From 835dea0eb6333a9ef452881ea073bfe59d14096a Mon Sep 17 00:00:00 2001 From: Nicholas Noll Date: Thu, 18 Nov 2021 17:49:04 -0800 Subject: feat: continued filling out system layer --- sys/linux/port/os/constants.h | 2 ++ sys/linux/port/os/types.h | 41 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 1 deletion(-) (limited to 'sys/linux') diff --git a/sys/linux/port/os/constants.h b/sys/linux/port/os/constants.h index 8abf1fa..8fb913f 100644 --- a/sys/linux/port/os/constants.h +++ b/sys/linux/port/os/constants.h @@ -23,6 +23,8 @@ #define sys·ModeLink 0120000 #define sys·ModeSocket 0140000 +/* ioctl values */ + /* mmap */ #define sys·ProtNone 0 #define sys·ProtRead 1 diff --git a/sys/linux/port/os/types.h b/sys/linux/port/os/types.h index 6e5c0c6..e772b35 100644 --- a/sys/linux/port/os/types.h +++ b/sys/linux/port/os/types.h @@ -1,4 +1,5 @@ #pragma once +#define packed __attribute__((packed)) /* * time @@ -6,6 +7,7 @@ /* timeval */ typedef struct sys·TimeStamp sys·TimeStamp; +typedef struct sys·TimeValue sys·TimeValue; struct sys·TimeStamp { @@ -14,6 +16,41 @@ struct sys·TimeStamp int32 femto; }; +struct sys·TimeValue +{ + int64 sec; + int64 micro; +}; + +/* resource */ +typedef struct sys·UsageInfo sys·UsageInfo; + +/* rusage */ +struct sys·UsageInfo +{ + sys·TimeValue cpu; + sys·TimeValue sys; + /* linux extensions */ + long maxrss; /* maximum resident set size */ + long ixrss; /* integral shared memory size */ + long idrss; /* integral unshared data size */ + long isrss; /* integral unshared stack size */ + struct packed { + long minor; /* page reclaims (soft page faults) */ + long major; /* page faults (hard page faults) */ + }fault; + long nswap; /* swaps */ + long iblk; /* block input operations */ + long oblk; /* block output operations */ + long msgsent; /* IPC messages sent */ + long msgrcvd; /* IPC messages received */ + long nsignal; /* signals received */ + long nvctxsw; /* voluntary context switches */ + long nictxsw; /* involuntary context switches */ + /* room for more... */ + long __reserved[16]; +}; + /* * files */ @@ -40,7 +77,7 @@ struct sys·Info sys·TimeStamp access, create, status, modify; - struct{ + struct packed{ uint32 major; uint32 minor; }spdev; @@ -70,3 +107,5 @@ struct sys·DirEntry uchar type; /* filetype */ char name[]; /* filename */ }; + +#undef packed -- cgit v1.2.1