From 89dcdd7ce4fc952bb0e91fdb814a2b2b3bb0f3e9 Mon Sep 17 00:00:00 2001
From: Alberto Bertogli <albertito@blitiri.com.ar>
Date: Fri, 19 Jun 2009 13:29:31 -0300
Subject: [PATCH 46/48] preload/posix: Add more wrapped functions

This time stat() and friends, fork() and friends (including the wait()
family, and kill() which is not exactly a friend but more like a love-hate
relationship), signal() and sigaction().

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
---
 preload/posix/modules/posix.io.mod   |   22 ++++++++++++++++++
 preload/posix/modules/posix.proc.mod |   41 ++++++++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+), 0 deletions(-)
 create mode 100644 preload/posix/modules/posix.proc.mod

diff --git a/preload/posix/modules/posix.io.mod b/preload/posix/modules/posix.io.mod
index a01f629..23b99d4 100644
--- a/preload/posix/modules/posix.io.mod
+++ b/preload/posix/modules/posix.io.mod
@@ -84,6 +84,28 @@ int closedir(DIR *dirp);
 	valid errnos: EBADF
 
 
+fiu name base: posix/io/stat/
+
+include: <sys/types.h>
+include: <sys/stat.h>
+include: <unistd.h>
+
+int stat(const char *path, struct stat *buf);
+	on error: -1
+	valid errnos: EACCES EBADF EFAULT ELOOP ENAMETOOLONG ENOENT ENOMEM \
+		ENOTDIR EOVERFLOW
+
+int fstat(int fd, struct stat *buf);
+	on error: -1
+	valid errnos: EACCES EBADF EFAULT ELOOP ENAMETOOLONG ENOENT ENOMEM \
+		ENOTDIR EOVERFLOW
+
+int lstat(const char *path, struct stat *buf);
+	on error: -1
+	valid errnos: EACCES EBADF EFAULT ELOOP ENAMETOOLONG ENOENT ENOMEM \
+		ENOTDIR EOVERFLOW
+
+
 fiu name base: posix/io/net/
 
 int socket(int domain, int type, int protocol);
diff --git a/preload/posix/modules/posix.proc.mod b/preload/posix/modules/posix.proc.mod
new file mode 100644
index 0000000..1054513
--- /dev/null
+++ b/preload/posix/modules/posix.proc.mod
@@ -0,0 +1,41 @@
+
+include: <unistd.h>
+include: <errno.h>
+include: <sys/types.h>
+include: <sys/wait.h>
+include: <signal.h>
+
+fiu name base: posix/proc/
+
+pid_t fork(void);
+	on error: -1
+	valid errnos: EAGAIN ENOMEM
+
+pid_t wait(int *status);
+	on error: -1
+	valid errnos: ECHILD EINTR EINVAL
+
+pid_t waitpid(pid_t pid, int *status, int options);
+	on error: -1
+	valid errnos: ECHILD EINTR EINVAL
+
+int waitid(idtype_t idtype, id_t id, siginfo_t *infop, int options);
+	on error: -1
+	valid errnos: ECHILD EINTR EINVAL
+
+int kill(pid_t pid, int sig);
+	on error: -1
+	valid errnos: EINVAL EPERM ESRCH
+
+# We need to do this typedef because our parser is not smart enough to handle
+# the function definition without it
+v: typedef void (*sighandler_t)(int);
+sighandler_t signal(int signum, sighandler_t handler);
+	on error: SIG_ERR
+        valid errnos: EINVAL
+
+int sigaction(int signum, const struct sigaction *act, \
+		struct sigaction *oldact);
+	on error: -1
+	valid errnos: EFAULT EINVAL
+
-- 
1.6.2.2.646.gb214

