1 /* vi: set sw=4 ts=4: */
5 * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
7 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
10 #include <sys/syscall.h>
12 #include <bits/wordsize.h>
14 #if defined __NR_fchownat && !defined __NR_chown
16 int chown(const char *path, uid_t owner, gid_t group)
18 return fchownat(AT_FDCWD, path, owner, group, 0);
23 # if (__WORDSIZE == 32 && defined(__NR_chown32)) || __WORDSIZE == 64
26 # define __NR_chown __NR_chown32
29 _syscall3(int, chown, const char *, path, uid_t, owner, gid_t, group)
33 # define __NR___syscall_chown __NR_chown
34 static __inline__ _syscall3(int, __syscall_chown, const char *, path,
35 __kernel_uid_t, owner, __kernel_gid_t, group)
37 int chown(const char *path, uid_t owner, gid_t group)
39 if (((owner + 1) > (uid_t) ((__kernel_uid_t) - 1U))
40 || ((group + 1) > (gid_t) ((__kernel_gid_t) - 1U))) {
44 return (__syscall_chown(path, owner, group));
49 libc_hidden_def(chown)