diff options
author | Roland McGrath <roland@gnu.org> | 1995-02-18 01:27:10 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1995-02-18 01:27:10 +0000 |
commit | 28f540f45bbacd939bfd07f213bcad2bf730b1bf (patch) | |
tree | 15f07c4c43d635959c6afee96bde71fb1b3614ee /sysdeps/unix/bsd/sun | |
download | glibc-28f540f45bbacd939bfd07f213bcad2bf730b1bf.tar glibc-28f540f45bbacd939bfd07f213bcad2bf730b1bf.tar.gz glibc-28f540f45bbacd939bfd07f213bcad2bf730b1bf.tar.bz2 glibc-28f540f45bbacd939bfd07f213bcad2bf730b1bf.zip |
initial import
Diffstat (limited to 'sysdeps/unix/bsd/sun')
46 files changed, 1809 insertions, 0 deletions
diff --git a/sysdeps/unix/bsd/sun/getdents.S b/sysdeps/unix/bsd/sun/getdents.S new file mode 100644 index 0000000000..f283a5cc71 --- /dev/null +++ b/sysdeps/unix/bsd/sun/getdents.S @@ -0,0 +1,24 @@ +/* Copyright (C) 1991, 1992, 1995 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <sysdep.h> + +SYSCALL__ (getdirentries, 4) + ret + +weak_alias (__getdirentries, getdirentries) diff --git a/sysdeps/unix/bsd/sun/m68k/Dist b/sysdeps/unix/bsd/sun/m68k/Dist new file mode 100644 index 0000000000..cd893ff463 --- /dev/null +++ b/sysdeps/unix/bsd/sun/m68k/Dist @@ -0,0 +1 @@ +sigtramp.c diff --git a/sysdeps/unix/bsd/sun/m68k/Makefile b/sysdeps/unix/bsd/sun/m68k/Makefile new file mode 100644 index 0000000000..ac4121dc2c --- /dev/null +++ b/sysdeps/unix/bsd/sun/m68k/Makefile @@ -0,0 +1,3 @@ +ifeq ($(subdir),signal) +sysdep_routines := $(sysdep_routines) sigtramp +endif diff --git a/sysdeps/unix/bsd/sun/m68k/brk.S b/sysdeps/unix/bsd/sun/m68k/brk.S new file mode 100644 index 0000000000..114fa73c85 --- /dev/null +++ b/sysdeps/unix/bsd/sun/m68k/brk.S @@ -0,0 +1,49 @@ +/* Copyright (C) 1991, 1992, 1994, 1995 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <sysdep.h> + +#ifndef SYS_brk +#define SYS_brk 17 +#endif + +#ifndef HAVE_GNU_LD +#define __end _end +#endif + +.data +.globl ___curbrk +___curbrk: + .long __end + +.text +ENTRY (__brk) + movel __end, d0 + cmpl sp@(4), d0 + ble 0f + movel d0, sp@(4) +0: pea SYS_brk + trap #0 + bcs 1f + movel sp@(4), ___curbrk + clrl d0 + rts +1: + jmp syscall_error + +weak_alias (__brk, brk) diff --git a/sysdeps/unix/bsd/sun/m68k/sethostid.S b/sysdeps/unix/bsd/sun/m68k/sethostid.S new file mode 100644 index 0000000000..8b30f3fe65 --- /dev/null +++ b/sysdeps/unix/bsd/sun/m68k/sethostid.S @@ -0,0 +1,44 @@ +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <sysdep.h> + +#ifdef SYS_sethostid + +SYSCALL (sethostid, 1) + ret + +#else + +#include <errnos.h> + +.globl _sethostid +.even +_sethostid: + movel #ENOSYS, _errno + moveq #-1, d0 + rts + +#ifdef HAVE_GNU_LD + +.stabs "warning: sethostid is not implemented and will always fail",30,0,0,0 +.stabs "_sethostid",1,0,0,0 + +#endif + +#endif diff --git a/sysdeps/unix/bsd/sun/m68k/sigcontext.h b/sysdeps/unix/bsd/sun/m68k/sigcontext.h new file mode 100644 index 0000000000..471b516bdc --- /dev/null +++ b/sysdeps/unix/bsd/sun/m68k/sigcontext.h @@ -0,0 +1,26 @@ +/* Structure describing state saved while handling a signal. Sun 3 version. +Copyright (C) 1993, 1994 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. */ + +struct sigcontext + { + int sc_onstack; + __sigset_t sc_mask; + + int sc_sp, sc_pc, sc_ps; + }; diff --git a/sysdeps/unix/bsd/sun/m68k/sigtramp.c b/sysdeps/unix/bsd/sun/m68k/sigtramp.c new file mode 100644 index 0000000000..32a2c2047e --- /dev/null +++ b/sysdeps/unix/bsd/sun/m68k/sigtramp.c @@ -0,0 +1,142 @@ +/* Copyright (C) 1993 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <ansidecl.h> + +#ifndef __GNUC__ + #error This file uses GNU C extensions; you must compile with GCC. +#endif + +/* Get the definition of `struct sigcontext'. */ +#define KERNEL +#define sigvec sun_sigvec +#define sigstack sun_sigstack +#define sigcontext sun_sigcontext +#include "/usr/include/sys/signal.h" +#undef sigvec +#undef sigstack +#undef sigcontext +#undef NSIG +#undef SIGABRT +#undef SIGCLD +#undef SV_ONSTACK +#undef SV_RESETHAND +#undef SV_INTERRUPT +#undef SA_ONSTACK +#undef SA_NOCLDSTOP +#undef SIG_ERR +#undef SIG_DFL +#undef SIG_IGN +#undef sigmask +#undef SIG_BLOCK +#undef SIG_UNBLOCK +#undef SIG_SETMASK + +#include <signal.h> +#include <stddef.h> +#include <errno.h> + +/* Defined in __sigvec.S. */ +extern int EXFUN(__raw_sigvec, (int sig, CONST struct sigvec *vec, + struct sigvec *ovec)); + +/* User-specified signal handlers. */ +#define mytramp 1 +#ifdef mytramp +static __sighandler_t handlers[NSIG]; +#else +#define handlers _sigfunc +extern __sighandler_t _sigfunc[]; +#endif + +#if mytramp + +/* Handler for all signals that are handled by a user-specified function. + Saves and restores the general regs %g2-%g7, the %y register, and + all the FPU regs (including %fsr), around calling the user's handler. */ +static void +DEFUN(trampoline, (sig, code, context, addr), + int sig AND int code AND struct sigcontext *context AND PTR addr) +{ + int save[4]; + + /* Save the call-clobbered registers. */ + asm volatile ("movem%.l d0-d1/a0-a1, %0" : : "m" (save[0])); + + /* XXX should save/restore FP regs */ + + /* Call the user's handler. */ + (*((void EXFUN((*), (int sig, int code, struct sigcontext *context, + PTR addr))) handlers[sig])) + (sig, code, context, addr); + + /* Restore the call-clobbered registers. */ + asm volatile ("movem%.l %0, d0-d1/a0-a1" : : "g" (save[0]) : + "d0", "d1", "a0", "a1"); + + __sigreturn (context); +} + +#endif + +int +DEFUN(__sigvec, (sig, vec, ovec), + int sig AND CONST struct sigvec *vec AND struct sigvec *ovec) +{ +#ifndef mytramp + extern void _sigtramp (int); +#define trampoline _sigtramp +#endif + struct sigvec myvec; + int mask; + __sighandler_t ohandler; + + if (sig <= 0 || sig >= NSIG) + { + errno = EINVAL; + return -1; + } + + mask = __sigblock(sigmask(sig)); + + ohandler = handlers[sig]; + + if (vec != NULL && + vec->sv_handler != SIG_IGN && vec->sv_handler != SIG_DFL) + { + handlers[sig] = vec->sv_handler; + myvec = *vec; + myvec.sv_handler = trampoline; + vec = &myvec; + } + + if (__raw_sigvec(sig, vec, ovec) < 0) + { + int save = errno; + (void) __sigsetmask(mask); + errno = save; + return -1; + } + + if (ovec != NULL && ovec->sv_handler == trampoline) + ovec->sv_handler = ohandler; + + (void) __sigsetmask(mask); + + return 0; +} diff --git a/sysdeps/unix/bsd/sun/m68k/syscall.S b/sysdeps/unix/bsd/sun/m68k/syscall.S new file mode 100644 index 0000000000..0a98da7c67 --- /dev/null +++ b/sysdeps/unix/bsd/sun/m68k/syscall.S @@ -0,0 +1,28 @@ +/* Copyright (C) 1993 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <sysdep.h> + +ENTRY (syscall) + movel sp@, d0 /* Save return address in D0. */ + movel sp@(4), sp@ /* Put syscall number at top of stack. */ + movel d0, sp@(4) /* Put return address under it. */ + trap #0 /* Do syscall; pops number from stack. */ + jcs error + ret +error: jmp syscall_error diff --git a/sysdeps/unix/bsd/sun/m68k/sysdep.h b/sysdeps/unix/bsd/sun/m68k/sysdep.h new file mode 100644 index 0000000000..80f6aba7b0 --- /dev/null +++ b/sysdeps/unix/bsd/sun/m68k/sysdep.h @@ -0,0 +1,62 @@ +/* Copyright (C) 1991, 1992, 1994, 1995 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <sysdeps/unix/sysdep.h> + +#ifdef ASSEMBLER + +#define POUND # + +#ifdef __STDC__ +#define ENTRY(name) \ + .globl _##name; \ + .even; \ + _##name##: +#else +#define ENTRY(name) \ + .globl _/**/name; \ + .even; \ + _/**/name/**/: +#endif + +#ifdef __STDC__ +#define PSEUDO(name, syscall_name, args) \ + .even; \ + .globl syscall_error; \ + error: jmp syscall_error; \ + ENTRY (name) \ + pea SYS_##syscall_name; \ + trap POUND 0; \ + bcs error +#else +#define PSEUDO(name, syscall_name, args) \ + .even; \ + .globl syscall_error; \ + error: jmp syscall_error; \ + ENTRY (name) \ + pea SYS_/**/syscall_name; \ + trap POUND 0; \ + bcs error +#endif + +#define ret rts +#define r0 d0 +#define r1 d1 +#define MOVE(x,y) movel x , y + +#endif /* ASSEMBLER */ diff --git a/sysdeps/unix/bsd/sun/sethostid.c b/sysdeps/unix/bsd/sun/sethostid.c new file mode 100644 index 0000000000..a8951fa7d5 --- /dev/null +++ b/sysdeps/unix/bsd/sun/sethostid.c @@ -0,0 +1 @@ +#include <sysdeps/stub/sethostid.c> diff --git a/sysdeps/unix/bsd/sun/signum.h b/sysdeps/unix/bsd/sun/signum.h new file mode 100644 index 0000000000..ea83d710f6 --- /dev/null +++ b/sysdeps/unix/bsd/sun/signum.h @@ -0,0 +1,69 @@ +/* Signal number definitions. SunOS version. +Copyright (C) 1994 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. */ + +#ifdef _SIGNAL_H + +/* This file defines the fake signal functions and signal + number constants for SunOS 3 and 4 Unix systems. */ + +/* Fake signal functions. */ +#define SIG_ERR ((__sighandler_t) -1) /* Error return. */ +#define SIG_DFL ((__sighandler_t) 0) /* Default action. */ +#define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */ + + +/* Signals. */ +#define SIGHUP 1 /* Hangup (POSIX). */ +#define SIGINT 2 /* Interrupt (ANSI). */ +#define SIGQUIT 3 /* Quit (POSIX). */ +#define SIGILL 4 /* Illegal instruction (ANSI). */ +#define SIGABRT SIGIOT /* Abort (ANSI). */ +#define SIGTRAP 5 /* Trace trap (POSIX). */ +#define SIGIOT 6 /* IOT trap (4.2 BSD). */ +#define SIGEMT 7 /* EMT trap (4.2 BSD). */ +#define SIGFPE 8 /* Floating-point exception (ANSI). */ +#define SIGKILL 9 /* Kill, unblockable (POSIX). */ +#define SIGBUS 10 /* Bus error (4.2 BSD). */ +#define SIGSEGV 11 /* Segmentation violation (ANSI). */ +#define SIGSYS 12 /* Bad argument to system call (4.2 BSD). */ +#define SIGPIPE 13 /* Broken pipe (POSIX). */ +#define SIGALRM 14 /* Alarm clock (POSIX). */ +#define SIGTERM 15 /* Termination (ANSI). */ +#define SIGURG 16 /* Urgent condition on socket (4.2 BSD). */ +#define SIGSTOP 17 /* Stop, unblockable (POSIX). */ +#define SIGTSTP 18 /* Keyboard stop (POSIX). */ +#define SIGCONT 19 /* Continue (POSIX). */ +#define SIGCHLD 20 /* Child status has changed (POSIX). */ +#define SIGCLD SIGCHLD /* Same as SIGCHLD (System V). */ +#define SIGTTIN 21 /* Background read from tty (POSIX). */ +#define SIGTTOU 22 /* Background write to tty (POSIX). */ +#define SIGIO 23 /* I/O now possible (4.2 BSD). */ +#define SIGPOLL SIGIO /* Same as SIGIO? (SVID). */ +#define SIGXCPU 24 /* CPU limit exceeded (4.2 BSD). */ +#define SIGXFSZ 25 /* File size limit exceeded (4.2 BSD). */ +#define SIGVTALRM 26 /* Virtual alarm clock (4.2 BSD). */ +#define SIGPROF 27 /* Profiling alarm clock (4.2 BSD). */ +#define SIGWINCH 28 /* Window size change (4.3 BSD, Sun). */ +#define SIGLOST 29 /* Resource lost (Sun). */ +#define SIGUSR1 30 /* User-defined signal 1 (POSIX). */ +#define SIGUSR2 31 /* User-defined signal 2 (POSIX). */ + +#endif /* <signal.h> included. */ + +#define _NSIG 32 /* Biggest signal number + 1. */ diff --git a/sysdeps/unix/bsd/sun/sigreturn.S b/sysdeps/unix/bsd/sun/sigreturn.S new file mode 100644 index 0000000000..d0a3f3a56b --- /dev/null +++ b/sysdeps/unix/bsd/sun/sigreturn.S @@ -0,0 +1,28 @@ +/* Copyright (C) 1993, 1995 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <sysdep.h> + +#ifndef SYS_sigreturn +#define SYS_sigreturn 139 +#endif + +SYSCALL__ (sigreturn, 1) + /* Does not return. */ + +weak_alias (__sigreturn, sigreturn) diff --git a/sysdeps/unix/bsd/sun/sigvec.S b/sysdeps/unix/bsd/sun/sigvec.S new file mode 100644 index 0000000000..c09397486f --- /dev/null +++ b/sysdeps/unix/bsd/sun/sigvec.S @@ -0,0 +1,26 @@ +/* Copyright (C) 1991, 1992, 1995 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <sysdep.h> + +/* __sigvec is defined by sigtramp.c. */ + +PSEUDO (__raw_sigvec, sigvec, 3) + ret + +weak_alias (__sigvec, sigvec) diff --git a/sysdeps/unix/bsd/sun/sparc/Dist b/sysdeps/unix/bsd/sun/sparc/Dist new file mode 100644 index 0000000000..cd893ff463 --- /dev/null +++ b/sysdeps/unix/bsd/sun/sparc/Dist @@ -0,0 +1 @@ +sigtramp.c diff --git a/sysdeps/unix/bsd/sun/sparc/Makefile b/sysdeps/unix/bsd/sun/sparc/Makefile new file mode 100644 index 0000000000..59d10dbdbf --- /dev/null +++ b/sysdeps/unix/bsd/sun/sparc/Makefile @@ -0,0 +1,7 @@ +# Basically `-e start' is magical to the Sun linker. You would think that +# having start.o first would be enough, but you would be wrong. +LDFLAGS := $(LDFLAGS) -Xlinker -e -Xlinker start + +ifeq ($(subdir),signal) +sysdep_routines := $(sysdep_routines) sigtramp +endif diff --git a/sysdeps/unix/bsd/sun/sparc/sethostid.S b/sysdeps/unix/bsd/sun/sparc/sethostid.S new file mode 100644 index 0000000000..fbafba5277 --- /dev/null +++ b/sysdeps/unix/bsd/sun/sparc/sethostid.S @@ -0,0 +1,46 @@ +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <sysdep.h> + +#ifdef SYS_sethostid + +SYSCALL (sethostid, 1) + ret + +#else + +/* <errnos.h> only defines E* #ifdef _ERRNO_H. */ +#define _ERRNO_H +#include <errnos.h> + +ENTRY (sethostid) + mov ENOSYS, %o0 + sethi %hi(_errno), %g1 + st %o0, [%g1 + %lo(_errno)] + retl + sub %g0, 1, %o0 + +#ifdef HAVE_GNU_LD + +.stabs "warning: sethostid is not implemented and will always fail",30,0,0,0 +.stabs "_sethostid",1,0,0,0 + +#endif + +#endif diff --git a/sysdeps/unix/bsd/sun/sparc/sigcontext.h b/sysdeps/unix/bsd/sun/sparc/sigcontext.h new file mode 100644 index 0000000000..290bf817af --- /dev/null +++ b/sysdeps/unix/bsd/sun/sparc/sigcontext.h @@ -0,0 +1,31 @@ +/* Structure describing state saved while handling a signal. Sparc version. +Copyright (C) 1992, 1994 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. */ + +struct sigcontext + { + int sc_onstack; + __sigset_t sc_mask; + +#define SPARC_MAXREGWINDOW 31 /* Maximum usable register windows. */ + int sc_sp, sc_pc, sc_npc, sc_psr, sc_g1, sc_o0; + int sc_wbcnt; /* Number of outstanding windows. */ + __ptr_t sc_spbuf[SPARC_MAXREGWINDOW]; /* SP's for each window. */ + int sc_wbuf[SPARC_MAXREGWINDOW][16]; /* Saved register windows. */ + }; + diff --git a/sysdeps/unix/bsd/sun/sparc/sigtramp.c b/sysdeps/unix/bsd/sun/sparc/sigtramp.c new file mode 100644 index 0000000000..54f62933a8 --- /dev/null +++ b/sysdeps/unix/bsd/sun/sparc/sigtramp.c @@ -0,0 +1,246 @@ +/* Copyright (C) 1991, 1992, 1994 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <ansidecl.h> + +#ifndef __GNUC__ + #error This file uses GNU C extensions; you must compile with GCC. +#endif + +/* Get the definition of `struct sigcontext'. */ +#define KERNEL +#define sigvec sun_sigvec +#define sigstack sun_sigstack +#define sigcontext sun_sigcontext +#include "/usr/include/sys/signal.h" +#undef sigvec +#undef sigstack +#undef sigcontext +#undef NSIG +#undef SIGABRT +#undef SIGCLD +#undef SV_ONSTACK +#undef SV_RESETHAND +#undef SV_INTERRUPT +#undef SA_ONSTACK +#undef SA_NOCLDSTOP +#undef SIG_ERR +#undef SIG_DFL +#undef SIG_IGN +#undef sigmask +#undef SIG_BLOCK +#undef SIG_UNBLOCK +#undef SIG_SETMASK + +#include <signal.h> +#include <stddef.h> +#include <errno.h> + +/* Defined in __sigvec.S. */ +extern int EXFUN(__raw_sigvec, (int sig, CONST struct sigvec *vec, + struct sigvec *ovec)); + +/* User-specified signal handlers. */ +#define mytramp 1 +#ifdef mytramp +static __sighandler_t handlers[NSIG]; +#else +#define handlers _sigfunc +extern __sighandler_t _sigfunc[]; +#endif + +#if mytramp + +/* Handler for all signals that are handled by a user-specified function. + Saves and restores the general regs %g2-%g7, the %y register, and + all the FPU regs (including %fsr), around calling the user's handler. */ +static void +DEFUN(trampoline, (sig), int sig) +{ + /* We use `double' and `long long int' so `std' (store doubleword) insns, + which might be faster than single-word stores, will be generated. */ + register double f0 asm("%f0"); + register double f2 asm("%f2"); + register double f4 asm("%f4"); + register double f6 asm("%f6"); + register double f8 asm("%f8"); + register double f10 asm("%f10"); + register double f12 asm("%f12"); + register double f14 asm("%f14"); + register double f16 asm("%f16"); + register double f18 asm("%f18"); + register double f20 asm("%f20"); + register double f22 asm("%f22"); + register double f24 asm("%f24"); + register double f26 asm("%f26"); + register double f28 asm("%f28"); + register double f30 asm("%f30"); + register long long int g2 asm("%g2"); + register long long int g4 asm("%g4"); + register long long int g6 asm("%g6"); + register int *fp asm("%fp"); + + int code; + register struct sigcontext *context asm("%i0"); /* See end of fn. */ + PTR addr; + int y; + double fpsave[16]; + int fsr; + int savefpu; + long long int glsave[3]; + + /* SIG isn't really passed as an arg. + The args to the signal handler are at fp[16..19]. */ + sig = fp[16]; + code = fp[17]; + context = (struct sigcontext *) fp[18]; + addr = (PTR) fp[19]; + + /* Save the Y register. */ + asm("rd %%y, %0" : "=r" (y)); + + /* Save the FPU regs if the FPU enable bit is set in the PSR, + and the signal isn't an FP exception. */ + savefpu = (context->sc_psr & 0x1000) && sig != SIGFPE; + if (savefpu) + { + fpsave[0] = f0; + fpsave[1] = f2; + fpsave[2] = f4; + fpsave[3] = f6; + fpsave[4] = f8; + fpsave[5] = f10; + fpsave[6] = f12; + fpsave[7] = f14; + fpsave[8] = f16; + fpsave[9] = f18; + fpsave[10] = f20; + fpsave[11] = f22; + fpsave[12] = f24; + fpsave[13] = f26; + fpsave[14] = f28; + fpsave[15] = f30; + + /* Force it into a stack slot so the asm won't barf. Sigh. */ + (void) &fsr; + asm("st %%fsr, %0" : "=m" (fsr)); + } + + /* Save the global registers (except for %g1, which is a scratch reg). */ + glsave[0] = g2; + glsave[1] = g4; + glsave[2] = g6; + + /* Call the user's handler. */ + (*((void EXFUN((*), (int sig, int code, struct sigcontext *context, + PTR addr))) handlers[sig])) + (sig, code, context, addr); + + /* Restore the Y register. */ + asm("mov %0, %%y" : : "r" (y)); + + if (savefpu) + { + /* Restore the FPU regs. */ + f0 = fpsave[0]; + f2 = fpsave[1]; + f4 = fpsave[2]; + f6 = fpsave[3]; + f8 = fpsave[4]; + f10 = fpsave[5]; + f12 = fpsave[6]; + f14 = fpsave[7]; + f16 = fpsave[8]; + f18 = fpsave[9]; + f20 = fpsave[10]; + f22 = fpsave[11]; + f24 = fpsave[12]; + f26 = fpsave[13]; + f28 = fpsave[14]; + f30 = fpsave[15]; + + asm("ld %0, %%fsr" : : "m" (fsr)); + } + + /* Restore the globals. */ + g2 = glsave[0]; + g4 = glsave[1]; + g6 = glsave[2]; + + /* Unwind a frame, and do a "sigcleanup" system call. + The system call apparently does a return. + I don't know what it's for. Ask Sun. */ + asm("restore %%g0, 139, %%g1\n" + "ta 0\n" + "! this should be i0: %0" /* Useless insn that will never be executed, */ + /* here to make the compiler happy. */ + : /* No outputs. */ : + /* CONTEXT is bound to %i0. We reference it as an input here to make + sure the compiler considers it live at this point, and preserves + the value in that register. The restore makes %i0 become %o0, the + argument to the system call. */ + "r" (context)); +} +#endif + +int +DEFUN(__sigvec, (sig, vec, ovec), + int sig AND CONST struct sigvec *vec AND struct sigvec *ovec) +{ +#ifndef mytramp + extern void _sigtramp (int); +#define trampoline _sigtramp +#endif + struct sigvec myvec; + int mask; + __sighandler_t ohandler; + + if (sig <= 0 || sig >= NSIG) + { + errno = EINVAL; + return -1; + } + + mask = __sigblock(sigmask(sig)); + + ohandler = handlers[sig]; + + if (vec != NULL && + vec->sv_handler != SIG_IGN && vec->sv_handler != SIG_DFL) + { + handlers[sig] = vec->sv_handler; + myvec = *vec; + myvec.sv_handler = trampoline; + vec = &myvec; + } + + if (__raw_sigvec(sig, vec, ovec) < 0) + { + int save = errno; + (void) __sigsetmask(mask); + errno = save; + return -1; + } + + if (ovec != NULL && ovec->sv_handler == trampoline) + ovec->sv_handler = ohandler; + + (void) __sigsetmask(mask); + + return 0; +} diff --git a/sysdeps/unix/bsd/sun/sunos3/m68k/wait.S b/sysdeps/unix/bsd/sun/sunos3/m68k/wait.S new file mode 100644 index 0000000000..f69c4b4431 --- /dev/null +++ b/sysdeps/unix/bsd/sun/sunos3/m68k/wait.S @@ -0,0 +1 @@ +#include <sysdeps/unix/bsd/hp/m68k/wait.S> diff --git a/sysdeps/unix/bsd/sun/sunos4/.cvsignore b/sysdeps/unix/bsd/sun/sunos4/.cvsignore new file mode 100644 index 0000000000..1f69fd919a --- /dev/null +++ b/sysdeps/unix/bsd/sun/sunos4/.cvsignore @@ -0,0 +1,4 @@ +*.gz *.Z *.tar *.tgz +=* +TODO COPYING* AUTHORS copyr-* copying.* +glibc-* diff --git a/sysdeps/unix/bsd/sun/sunos4/Dist b/sysdeps/unix/bsd/sun/sunos4/Dist new file mode 100644 index 0000000000..f1c9046516 --- /dev/null +++ b/sysdeps/unix/bsd/sun/sunos4/Dist @@ -0,0 +1,2 @@ +sys_wait4.S +sys_mmap.S diff --git a/sysdeps/unix/bsd/sun/sunos4/Implies b/sysdeps/unix/bsd/sun/sunos4/Implies new file mode 100644 index 0000000000..c99e256ac1 --- /dev/null +++ b/sysdeps/unix/bsd/sun/sunos4/Implies @@ -0,0 +1,2 @@ +# SunOS 4 has the canonical set of <sys/mman.h> system calls. +unix/mman diff --git a/sysdeps/unix/bsd/sun/sunos4/Makefile b/sysdeps/unix/bsd/sun/sunos4/Makefile new file mode 100644 index 0000000000..96b88e1b72 --- /dev/null +++ b/sysdeps/unix/bsd/sun/sunos4/Makefile @@ -0,0 +1,7 @@ +ifeq ($(subdir), posix) +sysdep_routines := $(sysdep_routines) sys_wait4 +endif + +ifeq ($(subdir), misc) +sysdep_routines := $(sysdep_routines) sys_mmap +endif diff --git a/sysdeps/unix/bsd/sun/sunos4/fcntlbits.h b/sysdeps/unix/bsd/sun/sunos4/fcntlbits.h new file mode 100644 index 0000000000..210072222c --- /dev/null +++ b/sysdeps/unix/bsd/sun/sunos4/fcntlbits.h @@ -0,0 +1,145 @@ +/* O_*, F_*, FD_* bit values for SunOS 4. +Copyright (C) 1991, 1992 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. */ + +#ifndef _FCNTLBITS_H + +#define _FCNTLBITS_H 1 + + +/* File access modes for `open' and `fcntl'. */ +#define O_RDONLY 0 /* Open read-only. */ +#define O_WRONLY 1 /* Open write-only. */ +#define O_RDWR 2 /* Open read/write. */ + + +/* Bits OR'd into the second argument to open. */ +#define O_CREAT 0x0200 /* Create file if it doesn't exist. */ +#define O_EXCL 0x0800 /* Fail if file already exists. */ +#define O_TRUNC 0x0400 /* Truncate file to zero length. */ +#define O_NOCTTY 0x8000 /* Don't assign a controlling terminal. */ +#if defined (__USE_BSD) || defined (__USE_SVID) +#define O_ASYNC 0x0040 /* Send SIGIO to owner when data is ready. */ +#define O_FSYNC 0x2000 /* Synchronous writes. */ +#define O_SYNC O_FSYNC +#endif + +/* File status flags for `open' and `fcntl'. */ +#define O_APPEND 0x0008 /* Writes append to the file. */ +#define O_NONBLOCK 0x4000 /* Non-blocking I/O. */ + +/* Sun defines O_NDELAY one way for BSD behavior and another for System V + behavior. In the GNU C library, you get the BSD behavior unless you + define _USG_SOURCE without also defining _BSD_SOURCE or _GNU_SOURCE. */ +#ifdef __USE_BSD +#define O_NDELAY 0x0004 +#endif +#if !defined (O_NDELAY) && defined (__USE_SVID) +#define O_NDELAY 0x1000 +#endif + +#ifdef __USE_BSD +/* Bits in the file status flags returned by F_GETFL. + These are all the O_* flags, plus FREAD and FWRITE, which are + independent bits set by which of O_RDONLY, O_WRONLY, and O_RDWR, was + given to `open'. */ +#define FREAD 1 +#define FWRITE 2 + +/* Traditional Unix names the O_* bits. */ +#define FASYNC O_ASYNC +#define FCREAT O_CREAT +#define FEXCL O_EXCL +#define FTRUNC O_TRUNC +#define FNOCTTY O_NOCTTY +#define FFSYNC O_FSYNC +#define FSYNC O_SYNC +#define FAPPEND O_APPEND +#define FNONBLOCK O_NONBLOCK +#define FNONBIO O_NONBLOCK +#define FNDELAY 0x0004 /* BSD O_NDELAY. */ +#define FNBIO 0x1000 /* System V O_NDELAY. */ +#endif + +/* Mask for file access modes. This is system-dependent in case + some system ever wants to define some other flavor of access. */ +#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR) + +/* Values for the second argument to `fcntl'. */ +#define F_DUPFD 0 /* Duplicate file descriptor. */ +#define F_GETFD 1 /* Get file descriptor flags. */ +#define F_SETFD 2 /* Set file descriptor flags. */ +#define F_GETFL 3 /* Get file status flags. */ +#define F_SETFL 4 /* Set file status flags. */ +#ifdef __USE_BSD +#define F_GETOWN 5 /* Get owner (receiver of SIGIO). */ +#define F_SETOWN 6 /* Set owner (receiver of SIGIO). */ +#endif +#define F_GETLK 7 /* Get record locking info. */ +#define F_SETLK 8 /* Set record locking info (non-blocking). */ +#define F_SETLKW 9 /* Set record locking info (blocking). */ +#ifdef __USE_BSD +#define F_RGETLK 10 /* Get remote record locking info. */ +#define F_RSETLK 11 /* Set remote locking info (non-blocking). */ +#define F_CNVT 12 /* Convert a fhandle to an open fd. */ +#define F_RSETLKW 13 /* Set remote locking info (blocking). */ +#endif + +/* File descriptor flags used with F_GETFD and F_SETFD. */ +#define FD_CLOEXEC 1 /* Close on exec. */ + + +#include <gnu/types.h> + +/* The structure describing an advisory lock. This is the type of the third + argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests. */ +struct flock + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ + __off_t l_start; /* Offset where the lock begins. */ + __off_t l_len; /* Size of the locked area; zero means until EOF. */ + short int l_pid; /* Process holding the lock. */ + short int l_xxx; /* Reserved for future use. */ + }; + +#ifdef __USE_BSD +/* The structure describing a remote advisory lock. This is the type of the + third arg to `fcntl' for the F_RGETLK, F_RSETLK, and F_RSETLKW requests. */ +struct eflock + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ + __off_t l_start; /* Offset where the lock begins. */ + __off_t l_len; /* Size of the locked area; zero means until EOF. */ + short int l_pid; /* Process holding the lock. */ + short int l_xxx; /* Reserved for future use. */ + long int l_rpid; /* Remote process ID wanting this lock. */ + long int l_rsys; /* Remote system ID wanting this lock. */ + }; + +#endif + + +/* Values for the `l_type' field of a `struct flock'. */ +#define F_RDLCK 1 /* Read lock. */ +#define F_WRLCK 2 /* Write lock. */ +#define F_UNLCK 3 /* Remove lock. */ + + +#endif /* fcntlbits.h */ diff --git a/sysdeps/unix/bsd/sun/sunos4/mmap.c b/sysdeps/unix/bsd/sun/sunos4/mmap.c new file mode 100644 index 0000000000..4dfc1ca2da --- /dev/null +++ b/sysdeps/unix/bsd/sun/sunos4/mmap.c @@ -0,0 +1,41 @@ +/* Copyright (C) 1994 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <sys/types.h> +#include <sys/mman.h> +#include <errno.h> + +/* Map addresses starting near ADDR and extending for LEN bytes. from + OFFSET into the file FD describes according to PROT and FLAGS. If ADDR + is nonzero, it is the desired mapping address. If the MAP_FIXED bit is + set in FLAGS, the mapping will be at ADDR exactly (which must be + page-aligned); otherwise the system chooses a convenient nearby address. + The return value is the actual mapping address chosen or (caddr_t) -1 + for errors (in which case `errno' is set). A successful `mmap' call + deallocates any previous mapping for the affected region. */ + +extern caddr_t __mmap_syscall (caddr_t addr, size_t len, + int prot, int flags, int fd, off_t offset); + + +caddr_t +mmap (caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset) +{ + return __mmap_syscall (addr, len, prot, flags | _MAP_NEW, fd, offset); +} + diff --git a/sysdeps/unix/bsd/sun/sunos4/msync.S b/sysdeps/unix/bsd/sun/sunos4/msync.S new file mode 100644 index 0000000000..9fb8955dc2 --- /dev/null +++ b/sysdeps/unix/bsd/sun/sunos4/msync.S @@ -0,0 +1,22 @@ +/* Copyright (C) 1994 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <sysdep.h> + +SYSCALL (msync, 3) + ret diff --git a/sysdeps/unix/bsd/sun/sunos4/poll.S b/sysdeps/unix/bsd/sun/sunos4/poll.S new file mode 100644 index 0000000000..95c4fd2f82 --- /dev/null +++ b/sysdeps/unix/bsd/sun/sunos4/poll.S @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/poll.S> diff --git a/sysdeps/unix/bsd/sun/sunos4/resourcebits.h b/sysdeps/unix/bsd/sun/sunos4/resourcebits.h new file mode 100644 index 0000000000..b5d3704e6c --- /dev/null +++ b/sysdeps/unix/bsd/sun/sunos4/resourcebits.h @@ -0,0 +1,48 @@ +/* Bit values for resource limits. SunOS 4 version. +Copyright (C) 1994 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. */ + +/* These are the values for 4.4 BSD and GNU. Earlier BSD systems have a + subset of these kinds of resource limit. In systems where `getrlimit' + and `setrlimit' are not system calls, these are the values used by the C + library to emulate them. */ + +/* Kinds of resource limit. */ +enum __rlimit_resource + { + /* Per-process CPU limit, in seconds. */ + RLIMIT_CPU, + /* Largest file that can be created, in bytes. */ + RLIMIT_FSIZE, + /* Maximum size of data segment, in bytes. */ + RLIMIT_DATA, + /* Maximum size of stack segment, in bytes. */ + RLIMIT_STACK, + /* Largest core file that can be created, in bytes. */ + RLIMIT_CORE, + /* Largest resident set size, in bytes. + This affects swapping; processes that are exceeding their + resident set size will be more likely to have physical memory + taken from them. */ + RLIMIT_RSS, + /* Number of open files. */ + RLIMIT_NOFILE, + RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same. */ + + RLIM_NLIMITS + }; diff --git a/sysdeps/unix/bsd/sun/sunos4/setsid.S b/sysdeps/unix/bsd/sun/sunos4/setsid.S new file mode 100644 index 0000000000..4930c56dcf --- /dev/null +++ b/sysdeps/unix/bsd/sun/sunos4/setsid.S @@ -0,0 +1 @@ +#include <sysdeps/unix/bsd/bsd4.4/setsid.S> diff --git a/sysdeps/unix/bsd/sun/sunos4/speed.c b/sysdeps/unix/bsd/sun/sunos4/speed.c new file mode 100644 index 0000000000..1c09d55dab --- /dev/null +++ b/sysdeps/unix/bsd/sun/sunos4/speed.c @@ -0,0 +1,113 @@ +/* `struct termios' speed frobnication functions. SunOS 4 version. +Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <ansidecl.h> +#include <stddef.h> +#include <errno.h> +#include <termios.h> + +static CONST speed_t speeds[] = + { + 0, + 50, + 75, + 110, + 134, + 150, + 200, + 300, + 600, + 1200, + 1800, + 2400, + 4800, + 9600, + 19200, + 38400, + }; + + +/* Return the output baud rate stored in *TERMIOS_P. */ +speed_t +DEFUN(cfgetospeed, (termios_p), CONST struct termios *termios_p) +{ + return termios_p->c_cflag & CBAUD; +} + +/* Return the input baud rate stored in *TERMIOS_P. */ +speed_t +DEFUN(cfgetispeed, (termios_p), CONST struct termios *termios_p) +{ + return (termios_p->c_cflag & CIBAUD) >> IBSHIFT; +} + +/* 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) +{ + register unsigned int i; + + if (termios_p == NULL) + { + errno = EINVAL; + return -1; + } + + /* This allows either B1200 or 1200 to work. XXX + Do we really want to try to support this, given that + fetching the speed must return one or the other? */ + + for (i = 0; i < sizeof (speeds) / sizeof (speeds[0]); ++i) + if (i == speed || speeds[i] == speed) + { + termios_p->c_cflag &= ~CBAUD; + termios_p->c_cflag |= i; + return 0; + } + + errno = EINVAL; + return -1; +} + +/* 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) +{ + register unsigned int i; + + if (termios_p == NULL) + { + errno = EINVAL; + return -1; + } + + /* See comment in cfsetospeed (above). */ + for (i = 0; i < sizeof (speeds) / sizeof (speeds[0]); ++i) + if (i == speed || speeds[i] == speed) + { + termios_p->c_cflag &= ~CIBAUD; + termios_p->c_cflag |= i << IBSHIFT; + return 0; + } + + errno = EINVAL; + return -1; +} diff --git a/sysdeps/unix/bsd/sun/sunos4/sys/mman.h b/sysdeps/unix/bsd/sun/sunos4/sys/mman.h new file mode 100644 index 0000000000..727e665fb6 --- /dev/null +++ b/sysdeps/unix/bsd/sun/sunos4/sys/mman.h @@ -0,0 +1,107 @@ +/* Definitions for BSD-style memory management. SunOS 4 version. +Copyright (C) 1994 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. */ + +#ifndef _SYS_MMAN_H + +#define _SYS_MMAN_H 1 +#include <features.h> + +#include <gnu/types.h> +#define __need_size_t +#include <stddef.h> + + +/* Protections are chosen from these bits, OR'd together. The + implementation does not necessarily support PROT_EXEC or PROT_WRITE + without PROT_READ. The only guarantees are that no writing will be + allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */ + +#define PROT_NONE 0x00 /* No access. */ +#define PROT_READ 0x01 /* Pages can be read. */ +#define PROT_WRITE 0x02 /* Pages can be written. */ +#define PROT_EXEC 0x04 /* Pages can be executed. */ + + +/* Sharing types (must choose one and only one of these). */ +#define MAP_SHARED 0x01 /* Share changes. */ +#define MAP_PRIVATE 0x02 /* Changes private; copy pages on write. */ +#define MAP_TYPE 0x0f /* Mask for sharing type. */ + +/* Other flags. */ +#define MAP_FIXED 0x10 /* Map address must be exactly as requested. */ +/* The following three flags are not actually implemented in SunOS 4.1. */ +#define MAP_RENAME 0x20 /* Rename private pages to file. */ +#define MAP_NORESERVE 0x40 /* Don't reserve needed swap area. */ +#define MAP_INHERIT 0x80 /* Region is retained after exec. */ + +/* This is an internal flag that is always set in `mmap' system calls. In + older versions of SunOS 4 `mmap' did not return the actual mapping + address, but always returned zero. This flag says to return the + address; the `mmap' C library function always sets it. */ +#define _MAP_NEW 0x80000000 + +/* Advice to `madvise'. */ +#define MADV_NORMAL 0 /* No further special treatment. */ +#define MADV_RANDOM 1 /* Expect random page references. */ +#define MADV_SEQUENTIAL 2 /* Expect sequential page references. */ +#define MADV_WILLNEED 3 /* Will need these pages. */ +#define MADV_DONTNEED 4 /* Don't need these pages. */ + +/* Flags to `msync'. */ +#define MS_ASYNC 0x1 /* Return immediately, don't fsync. */ +#define MS_INVALIDATE 0x2 /* Invalidate caches. */ + + +#include <sys/cdefs.h> + +__BEGIN_DECLS +/* Map addresses starting near ADDR and extending for LEN bytes. from + OFFSET into the file FD describes according to PROT and FLAGS. If ADDR + is nonzero, it is the desired mapping address. If the MAP_FIXED bit is + set in FLAGS, the mapping will be at ADDR exactly (which must be + page-aligned); otherwise the system chooses a convenient nearby address. + The return value is the actual mapping address chosen or (caddr_t) -1 + for errors (in which case `errno' is set). A successful `mmap' call + deallocates any previous mapping for the affected region. */ + +__caddr_t mmap __P ((__caddr_t __addr, size_t __len, + int __prot, int __flags, int __fd, __off_t __offset)); + +/* Deallocate any mapping for the region starting at ADDR and extending LEN + bytes. Returns 0 if successful, -1 for errors (and sets errno). */ +int munmap __P ((__caddr_t __addr, size_t __len)); + +/* Change the memory protection of the region starting at ADDR and + extending LEN bytes to PROT. Returns 0 if successful, -1 for errors + (and sets errno). */ +int mprotect __P ((__caddr_t __addr, size_t __len, int __prot)); + +/* Synchronize the region starting at ADDR and extending LEN bytes with the + file it maps. Filesystem operations on a file being mapped are + unpredictable before this is done. */ +int msync __P ((__caddr_t __addr, size_t __len, int __flags)); + +/* Advise the system about particular usage patterns the program follows + for the region starting at ADDR and extending LEN bytes. */ +int madvise __P ((__caddr_t __addr, size_t __len, int __advice)); + +__END_DECLS + + +#endif /* sys/mman.h */ diff --git a/sysdeps/unix/bsd/sun/sunos4/sys_mmap.S b/sysdeps/unix/bsd/sun/sunos4/sys_mmap.S new file mode 100644 index 0000000000..61fe877342 --- /dev/null +++ b/sysdeps/unix/bsd/sun/sunos4/sys_mmap.S @@ -0,0 +1,22 @@ +/* Copyright (C) 1994 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <sysdep.h> + +PSEUDO (__mmap_syscall, mmap, 5) + ret diff --git a/sysdeps/unix/bsd/sun/sunos4/sys_wait4.S b/sysdeps/unix/bsd/sun/sunos4/sys_wait4.S new file mode 100644 index 0000000000..6b796b7ea6 --- /dev/null +++ b/sysdeps/unix/bsd/sun/sunos4/sys_wait4.S @@ -0,0 +1,22 @@ +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <sysdep.h> + +PSEUDO (__wait4_syscall, wait4, 4) + ret diff --git a/sysdeps/unix/bsd/sun/sunos4/system.c b/sysdeps/unix/bsd/sun/sunos4/system.c new file mode 100644 index 0000000000..2c8e634bc8 --- /dev/null +++ b/sysdeps/unix/bsd/sun/sunos4/system.c @@ -0,0 +1,2 @@ +/* SunOS 4 does have `waitpid'. Avoid unix/system.c, which says we don't. */ +#include <sysdeps/posix/system.c> diff --git a/sysdeps/unix/bsd/sun/sunos4/tcflow.c b/sysdeps/unix/bsd/sun/sunos4/tcflow.c new file mode 100644 index 0000000000..bb9a7fc7a0 --- /dev/null +++ b/sysdeps/unix/bsd/sun/sunos4/tcflow.c @@ -0,0 +1,29 @@ +/* Copyright (C) 1993 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <ansidecl.h> +#include <errno.h> +#include <termios.h> +#include <sys/ioctl.h> + +/* Suspend or restart transmission on FD. */ +int +DEFUN(tcflow, (fd, action), int fd AND int action) +{ + return __ioctl (fd, TCXONC, action); +} diff --git a/sysdeps/unix/bsd/sun/sunos4/tcflush.c b/sysdeps/unix/bsd/sun/sunos4/tcflush.c new file mode 100644 index 0000000000..d76fc07cf0 --- /dev/null +++ b/sysdeps/unix/bsd/sun/sunos4/tcflush.c @@ -0,0 +1,29 @@ +/* Copyright (C) 1993 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <ansidecl.h> +#include <errno.h> +#include <termios.h> +#include <sys/ioctl.h> + +/* Flush pending data on FD. */ +int +DEFUN(tcflush, (fd, queue_selector), int fd AND int queue_selector) +{ + return __ioctl (fd, TCFLSH, queue_selector); +} diff --git a/sysdeps/unix/bsd/sun/sunos4/tcgetattr.c b/sysdeps/unix/bsd/sun/sunos4/tcgetattr.c new file mode 100644 index 0000000000..5e45037bb2 --- /dev/null +++ b/sysdeps/unix/bsd/sun/sunos4/tcgetattr.c @@ -0,0 +1,33 @@ +/* Copyright (C) 1993, 1995 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <ansidecl.h> +#include <errno.h> +#include <stddef.h> +#include <termios.h> +#include <sys/ioctl.h> + +/* Put the state of FD into *TERMIOS_P. */ +int +DEFUN(__tcgetattr, (fd, termios_p), + int fd AND struct termios *termios_p) +{ + return __ioctl (fd, TCGETS, termios_p); +} + +weak_alias (__tcgetattr, tcgetattr) diff --git a/sysdeps/unix/bsd/sun/sunos4/tcsendbrk.c b/sysdeps/unix/bsd/sun/sunos4/tcsendbrk.c new file mode 100644 index 0000000000..7a6d5cc05f --- /dev/null +++ b/sysdeps/unix/bsd/sun/sunos4/tcsendbrk.c @@ -0,0 +1,31 @@ +/* Copyright (C) 1993 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <ansidecl.h> +#include <errno.h> +#include <termios.h> +#include <sys/ioctl.h> +#include <sys/termio.h> /* Sun header file. */ + +/* Send zero bits on FD. */ +int +DEFUN(tcsendbreak, (fd, duration), int fd AND int duration) +{ + /* According to SunOS 4.1's termios(4), you can't specify a duration. */ + return __ioctl (fd, TCSBRK, 0); +} diff --git a/sysdeps/unix/bsd/sun/sunos4/tcsetattr.c b/sysdeps/unix/bsd/sun/sunos4/tcsetattr.c new file mode 100644 index 0000000000..4ae139a1f8 --- /dev/null +++ b/sysdeps/unix/bsd/sun/sunos4/tcsetattr.c @@ -0,0 +1,49 @@ +/* Copyright (C) 1993 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <ansidecl.h> +#include <errno.h> +#include <stddef.h> +#include <termios.h> +#include <sys/ioctl.h> + +/* Set the state of FD to *TERMIOS_P. */ +int +DEFUN(tcsetattr, (fd, optional_actions, termios_p), + int fd AND int optional_actions AND CONST struct termios *termios_p) +{ + int cmd; + + switch (optional_actions) + { + case TCSANOW: + cmd = TCSETS; + break; + case TCSADRAIN: + cmd = TCSETSW; + break; + case TCSAFLUSH: + cmd = TCSETSF; + break; + default: + errno = EINVAL; + return -1; + } + + return __ioctl (fd, cmd, termios_p); +} diff --git a/sysdeps/unix/bsd/sun/sunos4/termbits.h b/sysdeps/unix/bsd/sun/sunos4/termbits.h new file mode 100644 index 0000000000..b768deab6f --- /dev/null +++ b/sysdeps/unix/bsd/sun/sunos4/termbits.h @@ -0,0 +1,208 @@ +/* termios type and macro definitions. SunOS 4 version. +Copyright (C) 1993, 1994 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. */ + +/* Type of terminal control flag masks. */ +typedef unsigned long int tcflag_t; + +/* Type of control characters. */ +typedef unsigned char cc_t; + +/* Type of baud rate specifiers. */ +typedef unsigned int speed_t; + +/* Terminal control structure. */ +struct termios +{ + /* Input modes. */ + tcflag_t c_iflag; +#define IGNBRK 0x0001 /* Ignore break condition. */ +#define BRKINT 0x0002 /* Signal interrupt on break. */ +#define IGNPAR 0x0004 /* Ignore characters with parity errors. */ +#define PARMRK 0x0008 /* Mark parity and framing errors. */ +#define INPCK 0x0010 /* Enable input parity check. */ +#define ISTRIP 0x0020 /* Strip 8th bit off characters. */ +#define INLCR 0x0040 /* Map NL to CR on input. */ +#define IGNCR 0x0080 /* Ignore CR. */ +#define ICRNL 0x0100 /* Map CR to NL on input. */ +#ifdef __USE_BSD +#define IUCLC 0x0200 /* Map upper case to lower case on input. */ +#endif +#define IXON 0x0400 /* Enable start/stop output control. */ +#define IXOFF 0x1000 /* Enable start/stop input control. */ +#ifdef __USE_BSD +#define IXANY 0x0800 /* Any character will restart after stop. */ +#define IMAXBEL 0x2000 /* Ring bell when input queue is full. */ +#endif + + /* Output modes. */ + tcflag_t c_oflag; +#define OPOST 0x0001 /* Perform output processing. */ +#ifdef __USE_BSD +#define OLCUC 0x00000002 /* Map lower case to upper case on output. */ +#define ONLCR 0x00000004 /* Map NL to CR-NL on output. */ +#define OCRNL 0x00000008 +#define ONOCR 0x00000010 +#define ONLRET 0x00000020 +#define OFILL 0x00000040 +#define OFDEL 0x00000080 +#define NLDLY 0x00000100 +#define NL0 0 +#define NL1 0x00000100 +#define CRDLY 0x00000600 +#define CR0 0 +#define CR1 0x00000200 +#define CR2 0x00000400 +#define CR3 0x00000600 +#define TABDLY 0x00001800 +#define TAB0 0 +#define TAB1 0x00000800 +#define TAB2 0x00001000 +#define XTABS 0x00001800 +#define TAB3 XTABS +#define BSDLY 0x00002000 +#define BS0 0 +#define BS1 0x00002000 +#define VTDLY 0x00004000 +#define VT0 0 +#define VT1 0x00004000 +#define FFDLY 0x00008000 +#define FF0 0 +#define FF1 0x00008000 +#define PAGEOUT 0x00010000 +#define WRAP 0x00020000 +#endif + + /* Control modes. */ + tcflag_t c_cflag; +#define CSIZE (CS5|CS6|CS7|CS8) /* Number of bits per byte (mask). */ +#define CS5 0 /* 5 bits per byte. */ +#define CS6 0x00000010 /* 6 bits per byte. */ +#define CS7 0x00000020 /* 7 bits per byte. */ +#define CS8 0x00000030 /* 8 bits per byte. */ +#define CSTOPB 0x00000040 /* Two stop bits instead of one. */ +#define CREAD 0x00000080 /* Enable receiver. */ +#define PARENB 0x00000100 /* Parity enable. */ +#define PARODD 0x00000200 /* Odd parity instead of even. */ +#define HUPCL 0x00000400 /* Hang up on last close. */ +#define CLOCAL 0x00000800 /* Ignore modem status lines. */ +#ifdef __USE_BSD +#define LOBLK 0x00001000 +#define CRTSCTS 0x80000000 +#define CIBAUD 0x000f0000 /* Mask for input speed from c_cflag. */ +#define CBAUD 0x0000000f /* Mask for output speed from c_cflag. */ +#define IBSHIFT 16 /* Bits to shift for input speed. */ +#endif + + /* Input and output baud rates. These are encoded in c_cflag. */ +#define B0 0 +#define B50 1 +#define B75 2 +#define B110 3 +#define B134 4 +#define B150 5 +#define B200 6 +#define B300 7 +#define B600 8 +#define B1200 9 +#define B1800 10 +#define B2400 11 +#define B4800 12 +#define B9600 13 +#define B19200 14 +#define B38400 15 +#ifdef __USE_BSD +#define EXTA 14 +#define EXTB 15 +#endif + + /* Local modes. */ + tcflag_t c_lflag; +#ifdef __USE_BSD +#define ECHOKE 0x00000800 /* Visual erase for KILL. */ +#endif +#define ECHOE 0x00000010 /* Visual erase for ERASE. */ +#define ECHOK 0x00000020 /* Echo NL after KILL. */ +#define ECHO 0x00000008 /* Enable echo. */ +#define ECHONL 0x00000040 /* Echo NL even if ECHO is off. */ +#ifdef __USE_BSD +#define ECHOPRT 0x00000400 /* Hardcopy visual erase. */ +#define ECHOCTL 0x00000200 /* Echo control characters as ^X. */ +#endif +#define ISIG 0x00000001 /* Enable signals. */ +#define ICANON 0x00000002 /* Do erase and kill processing. */ +#define IEXTEN 0x00008000 /* Enable DISCARD and LNEXT. */ +#define TOSTOP 0x00000100 /* Send SIGTTOU for background output. */ +#ifdef __USE_BSD +#define PENDIN 0x00004000 /* Retype pending input (state). */ +#endif +#define NOFLSH 0x00000080 /* Disable flush after interrupt. */ + + char c_line; /* Line discipline (?) */ + + /* Control characters. */ +#define VEOF 4 /* End-of-file character [ICANON]. */ +#define VEOL 5 /* End-of-line character [ICANON]. */ +#ifdef __USE_BSD +#define VEOL2 6 /* Second EOL character [ICANON]. */ +#define VSWTCH 7 /* ??? */ +#endif +#define VERASE 2 /* Erase character [ICANON]. */ +#ifdef __USE_BSD +#define VWERASE 14 /* Word-erase character [ICANON]. */ +#endif +#define VKILL 3 /* Kill-line character [ICANON]. */ +#ifdef __USE_BSD +#define VREPRINT 12 /* Reprint-line character [ICANON]. */ +#endif +#define VINTR 0 /* Interrupt character [ISIG]. */ +#define VQUIT 1 /* Quit character [ISIG]. */ +#define VSUSP 10 /* Suspend character [ISIG]. */ +#ifdef __USE_BSD +#define VDSUSP 11 /* Delayed suspend character [ISIG]. */ +#endif +#define VSTART 8 /* Start (X-ON) character [IXON, IXOFF]. */ +#define VSTOP 9 /* Stop (X-OFF) character [IXON, IXOFF]. */ +#ifdef __USE_BSD +#define VLNEXT 15 /* Literal-next character [IEXTEN]. */ +#define VDISCARD 13 /* Discard character [IEXTEN]. */ +#endif +#define VMIN VEOF /* Minimum number of bytes read at once [!ICANON]. */ +#define VTIME VEOL /* Time-out value (tenths of a second) [!ICANON]. */ +#define NCCS 17 + cc_t c_cc[NCCS]; +}; + +#define _IOT_termios /* Hurd ioctl type field. */ \ + _IOT (_IOTS (cflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2) + +/* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'. */ +#define TCSANOW 0 /* Change immediately. */ +#define TCSADRAIN 1 /* Change when pending output is written. */ +#define TCSAFLUSH 2 /* Flush pending input before changing. */ + +/* Values for the QUEUE_SELECTOR argument to `tcflush'. */ +#define TCIFLUSH 0 /* Discard data received but not yet read. */ +#define TCOFLUSH 1 /* Discard data written but not yet sent. */ +#define TCIOFLUSH 2 /* Discard all pending data. */ + +/* Values for the ACTION argument to `tcflow'. */ +#define TCOOFF 0 /* Suspend output. */ +#define TCOON 1 /* Restart suspended output. */ +#define TCIOFF 2 /* Send a STOP character. */ +#define TCION 3 /* Send a START character. */ diff --git a/sysdeps/unix/bsd/sun/sunos4/uname.S b/sysdeps/unix/bsd/sun/sunos4/uname.S new file mode 100644 index 0000000000..488eeb1d97 --- /dev/null +++ b/sysdeps/unix/bsd/sun/sunos4/uname.S @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/uname.S> diff --git a/sysdeps/unix/bsd/sun/sunos4/utsnamelen.h b/sysdeps/unix/bsd/sun/sunos4/utsnamelen.h new file mode 100644 index 0000000000..e9111b6504 --- /dev/null +++ b/sysdeps/unix/bsd/sun/sunos4/utsnamelen.h @@ -0,0 +1,2 @@ +#define _UTSNAME_LENGTH 9 +#define _UTSNAME_NODENAME_LENGTH 65 diff --git a/sysdeps/unix/bsd/sun/sunos4/wait.c b/sysdeps/unix/bsd/sun/sunos4/wait.c new file mode 100644 index 0000000000..79d54580fd --- /dev/null +++ b/sysdeps/unix/bsd/sun/sunos4/wait.c @@ -0,0 +1 @@ +#include <sysdeps/unix/bsd/bsd4.4/wait.c> diff --git a/sysdeps/unix/bsd/sun/sunos4/wait3.c b/sysdeps/unix/bsd/sun/sunos4/wait3.c new file mode 100644 index 0000000000..0b3bdee771 --- /dev/null +++ b/sysdeps/unix/bsd/sun/sunos4/wait3.c @@ -0,0 +1 @@ +#include <sysdeps/unix/bsd/bsd4.4/wait3.c> diff --git a/sysdeps/unix/bsd/sun/sunos4/wait4.c b/sysdeps/unix/bsd/sun/sunos4/wait4.c new file mode 100644 index 0000000000..919cd7c42c --- /dev/null +++ b/sysdeps/unix/bsd/sun/sunos4/wait4.c @@ -0,0 +1,50 @@ +/* This implements wait4 with the 4.4 BSD semantics (also those documented in + SunOS 4.1) on top of SunOS's wait4 system call, which has semantics + different from those documented. Go Sun! + +Copyright (C) 1991, 1992, 1993, 1995 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <ansidecl.h> +#include <sys/types.h> +#include <sys/wait.h> +#include <unistd.h> + +extern pid_t __wait4_syscall __P ((pid_t pid, __WAIT_STATUS_DEFN stat_loc, + int options, struct rusage *usage)); + +pid_t +DEFUN(__wait4, (pid, stat_loc, options, usage), + pid_t pid AND __WAIT_STATUS_DEFN stat_loc AND + int options AND struct rusage *usage) +{ + switch (pid) + { + case WAIT_ANY: + pid = 0; + break; + + case WAIT_MYPGRP: + pid = - getpgrp (); + break; + } + + return __wait4_syscall (pid, stat_loc, options, usage); +} + +weak_alias (__wait4, wait4) diff --git a/sysdeps/unix/bsd/sun/sunos4/waitpid.c b/sysdeps/unix/bsd/sun/sunos4/waitpid.c new file mode 100644 index 0000000000..8378982ac7 --- /dev/null +++ b/sysdeps/unix/bsd/sun/sunos4/waitpid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/bsd/bsd4.4/waitpid.c> |