]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/unix/sysv/linux/i386/chown.c
Remove pre-2.4 Linux kernel support.
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / i386 / chown.c
1 /* Copyright (C) 1998-2012 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
17
18 #include <errno.h>
19 #include <unistd.h>
20
21 #include <sysdep.h>
22 #include <sys/syscall.h>
23 #include <shlib-compat.h>
24 #include <bp-checks.h>
25
26 #include <linux/posix_types.h>
27
28 /*
29 In Linux 2.1.x the chown functions have been changed. A new function lchown
30 was introduced. The new chown now follows symlinks - the old chown and the
31 new lchown do not follow symlinks.
32 The new lchown function has the same number as the old chown had and the
33 new chown has a new number. When compiling with headers from Linux > 2.1.8x
34 it's impossible to run this libc with older kernels. In these cases libc
35 has therefore to route calls to chown to the old chown function.
36 */
37
38 extern int __chown_is_lchown (const char *__file, uid_t __owner,
39 gid_t __group);
40 extern int __real_chown (const char *__file, uid_t __owner, gid_t __group);
41
42
43 /* Consider moving to syscalls.list. */
44
45 int
46 __real_chown (const char *file, uid_t owner, gid_t group)
47 {
48 return INLINE_SYSCALL (chown32, 3, CHECK_STRING (file), owner, group);
49 }
50
51
52 #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
53 /* Compiling for compatibiity. */
54 int
55 attribute_compat_text_section
56 __chown_is_lchown (const char *file, uid_t owner, gid_t group)
57 {
58 return __lchown (file, owner, group);
59 }
60 #endif
61
62 #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
63 compat_symbol (libc, __chown_is_lchown, chown, GLIBC_2_0);
64 #endif
65
66 versioned_symbol (libc, __real_chown, chown, GLIBC_2_1);
67 strong_alias (__real_chown, __chown)
68 libc_hidden_def (__chown)