File: uwrap_fake_socket_wrapper.c

package info (click to toggle)
uid-wrapper 1.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 544 kB
  • sloc: ansic: 5,785; sh: 21; makefile: 8
file content (44 lines) | stat: -rw-r--r-- 761 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "config.h"

#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>

#include <stdbool.h>
#include <string.h>
#include <sys/time.h>
#include <unistd.h>
#include <errno.h>

#ifdef HAVE_SYS_SYSCALL_H
#include <sys/syscall.h>
#endif
#ifdef HAVE_SYSCALL_H
#include <syscall.h>
#endif

#include "uwrap_fake_socket_wrapper.h"

/* simulate socket_wrapper hooks */
bool socket_wrapper_syscall_valid(long int sysno)
{
	if (sysno >= __FAKE_SOCKET_WRAPPER_SYSCALL_NO) {
		return true;
	}

	return false;
}

long int socket_wrapper_syscall_va(long int sysno, va_list va)
{
	(void) va; /* unused */

	if (sysno == __FAKE_SOCKET_WRAPPER_SYSCALL_NO) {
		errno = 0;
		return __FAKE_SOCKET_WRAPPER_SYSCALL_RC;
	}

	errno = ENOSYS;
	return -1;
}