The Pedigree Project 0.1
system-syscalls.h
1/*
2 * Copyright (c) 2008-2014, Pedigree Developers
3 *
4 * Please see the CONTRIB file in the root of the source tree for a full
5 * list of contributors.
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20#ifndef SYSTEM_SYSCALLS_H
21#define SYSTEM_SYSCALLS_H
22
23#include "pedigree/kernel/processor/Processor.h"
24#include "pedigree/kernel/processor/VirtualAddressSpace.h"
25#include "pedigree/kernel/processor/state.h"
26
27#include "logging.h"
28#include "wait-syscalls.h"
29#include <sys/types.h>
30
31// Forward-declare types.
32class File;
33bool posix_exec_file_readable(File* file);
34long posix_setfsuid(uid_t uid);
35long posix_setfsgid(gid_t gid);
36struct group;
38struct LinuxRlimit64;
39struct LinuxRusage64;
40struct passwd;
41struct timespec;
42
43uintptr_t posix_brk(uintptr_t theBreak);
44long posix_sbrk(int delta);
45SyscallState posix_copy_clone_state(const SyscallState& state);
46long posix_clone(SyscallState& state, unsigned long flags, void* child_stack, int* ptid, int* ctid,
47 unsigned long newtls, bool linuxAbi = false, bool clearSignalHandlers = false);
48int posix_fork(SyscallState& state);
49int posix_vfork(SyscallState& state);
50int posix_execve(const char* name, const char** argv, const char** env, SyscallState& state);
51int posix_getpid();
52int posix_getppid();
53
54int posix_gettimeofday(timeval* tv, struct timezone* tz);
55int posix_settimeofday(const timeval* tv, const struct timezone* tz);
56time_t posix_time(time_t* tval);
57clock_t posix_times(struct tms* tm);
58int posix_getrusage(int who, struct rusage* r);
59int posix_linux_getrusage(int who, LinuxRusage64* r);
60ssize_t posix_getrandom(void* buffer, size_t length, unsigned int flags);
61
62int posix_getpwent(passwd* pw, int n, char* str);
63int posix_getpwnam(passwd* pw, const char* name, char* str);
64uid_t posix_getuid();
65gid_t posix_getgid();
66uid_t posix_geteuid();
67gid_t posix_getegid();
68int posix_setuid(uid_t uid);
69int posix_setgid(gid_t gid);
70int posix_seteuid(uid_t euid);
71int posix_setegid(gid_t egid);
72
73size_t posix_alarm(uint32_t seconds);
74int posix_sleep(uint32_t seconds);
75int posix_usleep(size_t useconds);
76int posix_nanosleep(const struct timespec* rqtp, struct timespec* rmtp, bool time32 = false);
77int posix_clock_gettime(clockid_t clock_id, struct timespec* tp);
78int posix_clock_settime(clockid_t clock_id, const LinuxKernelTimespec* tp);
79int posix_clock_getres_native(clockid_t clock_id, struct timespec* resolution);
80int posix_clock_getres(clockid_t clock_id, LinuxKernelTimespec* resolution);
81int posix_clock_nanosleep(clockid_t clock_id, int flags, const LinuxKernelTimespec* request,
82 LinuxKernelTimespec* remainder);
83
84int pedigree_sigret();
85
86int posix_setsid();
87int posix_setpgid(int pid, int pgid);
88int posix_getpgrp();
89int posix_getpgid(int pid);
90
91mode_t posix_umask(mode_t mask);
92
93int posix_getgrnam(const char* name, struct group* out);
94int posix_getgrgid(gid_t id, struct group* out);
95
96int posix_linux_syslog(int type, char* buf, int len);
97int posix_syslog(const char* msg, int prio);
98
99int pedigree_login(int uid);
100
101int pedigree_reboot();
102int posix_reboot(uint32_t magic1, uint32_t magic2, uint32_t command);
103
104int posix_uname(struct utsname* n);
105
106int posix_prctl(int option, uint64_t arg2, uint64_t arg3, uint64_t arg4, uint64_t arg5);
107int posix_arch_prctl(int code, unsigned long addr);
108
109int posix_pause();
110
111int posix_setgroups(size_t size, const gid_t* list);
112int posix_getgroups(size_t size, gid_t* list);
113
114int posix_getrlimit(int resource, struct rlimit* rlim);
115int posix_setrlimit(int resource, const struct rlimit* rlim);
116int posix_prlimit64(int pid, int resource, const LinuxRlimit64* newLimit, LinuxRlimit64* oldLimit);
117int posix_membarrier(int command, unsigned int flags, int cpuId);
118int posix_getpriority(int which, int who, bool linuxAbi = false);
119int posix_setpriority(int which, int who, int prio);
120
121int posix_setreuid(uid_t ruid, uid_t euid);
122int posix_setregid(gid_t rgid, gid_t egid);
123
124int posix_setresuid(uid_t ruid, uid_t euid, uid_t suid);
125int posix_setresgid(gid_t rgid, gid_t egid, gid_t sgid);
126int posix_getresuid(uid_t* ruid, uid_t* euid, uid_t* suid);
127int posix_getresgid(gid_t* rgid, gid_t* egid, gid_t* sgid);
128
129int posix_get_robust_list(int pid, struct robust_list_head** head_ptr, size_t* len_ptr,
130 bool linuxAbi = false);
131int posix_set_robust_list(struct robust_list_head* head, size_t len, bool linuxAbi = false);
132
133int posix_ioperm(unsigned long from, unsigned long num, int turn_on);
134int posix_iopl(int level);
135
136int posix_getitimer(int which, struct itimerval* curr_value);
137int posix_setitimer(int which, const struct itimerval* new_value, struct itimerval* old_value);
138
139int posix_capget(void* hdrp, void* datap);
140int posix_capset(void* hdrp, const void* datap);
141
142#endif
Definition File.h:75