diff options
Diffstat (limited to 'ports/sysdeps/unix/sysv')
9 files changed, 231 insertions, 15 deletions
diff --git a/ports/sysdeps/unix/sysv/linux/hppa/nptl/bits/semaphore.h b/ports/sysdeps/unix/sysv/linux/hppa/nptl/bits/semaphore.h index 3d274eea2..270f3332c 100644 --- a/ports/sysdeps/unix/sysv/linux/hppa/nptl/bits/semaphore.h +++ b/ports/sysdeps/unix/sysv/linux/hppa/nptl/bits/semaphore.h @@ -20,17 +20,11 @@ # error "Never use <bits/semaphore.h> directly; include <semaphore.h> instead." #endif - #define __SIZEOF_SEM_T 16 - /* Value returned if `sem_open' failed. */ #define SEM_FAILED ((sem_t *) 0) -/* Maximum value the semaphore can have. */ -#define SEM_VALUE_MAX ((int) ((~0u) >> 1)) - - typedef union { char __size[__SIZEOF_SEM_T]; diff --git a/ports/sysdeps/unix/sysv/linux/hppa/sysdep.c b/ports/sysdeps/unix/sysv/linux/hppa/sysdep.c index 8637c513d..4a0bd2183 100644 --- a/ports/sysdeps/unix/sysv/linux/hppa/sysdep.c +++ b/ports/sysdeps/unix/sysv/linux/hppa/sysdep.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1997, 1998, 2001, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 2001, 2003, 2007 + 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 @@ -58,13 +59,14 @@ syscall (long int __sysno, ...) { register unsigned long int __res asm("r28"); + PIC_REG_DEF LOAD_ARGS_6 (arg0, arg1, arg2, arg3, arg4, arg5) asm volatile (SAVE_ASM_PIC " ble 0x100(%%sr2, %%r0) \n" " copy %1, %%r20 \n" LOAD_ASM_PIC : "=r" (__res) - : "r" (__sysno) ASM_ARGS_6 + : "r" (__sysno) PIC_REG_USE ASM_ARGS_6 : "memory", CALL_CLOB_REGS CLOB_ARGS_6); __sys_res = __res; } diff --git a/ports/sysdeps/unix/sysv/linux/hppa/sysdep.h b/ports/sysdeps/unix/sysv/linux/hppa/sysdep.h index 69ed7002c..96632a1c4 100644 --- a/ports/sysdeps/unix/sysv/linux/hppa/sysdep.h +++ b/ports/sysdeps/unix/sysv/linux/hppa/sysdep.h @@ -1,5 +1,6 @@ /* Assembler macros for PA-RISC. - Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1999, 2001, 2002, 2003, 2007 + Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper, <drepper@cygnus.com>, August 1999. Linux/PA-RISC changes by Philipp Rumpf, <prumpf@tux.org>, March 2000. @@ -40,7 +41,9 @@ # define TREG_ASM "%r4" /* Cant clobber r3, it holds framemarker */ # define SAVE_ASM_PIC " copy %%r19, %" TREG_ASM "\n" # define LOAD_ASM_PIC " copy %" TREG_ASM ", %%r19\n" -# define USING_TREG TREG_ASM, +# define CLOB_TREG TREG_ASM , +# define PIC_REG_DEF register unsigned long __r19 asm("r19"); +# define PIC_REG_USE , "r" (__r19) #else # define TREG %r3 # define SAVE_PIC(SREG) nop ASM_LINE_SEP @@ -49,7 +52,9 @@ # define TREG_ASM # define SAVE_ASM_PIC "nop \n" # define LOAD_ASM_PIC "nop \n" -# define USING_TREG +# define CLOB_TREG +# define PIC_REG_DEF +# define PIC_REG_USE #endif #ifdef __ASSEMBLER__ @@ -344,7 +349,7 @@ L(pre_end): ASM_LINE_SEP \ TREG is clobbered and use that register to save/restore r19 across the syscall. */ -#define CALL_CLOB_REGS "%r1", "%r2", USING_TREG \ +#define CALL_CLOB_REGS "%r1", "%r2", CLOB_TREG \ "%r20", "%r29", "%r31" #undef INLINE_SYSCALL @@ -353,6 +358,7 @@ L(pre_end): ASM_LINE_SEP \ long __sys_res; \ { \ register unsigned long __res asm("r28"); \ + PIC_REG_DEF \ LOAD_ARGS_##nr(args) \ /* FIXME: HACK save/load r19 around syscall */ \ asm volatile( \ @@ -361,7 +367,7 @@ L(pre_end): ASM_LINE_SEP \ " ldi %1, %%r20\n" \ LOAD_ASM_PIC \ : "=r" (__res) \ - : "i" (SYS_ify(name)) ASM_ARGS_##nr \ + : "i" (SYS_ify(name)) PIC_REG_USE ASM_ARGS_##nr \ : "memory", CALL_CLOB_REGS CLOB_ARGS_##nr \ ); \ __sys_res = (long)__res; \ @@ -398,6 +404,7 @@ L(pre_end): ASM_LINE_SEP \ long __sys_res; \ { \ register unsigned long __res asm("r28"); \ + PIC_REG_DEF \ LOAD_ARGS_##nr(args) \ /* FIXME: HACK save/load r19 around syscall */ \ asm volatile( \ @@ -406,7 +413,7 @@ L(pre_end): ASM_LINE_SEP \ " ldi %1, %%r20\n" \ LOAD_ASM_PIC \ : "=r" (__res) \ - : "i" (SYS_ify(name)) ASM_ARGS_##nr \ + : "i" (SYS_ify(name)) PIC_REG_USE ASM_ARGS_##nr \ : "memory", CALL_CLOB_REGS CLOB_ARGS_##nr \ ); \ __sys_res = (long)__res; \ @@ -422,6 +429,7 @@ L(pre_end): ASM_LINE_SEP \ long __sys_res; \ { \ register unsigned long __res asm("r28"); \ + PIC_REG_DEF \ LOAD_ARGS_##nr(args) \ /* FIXME: HACK save/load r19 around syscall */ \ asm volatile( \ @@ -430,7 +438,7 @@ L(pre_end): ASM_LINE_SEP \ " copy %1, %%r20\n" \ LOAD_ASM_PIC \ : "=r" (__res) \ - : "r" (name) ASM_ARGS_##nr \ + : "r" (name) PIC_REG_USE ASM_ARGS_##nr \ : "memory", CALL_CLOB_REGS CLOB_ARGS_##nr \ ); \ __sys_res = (long)__res; \ diff --git a/ports/sysdeps/unix/sysv/linux/mips/mips32/posix_fadvise.c b/ports/sysdeps/unix/sysv/linux/mips/mips32/posix_fadvise.c new file mode 100644 index 000000000..04c952d2f --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/mips/mips32/posix_fadvise.c @@ -0,0 +1,42 @@ +/* Copyright (C) 2007 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 <errno.h> +#include <fcntl.h> +#include <sysdep.h> + +/* Advice the system about the expected behaviour of the application with + respect to the file associated with FD. */ + +int +posix_fadvise (int fd, off_t offset, off_t len, int advise) +{ +/* MIPS kernel only has NR_fadvise64 which acts as NR_fadvise64_64 */ +#ifdef __NR_fadvise64 + INTERNAL_SYSCALL_DECL (err); + int ret = INTERNAL_SYSCALL (fadvise64, err, 7, fd, 0, + __LONG_LONG_PAIR (offset >> 31, offset), + __LONG_LONG_PAIR (len >> 31, len), + advise); + if (INTERNAL_SYSCALL_ERROR_P (ret, err)) + return INTERNAL_SYSCALL_ERRNO (ret, err); + return 0; +#else + return ENOSYS; +#endif +} diff --git a/ports/sysdeps/unix/sysv/linux/mips/mips32/posix_fadvise64.c b/ports/sysdeps/unix/sysv/linux/mips/mips32/posix_fadvise64.c new file mode 100644 index 000000000..715d37e45 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/mips/mips32/posix_fadvise64.c @@ -0,0 +1,61 @@ +/* Copyright (C) 2007 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 <errno.h> +#include <fcntl.h> +#include <sysdep.h> + +/* Advice the system about the expected behaviour of the application with + respect to the file associated with FD. */ + +int +__posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise) +{ +/* MIPS kernel only has NR_fadvise64 which acts as NR_fadvise64_64 */ +#ifdef __NR_fadvise64 + INTERNAL_SYSCALL_DECL (err); + int ret = INTERNAL_SYSCALL (fadvise64, err, 7, fd, 0, + __LONG_LONG_PAIR ((long) (offset >> 32), + (long) offset), + __LONG_LONG_PAIR ((long) (len >> 32), + (long) len), + advise); + if (INTERNAL_SYSCALL_ERROR_P (ret, err)) + return INTERNAL_SYSCALL_ERRNO (ret, err); + return 0; +#else + return ENOSYS; +#endif +} + +#include <shlib-compat.h> + +#if SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_3_3) + +int +attribute_compat_text_section +__posix_fadvise64_l32 (int fd, off64_t offset, size_t len, int advise) +{ + return __posix_fadvise64_l64 (fd, offset, len, advise); +} + +versioned_symbol (libc, __posix_fadvise64_l64, posix_fadvise64, GLIBC_2_3_3); +compat_symbol (libc, __posix_fadvise64_l32, posix_fadvise64, GLIBC_2_2); +#else +strong_alias (__posix_fadvise64_l64, posix_fadvise64); +#endif diff --git a/ports/sysdeps/unix/sysv/linux/mips/mips32/readahead.c b/ports/sysdeps/unix/sysv/linux/mips/mips32/readahead.c new file mode 100644 index 000000000..b5b967ce9 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/mips/mips32/readahead.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/arm/eabi/readahead.c> diff --git a/ports/sysdeps/unix/sysv/linux/mips/mips32/sync_file_range.c b/ports/sysdeps/unix/sysv/linux/mips/mips32/sync_file_range.c new file mode 100644 index 000000000..13a21b0da --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/mips/mips32/sync_file_range.c @@ -0,0 +1,47 @@ +/* Selective file content synch'ing. + Copyright (C) 2006, 2007 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 <errno.h> +#include <fcntl.h> +#include <sys/types.h> + +#include <sysdep.h> +#include <sys/syscall.h> + + +#ifdef __NR_sync_file_range +int +sync_file_range (int fd, __off64_t from, __off64_t to, unsigned int flags) +{ + return INLINE_SYSCALL (sync_file_range, 7, fd, 0, + __LONG_LONG_PAIR ((long) (from >> 32), (long) from), + __LONG_LONG_PAIR ((long) (to >> 32), (long) to), + flags); +} +#else +int +sync_file_range (int fd, __off64_t from, __off64_t to, unsigned int flags) +{ + __set_errno (ENOSYS); + return -1; +} +stub_warning (sync_file_range) + +# include <stub-tag.h> +#endif diff --git a/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/posix_fadvise64.c b/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/posix_fadvise64.c new file mode 100644 index 000000000..40bafdbac --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/posix_fadvise64.c @@ -0,0 +1,56 @@ +/* Copyright (C) 2007 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 <errno.h> +#include <fcntl.h> +#include <sysdep.h> + +/* Advice the system about the expected behaviour of the application with + respect to the file associated with FD. */ + +int +__posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise) +{ +/* MIPS kernel only has NR_fadvise64 which acts as NR_fadvise64_64 */ +#ifdef __NR_fadvise64 + INTERNAL_SYSCALL_DECL (err); + int ret = INTERNAL_SYSCALL (fadvise64, err, 4, fd, offset, len, advise); + if (INTERNAL_SYSCALL_ERROR_P (ret, err)) + return INTERNAL_SYSCALL_ERRNO (ret, err); + return 0; +#else + return ENOSYS; +#endif +} + +#include <shlib-compat.h> + +#if SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_3_3) + +int +attribute_compat_text_section +__posix_fadvise64_l32 (int fd, off64_t offset, size_t len, int advise) +{ + return __posix_fadvise64_l64 (fd, offset, len, advise); +} + +versioned_symbol (libc, __posix_fadvise64_l64, posix_fadvise64, GLIBC_2_3_3); +compat_symbol (libc, __posix_fadvise64_l32, posix_fadvise64, GLIBC_2_2); +#else +strong_alias (__posix_fadvise64_l64, posix_fadvise64); +#endif diff --git a/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list b/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list new file mode 100644 index 000000000..babdba0ca --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list @@ -0,0 +1,5 @@ +# File name Caller Syscall name # args Strong name Weak names + +readahead - readahead i:iii __readahead readahead +sync_file_range - sync_file_range i:iiii sync_file_range +posix_fadvise - fadvise64 i:iiii posix_fadvise |