libc: Move chmod from unistd.h to sys/stat.h
All checks were successful
continuous-integration/drone/push Build is passing

Apparently that's where it's supposed to be.
This commit is contained in:
apio 2023-05-11 19:40:34 +02:00
parent 4a764bc315
commit 4a3a92e9d4
Signed by: apio
GPG Key ID: B8A7D06E42258954
5 changed files with 10 additions and 10 deletions

View File

@ -1,7 +1,7 @@
#include <os/ArgumentParser.h> #include <os/ArgumentParser.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <sys/stat.h>
int main(int argc, char** argv) int main(int argc, char** argv)
{ {

View File

@ -18,6 +18,9 @@ extern "C"
/* Create a special file. */ /* Create a special file. */
int mknod(const char* path, mode_t mode, dev_t dev); int mknod(const char* path, mode_t mode, dev_t dev);
/* Change the mode bits of a file. */
int chmod(const char* path, mode_t mode);
#pragma GCC push_options #pragma GCC push_options
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"

View File

@ -52,9 +52,6 @@ extern "C"
/* Set the current process' effective group ID. */ /* Set the current process' effective group ID. */
int setegid(gid_t gid); int setegid(gid_t gid);
/* Change the mode bits of a file. */
int chmod(const char* path, mode_t mode);
/* Change the owner and group of a file. */ /* Change the owner and group of a file. */
int chown(const char* path, uid_t uid, gid_t gid); int chown(const char* path, uid_t uid, gid_t gid);

View File

@ -18,6 +18,12 @@ extern "C"
__errno_return(rc, int); __errno_return(rc, int);
} }
int chmod(const char* path, mode_t mode)
{
long rc = syscall(SYS_chmod, path, mode);
__errno_return(rc, int);
}
int stat(const char* path, struct stat* st) int stat(const char* path, struct stat* st)
{ {
long rc = syscall(SYS_fstatat, AT_FDCWD, path, st, 0); long rc = syscall(SYS_fstatat, AT_FDCWD, path, st, 0);

View File

@ -142,12 +142,6 @@ extern "C"
__errno_return(rc, int); __errno_return(rc, int);
} }
int chmod(const char* path, mode_t mode)
{
long rc = syscall(SYS_chmod, path, mode);
__errno_return(rc, int);
}
int chown(const char* path, uid_t uid, gid_t gid) int chown(const char* path, uid_t uid, gid_t gid)
{ {
long rc = syscall(SYS_chown, path, uid, gid); long rc = syscall(SYS_chown, path, uid, gid);