mirror of git://sourceware.org/git/glibc.git
hurd: Move {,f,l}xstat{,at} and xmknod{at} to compat symbols
We do not actually need them, so we can move their implementations into the standard {,f,l}stat{,at} variants and only keep compatibility wrappers.
This commit is contained in:
parent
1ccbb9258e
commit
85741f7eba
|
@ -94,36 +94,5 @@ int __lxstat64 (int ver, const char *__filename, struct stat64 *__stat_buf);
|
||||||
int __fxstatat64 (int ver, int __fildes, const char *__filename,
|
int __fxstatat64 (int ver, int __fildes, const char *__filename,
|
||||||
struct stat64 *__stat_buf, int __flag);
|
struct stat64 *__stat_buf, int __flag);
|
||||||
|
|
||||||
# ifdef NO_RTLD_HIDDEN
|
|
||||||
/* These are still required for Hurd. */
|
|
||||||
libc_hidden_proto (__fxstat);
|
|
||||||
libc_hidden_proto (__xstat);
|
|
||||||
libc_hidden_proto (__lxstat);
|
|
||||||
libc_hidden_proto (__fxstatat);
|
|
||||||
# if IS_IN (libc)
|
|
||||||
hidden_proto (__fxstat64);
|
|
||||||
hidden_proto (__xstat64);
|
|
||||||
hidden_proto (__lxstat64);
|
|
||||||
hidden_proto (__fxstatat64);
|
|
||||||
# endif
|
|
||||||
libc_hidden_proto (__xmknod)
|
|
||||||
libc_hidden_proto (__xmknodat)
|
|
||||||
# define stat(fname, buf) __xstat (_STAT_VER, fname, buf)
|
|
||||||
# define lstat(fname, buf) __lxstat (_STAT_VER, fname, buf)
|
|
||||||
# define __lstat(fname, buf) __lxstat (_STAT_VER, fname, buf)
|
|
||||||
# define lstat64(fname, buf) __lxstat64 (_STAT_VER, fname, buf)
|
|
||||||
# define __lstat64(fname, buf) __lxstat64 (_STAT_VER, fname, buf)
|
|
||||||
# define stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf)
|
|
||||||
# define __stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf)
|
|
||||||
# define fstat64(fd, buf) __fxstat64 (_STAT_VER, fd, buf)
|
|
||||||
# define __fstat64(fd, buf) __fxstat64 (_STAT_VER, fd, buf)
|
|
||||||
# define fstat(fd, buf) __fxstat (_STAT_VER, fd, buf)
|
|
||||||
# define __fstat(fd, buf) __fxstat (_STAT_VER, fd, buf)
|
|
||||||
# define __fstatat(dfd, fname, buf, flag) \
|
|
||||||
__fxstatat (_STAT_VER, dfd, fname, buf, flag)
|
|
||||||
# define __fstatat64(dfd, fname, buf, flag) \
|
|
||||||
__fxstatat64 (_STAT_VER, dfd, fname, buf, flag)
|
|
||||||
# endif /* NO_RTLD_HIDDEN */
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -18,6 +18,7 @@ libc {
|
||||||
__read_nocancel; __pread64_nocancel;
|
__read_nocancel; __pread64_nocancel;
|
||||||
__write_nocancel;
|
__write_nocancel;
|
||||||
__libc_lock_self0; __getcwd;
|
__libc_lock_self0; __getcwd;
|
||||||
|
__stat64;
|
||||||
|
|
||||||
_dl_init_first;
|
_dl_init_first;
|
||||||
__close_nocancel_nostatus;
|
__close_nocancel_nostatus;
|
||||||
|
@ -35,7 +36,7 @@ ld {
|
||||||
# functions that must be shared with libc
|
# functions that must be shared with libc
|
||||||
__close; __getpid;
|
__close; __getpid;
|
||||||
__mmap; __open; __read; __sbrk; __strtoul_internal;
|
__mmap; __open; __read; __sbrk; __strtoul_internal;
|
||||||
__write; __writev; __xstat64; __fxstat64;
|
__write; __writev;
|
||||||
_exit; _hurd_intr_rpc_mach_msg;
|
_exit; _hurd_intr_rpc_mach_msg;
|
||||||
abort;
|
abort;
|
||||||
}
|
}
|
||||||
|
@ -61,5 +62,6 @@ ld {
|
||||||
__read_nocancel; __pread64_nocancel;
|
__read_nocancel; __pread64_nocancel;
|
||||||
__write_nocancel;
|
__write_nocancel;
|
||||||
__libc_lock_self0; __getcwd;
|
__libc_lock_self0; __getcwd;
|
||||||
|
__stat64; __fstat64;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -545,31 +545,27 @@ __mmap (void *addr, size_t len, int prot, int flags, int fd, off_t offset)
|
||||||
return (void *) mapaddr;
|
return (void *) mapaddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
check_no_hidden(__fxstat64);
|
check_no_hidden(__fstat64);
|
||||||
int weak_function
|
int weak_function
|
||||||
__fxstat64 (int vers, int fd, struct stat64 *buf)
|
__fstat64 (int fd, struct stat64 *buf)
|
||||||
{
|
{
|
||||||
error_t err;
|
error_t err;
|
||||||
|
|
||||||
assert (vers == _STAT_VER);
|
|
||||||
|
|
||||||
err = __io_stat ((mach_port_t) fd, buf);
|
err = __io_stat ((mach_port_t) fd, buf);
|
||||||
if (err)
|
if (err)
|
||||||
return __hurd_fail (err);
|
return __hurd_fail (err);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
libc_hidden_def (__fxstat64)
|
libc_hidden_def (__fstat64)
|
||||||
|
|
||||||
check_no_hidden(__xstat64);
|
check_no_hidden(__stat64);
|
||||||
int weak_function
|
int weak_function
|
||||||
__xstat64 (int vers, const char *file, struct stat64 *buf)
|
__stat64 (const char *file, struct stat64 *buf)
|
||||||
{
|
{
|
||||||
error_t err;
|
error_t err;
|
||||||
mach_port_t port;
|
mach_port_t port;
|
||||||
|
|
||||||
assert (vers == _STAT_VER);
|
|
||||||
|
|
||||||
err = open_file (file, 0, &port, buf);
|
err = open_file (file, 0, &port, buf);
|
||||||
if (err)
|
if (err)
|
||||||
return __hurd_fail (err);
|
return __hurd_fail (err);
|
||||||
|
@ -578,7 +574,7 @@ __xstat64 (int vers, const char *file, struct stat64 *buf)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
libc_hidden_def (__xstat64)
|
libc_hidden_def (__stat64)
|
||||||
|
|
||||||
/* This function is called by the dynamic linker (rtld.c) to check
|
/* This function is called by the dynamic linker (rtld.c) to check
|
||||||
whether debugging malloc is allowed even for SUID binaries. This
|
whether debugging malloc is allowed even for SUID binaries. This
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
/* Copyright (C) 1992-2020 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
|
The GNU 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 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU 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 GNU C Library; if not, see
|
||||||
|
<https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#include "statconv.c"
|
||||||
|
|
||||||
|
/* Get information about the file descriptor FD in BUF. */
|
||||||
|
int
|
||||||
|
__fstat (int fd, struct stat *buf)
|
||||||
|
{
|
||||||
|
struct stat64 buf64;
|
||||||
|
return __fstat64 (fd, &buf64) ?: stat64_conv (buf, &buf64);
|
||||||
|
}
|
||||||
|
weak_alias (__fstat, fstat)
|
|
@ -0,0 +1,36 @@
|
||||||
|
/* Copyright (C) 2000-2020 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
|
The GNU 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 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU 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 GNU C Library; if not, see
|
||||||
|
<https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <hurd.h>
|
||||||
|
#include <hurd/fd.h>
|
||||||
|
|
||||||
|
/* Get information about the file descriptor FD in BUF. */
|
||||||
|
int
|
||||||
|
__fstat64 (int fd, struct stat64 *buf)
|
||||||
|
{
|
||||||
|
error_t err;
|
||||||
|
|
||||||
|
if (err = HURD_DPORT_USE (fd, __io_stat (port, buf)))
|
||||||
|
return __hurd_dfail (fd, err);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
hidden_def (__fstat64)
|
||||||
|
weak_alias (__fstat64, fstat64)
|
|
@ -0,0 +1,32 @@
|
||||||
|
/* Get information about file named relative to open directory. Hurd version.
|
||||||
|
Copyright (C) 2006-2020 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
|
The GNU 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 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU 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 GNU C Library; if not, see
|
||||||
|
<https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#include "statconv.c"
|
||||||
|
|
||||||
|
int
|
||||||
|
__fstatat (int fd, const char *filename, struct stat *buf, int flag)
|
||||||
|
{
|
||||||
|
struct stat64 buf64;
|
||||||
|
return (__fstatat64 (fd, filename, &buf64, flag)
|
||||||
|
?: stat64_conv (buf, &buf64));
|
||||||
|
}
|
||||||
|
weak_alias (__fstatat, fstatat)
|
|
@ -0,0 +1,43 @@
|
||||||
|
/* Get information about file named relative to open directory. Hurd version.
|
||||||
|
Copyright (C) 2006-2020 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
|
The GNU 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 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU 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 GNU C Library; if not, see
|
||||||
|
<https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <hurd.h>
|
||||||
|
#include <hurd/fd.h>
|
||||||
|
|
||||||
|
/* Get information about the file descriptor FD in BUF. */
|
||||||
|
int
|
||||||
|
__fstatat64 (int fd, const char *filename, struct stat64 *buf, int flag)
|
||||||
|
{
|
||||||
|
error_t err;
|
||||||
|
io_t port;
|
||||||
|
|
||||||
|
port = __file_name_lookup_at (fd, flag, filename, 0, 0);
|
||||||
|
if (port == MACH_PORT_NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
err = __io_stat (port, buf);
|
||||||
|
__mach_port_deallocate (__mach_task_self (), port);
|
||||||
|
|
||||||
|
return __hurd_fail (err);
|
||||||
|
}
|
||||||
|
libc_hidden_def (__fstatat64)
|
||||||
|
weak_alias (__fstatat64, fstatat64)
|
|
@ -18,15 +18,20 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <hurd.h>
|
||||||
|
#include <shlib-compat.h>
|
||||||
|
|
||||||
#include "xstatconv.c"
|
#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33)
|
||||||
|
|
||||||
/* Get information about the file descriptor FD in BUF. */
|
/* Get information about the file descriptor FD in BUF. */
|
||||||
int
|
int
|
||||||
__fxstat (int vers, int fd, struct stat *buf)
|
__fxstat (int vers, int fd, struct stat *buf)
|
||||||
{
|
{
|
||||||
struct stat64 buf64;
|
if (vers != _STAT_VER)
|
||||||
return __fxstat64 (vers, fd, &buf64) ?: xstat64_conv (buf, &buf64);
|
return __hurd_fail (EINVAL);
|
||||||
|
|
||||||
|
return __fstat (fd, buf);
|
||||||
}
|
}
|
||||||
hidden_def (__fxstat)
|
|
||||||
weak_alias (__fxstat, _fxstat)
|
weak_alias (__fxstat, _fxstat)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -15,28 +15,22 @@
|
||||||
License along with the GNU C Library; if not, see
|
License along with the GNU C Library; if not, see
|
||||||
<https://www.gnu.org/licenses/>. */
|
<https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#ifndef RTLD_STAT64 /* dl-fxstat64.c, but we don't want it. */
|
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <hurd.h>
|
#include <hurd.h>
|
||||||
#include <hurd/fd.h>
|
#include <shlib-compat.h>
|
||||||
|
|
||||||
|
#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_33)
|
||||||
|
|
||||||
/* Get information about the file descriptor FD in BUF. */
|
/* Get information about the file descriptor FD in BUF. */
|
||||||
int
|
int
|
||||||
__fxstat64 (int vers, int fd, struct stat64 *buf)
|
__fxstat64 (int vers, int fd, struct stat64 *buf)
|
||||||
{
|
{
|
||||||
error_t err;
|
|
||||||
|
|
||||||
if (vers != _STAT_VER)
|
if (vers != _STAT_VER)
|
||||||
return __hurd_fail (EINVAL);
|
return __hurd_fail (EINVAL);
|
||||||
|
|
||||||
if (err = HURD_DPORT_USE (fd, __io_stat (port, buf)))
|
return __fstat64 (fd, buf);
|
||||||
return __hurd_dfail (fd, err);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
hidden_def (__fxstat64)
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -19,14 +19,18 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <hurd.h>
|
||||||
|
#include <shlib-compat.h>
|
||||||
|
|
||||||
#include "xstatconv.c"
|
#if SHLIB_COMPAT(libc, GLIBC_2_4, GLIBC_2_33)
|
||||||
|
|
||||||
int
|
int
|
||||||
__fxstatat (int vers, int fd, const char *filename, struct stat *buf, int flag)
|
__fxstatat (int vers, int fd, const char *filename, struct stat *buf, int flag)
|
||||||
{
|
{
|
||||||
struct stat64 buf64;
|
if (vers != _STAT_VER)
|
||||||
return (__fxstatat64 (vers, fd, filename, &buf64, flag)
|
return __hurd_fail (EINVAL);
|
||||||
?: xstat64_conv (buf, &buf64));
|
|
||||||
|
return __fstatat (fd, filename, buf, flag);
|
||||||
}
|
}
|
||||||
libc_hidden_def (__fxstatat)
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -21,26 +21,19 @@
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <hurd.h>
|
#include <hurd.h>
|
||||||
#include <hurd/fd.h>
|
#include <shlib-compat.h>
|
||||||
|
|
||||||
|
#if SHLIB_COMPAT(libc, GLIBC_2_4, GLIBC_2_33)
|
||||||
|
|
||||||
/* Get information about the file descriptor FD in BUF. */
|
/* Get information about the file descriptor FD in BUF. */
|
||||||
int
|
int
|
||||||
__fxstatat64 (int vers, int fd, const char *filename, struct stat64 *buf,
|
__fxstatat64 (int vers, int fd, const char *filename, struct stat64 *buf,
|
||||||
int flag)
|
int flag)
|
||||||
{
|
{
|
||||||
error_t err;
|
|
||||||
io_t port;
|
|
||||||
|
|
||||||
if (vers != _STAT_VER)
|
if (vers != _STAT_VER)
|
||||||
return __hurd_fail (EINVAL);
|
return __hurd_fail (EINVAL);
|
||||||
|
|
||||||
port = __file_name_lookup_at (fd, flag, filename, 0, 0);
|
return __fstatat64 (fd, filename, buf, flag);
|
||||||
if (port == MACH_PORT_NULL)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
err = __io_stat (port, buf);
|
|
||||||
__mach_port_deallocate (__mach_task_self (), port);
|
|
||||||
|
|
||||||
return __hurd_fail (err);
|
|
||||||
}
|
}
|
||||||
libc_hidden_def (__fxstatat64)
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
GLIBC_2.2.6 __close F
|
GLIBC_2.2.6 __close F
|
||||||
GLIBC_2.2.6 __errno_location F
|
GLIBC_2.2.6 __errno_location F
|
||||||
GLIBC_2.2.6 __fxstat64 F
|
|
||||||
GLIBC_2.2.6 __getpid F
|
GLIBC_2.2.6 __getpid F
|
||||||
GLIBC_2.2.6 __libc_stack_end D 0x4
|
GLIBC_2.2.6 __libc_stack_end D 0x4
|
||||||
GLIBC_2.2.6 __mmap F
|
GLIBC_2.2.6 __mmap F
|
||||||
|
@ -11,7 +10,6 @@ GLIBC_2.2.6 __read F
|
||||||
GLIBC_2.2.6 __sbrk F
|
GLIBC_2.2.6 __sbrk F
|
||||||
GLIBC_2.2.6 __write F
|
GLIBC_2.2.6 __write F
|
||||||
GLIBC_2.2.6 __writev F
|
GLIBC_2.2.6 __writev F
|
||||||
GLIBC_2.2.6 __xstat64 F
|
|
||||||
GLIBC_2.2.6 _dl_mcount F
|
GLIBC_2.2.6 _dl_mcount F
|
||||||
GLIBC_2.2.6 _hurd_intr_rpc_mach_msg F
|
GLIBC_2.2.6 _hurd_intr_rpc_mach_msg F
|
||||||
GLIBC_2.2.6 _r_debug D 0x14
|
GLIBC_2.2.6 _r_debug D 0x14
|
||||||
|
|
|
@ -30,8 +30,8 @@ ld.so: __write_nocancel
|
||||||
ld.so: __writev
|
ld.so: __writev
|
||||||
ld.so: __libc_lseek64
|
ld.so: __libc_lseek64
|
||||||
ld.so: __mmap
|
ld.so: __mmap
|
||||||
ld.so: __fxstat64
|
ld.so: __fstat64
|
||||||
ld.so: __xstat64
|
ld.so: __stat64
|
||||||
ld.so: __access
|
ld.so: __access
|
||||||
ld.so: __access_noerrno
|
ld.so: __access_noerrno
|
||||||
ld.so: __getpid
|
ld.so: __getpid
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
/* Copyright (C) 1992-2020 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
|
The GNU 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 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU 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 GNU C Library; if not, see
|
||||||
|
<https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#include "statconv.c"
|
||||||
|
|
||||||
|
int
|
||||||
|
__lstat (const char *file, struct stat *buf)
|
||||||
|
{
|
||||||
|
struct stat64 buf64;
|
||||||
|
return __lstat64 (file, &buf64) ?: stat64_conv (buf, &buf64);
|
||||||
|
}
|
||||||
|
weak_alias (__lstat, lstat)
|
|
@ -0,0 +1,41 @@
|
||||||
|
/* Copyright (C) 2000-2020 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
|
The GNU 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 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU 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 GNU C Library; if not, see
|
||||||
|
<https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <hurd.h>
|
||||||
|
|
||||||
|
/* Get information about the file descriptor FD in BUF. */
|
||||||
|
int
|
||||||
|
__lstat64 (const char *file, struct stat64 *buf)
|
||||||
|
{
|
||||||
|
error_t err;
|
||||||
|
file_t port;
|
||||||
|
|
||||||
|
port = __file_name_lookup (file, O_NOLINK, 0);
|
||||||
|
if (port == MACH_PORT_NULL)
|
||||||
|
return -1;
|
||||||
|
err = __io_stat (port, buf);
|
||||||
|
__mach_port_deallocate (__mach_task_self (), port);
|
||||||
|
if (err)
|
||||||
|
return __hurd_fail (err);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
hidden_def (__lstat64)
|
||||||
|
weak_alias (__lstat64, lstat64)
|
|
@ -18,14 +18,19 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#include <hurd.h>
|
||||||
|
#include <shlib-compat.h>
|
||||||
|
|
||||||
#include "xstatconv.c"
|
#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33)
|
||||||
|
|
||||||
int
|
int
|
||||||
__lxstat (int vers, const char *file, struct stat *buf)
|
__lxstat (int vers, const char *file, struct stat *buf)
|
||||||
{
|
{
|
||||||
struct stat64 buf64;
|
if (vers != _STAT_VER)
|
||||||
return __lxstat64 (vers, file, &buf64) ?: xstat64_conv (buf, &buf64);
|
return __hurd_fail (EINVAL);
|
||||||
|
|
||||||
|
return __lstat (file, buf);
|
||||||
}
|
}
|
||||||
hidden_def (__lxstat)
|
|
||||||
weak_alias (__lxstat, _lxstat)
|
weak_alias (__lxstat, _lxstat)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -20,24 +20,18 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <hurd.h>
|
#include <hurd.h>
|
||||||
|
#include <shlib-compat.h>
|
||||||
|
|
||||||
|
#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_33)
|
||||||
|
|
||||||
/* Get information about the file descriptor FD in BUF. */
|
/* Get information about the file descriptor FD in BUF. */
|
||||||
int
|
int
|
||||||
__lxstat64 (int vers, const char *file, struct stat64 *buf)
|
__lxstat64 (int vers, const char *file, struct stat64 *buf)
|
||||||
{
|
{
|
||||||
error_t err;
|
|
||||||
file_t port;
|
|
||||||
|
|
||||||
if (vers != _STAT_VER)
|
if (vers != _STAT_VER)
|
||||||
return __hurd_fail (EINVAL);
|
return __hurd_fail (EINVAL);
|
||||||
|
|
||||||
port = __file_name_lookup (file, O_NOLINK, 0);
|
return __lstat64 (file, buf);
|
||||||
if (port == MACH_PORT_NULL)
|
|
||||||
return -1;
|
|
||||||
err = __io_stat (port, buf);
|
|
||||||
__mach_port_deallocate (__mach_task_self (), port);
|
|
||||||
if (err)
|
|
||||||
return __hurd_fail (err);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
hidden_def (__lxstat64)
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
/* Copyright (C) 1991-2020 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
|
The GNU 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 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU 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 GNU C Library; if not, see
|
||||||
|
<https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <shlib-compat.h>
|
||||||
|
|
||||||
|
/* Create a device file named FILE_NAME, with permission and special bits MODE
|
||||||
|
and device number DEV (which can be constructed from major and minor
|
||||||
|
device numbers with the `makedev' macro above). */
|
||||||
|
int
|
||||||
|
__mknod (const char *file_name, mode_t mode, dev_t dev)
|
||||||
|
{
|
||||||
|
return __mknodat (AT_FDCWD, file_name, mode, dev);
|
||||||
|
}
|
||||||
|
libc_hidden_def (__mknod)
|
||||||
|
weak_alias (__mknod, mknod)
|
|
@ -0,0 +1,118 @@
|
||||||
|
/* Create a device file relative to an open directory. Hurd version.
|
||||||
|
Copyright (C) 1991-2020 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
|
The GNU 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 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU 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 GNU C Library; if not, see
|
||||||
|
<https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <hurd.h>
|
||||||
|
#include <hurd/fd.h>
|
||||||
|
#include <hurd/paths.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <_itoa.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/sysmacros.h>
|
||||||
|
#include <shlib-compat.h>
|
||||||
|
|
||||||
|
/* Create a device file named PATH relative to FD, with permission and
|
||||||
|
special bits MODE and device number DEV (which can be constructed
|
||||||
|
from major and minor device numbers with the `makedev' macro
|
||||||
|
above). */
|
||||||
|
int
|
||||||
|
__mknodat (int fd, const char *path, mode_t mode, dev_t dev)
|
||||||
|
{
|
||||||
|
error_t errnode, err;
|
||||||
|
file_t dir, node;
|
||||||
|
char *name;
|
||||||
|
char buf[100], *bp;
|
||||||
|
const char *translator;
|
||||||
|
size_t len;
|
||||||
|
|
||||||
|
if (S_ISCHR (mode))
|
||||||
|
{
|
||||||
|
translator = _HURD_CHRDEV;
|
||||||
|
len = sizeof (_HURD_CHRDEV);
|
||||||
|
}
|
||||||
|
else if (S_ISBLK (mode))
|
||||||
|
{
|
||||||
|
translator = _HURD_BLKDEV;
|
||||||
|
len = sizeof (_HURD_BLKDEV);
|
||||||
|
}
|
||||||
|
else if (S_ISFIFO (mode))
|
||||||
|
{
|
||||||
|
translator = _HURD_FIFO;
|
||||||
|
len = sizeof (_HURD_FIFO);
|
||||||
|
}
|
||||||
|
else if (S_ISREG (mode))
|
||||||
|
{
|
||||||
|
translator = NULL;
|
||||||
|
len = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (translator != NULL && ! S_ISFIFO (mode))
|
||||||
|
{
|
||||||
|
/* We set the translator to "ifmt\0major\0minor\0", where IFMT
|
||||||
|
depends on the S_IFMT bits of our MODE argument, and MAJOR and
|
||||||
|
MINOR are ASCII decimal (octal or hex would do as well)
|
||||||
|
representations of our arguments. Thus the convention is that
|
||||||
|
CHRDEV and BLKDEV translators are invoked with two non-switch
|
||||||
|
arguments, giving the major and minor device numbers in %i format. */
|
||||||
|
|
||||||
|
bp = buf + sizeof (buf);
|
||||||
|
*--bp = '\0';
|
||||||
|
bp = _itoa (__gnu_dev_minor (dev), bp, 10, 0);
|
||||||
|
*--bp = '\0';
|
||||||
|
bp = _itoa (__gnu_dev_major (dev), bp, 10, 0);
|
||||||
|
memcpy (bp - len, translator, len);
|
||||||
|
translator = bp - len;
|
||||||
|
len = buf + sizeof (buf) - translator;
|
||||||
|
}
|
||||||
|
|
||||||
|
dir = __file_name_split_at (fd, path, &name);
|
||||||
|
if (dir == MACH_PORT_NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
/* Create a new, unlinked node in the target directory. */
|
||||||
|
errnode = err = __dir_mkfile (dir, O_WRITE, (mode & ~S_IFMT) & ~_hurd_umask, &node);
|
||||||
|
|
||||||
|
if (! err && translator != NULL)
|
||||||
|
/* Set the node's translator to make it a device. */
|
||||||
|
err = __file_set_translator (node,
|
||||||
|
FS_TRANS_EXCL | FS_TRANS_SET,
|
||||||
|
FS_TRANS_EXCL | FS_TRANS_SET, 0,
|
||||||
|
translator, len,
|
||||||
|
MACH_PORT_NULL, MACH_MSG_TYPE_COPY_SEND);
|
||||||
|
|
||||||
|
if (! err)
|
||||||
|
/* Link the node, now a valid device, into the target directory. */
|
||||||
|
err = __dir_link (dir, node, name, 1);
|
||||||
|
|
||||||
|
__mach_port_deallocate (__mach_task_self (), dir);
|
||||||
|
if (! errnode)
|
||||||
|
__mach_port_deallocate (__mach_task_self (), node);
|
||||||
|
|
||||||
|
if (err)
|
||||||
|
return __hurd_fail (err);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
libc_hidden_def (__mknodat)
|
||||||
|
weak_alias (__mknodat, mknodat)
|
|
@ -0,0 +1,30 @@
|
||||||
|
/* Copyright (C) 1992-2020 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
|
The GNU 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 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU 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 GNU C Library; if not, see
|
||||||
|
<https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#include "statconv.c"
|
||||||
|
|
||||||
|
/* Get file information about FILE in BUF. */
|
||||||
|
int
|
||||||
|
__stat (const char *file, struct stat *buf)
|
||||||
|
{
|
||||||
|
struct stat64 buf64;
|
||||||
|
return __stat64 (file, &buf64) ?: stat64_conv (buf, &buf64);
|
||||||
|
}
|
||||||
|
weak_alias (__stat, stat)
|
|
@ -0,0 +1,40 @@
|
||||||
|
/* Copyright (C) 2000-2020 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
|
The GNU 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 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU 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 GNU C Library; if not, see
|
||||||
|
<https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <hurd.h>
|
||||||
|
|
||||||
|
/* Get information about the file descriptor FD in BUF. */
|
||||||
|
int
|
||||||
|
__stat64 (const char *file, struct stat64 *buf)
|
||||||
|
{
|
||||||
|
error_t err;
|
||||||
|
file_t port;
|
||||||
|
|
||||||
|
port = __file_name_lookup (file, 0, 0);
|
||||||
|
if (port == MACH_PORT_NULL)
|
||||||
|
return -1;
|
||||||
|
err = __io_stat (port, buf);
|
||||||
|
__mach_port_deallocate (__mach_task_self (), port);
|
||||||
|
if (err)
|
||||||
|
return __hurd_fail (err);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
hidden_def (__stat64)
|
||||||
|
weak_alias (__stat64, stat64)
|
|
@ -20,7 +20,7 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
xstat64_conv (struct stat *buf, const struct stat64 *buf64)
|
stat64_conv (struct stat *buf, const struct stat64 *buf64)
|
||||||
{
|
{
|
||||||
if (sizeof *buf == sizeof *buf64
|
if (sizeof *buf == sizeof *buf64
|
||||||
&& sizeof buf->st_ino == sizeof buf64->st_ino
|
&& sizeof buf->st_ino == sizeof buf64->st_ino
|
|
@ -16,25 +16,21 @@
|
||||||
<https://www.gnu.org/licenses/>. */
|
<https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <hurd.h>
|
||||||
#include <shlib-compat.h>
|
#include <shlib-compat.h>
|
||||||
|
|
||||||
|
#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33)
|
||||||
/* Create a device file named FILE_NAME, with permission and special bits MODE
|
/* Create a device file named FILE_NAME, with permission and special bits MODE
|
||||||
and device number DEV (which can be constructed from major and minor
|
and device number DEV (which can be constructed from major and minor
|
||||||
device numbers with the `makedev' macro above). */
|
device numbers with the `makedev' macro above). */
|
||||||
int
|
int
|
||||||
__xmknod (int vers, const char *file_name, mode_t mode, dev_t *dev)
|
__xmknod (int vers, const char *file_name, mode_t mode, dev_t *dev)
|
||||||
{
|
{
|
||||||
return __xmknodat (vers, AT_FDCWD, file_name, mode, dev);
|
if (vers != _MKNOD_VER)
|
||||||
}
|
return __hurd_fail (EINVAL);
|
||||||
libc_hidden_def (__xmknod)
|
|
||||||
|
|
||||||
#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33)
|
return __mknodat (AT_FDCWD, file_name, mode, *dev);
|
||||||
int
|
|
||||||
__xmknod_compat (int vers, const char *file_name, mode_t mode, dev_t *dev)
|
|
||||||
{
|
|
||||||
return __xmknod (vers, file_name, mode, dev);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
compat_symbol (libc, __xmknod_compat, __xmknod, GLIBC_2_0);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -16,18 +16,13 @@
|
||||||
License along with the GNU C Library; if not, see
|
License along with the GNU C Library; if not, see
|
||||||
<https://www.gnu.org/licenses/>. */
|
<https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <hurd.h>
|
#include <errno.h>
|
||||||
#include <hurd/fd.h>
|
|
||||||
#include <hurd/paths.h>
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <_itoa.h>
|
#include <hurd.h>
|
||||||
#include <string.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/sysmacros.h>
|
|
||||||
#include <shlib-compat.h>
|
#include <shlib-compat.h>
|
||||||
|
|
||||||
|
#if SHLIB_COMPAT(libc, GLIBC_2_4, GLIBC_2_33)
|
||||||
/* Create a device file named PATH relative to FD, with permission and
|
/* Create a device file named PATH relative to FD, with permission and
|
||||||
special bits MODE and device number DEV (which can be constructed
|
special bits MODE and device number DEV (which can be constructed
|
||||||
from major and minor device numbers with the `makedev' macro
|
from major and minor device numbers with the `makedev' macro
|
||||||
|
@ -35,96 +30,9 @@
|
||||||
int
|
int
|
||||||
__xmknodat (int vers, int fd, const char *path, mode_t mode, dev_t *dev)
|
__xmknodat (int vers, int fd, const char *path, mode_t mode, dev_t *dev)
|
||||||
{
|
{
|
||||||
error_t errnode, err;
|
|
||||||
file_t dir, node;
|
|
||||||
char *name;
|
|
||||||
char buf[100], *bp;
|
|
||||||
const char *translator;
|
|
||||||
size_t len;
|
|
||||||
|
|
||||||
if (vers != _MKNOD_VER)
|
if (vers != _MKNOD_VER)
|
||||||
return __hurd_fail (EINVAL);
|
return __hurd_fail (EINVAL);
|
||||||
|
|
||||||
if (S_ISCHR (mode))
|
return __mknodat (fd, path, mode, *dev);
|
||||||
{
|
|
||||||
translator = _HURD_CHRDEV;
|
|
||||||
len = sizeof (_HURD_CHRDEV);
|
|
||||||
}
|
|
||||||
else if (S_ISBLK (mode))
|
|
||||||
{
|
|
||||||
translator = _HURD_BLKDEV;
|
|
||||||
len = sizeof (_HURD_BLKDEV);
|
|
||||||
}
|
|
||||||
else if (S_ISFIFO (mode))
|
|
||||||
{
|
|
||||||
translator = _HURD_FIFO;
|
|
||||||
len = sizeof (_HURD_FIFO);
|
|
||||||
}
|
|
||||||
else if (S_ISREG (mode))
|
|
||||||
{
|
|
||||||
translator = NULL;
|
|
||||||
len = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
errno = EINVAL;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (translator != NULL && ! S_ISFIFO (mode))
|
|
||||||
{
|
|
||||||
/* We set the translator to "ifmt\0major\0minor\0", where IFMT
|
|
||||||
depends on the S_IFMT bits of our MODE argument, and MAJOR and
|
|
||||||
MINOR are ASCII decimal (octal or hex would do as well)
|
|
||||||
representations of our arguments. Thus the convention is that
|
|
||||||
CHRDEV and BLKDEV translators are invoked with two non-switch
|
|
||||||
arguments, giving the major and minor device numbers in %i format. */
|
|
||||||
|
|
||||||
bp = buf + sizeof (buf);
|
|
||||||
*--bp = '\0';
|
|
||||||
bp = _itoa (__gnu_dev_minor (*dev), bp, 10, 0);
|
|
||||||
*--bp = '\0';
|
|
||||||
bp = _itoa (__gnu_dev_major (*dev), bp, 10, 0);
|
|
||||||
memcpy (bp - len, translator, len);
|
|
||||||
translator = bp - len;
|
|
||||||
len = buf + sizeof (buf) - translator;
|
|
||||||
}
|
|
||||||
|
|
||||||
dir = __file_name_split_at (fd, path, &name);
|
|
||||||
if (dir == MACH_PORT_NULL)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
/* Create a new, unlinked node in the target directory. */
|
|
||||||
errnode = err = __dir_mkfile (dir, O_WRITE, (mode & ~S_IFMT) & ~_hurd_umask, &node);
|
|
||||||
|
|
||||||
if (! err && translator != NULL)
|
|
||||||
/* Set the node's translator to make it a device. */
|
|
||||||
err = __file_set_translator (node,
|
|
||||||
FS_TRANS_EXCL | FS_TRANS_SET,
|
|
||||||
FS_TRANS_EXCL | FS_TRANS_SET, 0,
|
|
||||||
translator, len,
|
|
||||||
MACH_PORT_NULL, MACH_MSG_TYPE_COPY_SEND);
|
|
||||||
|
|
||||||
if (! err)
|
|
||||||
/* Link the node, now a valid device, into the target directory. */
|
|
||||||
err = __dir_link (dir, node, name, 1);
|
|
||||||
|
|
||||||
__mach_port_deallocate (__mach_task_self (), dir);
|
|
||||||
if (! errnode)
|
|
||||||
__mach_port_deallocate (__mach_task_self (), node);
|
|
||||||
|
|
||||||
if (err)
|
|
||||||
return __hurd_fail (err);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
libc_hidden_def (__xmknodat)
|
|
||||||
|
|
||||||
#if SHLIB_COMPAT(libc, GLIBC_2_4, GLIBC_2_33)
|
|
||||||
int
|
|
||||||
__xmknodat_compat (int vers, int fd, const char *path, mode_t mode, dev_t *dev)
|
|
||||||
{
|
|
||||||
return __xmknodat (vers, fd, path, mode, dev);
|
|
||||||
}
|
|
||||||
|
|
||||||
compat_symbol (libc, __xmknodat_compat, __xmknodat, GLIBC_2_4);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -17,15 +17,20 @@
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <hurd.h>
|
||||||
|
#include <shlib-compat.h>
|
||||||
|
|
||||||
#include "xstatconv.c"
|
#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33)
|
||||||
|
|
||||||
/* Get file information about FILE in BUF. */
|
/* Get file information about FILE in BUF. */
|
||||||
int
|
int
|
||||||
__xstat (int vers, const char *file, struct stat *buf)
|
__xstat (int vers, const char *file, struct stat *buf)
|
||||||
{
|
{
|
||||||
struct stat64 buf64;
|
if (vers != _STAT_VER)
|
||||||
return __xstat64 (vers, file, &buf64) ?: xstat64_conv (buf, &buf64);
|
return __hurd_fail (EINVAL);
|
||||||
|
|
||||||
|
return __stat (file, buf);
|
||||||
}
|
}
|
||||||
hidden_def (__xstat)
|
|
||||||
weak_alias (__xstat, _xstat)
|
weak_alias (__xstat, _xstat)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -15,32 +15,22 @@
|
||||||
License along with the GNU C Library; if not, see
|
License along with the GNU C Library; if not, see
|
||||||
<https://www.gnu.org/licenses/>. */
|
<https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#ifndef RTLD_STAT64 /* dl-xstat64.c, but we don't want it. */
|
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <hurd.h>
|
#include <hurd.h>
|
||||||
|
#include <shlib-compat.h>
|
||||||
|
|
||||||
|
#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_33)
|
||||||
|
|
||||||
/* Get information about the file descriptor FD in BUF. */
|
/* Get information about the file descriptor FD in BUF. */
|
||||||
int
|
int
|
||||||
__xstat64 (int vers, const char *file, struct stat64 *buf)
|
__xstat64 (int vers, const char *file, struct stat64 *buf)
|
||||||
{
|
{
|
||||||
error_t err;
|
|
||||||
file_t port;
|
|
||||||
|
|
||||||
if (vers != _STAT_VER)
|
if (vers != _STAT_VER)
|
||||||
return __hurd_fail (EINVAL);
|
return __hurd_fail (EINVAL);
|
||||||
|
|
||||||
port = __file_name_lookup (file, 0, 0);
|
return __stat64 (file, buf);
|
||||||
if (port == MACH_PORT_NULL)
|
|
||||||
return -1;
|
|
||||||
err = __io_stat (port, buf);
|
|
||||||
__mach_port_deallocate (__mach_task_self (), port);
|
|
||||||
if (err)
|
|
||||||
return __hurd_fail (err);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
hidden_def (__xstat64)
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue