mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Add lchown(2).
This commit is contained in:
parent
3b35dad9f7
commit
deeedf9e5d
3 changed files with 35 additions and 1 deletions
|
@ -167,6 +167,7 @@ ioleast.o \
|
|||
isatty.o \
|
||||
kernelinfo.o \
|
||||
kill.o \
|
||||
lchown.o \
|
||||
linkat.o \
|
||||
link.o \
|
||||
localeconv.o \
|
||||
|
|
|
@ -109,7 +109,6 @@ pid_t getpgid(pid_t);
|
|||
pid_t getpgrp(void);
|
||||
pid_t getsid(pid_t);
|
||||
uid_t getuid(void);
|
||||
int lchown(const char*, uid_t, gid_t);
|
||||
int lockf(int, int, off_t);
|
||||
int nice(int);
|
||||
long pathconf(const char*, int);
|
||||
|
@ -166,6 +165,7 @@ char* get_current_dir_name(void);
|
|||
pid_t getpid(void);
|
||||
pid_t getppid(void);
|
||||
int isatty(int);
|
||||
int lchown(const char*, uid_t, gid_t);
|
||||
int link(const char*, const char*);
|
||||
int linkat(int, const char*, int, const char*, int);
|
||||
off_t lseek(int, off_t, int);
|
||||
|
|
33
libc/lchown.cpp
Normal file
33
libc/lchown.cpp
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2013.
|
||||
|
||||
This file is part of the Sortix C Library.
|
||||
|
||||
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The Sortix C Library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
lchown.cpp
|
||||
Changes the owner and group of a file.
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
extern "C" int lchown(const char* path, uid_t owner, gid_t group)
|
||||
{
|
||||
return fchownat(AT_FDCWD, path, owner, group, AT_SYMLINK_NOFOLLOW);
|
||||
}
|
Loading…
Reference in a new issue