/* Copyright (C) 2008 Emmanuel Varoquaux This file is part of XOS. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include "unistd.h" #include "xos.h" #include "misc.h" #include char **environ __attribute__ ((weak, visibility ("default"))); off_t __attribute__ ((weak, visibility ("default"))) lseek(int fd, off_t offset, int whence) { return __syscall_seek(fd, offset, whence); } typeof (lseek) __lseek __attribute__ ((alias ("lseek"))); int __attribute__ ((weak, visibility ("default"))) close(int fd) { return __syscall_close(fd); } typeof (close) __close __attribute__ ((alias ("close"))); ssize_t __attribute__ ((weak, visibility ("default"))) read(int fd, void *buf, size_t count) { return __syscall_read(fd, buf, count); } typeof (read) __read __attribute__ ((alias ("read"))); ssize_t __attribute__ ((weak, visibility ("default"))) write(int fd, const void *buf, size_t count) { return __syscall_write(fd, buf, count); } typeof (write) __write __attribute__ ((alias ("write"))); int __attribute__ ((weak, visibility ("default"))) pipe(int fd[2]) { return __syscall_pipe(fd); } typeof (pipe) __pipe __attribute__ ((alias ("pipe"))); unsigned int __attribute__ ((weak, visibility ("default"))) sleep(unsigned int seconds) { return __syscall_sleep(seconds); } typeof (sleep) __sleep __attribute__ ((alias ("sleep"))); int __attribute__ ((weak, visibility ("default"))) chdir(const char *path) { return __syscall_chdir(path); } typeof (chdir) __chdir __attribute__ ((alias ("chdir"))); int __attribute__ ((weak, visibility ("default"))) dup(int fd) { return __syscall_dup(fd); } typeof (dup) __dup __attribute__ ((alias ("dup"))); int __attribute__ ((weak, visibility ("default"))) dup2(int fd, int newfd) { return __syscall_dup2(fd, newfd); } typeof (dup2) __dup2 __attribute__ ((alias ("dup2"))); void __attribute__ ((weak, visibility ("default"))) _exit(int status) { __syscall_exit(status); } pid_t __attribute__ ((weak, visibility ("default"))) getpid() { return __syscall_getpid(); } typeof (getpid) __getpid __attribute__ ((alias ("getpid"))); pid_t __attribute__ ((weak, visibility ("default"))) getpgrp() { return __syscall_getpgid(); } typeof (getpgrp) __getpgrp __attribute__ ((alias ("getpgrp"))); int __attribute__ ((weak, visibility ("default"))) setpgid(pid_t pid, pid_t pgid) { return __syscall_setpgid(pid, pgid); } typeof (setpgid) __setpgid __attribute__ ((alias ("setpgid"))); pid_t __attribute__ ((weak, visibility ("default"))) fork() { return __syscall_fork(); } typeof (fork) __fork __attribute__ ((alias ("fork"))); int __attribute__ ((weak, visibility ("default"))) isatty(int fd) { unsigned long lflags; return __syscall_ioctl(fd, _XOS_TGETLF, &lflags) == 0; } typeof (isatty) __isatty __attribute__ ((alias ("isatty"))); int __attribute__ ((weak, visibility ("default"))) unlink(const char *path) { return __syscall_remove(path); } typeof (unlink) __unlink __attribute__ ((alias ("unlink"))); int __attribute__ ((weak, visibility ("default"))) rmdir(const char *path) { return __syscall_rmdir(path); } typeof (rmdir) __rmdir __attribute__ ((alias ("rmdir"))); pid_t __attribute__ ((weak, visibility ("default"))) tcgetpgrp(int fd) { int pgid; if (__syscall_ioctl(fd, _XOS_TGETPGID, &pgid) == -1) return -1; return pgid; } int __attribute__ ((weak, visibility ("default"))) tcsetpgrp(int fd, pid_t pgid) { int _pgid; _pgid = pgid; if (__syscall_ioctl(fd, _XOS_TSETPGID, &_pgid) == -1) return -1; return 0; } int __attribute__ ((weak, visibility ("default"))) getpagesize() { return PAGESIZE; }