65816-llvm-mos/runtime/include/sys/times.h
2026-07-07 18:33:48 -05:00

25 lines
1,005 B
C

// sys/times.h -- process CPU-time accounting for the GNO/ME runtime.
//
// Layout byte-matches GNO's own <sys/times.h> (tools/gno kernel fills it):
// four clock_t fields, clock_t == unsigned long (32-bit) on this target,
// so sizeof(struct tms) == 16 on both sides. times() maps to the GNO
// kernel Ktimes primitive (toolset $03, func $35), which fills utime/cutime
// with the process' 60 Hz tick counts and leaves stime/cstime zero.
#ifndef _SYS_TIMES_H
#define _SYS_TIMES_H
// Single source of truth for clock_t (avoids a duplicate typedef).
#include <time.h>
struct tms {
clock_t tms_utime; // user CPU time (60 Hz ticks) for this process
clock_t tms_stime; // system CPU time (always 0 under GNO)
clock_t tms_cutime; // user CPU time of reaped child processes
clock_t tms_cstime; // system CPU time of reaped children (always 0)
};
_Static_assert(sizeof(struct tms) == 16, "struct tms must match GNO kernel layout");
clock_t times(struct tms *buf);
#endif