Commit 54db444d authored by Alejandro Alvarado's avatar Alejandro Alvarado

Add getpid support re ticket 29659

parent 4c00ec87
......@@ -135,6 +135,9 @@ void tsocks_once(tsocks_once_t *o, void (*init_routine)(void));
#ifndef __NR_getdents64
#define __NR_getdents64 -21
#endif
#ifndef __NR_getpid
#define __NR_getpid -22
#endif
#define TSOCKS_NR_SOCKET __NR_socket
#define TSOCKS_NR_CONNECT __NR_connect
......@@ -157,6 +160,7 @@ void tsocks_once(tsocks_once_t *o, void (*init_routine)(void));
#define TSOCKS_NR_MEMFD_CREATE __NR_memfd_create
#define TSOCKS_NR_GETDENTS __NR_getdents
#define TSOCKS_NR_GETDENTS64 __NR_getdents64
#define TSOCKS_NR_GETPID __NR_getpid
/*
* Despite glibc providing wrappers for these calls for a long time
......
......@@ -467,6 +467,13 @@ static LIBC_SYSCALL_RET_TYPE handle_getdents64(va_list args)
return tsocks_libc_syscall(TSOCKS_NR_GETDENTS64, fd, dirp, count);
}
/*
* Handle getpid(2) syscall.
*/
static LIBC_SYSCALL_RET_TYPE handle_getpid(void)
{
return tsocks_libc_syscall(TSOCKS_NR_GETPID);
}
#endif /* __linux__ */
......@@ -595,6 +602,9 @@ LIBC_SYSCALL_RET_TYPE tsocks_syscall(long int number, va_list args)
case TSOCKS_NR_GETDENTS64:
ret = handle_getdents64(args);
break;
case TSOCKS_NR_GETPID:
ret = handle_getpid();
break;
#endif /* __linux__ */
default:
/*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment