BarryServer : Git

All the code for all my projects
// BarryServer : Git / OrionLibC / commit / ad9b6af63f1fdfcf3556c9b2fc670f72cdc60ab4 / include

// Related

OrionLibC

Barry Updating libc for pipes and signals ad9b6af (2 years, 2 months ago)
diff --git a/include/errno.h b/include/errno.h
index b47e18c..614f13d 100644
--- a/include/errno.h
+++ b/include/errno.h
@@ -21,6 +21,9 @@ enum {
 	ENOMEM,
 	ECHILD,
 	ENOTTY,
+	ELOOP,
+	ENAMETOOLONG,
+	EINTR,
 };
 
 extern int errno;
diff --git a/include/signal.h b/include/signal.h
index 3999125..84535e8 100644
--- a/include/signal.h
+++ b/include/signal.h
@@ -11,6 +11,15 @@ typedef __sigset_t sigset_t;
 typedef int sig_atomic_t;
 #endif
 
+typedef void (*sighandler_t)(int);
+
+#define SIG_ERR (sighandler_t) -1
+#define SIG_IGNORE 0
+#define SIG_DFL 1
+#define SIG_BLOCK 2
+#define SIG_UNBLOCK 3
+#define SIG_SETMASK 4
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -25,12 +34,12 @@ enum Signals {
 	SIGKILL,
 	SIGSEGV,
 	SIGPIPE,
-	
 };
 
-void (*signal(int sig, void (*func)(int)))(int);
 int tgkill(pid_t tgid, pid_t tid, int sig);
 int kill(pid_t pid, int sig);
+sighandler_t signal(int signum, sighandler_t handler);
+int sigprocmask(int how, const sigset_t *set, sigset_t *oldset);
 
 #ifdef __cplusplus
 }
diff --git a/include/sys/sched.h b/include/sys/sched.h
index fe17753..2e3013f 100644
--- a/include/sys/sched.h
+++ b/include/sys/sched.h
@@ -5,13 +5,14 @@
 
 /* Flags for clone syscall */
 enum CloneFlag {
-	CLONE_NONE   = (1 << 0),
-	CLONE_PARENT = (1 << 1),
-	CLONE_THREAD = (1 << 2),
-	CLONE_FILES  = (1 << 3),
-	CLONE_FS     = (1 << 4),
-	CLONE_VM     = (1 << 5),
-	CLONE_IPC    = (1 << 6), // TODO: Add IPC namespace
+	CLONE_NONE    = (1 << 0),
+	CLONE_PARENT  = (1 << 1),
+	CLONE_THREAD  = (1 << 2),
+	CLONE_FILES   = (1 << 3),
+	CLONE_FS      = (1 << 4),
+	CLONE_VM      = (1 << 5),
+	CLONE_SIGHAND = (1 << 6),
+	CLONE_IPC     = (1 << 7), // TODO: Add IPC namespace
 };
 
 pid_t clone(int flags);
diff --git a/include/sys/syscall.h b/include/sys/syscall.h
index d732c59..d34101a 100644
--- a/include/sys/syscall.h
+++ b/include/sys/syscall.h
@@ -19,6 +19,8 @@ enum SystemCall {
 	SYSCALL_WAITPID,
 	SYSCALL_TGKILL,
 	SYSCALL_KILL,
+	SYSCALL_SIGNAL,
+	SYSCALL_SIGPROCMASK,
 	SYSCALL_TIME,
 	SYSCALL_TIMES,
 	SYSCALL_SLEEP,
@@ -40,6 +42,7 @@ enum SystemCall {
 	SYSCALL_DUP,
 	SYSCALL_DUP2,
 	SYSCALL_ISATTY,
+	SYSCALL_PIPE,
 
 	/* File System */
 	SYSCALL_MOUNT,
diff --git a/include/sys/time.h b/include/sys/time.h
new file mode 100644
index 0000000..e528978
--- /dev/null
+++ b/include/sys/time.h
@@ -0,0 +1,11 @@
+#ifndef _SYS_TIME_H
+#define _SYS_TIME_H
+
+#include <sys/types.h>
+
+struct timeval {
+	time_t tv_sec;
+	suseconds_t tv_usec;
+};
+
+#endif
diff --git a/include/sys/types.h b/include/sys/types.h
index f8d727a..42ad07c 100644
--- a/include/sys/types.h
+++ b/include/sys/types.h
@@ -10,5 +10,7 @@ typedef int off_t;
 typedef int mode_t;
 typedef int nlink_t;
 typedef int refcount_t;
+typedef unsigned int time_t;
+typedef unsigned int suseconds_t;
 
 #endif
diff --git a/include/time.h b/include/time.h
index 24dee55..c325424 100644
--- a/include/time.h
+++ b/include/time.h
@@ -2,8 +2,7 @@
 #define _TIME_H
 
 #include <stdint.h>
-
-typedef uint32_t time_t;
+#include <sys/types.h>
 
 int sleep(uint32_t ms);
 time_t time(time_t *tloc);
diff --git a/include/unistd.h b/include/unistd.h
index c250e84..452cc36 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -31,9 +31,10 @@ int isatty(int fd);
 int close(int fd);
 int dup(int oldfd);
 int dup2(int oldfd, int newfd);
-size_t read(int fd, void *buf, size_t count);
-size_t write(int fd, void *buf, size_t count);
+int read(int fd, void *buf, size_t count);
+int write(int fd, void *buf, size_t count);
 off_t lseek(int fd, off_t offset, int whence);
+int pipe(int pipefd[2]);
 int rmdir(const char *pathname);
 int chroot(const char *path);
 int chdir(const char *path);