blob: 14621e979743e2d9c86e260c149d2faf54ae7af4 [file] [log] [blame]
// Copyright 2013 Google Inc. All Rights Reserved.
//
// This file defines system calls NaCl does not support but nacl-glibc
// does have implementations which return -1 with ENOSYS.
//
// This file should be used only for syscalls which are not defined in
// third_party/nacl-glibc/sysdeps/nacl. Such system calls are defined
// in GPL code so you cannot use NACL MOD TRACK for them.
//
#include <errno.h>
#include <grp.h>
#include <pthread.h>
#include <sched.h>
#include <signal.h>
#include <stdint.h>
#include <stdio.h>
#include <sys/inotify.h>
#include <sys/mman.h>
#include <sys/prctl.h>
#include <sys/resource.h>
#include <sys/select.h>
#include <sys/sendfile.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <sys/utsname.h>
#include <unistd.h>
#include <utime.h>
#include <irt_syscalls.h>
#define DEFINE_ENOSYS_SYSCALL(ret, name, ...) \
ret name(__VA_ARGS__) { \
errno = ENOSYS; \
return (ret) -1; \
}
DEFINE_ENOSYS_SYSCALL(void *, __brk, void *addr)
DEFINE_ENOSYS_SYSCALL(int, __fcntl64, int fd, int cmd, ...)
DEFINE_ENOSYS_SYSCALL(pid_t, __fork, void)
DEFINE_ENOSYS_SYSCALL(long, __ptrace, int request, pid_t pid,
void *addr, void *data)
DEFINE_ENOSYS_SYSCALL(int, __sigsuspend, const sigset_t *mask)
DEFINE_ENOSYS_SYSCALL(int, execve, const char *filename, char *const argv[],
char *const envp[])
DEFINE_ENOSYS_SYSCALL(pid_t, fork, void)
DEFINE_ENOSYS_SYSCALL(pid_t, getpgid, pid_t pid)
DEFINE_ENOSYS_SYSCALL(pid_t, getppid, void)
DEFINE_ENOSYS_SYSCALL(int, getrusage, int who, struct rusage *usage)
DEFINE_ENOSYS_SYSCALL(int, getrlimit, int resource, struct rlimit *rlim)
DEFINE_ENOSYS_SYSCALL(int, inotify_add_watch, int fd, const char *pathname,
uint32_t mask)
DEFINE_ENOSYS_SYSCALL(int, inotify_init, void)
DEFINE_ENOSYS_SYSCALL(int, inotify_rm_watch, int fd, uint32_t wd)
DEFINE_ENOSYS_SYSCALL(int, madvise, const void *addr, size_t length,
int advice)
DEFINE_ENOSYS_SYSCALL(int, mincore, void *addr, size_t length,
unsigned char *vec)
DEFINE_ENOSYS_SYSCALL(int, msync, const void *addr, size_t length, int flags)
DEFINE_ENOSYS_SYSCALL(int, personality, unsigned long persona)
DEFINE_ENOSYS_SYSCALL(int, prctl,
int option, ...)
DEFINE_ENOSYS_SYSCALL(int, pthread_kill, pthread_t thread, int sig)
DEFINE_ENOSYS_SYSCALL(int, pthread_sigmask,
int how, const sigset_t *set, sigset_t *oldset)
DEFINE_ENOSYS_SYSCALL(int, readv, int fd, const struct iovec *iov, int iovcnt)
DEFINE_ENOSYS_SYSCALL(int, sched_getparam,
pid_t pid, struct sched_param *param)
DEFINE_ENOSYS_SYSCALL(int, sched_getscheduler, pid_t pid)
DEFINE_ENOSYS_SYSCALL(int, sched_setscheduler,
pid_t pid, int policy, const struct sched_param *param)
DEFINE_ENOSYS_SYSCALL(int, setgid, gid_t gid)
DEFINE_ENOSYS_SYSCALL(int, setgroups, size_t size, const gid_t *list)
DEFINE_ENOSYS_SYSCALL(int, setitimer, int which,
const struct itimerval *new_value,
struct itimerval *old_value)
DEFINE_ENOSYS_SYSCALL(int, setpgid, pid_t pid, pid_t pgid)
DEFINE_ENOSYS_SYSCALL(int, setpriority, int which, int who, int prio)
DEFINE_ENOSYS_SYSCALL(int, setresgid, gid_t rgid, gid_t egid, gid_t sgid)
DEFINE_ENOSYS_SYSCALL(int, setsid, void)
DEFINE_ENOSYS_SYSCALL(int, settimeofday, const struct timeval *tv,
const struct timezone *tz)
DEFINE_ENOSYS_SYSCALL(int, sigprocmask,
int how, const sigset_t *set, sigset_t *oldset)
DEFINE_ENOSYS_SYSCALL(mode_t, umask, mode_t mask)
DEFINE_ENOSYS_SYSCALL(int, umount2, const char *target, int flags)
DEFINE_ENOSYS_SYSCALL(int, uname, struct utsname *buf)
DEFINE_ENOSYS_SYSCALL(int, unlinkat,
int dirfd, const char *pathname, int flags)
DEFINE_ENOSYS_SYSCALL(int, unshare, int flags)
DEFINE_ENOSYS_SYSCALL(pid_t, vfork, void)