libc: add clock_getres()/clock_gettime() system calls.

In order to make it more clear that ticks should be used for timers
and realtime should be used for timestamps / displaying the date/time,
getuptime() was renamed to getticks() and getuptime2() was renamed to
getuptime().

Servers, drivers, libraries, tests, etc that use getuptime()/getuptime2()
have been updated. In instances where a realtime was calculated, the
calculation was changed to use realtime.

System calls clock_getres() and clock_gettime() were added to PM/libc.
This commit is contained in:
Thomas Cort
2013-04-04 15:04:53 +02:00
committed by Ben Gras
parent 5142b1f388
commit e67fc5771d
44 changed files with 182 additions and 62 deletions
+3 -1
View File
@@ -1,4 +1,4 @@
#define NCALLS 114 /* number of system calls allowed */
#define NCALLS 116 /* number of system calls allowed */
/* In case it isn't obvious enough: this list is sorted numerically. */
#define EXIT 1
@@ -102,6 +102,8 @@
#define GCOV_FLUSH 112 /* flush gcov data from server to gcov files */
#define PM_GETSID 113 /* PM getsid() */
#define CLOCK_GETRES 114 /* clock_getres() */
#define CLOCK_GETTIME 115 /* clock_gettime() */
#define TASK_REPLY 121 /* to VFS: reply code from drivers, not
* really a standalone call.
+2 -1
View File
@@ -488,7 +488,8 @@
#define T_USER_TIME m4_l1 /* user time consumed by process */
#define T_SYSTEM_TIME m4_l2 /* system time consumed by process */
#define T_BOOTTIME m4_l3 /* Boottime in seconds (also for SYS_STIME) */
#define T_BOOT_TICKS m4_l5 /* number of clock ticks since boot time */
#define T_REAL_TICKS m4_l4 /* number of wall clock ticks since boottime */
#define T_BOOT_TICKS m4_l5 /* number of hard clock ticks since boottime */
/* Field names for SYS_TRACE, SYS_PRIVCTL, SYS_STATECTL. */
#define CTL_ENDPT m2_i1 /* process number of the caller */
+2 -2
View File
@@ -49,8 +49,8 @@ int fkey_ctl(int req, int *fkeys, int *sfkeys);
int printf(const char *fmt, ...);
void kputc(int c);
__dead void panic(const char *fmt, ...);
int getuptime(clock_t *ticks);
int getuptime2(clock_t *ticks, time_t *boottime);
int getuptime(clock_t *ticks, clock_t *realtime, time_t *boottime);
int getticks(clock_t *ticks);
int tickdelay(clock_t ticks);
int tsc_calibrate(void);
u32_t sys_hz(void);
+1 -1
View File
@@ -158,11 +158,11 @@ struct sigevent;
struct itimerspec;
int clock_nanosleep(clockid_t, int, const struct timespec *, struct timespec *);
#ifndef __LIBC12_SOURCE__
#ifndef __minix
int clock_getres(clockid_t, struct timespec *)
__RENAME(__clock_getres50);
int clock_gettime(clockid_t, struct timespec *)
__RENAME(__clock_gettime50);
#ifndef __minix
int clock_settime(clockid_t, const struct timespec *)
__RENAME(__clock_settime50);
#endif /* !__minix */