From ede887c1b1d1700bc36da685788d96a19a5d2065 Mon Sep 17 00:00:00 2001 From: Nathan Wagner Date: Mon, 24 Oct 2016 20:29:49 -0500 Subject: [PATCH] system include headers --- include/stdlib.h | 8 ++++++++ include/sys/types.h | 40 ++++++++++++++++++++++++++++++++++++++++ include/time.h | 30 ++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 include/stdlib.h create mode 100644 include/sys/types.h create mode 100644 include/time.h diff --git a/include/stdlib.h b/include/stdlib.h new file mode 100644 index 0000000..46fb129 --- /dev/null +++ b/include/stdlib.h @@ -0,0 +1,8 @@ +#ifndef STDLIB_H_ +#define STDLIB_H_ 1 + +#include "mem.h" + +#define malloc(s) koalloc(s) + +#endif diff --git a/include/sys/types.h b/include/sys/types.h new file mode 100644 index 0000000..bd08122 --- /dev/null +++ b/include/sys/types.h @@ -0,0 +1,40 @@ +#ifndef SYS_TYPES_H_ +#define SYS_TYPES_H_ 1 + +#include + +/* mode_t shall be an integer type. */ +typedef uint64_t mode_t; + +/* nlink_t, uid_t, gid_t, and id_t shall be integer types. */ +typedef uint64_t nlink_t; +typedef uint64_t uid_t; +typedef uint64_t gid_t; +typedef uint64_t id_t; + +/* blkcnt_t and off_t shall be signed integer types. */ +typedef int64_t blkcnt_t; +typedef int64_t off_t; + +/* [XSI] [Option Start] fsblkcnt_t, fsfilcnt_t, [Option End] and ino_t shall + * be defined as unsigned integer types. + */ +typedef uint64_t fsblkcnt_t; +typedef uint64_t fsfilcnt_t; +typedef uint64_t ino_t; + +/* size_t shall be an unsigned integer type. */ +typedef uint64_t size_t; + +/* blksize_t, pid_t, and ssize_t shall be signed integer types. */ +typedef int64_t blksize_t; +typedef int64_t pid_t; +typedef int64_t ssize_t; + +/* time_t and clock_t shall be integer or real-floating types. */ +typedef uint64_t clock_t; +typedef uint64_t time_t; + +typedef uint64_t dev_t; + +#endif diff --git a/include/time.h b/include/time.h new file mode 100644 index 0000000..672e2a3 --- /dev/null +++ b/include/time.h @@ -0,0 +1,30 @@ +#ifndef _SYS_TIME_H_ +#define _SYS_TIME_H_ 1 + +/* we get to use the _ because we *are* the system header */ + +#include + +struct tm { + int tm_sec; /* seconds (0-60) */ + int tm_min; /* minutes (0-59) */ + int tm_hour; /* hours (0-23) */ + int tm_mday; /* day of the month (1-31) */ + int tm_mon; /* month (0-11) */ + int tm_year; /* year - 1900 */ + int tm_wday; /* day of the week (0-6, Sunday = 0) */ + int tm_yday; /* day in the year (0-365, 1 Jan = 0) */ + int tm_isdst; /* daylight saving time */ +}; + +struct timespec { + time_t tv_sec; + long tv_nsec; +}; + +struct itimerspec { + struct timespec it_interval; + struct timespec it_value; +}; + +#endif -- 2.40.0