1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef SANDBOX_LINUX_SERVICES_SYSCALL_WRAPPERS_H_
6 #define SANDBOX_LINUX_SERVICES_SYSCALL_WRAPPERS_H_
10 #include "sandbox/sandbox_export.h"
17 // Provide direct system call wrappers for a few common system calls.
18 // These are guaranteed to perform a system call and do not rely on things such
19 // as caching the current pid (c.f. getpid()) unless otherwise specified.
21 SANDBOX_EXPORT pid_t
sys_getpid(void);
23 SANDBOX_EXPORT pid_t
sys_gettid(void);
25 SANDBOX_EXPORT
long sys_clone(unsigned long flags
);
27 // |regs| is not supported and must be passed as nullptr. |child_stack| must be
28 // nullptr, since otherwise this function cannot safely return. As a
29 // consequence, this function does not support CLONE_VM.
30 SANDBOX_EXPORT
long sys_clone(unsigned long flags
,
31 decltype(nullptr) child_stack
,
34 decltype(nullptr) regs
);
36 SANDBOX_EXPORT
void sys_exit_group(int status
);
38 // The official system call takes |args| as void* (in order to be extensible),
39 // but add more typing for the cases that are currently used.
40 SANDBOX_EXPORT
int sys_seccomp(unsigned int operation
,
42 const struct sock_fprog
* args
);
44 // Some libcs do not expose a prlimit64 wrapper.
45 SANDBOX_EXPORT
int sys_prlimit64(pid_t pid
,
47 const struct rlimit64
* new_limit
,
48 struct rlimit64
* old_limit
);
50 } // namespace sandbox
52 #endif // SANDBOX_LINUX_SERVICES_SYSCALL_WRAPPERS_H_