From 112eafe13c3628cad6e692179c064dbbc3be2d8b Mon Sep 17 00:00:00 2001 From: dzwdz Date: Fri, 9 Jun 2023 17:22:31 +0200 Subject: ports/dash: stub out everything needed for dash to compile --- src/user/lib/include/sys/resource.h | 2 ++ src/user/lib/include/sys/stat.h | 16 ++++++++++++++++ src/user/lib/include/sys/time.h | 0 src/user/lib/include/sys/times.h | 13 +++++++++++++ src/user/lib/include/sys/types.h | 1 + src/user/lib/include/sys/wait.h | 13 +++++++++++++ 6 files changed, 45 insertions(+) create mode 100644 src/user/lib/include/sys/resource.h create mode 100644 src/user/lib/include/sys/time.h create mode 100644 src/user/lib/include/sys/times.h (limited to 'src/user/lib/include/sys') diff --git a/src/user/lib/include/sys/resource.h b/src/user/lib/include/sys/resource.h new file mode 100644 index 0000000..4582ce0 --- /dev/null +++ b/src/user/lib/include/sys/resource.h @@ -0,0 +1,2 @@ +#pragma once +struct rusage {}; diff --git a/src/user/lib/include/sys/stat.h b/src/user/lib/include/sys/stat.h index 9b9523c..26c8323 100644 --- a/src/user/lib/include/sys/stat.h +++ b/src/user/lib/include/sys/stat.h @@ -1,4 +1,5 @@ #pragma once +#include #include #include #include // struct timespec @@ -33,6 +34,9 @@ struct stat { #define S_IFDIR 0040000 #define S_IFCHR 0020000 #define S_IFIFO 0010000 +#define S_ISUID 04000 +#define S_ISGID 02000 +#define S_ISVTX 01000 /* inode(7) */ #define S_ISREG(m) ((m & S_IFMT) == S_IFREG) @@ -49,6 +53,12 @@ static inline int fstat(int fd, struct stat *sb) { return -1; } +static inline int stat(const char *restrict path, struct stat *restrict sb) { + (void)path; (void)sb; + errno = ENOSYS; + return -1; +} + static inline int lstat(const char *restrict path, struct stat *restrict sb) { (void)path; (void)sb; errno = ENOSYS; @@ -56,6 +66,12 @@ static inline int lstat(const char *restrict path, struct stat *restrict sb) { } int mkdir(const char *path, mode_t mode); + +static inline mode_t umask(mode_t mask) { + (void)mask; + __libc_panic("unimplemented"); +} + static inline int chmod(const char *path, mode_t mode) { (void)path; (void)mode; errno = ENOSYS; diff --git a/src/user/lib/include/sys/time.h b/src/user/lib/include/sys/time.h new file mode 100644 index 0000000..e69de29 diff --git a/src/user/lib/include/sys/times.h b/src/user/lib/include/sys/times.h new file mode 100644 index 0000000..4a8d3ef --- /dev/null +++ b/src/user/lib/include/sys/times.h @@ -0,0 +1,13 @@ +#pragma once +#include + +struct tms { + clock_t tms_utime; + clock_t tms_stime; + clock_t tms_cutime; + clock_t tms_cstime; +}; + +static inline clock_t times(struct tms *buf) { + __libc_panic("unimplemented"); +} diff --git a/src/user/lib/include/sys/types.h b/src/user/lib/include/sys/types.h index 3b04988..faf656a 100644 --- a/src/user/lib/include/sys/types.h +++ b/src/user/lib/include/sys/types.h @@ -15,3 +15,4 @@ typedef int uid_t; typedef int gid_t; typedef int blksize_t; typedef int blkcnt_t; +typedef int pid_t; diff --git a/src/user/lib/include/sys/wait.h b/src/user/lib/include/sys/wait.h index e69de29..c71418c 100644 --- a/src/user/lib/include/sys/wait.h +++ b/src/user/lib/include/sys/wait.h @@ -0,0 +1,13 @@ +#pragma once +#include + +#define WIFSTOPPED(x) 0 +#define WEXITSTATUS(x) 0 +#define WIFEXITED(x) 0 +#define WSTOPSIG(x) 0 +#define WTERMSIG(x) 0 + +#define WNOHANG 0 +#define WUNTRACED 0 + +pid_t wait3(int *wstatus, int opts, struct rusage *rusage); -- cgit v1.2.3