summaryrefslogtreecommitdiff
path: root/sysdeps/unix
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-10-03 20:44:20 +0000
committerJakub Jelinek <jakub@redhat.com>2005-10-03 20:44:20 +0000
commita5a11654ea5ea89bfffb295fbb2f17cbb45839b6 (patch)
tree2078fd7b828ae3b4c030e6722c53bdc81542a511 /sysdeps/unix
parent6543cff055c298ea3ec718b356f6c2115e8797ae (diff)
Updated to fedora-glibc-20051003T2040
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/alpha/sysdep.h63
-rw-r--r--sysdeps/unix/fdopendir.c (renamed from sysdeps/unix/sysv/i386/sigreturn.S)31
-rw-r--r--sysdeps/unix/opendir.c33
-rw-r--r--sysdeps/unix/sockatmark.c6
-rw-r--r--sysdeps/unix/sysv/i386/signal.S31
-rw-r--r--sysdeps/unix/sysv/linux/lddlibc4.c4
-rw-r--r--sysdeps/unix/sysv/linux/mips/brk.c5
-rw-r--r--sysdeps/unix/sysv/linux/mips/getpagesize.c1
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S10
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/syscall.S31
10 files changed, 119 insertions, 96 deletions
diff --git a/sysdeps/unix/alpha/sysdep.h b/sysdeps/unix/alpha/sysdep.h
index f9f1dd6e41..a154db8e41 100644
--- a/sysdeps/unix/alpha/sysdep.h
+++ b/sysdeps/unix/alpha/sysdep.h
@@ -242,9 +242,10 @@ __LABEL(name) \
register long _sc_0 inline_syscall_r0_asm; \
register long _sc_16 __asm__("$16"); \
register long _sc_19 __asm__("$19"); \
+ register long _tmp_16 = (long) (arg1); \
\
_sc_0 = name; \
- _sc_16 = (long) (arg1); \
+ _sc_16 = _tmp_16; \
__asm__ __volatile__ \
("callsys # %0 %1 <= %2 %3" \
: inline_syscall_r0_out_constraint (_sc_0), \
@@ -261,10 +262,12 @@ __LABEL(name) \
register long _sc_16 __asm__("$16"); \
register long _sc_17 __asm__("$17"); \
register long _sc_19 __asm__("$19"); \
+ register long _tmp_16 = (long) (arg1); \
+ register long _tmp_17 = (long) (arg2); \
\
_sc_0 = name; \
- _sc_16 = (long) (arg1); \
- _sc_17 = (long) (arg2); \
+ _sc_16 = _tmp_16; \
+ _sc_17 = _tmp_17; \
__asm__ __volatile__ \
("callsys # %0 %1 <= %2 %3 %4" \
: inline_syscall_r0_out_constraint (_sc_0), \
@@ -282,11 +285,14 @@ __LABEL(name) \
register long _sc_17 __asm__("$17"); \
register long _sc_18 __asm__("$18"); \
register long _sc_19 __asm__("$19"); \
+ register long _tmp_16 = (long) (arg1); \
+ register long _tmp_17 = (long) (arg2); \
+ register long _tmp_18 = (long) (arg3); \
\
_sc_0 = name; \
- _sc_16 = (long) (arg1); \
- _sc_17 = (long) (arg2); \
- _sc_18 = (long) (arg3); \
+ _sc_16 = _tmp_16; \
+ _sc_17 = _tmp_17; \
+ _sc_18 = _tmp_18; \
__asm__ __volatile__ \
("callsys # %0 %1 <= %2 %3 %4 %5" \
: inline_syscall_r0_out_constraint (_sc_0), \
@@ -305,12 +311,16 @@ __LABEL(name) \
register long _sc_17 __asm__("$17"); \
register long _sc_18 __asm__("$18"); \
register long _sc_19 __asm__("$19"); \
+ register long _tmp_16 = (long) (arg1); \
+ register long _tmp_17 = (long) (arg2); \
+ register long _tmp_18 = (long) (arg3); \
+ register long _tmp_19 = (long) (arg4); \
\
_sc_0 = name; \
- _sc_16 = (long) (arg1); \
- _sc_17 = (long) (arg2); \
- _sc_18 = (long) (arg3); \
- _sc_19 = (long) (arg4); \
+ _sc_16 = _tmp_16; \
+ _sc_17 = _tmp_17; \
+ _sc_18 = _tmp_18; \
+ _sc_19 = _tmp_19; \
__asm__ __volatile__ \
("callsys # %0 %1 <= %2 %3 %4 %5 %6" \
: inline_syscall_r0_out_constraint (_sc_0), \
@@ -330,13 +340,18 @@ __LABEL(name) \
register long _sc_18 __asm__("$18"); \
register long _sc_19 __asm__("$19"); \
register long _sc_20 __asm__("$20"); \
+ register long _tmp_16 = (long) (arg1); \
+ register long _tmp_17 = (long) (arg2); \
+ register long _tmp_18 = (long) (arg3); \
+ register long _tmp_19 = (long) (arg4); \
+ register long _tmp_20 = (long) (arg5); \
\
_sc_0 = name; \
- _sc_16 = (long) (arg1); \
- _sc_17 = (long) (arg2); \
- _sc_18 = (long) (arg3); \
- _sc_19 = (long) (arg4); \
- _sc_20 = (long) (arg5); \
+ _sc_16 = _tmp_16; \
+ _sc_17 = _tmp_17; \
+ _sc_18 = _tmp_18; \
+ _sc_19 = _tmp_19; \
+ _sc_20 = _tmp_20; \
__asm__ __volatile__ \
("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7" \
: inline_syscall_r0_out_constraint (_sc_0), \
@@ -357,14 +372,20 @@ __LABEL(name) \
register long _sc_19 __asm__("$19"); \
register long _sc_20 __asm__("$20"); \
register long _sc_21 __asm__("$21"); \
+ register long _tmp_16 = (long) (arg1); \
+ register long _tmp_17 = (long) (arg2); \
+ register long _tmp_18 = (long) (arg3); \
+ register long _tmp_19 = (long) (arg4); \
+ register long _tmp_20 = (long) (arg5); \
+ register long _tmp_21 = (long) (arg6); \
\
_sc_0 = name; \
- _sc_16 = (long) (arg1); \
- _sc_17 = (long) (arg2); \
- _sc_18 = (long) (arg3); \
- _sc_19 = (long) (arg4); \
- _sc_20 = (long) (arg5); \
- _sc_21 = (long) (arg6); \
+ _sc_16 = _tmp_16; \
+ _sc_17 = _tmp_17; \
+ _sc_18 = _tmp_18; \
+ _sc_19 = _tmp_19; \
+ _sc_20 = _tmp_20; \
+ _sc_21 = _tmp_21; \
__asm__ __volatile__ \
("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7 %8" \
: inline_syscall_r0_out_constraint (_sc_0), \
diff --git a/sysdeps/unix/sysv/i386/sigreturn.S b/sysdeps/unix/fdopendir.c
index edf4418c5b..3c481fcf0d 100644
--- a/sysdeps/unix/sysv/i386/sigreturn.S
+++ b/sysdeps/unix/fdopendir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994, 1995, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 2005 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
@@ -16,12 +16,27 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#include <sysdep.h>
+#include <dirent.h>
+#include <errno.h>
+#include <sys/stat.h>
-.text
-ENTRY (__sigreturn)
- addl $4, %esp /* Pop the return PC. */
- lcall $0xf, $0 /* Do the magic sigreturn trap. */
- /* NOTREACHED */
+#include <not-cancel.h>
-weak_alias (__sigreturn, sigreturn)
+
+DIR *
+fdopendir (int fd)
+{
+ struct stat64 statbuf;
+
+ if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &statbuf), 0) < 0)
+ goto out;
+ if (__builtin_expect (! S_ISDIR (statbuf.st_mode), 0))
+ {
+ __set_errno (ENOTDIR);
+ out:
+ close_not_cancel_no_status (fd);
+ return NULL;
+ }
+
+ return __alloc_dir (fd, &statbuf);
+}
diff --git a/sysdeps/unix/opendir.c b/sysdeps/unix/opendir.c
index 5e03ed9b20..366670b79c 100644
--- a/sysdeps/unix/opendir.c
+++ b/sysdeps/unix/opendir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1996,98,2000-2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1996,98,2000-2003,2005 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
@@ -78,11 +78,7 @@ tryopen_o_directory (void)
DIR *
__opendir (const char *name)
{
- DIR *dirp;
struct stat64 statbuf;
- int fd;
- size_t allocation;
- int save_errno;
if (__builtin_expect (name[0], '\1') == '\0')
{
@@ -113,7 +109,7 @@ __opendir (const char *name)
}
}
- fd = open_not_cancel_2 (name, O_RDONLY|O_NDELAY|EXTRA_FLAGS|O_LARGEFILE);
+ int fd = open_not_cancel_2 (name, O_RDONLY|O_NDELAY|EXTRA_FLAGS|O_LARGEFILE);
if (__builtin_expect (fd, 0) < 0)
return NULL;
@@ -129,18 +125,30 @@ __opendir (const char *name)
{
if (__builtin_expect (! S_ISDIR (statbuf.st_mode), 0))
{
- save_errno = ENOTDIR;
- goto lose;
+ __set_errno (ENOTDIR);
+ lose:
+ close_not_cancel_no_status (fd);
+ return NULL;
}
}
+ return __alloc_dir (fd, &statbuf);
+}
+weak_alias (__opendir, opendir)
+
+
+DIR *
+internal_function
+__alloc_dir (int fd, struct stat64 *statp)
+{
if (__builtin_expect (__fcntl (fd, F_SETFD, FD_CLOEXEC), 0) < 0)
goto lose;
+ size_t allocation;
#ifdef _STATBUF_ST_BLKSIZE
- if (__builtin_expect ((size_t) statbuf.st_blksize >= sizeof (struct dirent64),
+ if (__builtin_expect ((size_t) statp->st_blksize >= sizeof (struct dirent64),
1))
- allocation = statbuf.st_blksize;
+ allocation = statp->st_blksize;
else
#endif
allocation = (BUFSIZ < sizeof (struct dirent64)
@@ -148,11 +156,11 @@ __opendir (const char *name)
const int pad = -sizeof (DIR) % __alignof__ (struct dirent64);
- dirp = (DIR *) malloc (sizeof (DIR) + allocation + pad);
+ DIR *dirp = (DIR *) malloc (sizeof (DIR) + allocation + pad);
if (dirp == NULL)
lose:
{
- save_errno = errno;
+ int save_errno = errno;
close_not_cancel_no_status (fd);
__set_errno (save_errno);
return NULL;
@@ -166,4 +174,3 @@ __opendir (const char *name)
return dirp;
}
-weak_alias (__opendir, opendir)
diff --git a/sysdeps/unix/sockatmark.c b/sysdeps/unix/sockatmark.c
index 306ab36ee1..a2476415ac 100644
--- a/sysdeps/unix/sockatmark.c
+++ b/sysdeps/unix/sockatmark.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2005 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,5 +24,7 @@ int
sockatmark (fd)
int fd;
{
- return __ioctl (fd, SIOCATMARK);
+ int answ;
+
+ return __ioctl (fd, SIOCATMARK, &answ) == -1 ? -1 : answ;
}
diff --git a/sysdeps/unix/sysv/i386/signal.S b/sysdeps/unix/sysv/i386/signal.S
deleted file mode 100644
index af51bc5182..0000000000
--- a/sysdeps/unix/sysv/i386/signal.S
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <sysdep.h>
-
-/* This is just a standard system call, except we need to load %edx
- with the address of the `__sigreturn' function. */
-
- .globl syscall_error
- .globl C_SYMBOL_NAME(__sigreturn)
-ENTRY (signal)
- lea SYS_signal, %eax
- lea C_SYMBOL_NAME(__sigreturn), %edx
- .byte 0x9a, 0, 0, 0, 0, 7, 0 /* lcall $7, $0 -- GAS bug. */
- jb syscall_error
- ret
diff --git a/sysdeps/unix/sysv/linux/lddlibc4.c b/sysdeps/unix/sysv/linux/lddlibc4.c
index f7b208e7d8..7683ec2efd 100644
--- a/sysdeps/unix/sysv/linux/lddlibc4.c
+++ b/sysdeps/unix/sysv/linux/lddlibc4.c
@@ -1,5 +1,5 @@
/* Stub for ldd script to print Linux libc4 dependencies.
- Copyright (C) 1998 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -84,5 +84,5 @@ main (int argc, char *argv[])
putenv (buf);
/* Now we can execute the binary. */
- return execl (filename, NULL) ? 4 : 0;
+ return execv (filename, &argv[argc]) ? 4 : 0;
}
diff --git a/sysdeps/unix/sysv/linux/mips/brk.c b/sysdeps/unix/sysv/linux/mips/brk.c
index 4be88a9c5f..5c31bec5ee 100644
--- a/sysdeps/unix/sysv/linux/mips/brk.c
+++ b/sysdeps/unix/sysv/linux/mips/brk.c
@@ -1,5 +1,5 @@
/* brk system call for Linux/MIPS.
- Copyright (C) 2000 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2005 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
@@ -37,9 +37,10 @@ __brk (void *addr)
register long int res __asm__ ("$2");
asm ("move\t$4,%2\n\t"
+ "li\t%0,%1\n\t"
"syscall" /* Perform the system call. */
: "=r" (res)
- : "0" (SYS_ify (brk)), "r" (addr)
+ : "I" (SYS_ify (brk)), "r" (addr)
: "$4", "$7");
newbrk = (void *) res;
}
diff --git a/sysdeps/unix/sysv/linux/mips/getpagesize.c b/sysdeps/unix/sysv/linux/mips/getpagesize.c
new file mode 100644
index 0000000000..49492e5137
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/getpagesize.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/ia64/getpagesize.c>
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S b/sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S
index 7b14089bcb..e4b4f00a8c 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S
@@ -1,4 +1,4 @@
-/* Copyright 2003 Free Software Foundation, Inc.
+/* Copyright 2003, 2005 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
@@ -25,16 +25,16 @@
.text
ENTRY (__ioctl)
+ sll a1, a1, 0
li v0, __NR_ioctl
- sll a1,a1,0
syscall /* Do the system call. */
bne a3, zero, L(error)
ret
L(error):
- .cpsetup t9, a0, __ioctl
- PTR_LA t9,__syscall_error
- .cprestore
+ SETUP_GP64 (a0, __ioctl)
+ PTR_LA t9, __syscall_error
+ RESTORE_GP64
jr t9
PSEUDO_END (__ioctl)
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/syscall.S b/sysdeps/unix/sysv/linux/mips/mips64/syscall.S
index ea5bf491d6..3c6aaac810 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/syscall.S
+++ b/sysdeps/unix/sysv/linux/mips/mips64/syscall.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2002, 2003, 2005 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,17 +20,20 @@
#include <sys/asm.h>
-/* Please consult the file sysdeps/unix/sysv/linux/x86-64/sysdep.h for
- more information about the value -4095 used below. */
+/* Usage:
+ long syscall (syscall_number, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
-/* Usage: long syscall (syscall_number, arg1, arg2, arg3, arg4, arg5)
- We need to do some arg shifting, the syscall_number will be in
- rax. */
+ We need to do some arg shifting, syscall_number will be in v0. */
.text
-ENTRY (syscall)
- move v0, a0 /* Syscall number -> v0 */
+NESTED (syscall, SZREG, ra)
+ .mask 0x00010000, -SZREG
+ .fmask 0x00000000, 0
+ PTR_ADDIU sp, -SZREG
+ REG_S s0, (sp)
+
+ move s0, a0
move a0, a1 /* shift arg1 - arg7. */
move a1, a2
move a2, a3
@@ -39,15 +42,19 @@ ENTRY (syscall)
move a5, a6
move a6, a7
+ move v0, s0 /* Syscall number -> v0 */
syscall /* Do the system call. */
+
+ REG_L s0, (sp)
+ PTR_ADDIU sp, SZREG
bne a3, zero, L(error)
ret
L(error):
- .cpsetup t9, a0, syscall
- PTR_LA t9,__syscall_error
- .cprestore
+ SETUP_GP64 (a0, syscall)
+ PTR_LA t9, __syscall_error
+ RESTORE_GP64
jr t9
-PSEUDO_END (syscall)
+END (syscall)