From patchwork Mon Nov 11 17:04:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Capper X-Patchwork-Id: 21447 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f197.google.com (mail-ie0-f197.google.com [209.85.223.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6C2CC23FBA for ; Mon, 11 Nov 2013 17:04:29 +0000 (UTC) Received: by mail-ie0-f197.google.com with SMTP id qd12sf10072ieb.0 for ; Mon, 11 Nov 2013 09:04:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=unETOX05169A7uFKoGNcS8dlNpHOfma3VXCofXaL+vY=; b=bYUWF4kFwhDocu15PM/SdGrRJZZ45jQh5zGcFTyxAXWRokSo2OMA2vtzG0iPlkU1+E YXNRNEVIX1PvQN85lPl3MMjDbFwCmuVCrzslpeaNh6IHGv9DCIHDMXpeO4NDgWXE6i4d yK6cW08mxIYDMbio8jI2B1p545la7nD8r1BomQ9fBA8l24+4tnzRCcKBKnidrbG7OrQo ycAc/vX0aKCc6GuCUHncBUQWg8MHWB4FIxES7QL9y6HdH4UtIJeZB+39Ych9437AkDq1 EnMBuCCZf+IM0XNt1Y9HswrjAxOlaaaZjzDABR9askjNFwqBt0EXMKXXJ1vvWlXO7dSg PNxg== X-Gm-Message-State: ALoCoQkN6J252bt24ilPlddkE5MS0f8SiHvIKRHU3deUeLg0aM8LZz+WFtB7pU3APbCAPh7ivtf1 X-Received: by 10.182.111.134 with SMTP id ii6mr9973925obb.38.1384189468892; Mon, 11 Nov 2013 09:04:28 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.28.164 with SMTP id c4ls2524422qeh.63.gmail; Mon, 11 Nov 2013 09:04:28 -0800 (PST) X-Received: by 10.221.40.10 with SMTP id to10mr4009562vcb.22.1384189468780; Mon, 11 Nov 2013 09:04:28 -0800 (PST) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id cx4si6656070vcb.5.2013.11.11.09.04.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 11 Nov 2013 09:04:28 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id ib11so744321vcb.11 for ; Mon, 11 Nov 2013 09:04:28 -0800 (PST) X-Received: by 10.52.65.136 with SMTP id x8mr5752731vds.23.1384189468643; Mon, 11 Nov 2013 09:04:28 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp104306vcz; Mon, 11 Nov 2013 09:04:27 -0800 (PST) X-Received: by 10.180.72.238 with SMTP id g14mr12901419wiv.17.1384189467564; Mon, 11 Nov 2013 09:04:27 -0800 (PST) Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com [209.85.212.173]) by mx.google.com with ESMTPS id ce5si9977759wjc.98.2013.11.11.09.04.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 11 Nov 2013 09:04:27 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.173 is neither permitted nor denied by best guess record for domain of steve.capper@linaro.org) client-ip=209.85.212.173; Received: by mail-wi0-f173.google.com with SMTP id ey11so2468756wid.6 for ; Mon, 11 Nov 2013 09:04:27 -0800 (PST) X-Received: by 10.194.219.1 with SMTP id pk1mr5498339wjc.36.1384189466750; Mon, 11 Nov 2013 09:04:26 -0800 (PST) Received: from marmot.wormnet.eu (marmot.wormnet.eu. [188.246.204.87]) by mx.google.com with ESMTPSA id dj8sm35959163wid.2.2013.11.11.09.04.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Nov 2013 09:04:26 -0800 (PST) From: Steve Capper To: klibc@zytor.com Cc: hpa@zytor.com, anil.singhar@linaro.org, steve.mcintyre@linaro.org, codehelp@debian.org, wookey@wookware.org, patches@linaro.org, Steve Capper Subject: [PATCH V2 2/3] syscalls: Add syscalls needed by arm64 Date: Mon, 11 Nov 2013 17:04:11 +0000 Message-Id: <1384189452-9697-3-git-send-email-steve.capper@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1384189452-9697-1-git-send-email-steve.capper@linaro.org> References: <1384189452-9697-1-git-send-email-steve.capper@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: steve.capper@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , arm64 uses generic syscalls, and does not include the "noat", "noflags", and "deprecated" syscalls. i.e. __ARCH_WANT_SYSCALL_{NO_AT|NO_FLAGS|DEPRECATED} This patch adds the syscalls needed for klibc to run on arm64. Originally-by: Neil Williams Originally-by: Anil Singhar Signed-off-by: Steve Capper --- Changed in V2: chmod, stat, lstat re-implemented using *at syscalls. open64 merged with open. general pipe wrapper added. --- usr/klibc/Kbuild | 3 +++ usr/klibc/SYSCALLS.def | 39 ++++++++++++++++++++------------------- usr/klibc/access.c | 12 ++++++++++++ usr/klibc/chmod.c | 13 +++++++++++++ usr/klibc/chown.c | 12 ++++++++++++ usr/klibc/dup2.c | 11 +++++++++++ usr/klibc/lchown.c | 12 ++++++++++++ usr/klibc/link.c | 12 ++++++++++++ usr/klibc/lstat.c | 14 ++++++++++++++ usr/klibc/mkdir.c | 14 ++++++++++++++ usr/klibc/mknod.c | 14 ++++++++++++++ usr/klibc/open.c | 29 +++++++++++++++++++++++++++-- usr/klibc/pipe.c | 11 +++++++++++ usr/klibc/poll.c | 21 +++++++++++++++++++++ usr/klibc/readlink.c | 12 ++++++++++++ usr/klibc/rename.c | 11 +++++++++++ usr/klibc/rmdir.c | 12 ++++++++++++ usr/klibc/select.c | 34 ++++++++++++++++++++++++++++++++++ usr/klibc/stat.c | 14 ++++++++++++++ usr/klibc/symlink.c | 12 ++++++++++++ usr/klibc/unlink.c | 12 ++++++++++++ usr/klibc/utimes.c | 20 ++++++++++++++++++++ 22 files changed, 323 insertions(+), 21 deletions(-) create mode 100644 usr/klibc/access.c create mode 100644 usr/klibc/chmod.c create mode 100644 usr/klibc/chown.c create mode 100644 usr/klibc/dup2.c create mode 100644 usr/klibc/lchown.c create mode 100644 usr/klibc/link.c create mode 100644 usr/klibc/lstat.c create mode 100644 usr/klibc/mkdir.c create mode 100644 usr/klibc/mknod.c create mode 100644 usr/klibc/pipe.c create mode 100644 usr/klibc/poll.c create mode 100644 usr/klibc/readlink.c create mode 100644 usr/klibc/rename.c create mode 100644 usr/klibc/rmdir.c create mode 100644 usr/klibc/select.c create mode 100644 usr/klibc/stat.c create mode 100644 usr/klibc/symlink.c create mode 100644 usr/klibc/unlink.c create mode 100644 usr/klibc/utimes.c diff --git a/usr/klibc/Kbuild b/usr/klibc/Kbuild index 2bef9ca..40d43c7 100644 --- a/usr/klibc/Kbuild +++ b/usr/klibc/Kbuild @@ -58,6 +58,9 @@ klib-y += vsnprintf.o snprintf.o vsprintf.o sprintf.o \ inet/inet_ntoa.o inet/inet_aton.o inet/inet_addr.o \ inet/inet_ntop.o inet/inet_pton.o inet/bindresvport.o \ send.o recv.o \ + access.o chmod.o chown.o dup2.o mknod.o poll.o rename.o stat.o \ + lchown.o link.o rmdir.o unlink.o utimes.o lstat.o mkdir.o \ + readlink.o select.o symlink.o pipe.o \ ctype/isalnum.o ctype/isalpha.o ctype/isascii.o \ ctype/isblank.o ctype/iscntrl.o ctype/isdigit.o \ ctype/isgraph.o ctype/islower.o ctype/isprint.o \ diff --git a/usr/klibc/SYSCALLS.def b/usr/klibc/SYSCALLS.def index 55d8e36..12f57ac 100644 --- a/usr/klibc/SYSCALLS.def +++ b/usr/klibc/SYSCALLS.def @@ -106,34 +106,34 @@ int swapoff(const char *); /* * Inode-related system calls */ -int access(const char *, int); + int access(const char *, int); int faccessat(int, const char *, int, int); -int link(const char *, const char *); + int link(const char *, const char *); int linkat(int, const char *, int, const char *, int); -int unlink(const char *); + int unlink(const char *); int unlinkat(int, const char *, int); int chdir(const char *); int fchdir(int); -int rename(const char *, const char *); + int rename(const char *, const char *); int renameat(int, const char *, int, const char *); -int mknod(const char *, mode_t, dev_t); + int mknod(const char *, mode_t, dev_t); int mknodat(int, const char *, mode_t, dev_t); -int chmod(const char *, mode_t); + int chmod(const char *, mode_t); int fchmod(int, mode_t); int fchmodat(int, const char *, mode_t, int); -int mkdir(const char *, mode_t); + int mkdir(const char *, mode_t); int mkdirat(int, const char *, mode_t); -int rmdir(const char *); - int pipe(int *); + int rmdir(const char *); + int pipe(int *); int pipe2(int *, int); mode_t umask(mode_t); int chroot(const char *); -int symlink(const char *, const char *); + int symlink(const char *, const char *); int symlinkat(const char *, int, const char *); -int readlink(const char *, char *, size_t); + int readlink(const char *, char *, size_t); int readlinkat(int, const char *, char *, int); - int stat64,stat::stat(const char *, struct stat *); - int lstat64,lstat::lstat(const char *, struct stat *); + int stat64,stat::stat(const char *, struct stat *); + int lstat64,lstat::lstat(const char *, struct stat *); int fstat64,fstat::fstat(int, struct stat *); int stat::stat(const char *, struct stat *); int lstat::lstat(const char *, struct stat *); @@ -141,14 +141,15 @@ int readlink(const char *, char *, size_t); /* XXX: Is this right?! */ int fstatat64,newfstatat,fstatat::fstatat(int, const char *, struct stat *, int); int getdents64,getdents::getdents(unsigned int, struct dirent *, unsigned int); -int chown32,chown::chown(const char *, uid_t, gid_t); + int chown32,chown::chown(const char *, uid_t, gid_t); int fchown32,fchown::fchown(int, uid_t, gid_t); int fchownat(int, const char *, uid_t, gid_t, int); -int lchown32,lchown::lchown(const char *, uid_t, gid_t); + int lchown32,lchown::lchown(const char *, uid_t, gid_t); int getcwd::__getcwd(char *, size_t); int utime(const char *, const struct utimbuf *); int utimes(const char *, const struct timeval *); int futimesat(int, const char *, const struct timeval *); + int utimensat(int, const char *, const struct timespec *, int); int inotify_init(); int inotify_add_watch(int, const char *, __u32); int inotify_rm_watch(int, __u32); @@ -158,7 +159,7 @@ int getcwd::__getcwd(char *, size_t); */ int open::__open(const char *, int, mode_t); int openat::__openat(int, const char *, int, mode_t); -<64> int open(const char *, int, mode_t); + int open(const char *, int, mode_t); <64> int openat(int, const char *, int, mode_t); ssize_t read(int, void *, size_t); ssize_t write(int, const void *, size_t); @@ -166,14 +167,14 @@ int close(int); <64> off_t lseek(int, off_t, int); <32> int _llseek::__llseek(int, unsigned long, unsigned long, off_t *, int); int dup(int); -int dup2(int, int); + int dup2(int, int); int dup3(int, int, int); int fcntl64@varadic::fcntl(int, int, unsigned long); int fcntl(int, int, unsigned long); int fcntl64,fcntl::fcntl(int, int, unsigned long); int ioctl(int, int, void *); int flock(int, int); -int _newselect,select::select(int, fd_set *, fd_set *, fd_set *, struct timeval *); + int _newselect,select::select(int, fd_set *, fd_set *, fd_set *, struct timeval *); #if defined(__NR_pselect) && !_KLIBC_USE_RT_SIG int pselect(int, fd_set *, fd_set *, fd_set *, const struct timespec *, const sigset_t *); #elif defined(__NR_pselect7) @@ -181,7 +182,7 @@ int pselect7::__pselect7(int, fd_set *, fd_set *, fd_set *, struct timespec *, c #elif defined(__NR_pselect6) int pselect6::__pselect6(int, fd_set *, fd_set *, fd_set *, struct timespec *, const struct __pselect6 *); #endif -int poll(struct pollfd *, nfds_t, long); + int poll(struct pollfd *, nfds_t, long); int ppoll::__ppoll(struct pollfd *, nfds_t, struct timespec *, const sigset_t *, size_t); int fsync(int); int fdatasync,fsync::fdatasync(int); diff --git a/usr/klibc/access.c b/usr/klibc/access.c new file mode 100644 index 0000000..0f24856 --- /dev/null +++ b/usr/klibc/access.c @@ -0,0 +1,12 @@ +#include +#include +#include + +#ifndef __NR_access + +int access(const char *pathname, int mode) +{ + return faccessat(AT_FDCWD, pathname, mode, 0); +} + +#endif /* __NR_access */ diff --git a/usr/klibc/chmod.c b/usr/klibc/chmod.c new file mode 100644 index 0000000..b5129e6 --- /dev/null +++ b/usr/klibc/chmod.c @@ -0,0 +1,13 @@ +#include +#include +#include +#include + +#ifndef __NR_chmod + +int chmod(const char *path, mode_t mode) +{ + return fchmodat(AT_FDCWD, path, mode, 0); +} + +#endif /* __NR_chmod */ diff --git a/usr/klibc/chown.c b/usr/klibc/chown.c new file mode 100644 index 0000000..089cfc5 --- /dev/null +++ b/usr/klibc/chown.c @@ -0,0 +1,12 @@ +#include +#include +#include + +#ifndef __NR_chown + +int chown(const char *path, uid_t owner, gid_t group) +{ + return fchownat(AT_FDCWD, path, owner, group, 0); +} + +#endif /* __NR_chown */ diff --git a/usr/klibc/dup2.c b/usr/klibc/dup2.c new file mode 100644 index 0000000..67e2171 --- /dev/null +++ b/usr/klibc/dup2.c @@ -0,0 +1,11 @@ +#include +#include + +#ifndef __NR_dup2 + +int dup2(int fd, int fd2) +{ + return dup3(fd, fd2, 0); +} + +#endif /* __NR_dup2 */ diff --git a/usr/klibc/lchown.c b/usr/klibc/lchown.c new file mode 100644 index 0000000..9a9e1e1 --- /dev/null +++ b/usr/klibc/lchown.c @@ -0,0 +1,12 @@ +#include +#include +#include + +#ifndef __NR_lchown + +int lchown(const char *path, uid_t owner, gid_t group) +{ + return fchownat(AT_FDCWD, path, owner, group, AT_SYMLINK_NOFOLLOW); +} + +#endif /* __NR_lchown */ diff --git a/usr/klibc/link.c b/usr/klibc/link.c new file mode 100644 index 0000000..1d4b70e --- /dev/null +++ b/usr/klibc/link.c @@ -0,0 +1,12 @@ +#include +#include +#include + +#ifndef __NR_link + +int link(const char *oldpath, const char *newpath) +{ + return linkat(AT_FDCWD, oldpath, AT_FDCWD, newpath, 0); +} + +#endif /* __NR_link */ diff --git a/usr/klibc/lstat.c b/usr/klibc/lstat.c new file mode 100644 index 0000000..3288a33 --- /dev/null +++ b/usr/klibc/lstat.c @@ -0,0 +1,14 @@ +#include +#include +#include +#include +#include + +#ifndef __NR_lstat + +int lstat(const char *path, struct stat *buf) +{ + return fstatat(AT_FDCWD, path, buf, AT_SYMLINK_NOFOLLOW); +} + +#endif /* __NR_lstat */ diff --git a/usr/klibc/mkdir.c b/usr/klibc/mkdir.c new file mode 100644 index 0000000..27673e3 --- /dev/null +++ b/usr/klibc/mkdir.c @@ -0,0 +1,14 @@ +#include +#include +#include +#include +#include + +#ifndef __NR_mkdir + +int mkdir(const char *pathname, mode_t mode) +{ + return mkdirat(AT_FDCWD, pathname, mode); +} + +#endif /* __NR_mkdir */ diff --git a/usr/klibc/mknod.c b/usr/klibc/mknod.c new file mode 100644 index 0000000..727505f --- /dev/null +++ b/usr/klibc/mknod.c @@ -0,0 +1,14 @@ +#include +#include +#include +#include +#include + +#ifndef __NR_mknod + +int mknod(const char *pathname, mode_t mode, dev_t dev) +{ + return mknodat(AT_FDCWD, pathname, mode, dev); +} + +#endif /* __NR_mknod */ diff --git a/usr/klibc/open.c b/usr/klibc/open.c index 126f6db..5305c3d 100644 --- a/usr/klibc/open.c +++ b/usr/klibc/open.c @@ -3,14 +3,39 @@ * * On 32-bit platforms we need to pass O_LARGEFILE to the open() * system call, to indicate that we're 64-bit safe. + * + * For 64 bit systems without the open syscall, pass straight + * through into openat. */ #define _KLIBC_IN_OPEN_C #include #include #include +#include + +#ifndef __NR_open +#if _BITSIZE == 32 + +extern int __openat(int, const char *, int, mode_t); + +int open(const char *pathname, int flags, mode_t mode) +{ + return __openat(AT_FDCWD, pathname, flags | O_LARGEFILE, mode); +} + +#else + +__extern int openat(int, const char *, int, ...); + +int open(const char *pathname, int flags, mode_t mode) +{ + return openat(AT_FDCWD, pathname, flags, mode); +} + +#endif /* _BITSIZE == 32 */ -#if _BITSIZE == 32 && !defined(__i386__) && !defined(__m68k__) +#elif _BITSIZE == 32 && !defined(__i386__) && !defined(__m68k__) extern int __open(const char *, int, mode_t); @@ -19,4 +44,4 @@ int open(const char *pathname, int flags, mode_t mode) return __open(pathname, flags | O_LARGEFILE, mode); } -#endif +#endif /* __NR_open */ diff --git a/usr/klibc/pipe.c b/usr/klibc/pipe.c new file mode 100644 index 0000000..dfaed9e --- /dev/null +++ b/usr/klibc/pipe.c @@ -0,0 +1,11 @@ +#include +#include + +#ifndef __NR_pipe + +int pipe(int pipefd[2]) +{ + return pipe2(pipefd, 0); +} + +#endif /* __NR_pipe */ diff --git a/usr/klibc/poll.c b/usr/klibc/poll.c new file mode 100644 index 0000000..69da693 --- /dev/null +++ b/usr/klibc/poll.c @@ -0,0 +1,21 @@ +#include +#include +#include + +#ifndef __NR_poll + +int poll (struct pollfd *fds, nfds_t nfds, long timeout) +{ + struct timespec timeout_ts; + struct timespec *timeout_ts_p = NULL; + + if (timeout >= 0) { + timeout_ts.tv_sec = timeout / 1000; + timeout_ts.tv_nsec = (timeout % 1000) * 1000000; + timeout_ts_p = &timeout_ts; + } + + return ppoll(fds, nfds, timeout_ts_p, 0); +} + +#endif /* __NR_poll */ diff --git a/usr/klibc/readlink.c b/usr/klibc/readlink.c new file mode 100644 index 0000000..0e67442 --- /dev/null +++ b/usr/klibc/readlink.c @@ -0,0 +1,12 @@ +#include +#include +#include + +#ifndef __NR_readlink + +int readlink(const char *path, char *buf, size_t bufsiz) +{ + return readlinkat(AT_FDCWD, path, buf, bufsiz); +} + +#endif /* __NR_readlink */ diff --git a/usr/klibc/rename.c b/usr/klibc/rename.c new file mode 100644 index 0000000..587c26f --- /dev/null +++ b/usr/klibc/rename.c @@ -0,0 +1,11 @@ +#include +#include + +#ifndef __NR_rename + +int rename(const char *oldpath, const char *newpath) +{ + return renameat(AT_FDCWD, oldpath, AT_FDCWD, newpath); +} + +#endif /* __NR_rename */ diff --git a/usr/klibc/rmdir.c b/usr/klibc/rmdir.c new file mode 100644 index 0000000..94ae5f2 --- /dev/null +++ b/usr/klibc/rmdir.c @@ -0,0 +1,12 @@ +#include +#include +#include + +#ifndef __NR_rmdir + +int rmdir(const char *pathname) +{ + return unlinkat(AT_FDCWD, pathname, AT_REMOVEDIR); +} + +#endif /* __NR_rmdir */ diff --git a/usr/klibc/select.c b/usr/klibc/select.c new file mode 100644 index 0000000..e416794 --- /dev/null +++ b/usr/klibc/select.c @@ -0,0 +1,34 @@ +#include +#include +#include +#include +#include + +#if !defined(__NR_select) && !defined(__NR__newselect) + +struct __pselect6; +__extern int __pselect6(int, fd_set *, fd_set *, fd_set *, + const struct timespec *, const struct __pselect6 *); + +int select(int nfds, fd_set *readfds, fd_set *writefds, + fd_set *exceptfds, struct timeval *timeout) +{ + int result; + struct timespec ts; + + if (timeout) { + ts.tv_sec = timeout->tv_sec; + ts.tv_nsec = timeout->tv_usec * 1000; + } + + result = __pselect6(nfds, readfds, writefds, exceptfds, &ts, NULL); + + if (timeout) { + timeout->tv_sec = ts.tv_sec; + timeout->tv_usec = ts.tv_nsec / 1000; + } + + return result; +} + +#endif diff --git a/usr/klibc/stat.c b/usr/klibc/stat.c new file mode 100644 index 0000000..65063b0 --- /dev/null +++ b/usr/klibc/stat.c @@ -0,0 +1,14 @@ +#include +#include +#include +#include +#include + +#ifndef __NR_stat + +int stat(const char *path, struct stat *buf) +{ + return fstatat(AT_FDCWD, path, buf, 0); +} + +#endif /* __NR_stat */ diff --git a/usr/klibc/symlink.c b/usr/klibc/symlink.c new file mode 100644 index 0000000..080394f --- /dev/null +++ b/usr/klibc/symlink.c @@ -0,0 +1,12 @@ +#include +#include +#include + +#ifndef __NR_symlink + +int symlink(const char *oldpath, const char *newpath) +{ + return symlinkat(oldpath, AT_FDCWD, newpath); +} + +#endif /* __NR_symlink */ diff --git a/usr/klibc/unlink.c b/usr/klibc/unlink.c new file mode 100644 index 0000000..6dfe66c --- /dev/null +++ b/usr/klibc/unlink.c @@ -0,0 +1,12 @@ +#include +#include +#include + +#ifndef __NR_unlink + +int unlink(const char *pathname) +{ + return unlinkat(AT_FDCWD, pathname, 0); +} + +#endif /* __NR_unlink */ diff --git a/usr/klibc/utimes.c b/usr/klibc/utimes.c new file mode 100644 index 0000000..fd378a6 --- /dev/null +++ b/usr/klibc/utimes.c @@ -0,0 +1,20 @@ +#include +#include +#include +#include + +#ifndef __NR_utimes + +int utimes(const char *file, const struct timeval tvp[2]) +{ + struct timespec ts[2]; + + if (tvp) { + ts->tv_sec = tvp->tv_sec; + ts->tv_nsec = tvp->tv_usec * 1000; + } + + return utimensat(AT_FDCWD, file, &ts[0], 0); +} + +#endif /* __NR_utimes */