summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_common_syscalls.inc
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2013-04-16 13:06:20 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2013-04-16 13:06:20 +0000
commitfa568969fea365a04591d029974b5c93e2cc9867 (patch)
treeab448881dc41b8deec73781c5a2cdd79f9a57abc /lib/sanitizer_common/sanitizer_common_syscalls.inc
parent6d0b7f6c41bed64419dd74a8daf83de5e9f54de9 (diff)
[sanitizer] Implement wait4 and waitpid syscall hooks.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@179592 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_common_syscalls.inc')
-rw-r--r--lib/sanitizer_common/sanitizer_common_syscalls.inc38
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/sanitizer_common/sanitizer_common_syscalls.inc b/lib/sanitizer_common/sanitizer_common_syscalls.inc
index 8f9659019..753f80fa1 100644
--- a/lib/sanitizer_common/sanitizer_common_syscalls.inc
+++ b/lib/sanitizer_common/sanitizer_common_syscalls.inc
@@ -56,6 +56,16 @@ struct sanitizer_kernel_msghdr {
unsigned msg_flags;
};
+struct sanitizer_kernel_timeval {
+ long tv_sec;
+ long tv_usec;
+};
+
+struct sanitizer_kernel_rusage {
+ struct sanitizer_kernel_timeval ru_timeval[2];
+ long ru_long[14];
+};
+
PRE_SYSCALL(recvmsg)(int sockfd, struct sanitizer_kernel_msghdr *msg,
int flags) {
PRE_READ(msg, sizeof(*msg));
@@ -92,6 +102,34 @@ POST_SYSCALL(getdents64)(long res, int fd, void *dirp, int count) {
POST_WRITE(dirp, res);
}
+PRE_SYSCALL(wait4)(int pid, int *status, int options,
+ struct sanitizer_kernel_rusage *r) {
+ if (status)
+ PRE_WRITE(status, sizeof(*status));
+ if (r)
+ PRE_WRITE(r, sizeof(*r));
+}
+
+POST_SYSCALL(wait4)(long res, int pid, int *status, int options,
+ struct sanitizer_kernel_rusage *r) {
+ if (res > 0) {
+ if (status)
+ POST_WRITE(status, sizeof(*status));
+ if (r)
+ POST_WRITE(r, sizeof(*r));
+ }
+}
+
+PRE_SYSCALL(waitpid)(int pid, int *status, int options) {
+ if (status)
+ PRE_WRITE(status, sizeof(*status));
+}
+
+POST_SYSCALL(waitpid)(long res, int pid, int *status, int options) {
+ if (res > 0 && status)
+ POST_WRITE(status, sizeof(*status));
+}
+
} // extern "C"
#undef PRE_SYSCALL