]> git.ipfire.org Git - thirdparty/glibc.git/blame - ports/sysdeps/unix/sysv/linux/alpha/fxstat.c
Update copyright notices with scripts/update-copyrights
[thirdparty/glibc.git] / ports / sysdeps / unix / sysv / linux / alpha / fxstat.c
CommitLineData
b4d2a423 1/* fxstat using old-style Unix stat system call.
d4697bc9 2 Copyright (C) 2004-2014 Free Software Foundation, Inc.
b4d2a423
RH
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
ab84e3ff
PE
16 License along with the GNU C Library. If not, see
17 <http://www.gnu.org/licenses/>. */
b4d2a423
RH
18
19#define __fxstat64 __fxstat64_disable
20
21#include <errno.h>
22#include <stddef.h>
23#include <sys/stat.h>
24#include <kernel_stat.h>
25#include <sysdep.h>
26#include <sys/syscall.h>
27#include <xstatconv.h>
28
29#undef __fxstat64
30
31
32/* Get information about the file NAME in BUF. */
33int
34__fxstat (int vers, int fd, struct stat *buf)
35{
36 INTERNAL_SYSCALL_DECL (err);
6a84c77c 37 int result;
b4d2a423
RH
38 struct kernel_stat kbuf;
39
6a84c77c
GM
40 if (vers == _STAT_VER_KERNEL64)
41 {
42 result = INTERNAL_SYSCALL (fstat64, err, 2, fd, buf);
43 if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
44 return result;
45 __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
46 return -1;
47 }
b4d2a423
RH
48
49 result = INTERNAL_SYSCALL (fstat, err, 2, fd, &kbuf);
50 if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
51 return __xstat_conv (vers, &kbuf, buf);
6a84c77c 52 __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
b4d2a423
RH
53 return -1;
54}
55hidden_def (__fxstat)
56weak_alias (__fxstat, _fxstat);
57strong_alias (__fxstat, __fxstat64);
58hidden_ver (__fxstat, __fxstat64)