From c43b8c4bea7980e6830d5ecfbc301fb5cd89dec5 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Thu, 18 Jan 1996 00:35:55 +0000 Subject: Wed Jan 17 11:04:58 1996 Roland McGrath * io/sys/stat.h (_STAT_VER, _MKNOD_VER): New macros. (__xstat, __fxstat, __lxstat, __xmknod): Declare new functions. [__GNUC__] (stat, fstat, lstat, mknod): Define these (and __ names) as `extern inline's calling the `x' functions. * io/fstat.c: New file. * io/lstat.c: New file. * io/stat.c: New file. * sysdeps/generic/lstat.c: File removed. * sysdeps/generic/lxstat.c: New file. * sysdeps/mach/hurd/fstat.c: File removed. * sysdeps/mach/hurd/fxstat.c: New file. * sysdeps/mach/hurd/lstat.c: File removed. * sysdeps/mach/hurd/lxstat.c: New file. * sysdeps/mach/hurd/mknod.c: File removed. * sysdeps/mach/hurd/stat.c: File removed. * sysdeps/mach/hurd/xmknod.c: New file. * sysdeps/mach/hurd/xstat.c: New file. * sysdeps/stub/fstat.c: File removed. * sysdeps/stub/fxstat.c: New file. * sysdeps/stub/lstat.c: File removed. * sysdeps/stub/lxstat.c: New file. * sysdeps/stub/mknod.c: File removed. * sysdeps/stub/stat.c: File removed. * sysdeps/stub/xmknod.c: New file. * sysdeps/stub/xstat.c: New file. * sysdeps/unix/common/lstat.S: File removed. * sysdeps/unix/common/lxstat.c: New file. * sysdeps/unix/fstat.S: File removed. * sysdeps/unix/fxstat.c: New file. * sysdeps/unix/mknod.S: File removed. * sysdeps/unix/stat.S: File removed. * sysdeps/unix/sysv/linux/fstat.c: File removed. * sysdeps/unix/sysv/linux/i386/fxstat.S: File removed. * sysdeps/unix/sysv/linux/i386/lxstat.S: File removed. * sysdeps/unix/sysv/linux/i386/xmknod.S: File removed. * sysdeps/unix/sysv/linux/i386/xstat.S: File removed. * sysdeps/unix/sysv/linux/lstat.c: File removed. * sysdeps/unix/sysv/linux/mknod.c: File removed. * sysdeps/unix/sysv/linux/stat.c: File removed. * sysdeps/unix/sysv/sysv4/i386/fstat.S: File removed. * sysdeps/unix/sysv/sysv4/i386/lstat.S: File removed. * sysdeps/unix/sysv/sysv4/i386/mknod.S: File removed. * sysdeps/unix/sysv/sysv4/i386/stat.S: File removed. * sysdeps/unix/xmknod.c: New file. * sysdeps/unix/xstat.c: New file. * sysdeps/unix/mkfifo.c: Use __xmknod instead of __mknod. * misc/Makefile (routines): Remove mknod. * io/sys/stat.h (_STAT_VER, _MKNOD_VER): New macros. (__xstat, __fxstat, __lxstat, __xmknod): Declare new functions. [__GNUC__] (stat, fstat, lstat, mknod): Define these (and __ names) as `extern inline's calling the `x' functions. * io/fstat.c: New file. * io/lstat.c: New file. * io/stat.c: New file. * sysdeps/generic/lstat.c: File removed. * sysdeps/generic/lxstat.c: New file. * sysdeps/mach/hurd/fstat.c: File removed. * sysdeps/mach/hurd/fxstat.c: New file. * sysdeps/mach/hurd/lstat.c: File removed. * sysdeps/mach/hurd/lxstat.c: New file. * sysdeps/mach/hurd/mknod.c: File removed. * sysdeps/mach/hurd/stat.c: File removed. * sysdeps/mach/hurd/xmknod.c: New file. * sysdeps/mach/hurd/xstat.c: New file. * sysdeps/stub/fstat.c: File removed. * sysdeps/stub/fxstat.c: New file. * sysdeps/stub/lstat.c: File removed. * sysdeps/stub/lxstat.c: New file. * sysdeps/stub/mknod.c: File removed. * sysdeps/stub/stat.c: File removed. * sysdeps/stub/xmknod.c: New file. * sysdeps/stub/xstat.c: New file. * sysdeps/unix/common/lstat.S: File removed. * sysdeps/unix/common/lxstat.c: New file. * sysdeps/unix/fstat.S: File removed. * sysdeps/unix/fxstat.c: New file. * sysdeps/unix/mknod.S: File removed. * sysdeps/unix/stat.S: File removed. * sysdeps/unix/sysv/linux/fstat.c: File removed. * sysdeps/unix/sysv/linux/i386/fxstat.S: File removed. * sysdeps/unix/sysv/linux/i386/lxstat.S: File removed. * sysdeps/unix/sysv/linux/i386/xmknod.S: File removed. * sysdeps/unix/sysv/linux/i386/xstat.S: File removed. * sysdeps/unix/sysv/linux/lstat.c: File removed. * sysdeps/unix/sysv/linux/mknod.c: File removed. * sysdeps/unix/sysv/linux/stat.c: File removed. * sysdeps/unix/sysv/sysv4/i386/fstat.S: File removed. * sysdeps/unix/sysv/sysv4/i386/lstat.S: File removed. * sysdeps/unix/sysv/sysv4/i386/mknod.S: File removed. * sysdeps/unix/sysv/sysv4/i386/stat.S: File removed. * sysdeps/unix/xmknod.c: New file. * sysdeps/unix/xstat.c: New file. * sysdeps/unix/mkfifo.c: Use __xmknod instead of __mknod. * misc/Makefile (routines): Remove mknod. * sysdeps/ieee754/ieee754.h (union ieee854_long_double.ieee_nan): Add missing ; in little-endian case. --- ChangeLog | 51 +++++++++++++++ io/fstat.c | 36 +++++++++++ io/lstat.c | 36 +++++++++++ io/stat.c | 36 +++++++++++ sysdeps/generic/lstat.c | 31 --------- sysdeps/generic/lxstat.c | 27 ++++++++ sysdeps/mach/hurd/fstat.c | 38 ----------- sysdeps/mach/hurd/fxstat.c | 40 ++++++++++++ sysdeps/mach/hurd/lstat.c | 40 ------------ sysdeps/mach/hurd/lxstat.c | 44 +++++++++++++ sysdeps/mach/hurd/mknod.c | 114 --------------------------------- sysdeps/mach/hurd/stat.c | 40 ------------ sysdeps/mach/hurd/xmknod.c | 115 ++++++++++++++++++++++++++++++++++ sysdeps/mach/hurd/xstat.c | 44 +++++++++++++ sysdeps/stub/fstat.c | 44 ------------- sysdeps/stub/fxstat.c | 49 +++++++++++++++ sysdeps/stub/lstat.c | 40 ------------ sysdeps/stub/lxstat.c | 39 ++++++++++++ sysdeps/stub/mknod.c | 36 ----------- sysdeps/stub/stat.c | 39 ------------ sysdeps/stub/xmknod.c | 40 ++++++++++++ sysdeps/stub/xstat.c | 38 +++++++++++ sysdeps/unix/common/lstat.S | 24 ------- sysdeps/unix/common/lxstat.c | 37 +++++++++++ sysdeps/unix/fstat.S | 24 ------- sysdeps/unix/fxstat.c | 38 +++++++++++ sysdeps/unix/mkfifo.c | 8 +-- sysdeps/unix/mknod.S | 24 ------- sysdeps/unix/stat.S | 24 ------- sysdeps/unix/sysv/linux/fstat.c | 32 ---------- sysdeps/unix/sysv/linux/i386/fxstat.S | 4 -- sysdeps/unix/sysv/linux/i386/lxstat.S | 4 -- sysdeps/unix/sysv/linux/i386/xmknod.S | 48 -------------- sysdeps/unix/sysv/linux/i386/xstat.S | 48 -------------- sysdeps/unix/sysv/linux/lstat.c | 32 ---------- sysdeps/unix/sysv/linux/mknod.c | 30 --------- sysdeps/unix/sysv/linux/stat.c | 32 ---------- sysdeps/unix/sysv/sysv4/i386/fstat.S | 37 ----------- sysdeps/unix/sysv/sysv4/i386/lstat.S | 37 ----------- sysdeps/unix/sysv/sysv4/i386/mknod.S | 36 ----------- sysdeps/unix/sysv/sysv4/i386/stat.S | 37 ----------- sysdeps/unix/xmknod.c | 41 ++++++++++++ sysdeps/unix/xstat.c | 37 +++++++++++ 43 files changed, 752 insertions(+), 899 deletions(-) create mode 100644 io/fstat.c create mode 100644 io/lstat.c create mode 100644 io/stat.c delete mode 100644 sysdeps/generic/lstat.c create mode 100644 sysdeps/generic/lxstat.c delete mode 100644 sysdeps/mach/hurd/fstat.c create mode 100644 sysdeps/mach/hurd/fxstat.c delete mode 100644 sysdeps/mach/hurd/lstat.c create mode 100644 sysdeps/mach/hurd/lxstat.c delete mode 100644 sysdeps/mach/hurd/mknod.c delete mode 100644 sysdeps/mach/hurd/stat.c create mode 100644 sysdeps/mach/hurd/xmknod.c create mode 100644 sysdeps/mach/hurd/xstat.c delete mode 100644 sysdeps/stub/fstat.c create mode 100644 sysdeps/stub/fxstat.c delete mode 100644 sysdeps/stub/lstat.c create mode 100644 sysdeps/stub/lxstat.c delete mode 100644 sysdeps/stub/mknod.c delete mode 100644 sysdeps/stub/stat.c create mode 100644 sysdeps/stub/xmknod.c create mode 100644 sysdeps/stub/xstat.c delete mode 100644 sysdeps/unix/common/lstat.S create mode 100644 sysdeps/unix/common/lxstat.c delete mode 100644 sysdeps/unix/fstat.S create mode 100644 sysdeps/unix/fxstat.c delete mode 100644 sysdeps/unix/mknod.S delete mode 100644 sysdeps/unix/stat.S delete mode 100644 sysdeps/unix/sysv/linux/fstat.c delete mode 100644 sysdeps/unix/sysv/linux/i386/fxstat.S delete mode 100644 sysdeps/unix/sysv/linux/i386/lxstat.S delete mode 100644 sysdeps/unix/sysv/linux/i386/xmknod.S delete mode 100644 sysdeps/unix/sysv/linux/i386/xstat.S delete mode 100644 sysdeps/unix/sysv/linux/lstat.c delete mode 100644 sysdeps/unix/sysv/linux/mknod.c delete mode 100644 sysdeps/unix/sysv/linux/stat.c delete mode 100644 sysdeps/unix/sysv/sysv4/i386/fstat.S delete mode 100644 sysdeps/unix/sysv/sysv4/i386/lstat.S delete mode 100644 sysdeps/unix/sysv/sysv4/i386/mknod.S delete mode 100644 sysdeps/unix/sysv/sysv4/i386/stat.S create mode 100644 sysdeps/unix/xmknod.c create mode 100644 sysdeps/unix/xstat.c diff --git a/ChangeLog b/ChangeLog index d21eca3b1d..ec92ce9df5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,56 @@ Wed Jan 17 11:04:58 1996 Roland McGrath + * io/sys/stat.h (_STAT_VER, _MKNOD_VER): New macros. + (__xstat, __fxstat, __lxstat, __xmknod): Declare new functions. + [__GNUC__] (stat, fstat, lstat, mknod): Define these (and __ names) + as `extern inline's calling the `x' functions. + * io/fstat.c: New file. + * io/lstat.c: New file. + * io/stat.c: New file. + * sysdeps/generic/lstat.c: File removed. + * sysdeps/generic/lxstat.c: New file. + * sysdeps/mach/hurd/fstat.c: File removed. + * sysdeps/mach/hurd/fxstat.c: New file. + * sysdeps/mach/hurd/lstat.c: File removed. + * sysdeps/mach/hurd/lxstat.c: New file. + * sysdeps/mach/hurd/mknod.c: File removed. + * sysdeps/mach/hurd/stat.c: File removed. + * sysdeps/mach/hurd/xmknod.c: New file. + * sysdeps/mach/hurd/xstat.c: New file. + * sysdeps/stub/fstat.c: File removed. + * sysdeps/stub/fxstat.c: New file. + * sysdeps/stub/lstat.c: File removed. + * sysdeps/stub/lxstat.c: New file. + * sysdeps/stub/mknod.c: File removed. + * sysdeps/stub/stat.c: File removed. + * sysdeps/stub/xmknod.c: New file. + * sysdeps/stub/xstat.c: New file. + * sysdeps/unix/common/lstat.S: File removed. + * sysdeps/unix/common/lxstat.c: New file. + * sysdeps/unix/fstat.S: File removed. + * sysdeps/unix/fxstat.c: New file. + * sysdeps/unix/mknod.S: File removed. + * sysdeps/unix/stat.S: File removed. + * sysdeps/unix/sysv/linux/fstat.c: File removed. + * sysdeps/unix/sysv/linux/i386/fxstat.S: File removed. + * sysdeps/unix/sysv/linux/i386/lxstat.S: File removed. + * sysdeps/unix/sysv/linux/i386/xmknod.S: File removed. + * sysdeps/unix/sysv/linux/i386/xstat.S: File removed. + * sysdeps/unix/sysv/linux/lstat.c: File removed. + * sysdeps/unix/sysv/linux/mknod.c: File removed. + * sysdeps/unix/sysv/linux/stat.c: File removed. + * sysdeps/unix/sysv/sysv4/i386/fstat.S: File removed. + * sysdeps/unix/sysv/sysv4/i386/lstat.S: File removed. + * sysdeps/unix/sysv/sysv4/i386/mknod.S: File removed. + * sysdeps/unix/sysv/sysv4/i386/stat.S: File removed. + * sysdeps/unix/xmknod.c: New file. + * sysdeps/unix/xstat.c: New file. + * sysdeps/unix/mkfifo.c: Use __xmknod instead of __mknod. + * misc/Makefile (routines): Remove mknod. + + * sysdeps/ieee754/ieee754.h (union ieee854_long_double.ieee_nan): + Add missing ; in little-endian case. + * elf/dynamic-link.h [ELF_MACHINE_NO_REL] (ELF_DYNAMIC_DO_REL): Define this instead of ELF_DYNAMIC_DO_RELA. diff --git a/io/fstat.c b/io/fstat.c new file mode 100644 index 0000000000..60dd2f002d --- /dev/null +++ b/io/fstat.c @@ -0,0 +1,36 @@ +/* Copyright (C) 1996 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include + +/* This definition is only used if inlining fails for this function; see + the last page of . The real work is done by the `x' + function which is passed a version number argument. We arrange in the + makefile that when not inlined this function is always statically + linked; that way a dynamically-linked executable always encodes the + version number corresponding to the data structures it uses, so the `x' + functions in the shared library can adapt without needing to recompile + all callers. */ + +int +__fstat (int fd, struct stat *buf) +{ + return __fxstat (_STAT_VER, fd, buf); +} + +weak_alias (__fstat, fstat) diff --git a/io/lstat.c b/io/lstat.c new file mode 100644 index 0000000000..f2ab6bc7a1 --- /dev/null +++ b/io/lstat.c @@ -0,0 +1,36 @@ +/* Copyright (C) 1996 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include + +/* This definition is only used if inlining fails for this function; see + the last page of . The real work is done by the `x' + function which is passed a version number argument. We arrange in the + makefile that when not inlined this function is always statically + linked; that way a dynamically-linked executable always encodes the + version number corresponding to the data structures it uses, so the `x' + functions in the shared library can adapt without needing to recompile + all callers. */ + +int +__lstat (const char *file, struct stat *buf) +{ + return __lxstat (_STAT_VER, file, buf); +} + +weak_alias (__lstat, lstat) diff --git a/io/stat.c b/io/stat.c new file mode 100644 index 0000000000..007fdf0dd6 --- /dev/null +++ b/io/stat.c @@ -0,0 +1,36 @@ +/* Copyright (C) 1996 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include + +/* This definition is only used if inlining fails for this function; see + the last page of . The real work is done by the `x' + function which is passed a version number argument. We arrange in the + makefile that when not inlined this function is always statically + linked; that way a dynamically-linked executable always encodes the + version number corresponding to the data structures it uses, so the `x' + functions in the shared library can adapt without needing to recompile + all callers. */ + +int +__stat (const char *file, struct stat *buf) +{ + return __xstat (_STAT_VER, file, buf); +} + +weak_alias (__stat, stat) diff --git a/sysdeps/generic/lstat.c b/sysdeps/generic/lstat.c deleted file mode 100644 index 44fafa6f4d..0000000000 --- a/sysdeps/generic/lstat.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 1991, 1992, 1995 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 Library General Public License as -published by the Free Software Foundation; either version 2 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#include -#include -#include -#include - -int -DEFUN(__lstat, (file, buf), - CONST char *file AND struct stat *buf) -{ - return __stat (file, buf); -} - -weak_alias (__lstat, lstat) diff --git a/sysdeps/generic/lxstat.c b/sysdeps/generic/lxstat.c new file mode 100644 index 0000000000..cf28fee5ad --- /dev/null +++ b/sysdeps/generic/lxstat.c @@ -0,0 +1,27 @@ +/* Copyright (C) 1991, 1992, 1995, 1996 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include + +int +__lxstat (int version, const char *file, struct stat *buf) +{ + return __xstat (version, file, buf); +} + +weak_alias (__lxstat, _lxstat) diff --git a/sysdeps/mach/hurd/fstat.c b/sysdeps/mach/hurd/fstat.c deleted file mode 100644 index 5341e3e4a4..0000000000 --- a/sysdeps/mach/hurd/fstat.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 1992, 1993, 1994, 1995 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 Library General Public License as -published by the Free Software Foundation; either version 2 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#include -#include -#include -#include -#include -#include - -/* Get information about the file descriptor FD in BUF. */ -int -DEFUN(__fstat, (fd, buf), int fd AND struct stat *buf) -{ - error_t err; - - if (err = HURD_DPORT_USE (fd, __io_stat (port, buf))) - return __hurd_dfail (fd, err); - - return 0; -} - -weak_alias (__fstat, fstat) diff --git a/sysdeps/mach/hurd/fxstat.c b/sysdeps/mach/hurd/fxstat.c new file mode 100644 index 0000000000..d228e112c9 --- /dev/null +++ b/sysdeps/mach/hurd/fxstat.c @@ -0,0 +1,40 @@ +/* Copyright (C) 1992, 1993, 1994, 1995, 1996 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include +#include +#include +#include +#include + +/* Get information about the file descriptor FD in BUF. */ +int +__fxstat (int vers, int fd, struct stat *buf) +{ + error_t err; + + if (vers != _STAT_VER) + return __hurd_fail (EINVAL); + + if (err = HURD_DPORT_USE (fd, __io_stat (port, buf))) + return __hurd_dfail (fd, err); + + return 0; +} + +weak_alias (__fxstat, _fxstat) diff --git a/sysdeps/mach/hurd/lstat.c b/sysdeps/mach/hurd/lstat.c deleted file mode 100644 index 21eb448fe8..0000000000 --- a/sysdeps/mach/hurd/lstat.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (C) 1992, 1993, 1994, 1995 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 Library General Public License as -published by the Free Software Foundation; either version 2 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#include -#include -#include -#include -#include -#include - -int -DEFUN(__lstat, (file, buf), CONST char *file AND struct stat *buf) -{ - error_t err; - file_t 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; -} - -weak_alias (__lstat, lstat) diff --git a/sysdeps/mach/hurd/lxstat.c b/sysdeps/mach/hurd/lxstat.c new file mode 100644 index 0000000000..eb37552461 --- /dev/null +++ b/sysdeps/mach/hurd/lxstat.c @@ -0,0 +1,44 @@ +/* Copyright (C) 1992, 1993, 1994, 1995, 1996 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include +#include +#include +#include +#include + +int +__lxstat (int vers, const char *file, struct stat *buf) +{ + error_t err; + file_t port; + + if (vers != _STAT_VER) + return __hurd_fail (EINVAL); + + 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; +} + +weak_alias (__lxstat, _lxstat) diff --git a/sysdeps/mach/hurd/mknod.c b/sysdeps/mach/hurd/mknod.c deleted file mode 100644 index 1d82764ff6..0000000000 --- a/sysdeps/mach/hurd/mknod.c +++ /dev/null @@ -1,114 +0,0 @@ -/* Copyright (C) 1991, 1992, 1993, 1994, 1995 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 Library General Public License as -published by the Free Software Foundation; either version 2 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#include -#include -#include -#include -#include -#include -#include "stdio-common/_itoa.h" -#include - -/* Temporary hack; this belongs in a header file, probably types.h. */ -#define major(x) ((int)(((unsigned) (x) >> 8) & 0xff)) -#define minor(x) ((int)((x) & 0xff)) - - -/* 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 -DEFUN(__mknod, (file_name, mode, dev), - CONST char *file_name AND mode_t mode AND dev_t dev) -{ - error_t 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 - { - errno = EINVAL; - return -1; - } - - if (! 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 (minor (dev), bp, 10, 0); - *--bp = '\0'; - bp = _itoa (major (dev), bp, 10, 0); - memcpy (bp - len, translator, len); - translator = bp - len; - len = buf + sizeof (buf) - translator; - } - - dir = __file_name_split (file_name, &name); - if (dir == MACH_PORT_NULL) - return -1; - - /* Create a new, unlinked node in the target directory. */ - err = __dir_mkfile (dir, O_WRITE, mode & ~S_IFMT & _hurd_umask, &node); - - if (! err) - /* 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); - - __mach_port_deallocate (__mach_task_self (), dir); - __mach_port_deallocate (__mach_task_self (), node); - - if (err) - return __hurd_fail (err); - return 0; -} - -weak_alias (__mknod, mknod) diff --git a/sysdeps/mach/hurd/stat.c b/sysdeps/mach/hurd/stat.c deleted file mode 100644 index e6df5e66eb..0000000000 --- a/sysdeps/mach/hurd/stat.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (C) 1992, 1993, 1994, 1995 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 Library General Public License as -published by the Free Software Foundation; either version 2 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#include -#include -#include -#include -#include - -/* Get file information about FILE in BUF. */ -int -DEFUN(__stat, (file, buf), CONST char *file AND struct stat *buf) -{ - error_t err; - file_t 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; -} - -weak_alias (__stat, stat) diff --git a/sysdeps/mach/hurd/xmknod.c b/sysdeps/mach/hurd/xmknod.c new file mode 100644 index 0000000000..68fb2249b2 --- /dev/null +++ b/sysdeps/mach/hurd/xmknod.c @@ -0,0 +1,115 @@ +/* Copyright (C) 1991, 92, 93, 94, 95, 96 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include +#include +#include +#include +#include +#include "stdio-common/_itoa.h" +#include + +/* Temporary hack; this belongs in a header file, probably types.h. */ +#define major(x) ((int)(((unsigned) (x) >> 8) & 0xff)) +#define minor(x) ((int)((x) & 0xff)) + + +/* 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 +__xmknod (int vers, const char *file_name, mode_t mode, dev_t *dev) +{ + error_t err; + file_t dir, node; + char *name; + char buf[100], *bp; + const char *translator; + size_t len; + + if (vers != _MKNOD_VER) + return __hurd_fail (EINVAL); + + 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 + { + errno = EINVAL; + return -1; + } + + if (! 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 (minor (*dev), bp, 10, 0); + *--bp = '\0'; + bp = _itoa (major (*dev), bp, 10, 0); + memcpy (bp - len, translator, len); + translator = bp - len; + len = buf + sizeof (buf) - translator; + } + + dir = __file_name_split (file_name, &name); + if (dir == MACH_PORT_NULL) + return -1; + + /* Create a new, unlinked node in the target directory. */ + err = __dir_mkfile (dir, O_WRITE, mode & ~S_IFMT & _hurd_umask, &node); + + if (! err) + /* 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); + + __mach_port_deallocate (__mach_task_self (), dir); + __mach_port_deallocate (__mach_task_self (), node); + + if (err) + return __hurd_fail (err); + return 0; +} + +weak_alias (__mknod, mknod) diff --git a/sysdeps/mach/hurd/xstat.c b/sysdeps/mach/hurd/xstat.c new file mode 100644 index 0000000000..b56ca38d97 --- /dev/null +++ b/sysdeps/mach/hurd/xstat.c @@ -0,0 +1,44 @@ +/* Copyright (C) 1992, 1993, 1994, 1995, 1996 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include +#include +#include +#include + +/* Get file information about FILE in BUF. */ +int +__xstat (int vers, const char *file, struct stat *buf) +{ + error_t err; + file_t port; + + if (vers != _STAT_VER) + return __hurd_fail (EINVAL); + + 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; +} + +weak_alias (__xstat, _xstat) diff --git a/sysdeps/stub/fstat.c b/sysdeps/stub/fstat.c deleted file mode 100644 index 49981bbd52..0000000000 --- a/sysdeps/stub/fstat.c +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright (C) 1991, 1995 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 Library General Public License as -published by the Free Software Foundation; either version 2 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#include -#include -#include -#include - -/* Get information about the file descriptor FD in BUF. */ -int -DEFUN(__fstat, (fd, buf), int fd AND struct stat *buf) -{ - if (fd < 0) - { - errno = EBADF; - return -1; - } - else if (buf == NULL) - { - errno = EINVAL; - return -1; - } - - errno = ENOSYS; - return -1; -} -stub_warning (fstat) - -weak_alias (__fstat, fstat) diff --git a/sysdeps/stub/fxstat.c b/sysdeps/stub/fxstat.c new file mode 100644 index 0000000000..7c1eeff2cb --- /dev/null +++ b/sysdeps/stub/fxstat.c @@ -0,0 +1,49 @@ +/* Copyright (C) 1991, 1995, 1996 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include +#include +#include + +/* Get information about the file descriptor FD in BUF. */ +int +__fxstat (int vers, int fd, struct stat *buf) +{ + if (vers != _STAT_VER) + { + errno = EINVAL; + return -1; + } + + if (fd < 0) + { + errno = EBADF; + return -1; + } + else if (buf == NULL) + { + errno = EINVAL; + return -1; + } + + errno = ENOSYS; + return -1; +} +stub_warning (__fxstat) + +weak_alias (__fxstat, _fxstat) diff --git a/sysdeps/stub/lstat.c b/sysdeps/stub/lstat.c deleted file mode 100644 index 0e69a086e3..0000000000 --- a/sysdeps/stub/lstat.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (C) 1991, 1995 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 Library General Public License as -published by the Free Software Foundation; either version 2 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#include -#include -#include -#include - -/* Get file information about FILE in BUF. - If FILE is a symbolic link, do not follow it. */ -int -DEFUN(__lstat, (file, buf), CONST char *file AND struct stat *buf) -{ - if (file == NULL || buf == NULL) - { - errno = EINVAL; - return -1; - } - - errno = ENOSYS; - return -1; -} -stub_warning (lstat) - -weak_alias (__lstat, lstat) diff --git a/sysdeps/stub/lxstat.c b/sysdeps/stub/lxstat.c new file mode 100644 index 0000000000..5729925ff3 --- /dev/null +++ b/sysdeps/stub/lxstat.c @@ -0,0 +1,39 @@ +/* Copyright (C) 1991, 1995, 1996 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include +#include +#include + +/* Get file information about FILE in BUF. + If FILE is a symbolic link, do not follow it. */ +int +__lxstat (int vers, const char *file, struct stat *buf) +{ + if (vers != _STAT_VER || file == NULL || buf == NULL) + { + errno = EINVAL; + return -1; + } + + errno = ENOSYS; + return -1; +} +stub_warning (__lxstat) + +weak_alias (__lxstat, _lxstat) diff --git a/sysdeps/stub/mknod.c b/sysdeps/stub/mknod.c deleted file mode 100644 index 66f88aa36f..0000000000 --- a/sysdeps/stub/mknod.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (C) 1991, 1993, 1995 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 Library General Public License as -published by the Free Software Foundation; either version 2 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#include -#include -#include -#include - -/* Create a device file named PATH, 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 -DEFUN(__mknod, (path, mode, dev), - CONST char *path AND mode_t mode AND dev_t dev) -{ - errno = ENOSYS; - return -1; -} -stub_warning (mknod) - -weak_alias (__mknod, mknod) diff --git a/sysdeps/stub/stat.c b/sysdeps/stub/stat.c deleted file mode 100644 index f24ce64e0c..0000000000 --- a/sysdeps/stub/stat.c +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (C) 1991, 1995 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 Library General Public License as -published by the Free Software Foundation; either version 2 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#include -#include -#include -#include - -/* Get file information about FILE in BUF. */ -int -DEFUN(__stat, (file, buf), CONST char *file AND struct stat *buf) -{ - if (file == NULL || buf == NULL) - { - errno = EINVAL; - return -1; - } - - errno = ENOSYS; - return -1; -} -stub_warning (stat) - -weak_alias (__stat, stat) diff --git a/sysdeps/stub/xmknod.c b/sysdeps/stub/xmknod.c new file mode 100644 index 0000000000..6d365cbe0c --- /dev/null +++ b/sysdeps/stub/xmknod.c @@ -0,0 +1,40 @@ +/* Copyright (C) 1991, 1993, 1995, 1996 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include +#include +#include + +/* Create a device file named PATH, 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 +__xmknod (int vers, const char *path, mode_t mode, dev_t *dev) +{ + if (vers != _MKNOD_VER) + { + errno = EINVAL; + return -1; + } + + errno = ENOSYS; + return -1; +} +stub_warning (__xmknod) + +weak_alias (__xmknod, _xmknod) diff --git a/sysdeps/stub/xstat.c b/sysdeps/stub/xstat.c new file mode 100644 index 0000000000..ad67aa9fec --- /dev/null +++ b/sysdeps/stub/xstat.c @@ -0,0 +1,38 @@ +/* Copyright (C) 1991, 1995, 1996 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include +#include +#include + +/* Get file information about FILE in BUF. */ +int +__xstat (int vers, const char *file, struct stat *buf) +{ + if (vers != _STAT_VER || file == NULL || buf == NULL) + { + errno = EINVAL; + return -1; + } + + errno = ENOSYS; + return -1; +} +stub_warning (stat) + +weak_alias (__xstat, _xstat) diff --git a/sysdeps/unix/common/lstat.S b/sysdeps/unix/common/lstat.S deleted file mode 100644 index bc9592232f..0000000000 --- a/sysdeps/unix/common/lstat.S +++ /dev/null @@ -1,24 +0,0 @@ -/* Copyright (C) 1991, 1992, 1995 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 Library General Public License as -published by the Free Software Foundation; either version 2 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#include - -SYSCALL__ (lstat, 2) - ret - -weak_alias (__lstat, lstat) diff --git a/sysdeps/unix/common/lxstat.c b/sysdeps/unix/common/lxstat.c new file mode 100644 index 0000000000..499a0838ac --- /dev/null +++ b/sysdeps/unix/common/lxstat.c @@ -0,0 +1,37 @@ +/* lxstat using old-style Unix lstat system call. +Copyright (C) 1991, 1995, 1996 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include +#include +#include + +extern int __syscall_lstat (const char *, struct stat *); + +int +__lxstat (int vers, const char *file, struct stat *buf) +{ + if (vers != _STAT_VER) + { + errno = EINVAL; + return -1; + } + + return __syscall_lstat (file, buf); +} +weak_alias (__lxstat, _lxstat) diff --git a/sysdeps/unix/fstat.S b/sysdeps/unix/fstat.S deleted file mode 100644 index cf501efe3e..0000000000 --- a/sysdeps/unix/fstat.S +++ /dev/null @@ -1,24 +0,0 @@ -/* Copyright (C) 1991, 1992, 1995 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 Library General Public License as -published by the Free Software Foundation; either version 2 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#include - -SYSCALL__ (fstat, 2) - ret - -weak_alias (__fstat, fstat) diff --git a/sysdeps/unix/fxstat.c b/sysdeps/unix/fxstat.c new file mode 100644 index 0000000000..522d3fd052 --- /dev/null +++ b/sysdeps/unix/fxstat.c @@ -0,0 +1,38 @@ +/* fxstat using old-style Unix fstat system call. +Copyright (C) 1991, 1995, 1996 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include +#include +#include + +extern int __syscall_fstat (int, struct stat *); + +/* Get information about the file descriptor FD in BUF. */ +int +__fxstat (int vers, int fd, struct stat *buf) +{ + if (vers != _STAT_VER) + { + errno = EINVAL; + return -1; + } + + return __syscall_fstat (fd, buf); +} +weak_alias (__fxstat, _fxstat) diff --git a/sysdeps/unix/mkfifo.c b/sysdeps/unix/mkfifo.c index 776e981d93..4041f3a7be 100644 --- a/sysdeps/unix/mkfifo.c +++ b/sysdeps/unix/mkfifo.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1996 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 @@ -15,7 +15,6 @@ You should have received a copy of the GNU General Public License along with the GNU C Library; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include #include #include #include @@ -23,7 +22,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Create a named pipe (FIFO) named PATH with protections MODE. */ int -DEFUN(mkfifo, (path, mode), CONST char *path AND mode_t mode) +mkfifo (const char *path, mode_t mode) { - return __mknod (path, mode | S_IFIFO, 0); + dev_t dev = 0; + return __xmknod (_MKNOD_VER, path, mode | S_IFIFO, &dev); } diff --git a/sysdeps/unix/mknod.S b/sysdeps/unix/mknod.S deleted file mode 100644 index 76fab52ee1..0000000000 --- a/sysdeps/unix/mknod.S +++ /dev/null @@ -1,24 +0,0 @@ -/* Copyright (C) 1991, 1992, 1995 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 Library General Public License as -published by the Free Software Foundation; either version 2 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#include - -SYSCALL__ (mknod, 3) - ret - -weak_alias (__mknod, mknod) diff --git a/sysdeps/unix/stat.S b/sysdeps/unix/stat.S deleted file mode 100644 index 8ffd60a464..0000000000 --- a/sysdeps/unix/stat.S +++ /dev/null @@ -1,24 +0,0 @@ -/* Copyright (C) 1991, 1992, 1995 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 Library General Public License as -published by the Free Software Foundation; either version 2 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#include - -SYSCALL__ (stat, 2) - ret - -weak_alias (__stat, stat) diff --git a/sysdeps/unix/sysv/linux/fstat.c b/sysdeps/unix/sysv/linux/fstat.c deleted file mode 100644 index e6ef27094d..0000000000 --- a/sysdeps/unix/sysv/linux/fstat.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 1995 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 Library General Public License as -published by the Free Software Foundation; either version 2 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#include - -/* In Linux the `stat' call is actually done by emulating a `xstat' system - call, which takes an additional first argument giving a version number - for `struct stat'. Likewise for `fstat' and `lstat' there are `fxstat' - and `lxstat' emulations. */ - -int -__fstat (int fd, struct stat *buf) -{ - return __fxstat (_STAT_VER, fd, buf); -} - -weak_alias (__fstat, fstat) diff --git a/sysdeps/unix/sysv/linux/i386/fxstat.S b/sysdeps/unix/sysv/linux/i386/fxstat.S deleted file mode 100644 index c4db088abe..0000000000 --- a/sysdeps/unix/sysv/linux/i386/fxstat.S +++ /dev/null @@ -1,4 +0,0 @@ -#define __xstat __fxstat -#define _xstat _fxstat -#define stat fstat -#include "xstat.S" diff --git a/sysdeps/unix/sysv/linux/i386/lxstat.S b/sysdeps/unix/sysv/linux/i386/lxstat.S deleted file mode 100644 index fee635be78..0000000000 --- a/sysdeps/unix/sysv/linux/i386/lxstat.S +++ /dev/null @@ -1,4 +0,0 @@ -#define __xstat __lxstat -#define _xstat _lxstat -#define stat lstat -#include "xstat.S" diff --git a/sysdeps/unix/sysv/linux/i386/xmknod.S b/sysdeps/unix/sysv/linux/i386/xmknod.S deleted file mode 100644 index e075e52105..0000000000 --- a/sysdeps/unix/sysv/linux/i386/xmknod.S +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (C) 1995 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 Library General Public License as -published by the Free Software Foundation; either version 2 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#include -#include - - .text - SYSCALL_ERROR_HANDLER /* Error handler for PIC. */ -ENTRY (__xmknod) - popl %ecx /* Pop return address into %eax. */ - popl %edx /* Pop version number into %edx. */ - pushl %ecx /* Push back the return address. */ - - cmpl $1, %edx /* Version 1 xstat call? */ - je .L1 /* Yes, do syscall. */ - - movl $-EINVAL, %eax /* Load error code into %eax. */ - jmp .L2 - -.L1: DO_CALL (3, mknod) /* Do the syscall. */ - - movl (%esp), %ecx - testl %eax, %eax /* Check for error. */ - jl .L2 - - jmp *%ecx /* Return success. */ - -.L2: pushl %ecx - jmp syscall_error - /* Yes, then branch to error handling. */ - -/* For compatibility with Linux libc. */ -weak_alias (__xmknod, _xmknod) diff --git a/sysdeps/unix/sysv/linux/i386/xstat.S b/sysdeps/unix/sysv/linux/i386/xstat.S deleted file mode 100644 index b936bb5b69..0000000000 --- a/sysdeps/unix/sysv/linux/i386/xstat.S +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (C) 1995 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 Library General Public License as -published by the Free Software Foundation; either version 2 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#include -#include - - .text - SYSCALL_ERROR_HANDLER /* Error handler for PIC. */ -ENTRY (__xstat) - popl %ecx /* Pop return address into %eax. */ - popl %edx /* Pop version number into %edx. */ - pushl %ecx /* Push back the return address. */ - - cmpl $1, %edx /* Version 1 xstat call? */ - je .L1 /* Yes, do syscall. */ - - movl $-EINVAL, %eax /* Load error code into %eax. */ - jmp .L2 - -.L1: DO_CALL (2, stat) /* Do the syscall. */ - - movl (%esp), %ecx - testl %eax, %eax /* Check for error. */ - jl .L2 - - jmp *%ecx /* Return success. */ - -.L2: pushl %ecx - jmp syscall_error - /* Yes, then branch to error handling. */ - -/* For compatibility with Linux libc. */ -weak_alias (__xstat, _xstat) diff --git a/sysdeps/unix/sysv/linux/lstat.c b/sysdeps/unix/sysv/linux/lstat.c deleted file mode 100644 index 51597b8f4d..0000000000 --- a/sysdeps/unix/sysv/linux/lstat.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 1995 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 Library General Public License as -published by the Free Software Foundation; either version 2 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#include - -/* In Linux the `stat' call is actually done by emulating a `xstat' system - call, which takes an additional first argument giving a version number - for `struct stat'. Likewise for `fstat' and `lstat' there are `fxstat' - and `lxstat' emulations. */ - -int -__lstat (const char *file, struct stat *buf) -{ - return __lxstat (_STAT_VER, file, buf); -} - -weak_alias (__lstat, lstat) diff --git a/sysdeps/unix/sysv/linux/mknod.c b/sysdeps/unix/sysv/linux/mknod.c deleted file mode 100644 index 38a85b9c20..0000000000 --- a/sysdeps/unix/sysv/linux/mknod.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 1995, 1996 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 Library General Public License as -published by the Free Software Foundation; either version 2 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#include - -/* In Linux the `mknod' call is actually done by emulating a `xmknod' - system call, which takes an additional first argument. */ - -int -__mknod (const char *path, mode_t mode, dev_t dev) -{ - return __xmknod (LINUX_MKNOD_VERSION, path, mode, &dev); -} - -weak_alias (__mknod, mknod) diff --git a/sysdeps/unix/sysv/linux/stat.c b/sysdeps/unix/sysv/linux/stat.c deleted file mode 100644 index cfdf46f49d..0000000000 --- a/sysdeps/unix/sysv/linux/stat.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 1995 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 Library General Public License as -published by the Free Software Foundation; either version 2 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#include - -/* In Linux the `stat' call is actually done by emulating a `xstat' system - call, which takes an additional first argument giving a version number - for `struct stat'. Likewise for `fstat' and `lstat' there are `fxstat' - and `lxstat' emulations. */ - -int -__stat (const char *file, struct stat *buf) -{ - return __xstat (_STAT_VER, file, buf); -} - -weak_alias (__stat, stat) diff --git a/sysdeps/unix/sysv/sysv4/i386/fstat.S b/sysdeps/unix/sysv/sysv4/i386/fstat.S deleted file mode 100644 index 11743b3fc3..0000000000 --- a/sysdeps/unix/sysv/sysv4/i386/fstat.S +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 1994, 1995 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 Library General Public License as -published by the Free Software Foundation; either version 2 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#include - -/* In SVR4 the `stat' call is actually done by the `xstat' system call, - which takes an additional first argument giving a version number for - `struct stat'. Likewise for `fstat' and `lstat' there are `fxstat' and - `lxstat' system calls. This macro gives the SVR4 version number that - corresponds to the definition of `struct stat' in . */ -#define _STAT_VER 2 - -.globl syscall_error -ENTRY (__fstat) - popl %eax /* Pop return address into %eax. */ - pushl $_STAT_VER /* Push extra first arg to syscall. */ - pushl %eax /* Push back the return address. */ - DO_CALL (fxstat, 3) /* Do the syscall. */ - jb syscall_error /* Check for error. */ - ret /* Return success. */ - -weak_alias (__fstat, fstat) diff --git a/sysdeps/unix/sysv/sysv4/i386/lstat.S b/sysdeps/unix/sysv/sysv4/i386/lstat.S deleted file mode 100644 index 52ffdbadfd..0000000000 --- a/sysdeps/unix/sysv/sysv4/i386/lstat.S +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 1994, 1995 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 Library General Public License as -published by the Free Software Foundation; either version 2 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#include - -/* In SVR4 the `stat' call is actually done by the `xstat' system call, - which takes an additional first argument giving a version number for - `struct stat'. Likewise for `fstat' and `lstat' there are `fxstat' and - `lxstat' system calls. This macro gives the SVR4 version number that - corresponds to the definition of `struct stat' in . */ -#define _STAT_VER 2 - -.globl syscall_error -ENTRY (__lstat) - popl %eax /* Pop return address into %eax. */ - pushl $_STAT_VER /* Push extra first arg to syscall. */ - pushl %eax /* Push back the return address. */ - DO_CALL (lxstat, 3) /* Do the syscall. */ - jb syscall_error /* Check for error. */ - ret /* Return success. */ - -weak_alias (__lstat, lstat) diff --git a/sysdeps/unix/sysv/sysv4/i386/mknod.S b/sysdeps/unix/sysv/sysv4/i386/mknod.S deleted file mode 100644 index 21f932c921..0000000000 --- a/sysdeps/unix/sysv/sysv4/i386/mknod.S +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (C) 1994, 1995 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 Library General Public License as -published by the Free Software Foundation; either version 2 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#include - -/* In SVR4 the `mknod' call is actually done by the `xmknod' system call, - which takes an additional first argument giving a version number for - the interface. This macro gives the SVR4 version number that - corresponds to the modern interface. */ -#define _MKNOD_VER 2 - -.globl syscall_error -ENTRY (__mknod) - popl %eax /* Pop return address into %eax. */ - pushl $_MKNOD_VER /* Push extra first arg to syscall. */ - pushl %eax /* Push back the return address. */ - DO_CALL (xmknod, 3) /* Do the syscall. */ - jb syscall_error /* Check for error. */ - ret /* Return success. */ - -weak_alias (__mknod, mknod) diff --git a/sysdeps/unix/sysv/sysv4/i386/stat.S b/sysdeps/unix/sysv/sysv4/i386/stat.S deleted file mode 100644 index 3a5107c267..0000000000 --- a/sysdeps/unix/sysv/sysv4/i386/stat.S +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 1994, 1995 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 Library General Public License as -published by the Free Software Foundation; either version 2 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#include - -/* In SVR4 the `stat' call is actually done by the `xstat' system call, - which takes an additional first argument giving a version number for - `struct stat'. Likewise for `fstat' and `lstat' there are `fxstat' and - `lxstat' system calls. This macro gives the SVR4 version number that - corresponds to the definition of `struct stat' in . */ -#define _STAT_VER 2 - -.globl syscall_error -ENTRY (__stat) - popl %eax /* Pop return address into %eax. */ - pushl $_STAT_VER /* Push extra first arg to syscall. */ - pushl %eax /* Push back the return address. */ - DO_CALL (xstat, 3) /* Do the syscall. */ - jb syscall_error /* Check for error. */ - ret /* Return success. */ - -weak_alias (__stat, stat) diff --git a/sysdeps/unix/xmknod.c b/sysdeps/unix/xmknod.c new file mode 100644 index 0000000000..81c794a435 --- /dev/null +++ b/sysdeps/unix/xmknod.c @@ -0,0 +1,41 @@ +/* xmknod call using old-style Unix mknod system call. +Copyright (C) 1991, 1993, 1995, 1996 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include +#include +#include + +extern int __syscall_mknod (const char *, mode_t, dev_t); + +/* Create a device file named PATH, 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 +__xmknod (int vers, const char *path, mode_t mode, dev_t *dev) +{ + if (vers != _MKNOD_VER) + { + errno = EINVAL; + return -1; + } + + return __syscall_mknod (path, mode, *dev); +} + +weak_alias (__xmknod, _xmknod) diff --git a/sysdeps/unix/xstat.c b/sysdeps/unix/xstat.c new file mode 100644 index 0000000000..3b1b112234 --- /dev/null +++ b/sysdeps/unix/xstat.c @@ -0,0 +1,37 @@ +/* xstat using old-style Unix stat system call. +Copyright (C) 1991, 1995, 1996 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include +#include +#include + +extern int __syscall_stat (const char *, struct stat *); + +int +__xstat (int vers, const char *file, struct stat *buf) +{ + if (vers != _STAT_VER) + { + errno = EINVAL; + return -1; + } + + return __syscall_stat (file, buf); +} +weak_alias (__xstat, _xstat) -- cgit v1.2.3