chown in libc

This commit is contained in:
K. Lange 2018-07-18 12:37:21 +09:00
parent b1fe4fa4ce
commit 1ecdb29e51
3 changed files with 12 additions and 1 deletions

View File

@ -66,6 +66,7 @@ struct utimbuf {
extern char * ttyname(int fd);
extern int utime(const char *filename, const struct utimbuf *times);
extern int rmdir(const char *pathname); /* TODO rm probably just works */
extern int chown(const char * pathname, uid_t owner, gid_t group);
#define STDIN_FILENO 0
#define STDOUT_FILENO 1

View File

@ -42,7 +42,6 @@ DEFN_SYSCALL5(mount, SYS_MOUNT, char *, char *, char *, unsigned long, void *);
DEFN_SYSCALL2(lstat, SYS_LSTAT, char *, void *);
DEFN_SYSCALL2(fswait, SYS_FSWAIT, int, int *);
DEFN_SYSCALL3(fswait2, SYS_FSWAIT2, int, int *,int);
DEFN_SYSCALL3(chown, SYS_CHOWN, char *, int, int);
extern void _init();
extern void _fini();

11
libc/unistd/chown.c Normal file
View File

@ -0,0 +1,11 @@
#include <unistd.h>
#include <errno.h>
#include <syscall.h>
#include <syscall_nums.h>
DEFN_SYSCALL3(chown, SYS_CHOWN, char *, int, int);
int chown(const char * pathname, uid_t owner, gid_t group) {
__sets_errno(syscall_chown((char*)pathname,owner,group));
}