From 6d4752d8b97037222ad88e74eb149459e5c0b53c Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 28 Nov 1998 21:06:13 +0000 Subject: Update. 1998-11-27 Philip Blundell Fixes to allow compilation with static NSS: * nss/Makefile: Make explicit the dependency of getent on libnss_files.a. [build_static_nss]: Define $(otherlibs) appropriately. * nss/Depend: Add a dependency on `resolv'. 1998-11-27 Andreas Jaeger Partial support for MIPS ISO C 9x exception handling: * sysdeps/mips/fclrexcpt.c: New file. * sysdeps/mips/ftestexcept.c: New file. * sysdeps/mips/fgetexcptflg.c: New file. * sysdeps/mips/fesetround.c: New file. * sysdeps/mips/fegetround.c: New file. * sysdeps/mips/fegetenv.c: New file. * sysdeps/mips/fesetenv.c: New file. * sysdeps/mips/feupdateenv.c: Likewise. * sysdeps/mips/bits/fenv.h: New file. 1998-11-28 Andreas Jaeger * sysdeps/unix/sysv/linux/mips/bits/signum.h: Remove inclusion of and add needed symbols from ; bring in sync with linux specific version. Patches by Ralf Baechle for mips-linux: * sysdeps/unix/mips/sysdep.S: Define _errno as weak_alias, rewrite errno declaration. * sysdeps/unix/sysv/linux/mips/ustat.c: Use INLINE_SYSCALL instead of calling __syscall_*. * sysdeps/unix/sysv/linux/mips/xmknod.c: Likewise. * sysdeps/unix/sysv/linux/mips/syscalls.list: Update entries. * sysdeps/unix/sysv/linux/mips/sys/syscall.h: Add missing SYS_* constants, correct values according to Linux 2.1.130. * sysdeps/unix/sysv/linux/mips/pwrite.c: New file. * sysdeps/unix/sysv/linux/mips/pwrite64.c: New file. * sysdeps/unix/sysv/linux/mips/pread.c: New file. * sysdeps/unix/sysv/linux/mips/pread64.c: New file. * sysdeps/mips/Makefile (sysdep_routines): Use += instead of a :=. * sysdeps/unix/sysv/linux/mips/bits/ipc.h: Remove ipc_kludge. * sysdeps/unix/sysv/linux/mips/xstatconv.c: New file. * sysdeps/unix/sysv/linux/mips/xstat.c: Removed. * sysdeps/unix/sysv/linux/mips/sys/ucontext.h: New file. * sysdeps/unix/sysv/linux/mips/kernel_termios.h: Add copyright message, change name of include protection, remove inclusion of . * sysdeps/unix/sysv/linux/mips/kernel_sigaction.h (old_kernel_sigaction): Define. (struct kernel_sigaction): Rename sa_handler to k_sa_handler. * sysdeps/unix/sysv/linux/mips/bits/time.h: Removed, we can use the general linux version. * sysdeps/unix/sysv/linux/mips/bits/stat.h (_STAT_VER_KERNEL): Added. * sysdeps/unix/sysv/linux/mips/bits/socket.h: Update file. 1998-09-03 Philip Blundell * sysdeps/arm/bits/endian.h (__FLOAT_WORD_ORDER): Define to big endian. * math/math_private.h: Use __FLOAT_WORD_ORDER rather than BYTE_ORDER. * string/endian.h: If __FLOAT_WORD_ORDER wasn't defined by , make it the same as __BYTE_ORDER. 1998-11-26 Andreas Schwab * Makeconfig ($(common-objpfx)sysd-dirs): Use automatic variables if possible. ($(common-objpfx)sysd-sorted): Likewise. 1998-11-27 Andreas Jaeger * sysdeps/libm-ieee754/e_log.c (__ieee754_log): Add declaration of local variables t1,t2 only if needed. * sysdeps/libm-ieee754/s_truncf.c (__truncf): Likewise. * sysdeps/libm-ieee754/s_trunc.c (__trunc): Likewise. * sysdeps/mips/mul_1.S (Loop): Add closing comment to avoid warning. 1998-11-27 Andreas Jaeger * math/math.h: Add brace to correct #if expression. 1998-11-26 Philip Blundell Undo change of 1998-11-12: * sysdeps/unix/sysv/linux/netlink/netlink.h: Deleted. * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Remove netlink/netlink.h. * sysdeps/unix/sysv/linux/Dist: Likewise. 1998-11-22 Thorsten Kukuk * nis/nis_print.c (nis_print_entry): Changes to match Solaris output. 1998-11-26 Andreas Jaeger * sysdeps/generic/pselect.c (__pselect): Change interface, set/restore sigmask. * misc/sys/select.h: Change declaration according to Stevens' Unix Network Programming. * include/sys/select.h (__pselect): Likewise. Reported by [PR libc/872]. * include/fpu_control.h: New file, contains __setfpucw declaration. * sysdeps/generic/fpu_control.h: Remove __setfpucw declaration, it's an internal symbol. * sysdeps/alpha/fpu/fpu_control.h: Likewise. * sysdeps/arm/fpu/fpu_control.h: Likewise. * sysdeps/i386/fpu_control.h: Likewise. * sysdeps/m68k/fpu_control.h: Likewise. * sysdeps/powerpc/fpu_control.h: Likewise. * sysdeps/sparc/sparc32/fpu/fpu_control.h: Likewise. * sysdeps/sparc/sparc64/fpu/fpu_control.h: Likewise. --- sysdeps/mips/Makefile | 2 +- sysdeps/mips/bits/fenv.h | 72 ++++++++++++ sysdeps/mips/fclrexcpt.c | 40 +++++++ sysdeps/mips/fegetenv.c | 28 +++++ sysdeps/mips/fegetround.c | 33 ++++++ sysdeps/mips/fesetenv.c | 31 +++++ sysdeps/mips/fesetround.c | 43 +++++++ sysdeps/mips/feupdateenv.c | 40 +++++++ sysdeps/mips/fgetexcptflg.c | 33 ++++++ sysdeps/mips/ftestexcept.c | 33 ++++++ sysdeps/unix/mips/sysdep.S | 12 +- sysdeps/unix/sysv/linux/mips/bits/ipc.h | 11 +- sysdeps/unix/sysv/linux/mips/bits/signum.h | 59 ++++++++-- sysdeps/unix/sysv/linux/mips/bits/socket.h | 149 +++++++++++++++++------- sysdeps/unix/sysv/linux/mips/bits/stat.h | 4 +- sysdeps/unix/sysv/linux/mips/bits/time.h | 57 --------- sysdeps/unix/sysv/linux/mips/kernel_sigaction.h | 5 +- sysdeps/unix/sysv/linux/mips/kernel_termios.h | 25 +++- sysdeps/unix/sysv/linux/mips/pread.c | 62 ++++++++++ sysdeps/unix/sysv/linux/mips/pread64.c | 65 +++++++++++ sysdeps/unix/sysv/linux/mips/pwrite.c | 62 ++++++++++ sysdeps/unix/sysv/linux/mips/pwrite64.c | 65 +++++++++++ sysdeps/unix/sysv/linux/mips/sys/syscall.h | 26 ++++- sysdeps/unix/sysv/linux/mips/sys/ucontext.h | 77 ++++++++++++ sysdeps/unix/sysv/linux/mips/syscalls.list | 21 ++-- sysdeps/unix/sysv/linux/mips/ustat.c | 7 +- sysdeps/unix/sysv/linux/mips/xmknod.c | 7 +- sysdeps/unix/sysv/linux/mips/xstat.c | 80 ------------- sysdeps/unix/sysv/linux/mips/xstatconv.c | 120 +++++++++++++++++++ sysdeps/unix/sysv/linux/pwrite.c | 4 +- 30 files changed, 1045 insertions(+), 228 deletions(-) create mode 100644 sysdeps/mips/bits/fenv.h create mode 100644 sysdeps/mips/fclrexcpt.c create mode 100644 sysdeps/mips/fegetenv.c create mode 100644 sysdeps/mips/fegetround.c create mode 100644 sysdeps/mips/fesetenv.c create mode 100644 sysdeps/mips/fesetround.c create mode 100644 sysdeps/mips/feupdateenv.c create mode 100644 sysdeps/mips/fgetexcptflg.c create mode 100644 sysdeps/mips/ftestexcept.c delete mode 100644 sysdeps/unix/sysv/linux/mips/bits/time.h create mode 100644 sysdeps/unix/sysv/linux/mips/pread.c create mode 100644 sysdeps/unix/sysv/linux/mips/pread64.c create mode 100644 sysdeps/unix/sysv/linux/mips/pwrite.c create mode 100644 sysdeps/unix/sysv/linux/mips/pwrite64.c create mode 100644 sysdeps/unix/sysv/linux/mips/sys/ucontext.h delete mode 100644 sysdeps/unix/sysv/linux/mips/xstat.c create mode 100644 sysdeps/unix/sysv/linux/mips/xstatconv.c (limited to 'sysdeps') diff --git a/sysdeps/mips/Makefile b/sysdeps/mips/Makefile index 736414197a..5585c61f03 100644 --- a/sysdeps/mips/Makefile +++ b/sysdeps/mips/Makefile @@ -1,3 +1,3 @@ ifeq ($(subdir),setjmp) -sysdep_routines := $(sysdep_routines) setjmp_aux +sysdep_routines += setjmp_aux endif diff --git a/sysdeps/mips/bits/fenv.h b/sysdeps/mips/bits/fenv.h new file mode 100644 index 0000000000..0637bf7623 --- /dev/null +++ b/sysdeps/mips/bits/fenv.h @@ -0,0 +1,72 @@ +/* Copyright (C) 1998 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., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _FENV_H +# error "Never use directly; include instead." +#endif + + +/* Define bits representing the exception. We use the bit positions + of the appropriate bits in the FPU control word. */ +enum + { + FE_INEXACT = 0x04, +#define FE_INEXACT FE_INEXACT + FE_UNDERFLOW = 0x08, +#define FE_UNDERFLOW FE_UNDERFLOW + FE_OVERFLOW = 0x10, +#define FE_OVERFLOW FE_OVERFLOW + FE_DIVBYZERO = 0x20, +#define FE_DIVBYZERO FE_DIVBYZERO + FE_INVALID = 0x40, +#define FE_INVALID FE_INVALID + }; + +#define FE_ALL_EXCEPT \ + (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID) + +/* The MIPS FPU supports all of the four defined rounding modes. We + use again the bit positions in the FPU control word as the values + for the appropriate macros. */ +enum + { + FE_TONEAREST = 0x0, +#define FE_TONEAREST FE_TONEAREST + FE_TOWARDZERO = 0x1, +#define FE_TOWARDZERO FE_TOWARDZERO + FE_UPWARD = 0x2, +#define FE_UPWARD FE_UPWARD + FE_DOWNWARD = 0x3 +#define FE_DOWNWARD FE_DOWNWARD + }; + + +/* Type representing exception flags. */ +typedef unsigned short int fexcept_t; + + +/* Type representing floating-point environment. This function corresponds + to the layout of the block written by the `fstenv'. */ +typedef struct + { + unsigned int fp_control_register; + } +fenv_t; + +/* If the default argument is used we use this value. */ +#define FE_DFL_ENV ((fenv_t *) -1) diff --git a/sysdeps/mips/fclrexcpt.c b/sysdeps/mips/fclrexcpt.c new file mode 100644 index 0000000000..de96dd0b5c --- /dev/null +++ b/sysdeps/mips/fclrexcpt.c @@ -0,0 +1,40 @@ +/* Clear given exceptions in current floating-point environment. + Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Andreas Jaeger , 1998. + + 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., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +void +feclearexcept (int excepts) +{ + int cw; + + /* Mask out unsupported bits/exceptions. */ + excepts &= FE_ALL_EXCEPT; + + /* Read the complete control word. */ + _FPU_GETCW (cw); + + /* Clear exception bits. */ + cw &= ~excepts; + + /* Put the new data in effect. */ + _FPU_SETCW (cw); +} diff --git a/sysdeps/mips/fegetenv.c b/sysdeps/mips/fegetenv.c new file mode 100644 index 0000000000..13a2c8fc19 --- /dev/null +++ b/sysdeps/mips/fegetenv.c @@ -0,0 +1,28 @@ +/* Store current floating-point environment. + Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Andreas Jaeger , 1998. + + 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., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +void +fegetenv (fenv_t *envp) +{ + _FPU_GETCW (*envp); +} diff --git a/sysdeps/mips/fegetround.c b/sysdeps/mips/fegetround.c new file mode 100644 index 0000000000..e2e51ae64d --- /dev/null +++ b/sysdeps/mips/fegetround.c @@ -0,0 +1,33 @@ +/* Return current rounding direction. + Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Andreas Jaeger , 1998. + + 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., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +int +fegetround (void) +{ + int cw; + + /* Get control word. */ + _FPU_GETCW (cw); + + return cw & 0x3; +} diff --git a/sysdeps/mips/fesetenv.c b/sysdeps/mips/fesetenv.c new file mode 100644 index 0000000000..58df06391e --- /dev/null +++ b/sysdeps/mips/fesetenv.c @@ -0,0 +1,31 @@ +/* Install given floating-point environment. + Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Andreas Jaeger , 1998. + + 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., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +void +fesetenv (const fenv_t *envp) +{ + if (envp == FE_DFL_ENV) + _FPU_SETCW (_FPU_DEFAULT); + else + _FPU_SETCW (envp->fp_control_register); +} diff --git a/sysdeps/mips/fesetround.c b/sysdeps/mips/fesetround.c new file mode 100644 index 0000000000..6b623d6eab --- /dev/null +++ b/sysdeps/mips/fesetround.c @@ -0,0 +1,43 @@ +/* Set current rounding direction. + Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Andreas Jaeger , 1998. + + 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., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +int +fesetround (int round) +{ + unsigned short int cw; + + if ((round & ~0x3) != 0) + /* ROUND is no valid rounding mode. */ + return 0; + + /* Get current state. */ + _FPU_GETCW (cw); + + /* Set rounding bits. */ + cw &= ~0x3; + cw |= round; + /* Set new state. */ + _FPU_SETCW (cw); + + return 1; +} diff --git a/sysdeps/mips/feupdateenv.c b/sysdeps/mips/feupdateenv.c new file mode 100644 index 0000000000..e826084671 --- /dev/null +++ b/sysdeps/mips/feupdateenv.c @@ -0,0 +1,40 @@ +/* Install given floating-point environment and raise exceptions. + Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Andreas Jaeger , 1998. + + 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., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +void +feupdateenv (const fenv_t *envp) +{ + int temp; + + /* Save current exceptions. */ + _FPU_GETCW (temp); + temp &= FE_ALL_EXCEPT; + + /* Install new environment. */ + fesetenv (envp); + + /* Raise the safed exception. Incidently for us the implementation + defined format of the values in objects of type fexcept_t is the + same as the ones specified using the FE_* constants. */ + feraiseexcept (temp); +} diff --git a/sysdeps/mips/fgetexcptflg.c b/sysdeps/mips/fgetexcptflg.c new file mode 100644 index 0000000000..f3d52bc555 --- /dev/null +++ b/sysdeps/mips/fgetexcptflg.c @@ -0,0 +1,33 @@ +/* Store current representation for exceptions. + Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Andreas Jaeger , 1998. + + 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., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +void +fegetexceptflag (fexcept_t *flagp, int excepts) +{ + fexcept_t temp; + + /* Get the current exceptions. */ + _FPU_GETCW (temp); + + *flagp = temp & excepts & FE_ALL_EXCEPT; +} diff --git a/sysdeps/mips/ftestexcept.c b/sysdeps/mips/ftestexcept.c new file mode 100644 index 0000000000..f348258318 --- /dev/null +++ b/sysdeps/mips/ftestexcept.c @@ -0,0 +1,33 @@ +/* Test exception in current environment. + Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Andreas Jaeger , 1998. + + 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., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +int +fetestexcept (int excepts) +{ + int cw; + + /* Get current control word. */ + _FPU_GETCW (cw); + + return cw & excepts & FE_ALL_EXCEPT; +} diff --git a/sysdeps/unix/mips/sysdep.S b/sysdeps/unix/mips/sysdep.S index 4275d664ec..fa8888663e 100644 --- a/sysdeps/unix/mips/sysdep.S +++ b/sysdeps/unix/mips/sysdep.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1993, 1994, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1993, 1994, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Brendan Kehoe (brendan@zen.org). @@ -21,10 +21,16 @@ #define _ERRNO_H #include - .comm errno, 4 + .bss + .globl errno #ifdef __ELF__ - .type errno, @object + .type errno, @object #endif + .size errno, 4 +errno: + .space 4 + +weak_alias (errno, _errno) .set noreorder diff --git a/sysdeps/unix/sysv/linux/mips/bits/ipc.h b/sysdeps/unix/sysv/linux/mips/bits/ipc.h index 2841e6a5e2..04bd3f0ce2 100644 --- a/sysdeps/unix/sysv/linux/mips/bits/ipc.h +++ b/sysdeps/unix/sysv/linux/mips/bits/ipc.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1995, 1996, 1997, 1998 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 @@ -33,7 +33,6 @@ #define IPC_STAT 2 /* Get `ipc_perm' options. */ #define IPC_INFO 3 /* See ipcs. */ - /* Special key values. */ #define IPC_PRIVATE ((__key_t) 0) /* Private key. */ @@ -51,14 +50,6 @@ struct ipc_perm }; -/* Kludge to work around Linux' restriction of only up to five - arguments to a system call. */ -struct ipc_kludge - { - void *msgp; - long int msgtyp; - }; - __BEGIN_DECLS /* The actual system call: all functions are multiplexed by this. */ diff --git a/sysdeps/unix/sysv/linux/mips/bits/signum.h b/sysdeps/unix/sysv/linux/mips/bits/signum.h index c30abe3841..2cf5814739 100644 --- a/sysdeps/unix/sysv/linux/mips/bits/signum.h +++ b/sysdeps/unix/sysv/linux/mips/bits/signum.h @@ -19,16 +19,61 @@ #ifdef _SIGNAL_H -/* Take these architecture specific stuff from the kernel header files. */ -#define __need_fake_sigfuns -#define __need_signums -#include +/* Fake signal functions. */ +#define SIG_ERR ((__sighandler_t) -1) /* Error return. */ +#define SIG_DFL ((__sighandler_t) 0) /* Default action. */ +#define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */ #ifdef __USE_UNIX98 # define SIG_HOLD ((__sighandler_t) 2) /* Add signal to hold mask. */ #endif -#endif /* included. */ -#define __need__nsig -#include +#define SIGHUP 1 /* Hangup (POSIX). */ +#define SIGINT 2 /* Interrupt (ANSI). */ +#define SIGQUIT 3 /* Quit (POSIX). */ +#define SIGILL 4 /* Illegal instruction (ANSI). */ +#define SIGTRAP 5 /* Trace trap (POSIX). */ +#define SIGIOT 6 /* IOT trap (4.2 BSD). */ +#define SIGABRT SIGIOT /* Abort (ANSI). */ +#define SIGEMT 7 +#define SIGFPE 8 /* Floating-point exception (ANSI). */ +#define SIGKILL 9 /* Kill, unblockable (POSIX). */ +#define SIGBUS 10 /* BUS error (4.2 BSD). */ +#define SIGSEGV 11 /* Segmentation violation (ANSI). */ +#define SIGSYS 12 +#define SIGPIPE 13 /* Broken pipe (POSIX). */ +#define SIGALRM 14 /* Alarm clock (POSIX). */ +#define SIGTERM 15 /* Termination (ANSI). */ +#define SIGUSR1 16 /* User-defined signal 1 (POSIX). */ +#define SIGUSR2 17 /* User-defined signal 2 (POSIX). */ +#define SIGCHLD 18 /* Child status has changed (POSIX). */ +#define SIGCLD SIGCHLD /* Same as SIGCHLD (System V). */ +#define SIGPWR 19 /* Power failure restart (System V). */ +#define SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */ +#define SIGURG 21 /* Urgent condition on socket (4.2 BSD). */ +#define SIGIO 22 /* I/O now possible (4.2 BSD). */ +#define SIGPOLL SIGIO /* Pollable event occurred (System V). */ +#define SIGSTOP 23 /* Stop, unblockable (POSIX). */ +#define SIGTSTP 24 /* Keyboard stop (POSIX). */ +#define SIGCONT 25 /* Continue (POSIX). */ +#define SIGTTIN 26 /* Background read from tty (POSIX). */ +#define SIGTTOU 27 /* Background write to tty (POSIX). */ +#define SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */ +#define SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */ +#define SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */ +#define SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */ + + +#define _NSIG 128 /* Biggest signal number + 1 + (including real-time signals). */ + +#define SIGRTMIN (__libc_current_sigrtmin ()) +#define SIGRTMAX (__libc_current_sigrtmax ()) + +/* These are the hard limits of the kernel. These values should not be + used directly at user level. */ +#define __SIGRTMIN 32 +#define __SIGRTMAX (_NSIG - 1) + +#endif /* included. */ diff --git a/sysdeps/unix/sysv/linux/mips/bits/socket.h b/sysdeps/unix/sysv/linux/mips/bits/socket.h index 528b8be8d4..cd85df7ef3 100644 --- a/sysdeps/unix/sysv/linux/mips/bits/socket.h +++ b/sysdeps/unix/sysv/linux/mips/bits/socket.h @@ -1,4 +1,4 @@ -/* System-specific socket constants and types. Linux version. +/* System-specific socket constants and types. Linux/MIPS version. Copyright (C) 1991, 92, 94, 95, 96, 97, 98 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -17,7 +17,10 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#if !defined _SYS_STAT_H && !defined _NETINET_IN_H +#ifndef __BITS_SOCKET_H +#define __BITS_SOCKET_H + +#if !defined _SYS_SOCKET_H && !defined _NETINET_IN_H # error "Never include directly; use instead." #endif @@ -25,65 +28,93 @@ #define __need_NULL #include +#include + /* Type for length arguments in socket calls. */ typedef unsigned int socklen_t; -/* Supported address families. */ -#define PF_UNSPEC 0 +/* Types of sockets. */ +enum __socket_type +{ + SOCK_DGRAM = 1, /* Connectionless, unreliable datagrams + of fixed maximum length. */ +#define SOCK_DGRAM SOCK_DGRAM + SOCK_STREAM = 2, /* Sequenced, reliable, connection-based + byte streams. */ +#define SOCK_STREAM SOCK_STREAM + SOCK_RAW = 3, /* Raw protocol interface. */ +#define SOCK_RAW SOCK_RAW + SOCK_RDM = 4, /* Reliably-delivered messages. */ +#define SOCK_RDM SOCK_RDM + SOCK_SEQPACKET = 5, /* Sequenced, reliable, connection-based, + datagrams of fixed maximum length. */ +#define SOCK_SEQPACKET SOCK_SEQPACKET + SOCK_PACKET = 10 /* Linux specific way of getting packets + at the dev level. For writing rarp and + other similar things on the user level. */ +#define SOCK_PACKET SOCK_PACKET +}; + +/* Protocol families. */ +#define PF_UNSPEC 0 /* Unspecified. */ #define PF_LOCAL 1 /* Local to host (pipes and file-domain). */ #define PF_UNIX PF_LOCAL /* Old BSD name for PF_LOCAL. */ -#define PF_FILE PF_LOCAL /* POSIX name for PF_LOCAL. */ +#define PF_FILE PF_LOCAL /* Another non-standard name for PF_LOCAL. */ #define PF_INET 2 /* IP protocol family. */ #define PF_AX25 3 /* Amateur Radio AX.25. */ #define PF_IPX 4 /* Novell Internet Protocol. */ -#define PF_APPLETALK 5 /* Don't use this. */ +#define PF_APPLETALK 5 /* Appletalk DDP. */ #define PF_NETROM 6 /* Amateur radio NetROM. */ #define PF_BRIDGE 7 /* Multiprotocol bridge. */ -#define PF_AAL5 8 /* Reserved for Werner's ATM. */ +#define PF_ATMPVC 8 /* ATM PVCs. */ #define PF_X25 9 /* Reserved for X.25 project. */ #define PF_INET6 10 /* IP version 6. */ -#define PF_ROSE 11 /* Amateur Radio X.25 PLP */ -#define PF_DECnet 12 /* Reserved for DECnet project */ -#define PF_NETBEUI 13 /* Reserved for 802.2LLC project*/ -#define PF_SECURITY 14 /* Security callback pseudo AF */ -#define PF_KEY 15 /* PF_KEY key management API */ +#define PF_ROSE 11 /* Amateur Radio X.25 PLP. */ +#define PF_DECnet 12 /* Reserved for DECnet project. */ +#define PF_NETBEUI 13 /* Reserved for 802.2LLC project. */ +#define PF_SECURITY 14 /* Security callback pseudo AF. */ +#define PF_KEY 15 /* PF_KEY key management API. */ #define PF_NETLINK 16 -#define PF_ROUTE PF_NETLINK /* Alias to emulate 4.4BSD */ -#define PF_PACKET 17 /* Packet family */ -#define PF_ASH 18 /* Ash */ -#define PF_MAX 32 /* For now.. */ - -/* Protocol families, same as address families. */ -#define AF_UNSPEC PF_UNSPEC -#define AF_UNIX PF_UNIX -#define AF_LOCAL PF_LOCAL -#define AF_FILE PF_FILE - -#define AF_AX25 PF_AX25 -#define AF_IPX PF_IPX -#define AF_APPLETALK PF_APPLETALK +#define PF_ROUTE PF_NETLINK /* Alias to emulate 4.4BSD. */ +#define PF_PACKET 17 /* Packet family. */ +#define PF_ASH 18 /* Ash. */ +#define PF_ECONET 19 /* Acorn Econet. */ +#define PF_ATMSVC 20 /* ATM SVCs. */ +#define PF_SNA 22 /* Linux SNA Project */ +#define PF_MAX 32 /* For now.. */ + +/* Address families. */ +#define AF_UNSPEC PF_UNSPEC +#define AF_LOCAL PF_LOCAL +#define AF_UNIX PF_UNIX +#define AF_FILE PF_FILE +#define AF_INET PF_INET +#define AF_AX25 PF_AX25 +#define AF_IPX PF_IPX +#define AF_APPLETALK PF_APPLETALK #define AF_NETROM PF_NETROM -#define AF_BRIDGE PF_BRIDGE -#define AF_AAL5 PF_AAL5 -#define AF_X25 PF_X25 -#define AF_INET6 PF_INET6 -#define AF_ROSE PF_ROSE -#define AF_DECNET PF_DECNET -#define AF_NETBEUI PF_NETBEUI +#define AF_BRIDGE PF_BRIDGE +#define AF_ATMPVC PF_ATMPVC +#define AF_X25 PF_X25 +#define AF_INET6 PF_INET6 +#define AF_ROSE PF_ROSE +#define AF_DECnet PF_DECnet +#define AF_NETBEUI PF_NETBEUI #define AF_SECURITY PF_SECURITY #define pseudo_AF_KEY PF_KEY #define AF_NETLINK PF_NETLINK #define AF_ROUTE PF_ROUTE #define AF_PACKET PF_PACKET #define AF_ASH PF_ASH -#define AF_MAX PF_MAX +#define AF_ECONET PF_ECONET +#define AF_ATMSVC PF_ATMSVC +#define AF_SNA PF_SNA +#define AF_MAX PF_MAX /* Socket level values. Others are defined in the appropriate headers. XXX These definitions also should go into the appropriate headers as far as they are available. */ -#define SOL_IPV6 41 -#define SOL_ICMPV6 58 #define SOL_RAW 255 #define SOL_DECNET 261 #define SOL_X25 262 @@ -106,10 +137,15 @@ struct sockaddr enum { MSG_OOB = 0x01, /* Process out-of-band data. */ +#define MSG_OOB MSG_OOB MSG_PEEK = 0x02, /* Peek at incoming messages. */ +#define MSG_PEEK MSG_PEEK MSG_DONTROUTE = 0x04, /* Don't use local routing. */ +#define MSG_DONTROUTE MSG_DONTROUTE MSG_CTRUNC = 0x08, /* Control data lost before delivery. */ +#define MSG_CTRUNC MSG_CTRUNC MSG_PROXY = 0x10 /* Supply or ask second address. */ +#define MSG_PROXY MSG_PROXY }; @@ -121,10 +157,10 @@ struct msghdr socklen_t msg_namelen; /* Length of address data. */ struct iovec *msg_iov; /* Vector of data to send/receive into. */ - int msg_iovlen; /* Number of elements in the vector. */ + size_t msg_iovlen; /* Number of elements in the vector. */ __ptr_t msg_control; /* Ancillary data (eg BSD filedesc passing). */ - socklen_t msg_controllen; /* Ancillary data buffer length. */ + size_t msg_controllen; /* Ancillary data buffer length. */ int msg_flags; /* Flags on received message. */ }; @@ -132,12 +168,13 @@ struct msghdr /* Structure used for storage of ancillary data object information. */ struct cmsghdr { - socklen_t cmsg_len; /* Length of data in cmsg_data plus length + size_t cmsg_len; /* Length of data in cmsg_data plus length of cmsghdr structure. */ int cmsg_level; /* Originating protocol. */ int cmsg_type; /* Protocol specific type. */ #if !defined __STRICT_ANSI__ && defined __GNUC__ && __GNUC__ >= 2 unsigned char __cmsg_data[0]; /* Ancillary data. */ + /* XXX Perhaps this should be removed. */ #endif }; @@ -157,14 +194,14 @@ struct cmsghdr + CMSG_ALIGN (sizeof (struct cmsghdr))) #define CMSG_LEN(len) (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len)) - -#ifndef _EXTERN_INLINE -# define _EXTERN_INLINE extern __inline -#endif extern struct cmsghdr *__cmsg_nxthdr __P ((struct msghdr *__mhdr, struct cmsghdr *__cmsg)); +#ifdef __USE_EXTERN_INLINES +# ifndef _EXTERN_INLINE +# define _EXTERN_INLINE extern __inline +# endif _EXTERN_INLINE struct cmsghdr * -__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg) +__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg) __THROW { if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr)) /* The kernel header does this so there may be a reason. */ @@ -180,7 +217,29 @@ __cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg) return NULL; return __cmsg; } +#endif /* Use `extern inline'. */ +/* Socket level message types. This must match the definitions in + . */ +enum + { + SCM_RIGHTS = 0x01, /* Transfer file descriptors. */ +#define SCM_RIGHTS SCM_RIGHTS +#ifdef __USE_BSD + SCM_CREDENTIALS = 0x02, /* Credentials passing. */ +# define SCM_CREDENTIALS SCM_CREDENTIALS +#endif + __SCM_CONNECT = 0x03 /* Data array is `struct scm_connect'. */ + }; + +/* User visible structure for SCM_CREDENTIALS message */ + +struct ucred +{ + pid_t pid; /* PID of sending process. */ + uid_t uid; /* UID of sending process. */ + gid_t gid; /* GID of sending process. */ +}; /* Get socket manipulation related informations from kernel headers. */ #include @@ -192,3 +251,5 @@ struct linger int l_onoff; /* Nonzero to linger on close. */ int l_linger; /* Time to linger. */ }; + +#endif /* bits/socket.h */ diff --git a/sysdeps/unix/sysv/linux/mips/bits/stat.h b/sysdeps/unix/sysv/linux/mips/bits/stat.h index 3bcf1a9299..f0afd5e728 100644 --- a/sysdeps/unix/sysv/linux/mips/bits/stat.h +++ b/sysdeps/unix/sysv/linux/mips/bits/stat.h @@ -22,15 +22,17 @@ /* Versions of the `struct stat' data structure. */ #define _STAT_VER_LINUX_OLD 1 +#define _STAT_VER_KERNEL 1 #define _STAT_VER_SVR4 2 #define _STAT_VER_LINUX 3 -#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ +#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ /* Versions of the `xmknod' interface. */ #define _MKNOD_VER_LINUX 1 #define _MKNOD_VER_SVR4 2 #define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ + /* Structure describing file characteristics. */ struct stat { diff --git a/sysdeps/unix/sysv/linux/mips/bits/time.h b/sysdeps/unix/sysv/linux/mips/bits/time.h deleted file mode 100644 index 15c7cb3852..0000000000 --- a/sysdeps/unix/sysv/linux/mips/bits/time.h +++ /dev/null @@ -1,57 +0,0 @@ -/* System-dependent timing definitions. Linux/MIPS version. - Copyright (C) 1996, 1997, 1998 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., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* - * Never include this file directly; use instead. - */ - -#ifndef __need_timeval -# ifndef _BITS_TIME_H -# define _BITS_TIME_H 1 - -/* ISO/IEC 9899:1990 7.12.1: - The macro `CLOCKS_PER_SEC' is the number per second of the value - returned by the `clock' function. */ -/* CAE XSH, Issue 4, Version 2: - The value of CLOCKS_PER_SEC is required to be 1 million on all - XSI-conformant systems. */ -# define CLOCKS_PER_SEC 1000000 - -# ifndef __STRICT_ANSI__ -/* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK - presents the real value for clock ticks per second for the system. */ -# define CLK_TCK 100 /* XXX not correct for all systems. */ -# endif - -# endif /* bits/time.h */ -#endif - -#ifdef __need_timeval -# undef __need_timeval -# ifndef _STRUCT_TIMEVAL -# define _STRUCT_TIMEVAL 1 -/* A time value that is accurate to the nearest - microsecond but also has a range of years. */ -struct timeval - { - long int tv_sec; /* Seconds. */ - long int tv_usec; /* Microseconds. */ - }; -# endif /* struct timeval */ -#endif /* need timeval */ diff --git a/sysdeps/unix/sysv/linux/mips/kernel_sigaction.h b/sysdeps/unix/sysv/linux/mips/kernel_sigaction.h index bb7fe6bece..3a803a66a5 100644 --- a/sysdeps/unix/sysv/linux/mips/kernel_sigaction.h +++ b/sysdeps/unix/sysv/linux/mips/kernel_sigaction.h @@ -4,9 +4,12 @@ #define HAVE_SA_RESTORER +/* Linux/MIPS still uses the old sigaction structure in the kernel. */ +#define old_kernel_sigaction kernel_sigaction + struct kernel_sigaction { unsigned int sa_flags; - __sighandler_t sa_handler; + __sighandler_t k_sa_handler; unsigned long sa_mask; unsigned int __pad0[3]; /* reserved, keep size constant */ diff --git a/sysdeps/unix/sysv/linux/mips/kernel_termios.h b/sysdeps/unix/sysv/linux/mips/kernel_termios.h index 35be1bb290..e8768627fc 100644 --- a/sysdeps/unix/sysv/linux/mips/kernel_termios.h +++ b/sysdeps/unix/sysv/linux/mips/kernel_termios.h @@ -1,9 +1,24 @@ -#ifndef _SYS_KERNEL_TERMIOS_H -#define _SYS_KERNEL_TERMIOS_H 1 -/* The following corresponds to the values from the Linux 2.1.24 kernel. */ +/* Copyright (C) 1997 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. -/* We need the definition of tcflag_t, cc_t, and speed_t. */ -#include + 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., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _KERNEL_TERMIOS_H +#define _KERNEL_TERMIOS_H 1 +/* The following corresponds to the values from the Linux 2.1.24 kernel. */ #define __KERNEL_NCCS 23 diff --git a/sysdeps/unix/sysv/linux/mips/pread.c b/sysdeps/unix/sysv/linux/mips/pread.c new file mode 100644 index 0000000000..c3bdcf9cc7 --- /dev/null +++ b/sysdeps/unix/sysv/linux/mips/pread.c @@ -0,0 +1,62 @@ +/* Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + 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., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +#include +#include + +#ifdef __NR_pread + +extern ssize_t __syscall_pread (int fd, void *buf, size_t count, int dummy, + off_t offset_hi, off_t offset_lo); + +static ssize_t __emulate_pread (int fd, void *buf, size_t count, + off_t offset) internal_function; + + +ssize_t +__pread (fd, buf, count, offset) + int fd; + void *buf; + size_t count; + off_t offset; +{ + ssize_t result; + + /* First try the syscall. */ +#if defined(__MIPSEB__) + result = INLINE_SYSCALL (pread, 6, fd, buf, count, 0, 0, offset); +#elif defined(__MIPSEL__) + result = INLINE_SYSCALL (pread, 6, fd, buf, count, 0, offset, 0); +#endif + if (result == -1 && errno == ENOSYS) + /* No system call available. Use the emulation. */ + result = __emulate_pread (fd, buf, count, offset); + + return result; +} + +weak_alias (__pread, pread) + +#define __pread(fd, buf, count, offset) \ + static internal_function __emulate_pread (fd, buf, count, offset) +#endif +#include diff --git a/sysdeps/unix/sysv/linux/mips/pread64.c b/sysdeps/unix/sysv/linux/mips/pread64.c new file mode 100644 index 0000000000..dfcfa01318 --- /dev/null +++ b/sysdeps/unix/sysv/linux/mips/pread64.c @@ -0,0 +1,65 @@ +/* Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + 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., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +#include +#include + +#ifdef __NR_pread + +extern ssize_t __syscall_pread (int fd, void *buf, size_t count, int dummy, + off_t offset_hi, off_t offset_lo); + +static ssize_t __emulate_pread64 (int fd, void *buf, size_t count, + off64_t offset) internal_function; + + +ssize_t +__pread64 (fd, buf, count, offset) + int fd; + void *buf; + size_t count; + off64_t offset; +{ + ssize_t result; + + /* First try the syscall. */ +#if defined(__MIPSEB__) + result = INLINE_SYSCALL (pread, 6, fd, buf, count, 0, (off_t) (offset >> 32), + (off_t) (offset & 0xffffffff)); +#elif defined(__MIPSEL__) + result = INLINE_SYSCALL (pread, 6, fd, buf, count, 0, + (off_t) (offset & 0xffffffff), + (off_t) (offset >> 32)); +#endif + if (result == -1 && errno == ENOSYS) + /* No system call available. Use the emulation. */ + result = __emulate_pread64 (fd, buf, count, offset); + + return result; +} + +weak_alias (__pread64, pread64) + +#define __pread64(fd, buf, count, offset) \ + static internal_function __emulate_pread64 (fd, buf, count, offset) +#endif +#include diff --git a/sysdeps/unix/sysv/linux/mips/pwrite.c b/sysdeps/unix/sysv/linux/mips/pwrite.c new file mode 100644 index 0000000000..274c14266e --- /dev/null +++ b/sysdeps/unix/sysv/linux/mips/pwrite.c @@ -0,0 +1,62 @@ +/* Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + 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., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +#include +#include + +#ifdef __NR_pwrite + +extern ssize_t __syscall_pwrite (int fd, const void *buf, size_t count, + int dummy, off_t offset_hi, off_t offset_lo); + +static ssize_t __emulate_pwrite (int fd, const void *buf, size_t count, + off_t offset) internal_function; + + +ssize_t +__pwrite (fd, buf, count, offset) + int fd; + const void *buf; + size_t count; + off_t offset; +{ + ssize_t result; + + /* First try the syscall. */ +#if defined(__MIPSEB__) + result = INLINE_SYSCALL (pwrite, 6, fd, buf, count, 0, 0, offset); +#elif defined(__MIPSEL__) + result = INLINE_SYSCALL (pwrite, 6, fd, buf, count, 0, offset, 0); +#endif + if (result == -1 && errno == ENOSYS) + /* No system call available. Use the emulation. */ + result = __emulate_pwrite (fd, buf, count, offset); + + return result; +} + +weak_alias (__pwrite, pwrite) + +#define __pwrite(fd, buf, count, offset) \ + static internal_function __emulate_pwrite (fd, buf, count, offset) +#endif +#include diff --git a/sysdeps/unix/sysv/linux/mips/pwrite64.c b/sysdeps/unix/sysv/linux/mips/pwrite64.c new file mode 100644 index 0000000000..f73b10e0aa --- /dev/null +++ b/sysdeps/unix/sysv/linux/mips/pwrite64.c @@ -0,0 +1,65 @@ +/* Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ralf Baechle , 1998. + + 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., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +#include +#include + +#ifdef __NR_pwrite + +extern ssize_t __syscall_pwrite (int fd, const void *buf, size_t count, + int dummy, off_t offset_hi, off_t offset_lo); + +static ssize_t __emulate_pwrite64 (int fd, const void *buf, size_t count, + off64_t offset) internal_function; + + +ssize_t +__pwrite64 (fd, buf, count, offset) + int fd; + const void *buf; + size_t count; + off64_t offset; +{ + ssize_t result; + + /* First try the syscall. */ +#if defined(__MIPSEB__) + result = INLINE_SYSCALL (pwrite, 6, fd, buf, count, 0, (off_t) (offset >> 32), + (off_t) (offset & 0xffffffff)); +#elif defined(__MIPSEL__) + result = INLINE_SYSCALL (pwrite, 6, fd, buf, count, 0, + (off_t) (offset & 0xffffffff), + (off_t) (offset >> 32)); +#endif + if (result == -1 && errno == ENOSYS) + /* No system call available. Use the emulation. */ + result = __emulate_pwrite64 (fd, buf, count, offset); + + return result; +} + +weak_alias (__pwrite64, pwrite64) + +#define __pwrite64(fd, buf, count, offset) \ + static internal_function __emulate_pwrite64 (fd, buf, count, offset) +#endif +#include diff --git a/sysdeps/unix/sysv/linux/mips/sys/syscall.h b/sysdeps/unix/sysv/linux/mips/sys/syscall.h index 82f8427aa0..36214e4162 100644 --- a/sysdeps/unix/sysv/linux/mips/sys/syscall.h +++ b/sysdeps/unix/sysv/linux/mips/sys/syscall.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1995, 1996, 1997, 1998 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 @@ -1009,7 +1009,7 @@ #define SYS_time (SYS_Linux + 13) #define SYS_mknod (SYS_Linux + 14) #define SYS_chmod (SYS_Linux + 15) -#define SYS_chown (SYS_Linux + 16) +#define SYS_lchown (SYS_Linux + 16) #define SYS_break (SYS_Linux + 17) #define SYS_oldstat (SYS_Linux + 18) #define SYS_lseek (SYS_Linux + 19) @@ -1045,7 +1045,7 @@ #define SYS_geteuid (SYS_Linux + 49) #define SYS_getegid (SYS_Linux + 50) #define SYS_acct (SYS_Linux + 51) -#define SYS_phys (SYS_Linux + 52) +#define SYS_umount2 (SYS_Linux + 52) #define SYS_lock (SYS_Linux + 53) #define SYS_ioctl (SYS_Linux + 54) #define SYS_fcntl (SYS_Linux + 55) @@ -1183,5 +1183,25 @@ #define SYS_query_module (SYS_Linux + 187) #define SYS_poll (SYS_Linux + 188) #define SYS_nfsservctl (SYS_Linux + 189) +#define SYS_setresgid (SYS_Linux + 190) +#define SYS_getresgid (SYS_Linux + 191) +#define SYS_prctl (SYS_Linux + 192) +#define SYS_rt_sigreturn (SYS_Linux + 193) +#define SYS_rt_sigaction (SYS_Linux + 194) +#define SYS_rt_sigprocmask (SYS_Linux + 195) +#define SYS_rt_sigpending (SYS_Linux + 196) +#define SYS_rt_sigtimedwait (SYS_Linux + 197) +#define SYS_rt_sigqueueinfo (SYS_Linux + 198) +#define SYS_rt_sigsuspend (SYS_Linux + 199) +#define SYS_pread (SYS_Linux + 200) +#define SYS_pwrite (SYS_Linux + 201) +#define SYS_chown (SYS_Linux + 202) +#define SYS_getcwd (SYS_Linux + 203) +#define SYS_capget (SYS_Linux + 204) +#define SYS_capset (SYS_Linux + 205) +#define SYS_sigaltstack (SYS_Linux + 206) +#define SYS_sendfile (SYS_Linux + 207) +#define SYS_putpmsg (SYS_Linux + 208) +#define SYS_getpmsg (SYS_Linux + 209) #endif /* sys/syscall.h */ diff --git a/sysdeps/unix/sysv/linux/mips/sys/ucontext.h b/sysdeps/unix/sysv/linux/mips/sys/ucontext.h new file mode 100644 index 0000000000..dd534eae20 --- /dev/null +++ b/sysdeps/unix/sysv/linux/mips/sys/ucontext.h @@ -0,0 +1,77 @@ +/* Copyright (C) 1997, 1998 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., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* Don't rely on this, the interface is currently messed up and may need to + be broken to be fixed. */ +#ifndef _SYS_UCONTEXT_H +#define _SYS_UCONTEXT_H 1 + +#include +#include + +/* We need the signal context definitions even if they are not used + included in . */ +#include + + +/* Type for general register. */ +typedef unsigned long greg_t; + +/* Number of general registers. */ +#define NGREG 37 +#define NFPREG 33 + +/* Container for all general registers. */ +typedef struct gregset { + greg_t g_regs[32]; + greg_t g_hi; + greg_t g_lo; + greg_t g_pad[3]; +} gregset_t; + +/* Container for all FPU registers. */ +typedef struct fpregset { + union { + double fp_dregs[32]; + struct { + float _fp_fregs; + unsigned int _fp_pad; + } fp_fregs[32]; + } fp_r; + unsigned int fp_csr; + unsigned int fp_pad; +} fpregset_t; + +/* Context to describe whole processor state. */ +typedef struct + { + gregset_t gregs; + fpregset_t fpregs; + } mcontext_t; + +/* Userlevel context. */ +typedef struct ucontext + { + unsigned long uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + __sigset_t uc_sigmask; + } ucontext_t; + +#endif /* sys/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/mips/syscalls.list b/sysdeps/unix/sysv/linux/mips/syscalls.list index dd38647d95..dd29d159aa 100644 --- a/sysdeps/unix/sysv/linux/mips/syscalls.list +++ b/sysdeps/unix/sysv/linux/mips/syscalls.list @@ -34,13 +34,16 @@ shutdown - shutdown 2 __shutdown shutdown socket - socket 3 __socket socket socketpair - socketpair 4 __socketpair socketpair -getresuid - getresuid 3 getresuid -getresgid - getresgid 3 getresgid - # # There are defined locally because the caller is also defined in this dir. # -s_llseek llseek _llseek 5 __syscall__llseek +s_llseek llseek _llseek 5 __sys_llseek +s_sigaction sigaction sigaction 3 __syscall_sigaction +s_ustat ustat ustat 2 __syscall_ustat +sys_mknod xmknod mknod 3 __syscall_mknod +sys_fstat fxstat fstat 2 __syscall_fstat +sys_lstat lxstat lstat 2 __syscall_lstat +sys_stat xstat stat 2 __syscall_stat # System calls with wrappers. rt_sigaction - rt_sigaction 4 __syscall_rt_sigaction @@ -55,16 +58,14 @@ s_getpriority getpriority getpriority 2 __syscall_getpriority s_getresgid getresgid getresgid 3 __syscall_getresgid s_getresuid getresuid getresuid 3 __syscall_getresuid s_poll poll poll 3 __syscall_poll -s_pread64 pread64 pread 5 __syscall_pread +s_pread pread pread 6 __syscall_pread s_ptrace ptrace ptrace 4 __syscall_ptrace -s_pwrite64 pwrite64 pwrite 5 __syscall_pwrite +s_pwrite pwrite pwrite 6 __syscall_pwrite s_reboot reboot reboot 3 __syscall_reboot -s_sigaction sigaction sigaction 3 __syscall_sigaction s_sigpending sigpending sigpending 1 __syscall_sigpending s_sigprocmask sigprocmask sigprocmask 3 __syscall_sigprocmask -s_sigsuspend sigsuspend sigsuspend 3 __syscall_sigsuspend -s_sysctl sysctl _sysctl 1 __syscall__sysctl -s_ustat ustat ustat 2 __syscall_ustat +# Todo: we can pass 6 args in registers, no need for the wrapper +sysctl sysctl _sysctl 1 __syscall_sysctl sys_fstat fxstat fstat 2 __syscall_fstat sys_lstat lxstat lstat 2 __syscall_lstat sys_mknod xmknod mknod 3 __syscall_mknod diff --git a/sysdeps/unix/sysv/linux/mips/ustat.c b/sysdeps/unix/sysv/linux/mips/ustat.c index 447ab2947e..63eb68c602 100644 --- a/sysdeps/unix/sysv/linux/mips/ustat.c +++ b/sysdeps/unix/sysv/linux/mips/ustat.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -17,9 +17,12 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include #include #include +#include +#include extern int __syscall_ustat (unsigned long dev, struct ustat *ubuf); @@ -31,5 +34,5 @@ ustat (dev_t dev, struct ustat *ubuf) /* We must convert the value to dev_t type used by the kernel. */ k_dev = ((major (dev) & 0xff) << 8) | (minor (dev) & 0xff); - return __syscall_ustat (k_dev, ubuf); + return INLINE_SYSCALL (ustat, 2, k_dev, ubuf); } diff --git a/sysdeps/unix/sysv/linux/mips/xmknod.c b/sysdeps/unix/sysv/linux/mips/xmknod.c index c7ff64fecb..ba1b468b78 100644 --- a/sysdeps/unix/sysv/linux/mips/xmknod.c +++ b/sysdeps/unix/sysv/linux/mips/xmknod.c @@ -1,5 +1,5 @@ /* xmknod call using old-style Unix mknod system call. - Copyright (C) 1991, 1993, 1995, 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1991, 93, 95, 96, 97, 98 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 @@ -22,6 +22,9 @@ #include #include +#include +#include + extern int __syscall_mknod (const char *, unsigned long, unsigned int); /* Create a device file named PATH, with permission and special bits MODE @@ -41,7 +44,7 @@ __xmknod (int vers, const char *path, mode_t mode, dev_t *dev) /* We must convert the value to dev_t type used by the kernel. */ k_dev = ((major (*dev) & 0xff) << 8) | (minor (*dev) & 0xff); - return __syscall_mknod (path, mode, k_dev); + return INLINE_SYSCALL (mknod, 3, path, mode, k_dev); } weak_alias (__xmknod, _xmknod) diff --git a/sysdeps/unix/sysv/linux/mips/xstat.c b/sysdeps/unix/sysv/linux/mips/xstat.c deleted file mode 100644 index 9f7eb58e0a..0000000000 --- a/sysdeps/unix/sysv/linux/mips/xstat.c +++ /dev/null @@ -1,80 +0,0 @@ -/* xstat using old-style Unix stat system call. - Copyright (C) 1991, 1995, 1996, 1997 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., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include - -#include - -extern int __syscall_stat (const char *, struct kernel_stat *); - -/* Get information about the file NAME in BUF. */ -int -__xstat (int vers, const char *name, struct stat *buf) -{ - struct kernel_stat kbuf; - int result; - - switch (vers) - { - case _STAT_VER_LINUX_OLD: - /* Nothing to do. The struct is in the form the kernel expects - it to be. */ - result = __syscall_stat (name, (struct kernel_stat *) buf); - break; - - case _STAT_VER_LINUX: - /* Do the system call. */ - result = __syscall_stat (name, &kbuf); - - /* Convert to current kernel version of `struct stat'. */ - buf->st_dev = kbuf.st_dev; - buf->st_pad1[0] = 0; buf->st_pad1[1] = 0; buf->st_pad1[2] = 0; - buf->st_ino = kbuf.st_ino; - buf->st_mode = kbuf.st_mode; - buf->st_nlink = kbuf.st_nlink; - buf->st_uid = kbuf.st_uid; - buf->st_gid = kbuf.st_gid; - buf->st_rdev = kbuf.st_rdev; - buf->st_pad2[0] = 0; buf->st_pad2[1] = 0; - buf->st_pad3 = 0; - buf->st_size = kbuf.st_size; - buf->st_blksize = kbuf.st_blksize; - buf->st_blocks = kbuf.st_blocks; - - buf->st_atime = kbuf.st_atime; buf->__reserved0 = 0; - buf->st_mtime = kbuf.st_mtime; buf->__reserved1 = 0; - buf->st_ctime = kbuf.st_ctime; buf->__reserved2 = 0; - - buf->st_pad4[0] = 0; buf->st_pad4[1] = 0; - buf->st_pad4[2] = 0; buf->st_pad4[3] = 0; - buf->st_pad4[4] = 0; buf->st_pad4[5] = 0; - buf->st_pad4[6] = 0; buf->st_pad4[7] = 0; - break; - - default: - __set_errno (EINVAL); - result = -1; - break; - } - - return result; -} -weak_alias (__xstat, _xstat) diff --git a/sysdeps/unix/sysv/linux/mips/xstatconv.c b/sysdeps/unix/sysv/linux/mips/xstatconv.c new file mode 100644 index 0000000000..356235ace7 --- /dev/null +++ b/sysdeps/unix/sysv/linux/mips/xstatconv.c @@ -0,0 +1,120 @@ +/* Convert between the kernel's `struct stat' format, and libc's. + Copyright (C) 1991, 1995, 1996, 1997, 1998 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., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + +static inline int +xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf) +{ + switch (vers) + { + case _STAT_VER_KERNEL: + /* Nothing to do. The struct is in the form the kernel expects. + We should have short-circuted before we got here, but for + completeness... */ + *(struct kernel_stat *) ubuf = *kbuf; + break; + + case _STAT_VER_LINUX: + { + struct stat *buf = ubuf; + + /* Convert to current kernel version of `struct stat'. */ + buf->st_dev = kbuf->st_dev; + buf->st_pad1[0] = 0; buf->st_pad1[1] = 0; buf->st_pad1[2] = 0; + buf->st_ino = kbuf->st_ino; + buf->st_mode = kbuf->st_mode; + buf->st_nlink = kbuf->st_nlink; + buf->st_uid = kbuf->st_uid; + buf->st_gid = kbuf->st_gid; + buf->st_rdev = kbuf->st_rdev; + buf->st_pad2[0] = 0; buf->st_pad2[1] = 0; + buf->st_pad3 = 0; + buf->st_size = kbuf->st_size; + buf->st_blksize = kbuf->st_blksize; + buf->st_blocks = kbuf->st_blocks; + + buf->st_atime = kbuf->st_atime; buf->__reserved0 = 0; + buf->st_mtime = kbuf->st_mtime; buf->__reserved1 = 0; + buf->st_ctime = kbuf->st_ctime; buf->__reserved2 = 0; + + buf->st_pad4[0] = 0; buf->st_pad4[1] = 0; + buf->st_pad4[2] = 0; buf->st_pad4[3] = 0; + buf->st_pad4[4] = 0; buf->st_pad4[5] = 0; + buf->st_pad4[6] = 0; buf->st_pad4[7] = 0; + } + break; + + default: + __set_errno (EINVAL); + return -1; + } + + return 0; +} + +static inline int +xstat64_conv (int vers, struct kernel_stat *kbuf, void *ubuf) +{ +#ifdef XSTAT_IS_XSTAT64 + return xstat_conv (vers, kbuf, ubuf); +#else + switch (vers) + { + case _STAT_VER_LINUX: + { + struct stat64 *buf = ubuf; + + buf->st_dev = kbuf->st_dev; + buf->st_pad1[0] = 0; buf->st_pad1[1] = 0; buf->st_pad1[2] = 0; + buf->st_ino = kbuf->st_ino; + buf->st_mode = kbuf->st_mode; + buf->st_nlink = kbuf->st_nlink; + buf->st_uid = kbuf->st_uid; + buf->st_gid = kbuf->st_gid; + buf->st_rdev = kbuf->st_rdev; + buf->st_pad2[0] = 0; buf->st_pad2[1] = 0; + buf->st_pad3 = 0; + buf->st_size = kbuf->st_size; + buf->st_blksize = kbuf->st_blksize; + buf->st_blocks = kbuf->st_blocks; + + buf->st_atime = kbuf->st_atime; buf->__reserved0 = 0; + buf->st_mtime = kbuf->st_mtime; buf->__reserved1 = 0; + buf->st_ctime = kbuf->st_ctime; buf->__reserved2 = 0; + + buf->st_pad4[0] = 0; buf->st_pad4[1] = 0; + buf->st_pad4[2] = 0; buf->st_pad4[3] = 0; + buf->st_pad4[4] = 0; buf->st_pad4[5] = 0; + buf->st_pad4[6] = 0; buf->st_pad4[7] = 0; + } + break; + + /* If struct stat64 is different from struct stat then + _STAT_VER_KERNEL does not make sense. */ + case _STAT_VER_KERNEL: + default: + __set_errno (EINVAL); + return -1; + } + + return 0; +#endif +} diff --git a/sysdeps/unix/sysv/linux/pwrite.c b/sysdeps/unix/sysv/linux/pwrite.c index 74be599b09..cd7b8adaa1 100644 --- a/sysdeps/unix/sysv/linux/pwrite.c +++ b/sysdeps/unix/sysv/linux/pwrite.c @@ -25,8 +25,8 @@ #ifdef __NR_pwrite -extern ssize_t __syscall_pwrite64 (int fd, const void *buf, size_t count, - off_t offset_hi, off_t offset_lo); +extern ssize_t __syscall_pwrite (int fd, const void *buf, size_t count, + off_t offset_hi, off_t offset_lo); static ssize_t __emulate_pwrite (int fd, const void *buf, size_t count, off_t offset) internal_function; -- cgit 1.4.1