diff options
author | Anton Kling <anton@kling.gg> | 2023-10-22 19:50:38 +0200 |
---|---|---|
committer | Anton Kling <anton@kling.gg> | 2023-10-22 19:50:38 +0200 |
commit | 4e09bca9e34c226b6d7e34b4fa11248405fd988e (patch) | |
tree | 80f156b7940d9d19971395f335530170c69516c7 /userland/libc/include/sys |
Move everything into a new repo.
Diffstat (limited to 'userland/libc/include/sys')
-rw-r--r-- | userland/libc/include/sys/ioctl.h | 10 | ||||
-rw-r--r-- | userland/libc/include/sys/mman.h | 15 | ||||
-rw-r--r-- | userland/libc/include/sys/mount.h | 0 | ||||
-rw-r--r-- | userland/libc/include/sys/resource.h | 0 | ||||
-rw-r--r-- | userland/libc/include/sys/socket.h | 0 | ||||
-rw-r--r-- | userland/libc/include/sys/stat.h | 31 | ||||
-rw-r--r-- | userland/libc/include/sys/statvfs.h | 0 | ||||
-rw-r--r-- | userland/libc/include/sys/syscall.h | 0 | ||||
-rw-r--r-- | userland/libc/include/sys/time.h | 41 | ||||
-rw-r--r-- | userland/libc/include/sys/times.h | 0 | ||||
-rw-r--r-- | userland/libc/include/sys/types.h | 28 | ||||
-rw-r--r-- | userland/libc/include/sys/ucontext.h | 0 | ||||
-rw-r--r-- | userland/libc/include/sys/un.h | 0 | ||||
-rw-r--r-- | userland/libc/include/sys/utsname.h | 0 | ||||
-rw-r--r-- | userland/libc/include/sys/wait.h | 0 |
15 files changed, 125 insertions, 0 deletions
diff --git a/userland/libc/include/sys/ioctl.h b/userland/libc/include/sys/ioctl.h new file mode 100644 index 0000000..a373a4b --- /dev/null +++ b/userland/libc/include/sys/ioctl.h @@ -0,0 +1,10 @@ +#ifndef IOCTL_H +#define IOCTL_H +#define TIOCGWINSZ 0 +struct winsize { + unsigned short ws_row; + unsigned short ws_col; + unsigned short ws_xpixel; + unsigned short ws_ypixel; +}; +#endif // IOCTL_H diff --git a/userland/libc/include/sys/mman.h b/userland/libc/include/sys/mman.h new file mode 100644 index 0000000..7dfe29a --- /dev/null +++ b/userland/libc/include/sys/mman.h @@ -0,0 +1,15 @@ +#ifndef MMAP_H +#define MMAP_H +#include <stdint.h> +#include <stddef.h> + +#define PROT_READ (1 << 0) +#define PROT_WRITE (1 << 1) + +#define MAP_PRIVATE (1 << 0) +#define MAP_ANONYMOUS (1<< 1) +#define MAP_SHARED (1<< 2) + +void *mmap(void *addr, size_t length, int prot, int flags, int fd, + size_t offset); +#endif diff --git a/userland/libc/include/sys/mount.h b/userland/libc/include/sys/mount.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/userland/libc/include/sys/mount.h diff --git a/userland/libc/include/sys/resource.h b/userland/libc/include/sys/resource.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/userland/libc/include/sys/resource.h diff --git a/userland/libc/include/sys/socket.h b/userland/libc/include/sys/socket.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/userland/libc/include/sys/socket.h diff --git a/userland/libc/include/sys/stat.h b/userland/libc/include/sys/stat.h new file mode 100644 index 0000000..178d014 --- /dev/null +++ b/userland/libc/include/sys/stat.h @@ -0,0 +1,31 @@ +#ifndef STAT_H +#define STAT_H +#include <sys/types.h> +#include <time.h> + +struct stat { + dev_t st_dev; // Device ID of device containing file. + ino_t st_ino; // File serial number. + mode_t st_mode; // Mode of file (see below). + nlink_t st_nlink; // Number of hard links to the file. + uid_t st_uid; // User ID of file. + gid_t st_gid; // Group ID of file. + dev_t st_rdev; // Device ID (if file is character or block special). + off_t st_size; // For regular files, the file size in bytes. + // For symbolic links, the length in bytes of the + // pathname contained in the symbolic link. + // For a shared memory object, the length in bytes. + // For a typed memory object, the length in bytes. + // For other file types, the use of this field is + // unspecified. + struct timespec st_atime; // Last data access timestamp. + struct timespec st_mtime; // Last data modification timestamp. + struct timespec st_ctime; // Last file status change timestamp. + blksize_t st_blksize; // A file system-specific preferred I/O block size + // for this object. In some file system types, this + // may vary from file to file. + blkcnt_t st_blocks; // Number of blocks allocated for this object. +}; +int stat(const char *path, struct stat *buf); +int mkdir(const char *path, mode_t mode); +#endif diff --git a/userland/libc/include/sys/statvfs.h b/userland/libc/include/sys/statvfs.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/userland/libc/include/sys/statvfs.h diff --git a/userland/libc/include/sys/syscall.h b/userland/libc/include/sys/syscall.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/userland/libc/include/sys/syscall.h diff --git a/userland/libc/include/sys/time.h b/userland/libc/include/sys/time.h new file mode 100644 index 0000000..a675d9e --- /dev/null +++ b/userland/libc/include/sys/time.h @@ -0,0 +1,41 @@ +#ifndef TIME_H +#define TIME_H +#include <stddef.h> +#include <sys/types.h> +#include <time.h> + +#define CLOCK_REALTIME 0 + +struct tm { + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + long __tm_gmtoff; + const char *__tm_zone; +}; + +typedef int clockid_t; +struct timespec { + time_t tv_sec; // Seconds. + long tv_nsec; // Nanoseconds. +}; + +struct timeval { + time_t tv_sec; + suseconds_t tv_usec; +}; + +time_t time(time_t *tloc); +int clock_gettime(clockid_t clock_id, struct timespec *tp); +struct tm *localtime(const time_t *timer); +struct tm *gmtime(const time_t *timer); +size_t strftime(char *restrict s, size_t maxsize, const char *restrict format, + const struct tm *restrict timeptr); +int gettimeofday(struct timeval *tp, void *tzp); +#endif diff --git a/userland/libc/include/sys/times.h b/userland/libc/include/sys/times.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/userland/libc/include/sys/times.h diff --git a/userland/libc/include/sys/types.h b/userland/libc/include/sys/types.h new file mode 100644 index 0000000..48c57f9 --- /dev/null +++ b/userland/libc/include/sys/types.h @@ -0,0 +1,28 @@ +#ifndef TYPES_H +#define TYPES_H +typedef unsigned int ino_t; + +typedef int mode_t; + +typedef int nlink_t; +typedef int uid_t; +typedef int gid_t; +typedef int id_t; + +typedef int blkcnt_t; +typedef int off_t; + +typedef int dev_t; +typedef unsigned int fsblkcnt_t; +typedef unsigned int fsfilcnt_t; +typedef unsigned int ino_t; +//typedef unsigned int size_t; + +typedef int blksize_t; +typedef int pid_t; +typedef int ssize_t; + +//typedef int clock_t; +typedef int time_t; +typedef unsigned int suseconds_t; +#endif diff --git a/userland/libc/include/sys/ucontext.h b/userland/libc/include/sys/ucontext.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/userland/libc/include/sys/ucontext.h diff --git a/userland/libc/include/sys/un.h b/userland/libc/include/sys/un.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/userland/libc/include/sys/un.h diff --git a/userland/libc/include/sys/utsname.h b/userland/libc/include/sys/utsname.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/userland/libc/include/sys/utsname.h diff --git a/userland/libc/include/sys/wait.h b/userland/libc/include/sys/wait.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/userland/libc/include/sys/wait.h |