forked from cloudius-systems/osv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
linux.cc
41 lines (35 loc) · 892 Bytes
/
linux.cc
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
/*
* Copyright (C) 2013 Cloudius Systems, Ltd.
*
* This work is open source software, licensed under the terms of the
* BSD license as described in the LICENSE file in the top-level directory.
*/
// linux syscalls
#include "debug.hh"
#include <boost/format.hpp>
#include "sched.hh"
#include <syscall.h>
#include <stdarg.h>
#include <time.h>
long gettid()
{
return sched::thread::current()->id();
}
long syscall(long number, ...)
{
switch (number) {
case __NR_gettid: return gettid();
case __NR_clock_gettime: {
va_list args;
clockid_t arg1;
struct timespec *arg2;
va_start(args, number);
arg1 = va_arg(args, typeof(arg1));
arg2 = va_arg(args, typeof(arg2));
va_end(args);
return clock_gettime(arg1, arg2);
}
}
debug("syscall(): unimplemented system call %d\n", number);
abort();
}