};
static __attribute__((unused))
-void *sys_mmap(void *addr, size_t length, int prot, int flags, int fd,
- off_t offset)
+void *_sys_mmap(void *addr, size_t length, int prot, int flags, int fd,
+ off_t offset)
{
struct s390_mmap_arg_struct args = {
.addr = (unsigned long)addr,
return (void *)__nolibc_syscall1(__NR_mmap, &args);
}
-#define sys_mmap sys_mmap
+#define _sys_mmap _sys_mmap
static __attribute__((unused))
-pid_t sys_fork(void)
+pid_t _sys_fork(void)
{
return __nolibc_syscall5(__NR_clone, 0, SIGCHLD, 0, 0, 0);
}
-#define sys_fork sys_fork
+#define _sys_fork _sys_fork
static __attribute__((unused))
-pid_t sys_vfork(void)
+pid_t _sys_vfork(void)
{
return __nolibc_syscall5(__NR_clone, 0, CLONE_VM | CLONE_VFORK | SIGCHLD, 0, 0, 0);
}
-#define sys_vfork sys_vfork
+#define _sys_vfork _sys_vfork
#endif /* _NOLIBC_ARCH_S390_H */
static pid_t getpid(void);
static __attribute__((unused))
-pid_t sys_fork(void)
+pid_t _sys_fork(void)
{
pid_t parent, ret;
else
return ret;
}
-#define sys_fork sys_fork
+#define _sys_fork _sys_fork
static __attribute__((unused))
-pid_t sys_vfork(void)
+pid_t _sys_vfork(void)
{
pid_t parent, ret;
else
return ret;
}
-#define sys_vfork sys_vfork
+#define _sys_vfork _sys_vfork
#endif /* _NOLIBC_ARCH_SPARC_H */
fd = ~i;
- ret = sys_getdents64(fd, ldir, sizeof(buf));
+ ret = _sys_getdents64(fd, ldir, sizeof(buf));
if (ret < 0)
return -ret;
if (ret == 0) {
* readdir() can only return one entry at a time.
* Make sure the non-returned ones are not skipped.
*/
- ret = sys_lseek(fd, ldir->d_off, SEEK_SET);
+ ret = _sys_lseek(fd, ldir->d_off, SEEK_SET);
if (ret < 0)
return -ret;
*/
static __attribute__((unused))
-int sys_openat(int dirfd, const char *path, int flags, mode_t mode)
+int _sys_openat(int dirfd, const char *path, int flags, mode_t mode)
{
return __nolibc_syscall4(__NR_openat, dirfd, path, flags, mode);
}
va_end(args);
}
- return __sysret(sys_openat(dirfd, path, flags, mode));
+ return __sysret(_sys_openat(dirfd, path, flags, mode));
}
/*
*/
static __attribute__((unused))
-int sys_open(const char *path, int flags, mode_t mode)
+int _sys_open(const char *path, int flags, mode_t mode)
{
return __nolibc_syscall4(__NR_openat, AT_FDCWD, path, flags, mode);
}
va_end(args);
}
- return __sysret(sys_open(path, flags, mode));
+ return __sysret(_sys_open(path, flags, mode));
}
#endif /* _NOLIBC_FCNTL_H */
* a pointer or the negated errno value.
*
* - The second level is mostly architecture-independent. It is made of
- * static functions called sys_<name>() which rely on __nolibc_syscallN()
+ * static functions called _sys_<name>() which rely on __nolibc_syscallN()
* depending on the syscall definition. These functions are responsible
* for exposing the appropriate types for the syscall arguments (int,
* pointers, etc) and for setting the appropriate return type (often int).
* A few of them are architecture-specific because the syscalls are not all
* mapped exactly the same among architectures. For example, some archs do
- * not implement select() and need pselect6() instead, so the sys_select()
+ * not implement select() and need pselect6() instead, so the _sys_select()
* function will have to abstract this.
*
* - The third level is the libc call definition. It exposes the lower raw
- * sys_<name>() calls in a way that looks like what a libc usually does,
+ * _sys_<name>() calls in a way that looks like what a libc usually does,
* takes care of specific input values, and of setting errno upon error.
* There can be minor variations compared to standard libc calls.
*
*/
static __attribute__((unused))
-int sys_poll(struct pollfd *fds, int nfds, int timeout)
+int _sys_poll(struct pollfd *fds, int nfds, int timeout)
{
#if defined(__NR_ppoll_time64)
struct __kernel_timespec t;
static __attribute__((unused))
int poll(struct pollfd *fds, int nfds, int timeout)
{
- return __sysret(sys_poll(fds, nfds, timeout));
+ return __sysret(_sys_poll(fds, nfds, timeout));
}
#endif /* _NOLIBC_POLL_H */
*/
static __attribute__((unused))
-int sys_setns(int fd, int nstype)
+int _sys_setns(int fd, int nstype)
{
return __nolibc_syscall2(__NR_setns, fd, nstype);
}
static __attribute__((unused))
int setns(int fd, int nstype)
{
- return __sysret(sys_setns(fd, nstype));
+ return __sysret(_sys_setns(fd, nstype));
}
*/
static __attribute__((unused))
-int sys_unshare(int flags)
+int _sys_unshare(int flags)
{
return __nolibc_syscall1(__NR_unshare, flags);
}
static __attribute__((unused))
int unshare(int flags)
{
- return __sysret(sys_unshare(flags));
+ return __sysret(_sys_unshare(flags));
}
#endif /* _NOLIBC_SCHED_H */
__attribute__((weak,unused,section(".text.nolibc_raise")))
int raise(int signal)
{
- return sys_kill(sys_getpid(), signal);
+ return _sys_kill(_sys_getpid(), signal);
}
#endif /* _NOLIBC_SIGNAL_H */
__attribute__((weak,unused,noreturn,section(".text.nolibc_abort")))
void abort(void)
{
- sys_kill(sys_getpid(), SIGABRT);
+ _sys_kill(_sys_getpid(), SIGABRT);
for (;;);
}
* - the "internal" ones, which matches the raw syscall interface at the
* kernel level, which may sometimes slightly differ from the documented
* libc-level ones. For example most of them return either a valid value
- * or -errno. All of these are prefixed with "sys_". They may be called
+ * or -errno. All of these are prefixed with "_sys_". They may be called
* by non-portable applications if desired.
*
* - the "exported" ones, whose interface must closely match the one
*/
static __attribute__((unused))
-void *sys_brk(void *addr)
+void *_sys_brk(void *addr)
{
return (void *)__nolibc_syscall1(__NR_brk, addr);
}
static __attribute__((unused))
int brk(void *addr)
{
- void *ret = sys_brk(addr);
+ void *ret = _sys_brk(addr);
if (!ret) {
SET_ERRNO(ENOMEM);
void *sbrk(intptr_t inc)
{
/* first call to find current end */
- void *ret = sys_brk(NULL);
+ void *ret = _sys_brk(NULL);
- if (ret && sys_brk(ret + inc) == ret + inc)
+ if (ret && _sys_brk(ret + inc) == ret + inc)
return ret + inc;
SET_ERRNO(ENOMEM);
*/
static __attribute__((unused))
-int sys_chdir(const char *path)
+int _sys_chdir(const char *path)
{
return __nolibc_syscall1(__NR_chdir, path);
}
static __attribute__((unused))
int chdir(const char *path)
{
- return __sysret(sys_chdir(path));
+ return __sysret(_sys_chdir(path));
}
static __attribute__((unused))
-int sys_fchdir(int fildes)
+int _sys_fchdir(int fildes)
{
return __nolibc_syscall1(__NR_fchdir, fildes);
}
static __attribute__((unused))
int fchdir(int fildes)
{
- return __sysret(sys_fchdir(fildes));
+ return __sysret(_sys_fchdir(fildes));
}
*/
static __attribute__((unused))
-int sys_chmod(const char *path, mode_t mode)
+int _sys_chmod(const char *path, mode_t mode)
{
#if defined(__NR_fchmodat)
return __nolibc_syscall4(__NR_fchmodat, AT_FDCWD, path, mode, 0);
static __attribute__((unused))
int chmod(const char *path, mode_t mode)
{
- return __sysret(sys_chmod(path, mode));
+ return __sysret(_sys_chmod(path, mode));
}
*/
static __attribute__((unused))
-int sys_chown(const char *path, uid_t owner, gid_t group)
+int _sys_chown(const char *path, uid_t owner, gid_t group)
{
#if defined(__NR_fchownat)
return __nolibc_syscall5(__NR_fchownat, AT_FDCWD, path, owner, group, 0);
static __attribute__((unused))
int chown(const char *path, uid_t owner, gid_t group)
{
- return __sysret(sys_chown(path, owner, group));
+ return __sysret(_sys_chown(path, owner, group));
}
*/
static __attribute__((unused))
-int sys_chroot(const char *path)
+int _sys_chroot(const char *path)
{
return __nolibc_syscall1(__NR_chroot, path);
}
static __attribute__((unused))
int chroot(const char *path)
{
- return __sysret(sys_chroot(path));
+ return __sysret(_sys_chroot(path));
}
*/
static __attribute__((unused))
-int sys_close(int fd)
+int _sys_close(int fd)
{
return __nolibc_syscall1(__NR_close, fd);
}
static __attribute__((unused))
int close(int fd)
{
- return __sysret(sys_close(fd));
+ return __sysret(_sys_close(fd));
}
*/
static __attribute__((unused))
-int sys_dup(int fd)
+int _sys_dup(int fd)
{
return __nolibc_syscall1(__NR_dup, fd);
}
static __attribute__((unused))
int dup(int fd)
{
- return __sysret(sys_dup(fd));
+ return __sysret(_sys_dup(fd));
}
*/
static __attribute__((unused))
-int sys_dup2(int old, int new)
+int _sys_dup2(int old, int new)
{
#if defined(__NR_dup3)
int ret, nr_fcntl;
static __attribute__((unused))
int dup2(int old, int new)
{
- return __sysret(sys_dup2(old, new));
+ return __sysret(_sys_dup2(old, new));
}
#if defined(__NR_dup3)
static __attribute__((unused))
-int sys_dup3(int old, int new, int flags)
+int _sys_dup3(int old, int new, int flags)
{
return __nolibc_syscall3(__NR_dup3, old, new, flags);
}
static __attribute__((unused))
int dup3(int old, int new, int flags)
{
- return __sysret(sys_dup3(old, new, flags));
+ return __sysret(_sys_dup3(old, new, flags));
}
#endif
*/
static __attribute__((unused))
-int sys_execve(const char *filename, char *const argv[], char *const envp[])
+int _sys_execve(const char *filename, char *const argv[], char *const envp[])
{
return __nolibc_syscall3(__NR_execve, filename, argv, envp);
}
static __attribute__((unused))
int execve(const char *filename, char *const argv[], char *const envp[])
{
- return __sysret(sys_execve(filename, argv, envp));
+ return __sysret(_sys_execve(filename, argv, envp));
}
*/
static __attribute__((noreturn,unused))
-void sys_exit(int status)
+void _sys_exit(int status)
{
__nolibc_syscall1(__NR_exit, status & 255);
while(1); /* shut the "noreturn" warnings. */
static __attribute__((noreturn,unused))
void _exit(int status)
{
- sys_exit(status);
+ _sys_exit(status);
}
static __attribute__((noreturn,unused))
* pid_t fork(void);
*/
-#ifndef sys_fork
+#ifndef _sys_fork
static __attribute__((unused))
-pid_t sys_fork(void)
+pid_t _sys_fork(void)
{
#if defined(__NR_clone)
/* note: some archs only have clone() and not fork(). Different archs
static __attribute__((unused))
pid_t fork(void)
{
- return __sysret(sys_fork());
+ return __sysret(_sys_fork());
}
-#ifndef sys_vfork
+#ifndef _sys_vfork
static __attribute__((unused))
-pid_t sys_vfork(void)
+pid_t _sys_vfork(void)
{
#if defined(__NR_clone)
- /* See the note in sys_fork(). */
+ /* See the note in _sys_fork(). */
return __nolibc_syscall5(__NR_clone, CLONE_VM | CLONE_VFORK | SIGCHLD, 0, 0, 0, 0);
#elif defined(__NR_vfork)
return __nolibc_syscall0(__NR_vfork);
static __attribute__((unused))
pid_t vfork(void)
{
- return __sysret(sys_vfork());
+ return __sysret(_sys_vfork());
}
/*
*/
static __attribute__((unused))
-int sys_fsync(int fd)
+int _sys_fsync(int fd)
{
return __nolibc_syscall1(__NR_fsync, fd);
}
static __attribute__((unused))
int fsync(int fd)
{
- return __sysret(sys_fsync(fd));
+ return __sysret(_sys_fsync(fd));
}
*/
static __attribute__((unused))
-int sys_getdents64(int fd, struct linux_dirent64 *dirp, int count)
+int _sys_getdents64(int fd, struct linux_dirent64 *dirp, int count)
{
return __nolibc_syscall3(__NR_getdents64, fd, dirp, count);
}
static __attribute__((unused))
int getdents64(int fd, struct linux_dirent64 *dirp, int count)
{
- return __sysret(sys_getdents64(fd, dirp, count));
+ return __sysret(_sys_getdents64(fd, dirp, count));
}
*/
static __attribute__((unused))
-uid_t sys_geteuid(void)
+uid_t _sys_geteuid(void)
{
#if defined(__NR_geteuid32)
return __nolibc_syscall0(__NR_geteuid32);
static __attribute__((unused))
uid_t geteuid(void)
{
- return sys_geteuid();
+ return _sys_geteuid();
}
*/
static __attribute__((unused))
-pid_t sys_getpgid(pid_t pid)
+pid_t _sys_getpgid(pid_t pid)
{
return __nolibc_syscall1(__NR_getpgid, pid);
}
static __attribute__((unused))
pid_t getpgid(pid_t pid)
{
- return __sysret(sys_getpgid(pid));
+ return __sysret(_sys_getpgid(pid));
}
*/
static __attribute__((unused))
-pid_t sys_getpgrp(void)
+pid_t _sys_getpgrp(void)
{
- return sys_getpgid(0);
+ return _sys_getpgid(0);
}
static __attribute__((unused))
pid_t getpgrp(void)
{
- return sys_getpgrp();
+ return _sys_getpgrp();
}
*/
static __attribute__((unused))
-pid_t sys_getpid(void)
+pid_t _sys_getpid(void)
{
return __nolibc_syscall0(__NR_getpid);
}
static __attribute__((unused))
pid_t getpid(void)
{
- return sys_getpid();
+ return _sys_getpid();
}
*/
static __attribute__((unused))
-pid_t sys_getppid(void)
+pid_t _sys_getppid(void)
{
return __nolibc_syscall0(__NR_getppid);
}
static __attribute__((unused))
pid_t getppid(void)
{
- return sys_getppid();
+ return _sys_getppid();
}
*/
static __attribute__((unused))
-pid_t sys_gettid(void)
+pid_t _sys_gettid(void)
{
return __nolibc_syscall0(__NR_gettid);
}
static __attribute__((unused))
pid_t gettid(void)
{
- return sys_gettid();
+ return _sys_gettid();
}
#ifndef NOLIBC_NO_RUNTIME
*/
static __attribute__((unused))
-uid_t sys_getuid(void)
+uid_t _sys_getuid(void)
{
#if defined(__NR_getuid32)
return __nolibc_syscall0(__NR_getuid32);
static __attribute__((unused))
uid_t getuid(void)
{
- return sys_getuid();
+ return _sys_getuid();
}
*/
static __attribute__((unused))
-int sys_kill(pid_t pid, int signal)
+int _sys_kill(pid_t pid, int signal)
{
return __nolibc_syscall2(__NR_kill, pid, signal);
}
static __attribute__((unused))
int kill(pid_t pid, int signal)
{
- return __sysret(sys_kill(pid, signal));
+ return __sysret(_sys_kill(pid, signal));
}
*/
static __attribute__((unused))
-int sys_link(const char *old, const char *new)
+int _sys_link(const char *old, const char *new)
{
#if defined(__NR_linkat)
return __nolibc_syscall5(__NR_linkat, AT_FDCWD, old, AT_FDCWD, new, 0);
static __attribute__((unused))
int link(const char *old, const char *new)
{
- return __sysret(sys_link(old, new));
+ return __sysret(_sys_link(old, new));
}
*/
static __attribute__((unused))
-off_t sys_lseek(int fd, off_t offset, int whence)
+off_t _sys_lseek(int fd, off_t offset, int whence)
{
#if defined(__NR_llseek)
__kernel_loff_t loff = 0;
static __attribute__((unused))
off_t lseek(int fd, off_t offset, int whence)
{
- return __sysret(sys_lseek(fd, offset, whence));
+ return __sysret(_sys_lseek(fd, offset, whence));
}
*/
static __attribute__((unused))
-int sys_mkdir(const char *path, mode_t mode)
+int _sys_mkdir(const char *path, mode_t mode)
{
#if defined(__NR_mkdirat)
return __nolibc_syscall3(__NR_mkdirat, AT_FDCWD, path, mode);
static __attribute__((unused))
int mkdir(const char *path, mode_t mode)
{
- return __sysret(sys_mkdir(path, mode));
+ return __sysret(_sys_mkdir(path, mode));
}
/*
*/
static __attribute__((unused))
-int sys_rmdir(const char *path)
+int _sys_rmdir(const char *path)
{
#if defined(__NR_rmdir)
return __nolibc_syscall1(__NR_rmdir, path);
static __attribute__((unused))
int rmdir(const char *path)
{
- return __sysret(sys_rmdir(path));
+ return __sysret(_sys_rmdir(path));
}
*/
static __attribute__((unused))
-long sys_mknod(const char *path, mode_t mode, dev_t dev)
+long _sys_mknod(const char *path, mode_t mode, dev_t dev)
{
#if defined(__NR_mknodat)
return __nolibc_syscall4(__NR_mknodat, AT_FDCWD, path, mode, dev);
static __attribute__((unused))
int mknod(const char *path, mode_t mode, dev_t dev)
{
- return __sysret(sys_mknod(path, mode, dev));
+ return __sysret(_sys_mknod(path, mode, dev));
}
*/
static __attribute__((unused))
-int sys_pipe2(int pipefd[2], int flags)
+int _sys_pipe2(int pipefd[2], int flags)
{
return __nolibc_syscall2(__NR_pipe2, pipefd, flags);
}
static __attribute__((unused))
int pipe2(int pipefd[2], int flags)
{
- return __sysret(sys_pipe2(pipefd, flags));
+ return __sysret(_sys_pipe2(pipefd, flags));
}
static __attribute__((unused))
*/
static __attribute__((unused))
-int sys_pivot_root(const char *new, const char *old)
+int _sys_pivot_root(const char *new, const char *old)
{
return __nolibc_syscall2(__NR_pivot_root, new, old);
}
static __attribute__((unused))
int pivot_root(const char *new, const char *old)
{
- return __sysret(sys_pivot_root(new, old));
+ return __sysret(_sys_pivot_root(new, old));
}
*/
static __attribute__((unused))
-ssize_t sys_read(int fd, void *buf, size_t count)
+ssize_t _sys_read(int fd, void *buf, size_t count)
{
return __nolibc_syscall3(__NR_read, fd, buf, count);
}
static __attribute__((unused))
ssize_t read(int fd, void *buf, size_t count)
{
- return __sysret(sys_read(fd, buf, count));
+ return __sysret(_sys_read(fd, buf, count));
}
*/
static __attribute__((unused))
-int sys_sched_yield(void)
+int _sys_sched_yield(void)
{
return __nolibc_syscall0(__NR_sched_yield);
}
static __attribute__((unused))
int sched_yield(void)
{
- return __sysret(sys_sched_yield());
+ return __sysret(_sys_sched_yield());
}
*/
static __attribute__((unused))
-int sys_setpgid(pid_t pid, pid_t pgid)
+int _sys_setpgid(pid_t pid, pid_t pgid)
{
return __nolibc_syscall2(__NR_setpgid, pid, pgid);
}
static __attribute__((unused))
int setpgid(pid_t pid, pid_t pgid)
{
- return __sysret(sys_setpgid(pid, pgid));
+ return __sysret(_sys_setpgid(pid, pgid));
}
/*
*/
static __attribute__((unused))
-pid_t sys_setsid(void)
+pid_t _sys_setsid(void)
{
return __nolibc_syscall0(__NR_setsid);
}
static __attribute__((unused))
pid_t setsid(void)
{
- return __sysret(sys_setsid());
+ return __sysret(_sys_setsid());
}
*/
static __attribute__((unused))
-int sys_symlink(const char *old, const char *new)
+int _sys_symlink(const char *old, const char *new)
{
#if defined(__NR_symlinkat)
return __nolibc_syscall3(__NR_symlinkat, old, AT_FDCWD, new);
static __attribute__((unused))
int symlink(const char *old, const char *new)
{
- return __sysret(sys_symlink(old, new));
+ return __sysret(_sys_symlink(old, new));
}
*/
static __attribute__((unused))
-mode_t sys_umask(mode_t mode)
+mode_t _sys_umask(mode_t mode)
{
return __nolibc_syscall1(__NR_umask, mode);
}
static __attribute__((unused))
mode_t umask(mode_t mode)
{
- return sys_umask(mode);
+ return _sys_umask(mode);
}
*/
static __attribute__((unused))
-int sys_umount2(const char *path, int flags)
+int _sys_umount2(const char *path, int flags)
{
return __nolibc_syscall2(__NR_umount2, path, flags);
}
static __attribute__((unused))
int umount2(const char *path, int flags)
{
- return __sysret(sys_umount2(path, flags));
+ return __sysret(_sys_umount2(path, flags));
}
*/
static __attribute__((unused))
-int sys_unlink(const char *path)
+int _sys_unlink(const char *path)
{
#if defined(__NR_unlinkat)
return __nolibc_syscall3(__NR_unlinkat, AT_FDCWD, path, 0);
static __attribute__((unused))
int unlink(const char *path)
{
- return __sysret(sys_unlink(path));
+ return __sysret(_sys_unlink(path));
}
*/
static __attribute__((unused))
-ssize_t sys_write(int fd, const void *buf, size_t count)
+ssize_t _sys_write(int fd, const void *buf, size_t count)
{
return __nolibc_syscall3(__NR_write, fd, buf, count);
}
static __attribute__((unused))
ssize_t write(int fd, const void *buf, size_t count)
{
- return __sysret(sys_write(fd, buf, count));
+ return __sysret(_sys_write(fd, buf, count));
}
*/
static __attribute__((unused))
-int sys_memfd_create(const char *name, unsigned int flags)
+int _sys_memfd_create(const char *name, unsigned int flags)
{
return __nolibc_syscall2(__NR_memfd_create, name, flags);
}
static __attribute__((unused))
int memfd_create(const char *name, unsigned int flags)
{
- return __sysret(sys_memfd_create(name, flags));
+ return __sysret(_sys_memfd_create(name, flags));
}
#endif /* _NOLIBC_SYS_H */
*/
static __attribute__((unused))
-long sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
+long _sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
{
return __nolibc_syscall3(__NR_ioctl, fd, cmd, arg);
}
-#define ioctl(fd, cmd, arg) __sysret(sys_ioctl(fd, cmd, (unsigned long)(arg)))
+#define ioctl(fd, cmd, arg) __sysret(_sys_ioctl(fd, cmd, (unsigned long)(arg)))
#endif /* _NOLIBC_SYS_IOCTL_H */
#include "../arch.h"
#include "../sys.h"
-#ifndef sys_mmap
+#ifndef _sys_mmap
static __attribute__((unused))
-void *sys_mmap(void *addr, size_t length, int prot, int flags, int fd,
- off_t offset)
+void *_sys_mmap(void *addr, size_t length, int prot, int flags, int fd,
+ off_t offset)
{
int n;
static __attribute__((unused))
void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset)
{
- void *ret = sys_mmap(addr, length, prot, flags, fd, offset);
+ void *ret = _sys_mmap(addr, length, prot, flags, fd, offset);
if ((unsigned long)ret >= -4095UL) {
SET_ERRNO(-(long)ret);
}
static __attribute__((unused))
-void *sys_mremap(void *old_address, size_t old_size, size_t new_size, int flags, void *new_address)
+void *_sys_mremap(void *old_address, size_t old_size, size_t new_size, int flags, void *new_address)
{
return (void *)__nolibc_syscall5(__NR_mremap, old_address, old_size,
new_size, flags, new_address);
static __attribute__((unused))
void *mremap(void *old_address, size_t old_size, size_t new_size, int flags, void *new_address)
{
- void *ret = sys_mremap(old_address, old_size, new_size, flags, new_address);
+ void *ret = _sys_mremap(old_address, old_size, new_size, flags, new_address);
if ((unsigned long)ret >= -4095UL) {
SET_ERRNO(-(long)ret);
}
static __attribute__((unused))
-int sys_munmap(void *addr, size_t length)
+int _sys_munmap(void *addr, size_t length)
{
return __nolibc_syscall2(__NR_munmap, addr, length);
}
static __attribute__((unused))
int munmap(void *addr, size_t length)
{
- return __sysret(sys_munmap(addr, length));
+ return __sysret(_sys_munmap(addr, length));
}
#endif /* _NOLIBC_SYS_MMAN_H */
* const void *data);
*/
static __attribute__((unused))
-int sys_mount(const char *src, const char *tgt, const char *fst,
- unsigned long flags, const void *data)
+int _sys_mount(const char *src, const char *tgt, const char *fst,
+ unsigned long flags, const void *data)
{
return __nolibc_syscall5(__NR_mount, src, tgt, fst, flags, data);
}
const char *fst, unsigned long flags,
const void *data)
{
- return __sysret(sys_mount(src, tgt, fst, flags, data));
+ return __sysret(_sys_mount(src, tgt, fst, flags, data));
}
#endif /* _NOLIBC_SYS_MOUNT_H */
*/
static __attribute__((unused))
-int sys_prctl(int option, unsigned long arg2, unsigned long arg3,
- unsigned long arg4, unsigned long arg5)
+int _sys_prctl(int option, unsigned long arg2, unsigned long arg3,
+ unsigned long arg4, unsigned long arg5)
{
return __nolibc_syscall5(__NR_prctl, option, arg2, arg3, arg4, arg5);
}
int prctl(int option, unsigned long arg2, unsigned long arg3,
unsigned long arg4, unsigned long arg5)
{
- return __sysret(sys_prctl(option, arg2, arg3, arg4, arg5));
+ return __sysret(_sys_prctl(option, arg2, arg3, arg4, arg5));
}
#endif /* _NOLIBC_SYS_PRCTL_H */
* long ptrace(int op, pid_t pid, void *addr, void *data);
*/
static __attribute__((unused))
-long sys_ptrace(int op, pid_t pid, void *addr, void *data)
+long _sys_ptrace(int op, pid_t pid, void *addr, void *data)
{
return __nolibc_syscall4(__NR_ptrace, op, pid, addr, data);
}
static __attribute__((unused))
ssize_t ptrace(int op, pid_t pid, void *addr, void *data)
{
- return __sysret(sys_ptrace(op, pid, addr, data));
+ return __sysret(_sys_ptrace(op, pid, addr, data));
}
#endif /* _NOLIBC_SYS_PTRACE_H */
*/
static __attribute__((unused))
-ssize_t sys_getrandom(void *buf, size_t buflen, unsigned int flags)
+ssize_t _sys_getrandom(void *buf, size_t buflen, unsigned int flags)
{
return __nolibc_syscall3(__NR_getrandom, buf, buflen, flags);
}
static __attribute__((unused))
ssize_t getrandom(void *buf, size_t buflen, unsigned int flags)
{
- return __sysret(sys_getrandom(buf, buflen, flags));
+ return __sysret(_sys_getrandom(buf, buflen, flags));
}
#endif /* _NOLIBC_SYS_RANDOM_H */
*/
static __attribute__((unused))
-ssize_t sys_reboot(int magic1, int magic2, int cmd, void *arg)
+ssize_t _sys_reboot(int magic1, int magic2, int cmd, void *arg)
{
return __nolibc_syscall4(__NR_reboot, magic1, magic2, cmd, arg);
}
static __attribute__((unused))
int reboot(int cmd)
{
- return __sysret(sys_reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, cmd, NULL));
+ return __sysret(_sys_reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, cmd, NULL));
}
#endif /* _NOLIBC_SYS_REBOOT_H */
*/
static __attribute__((unused))
-int sys_prlimit64(pid_t pid, int resource,
- const struct rlimit64 *new_limit, struct rlimit64 *old_limit)
+int _sys_prlimit64(pid_t pid, int resource,
+ const struct rlimit64 *new_limit, struct rlimit64 *old_limit)
{
return __nolibc_syscall4(__NR_prlimit64, pid, resource, new_limit, old_limit);
}
struct rlimit64 rlim64;
int ret;
- ret = __sysret(sys_prlimit64(0, resource, NULL, &rlim64));
+ ret = __sysret(_sys_prlimit64(0, resource, NULL, &rlim64));
rlim->rlim_cur = rlim64.rlim_cur;
rlim->rlim_max = rlim64.rlim_max;
.rlim_max = rlim->rlim_max,
};
- return __sysret(sys_prlimit64(0, resource, &rlim64, NULL));
+ return __sysret(_sys_prlimit64(0, resource, &rlim64, NULL));
}
#endif /* _NOLIBC_SYS_RESOURCE_H */
*/
static __attribute__((unused))
-int sys_select(int nfds, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timeval *timeout)
+int _sys_select(int nfds, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timeval *timeout)
{
#if defined(__NR_pselect6_time64)
struct __kernel_timespec t;
static __attribute__((unused))
int select(int nfds, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timeval *timeout)
{
- return __sysret(sys_select(nfds, rfds, wfds, efds, timeout));
+ return __sysret(_sys_select(nfds, rfds, wfds, efds, timeout));
}
*/
static __attribute__((unused))
-int sys_statx(int fd, const char *path, int flags, unsigned int mask, struct statx *buf)
+int _sys_statx(int fd, const char *path, int flags, unsigned int mask, struct statx *buf)
{
#ifdef __NR_statx
return __nolibc_syscall5(__NR_statx, fd, path, flags, mask, buf);
static __attribute__((unused))
int statx(int fd, const char *path, int flags, unsigned int mask, struct statx *buf)
{
- return __sysret(sys_statx(fd, path, flags, mask, buf));
+ return __sysret(_sys_statx(fd, path, flags, mask, buf));
}
struct statx statx;
long ret;
- ret = __sysret(sys_statx(fd, path, flag | AT_NO_AUTOMOUNT, STATX_BASIC_STATS, &statx));
+ ret = __sysret(_sys_statx(fd, path, flag | AT_NO_AUTOMOUNT, STATX_BASIC_STATS, &statx));
if (ret == -1)
return ret;
#include "../arch.h"
#include "../sys.h"
-static int sys_clock_gettime(clockid_t clockid, struct timespec *tp);
+static int _sys_clock_gettime(clockid_t clockid, struct timespec *tp);
/*
* int gettimeofday(struct timeval *tv, struct timezone *tz);
*/
static __attribute__((unused))
-int sys_gettimeofday(struct timeval *tv, struct timezone *tz)
+int _sys_gettimeofday(struct timeval *tv, struct timezone *tz)
{
(void) tz; /* Non-NULL tz is undefined behaviour */
struct timespec tp;
int ret;
- ret = sys_clock_gettime(CLOCK_REALTIME, &tp);
+ ret = _sys_clock_gettime(CLOCK_REALTIME, &tp);
if (!ret && tv) {
tv->tv_sec = tp.tv_sec;
tv->tv_usec = (uint32_t)tp.tv_nsec / 1000;
static __attribute__((unused))
int gettimeofday(struct timeval *tv, struct timezone *tz)
{
- return __sysret(sys_gettimeofday(tv, tz));
+ return __sysret(_sys_gettimeofday(tv, tz));
}
#endif /* _NOLIBC_SYS_TIME_H */
static __attribute__((unused))
-int sys_timerfd_create(int clockid, int flags)
+int _sys_timerfd_create(int clockid, int flags)
{
return __nolibc_syscall2(__NR_timerfd_create, clockid, flags);
}
static __attribute__((unused))
int timerfd_create(int clockid, int flags)
{
- return __sysret(sys_timerfd_create(clockid, flags));
+ return __sysret(_sys_timerfd_create(clockid, flags));
}
static __attribute__((unused))
-int sys_timerfd_gettime(int fd, struct itimerspec *curr_value)
+int _sys_timerfd_gettime(int fd, struct itimerspec *curr_value)
{
#if defined(__NR_timerfd_gettime64)
__nolibc_assert_time64_type(curr_value->it_value.tv_sec);
static __attribute__((unused))
int timerfd_gettime(int fd, struct itimerspec *curr_value)
{
- return __sysret(sys_timerfd_gettime(fd, curr_value));
+ return __sysret(_sys_timerfd_gettime(fd, curr_value));
}
static __attribute__((unused))
-int sys_timerfd_settime(int fd, int flags,
- const struct itimerspec *new_value, struct itimerspec *old_value)
+int _sys_timerfd_settime(int fd, int flags,
+ const struct itimerspec *new_value, struct itimerspec *old_value)
{
#if defined(__NR_timerfd_settime64)
__nolibc_assert_time64_type(new_value->it_value.tv_sec);
int timerfd_settime(int fd, int flags,
const struct itimerspec *new_value, struct itimerspec *old_value)
{
- return __sysret(sys_timerfd_settime(fd, flags, new_value, old_value));
+ return __sysret(_sys_timerfd_settime(fd, flags, new_value, old_value));
}
#endif /* _NOLIBC_SYS_TIMERFD_H */
* ssize_t readv(int fd, const struct iovec *iovec, int count);
*/
static __attribute__((unused))
-ssize_t sys_readv(int fd, const struct iovec *iovec, int count)
+ssize_t _sys_readv(int fd, const struct iovec *iovec, int count)
{
return __nolibc_syscall3(__NR_readv, fd, iovec, count);
}
static __attribute__((unused))
ssize_t readv(int fd, const struct iovec *iovec, int count)
{
- return __sysret(sys_readv(fd, iovec, count));
+ return __sysret(_sys_readv(fd, iovec, count));
}
/*
* ssize_t writev(int fd, const struct iovec *iovec, int count);
*/
static __attribute__((unused))
-ssize_t sys_writev(int fd, const struct iovec *iovec, int count)
+ssize_t _sys_writev(int fd, const struct iovec *iovec, int count)
{
return __nolibc_syscall3(__NR_writev, fd, iovec, count);
}
static __attribute__((unused))
ssize_t writev(int fd, const struct iovec *iovec, int count)
{
- return __sysret(sys_writev(fd, iovec, count));
+ return __sysret(_sys_writev(fd, iovec, count));
}
};
static __attribute__((unused))
-int sys_uname(struct utsname *buf)
+int _sys_uname(struct utsname *buf)
{
return __nolibc_syscall1(__NR_uname, buf);
}
static __attribute__((unused))
int uname(struct utsname *buf)
{
- return __sysret(sys_uname(buf));
+ return __sysret(_sys_uname(buf));
}
#endif /* _NOLIBC_SYS_UTSNAME_H */
*/
static __attribute__((unused))
-int sys_waitid(int which, pid_t pid, siginfo_t *infop, int options, struct rusage *rusage)
+int _sys_waitid(int which, pid_t pid, siginfo_t *infop, int options, struct rusage *rusage)
{
return __nolibc_syscall5(__NR_waitid, which, pid, infop, options, rusage);
}
static __attribute__((unused))
int waitid(int which, pid_t pid, siginfo_t *infop, int options)
{
- return __sysret(sys_waitid(which, pid, infop, options, NULL));
+ return __sysret(_sys_waitid(which, pid, infop, options, NULL));
}
*/
static __attribute__((unused))
-int sys_clock_getres(clockid_t clockid, struct timespec *res)
+int _sys_clock_getres(clockid_t clockid, struct timespec *res)
{
#if defined(__NR_clock_getres_time64)
__nolibc_assert_time64_type(res->tv_sec);
static __attribute__((unused))
int clock_getres(clockid_t clockid, struct timespec *res)
{
- return __sysret(sys_clock_getres(clockid, res));
+ return __sysret(_sys_clock_getres(clockid, res));
}
static __attribute__((unused))
-int sys_clock_gettime(clockid_t clockid, struct timespec *tp)
+int _sys_clock_gettime(clockid_t clockid, struct timespec *tp)
{
#if defined(__NR_clock_gettime64)
__nolibc_assert_time64_type(tp->tv_sec);
static __attribute__((unused))
int clock_gettime(clockid_t clockid, struct timespec *tp)
{
- return __sysret(sys_clock_gettime(clockid, tp));
+ return __sysret(_sys_clock_gettime(clockid, tp));
}
static __attribute__((unused))
-int sys_clock_settime(clockid_t clockid, struct timespec *tp)
+int _sys_clock_settime(clockid_t clockid, struct timespec *tp)
{
#if defined(__NR_clock_settime64)
__nolibc_assert_time64_type(tp->tv_sec);
static __attribute__((unused))
int clock_settime(clockid_t clockid, struct timespec *tp)
{
- return __sysret(sys_clock_settime(clockid, tp));
+ return __sysret(_sys_clock_settime(clockid, tp));
}
static __attribute__((unused))
-int sys_clock_nanosleep(clockid_t clockid, int flags, const struct timespec *rqtp,
- struct timespec *rmtp)
+int _sys_clock_nanosleep(clockid_t clockid, int flags, const struct timespec *rqtp,
+ struct timespec *rmtp)
{
#if defined(__NR_clock_nanosleep_time64)
__nolibc_assert_time64_type(rqtp->tv_sec);
struct timespec *rmtp)
{
/* Directly return a positive error number */
- return -sys_clock_nanosleep(clockid, flags, rqtp, rmtp);
+ return -_sys_clock_nanosleep(clockid, flags, rqtp, rmtp);
}
static __inline__
static __inline__
int nanosleep(const struct timespec *rqtp, struct timespec *rmtp)
{
- return __sysret(sys_clock_nanosleep(CLOCK_REALTIME, 0, rqtp, rmtp));
+ return __sysret(_sys_clock_nanosleep(CLOCK_REALTIME, 0, rqtp, rmtp));
}
struct timeval tv;
/* note, cannot fail here */
- sys_gettimeofday(&tv, NULL);
+ _sys_gettimeofday(&tv, NULL);
if (tptr)
*tptr = tv.tv_sec;
*/
static __attribute__((unused))
-int sys_timer_create(clockid_t clockid, struct sigevent *evp, timer_t *timerid)
+int _sys_timer_create(clockid_t clockid, struct sigevent *evp, timer_t *timerid)
{
return __nolibc_syscall3(__NR_timer_create, clockid, evp, timerid);
}
static __attribute__((unused))
int timer_create(clockid_t clockid, struct sigevent *evp, timer_t *timerid)
{
- return __sysret(sys_timer_create(clockid, evp, timerid));
+ return __sysret(_sys_timer_create(clockid, evp, timerid));
}
static __attribute__((unused))
-int sys_timer_delete(timer_t timerid)
+int _sys_timer_delete(timer_t timerid)
{
return __nolibc_syscall1(__NR_timer_delete, timerid);
}
static __attribute__((unused))
int timer_delete(timer_t timerid)
{
- return __sysret(sys_timer_delete(timerid));
+ return __sysret(_sys_timer_delete(timerid));
}
static __attribute__((unused))
-int sys_timer_gettime(timer_t timerid, struct itimerspec *curr_value)
+int _sys_timer_gettime(timer_t timerid, struct itimerspec *curr_value)
{
#if defined(__NR_timer_gettime64)
__nolibc_assert_time64_type(curr_value->it_value.tv_sec);
static __attribute__((unused))
int timer_gettime(timer_t timerid, struct itimerspec *curr_value)
{
- return __sysret(sys_timer_gettime(timerid, curr_value));
+ return __sysret(_sys_timer_gettime(timerid, curr_value));
}
static __attribute__((unused))
-int sys_timer_settime(timer_t timerid, int flags,
- const struct itimerspec *new_value, struct itimerspec *old_value)
+int _sys_timer_settime(timer_t timerid, int flags,
+ const struct itimerspec *new_value, struct itimerspec *old_value)
{
#if defined(__NR_timer_settime64)
__nolibc_assert_time64_type(new_value->it_value.tv_sec);
int timer_settime(timer_t timerid, int flags,
const struct itimerspec *new_value, struct itimerspec *old_value)
{
- return __sysret(sys_timer_settime(timerid, flags, new_value, old_value));
+ return __sysret(_sys_timer_settime(timerid, flags, new_value, old_value));
}
#endif /* _NOLIBC_TIME_H */
*/
static __attribute__((unused))
-int sys_faccessat(int fd, const char *path, int amode, int flag)
+int _sys_faccessat(int fd, const char *path, int amode, int flag)
{
return __nolibc_syscall4(__NR_faccessat, fd, path, amode, flag);
}
static __attribute__((unused))
int faccessat(int fd, const char *path, int amode, int flag)
{
- return __sysret(sys_faccessat(fd, path, amode, flag));
+ return __sysret(_sys_faccessat(fd, path, amode, flag));
}
static __attribute__((unused))
{
struct timeval my_timeval = { msecs / 1000, (msecs % 1000) * 1000 };
- if (sys_select(0, NULL, NULL, NULL, &my_timeval) < 0)
+ if (_sys_select(0, NULL, NULL, NULL, &my_timeval) < 0)
return (my_timeval.tv_sec * 1000) +
(my_timeval.tv_usec / 1000) +
!!(my_timeval.tv_usec % 1000);
{
struct timeval my_timeval = { seconds, 0 };
- if (sys_select(0, NULL, NULL, NULL, &my_timeval) < 0)
+ if (_sys_select(0, NULL, NULL, NULL, &my_timeval) < 0)
return my_timeval.tv_sec + !!my_timeval.tv_usec;
else
return 0;
{
struct timeval my_timeval = { usecs / 1000000, usecs % 1000000 };
- return sys_select(0, NULL, NULL, NULL, &my_timeval);
+ return _sys_select(0, NULL, NULL, NULL, &my_timeval);
}
static __attribute__((unused))