1 /* -*-comment-start: "//";comment-end:""-*-
2 * GNU Mes --- Maxwell Equations of Software
3 * Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
5 * This file is part of GNU Mes.
7 * GNU Mes is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or (at
10 * your option) any later version.
12 * GNU Mes is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
21 #include <sys/resource.h>
24 link (char const *old_name, char const *new_name)
26 return _sys_call2 (SYS_link, (long)old_name, (long)new_name);
32 return _sys_call (SYS_getpid);
38 return _sys_call (SYS_getuid);
42 kill (pid_t pid, int signum)
44 return _sys_call2 (SYS_kill, (long)pid, (long)signum);
48 rename (char const *old_name, char const *new_name)
50 return _sys_call2 (SYS_rename, (long)old_name, (long)new_name);
54 mkdir (char const *file_name, mode_t mode)
56 return _sys_call2 (SYS_mkdir, (long)file_name, (long)mode);
62 return _sys_call1 (SYS_dup, (long)old);
68 return _sys_call (SYS_getgid);
74 signal (int signum, void * action)
77 signal (int signum, sighandler_t action)
80 return _sys_call2 (SYS_signal, signum, action);
84 signal (int signum, sighandler_t action)
87 _sys_call3 (SYS_rt_sigaction, signum, action, &old);
91 #error arch not supported
95 fcntl (int filedes, int command, ...)
98 va_start (ap, command);
99 int data = va_arg (ap, int);
100 int r = _sys_call3 (SYS_fcntl, (long)filedes, (long)command, (long)data);
106 pipe (int filedes[2])
108 return _sys_call1 (SYS_pipe, (long)filedes);
112 dup2 (int old, int new)
114 return _sys_call2 (SYS_dup2, (long)old, (long)new);
118 getrusage (int processes, struct rusage *rusage)
120 return _sys_call2 (SYS_getrusage, (long)processes, (long)rusage);
124 lstat (char const *file_name, struct stat *statbuf)
126 return _sys_call2 (SYS_lstat, (long)file_name, (long)statbuf);
130 nanosleep (const struct timespec *requested_time,
131 struct timespec *remaining)
133 return _sys_call2 (SYS_nanosleep, (long)requested_time, (long)remaining);
137 setitimer (int which, struct itimerval const *new,
138 struct itimerval *old)
140 return _sys_call3 (SYS_setitimer, (long)which, (long)new, (long)old);
144 fstat (int fd, struct stat *statbuf)
146 return _sys_call2 (SYS_fstat, (long)fd, (long)statbuf);
150 getdents (long filedes, char *buffer, size_t nbytes)
152 return _sys_call3 (SYS_getdents, (long)filedes, (long)buffer, (long)nbytes);