diff options
Diffstat (limited to 'sysdeps')
62 files changed, 2232 insertions, 436 deletions
diff --git a/sysdeps/alpha/dl-machine.h b/sysdeps/alpha/dl-machine.h index 78c5071b4e..1d01f035ea 100644 --- a/sysdeps/alpha/dl-machine.h +++ b/sysdeps/alpha/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. Alpha version. - Copyright (C) 1996 Free Software Foundation, Inc. + Copyright (C) 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson <rth@tamu.edu>. @@ -14,9 +14,9 @@ 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. */ + 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. */ /* This was written in the absence of an ABI -- don't expect it to remain unchanged. */ @@ -43,7 +43,12 @@ elf_machine_matches_host (Elf64_Word e_machine) static inline Elf64_Addr elf_machine_dynamic (void) { +#ifdef AXP_MULTI_GOT_LD return (Elf64_Addr) &_DYNAMIC; +#else + register Elf64_Addr *gp __asm__ ("$29"); + return gp[-4096]; +#endif } /* Return the run-time load address of the shared object. */ diff --git a/sysdeps/generic/abort.c b/sysdeps/generic/abort.c index 366a543791..14c182b411 100644 --- a/sysdeps/generic/abort.c +++ b/sysdeps/generic/abort.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1993, 1995, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1993, 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 @@ -20,11 +20,12 @@ #include <signal.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <unistd.h> /* Try to get a machine dependent instruction which will make the program crash. This is used in case everything else fails. */ -#include "abort-instr.h" +#include <abort-instr.h> #ifndef ABORT_INSTRUCTION /* No such instruction is available. */ # define ABORT_INSTRUCTION @@ -46,7 +47,7 @@ abort (void) sigset_t sigs; /* First acquire the lock. */ - __libc_lock_lock (lock); + __libc_lock_lock_recursive (lock); /* Now it's for sure we are alone. But recursive calls are possible. */ @@ -70,8 +71,19 @@ abort (void) /* Send signal which possibly calls a user handler. */ if (stage == 2) { - ++stage; + /* This stage is special: we must allow repeated calls of + `abort' when a user defined handler for SIGABRT is installed. + This is risky since the `raise' implementation might also + fail but I don't see another possiblity. */ + int save_stage = stage; + + stage = 0; + __libc_lock_unlock_recursive (lock); + raise (SIGABRT); + + __libc_lock_lock_recursive (lock); + stage = save_stage + 1; } /* There was a handler installed. Now remove it. */ diff --git a/sysdeps/generic/gnu/types.h b/sysdeps/generic/gnu/types.h index acd817bcab..85f17a4fb1 100644 --- a/sysdeps/generic/gnu/types.h +++ b/sysdeps/generic/gnu/types.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 92, 94, 95, 96 Free Software Foundation, Inc. +/* Copyright (C) 1991, 92, 94, 95, 96, 97 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 @@ -29,17 +29,17 @@ typedef unsigned long __u_long; #ifdef __GNUC__ typedef unsigned long long int __u_quad_t; typedef long long int __quad_t; -typedef __quad_t *__qaddr_t; #else typedef struct { - long val[2]; + long __val[2]; } __quad_t; typedef struct { - __u_long val[2]; + __u_long __val[2]; } __u_quad_t; #endif +typedef __quad_t *__qaddr_t; typedef int __dev_t; /* Type of device numbers. */ typedef unsigned int __uid_t; /* Type of user identifications. */ typedef unsigned int __gid_t; /* Type of group identifications. */ @@ -72,17 +72,10 @@ typedef long int __key_t; /* Type of an IPC key */ typedef struct { - /* Some braindead old software uses this member name. */ + /* XPG4.2 requires this member name. */ unsigned long int fds_bits[(__FD_SETSIZE + (__NFDBITS - 1)) / __NFDBITS]; } __fd_set; -typedef unsigned long __fd_mask; - -/* This line MUST be split! Otherwise m4 will not change it. */ -#define __FD_ZERO(set) \ - ((void) memset ((__ptr_t) (set), 0, sizeof (fd_set))) -#define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d)) -#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d)) -#define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) +typedef unsigned long int __fd_mask; #endif /* gnu/types.h */ diff --git a/sysdeps/generic/selectbits.h b/sysdeps/generic/selectbits.h new file mode 100644 index 0000000000..e2bdf6049e --- /dev/null +++ b/sysdeps/generic/selectbits.h @@ -0,0 +1,29 @@ +/* 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. + + 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 _SELECTBITS_H +#define _SELECTBITS_H 1 + +/* This line MUST be split! Otherwise m4 will not change it. */ +#define __FD_ZERO(set) \ + ((void) memset ((__ptr_t) (set), 0, sizeof (fd_set))) +#define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d)) +#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d)) +#define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) + +#endif /* selectbits.h */ diff --git a/sysdeps/generic/speed.c b/sysdeps/generic/speed.c index 229c0665e2..52e89508c0 100644 --- a/sysdeps/generic/speed.c +++ b/sysdeps/generic/speed.c @@ -1,45 +1,47 @@ /* `struct termios' speed frobnication functions. 4.4 BSD/generic GNU version. -Copyright (C) 1991, 1992, 1993, 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. + Copyright (C) 1991, 1992, 1993, 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 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. + 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. */ + 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 <ansidecl.h> #include <stddef.h> #include <errno.h> #include <termios.h> /* Return the output baud rate stored in *TERMIOS_P. */ speed_t -DEFUN(cfgetospeed, (termios_p), CONST struct termios *termios_p) +cfgetospeed (termios_p) + const struct termios *termios_p; { return termios_p->__ospeed; } /* Return the input baud rate stored in *TERMIOS_P. */ speed_t -DEFUN(cfgetispeed, (termios_p), CONST struct termios *termios_p) +cfgetispeed (termios_p) + const struct termios *termios_p; { return termios_p->__ispeed; } /* Set the output baud rate stored in *TERMIOS_P to SPEED. */ int -DEFUN(cfsetospeed, (termios_p, speed), - struct termios *termios_p AND speed_t speed) +cfsetospeed (termios_p, speed) + struct termios *termios_p; + speed_t speed; { if (termios_p == NULL) { @@ -53,8 +55,9 @@ DEFUN(cfsetospeed, (termios_p, speed), /* Set the input baud rate stored in *TERMIOS_P to SPEED. */ int -DEFUN(cfsetispeed, (termios_p, speed), - struct termios *termios_p AND speed_t speed) +cfsetispeed (termios_p, speed) + struct termios *termios_p; + speed_t speed; { if (termios_p == NULL) { diff --git a/sysdeps/i386/selectbits.h b/sysdeps/i386/selectbits.h new file mode 100644 index 0000000000..973ecad58e --- /dev/null +++ b/sysdeps/i386/selectbits.h @@ -0,0 +1,57 @@ +/* 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. + + 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 _SELECTBITS_H +#define _SELECTBITS_H 1 + +#if defined __GNUC__ && __GNUC__ >= 2 + +#define __FD_ZERO(fdsetp) \ + __asm__ __volatile__ ("cld ; rep ; stosl" \ + : "=m" (*(__fd_set *) (fdsetp)) \ + : "a" (0), "c" (sizeof (__fd_set) \ + / sizeof (__fd_mask)), \ + "D" ((__fd_set *) (fdsetp)) \ + :"cx","di") +#define __FD_SET(fd, fdsetp) \ + __asm__ __volatile__ ("btsl %1,%0" \ + : "=m" (*(__fd_set *) (fdsetp)) \ + : "r" ((int) (fd))) +#define __FD_CLR(fd, fdsetp) \ + __asm__ __volatile__ ("btrl %1,%0" \ + : "=m" (*(__fd_set *) (fdsetp)) \ + : "r" ((int) (fd))) +#define __FD_ISSET(fd, fdsetp) \ + (__extension__ \ + ({unsigned char __result; \ + __asm__ __volatile__ ("btl %1,%2 ; setb %0" \ + : "=q" (__result) \ + : "r" ((int) (fd)), "m" (*(__fd_set *) (fdsetp))); \ + __result; })) + +#else /* ! GNU CC */ + +#define __FD_ZERO(set) \ + ((void) memset ((__ptr_t) (set), 0, sizeof (fd_set))) +#define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d)) +#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d)) +#define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) + +#endif /* GNU CC */ + +#endif /* selectbits.h */ diff --git a/sysdeps/mach/syscall.h b/sysdeps/mach/sys/syscall.h index 6e4ed4d64e..6e4ed4d64e 100644 --- a/sysdeps/mach/syscall.h +++ b/sysdeps/mach/sys/syscall.h diff --git a/sysdeps/posix/signal.c b/sysdeps/posix/signal.c index 25e7cab617..2e0cf64de3 100644 --- a/sysdeps/posix/signal.c +++ b/sysdeps/posix/signal.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc. +/* BSD-like signal function. + Copyright (C) 1991, 1992, 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 @@ -20,10 +21,12 @@ #include <signal.h> +sigset_t _sigintr; /* Set by siginterrupt. */ + /* Set the handler for the signal SIG to HANDLER, returning the old handler, or SIG_ERR on error. */ __sighandler_t -signal (sig, handler) +__bsd_signal (sig, handler) int sig; __sighandler_t handler; { @@ -39,12 +42,12 @@ signal (sig, handler) act.sa_handler = handler; if (__sigemptyset (&act.sa_mask) < 0) return SIG_ERR; - act.sa_flags = SA_ONESHOT | SA_NOMASK | SA_INTERRUPT; - act.sa_flags &= ~SA_RESTART; + act.sa_flags = __sigismember (&_sigintr, sig) ? 0 : SA_RESTART; if (__sigaction (sig, &act, &oact) < 0) return SIG_ERR; return oact.sa_handler; } - -weak_alias (signal, ssignal) +weak_alias (__bsd_signal, bsd_signal) +weak_alias (__bsd_signal, signal) +weak_alias (__bsd_signal, ssignal) diff --git a/sysdeps/posix/sigpause.c b/sysdeps/posix/sigpause.c index 8b820ecad9..414019a40d 100644 --- a/sysdeps/posix/sigpause.c +++ b/sysdeps/posix/sigpause.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 92, 94, 95, 96 Free Software Foundation, Inc. +/* Copyright (C) 1991, 92, 94, 95, 96, 97 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,7 @@ __sigpause (sig_or_mask, is_sig) { /* The modern X/Open implementation is requested. */ if (sigprocmask (0, NULL, &set) < 0 - /* Yes, we call `sigaddset' and not `__sigaddset'. */ + /* Yes, we call `sigdelset' and not `__sigdelset'. */ || sigdelset (&set, sig_or_mask) < 0) return -1; } @@ -66,4 +66,5 @@ __default_sigpause (mask) { return __sigpause (mask, 0); } +#undef sigpause weak_alias (__default_sigpause, sigpause) diff --git a/sysdeps/posix/bsd_signal.c b/sysdeps/posix/sysv_signal.c index 4941485c0d..2b6d5f9d56 100644 --- a/sysdeps/posix/bsd_signal.c +++ b/sysdeps/posix/sysv_signal.c @@ -1,5 +1,4 @@ -/* X/Open compatibility function. - Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992, 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 @@ -20,13 +19,21 @@ #include <errno.h> #include <signal.h> - -sigset_t _sigintr; /* Set by siginterrupt. */ +/* Tolerate non-threads versions of Posix */ +#ifndef SA_ONESHOT +#define SA_ONESHOT 0 +#endif +#ifndef SA_NOMASK +#define SA_NOMASK 0 +#endif +#ifndef SA_INTERRUPT +#define SA_INTERRUPT 0 +#endif /* Set the handler for the signal SIG to HANDLER, returning the old handler, or SIG_ERR on error. */ __sighandler_t -bsd_signal (sig, handler) +__sysv_signal (sig, handler) int sig; __sighandler_t handler; { @@ -42,7 +49,8 @@ bsd_signal (sig, handler) act.sa_handler = handler; if (__sigemptyset (&act.sa_mask) < 0) return SIG_ERR; - act.sa_flags = __sigismember (&_sigintr, sig) ? 0 : SA_RESTART; + act.sa_flags = SA_ONESHOT | SA_NOMASK | SA_INTERRUPT; + act.sa_flags &= ~SA_RESTART; if (__sigaction (sig, &act, &oact) < 0) return SIG_ERR; diff --git a/sysdeps/stub/libc-lock.h b/sysdeps/stub/libc-lock.h index 63ea622cc4..724b6e59d4 100644 --- a/sysdeps/stub/libc-lock.h +++ b/sysdeps/stub/libc-lock.h @@ -1,5 +1,5 @@ /* libc-internal interface for mutex locks. Stub version. - Copyright (C) 1996 Free Software Foundation, Inc. + Copyright (C) 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 @@ -33,6 +33,10 @@ /* Define an initialized lock variable NAME with storage class CLASS. */ #define __libc_lock_define_initialized(CLASS,NAME) +/* Define an initialized recursive lock variable NAME with storage + class CLASS. */ +#define __libc_lock_define_initialized_recursive(CLASS,NAME) + /* Initialize the named lock variable, leaving it in a consistent, unlocked state. */ #define __libc_lock_init(NAME) @@ -45,15 +49,27 @@ called on a lock variable before the containing storage is reused. */ #define __libc_lock_fini(NAME) +/* Finalize recursive named lock. */ +#define __libc_lock_fini_recursive(NAME) + /* Lock the named lock variable. */ #define __libc_lock_lock(NAME) -/* Try tp lock the named lock variable. */ +/* Lock the recursive named lock variable. */ +#define __libc_lock_lock_recursive(NAME) + +/* Try to lock the named lock variable. */ #define __libc_lock_trylock(NAME) 0 +/* Try to lock the recursive named lock variable. */ +#define __libc_lock_trylock_recursive(NAME) 0 + /* Unlock the named lock variable. */ #define __libc_lock_unlock(NAME) +/* Unlock the recursive named lock variable. */ +#define __libc_lock_unlock_recursive(NAME) + /* Start critical region with cleanup. */ #define __libc_cleanup_region_start(FCT, ARG) diff --git a/sysdeps/stub/sigpause.c b/sysdeps/stub/sigpause.c index 5e68899ed8..3525e3536f 100644 --- a/sysdeps/stub/sigpause.c +++ b/sysdeps/stub/sigpause.c @@ -28,3 +28,15 @@ __sigpause (sig_or_mask, is_sig) return -1; } stub_warning (__sigpause) + + +int __default_sigpause __P ((int mask)); +int +__default_sigpause (mask) + int mask; +{ + __set_errno (ENOSYS); + return -1; +} +weak_alias (__default_sigpause, sigpause) +stub_warning (sigpause) diff --git a/sysdeps/stub/syscall.h b/sysdeps/stub/sys/syscall.h index 719bd08904..719bd08904 100644 --- a/sysdeps/stub/syscall.h +++ b/sysdeps/stub/sys/syscall.h diff --git a/sysdeps/unix/Makefile b/sysdeps/unix/Makefile index a7bfa39c27..15993b34ac 100644 --- a/sysdeps/unix/Makefile +++ b/sysdeps/unix/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc. +# Copyright (C) 1991, 92, 93, 94, 95, 96, 97 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 @@ -12,9 +12,9 @@ # 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. +# 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. # The unix-specific configure fragment writes `unix-generated' in config.make. config-generated := $(config-generated) $(unix-generated) @@ -227,9 +227,9 @@ endif endif # stdio-common ifeq (,$(filter-out $(sysdep_dir)/stub/ $(common-objpfx),\ - $(dir $(firstword $(wildcard $(+sysdep_dirs:%=%/syscall.h)))))) + $(dir $(firstword $(wildcard $(+sysdep_dirs:%=%/sys/syscall.h)))))) -# The syscall code assumes a file <syscall.h> that defines macros +# The syscall code assumes a file <sys/syscall.h> that defines macros # `SYS_call' for syscall `call'. Variations on this I have seen include: # it's in <sys/syscall.h>; # it's in <sys.s>; @@ -246,7 +246,8 @@ syscall.h := $(firstword $(wildcard $(addprefix $(sysincludedir)/, \ ifdef syscall.h # Transmogrify any of several formats of the file into the one we want. -$(common-objpfx)syscall.h: $(syscall.h) +$(common-objpfx)sys/syscall.h: $(syscall.h) + -mkdir $(common-objpfx)sys tr '[A-Z]' '[a-z]' < $< | \ sed -e 's/[ ]sys_/ /' \ -e 's/^#define[ ]*\([a-z0-9_]*\)[ ]*/#define SYS_\1 /' \ diff --git a/sysdeps/unix/bsd/poll.c b/sysdeps/unix/bsd/poll.c index 4cccfe3b35..972cd011f1 100644 --- a/sysdeps/unix/bsd/poll.c +++ b/sysdeps/unix/bsd/poll.c @@ -1,20 +1,20 @@ -/* Copyright (C) 1994, 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. +/* Copyright (C) 1994, 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 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. + 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. */ + 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 <sys/poll.h> #include <sys/types.h> diff --git a/sysdeps/unix/bsd/sun/sunos4/tcsetattr.c b/sysdeps/unix/bsd/sun/sunos4/tcsetattr.c index f825d41ab8..da30f7b4c2 100644 --- a/sysdeps/unix/bsd/sun/sunos4/tcsetattr.c +++ b/sysdeps/unix/bsd/sun/sunos4/tcsetattr.c @@ -1,23 +1,22 @@ -/* Copyright (C) 1993, 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. +/* Copyright (C) 1993, 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 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. + 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. */ + 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 <errno.h> -#include <stddef.h> #include <termios.h> #include <sys/ioctl.h> diff --git a/sysdeps/unix/bsd/tcdrain.c b/sysdeps/unix/bsd/tcdrain.c index 84bc06813d..1620eeda89 100644 --- a/sysdeps/unix/bsd/tcdrain.c +++ b/sysdeps/unix/bsd/tcdrain.c @@ -1,20 +1,20 @@ -/* Copyright (C) 1991, 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. +/* Copyright (C) 1991, 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 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. + 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. */ + 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 <errno.h> #include <stddef.h> diff --git a/sysdeps/unix/bsd/tcflow.c b/sysdeps/unix/bsd/tcflow.c index 04895a0648..e21efcabb8 100644 --- a/sysdeps/unix/bsd/tcflow.c +++ b/sysdeps/unix/bsd/tcflow.c @@ -1,20 +1,20 @@ -/* Copyright (C) 1991, 1992, 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. */ +/* Copyright (C) 1991, 1992, 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 <errno.h> #include <stddef.h> diff --git a/sysdeps/unix/bsd/tcflush.c b/sysdeps/unix/bsd/tcflush.c index 9806aaf435..3a88191d0c 100644 --- a/sysdeps/unix/bsd/tcflush.c +++ b/sysdeps/unix/bsd/tcflush.c @@ -1,20 +1,20 @@ -/* Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. +/* Copyright (C) 1991, 1992, 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 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. + 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. */ + 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 <errno.h> #include <stddef.h> diff --git a/sysdeps/unix/bsd/tcgetpgrp.c b/sysdeps/unix/bsd/tcgetpgrp.c index b41f005375..afa24fbd31 100644 --- a/sysdeps/unix/bsd/tcgetpgrp.c +++ b/sysdeps/unix/bsd/tcgetpgrp.c @@ -1,22 +1,21 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. -This file is part of the GNU C Library. +/* Copyright (C) 1991, 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 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. + 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. */ + 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 <ansidecl.h> #include <sys/ioctl.h> #include <errno.h> #include <unistd.h> @@ -24,10 +23,12 @@ Cambridge, MA 02139, USA. */ /* Return the foreground process group ID of FD. */ pid_t -DEFUN(tcgetpgrp, (fd), int fd) +tcgetpgrp (fd) + int fd; { int pgrp; - if (__ioctl(fd, TIOCGPGRP, &pgrp) < 0) + + if (__ioctl (fd, TIOCGPGRP, &pgrp) < 0) return (pid_t) -1; return (pid_t) pgrp; } diff --git a/sysdeps/unix/bsd/tcsendbrk.c b/sysdeps/unix/bsd/tcsendbrk.c index 574f442b7b..8e63163af1 100644 --- a/sysdeps/unix/bsd/tcsendbrk.c +++ b/sysdeps/unix/bsd/tcsendbrk.c @@ -1,22 +1,21 @@ -/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. -This file is part of the GNU C Library. +/* Copyright (C) 1991, 1992, 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 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. + 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. */ + 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 <ansidecl.h> #include <errno.h> #include <stddef.h> #include <signal.h> @@ -29,7 +28,9 @@ Cambridge, MA 02139, USA. */ /* Send zero bits on FD. */ int -DEFUN(tcsendbreak, (fd, duration), int fd AND int duration) +tcsendbreak (fd, duration) + int fd; + int duration; { struct timeval delay; diff --git a/sysdeps/unix/bsd/tcsetpgrp.c b/sysdeps/unix/bsd/tcsetpgrp.c index e5da8b3f8c..cfb695a4f1 100644 --- a/sysdeps/unix/bsd/tcsetpgrp.c +++ b/sysdeps/unix/bsd/tcsetpgrp.c @@ -1,22 +1,21 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. -This file is part of the GNU C Library. +/* Copyright (C) 1991, 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 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. + 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. */ + 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 <ansidecl.h> #include <sys/types.h> #include <sys/ioctl.h> #include <errno.h> @@ -24,7 +23,9 @@ Cambridge, MA 02139, USA. */ /* Set the foreground process group ID of FD set PGRP_ID. */ int -DEFUN(tcsetpgrp, (fd, pgrp_id), int fd AND pid_t pgrp_id) +tcsetpgrp (fd, pgrp_id) + int fd; + pid_t pgrp_id; { - return __ioctl(fd, TIOCSPGRP, &pgrp_id); + return __ioctl (fd, TIOCSPGRP, &pgrp_id); } diff --git a/sysdeps/unix/getdents.c b/sysdeps/unix/getdents.c index 6dec0dc5b5..e356e96d71 100644 --- a/sysdeps/unix/getdents.c +++ b/sysdeps/unix/getdents.c @@ -1,20 +1,20 @@ -/* Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. +/* Copyright (C) 1993, 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 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. + 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. */ + 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 <stddef.h> #include <sys/types.h> diff --git a/sysdeps/unix/siglist.c b/sysdeps/unix/siglist.c index c904e7f38d..4e69530715 100644 --- a/sysdeps/unix/siglist.c +++ b/sysdeps/unix/siglist.c @@ -1,4 +1,21 @@ -#include <ansidecl.h> +/* Copyright (C) 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 <stddef.h> #ifndef HAVE_GNU_LD @@ -7,40 +24,39 @@ /* This is a list of all known signal numbers. */ -CONST char *CONST _sys_siglist[] = +const char *const _sys_siglist[] = { - "Signal 0", - "Hangup", - "Interrupt", - "Quit", - "Illegal instruction", - "Trace/BPT trap", - "IOT trap", - "EMT trap", - "Floating point exception", - "Killed", - "Bus error", - "Segmentation fault", - "Bad system call", - "Broken pipe", - "Alarm clock", - "Terminated", - "Urgent I/O condition", - "Stopped (signal)", - "Stopped", - "Continued", - "Child exited", - "Stopped (tty input)", - "Stopped (tty output)", - "I/O possible", - "Cputime limit exceeded", - "Filesize limit exceeded", - "Virtual timer expired", - "Profiling timer expired", - "Window changed", - "Resource lost", - "User defined signal 1", - "User defined signal 2", + N_("Signal 0"), + N_("Hangup"), + N_("Interrupt"), + N_("Quit"), + N_("Illegal instruction"), + N_("Trace/BPT trap"), + N_("IOT trap"), + N_("EMT trap"), + N_("Floating point exception"), + N_("Killed"), + N_("Bus error"), + N_("Segmentation fault"), + N_("Bad system call"), + N_("Broken pipe"), + N_("Alarm clock"), + N_("Terminated"), + N_("Urgent I/O condition"), + N_("Stopped (signal)"), + N_("Stopped"), + N_("Continued"), + N_("Child exited"), + N_("Stopped (tty input)"), + N_("Stopped (tty output)"), + N_("I/O possible"), + N_("Cputime limit exceeded"), + N_("Filesize limit exceeded"), + N_("Virtual timer expired"), + N_("Profiling timer expired"), + N_("Window changed"), + N_("Resource lost"), + N_("User defined signal 1"), + N_("User defined signal 2"), NULL }; - diff --git a/sysdeps/unix/sysdep.h b/sysdeps/unix/sysdep.h index f18b2656b1..dc8c0b34d2 100644 --- a/sysdeps/unix/sysdep.h +++ b/sysdeps/unix/sysdep.h @@ -18,7 +18,7 @@ #include <sysdeps/generic/sysdep.h> -#include <syscall.h> +#include <sys/syscall.h> #define HAVE_SYSCALLS /* Note that using a `PASTE' macro loses. */ diff --git a/sysdeps/unix/sysv/getdents.c b/sysdeps/unix/sysv/getdents.c index bb6c812647..109f29a2b1 100644 --- a/sysdeps/unix/sysv/getdents.c +++ b/sysdeps/unix/sysv/getdents.c @@ -1,22 +1,21 @@ -/* Copyright (C) 1993, 1995 Free Software Foundation, Inc. -This file is part of the GNU C Library. +/* Copyright (C) 1993, 1995, 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 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. + 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. */ + 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 <ansidecl.h> #include <stddef.h> #include <errno.h> #include <sys/types.h> @@ -25,8 +24,11 @@ Cambridge, MA 02139, USA. */ extern int __getdents __P ((int fd, char *buf, size_t nbytes)); int -DEFUN(__getdirentries, (fd, buf, nbytes, basep), - int fd AND char *buf AND size_t nbytes AND off_t *basep) +__getdirentries (fd, buf, nbytes, basep) + int fd; + char *buf; + size_t nbytes; + off_t *basep; { if (basep) *basep = __lseek (fd, (off_t) 0, SEEK_CUR); diff --git a/sysdeps/unix/sysv/i386/sigreturn.S b/sysdeps/unix/sysv/i386/sigreturn.S index be1c6b89bf..8477bbd075 100644 --- a/sysdeps/unix/sysv/i386/sigreturn.S +++ b/sysdeps/unix/sysv/i386/sigreturn.S @@ -1,20 +1,20 @@ -/* Copyright (C) 1994, 1995 Free Software Foundation, Inc. -This file is part of the GNU C Library. +/* Copyright (C) 1994, 1995, 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 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. + 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. */ + 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 <sysdep.h> diff --git a/sysdeps/unix/sysv/linux/Dist b/sysdeps/unix/sysv/linux/Dist index 425fb589f7..766d96a110 100644 --- a/sysdeps/unix/sysv/linux/Dist +++ b/sysdeps/unix/sysv/linux/Dist @@ -1,4 +1,5 @@ init-first.h +kernel_termios.h llseek.c siglist.h sysctl.c diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index c03d966a61..97fb5f14a5 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -13,7 +13,7 @@ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h sys/mtio.h \ sys/debugreg.h sys/kd.h sys/soundcard.h sys/vt.h # Generate the list of SYS_* macros for the system calls (__NR_* macros). -$(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/syscall.h +$(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/sys/syscall.h rm -f $(@:.h=.d) echo > $(@:.d=.h).new \ '/* Generated at libc build time from kernel syscall list. */' diff --git a/sysdeps/unix/sysv/linux/alpha/Dist b/sysdeps/unix/sysv/linux/alpha/Dist index d898d041a2..a15f181ff6 100644 --- a/sysdeps/unix/sysv/linux/alpha/Dist +++ b/sysdeps/unix/sysv/linux/alpha/Dist @@ -4,3 +4,5 @@ ioperm.c init-first.h clone.S sys/io.h +kernel_termios.h +sys/acct.h diff --git a/sysdeps/unix/sysv/linux/alpha/gnu/types.h b/sysdeps/unix/sysv/linux/alpha/gnu/types.h new file mode 100644 index 0000000000..5c1e407423 --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/gnu/types.h @@ -0,0 +1,89 @@ +/* Copyright (C) 1991, 92, 94, 95, 96, 97 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 _GNU_TYPES_H +#define _GNU_TYPES_H 1 + +#include <features.h> + +/* Convenience types. */ +typedef unsigned char __u_char; +typedef unsigned short __u_short; +typedef unsigned int __u_int; +typedef unsigned long __u_long; +#ifdef __GNUC__ +typedef unsigned long long int __u_quad_t; +typedef long long int __quad_t; +#else +typedef struct + { + long int __val[2]; + } __quad_t; +typedef struct + { + __u_long __val[2]; + } __u_quad_t; +#endif +typedef __quad_t *__qaddr_t; + +typedef __u_long __dev_t; /* Type of device numbers. */ +typedef __u_int __uid_t; /* Type of user identifications. */ +typedef __u_int __gid_t; /* Type of group identifications. */ +typedef __u_int __ino_t; /* Type of file serial numbers. */ +typedef __u_int __mode_t; /* Type of file attribute bitmasks. */ +typedef __u_int __nlink_t; /* Type of file link counts. */ +typedef long int __off_t; /* Type of file sizes and offsets. */ +typedef __quad_t __loff_t; /* Type of file sizes and offsets. */ +typedef int __pid_t; /* Type of process identifications. */ +typedef long int __ssize_t; /* Type of a byte count, or error. */ + +typedef struct + { + int __val[2]; + } __fsid_t; /* Type of file system IDs. */ + +/* Everythin' else. */ +typedef int __daddr_t; /* The type of a disk address. */ +typedef char *__caddr_t; +typedef long int __time_t; +typedef long int __swblk_t; /* Type of a swap block maybe? */ + +typedef long int __clock_t; + +/* One element in the file descriptor mask array. */ +typedef unsigned int __fd_mask; + +/* Number of descriptors that can fit in an `fd_set'. */ +#define __FD_SETSIZE 1024 + +/* It's easier to assume 8-bit bytes than to get CHAR_BIT. */ +#define __NFDBITS (8 * sizeof (__fd_mask)) +#define __FDELT(d) ((d) / __NFDBITS) +#define __FDMASK(d) (1 << ((d) % __NFDBITS)) + +/* fd_set for select and pselect. */ +typedef struct + { + /* XPG4.2 requires this member name. */ + __fd_mask fds_bits[__FD_SETSIZE / __NFDBITS]; + } __fd_set; + + +typedef int __key_t; + +#endif /* gnu/types.h */ diff --git a/sysdeps/unix/sysv/linux/alpha/ioctl-types.h b/sysdeps/unix/sysv/linux/alpha/ioctl-types.h new file mode 100644 index 0000000000..c51310f4cd --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/ioctl-types.h @@ -0,0 +1,123 @@ +/* Structure types for pre-termios terminal ioctls. Linux version. + Copyright (C) 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. */ + +#ifndef _IOCTL_TYPES_H +#define _IOCTL_TYPES_H 1 + +/* Get definition of constants for use with `ioctl'. */ +#include <asm/ioctl.h> + + +#define FIOCLEX _IO('f', 1) +#define FIONCLEX _IO('f', 2) +#define FIOASYNC _IOW('f', 125, int) +#define FIONBIO _IOW('f', 126, int) +#define FIONREAD _IOR('f', 127, int) +#define TIOCINQ FIONREAD + +#define TIOCGETP _IOR('t', 8, struct sgttyb) +#define TIOCSETP _IOW('t', 9, struct sgttyb) +#define TIOCSETN _IOW('t', 10, struct sgttyb) /* TIOCSETP wo flush */ + +#define TIOCSETC _IOW('t', 17, struct tchars) +#define TIOCGETC _IOR('t', 18, struct tchars) +#define TCGETS _IOR('t', 19, struct termios) +#define TCSETS _IOW('t', 20, struct termios) +#define TCSETSW _IOW('t', 21, struct termios) +#define TCSETSF _IOW('t', 22, struct termios) + +#define TCGETA _IOR('t', 23, struct termio) +#define TCSETA _IOW('t', 24, struct termio) +#define TCSETAW _IOW('t', 25, struct termio) +#define TCSETAF _IOW('t', 28, struct termio) + +#define TCSBRK _IO('t', 29) +#define TCXONC _IO('t', 30) +#define TCFLSH _IO('t', 31) + +#define TIOCSWINSZ _IOW('t', 103, struct winsize) +#define TIOCGWINSZ _IOR('t', 104, struct winsize) +#define TIOCSTART _IO('t', 110) /* start output, like ^Q */ +#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */ +#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */ + +#define TIOCGLTC _IOR('t', 116, struct ltchars) +#define TIOCSLTC _IOW('t', 117, struct ltchars) +#define TIOCSPGRP _IOW('t', 118, int) +#define TIOCGPGRP _IOR('t', 119, int) + +#define TIOCEXCL 0x540C +#define TIOCNXCL 0x540D +#define TIOCSCTTY 0x540E + +#define TIOCSTI 0x5412 +#define TIOCMGET 0x5415 +#define TIOCMBIS 0x5416 +#define TIOCMBIC 0x5417 +#define TIOCMSET 0x5418 +# define TIOCM_LE 0x001 +# define TIOCM_DTR 0x002 +# define TIOCM_RTS 0x004 +# define TIOCM_ST 0x008 +# define TIOCM_SR 0x010 +# define TIOCM_CTS 0x020 +# define TIOCM_CAR 0x040 +# define TIOCM_RNG 0x080 +# define TIOCM_DSR 0x100 +# define TIOCM_CD TIOCM_CAR +# define TIOCM_RI TIOCM_RNG + +#define TIOCGSOFTCAR 0x5419 +#define TIOCSSOFTCAR 0x541A +#define TIOCLINUX 0x541C +#define TIOCCONS 0x541D +#define TIOCGSERIAL 0x541E +#define TIOCSSERIAL 0x541F +#define TIOCPKT 0x5420 +# define TIOCPKT_DATA 0 +# define TIOCPKT_FLUSHREAD 1 +# define TIOCPKT_FLUSHWRITE 2 +# define TIOCPKT_STOP 4 +# define TIOCPKT_START 8 +# define TIOCPKT_NOSTOP 16 +# define TIOCPKT_DOSTOP 32 + + +#define TIOCNOTTY 0x5422 +#define TIOCSETD 0x5423 +#define TIOCGETD 0x5424 +#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ +#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */ + +#define TIOCSERCONFIG 0x5453 +#define TIOCSERGWILD 0x5454 +#define TIOCSERSWILD 0x5455 +#define TIOCGLCKTRMIOS 0x5456 +#define TIOCSLCKTRMIOS 0x5457 +#define TIOCSERGSTRUCT 0x5458 /* For debugging only */ +#define TIOCSERGETLSR 0x5459 /* Get line status register */ + /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ +# define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ +#define TIOCSERGETMULTI 0x545A /* Get multiport config */ +#define TIOCSERSETMULTI 0x545B /* Set multiport config */ + +#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */ +#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ + +#endif /* ioctl-types.h */ diff --git a/sysdeps/unix/sysv/linux/alpha/kernel_termios.h b/sysdeps/unix/sysv/linux/alpha/kernel_termios.h new file mode 100644 index 0000000000..cb030e4de4 --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/kernel_termios.h @@ -0,0 +1,18 @@ +/* The following corresponds to the values from the Linux 2.1.20 kernel. */ + +#define KERNEL_NCCS 19 + +struct kernel_termios + { + tcflag_t c_iflag; /* input mode flags */ + tcflag_t c_oflag; /* output mode flags */ + tcflag_t c_cflag; /* control mode flags */ + tcflag_t c_lflag; /* local mode flags */ + cc_t c_cc[KERNEL_NCCS]; /* control characters */ + cc_t c_line; /* line discipline */ + speed_t c_ispeed; /* input speed */ + speed_t c_ospeed; /* output speed */ + }; + +#define _HAVE_C_ISPEED 1 +#define _HAVE_C_OSPEED 1 diff --git a/sysdeps/unix/sysv/linux/alpha/sys/acct.h b/sysdeps/unix/sysv/linux/alpha/sys/acct.h new file mode 100644 index 0000000000..6dda5f4922 --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/sys/acct.h @@ -0,0 +1,66 @@ +/* Copyright (C) 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. */ + +#ifndef _SYS_ACCT_H + +#define _SYS_ACCT_H 1 +#include <features.h> + +#define __need_time_t +#include <time.h> + + +__BEGIN_DECLS + +#define ACCT_COMM 16 + +struct acct + { + char ac_comm[ACCT_COMM]; /* Accounting command name. */ + time_t ac_utime; /* Accounting user time. */ + time_t ac_stime; /* Accounting system time. */ + time_t ac_etime; /* Accounting elapsed time. */ + time_t ac_btime; /* Beginning time. */ + unsigned int ac_uid; /* Accounting user ID. */ + unsigned int ac_gid; /* Accounting group ID. */ + unsigned int ac_tty; /* Controlling tty. */ + /* Please note that the value of the `ac_tty' field, a device number, + is encoded differently in the kernel and for the libc dev_t type. */ + char ac_flag; /* Accounting flag. */ + long int ac_minflt; /* Accounting minor pagefaults. */ + long int ac_majflt; /* Accounting major pagefaults. */ + long int ac_exitcode; /* Accounting process exitcode. */ + }; + +enum + { + AFORK = 0001, /* Has executed fork, but no exec. */ + ASU = 0002, /* Used super-user privileges. */ + ACORE = 0004, /* Dumped core. */ + AXSIG = 0010 /* Killed by a signal. */ + }; + +#define AHZ 100 + + +/* Switch process accounting on and off. */ +extern int acct __P ((__const char *__filename)); + +__END_DECLS + +#endif /* sys/acct.h */ diff --git a/sysdeps/unix/sysv/linux/alpha/termbits.h b/sysdeps/unix/sysv/linux/alpha/termbits.h new file mode 100644 index 0000000000..6cb729f7f8 --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/termbits.h @@ -0,0 +1,188 @@ +/* termios type and macro definitions. Linux version. + Copyright (C) 1993, 1994, 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. */ + +typedef unsigned char cc_t; +typedef unsigned int speed_t; +typedef unsigned int tcflag_t; + +#define NCCS 32 +struct termios + { + tcflag_t c_iflag; /* input mode flags */ + tcflag_t c_oflag; /* output mode flags */ + tcflag_t c_cflag; /* control mode flags */ + tcflag_t c_lflag; /* local mode flags */ + cc_t c_cc[NCCS]; /* control characters */ + cc_t c_line; /* line discipline (== c_cc[19]) */ + speed_t c_ispeed; /* input speed */ + speed_t c_ospeed; /* output speed */ + }; + +/* c_cc characters */ +#define VEOF 0 +#define VEOL 1 +#define VEOL2 2 +#define VERASE 3 +#define VWERASE 4 +#define VKILL 5 +#define VREPRINT 6 +#define VSWTC 7 +#define VINTR 8 +#define VQUIT 9 +#define VSUSP 10 +#define VSTART 12 +#define VSTOP 13 +#define VLNEXT 14 +#define VDISCARD 15 +#define VMIN 16 +#define VTIME 17 + +/* c_iflag bits */ +#define IGNBRK 0000001 +#define BRKINT 0000002 +#define IGNPAR 0000004 +#define PARMRK 0000010 +#define INPCK 0000020 +#define ISTRIP 0000040 +#define INLCR 0000100 +#define IGNCR 0000200 +#define ICRNL 0000400 +#define IXON 0001000 +#define IXOFF 0002000 +#ifdef __USE_BSD + /* POSIX.1 doesn't want these... */ +# define IXANY 0004000 +# define IUCLC 0010000 +# define IMAXBEL 0020000 +#endif + +/* c_oflag bits */ +#define OPOST 0000001 +#define ONLCR 0000002 +#define OLCUC 0000004 + +#define OCRNL 0000010 +#define ONOCR 0000020 +#define ONLRET 0000040 + +#define OFILL 00000100 +#define OFDEL 00000200 +#define NLDLY 00001400 +#define NL0 00000000 +#define NL1 00000400 +#define NL2 00001000 +#define NL3 00001400 +#define TABDLY 00006000 +#define TAB0 00000000 +#define TAB1 00002000 +#define TAB2 00004000 +#define TAB3 00006000 +#define CRDLY 00030000 +#define CR0 00000000 +#define CR1 00010000 +#define CR2 00020000 +#define CR3 00030000 +#define FFDLY 00040000 +#define FF0 00000000 +#define FF1 00040000 +#define BSDLY 00100000 +#define BS0 00000000 +#define BS1 00100000 +#define VTDLY 00200000 +#define VT0 00000000 +#define VT1 00200000 +#define XTABS 01000000 /* Hmm.. Linux/i386 considers this part of TABDLY.. */ + +/* c_cflag bit meaning */ +#define CBAUD 0000037 +#define B0 0000000 /* hang up */ +#define B50 0000001 +#define B75 0000002 +#define B110 0000003 +#define B134 0000004 +#define B150 0000005 +#define B200 0000006 +#define B300 0000007 +#define B600 0000010 +#define B1200 0000011 +#define B1800 0000012 +#define B2400 0000013 +#define B4800 0000014 +#define B9600 0000015 +#define B19200 0000016 +#define B38400 0000017 +#define EXTA B19200 +#define EXTB B38400 +#define CBAUDEX 0000000 +#define B57600 00020 +#define B115200 00021 +#define B230400 00022 +#define B460800 00023 + +#define CSIZE 00001400 +#define CS5 00000000 +#define CS6 00000400 +#define CS7 00001000 +#define CS8 00001400 + +#define CSTOPB 00002000 +#define CREAD 00004000 +#define PARENB 00010000 +#define PARODD 00020000 +#define HUPCL 00040000 + +#define CLOCAL 00100000 +#define CRTSCTS 020000000000 /* flow control */ + +/* c_lflag bits */ +#define ISIG 0x00000080 +#define ICANON 0x00000100 +#define XCASE 0x00004000 +#define ECHO 0x00000008 +#define ECHOE 0x00000002 +#define ECHOK 0x00000004 +#define ECHONL 0x00000010 +#define NOFLSH 0x80000000 +#define TOSTOP 0x00400000 +#define ECHOCTL 0x00000040 +#define ECHOPRT 0x00000020 +#define ECHOKE 0x00000001 +#define FLUSHO 0x00800000 +#define PENDIN 0x20000000 +#define IEXTEN 0x00000400 + +/* Values for the ACTION argument to `tcflow'. */ +#define TCOOFF 0 +#define TCOON 1 +#define TCIOFF 2 +#define TCION 3 + +/* Values for the QUEUE_SELECTOR argument to `tcflush'. */ +#define TCIFLUSH 0 +#define TCOFLUSH 1 +#define TCIOFLUSH 2 + +/* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'. */ +#define TCSANOW 0 +#define TCSADRAIN 1 +#define TCSAFLUSH 2 + + +#define _IOT_termios /* Hurd ioctl type field. */ \ + _IOT (_IOTS (cflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2) diff --git a/sysdeps/unix/sysv/linux/alpha/ustat.c b/sysdeps/unix/sysv/linux/alpha/ustat.c new file mode 100644 index 0000000000..c09b4fd84e --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/ustat.c @@ -0,0 +1,32 @@ +/* Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 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 <sys/ustat.h> +#include <sys/sysmacros.h> + +int +ustat (dev_t dev, struct ustat *ubuf) +{ + unsigned int k_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_ustat (k_dev, ubuf); +} diff --git a/sysdeps/unix/sysv/linux/alpha/xmknod.c b/sysdeps/unix/sysv/linux/alpha/xmknod.c new file mode 100644 index 0000000000..f4cdd7135a --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/xmknod.c @@ -0,0 +1,46 @@ +/* xmknod call using old-style Unix mknod system call. + Copyright (C) 1991, 1993, 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 <errno.h> +#include <sys/types.h> +#include <sys/stat.h> + +extern int __syscall_mknod (const char *, unsigned int, unsigned int); + +/* 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) +{ + unsigned int k_dev; + + if (vers != _MKNOD_VER) + { + __set_errno (EINVAL); + return -1; + } + + /* 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); +} + +weak_alias (__xmknod, _xmknod) diff --git a/sysdeps/unix/sysv/linux/direntry.h b/sysdeps/unix/sysv/linux/direntry.h index 486ad0a0f2..ccf5080151 100644 --- a/sysdeps/unix/sysv/linux/direntry.h +++ b/sysdeps/unix/sysv/linux/direntry.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996 Free Software Foundation, Inc. +/* Copyright (C) 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 @@ -19,14 +19,19 @@ #ifndef _DIRENTRY_H #define _DIRENTRY_H 1 -/* Get `struct dirent' from the Linux kernel header file. */ -#include <asm/posix_types.h> -#include <linux/dirent.h> - -#define d_fileno d_ino /* backwards compatibility */ +struct dirent + { + long int d_ino; + __off_t d_off; + unsigned short int d_reclen; + unsigned char d_type; + char d_name[256]; /* We must not include limits.h! */ + }; +#define d_fileno d_ino /* Backwards compatibility. */ #undef _DIRENT_HAVE_D_NAMLEN #define _DIRENT_HAVE_D_RECLEN #define _DIRENT_HAVE_D_OFF +#define _DIRENT_HAVE_D_TYPE #endif /* _DIRENTRY_H */ diff --git a/sysdeps/unix/sysv/linux/getdents.c b/sysdeps/unix/sysv/linux/getdents.c new file mode 100644 index 0000000000..0504393e67 --- /dev/null +++ b/sysdeps/unix/sysv/linux/getdents.c @@ -0,0 +1,105 @@ +/* Copyright (C) 1993, 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 <dirent.h> +#include <stddef.h> +#include <string.h> +#include <unistd.h> +#include <sys/types.h> + +#include <linux/posix_types.h> + +#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) + + +extern int __getdents __P ((int fd, char *buf, size_t nbytes)); + +/* For Linux we need a special version of this file since the + definition of `struct dirent' is not the same for the kernel and + the libc. There is one additional field which might be introduced + in the kernel structure in the future. + + He is the kernel definition of `struct dirent' as of 2.1.20: */ + +struct kernel_dirent + { + long int d_ino; + __kernel_off_t d_off; + unsigned short int d_reclen; + char d_name[256]; + }; + + +/* The problem here is that we cannot simply read the next NBYTES + bytes. We need to take the additional field into account. We use + some heuristic. Assume the directory contains names with at least + 3 characters we can compute a maximum number of entries which fit + in the buffer. Taking this number allows us to specify a correct + number of bytes to read. If we should be wrong, we can reset the + file descriptor. */ +int __getdirentries __P ((int fd, char *buf, size_t nbytes, off_t *basep)); +int +__getdirentries (fd, buf, nbytes, basep) + int fd; + char *buf; + size_t nbytes; + off_t *basep; +{ + off_t base = __lseek (fd, (off_t) 0, SEEK_CUR); + size_t red_nbytes; + struct kernel_dirent *kdp; + struct dirent *dp; + int retval; + + red_nbytes = nbytes - (nbytes / (offsetof (struct dirent, d_name) + 3)); + + dp = (struct dirent *) buf; + kdp = (struct kernel_dirent *) (buf + (nbytes - red_nbytes)); + + retval = __getdents (fd, (char *) kdp, red_nbytes); + + while ((char *) kdp < buf + (nbytes - red_nbytes) + retval) + { + dp->d_ino = kdp->d_ino; + dp->d_off = kdp->d_off; + dp->d_reclen = (kdp->d_reclen + + (offsetof (struct dirent, d_name) + - offsetof (struct kernel_dirent, d_name))); + dp->d_type = DT_UNKNOWN; + memmove (dp->d_name, kdp->d_name, + kdp->d_reclen - offsetof (struct kernel_dirent, d_name)); + + dp = (struct dirent *) (((char *) dp) + dp->d_reclen); + kdp = (struct kernel_dirent *) (((char *) kdp) + kdp->d_reclen); + + if ((char *) dp >= (char *) kdp) + { + /* Our heuristic failed. We read too many entries. Reset + the stream. */ + off_t used = ((char *) kdp - (char *) buf) - (nbytes - red_nbytes); + base = __lseek (fd, retval - used, SEEK_CUR); + } + } + + if (basep) + *basep = base; + + return (char *) dp - (char *) buf; +} + +weak_alias (__getdirentries, getdirentries) diff --git a/sysdeps/unix/sysv/linux/gnu/types.h b/sysdeps/unix/sysv/linux/gnu/types.h index 3212a85d96..872fc4e557 100644 --- a/sysdeps/unix/sysv/linux/gnu/types.h +++ b/sysdeps/unix/sysv/linux/gnu/types.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 92, 94, 95, 96 Free Software Foundation, Inc. +/* Copyright (C) 1991, 92, 94, 95, 96, 97 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 @@ -21,9 +21,6 @@ #include <features.h> -/* Get actual type definitions for architecture from kernel headers. */ -#include <linux/types.h> - /* Convenience types. */ typedef unsigned char __u_char; typedef unsigned short __u_short; @@ -32,46 +29,61 @@ typedef unsigned long __u_long; #ifdef __GNUC__ typedef unsigned long long int __u_quad_t; typedef long long int __quad_t; -typedef __quad_t *__qaddr_t; #else typedef struct -{ - long val[2]; -} __quad_t; + { + long int __val[2]; + } __quad_t; typedef struct -{ - __u_long val[2]; -} __u_quad_t; + { + __u_long __val[2]; + } __u_quad_t; #endif +typedef __quad_t *__qaddr_t; -typedef __kernel_dev_t __dev_t; /* Type of device numbers. */ -typedef __kernel_uid_t __uid_t; /* Type of user identifications. */ -typedef __kernel_gid_t __gid_t; /* Type of group identifications. */ -typedef __kernel_ino_t __ino_t; /* Type of file serial numbers. */ -typedef __kernel_mode_t __mode_t; /* Type of file attribute bitmasks. */ -typedef __kernel_nlink_t __nlink_t; /* Type of file link counts. */ -typedef __kernel_off_t __off_t; /* Type of file sizes and offsets. */ -typedef __kernel_loff_t __loff_t; /* Type of file sizes and offsets. */ -typedef __kernel_pid_t __pid_t; /* Type of process identifications. */ -typedef __kernel_ssize_t __ssize_t; /* Type of a byte count, or error. */ -typedef __kernel_fsid_t __fsid_t; /* Type of file system IDs. */ +typedef __u_quad_t __dev_t; /* Type of device numbers. */ +typedef __u_int __uid_t; /* Type of user identifications. */ +typedef __u_int __gid_t; /* Type of group identifications. */ +typedef __u_long __ino_t; /* Type of file serial numbers. */ +typedef __u_int __mode_t; /* Type of file attribute bitmasks. */ +typedef __u_int __nlink_t; /* Type of file link counts. */ +typedef long int __off_t; /* Type of file sizes and offsets. */ +typedef __quad_t __loff_t; /* Type of file sizes and offsets. */ +typedef int __pid_t; /* Type of process identifications. */ +typedef int __ssize_t; /* Type of a byte count, or error. */ + +typedef struct + { + int __val[2]; + } __fsid_t; /* Type of file system IDs. */ /* Everythin' else. */ -typedef __kernel_daddr_t __daddr_t; /* The type of a disk address. */ -typedef __kernel_caddr_t __caddr_t; -typedef __kernel_time_t __time_t; +typedef int __daddr_t; /* The type of a disk address. */ +typedef char *__caddr_t; +typedef long int __time_t; typedef long int __swblk_t; /* Type of a swap block maybe? */ -/* fd_set for select. */ -typedef __kernel_fd_set __fd_set; -typedef __kernel_clock_t __clock_t; +typedef long int __clock_t; + +/* One element in the file descriptor mask array. */ +typedef unsigned long int __fd_mask; + +/* Number of descriptors that can fit in an `fd_set'. */ +#define __FD_SETSIZE 1024 + +/* It's easier to assume 8-bit bytes than to get CHAR_BIT. */ +#define __NFDBITS (8 * sizeof (__fd_mask)) +#define __FDELT(d) ((d) / __NFDBITS) +#define __FDMASK(d) (1 << ((d) % __NFDBITS)) + +/* fd_set for select and pselect. */ +typedef struct + { + /* XPG4.2 requires this member name. */ + __fd_mask fds_bits[__FD_SETSIZE / __NFDBITS]; + } __fd_set; -/* Linus doesn't want __kernel_fd_mask in <linux/posix_types.h> since - XPG4 seems to require `unsigned long'. */ -typedef unsigned long __fd_mask; -#ifdef __USE_SVID typedef int __key_t; -#endif #endif /* gnu/types.h */ diff --git a/sysdeps/unix/sysv/linux/ioctl-types.h b/sysdeps/unix/sysv/linux/ioctl-types.h index 510428ee7a..91fcc2653b 100644 --- a/sysdeps/unix/sysv/linux/ioctl-types.h +++ b/sysdeps/unix/sysv/linux/ioctl-types.h @@ -1,5 +1,5 @@ /* Structure types for pre-termios terminal ioctls. Linux version. - Copyright (C) 1996 Free Software Foundation, Inc. + Copyright (C) 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 @@ -20,8 +20,51 @@ #ifndef _IOCTL_TYPES_H #define _IOCTL_TYPES_H 1 -/* The Linux kernel header defines the types associated with old ioctls. */ +/* Get definition of constants for use with `ioctl'. */ +#include <asm/ioctls.h> + + +struct winsize + { + unsigned short int ws_row; + unsigned short int ws_col; + unsigned short int ws_xpixel; + unsigned short int ws_ypixel; + }; + +#define NCC 8 +struct termio + { + unsigned short int c_iflag; /* input mode flags */ + unsigned short int c_oflag; /* output mode flags */ + unsigned short int c_cflag; /* control mode flags */ + unsigned short int c_lflag; /* local mode flags */ + unsigned char c_line; /* line discipline */ + unsigned char c_cc[NCC]; /* control characters */ +}; + +/* modem lines */ +#define TIOCM_LE 0x001 +#define TIOCM_DTR 0x002 +#define TIOCM_RTS 0x004 +#define TIOCM_ST 0x008 +#define TIOCM_SR 0x010 +#define TIOCM_CTS 0x020 +#define TIOCM_CAR 0x040 +#define TIOCM_RNG 0x080 +#define TIOCM_DSR 0x100 +#define TIOCM_CD TIOCM_CAR +#define TIOCM_RI TIOCM_RNG + +/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ + +/* line disciplines */ +#define N_TTY 0 +#define N_SLIP 1 +#define N_MOUSE 2 +#define N_PPP 3 +#define N_STRIP 4 +#define N_AX25 5 -#include <asm/termios.h> #endif /* ioctl-types.h */ diff --git a/sysdeps/unix/sysv/linux/kernel_termios.h b/sysdeps/unix/sysv/linux/kernel_termios.h new file mode 100644 index 0000000000..3b2653b2cd --- /dev/null +++ b/sysdeps/unix/sysv/linux/kernel_termios.h @@ -0,0 +1,13 @@ +/* The following corresponds to the values from the Linux 2.1.20 kernel. */ + +#define KERNEL_NCCS 19 + +struct kernel_termios + { + tcflag_t c_iflag; /* input mode flags */ + tcflag_t c_oflag; /* output mode flags */ + tcflag_t c_cflag; /* control mode flags */ + tcflag_t c_lflag; /* local mode flags */ + cc_t c_line; /* line discipline */ + cc_t c_cc[KERNEL_NCCS]; /* control characters */ + }; diff --git a/sysdeps/unix/sysv/linux/net/if.h b/sysdeps/unix/sysv/linux/net/if.h index 1aa8e7b90c..bf261175ec 100644 --- a/sysdeps/unix/sysv/linux/net/if.h +++ b/sysdeps/unix/sysv/linux/net/if.h @@ -1 +1,146 @@ -#include <linux/if.h> +/* 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. + + 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 _NET_IF_H + +#define _NET_IF_H 1 +#include <features.h> + +#include <sys/types.h> +#include <sys/socket.h> + +/* Standard interface flags. */ +enum + { + IFF_UP = 0x1, /* Interface is up. */ + IFF_BROADCAST = 0x2, /* Broadcast address valid. */ + IFF_DEBUG = 0x4, /* Turn on debugging. */ + IFF_LOOPBACK = 0x8, /* Is a loopback net. */ + IFF_POINTOPOINT = 0x10, /* Interface is point-to-point link. */ + IFF_NOTRAILERS = 0x20, /* Avoid use of trailers. */ + IFF_RUNNING = 0x40, /* Resources allocated. */ + IFF_NOARP = 0x80, /* No address resolution protocol. */ + IFF_PROMISC = 0x100, /* Receive all packets. */ + /* Not supported */ + IFF_ALLMULTI = 0x200, /* Receive all multicast packets. */ + + IFF_MASTER = 0x400, /* Master of a load balancer. */ + IFF_SLAVE = 0x800, /* Slave of a load balancer. */ + + IFF_MULTICAST = 0x1000 /* Supports multicast. */ + }; + +/* The ifaddr structure contains information about one address of an + interface. They are maintained by the different address families, + are allocated and attached when an address is set, and are linked + together so all addresses for an interface can be located. */ + +struct ifaddr + { + struct sockaddr ifa_addr; /* Address of interface. */ + union + { + struct sockaddr ifu_broadaddr; + struct sockaddr ifu_dstaddr; + } ifa_ifu; + struct iface *ifa_ifp; /* Back-pointer to interface. */ + struct ifaddr *ifa_next; /* Next address for interface. */ + }; + +#define ifa_broadaddr ifa_ifu.ifu_broadaddr /* broadcast address */ +#define ifa_dstaddr ifa_ifu.ifu_dstaddr /* other end of link */ + +/* Device mapping structure. I'd just gone off and designed a + beautiful scheme using only loadable modules with arguments for + driver options and along come the PCMCIA people 8) + + Ah well. The get() side of this is good for WDSETUP, and it'll be + handy for debugging things. The set side is fine for now and being + very small might be worth keeping for clean configuration. */ + +struct ifmap + { + unsigned long int mem_start; + unsigned long int mem_end; + unsigned short int base_addr; + unsigned char irq; + unsigned char dma; + unsigned char port; + /* 3 bytes spare */ + }; + +/* Interface request structure used for socket ioctl's. All interface + ioctl's must have parameter definitions which begin with ifr_name. + The remainder may be interface specific. */ + +struct ifreq + { +#define IFHWADDRLEN 6 +#define IFNAMSIZ 16 + union + { + char ifrn_name[IFNAMSIZ]; /* Interface name, e.g. "en0". */ + } ifr_ifrn; + + union + { + struct sockaddr ifru_addr; + struct sockaddr ifru_dstaddr; + struct sockaddr ifru_broadaddr; + struct sockaddr ifru_netmask; + struct sockaddr ifru_hwaddr; + short int ifru_flags; + int ifru_metric; + int ifru_mtu; + struct ifmap ifru_map; + char ifru_slave[IFNAMSIZ]; /* Just fits the size */ + __caddr_t ifru_data; + } ifr_ifru; + }; + +#define ifr_name ifr_ifrn.ifrn_name /* interface name */ +#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */ +#define ifr_addr ifr_ifru.ifru_addr /* address */ +#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-p lnk */ +#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ +#define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */ +#define ifr_flags ifr_ifru.ifru_flags /* flags */ +#define ifr_metric ifr_ifru.ifru_metric /* metric */ +#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ +#define ifr_map ifr_ifru.ifru_map /* device map */ +#define ifr_slave ifr_ifru.ifru_slave /* slave device */ +#define ifr_data ifr_ifru.ifru_data /* for use by interface */ + + +/* Structure used in SIOCGIFCONF request. Used to retrieve interface + configuration for machine (useful for programs which must know all + networks accessible). */ + +struct ifconf + { + int ifc_len; /* Size of buffer. */ + union + { + __caddr_t ifcu_buf; + struct ifreq *ifcu_req; + } ifc_ifcu; + }; +#define ifc_buf ifc_ifcu.ifcu_buf /* Buffer address. */ +#define ifc_req ifc_ifcu.ifcu_req /* Array of structures. */ + +#endif /* net/if.h */ diff --git a/sysdeps/unix/sysv/linux/netinet/in.h b/sysdeps/unix/sysv/linux/netinet/in.h index 91c88835db..3dea878a21 100644 --- a/sysdeps/unix/sysv/linux/netinet/in.h +++ b/sysdeps/unix/sysv/linux/netinet/in.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc. +/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 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 @@ -23,14 +23,25 @@ #include <sys/socket.h> -__BEGIN_DECLS -#include <linux/in.h> -__END_DECLS -/* Standard well-known ports. The use of these constants is - deprecated. Instead use the contents of the file `/etc/services' - or similar databases by using the function getservbyname and - getservbyport. */ +/* Standard well-defined IP protocols. */ +enum + { + IPPROTO_IP = 0, /* Dummy protocol for TCP. */ + IPPROTO_ICMP = 1, /* Internet Control Message Protocol. */ + IPPROTO_IGMP = 2, /* Internet Group Management Protocol. */ + IPPROTO_IPIP = 4, /* IPIP tunnels (older KA9Q tunnels use 94). */ + IPPROTO_TCP = 6, /* Transmission Control Protocol. */ + IPPROTO_EGP = 8, /* Exterior Gateway Protocol. */ + IPPROTO_PUP = 12, /* PUP protocol. */ + IPPROTO_UDP = 17, /* User Datagram Protocol. */ + IPPROTO_IDP = 22, /* XNS IDP protocol. */ + + IPPROTO_RAW = 255, /* Raw IP packets. */ + IPPROTO_MAX + }; + +/* Standard well-known ports. */ enum { IPPORT_ECHO = 7, /* Echo service. */ @@ -71,50 +82,120 @@ enum }; -/* Link numbers. */ -#define IMPLINK_IP 155 -#define IMPLINK_LOWEXPER 156 -#define IMPLINK_HIGHEXPER 158 +/* Internet address. */ +struct in_addr + { + unsigned int s_addr; + }; + + +/* Definitions of the bits in an Internet address integer. + + On subnets, host and network parts are found according to + the subnet mask, not these masks. */ + +#define IN_CLASSA(a) ((((unsigned) (a)) & 0x80000000) == 0) +#define IN_CLASSA_NET 0xff000000 +#define IN_CLASSA_NSHIFT 24 +#define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET) +#define IN_CLASSA_MAX 128 + +#define IN_CLASSB(a) ((((unsigned) (a)) & 0xc0000000) == 0x80000000) +#define IN_CLASSB_NET 0xffff0000 +#define IN_CLASSB_NSHIFT 16 +#define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET) +#define IN_CLASSB_MAX 65536 + +#define IN_CLASSC(a) ((((unsigned) (a)) & 0xc0000000) == 0xc0000000) +#define IN_CLASSC_NET 0xffffff00 +#define IN_CLASSC_NSHIFT 8 +#define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET) + +#define IN_CLASSD(a) ((((unsigned) (a)) & 0xf0000000) == 0xe0000000) +#define IN_MULTICAST(a) IN_CLASSD(a) + +#define IN_EXPERIMENTAL(a) ((((unsigned) (a)) & 0xe0000000) == 0xe0000000) +#define IN_BADCLASS(a) ((((unsigned) (a)) & 0xf0000000) == 0xf0000000) + +/* Address to accept any incoming messages. */ +#define INADDR_ANY ((unsigned) 0x00000000) +/* Address to send to all hosts. */ +#define INADDR_BROADCAST ((unsigned) 0xffffffff) +/* Address indicating an error return. */ +#define INADDR_NONE 0xffffffff + +/* Network number for local host loopback. */ +#define IN_LOOPBACKNET 127 +/* Address to loopback in software to local host. */ +#ifndef INADDR_LOOPBACK +#define INADDR_LOOPBACK 0x7f000001 /* Internet address 127.0.0.1. */ +#endif + /* Get the definition of the macro to define the common sockaddr members. */ #include <sockaddrcom.h> -/* Structure used to describe IP options for IP_OPTIONS and IP_RETOPTS. - The `ip_dst' field is used for the first-hop gateway when using a - source route (this gets put into the header proper). */ + +/* Structure describing an Internet socket address. */ +struct sockaddr_in + { + __SOCKADDR_COMMON (sin_); + unsigned short int sin_port; /* Port number. */ + struct in_addr sin_addr; /* Internet address. */ + + /* Pad to size of `struct sockaddr'. */ + unsigned char sin_zero[sizeof(struct sockaddr) - + __SOCKADDR_COMMON_SIZE - + sizeof(unsigned short int) - + sizeof(struct in_addr)]; + }; + + +/* Options for use with `getsockopt' and `setsockopt' at the IP level. + The first word in the comment at the right is the data type used; + "bool" means a boolean value stored in an `int'. */ +#define IP_TOS 1 /* int; IP type of service and precedence. */ +#define IP_TTL 2 /* int; IP time to live. */ +#define IP_HDRINCL 3 /* int; Header is included with data. */ +#define IP_OPTIONS 4 /* ip_opts; IP per-packet options. */ +#define IP_MULTICAST_IF 32 /* in_addr; set/get IP multicast i/f */ +#define IP_MULTICAST_TTL 33 /* u_char; set/get IP multicast ttl */ +#define IP_MULTICAST_LOOP 34 /* i_char; set/get IP multicast loopback */ +#define IP_ADD_MEMBERSHIP 35 /* ip_mreq; add an IP group membership */ +#define IP_DROP_MEMBERSHIP 36 /* ip_mreq; drop an IP group membership */ + +/* Structure used to describe IP options for IP_OPTIONS. The `ip_dst' + field is used for the first-hop gateway when using a source route + (this gets put into the header proper). */ struct ip_opts { struct in_addr ip_dst; /* First hop; zero without source route. */ char ip_opts[40]; /* Actually variable in size. */ }; -__BEGIN_DECLS +/* Structure used for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP. */ +struct ip_mreq + { + struct in_addr imr_multiaddr; /* IP multicast address of group */ + struct in_addr imr_interface; /* local IP address of interface */ + }; /* Functions to convert between host and network byte order. */ -extern unsigned long int ntohl __P ((unsigned long int __long_word)); -extern unsigned short int ntohs __P ((unsigned short int __short_word)); -extern unsigned long int htonl __P ((unsigned long int __long_word)); -extern unsigned short int htons __P ((unsigned short int __short_word)); - -/* Bind socket FD to a privileged IP address SIN. */ -extern int bindresvport __P ((int __fd, struct sockaddr_in * __sock_in)); - -__END_DECLS +extern unsigned long int ntohl __P ((unsigned long int)); +extern unsigned short int ntohs __P ((unsigned short int)); +extern unsigned long int htonl __P ((unsigned long int)); +extern unsigned short int htons __P ((unsigned short int)); #include <endian.h> #if __BYTE_ORDER == __BIG_ENDIAN /* The host byte order is the same as network byte order, so these functions are all just identity. */ -# undef ntohl -# define ntohl(x) (x) -# undef ntohs -# define ntohs(x) (x) -# undef htonl -# define htonl(x) (x) -# undef htons -# define htons(x) (x) +#define ntohl(x) (x) +#define ntohs(x) (x) +#define htonl(x) (x) +#define htons(x) (x) #endif #endif /* netinet/in.h */ diff --git a/sysdeps/unix/sysv/linux/siglist.h b/sysdeps/unix/sysv/linux/siglist.h index 44aa4d9027..c2bf2331d7 100644 --- a/sysdeps/unix/sysv/linux/siglist.h +++ b/sysdeps/unix/sysv/linux/siglist.h @@ -1,47 +1,65 @@ +/* Copyright (C) 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. */ + /* This file is included multiple times. */ /* Standard signals */ - init_sig (SIGHUP, "HUP", "Hangup") - init_sig (SIGINT, "INT", "Interrupt") - init_sig (SIGQUIT, "QUIT", "Quit") - init_sig (SIGILL, "ILL", "Illegal Instruction") - init_sig (SIGTRAP, "TRAP", "Trace/breakpoint trap") - init_sig (SIGABRT, "ABRT", "Aborted") - init_sig (SIGFPE, "FPE", "Floating point exception") - init_sig (SIGKILL, "KILL", "Killed") - init_sig (SIGBUS, "BUS", "Bus error") - init_sig (SIGSEGV, "SEGV", "Segmentation fault") - init_sig (SIGPIPE, "PIPE", "Broken pipe") - init_sig (SIGALRM, "ALRM", "Alarm clock") - init_sig (SIGTERM, "TERM", "Terminated") - init_sig (SIGURG, "URG", "Urgent I/O condition") - init_sig (SIGSTOP, "STOP", "Stopped (signal)") - init_sig (SIGTSTP, "TSTP", "Stopped") - init_sig (SIGCONT, "CONT", "Continued") - init_sig (SIGCHLD, "CHLD", "Child exited") - init_sig (SIGTTIN, "TTIN", "Stopped (tty input)") - init_sig (SIGTTOU, "TTOU", "Stopped (tty output)") - init_sig (SIGIO, "IO", "I/O possible") - init_sig (SIGXCPU, "XCPU", "CPU time limit exceeded") - init_sig (SIGXFSZ, "XFSZ", "File size limit exceeded") - init_sig (SIGVTALRM, "VTALRM", "Virtual timer expired") - init_sig (SIGPROF, "PROF", "Profiling timer expired") - init_sig (SIGWINCH, "WINCH", "Window changed") - init_sig (SIGUSR1, "USR1", "User defined signal 1") - init_sig (SIGUSR2, "USR2", "User defined signal 2") + init_sig (SIGHUP, "HUP", N_("Hangup")) + init_sig (SIGINT, "INT", N_("Interrupt")) + init_sig (SIGQUIT, "QUIT", N_("Quit")) + init_sig (SIGILL, "ILL", N_("Illegal Instruction")) + init_sig (SIGTRAP, "TRAP", N_("Trace/breakpoint trap")) + init_sig (SIGABRT, "ABRT", N_("Aborted")) + init_sig (SIGFPE, "FPE", N_("Floating point exception")) + init_sig (SIGKILL, "KILL", N_("Killed")) + init_sig (SIGBUS, "BUS", N_("Bus error")) + init_sig (SIGSEGV, "SEGV", N_("Segmentation fault")) + init_sig (SIGPIPE, "PIPE", N_("Broken pipe")) + init_sig (SIGALRM, "ALRM", N_("Alarm clock")) + init_sig (SIGTERM, "TERM", N_("Terminated")) + init_sig (SIGURG, "URG", N_("Urgent I/O condition")) + init_sig (SIGSTOP, "STOP", N_("Stopped (signal)")) + init_sig (SIGTSTP, "TSTP", N_("Stopped")) + init_sig (SIGCONT, "CONT", N_("Continued")) + init_sig (SIGCHLD, "CHLD", N_("Child exited")) + init_sig (SIGTTIN, "TTIN", N_("Stopped (tty input)")) + init_sig (SIGTTOU, "TTOU", N_("Stopped (tty output)")) + init_sig (SIGIO, "IO", N_("I/O possible")) + init_sig (SIGXCPU, "XCPU", N_("CPU time limit exceeded")) + init_sig (SIGXFSZ, "XFSZ", N_("File size limit exceeded")) + init_sig (SIGVTALRM, "VTALRM", N_("Virtual timer expired")) + init_sig (SIGPROF, "PROF", N_("Profiling timer expired")) + init_sig (SIGWINCH, "WINCH", N_("Window changed")) + init_sig (SIGUSR1, "USR1", N_("User defined signal 1")) + init_sig (SIGUSR2, "USR2", N_("User defined signal 2")) /* Variations */ #ifdef SIGEMT - init_sig (SIGEMT, "EMT", "EMT trap") + init_sig (SIGEMT, "EMT", N_("EMT trap")) #endif #ifdef SIGSYS - init_sig (SIGSYS, "SYS", "Bad system call") + init_sig (SIGSYS, "SYS", N_("Bad system call")) #endif #ifdef SIGSTKFLT - init_sig (SIGSTKFLT, "STKFLT", "Stack fault") + init_sig (SIGSTKFLT, "STKFLT", N_("Stack fault")) #endif #ifdef SIGINFO - init_sig (SIGINFO, "INFO", "Information request") + init_sig (SIGINFO, "INFO", N_("Information request")) #elif defined(SIGPWR) - init_sig (SIGPWR, "PWR", "Power failure") + init_sig (SIGPWR, "PWR", N_("Power failure")) #endif diff --git a/sysdeps/unix/sysv/linux/sigset.h b/sysdeps/unix/sysv/linux/sigset.h new file mode 100644 index 0000000000..69648b7e9c --- /dev/null +++ b/sysdeps/unix/sysv/linux/sigset.h @@ -0,0 +1,89 @@ +/* __sig_atomic_t, __sigset_t, and related definitions. Linux version. + Copyright (C) 1991, 1992, 1994, 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. */ + +#ifndef _SIGSET_H_types +#define _SIGSET_H_types 1 + +typedef int __sig_atomic_t; + +/* A `sigset_t' has a bit for each signal. Having 32 * 4 * 8 bits gives + us up to 1024 signals. */ +#define _SIGSET_NWORDS 32 +typedef struct +{ + unsigned int __val[_SIGSET_NWORDS]; +} __sigset_t; + +#endif + + +/* We only want to define these functions if <signal.h> was actually + included; otherwise we were included just to define the types. Since we + are namespace-clean, it wouldn't hurt to define extra macros. But + trouble can be caused by functions being defined (e.g., any global + register vars declared later will cause compilation errors). */ + +#if !defined (_SIGSET_H_fns) && defined (_SIGNAL_H) +#define _SIGSET_H_fns 1 + +#ifndef _EXTERN_INLINE +#define _EXTERN_INLINE extern __inline +#endif + +/* Return a mask that includes the bit for SIG only. */ +#define __sigmask(sig) (((unsigned int) 1) << (((sig) - 1) \ + % (8 * sizeof (unsigned int)))) +/* Return the word index for SIG. */ +#define __sigword(sig) (((sig) - 1) / (8 * sizeof (unsigned int))) + +#if defined __GNUC__ && __GNUC__ >= 2 +#define __sigemptyset(set) \ + (__extension__ ({ unsigned int __cnt; \ + for (__cnt = 0; __cnt < _SIGSET_NWORDS; ++__cnt) \ + (set)->__val[__cnt] = 0; 0; })) +#define __sigfillset(set) \ + (__extension__ ({ unsigned int __cnt; \ + for (__cnt = 0; __cnt < _SIGSET_NWORDS; ++__cnt) \ + (set)->__val[__cnt] = ~0; 0; })) +#endif + +/* These functions needn't check for a bogus signal number -- error + checking is done in the non __ versions. */ + +extern int __sigismember (__const __sigset_t *, int); +extern int __sigaddset (__sigset_t *, int); +extern int __sigdelset (__sigset_t *, int); + +#define __SIGSETFN(NAME, BODY, CONST) \ + _EXTERN_INLINE int \ + NAME (CONST __sigset_t *__set, int __sig) \ + { \ + unsigned int __mask = __sigmask (__sig); \ + unsigned int __word = __sigword (__sig); \ + return BODY; \ + } + +__SIGSETFN (__sigismember, (__set->__val[__word] & __mask) ? 1 : 0, __const) +__SIGSETFN (__sigaddset, ((__set->__val[__word] |= __mask), 0), ) +__SIGSETFN (__sigdelset, ((__set->__val[__word] &= ~__mask), 0), ) + +#undef __SIGSETFN + + +#endif /* ! _SIGSET_H_fns. */ diff --git a/sysdeps/unix/sysv/linux/sigsuspend.c b/sysdeps/unix/sysv/linux/sigsuspend.c index 8b3d2519ce..723f7629ec 100644 --- a/sysdeps/unix/sysv/linux/sigsuspend.c +++ b/sysdeps/unix/sysv/linux/sigsuspend.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996 Free Software Foundation, Inc. +/* Copyright (C) 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 @@ -20,7 +20,7 @@ #include <stddef.h> #include <unistd.h> -extern int __syscall_sigsuspend (int, unsigned long, unsigned long); +extern int __syscall_sigsuspend (int, unsigned long int, unsigned long int); /* Change the set of blocked signals to SET, wait until a signal arrives, and restore the set of blocked signals. */ @@ -28,6 +28,10 @@ int __sigsuspend (set) const sigset_t *set; { - return __syscall_sigsuspend (0, 0, *set); + /* XXX This will have to be changed once the kernel knows about + larger sigsets. */ + unsigned long int word = set->__val[0]; + + return __syscall_sigsuspend (0, 0, word); } weak_alias (__sigsuspend, sigsuspend) diff --git a/sysdeps/unix/sysv/linux/socketbits.h b/sysdeps/unix/sysv/linux/socketbits.h index 1c7cee0dad..3bb92ab733 100644 --- a/sysdeps/unix/sysv/linux/socketbits.h +++ b/sysdeps/unix/sysv/linux/socketbits.h @@ -1,2 +1,136 @@ -/* Get Linux specific constants and data types kernel header. */ -#include <linux/socket.h> +/* System-specific socket constants and types. Linux version. + Copyright (C) 1991, 92, 94, 95, 96, 97 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 _SOCKETBITS_H + +#define _SOCKETBITS_H 1 +#include <features.h> + +#define __need_size_t +#include <stddef.h> + + +__BEGIN_DECLS + +/* Types of sockets. */ +enum __socket_type +{ + SOCK_STREAM = 1, /* Sequenced, reliable, connection-based + byte streams. */ + SOCK_DGRAM = 2, /* Connectionless, unreliable datagrams + of fixed maximum length. */ + SOCK_RAW = 3, /* Raw protocol interface. */ + SOCK_RDM = 4, /* Reliably-delivered messages. */ + SOCK_SEQPACKET = 5, /* Sequenced, reliable, connection-based, + datagrams of fixed maximum length. */ + SOCK_PACKET = 10 /* Linux specific way of getting packets + at the dev level. For writing rarp and + other similar things on the user level. */ +}; + +/* 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_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_NETROM 6 /* Amateur radio NetROM. */ +#define PF_BRIDGE 7 /* Multiprotocol bridge. */ +#define PF_AAL5 8 /* Reserved for Werner's ATM. */ +#define PF_X25 9 /* Reserved for X.25 project. */ +#define PF_INET6 10 /* IP version 6. */ +#define PF_MAX 12 /* For now.. */ + +/* Address families. */ +#define AF_UNSPEC PF_UNSPEC +#define AF_LOCAL PF_LOCAL +#define AF_UNIX PF_UNIX +#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_MAX PF_MAX + + + +/* Maximum queue length specifiable by listen. */ +#define SOMAXCONN 128 + +/* Get the definition of the macro to define the common sockaddr members. */ +#include <sockaddrcom.h> + +/* Structure describing a generic socket address. */ +struct sockaddr + { + __SOCKADDR_COMMON (sa_); /* Common data: address family and length. */ + char sa_data[14]; /* Address data. */ + }; + + +/* Bits in the FLAGS argument to `send', `recv', et al. */ +enum + { + MSG_OOB = 0x01, /* Process out-of-band data. */ + MSG_PEEK = 0x02, /* Peek at incoming messages. */ + MSG_DONTROUTE = 0x04, /* Don't use local routing. */ + MSG_CTRUNC = 0x08, /* Control data lost before delivery. */ + MSG_PROXY = 0x10 /* Supply or ask second address. */ + }; + + +/* Structure describing messages sent by + `sendmsg' and received by `recvmsg'. */ +struct msghdr + { + __ptr_t msg_name; /* Address to send to/receive from. */ + int msg_namelen; /* Length of address data. */ + /* XXX Should be type `size_t' according to POSIX.1g. */ + + struct iovec *msg_iov; /* Vector of data to send/receive into. */ + int msg_iovlen; /* Number of elements in the vector. */ + /* XXX Should be type `size_t' according to POSIX.1g. */ + + __ptr_t msg_control; /* Ancillary data (eg BSD filedesc passing). */ + int msg_controllen; /* Ancillary data buffer length. */ + /* XXX Should be type `size_t' according to POSIX.1g. */ + int msg_flags; /* Flags on received message. */ + }; + + +/* Get socket manipulation related informations from kernel headers. */ +#include <asm/socket.h> + + +/* Structure used to manipulate the SO_LINGER option. */ +struct linger + { + int l_onoff; /* Nonzero to linger on close. */ + int l_linger; /* Time to linger. */ + }; + +__END_DECLS + +#endif /* socketbits.h */ diff --git a/sysdeps/unix/sysv/linux/statfsbuf.h b/sysdeps/unix/sysv/linux/statfsbuf.h index 08a10cb495..1d1bbdae0d 100644 --- a/sysdeps/unix/sysv/linux/statfsbuf.h +++ b/sysdeps/unix/sysv/linux/statfsbuf.h @@ -1 +1,36 @@ -#include <asm/statfs.h> +/* 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. + + 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 _STATFSBUF_H +#define _STATFSBUF_H + +struct statfs + { + int f_type; + int f_bsize; + int f_blocks; + int f_bfree; + int f_bavail; + int f_files; + int f_ffree; + __fsid_t f_fsid; + int f_namelen; + int f_spare[6]; + }; + +#endif /* statfsbuf.h */ diff --git a/sysdeps/unix/sysv/linux/sys/acct.h b/sysdeps/unix/sysv/linux/sys/acct.h index 4267ef405e..1d723d55b8 100644 --- a/sysdeps/unix/sysv/linux/sys/acct.h +++ b/sysdeps/unix/sysv/linux/sys/acct.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996 Free Software Foundation, Inc. +/* Copyright (C) 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 @@ -24,11 +24,40 @@ #define __need_time_t #include <time.h> -/* Get needed constants. */ -#include <linux/acct.h> __BEGIN_DECLS +#define ACCT_COMM 16 + +struct acct + { + char ac_comm[ACCT_COMM]; /* Accounting command name. */ + time_t ac_utime; /* Accounting user time. */ + time_t ac_stime; /* Accounting system time. */ + time_t ac_etime; /* Accounting elapsed time. */ + time_t ac_btime; /* Beginning time. */ + unsigned short int ac_uid; /* Accounting user ID. */ + unsigned short int ac_gid; /* Accounting group ID. */ + unsigned short int ac_tty; /* Controlling tty. */ + /* Please note that the value of the `ac_tty' field, a device number, + is encoded differently in the kernel and for the libc dev_t type. */ + char ac_flag; /* Accounting flag. */ + long int ac_minflt; /* Accounting minor pagefaults. */ + long int ac_majflt; /* Accounting major pagefaults. */ + long int ac_exitcode; /* Accounting process exitcode. */ + }; + +enum + { + AFORK = 0001, /* Has executed fork, but no exec. */ + ASU = 0002, /* Used super-user privileges. */ + ACORE = 0004, /* Dumped core. */ + AXSIG = 0010 /* Killed by a signal. */ + }; + +#define AHZ 100 + + /* Switch process accounting on and off. */ extern int acct __P ((__const char *__filename)); diff --git a/sysdeps/unix/sysv/linux/sys/ptrace.h b/sysdeps/unix/sysv/linux/sys/ptrace.h index ec94def4c5..eda8b8c00f 100644 --- a/sysdeps/unix/sysv/linux/sys/ptrace.h +++ b/sysdeps/unix/sysv/linux/sys/ptrace.h @@ -1,5 +1,5 @@ /* `ptrace' debugger support interface. Linux version. - Copyright (C) 1996 Free Software Foundation, Inc. + Copyright (C) 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 @@ -22,6 +22,8 @@ #define _SYS_PTRACE_H 1 #include <features.h> +#include <asm/ptrace.h> + __BEGIN_DECLS /* Type of the REQUEST argument to `ptrace.' */ diff --git a/sysdeps/unix/sysv/linux/syscall.h b/sysdeps/unix/sysv/linux/sys/syscall.h index cef91f6727..cef91f6727 100644 --- a/sysdeps/unix/sysv/linux/syscall.h +++ b/sysdeps/unix/sysv/linux/sys/syscall.h diff --git a/sysdeps/unix/sysv/linux/sys/sysmacros.h b/sysdeps/unix/sysv/linux/sys/sysmacros.h index caf4566414..b859dc7d64 100644 --- a/sysdeps/unix/sysv/linux/sys/sysmacros.h +++ b/sysdeps/unix/sysv/linux/sys/sysmacros.h @@ -1,5 +1,5 @@ /* Definitions of macros to access `dev_t' values. - Copyright (C) 1996 Free Software Foundation, Inc. + Copyright (C) 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 @@ -21,12 +21,9 @@ #define _SYS_SYSMACROS_H 1 -/* Get definition from kernel header. */ -#include <linux/kdev_t.h> - /* For compatibility we provide alternative names. */ -#define major(dev) MAJOR ((unsigned int) (dev)) -#define minor(dev) MINOR ((unsigned int) (dev)) -#define makedev(major, minor) MKDEV (major, minor) +#define major(dev) ((dev) >> 32) +#define minor(dev) ((dev) & 0xffffffff) +#define makedev(major, minor) (((major) << 32) | (monor)) #endif /* _SYS_SYSMACROS_H */ diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list index 38896e7f18..246470a66a 100644 --- a/sysdeps/unix/sysv/linux/syscalls.list +++ b/sysdeps/unix/sysv/linux/syscalls.list @@ -31,11 +31,13 @@ pause - pause 0 __libc_pause pause personality init-first personality 1 __personality personality pipe - pipe 1 __pipe pipe query_module EXTRA query_module 5 query_module +s_getdents EXTRA getdents 3 __getdents s_getpriority getpriority getpriority 2 __syscall_getpriority s_ptrace ptrace ptrace 4 __syscall_ptrace s_reboot EXTRA reboot 3 __syscall_reboot s_sigsuspend sigsuspend sigsuspend 3 __syscall_sigsuspend s_sysctl sysctl _sysctl 1 __syscall__sysctl +s_ustat ustat ustat 2 __syscall_ustat sched_getp - sched_getparam 2 __sched_getparam sched_getparam sched_gets - sched_getscheduler 1 __sched_getscheduler sched_getscheduler sched_primax - sched_get_priority_max 1 __sched_get_priority_max sched_get_priority_max @@ -51,9 +53,9 @@ setpgid - setpgid 2 __setpgid setpgid setresuid EXTRA setresuid 3 setresuid sigpending - sigpending 1 sigpending sigprocmask - sigprocmask 3 __sigprocmask sigprocmask +sigreturn EXTRA sigreturn 1 __sigreturn sigreturn sysinfo EXTRA sysinfo 1 sysinfo swapon - swapon 2 swapon umount EXTRA umount 1 __umount umount uselib EXTRA uselib 1 uselib -ustat - ustat 2 __ustat ustat wait4 - wait4 4 __wait4 wait4 diff --git a/sysdeps/unix/sysv/linux/tcgetattr.c b/sysdeps/unix/sysv/linux/tcgetattr.c index 3f12348478..2e8cb1cf79 100644 --- a/sysdeps/unix/sysv/linux/tcgetattr.c +++ b/sysdeps/unix/sysv/linux/tcgetattr.c @@ -1,23 +1,29 @@ -/* Copyright (C) 1992, 1995 Free Software Foundation, Inc. -This file is part of the GNU C Library. +/* Copyright (C) 1992, 1995, 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 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. + 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. */ + 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 <termios.h> #include <sys/ioctl.h> +#include <sys/types.h> + +/* The difference here is that the termios structure used in the + kernel is not the same as we use in the libc. Therefore we must + translate it here. */ +#include <kernel_termios.h> /* Put the state of FD into *TERMIOS_P. */ int @@ -25,7 +31,27 @@ __tcgetattr (fd, termios_p) int fd; struct termios *termios_p; { - return __ioctl (fd, TCGETS, termios_p); + struct kernel_termios k_termios; + int retval; + size_t cnt; + + retval = __ioctl (fd, TCGETS, &k_termios); + + termios_p->c_iflag = k_termios.c_iflag; + termios_p->c_oflag = k_termios.c_oflag; + termios_p->c_cflag = k_termios.c_cflag; + termios_p->c_lflag = k_termios.c_lflag; + termios_p->c_line = k_termios.c_line; +#ifdef _HAVE_C_ISPEED + termios_p->c_ispeed = k_termios.c_ispeed; +#endif +#ifdef _HAVE_C_OSPEED + termios_p->c_ospeed = k_termios.c_ospeed; +#endif + for (cnt = 0; cnt < KERNEL_NCCS; ++cnt) + termios_p->c_cc[cnt] = k_termios.c_cc[cnt]; + + return retval; } weak_alias (__tcgetattr, tcgetattr) diff --git a/sysdeps/unix/sysv/linux/tcsetattr.c b/sysdeps/unix/sysv/linux/tcsetattr.c index ef5009d1c8..7afaf1b986 100644 --- a/sysdeps/unix/sysv/linux/tcsetattr.c +++ b/sysdeps/unix/sysv/linux/tcsetattr.c @@ -1 +1,72 @@ -#include <sysdeps/unix/bsd/sun/sunos4/tcsetattr.c> +/* Copyright (C) 1993, 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 <errno.h> +#include <termios.h> +#include <sys/ioctl.h> +#include <sys/types.h> + +/* The difference here is that the termios structure used in the + kernel is not the same as we use in the libc. Therefore we must + translate it here. */ +#include <kernel_termios.h> + + +/* Set the state of FD to *TERMIOS_P. */ +int +tcsetattr (fd, optional_actions, termios_p) + int fd; + int optional_actions; + const struct termios *termios_p; +{ + struct kernel_termios k_termios; + unsigned long int cmd; + size_t cnt; + + switch (optional_actions) + { + case TCSANOW: + cmd = TCSETS; + break; + case TCSADRAIN: + cmd = TCSETSW; + break; + case TCSAFLUSH: + cmd = TCSETSF; + break; + default: + __set_errno (EINVAL); + return -1; + } + + k_termios.c_iflag = termios_p->c_iflag; + k_termios.c_oflag = termios_p->c_oflag; + k_termios.c_cflag = termios_p->c_cflag; + k_termios.c_lflag = termios_p->c_lflag; + k_termios.c_line = termios_p->c_line; +#ifdef _HAVE_C_ISPEED + k_termios.c_ispeed = termios_p.c_ispeed; +#endif +#ifdef _HAVE_C_OSPEED + k_termios.c_ospeed = termios_p.c_ospeed; +#endif + for (cnt = 0; cnt < KERNEL_NCCS; ++cnt) + k_termios.c_cc[cnt] = termios_p->c_cc[cnt]; + + return __ioctl (fd, cmd, &k_termios); +} diff --git a/sysdeps/unix/sysv/linux/termbits.h b/sysdeps/unix/sysv/linux/termbits.h index 536ced356d..f8e59f1d3b 100644 --- a/sysdeps/unix/sysv/linux/termbits.h +++ b/sysdeps/unix/sysv/linux/termbits.h @@ -1,5 +1,5 @@ /* termios type and macro definitions. Linux version. - Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1993, 1994, 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 @@ -17,8 +17,163 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* Use the architecture dependent definitions from the kernel. */ -#include <asm/termbits.h> +typedef unsigned char cc_t; +typedef unsigned int speed_t; +typedef unsigned int tcflag_t; + +#define NCCS 32 +struct termios + { + tcflag_t c_iflag; /* input mode flags */ + tcflag_t c_oflag; /* output mode flags */ + tcflag_t c_cflag; /* control mode flags */ + tcflag_t c_lflag; /* local mode flags */ + cc_t c_line; /* line discipline */ + cc_t c_cc[NCCS]; /* control characters */ + speed_t c_ispeed; /* input speed */ + speed_t c_ospeed; /* output speed */ + }; + +/* c_cc characters */ +#define VINTR 0 +#define VQUIT 1 +#define VERASE 2 +#define VKILL 3 +#define VEOF 4 +#define VTIME 5 +#define VMIN 6 +#define VSWTC 7 +#define VSTART 8 +#define VSTOP 9 +#define VSUSP 10 +#define VEOL 11 +#define VREPRINT 12 +#define VDISCARD 13 +#define VWERASE 14 +#define VLNEXT 15 +#define VEOL2 16 + +/* c_iflag bits */ +#define IGNBRK 0000001 +#define BRKINT 0000002 +#define IGNPAR 0000004 +#define PARMRK 0000010 +#define INPCK 0000020 +#define ISTRIP 0000040 +#define INLCR 0000100 +#define IGNCR 0000200 +#define ICRNL 0000400 +#define IUCLC 0001000 +#define IXON 0002000 +#define IXANY 0004000 +#define IXOFF 0010000 +#define IMAXBEL 0020000 + +/* c_oflag bits */ +#define OPOST 0000001 +#define OLCUC 0000002 +#define ONLCR 0000004 +#define OCRNL 0000010 +#define ONOCR 0000020 +#define ONLRET 0000040 +#define OFILL 0000100 +#define OFDEL 0000200 +#define NLDLY 0000400 +#define NL0 0000000 +#define NL1 0000400 +#define CRDLY 0003000 +#define CR0 0000000 +#define CR1 0001000 +#define CR2 0002000 +#define CR3 0003000 +#define TABDLY 0014000 +#define TAB0 0000000 +#define TAB1 0004000 +#define TAB2 0010000 +#define TAB3 0014000 +#define XTABS 0014000 +#define BSDLY 0020000 +#define BS0 0000000 +#define BS1 0020000 +#define VTDLY 0040000 +#define VT0 0000000 +#define VT1 0040000 +#define FFDLY 0100000 +#define FF0 0000000 +#define FF1 0100000 + +/* c_cflag bit meaning */ +#define CBAUD 0010017 +#define B0 0000000 /* hang up */ +#define B50 0000001 +#define B75 0000002 +#define B110 0000003 +#define B134 0000004 +#define B150 0000005 +#define B200 0000006 +#define B300 0000007 +#define B600 0000010 +#define B1200 0000011 +#define B1800 0000012 +#define B2400 0000013 +#define B4800 0000014 +#define B9600 0000015 +#define B19200 0000016 +#define B38400 0000017 +#define EXTA B19200 +#define EXTB B38400 +#define CSIZE 0000060 +#define CS5 0000000 +#define CS6 0000020 +#define CS7 0000040 +#define CS8 0000060 +#define CSTOPB 0000100 +#define CREAD 0000200 +#define PARENB 0000400 +#define PARODD 0001000 +#define HUPCL 0002000 +#define CLOCAL 0004000 +#define CBAUDEX 0010000 +#define B57600 0010001 +#define B115200 0010002 +#define B230400 0010003 +#define B460800 0010004 +#define CIBAUD 002003600000 /* input baud rate (not used) */ +#define CRTSCTS 020000000000 /* flow control */ + +/* c_lflag bits */ +#define ISIG 0000001 +#define ICANON 0000002 +#define XCASE 0000004 +#define ECHO 0000010 +#define ECHOE 0000020 +#define ECHOK 0000040 +#define ECHONL 0000100 +#define NOFLSH 0000200 +#define TOSTOP 0000400 +#define ECHOCTL 0001000 +#define ECHOPRT 0002000 +#define ECHOKE 0004000 +#define FLUSHO 0010000 +#define PENDIN 0040000 +#define IEXTEN 0100000 + +/* tcflow() and TCXONC use these */ +#define TCOOFF 0 +#define TCOON 1 +#define TCIOFF 2 +#define TCION 3 + +/* tcflush() and TCFLSH use these */ +#define TCIFLUSH 0 +#define TCOFLUSH 1 +#define TCIOFLUSH 2 + +/* tcsetattr uses these */ +#define TCSANOW 0 +#define TCSADRAIN 1 +#define TCSAFLUSH 2 + #define _IOT_termios /* Hurd ioctl type field. */ \ _IOT (_IOTS (cflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2) diff --git a/sysdeps/unix/sysv/linux/ustat.c b/sysdeps/unix/sysv/linux/ustat.c new file mode 100644 index 0000000000..8cec8eb9b7 --- /dev/null +++ b/sysdeps/unix/sysv/linux/ustat.c @@ -0,0 +1,32 @@ +/* Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 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 <sys/ustat.h> +#include <sys/sysmacros.h> + +int +ustat (dev_t dev, struct ustat *ubuf) +{ + unsigned short int k_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_ustat (k_dev, ubuf); +} diff --git a/sysdeps/unix/sysv/linux/ustatbits.h b/sysdeps/unix/sysv/linux/ustatbits.h index 96580031c7..526069a7f3 100644 --- a/sysdeps/unix/sysv/linux/ustatbits.h +++ b/sysdeps/unix/sysv/linux/ustatbits.h @@ -1,2 +1,27 @@ -/* struct ustat is currently in <linux/types.h>. Good or bad? */ -#include <linux/types.h> +/* 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. + + 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 <sys/types.h> + +struct ustat + { + __daddr_t f_tfree; + __ino_t f_tinode; + char f_fname[6]; + char f_fpack[6]; + }; diff --git a/sysdeps/unix/sysv/linux/xmknod.c b/sysdeps/unix/sysv/linux/xmknod.c new file mode 100644 index 0000000000..cd73849021 --- /dev/null +++ b/sysdeps/unix/sysv/linux/xmknod.c @@ -0,0 +1,48 @@ +/* xmknod call using old-style Unix mknod system call. + Copyright (C) 1991, 1993, 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 <errno.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <sys/sysmacros.h> + +extern int __syscall_mknod (const char *, unsigned short int, + unsigned short int); + +/* 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) +{ + unsigned short int k_dev; + + if (vers != _MKNOD_VER) + { + __set_errno (EINVAL); + return -1; + } + + /* 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); +} + +weak_alias (__xmknod, _xmknod) diff --git a/sysdeps/unix/sysv/sco3.2.4/syscall.h b/sysdeps/unix/sysv/sco3.2.4/sys/syscall.h index 9c03f89759..9c03f89759 100644 --- a/sysdeps/unix/sysv/sco3.2.4/syscall.h +++ b/sysdeps/unix/sysv/sco3.2.4/sys/syscall.h diff --git a/sysdeps/unix/xmknod.c b/sysdeps/unix/xmknod.c index 21bd3f48bd..63d96a0897 100644 --- a/sysdeps/unix/xmknod.c +++ b/sysdeps/unix/xmknod.c @@ -1,21 +1,21 @@ /* 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. */ + Copyright (C) 1991, 1993, 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 <errno.h> #include <sys/types.h> |