summaryrefslogtreecommitdiff
path: root/src/libc/include/sys
diff options
context:
space:
mode:
authordzwdz2023-08-24 19:10:35 +0200
committerdzwdz2023-08-24 19:10:35 +0200
commit3e09037780ca95633749be3acd52e817eed7f98c (patch)
tree83bcf5026cd4383809c81c5f38473a6b1e46755e /src/libc/include/sys
parent292b2386d766826b15f5ca084d37aa2c485fdda6 (diff)
libc: get most of binutils to compile
Diffstat (limited to 'src/libc/include/sys')
-rw-r--r--src/libc/include/sys/stat.h10
-rw-r--r--src/libc/include/sys/time.h8
-rw-r--r--src/libc/include/sys/types.h1
-rw-r--r--src/libc/include/sys/wait.h1
4 files changed, 19 insertions, 1 deletions
diff --git a/src/libc/include/sys/stat.h b/src/libc/include/sys/stat.h
index 343db55..b9d0e8b 100644
--- a/src/libc/include/sys/stat.h
+++ b/src/libc/include/sys/stat.h
@@ -38,6 +38,8 @@ struct stat {
#define S_ISGID 02000
#define S_ISVTX 01000
+#define S_IRUSR 0x400
+
/* inode(7) */
#define S_ISREG(m) ((m & S_IFMT) == S_IFREG)
#define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR)
@@ -54,7 +56,7 @@ int mkdir(const char *path, mode_t mode);
static inline mode_t umask(mode_t mask) {
(void)mask;
- __libc_panic("unimplemented");
+ return 0;
}
static inline int chmod(const char *path, mode_t mode) {
@@ -63,6 +65,12 @@ static inline int chmod(const char *path, mode_t mode) {
return -1;
}
+static inline int fchmod(int fd, mode_t mode) {
+ (void)fd; (void)mode;
+ errno = ENOSYS;
+ return -1;
+}
+
static inline int mknod(const char *path, mode_t mode, dev_t dev) {
(void)path; (void)mode; (void)dev;
errno = ENOSYS;
diff --git a/src/libc/include/sys/time.h b/src/libc/include/sys/time.h
index e69de29..54df6b3 100644
--- a/src/libc/include/sys/time.h
+++ b/src/libc/include/sys/time.h
@@ -0,0 +1,8 @@
+#pragma once
+#include <errno.h>
+#include <sys/types.h>
+
+struct timeval {
+ time_t tv_sec;
+ suseconds_t tv_usec;
+};
diff --git a/src/libc/include/sys/types.h b/src/libc/include/sys/types.h
index faf656a..2e7f54b 100644
--- a/src/libc/include/sys/types.h
+++ b/src/libc/include/sys/types.h
@@ -4,6 +4,7 @@
typedef long long off_t;
typedef int64_t time_t;
+typedef int64_t suseconds_t;
typedef uint64_t clock_t;
typedef int mode_t;
diff --git a/src/libc/include/sys/wait.h b/src/libc/include/sys/wait.h
index cff407e..5f0d2cc 100644
--- a/src/libc/include/sys/wait.h
+++ b/src/libc/include/sys/wait.h
@@ -10,4 +10,5 @@
#define WNOHANG 0
#define WUNTRACED 0
+pid_t wait(int *wstatus);
pid_t wait3(int *wstatus, int opts, struct rusage *rusage);