Update copyright notices with scripts/update-copyrights.
[glibc.git] / sysdeps / unix / sysv / linux / s390 / s390-32 / chown.c
blob408d24aae81efa687daf96ca99158e846c84d7b6
1 /* Copyright (C) 2000-2013 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
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.
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.
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/>. */
18 #include <errno.h>
19 #include <unistd.h>
21 #include <sysdep.h>
22 #include <sys/syscall.h>
23 #include <shlib-compat.h>
24 #include <bp-checks.h>
26 #include <linux/posix_types.h>
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.
38 /* Running under Linux > 2.1.80. */
40 /* Consider moving to syscalls.list. */
42 int
43 __real_chown (const char *file, uid_t owner, gid_t group)
45 return INLINE_SYSCALL (chown32, 3, CHECK_STRING (file), owner, group);
49 #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
50 /* Compiling for compatibiity. */
51 int
52 attribute_compat_text_section
53 __chown_is_lchown (const char *file, uid_t owner, gid_t group)
55 return __lchown (file, owner, group);
57 #endif
59 #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
60 strong_alias (__chown_is_lchown, _chown_is_lchown)
61 compat_symbol (libc, __chown_is_lchown, __chown, GLIBC_2_0);
62 compat_symbol (libc, _chown_is_lchown, chown, GLIBC_2_0);
64 strong_alias (__real_chown, _real_chown)
65 versioned_symbol (libc, __real_chown, __chown, GLIBC_2_1);
66 versioned_symbol (libc, _real_chown, chown, GLIBC_2_1);
67 libc_hidden_ver (__real_chown, __chown)
68 #else
69 strong_alias (__real_chown, __chown)
70 libc_hidden_def (__chown)
71 weak_alias (__real_chown, chown)
72 #endif