d91f738bd8
Please note that this information is for use by system services only! The clock facility is not ready to be used directly by userland, and thus, this kernel page extension is NOT part of the userland ABI. For service programmers' convenience, change the prototype of the getticks(3) to return the uptime clock value directly, since the call can no longer fail. Correct the sys_times(2) reply message to use the right field type for the boot time. Restructure the kernel internals a bit so as to have all the clock stuff closer together. Change-Id: Ifc050b7bd253aecbe46e3bd7d7cc75bd86e45555
22 lines
622 B
C
22 lines
622 B
C
#include "sysutil.h"
|
|
|
|
/*
|
|
* Retrieve the system's uptime (number of clock ticks since system boot),
|
|
* real time (corrected number of clock ticks since system boot), and
|
|
* boot time (in number of seconds since the UNIX epoch).
|
|
*/
|
|
int
|
|
getuptime(clock_t * uptime, clock_t * realtime, time_t * boottime)
|
|
{
|
|
struct minix_kerninfo *minix_kerninfo;
|
|
|
|
minix_kerninfo = get_minix_kerninfo();
|
|
|
|
/* We assume atomic 32-bit field retrieval. TODO: 64-bit support. */
|
|
*uptime = minix_kerninfo->kclockinfo->uptime;
|
|
*realtime = minix_kerninfo->kclockinfo->realtime;
|
|
*boottime = minix_kerninfo->kclockinfo->boottime;
|
|
|
|
return OK;
|
|
}
|