diff options
Diffstat (limited to 'sysdeps/unix')
47 files changed, 3288 insertions, 56 deletions
diff --git a/sysdeps/unix/getlogin.c b/sysdeps/unix/getlogin.c index 6e8a9a2a87..84b7dd8276 100644 --- a/sysdeps/unix/getlogin.c +++ b/sysdeps/unix/getlogin.c @@ -1,4 +1,4 @@ -/* 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 @@ -46,7 +46,7 @@ getlogin (void) thing to do. Note that ttyname(open("/dev/tty")) on those systems returns /dev/tty, so that is not a possible solution for getlogin(). */ - if (__ttyname_r (0, real_tty_path, sizeof (tty_pathname)) < 0) + if (__ttyname_r (0, real_tty_path, sizeof (tty_pathname)) != 0) return NULL; real_tty_path += 5; /* Remove "/dev/". */ diff --git a/sysdeps/unix/getlogin_r.c b/sysdeps/unix/getlogin_r.c index 75f17cb86f..8ec2fae754 100644 --- a/sysdeps/unix/getlogin_r.c +++ b/sysdeps/unix/getlogin_r.c @@ -1,5 +1,5 @@ /* Reentrant function to return the current login name. Unix version. - 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 @@ -41,19 +41,17 @@ getlogin_r (name, name_len) struct utmp *ut, line, buffer; { - int err; int d = __open ("/dev/tty", 0); if (d < 0) return errno; result = ttyname_r (d, real_tty_path, sizeof (tty_pathname)); - err = errno; (void) close (d); - if (result < 0) + if (result != 0) { - __set_errno (err); - return err; + __set_errno (result); + return result; } } diff --git a/sysdeps/unix/mips/brk.S b/sysdeps/unix/mips/brk.S index 197672669b..e38f735b92 100644 --- a/sysdeps/unix/mips/brk.S +++ b/sysdeps/unix/mips/brk.S @@ -24,46 +24,24 @@ #endif #ifndef HAVE_GNU_LD -#define __end end +#define _end end #endif -.data -.sdata + .data ENTRY(__curbrk) - .word __end + .word 0 .end __curbrk -.text -.set noreorder -.set noat -ENTRY(__brk) - /* Minimum is one page. */ - lui v0, 4096 - lw v0, __end - nop - - /* If they ask for less than a page, givvem the whole - thing anyway. */ - sltu AT, a0, v0 - beq AT, zero, down1 - nop - move a0, v0 -down1: - li v0, SYS_brk - syscall - bne a3, zero, error - - /* Update __curbrk and exit cleanly. */ - lui AT, 4096 + .text +SYSCALL__(brk, 1) + .set reorder + /* Handle the query case. */ + bnez a0, 1f + move a0,v0 +1: /* Update __curbrk and exit cleanly. */ sw a0, __curbrk - j ra move v0, zero - - /* What a horrible way to die. */ -error: j syscall_error - nop - nop - nop + jr ra .end __brk weak_alias (__brk, brk) diff --git a/sysdeps/unix/mips/sysdep.S b/sysdeps/unix/mips/sysdep.S index 0cfc302770..ac8335fe5b 100644 --- a/sysdeps/unix/mips/sysdep.S +++ b/sysdeps/unix/mips/sysdep.S @@ -21,10 +21,23 @@ #define _ERRNO_H #include <bits/errno.h> -/* .globl errno */ -.set noreorder + .comm errno, 4 +#ifdef __ELF__ + .type errno, @object +#endif + + .set noreorder -ENTRY(syscall_error) +ENTRY(__syscall_error) +#ifdef __PIC__ + .set noat + move $1, $31 + bltzal $0, 0f + nop +0: .cpload $31 + move $31, $1 + .set at +#endif #if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN /* We translate the system's EWOULDBLOCK error into EAGAIN. The GNU C library always defines EWOULDBLOCK==EAGAIN. @@ -40,4 +53,8 @@ skip: /* And just kick back a -1. */ j ra li v0, -1 - .end syscall_error + END(__syscall_error) + +/* We provide this alias for compatilility with other Unices + like IRIX 5 */ +weak_alias (__syscall_error, syscall_error) diff --git a/sysdeps/unix/mips/sysdep.h b/sysdeps/unix/mips/sysdep.h index 2f148d0938..cbafbdcd9a 100644 --- a/sysdeps/unix/mips/sysdep.h +++ b/sysdeps/unix/mips/sysdep.h @@ -32,19 +32,41 @@ /* Note that while it's better structurally, going back to call syscall_error can make things confusing if you're debugging---it looks like it's jumping backwards into the previous fn. */ +#ifdef __PIC__ + #define PSEUDO(name, syscall_name, args) \ + .align 2; \ + 99: la t9,syscall_error; \ + jr t9; \ + ENTRY(name) \ + .set noreorder; \ + .cpload t9; \ + li v0, SYS_##syscall_name; \ + syscall; \ + .set reorder; \ + bne a3, zero, 99b; \ +syse1: +#else #define PSEUDO(name, syscall_name, args) \ .set noreorder; \ .align 2; \ 99: j syscall_error; \ - nop; \ ENTRY(name) \ + .set noreorder; \ li v0, SYS_##syscall_name; \ syscall; \ + .set reorder; \ bne a3, zero, 99b; \ - nop; \ syse1: +#endif + +#undef PSEUDO_END +#define PSEUDO_END(sym) .end sym #define ret j ra ; nop + +#undef END +#define END(sym) .end sym + #define r0 v0 #define r1 v1 /* The mips move insn is d,s. */ diff --git a/sysdeps/unix/mips/wait.S b/sysdeps/unix/mips/wait.S index a544156c4e..9ea55bc7d0 100644 --- a/sysdeps/unix/mips/wait.S +++ b/sysdeps/unix/mips/wait.S @@ -28,14 +28,14 @@ ENTRY(__wait) li v0, SYS_wait syscall - beq a3, zero, noerror + beqz a3, noerror nop - j syscall_error + j __syscall_error nop noerror: /* If the arg is not NULL, store v1 there. */ - beq a0, zero, noarg + beqz a0, noarg nop sw v1, 0(a0) nop diff --git a/sysdeps/unix/sysv/linux/bits/ipc.h b/sysdeps/unix/sysv/linux/bits/ipc.h index f5fea0d295..c01a81a83f 100644 --- a/sysdeps/unix/sysv/linux/bits/ipc.h +++ b/sysdeps/unix/sysv/linux/bits/ipc.h @@ -82,4 +82,4 @@ extern int __ipc __P ((int __call, int __first, int __second, int __third, __END_DECLS -#endif /* _SYS_IPC_BUF_H */ +#endif /* bits/ipc_buf.h */ diff --git a/sysdeps/unix/sysv/linux/bits/msq.h b/sysdeps/unix/sysv/linux/bits/msq.h index 0abc10f6e5..59559a31c3 100644 --- a/sysdeps/unix/sysv/linux/bits/msq.h +++ b/sysdeps/unix/sysv/linux/bits/msq.h @@ -75,4 +75,4 @@ struct msginfo __END_DECLS -#endif /* _SYS_MSQ_BUF_H */ +#endif /* bits/msq_buf.h */ diff --git a/sysdeps/unix/sysv/linux/bits/sem.h b/sysdeps/unix/sysv/linux/bits/sem.h index 049a71bc47..87951efea1 100644 --- a/sysdeps/unix/sysv/linux/bits/sem.h +++ b/sysdeps/unix/sysv/linux/bits/sem.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995. @@ -85,4 +85,4 @@ struct seminfo __END_DECLS -#endif /* _SYS_SEM_BUF_H */ +#endif /* bits/sem_buf.h */ diff --git a/sysdeps/unix/sysv/linux/bits/shm.h b/sysdeps/unix/sysv/linux/bits/shm.h index 642b7bd191..6db01dd4a2 100644 --- a/sysdeps/unix/sysv/linux/bits/shm.h +++ b/sysdeps/unix/sysv/linux/bits/shm.h @@ -89,4 +89,4 @@ struct shm_info __END_DECLS -#endif /* _SYS_SHM_BUF_H */ +#endif /* bits/shm_buf.h */ diff --git a/sysdeps/unix/sysv/linux/mips/Dist b/sysdeps/unix/sysv/linux/mips/Dist new file mode 100644 index 0000000000..a205c94f95 --- /dev/null +++ b/sysdeps/unix/sysv/linux/mips/Dist @@ -0,0 +1,3 @@ +clone.S +kernel_sigaction.h +kernel_stat.h diff --git a/sysdeps/unix/sysv/linux/mips/Makefile b/sysdeps/unix/sysv/linux/mips/Makefile new file mode 100644 index 0000000000..e6240ea9a4 --- /dev/null +++ b/sysdeps/unix/sysv/linux/mips/Makefile @@ -0,0 +1,10 @@ +ifeq ($(subdir),signal) +#sysdep_routines += sigsuspend +endif + +ifeq ($(subdir),misc) +sysdep_routines += cachectl cacheflush sysmips + +headers += regdef.h fpregdef.h sys/asm.h sys/cachectl.h sys/fpregdef.h \ + sys/regdef.h sys/sysmips.h +endif diff --git a/sysdeps/unix/sysv/linux/mips/bits/endian.h b/sysdeps/unix/sysv/linux/mips/bits/endian.h new file mode 100644 index 0000000000..9f60758f36 --- /dev/null +++ b/sysdeps/unix/sysv/linux/mips/bits/endian.h @@ -0,0 +1,12 @@ +/* The MIPS architecture has selectable endianness. + Linux/MIPS exists in two both little and big endian flavours and we + want to be able to share the installed headerfiles between both, + so we define __BYTE_ORDER based on GCC's predefines. */ + +#ifdef __MIPSEB__ +#define __BYTE_ORDER __BIG_ENDIAN +#else +#ifdef __MIPSEL__ +#define __BYTE_ORDER __LITTLE_ENDIAN +#endif +#endif diff --git a/sysdeps/unix/sysv/linux/mips/bits/fcntl.h b/sysdeps/unix/sysv/linux/mips/bits/fcntl.h new file mode 100644 index 0000000000..2586140fdc --- /dev/null +++ b/sysdeps/unix/sysv/linux/mips/bits/fcntl.h @@ -0,0 +1,100 @@ +/* O_*, F_*, FD_* bit values for Linux. + Copyright (C) 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. */ + +#ifndef _FCNTL_H +#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead." +#endif + +#include <sys/types.h> + + +/* In GNU, read and write are bits (unlike BSD). */ +#ifdef __USE_GNU +#define O_READ O_RDONLY /* Open for reading. */ +#define O_WRITE O_WRONLY /* Open for writing. */ +#endif +/* open/fcntl - O_SYNC is only implemented on blocks devices and on files + located on an ext2 file system */ +#define O_ACCMODE 0x0003 +#define O_RDONLY 0x0000 +#define O_WRONLY 0x0001 +#define O_RDWR 0x0002 +#define O_APPEND 0x0008 +#define O_SYNC 0x0010 +#define O_NONBLOCK 0x0080 +#define O_CREAT 0x0100 /* not fcntl */ +#define O_TRUNC 0x0200 /* not fcntl */ +#define O_EXCL 0x0400 /* not fcntl */ +#define O_NOCTTY 0x0800 /* not fcntl */ +#define O_FSYNC O_SYNC +#define O_ASYNC 020000 + +#define O_NDELAY O_NONBLOCK + +#define F_DUPFD 0 /* dup */ +#define F_GETFD 1 /* get f_flags */ +#define F_SETFD 2 /* set f_flags */ +#define F_GETFL 3 /* more flags (cloexec) */ +#define F_SETFL 4 +#define F_GETLK 14 +#define F_SETLK 6 +#define F_SETLKW 7 + +#define F_SETOWN 24 /* for sockets. */ +#define F_GETOWN 23 /* for sockets. */ + +/* for F_[GET|SET]FL */ +#define FD_CLOEXEC 1 /* actually anything with low bit set goes */ + +/* for posix fcntl() and lockf() */ < |
