From 0bc2e60c7231564599bcc3eeb31288f2e4d785c6 Mon Sep 17 00:00:00 2001 From: Giacomo Tesio Date: Thu, 31 Aug 2017 00:50:31 +0200 Subject: [PATCH] libposix: stub chown family (always returning 0) I do not expect chown, fchownat and lchown to be much used in UNIX softwares that we care to port. We stub the functions in libposix so that we can refer them from standard C libaries (such as newlib). We will implement them (parsing /cfg/users to determinate uid and gid) when it will be actually needed from a software ported to Jehanne. --- sys/include/posix.h | 3 +++ sys/src/lib/posix/files.c | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/sys/include/posix.h b/sys/include/posix.h index 67ab5bb..e9c61dc 100644 --- a/sys/include/posix.h +++ b/sys/include/posix.h @@ -90,6 +90,9 @@ extern int POSIX_access(int *errnop, const char *path, int amode); extern void POSIX_exit(int code) __attribute__((noreturn)); extern int POSIX_chmod(int *errnop, const char *path, int mode); extern int POSIX_fchmodat(int *errnop, int fd, const char *path, long mode, int flag); +extern int POSIX_chown(int *errnop, const char *pathname, int owner, int group); +extern int POSIX_fchownat(int *errnop, int fd, const char *path, int owner, int group, int flag); +extern int POSIX_lchown(int *errnop, const char *path, int owner, int group); extern int POSIX_chdir(int *errnop, const char *path); extern int POSIX_fchdir(int *errnop, int fd); extern int POSIX_mkdir(int *errnop, const char *path, int mode); diff --git a/sys/src/lib/posix/files.c b/sys/src/lib/posix/files.c index c2bdf6f..97ff98f 100644 --- a/sys/src/lib/posix/files.c +++ b/sys/src/lib/posix/files.c @@ -529,6 +529,27 @@ FailWithError: return -1; } +int +POSIX_chown(int *errnop, const char *pathname, int owner, int group) +{ + /* TODO: implement when actually needed */ + return 0; +} + +int +POSIX_fchownat(int *errnop, int fd, const char *path, int owner, int group, int flag) +{ + /* TODO: implement when actually needed */ + return 0; +} + +int +POSIX_lchown(int *errnop, const char *path, int owner, int group) +{ + /* TODO: implement when actually needed */ + return 0; +} + int POSIX_chdir(int *errnop, const char *path) {