diff --git a/include/linux/x86/syscall.h b/include/linux/x86/syscall.h index eb776be0..620a8b7d 100644 --- a/include/linux/x86/syscall.h +++ b/include/linux/x86/syscall.h @@ -83,4 +83,8 @@ // make+POSIX #define SYS_sigprocmask 0x7e +// tar +#define SYS_symlink 0x53 +#define SYS_readlink 0x55 + #endif // __MES_LINUX_X86_SYSCALL_H diff --git a/include/linux/x86_64/syscall.h b/include/linux/x86_64/syscall.h index 269546e2..66022289 100644 --- a/include/linux/x86_64/syscall.h +++ b/include/linux/x86_64/syscall.h @@ -80,4 +80,8 @@ // make+POSIX #define SYS_rt_sigprocmask 0x0e +// tar +#define SYS_symlink 0x58 +#define SYS_readlink 0x59 + #endif // __MES_LINUX_X86_64_SYSCALL_H diff --git a/include/unistd.h b/include/unistd.h index a5c840f8..82e51ff5 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -74,15 +74,17 @@ int setuid (uid_t newuid); uid_t geteuid (void); gid_t getegid (void); int isatty (int fd); -int link (char const *oldname, char const *newname); +int link (char const *old_name, char const *new_name); off_t lseek (int fd, off_t offset, int whence); ssize_t read (int fd, void *buffer, size_t size); +ssize_t readlink (char const *file_name, char *buffer, size_t size); #if __SBRK_CHAR_PTRDIFF /* xmalloc in binutils <= 2.10.1 uses this old prototype */ char * sbrk (ptrdiff_t delta); #else void * sbrk (intptr_t delta); #endif +int symlink (char const *old_name, char const *new_name); int unlink (char const *file_name); ssize_t write (int filedes, void const *buffer, size_t size); pid_t getpid (void); diff --git a/lib/linux/gnu.c b/lib/linux/gnu.c index 325eb247..1e9553e3 100644 --- a/lib/linux/gnu.c +++ b/lib/linux/gnu.c @@ -197,3 +197,16 @@ sigprocmask (int how, sigset_t const *set, sigset_t *oldset) return _sys_call3 (SYS_rt_sigprocmask, (long)how, (long)set, (long)oldset); #endif } + +// tar +int +symlink (char const *old_name, char const *new_name) +{ + return _sys_call2 (SYS_symlink, (long)old_name, (long)new_name); +} + +ssize_t +readlink (char const *file_name, char *buffer, size_t size) +{ + return _sys_call3 (SYS_readlink, (long)file_name, (long)buffer, (long)size); +}