Skip to content
Snippets Groups Projects
Commit d437a24e authored by Glauber Costa's avatar Glauber Costa Committed by Pekka Enberg
Browse files

linux: make write syscall available


The jemalloc memory allocator likes to bypass the libc when calling write, so
it calls the syscall directly. Let's make write available through this interface
as well.

Reviewed-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: default avatarGlauber Costa <glommer@cloudius-systems.com>
Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
parent c86c915b
No related branches found
No related tags found
No related merge requests found
...@@ -74,6 +74,19 @@ int futex(int *uaddr, int op, int val, const struct timespec *timeout, ...@@ -74,6 +74,19 @@ int futex(int *uaddr, int op, int val, const struct timespec *timeout,
long syscall(long number, ...) long syscall(long number, ...)
{ {
switch (number) { switch (number) {
case __NR_write: {
va_list args;
int arg1;
const void *arg2;
size_t arg3;
va_start(args, number);
arg1 = va_arg(args, typeof(arg1));
arg2 = va_arg(args, typeof(arg2));
arg3 = va_arg(args, typeof(arg3));
va_end(args);
return write(arg1, arg2, arg3);
}
case __NR_gettid: return gettid(); case __NR_gettid: return gettid();
case __NR_clock_gettime: { case __NR_clock_gettime: {
va_list args; va_list args;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment