libc: Add support for the new clock() system call
This commit is contained in:
parent
62a2bcf2ff
commit
b1739f7f0d
@ -16,6 +16,7 @@
|
||||
#define SYS_exec 12
|
||||
#define SYS_fcntl 13
|
||||
#define SYS_mprotect 14
|
||||
#define SYS_clock 15
|
||||
|
||||
#ifndef __want_syscalls
|
||||
#ifdef __cplusplus
|
||||
|
@ -0,0 +1,22 @@
|
||||
#ifndef _TIME_H
|
||||
#define _TIME_H
|
||||
|
||||
typedef long int clock_t;
|
||||
typedef long int time_t;
|
||||
|
||||
#define CLOCKS_PER_SEC 1000
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/* Returns a number representing how much CPU time has been used by this process. Divide this by CLOCKS_PER_SEC to
|
||||
* get the value in seconds. */
|
||||
clock_t clock(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
11
libs/libc/src/time.cpp
Normal file
11
libs/libc/src/time.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include <sys/syscall.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
clock_t clock()
|
||||
{
|
||||
return syscall(SYS_clock);
|
||||
}
|
||||
}
|
@ -32,6 +32,7 @@ extern "C"
|
||||
va_start(ap, number);
|
||||
switch (number)
|
||||
{
|
||||
case SYS_clock:
|
||||
case SYS_yield:
|
||||
case SYS_gettid: result = __luna_syscall0(number); break;
|
||||
case SYS_exit:
|
||||
|
Loading…
Reference in New Issue
Block a user