diff options
Diffstat (limited to 'libc/sysdeps/linux')
117 files changed, 1684 insertions, 766 deletions
diff --git a/libc/sysdeps/linux/alpha/bits/fcntl.h b/libc/sysdeps/linux/alpha/bits/fcntl.h index 0f32cec87..f2fa87ebe 100644 --- a/libc/sysdeps/linux/alpha/bits/fcntl.h +++ b/libc/sysdeps/linux/alpha/bits/fcntl.h @@ -21,8 +21,10 @@ # error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead." #endif - #include <sys/types.h> +#ifdef __USE_GNU +# include <bits/uio.h> +#endif /* open/fcntl - O_SYNC is only implemented on blocks devices and on files @@ -173,16 +175,45 @@ struct flock64 # define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ #endif -/* Linux-specific operations for posix_fadvise. */ + #ifdef __USE_GNU -# define LINUX_FADV_ASYNC_WRITE 32 /* Start writeout on range. */ -# define LINUX_FADV_WRITE_WAIT 33 /* Wait upon writeout to range. */ +# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages + in the range before performing the + write. */ +# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those + dirty pages in the range which are + not presently under writeback. */ +# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in + the range after performing the + write. */ #endif __BEGIN_DECLS +#if 0 /*def __USE_GNU*/ + /* Provide kernel hint to read ahead. */ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) __THROW; + +/* Selective file content synch'ing. */ +extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, + unsigned int __flags); + + +/* Splice address range into a pipe. */ +extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count, + unsigned int __flags); + +/* Splice two files together. */ +extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags) + __THROW; + +/* In-kernel implementation of tee for pipe buffers. */ +extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags) + __THROW; + +#endif + __END_DECLS diff --git a/libc/sysdeps/linux/alpha/bits/mman.h b/libc/sysdeps/linux/alpha/bits/mman.h index 2a84709d2..2f0e56491 100644 --- a/libc/sysdeps/linux/alpha/bits/mman.h +++ b/libc/sysdeps/linux/alpha/bits/mman.h @@ -96,7 +96,7 @@ # define MADV_SEQUENTIAL 2 /* Expect sequential page references. */ # define MADV_WILLNEED 3 /* Will need these pages. */ # define MADV_DONTNEED 6 /* Don't need these pages. */ -# define MADV_REMOVE 7 /* Remove these pages and resources. */ +# define MADV_REMOVE 9 /* Remove these pages and resources. */ # define MADV_DONTFORK 10 /* Do not inherit across fork. */ # define MADV_DOFORK 11 /* Do inherit across fork. */ #endif diff --git a/libc/sysdeps/linux/alpha/bits/stat.h b/libc/sysdeps/linux/alpha/bits/stat.h index 921283a51..148c6ff70 100644 --- a/libc/sysdeps/linux/alpha/bits/stat.h +++ b/libc/sysdeps/linux/alpha/bits/stat.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. +/* Copyright (C) 1996,1997,1998,1999,2000,2001,2004 + Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -24,11 +25,45 @@ #define _STAT_VER_KERNEL 0 #define _STAT_VER_GLIBC2 1 #define _STAT_VER_GLIBC2_1 2 -#define _STAT_VER _STAT_VER_GLIBC2_1 +#define _STAT_VER_KERNEL64 3 +#define _STAT_VER_GLIBC2_3_4 3 +#define _STAT_VER _STAT_VER_GLIBC2_3_4 /* Versions of the `xmknod' interface. */ #define _MKNOD_VER_LINUX 0 + +/* Nanosecond resolution timestamps are stored in a format equivalent to + 'struct timespec'. This is the type used whenever possible but the + Unix namespace rules do not allow the identifier 'timespec' to appear + in the <sys/stat.h> header. Therefore we have to handle the use of + this header in strictly standard-compliant sources special. + + Use neat tidy anonymous unions and structures when possible. */ + +#if 0 /*def __USE_MISC*/ +# if __GNUC_PREREQ(3,3) +# define __ST_TIME(X) \ + __extension__ union { \ + struct timespec st_##X##tim; \ + struct { \ + __time_t st_##X##time; \ + unsigned long st_##X##timensec; \ + }; \ + } +# else +# define __ST_TIME(X) struct timespec st_##X##tim +# define st_atime st_atim.tv_sec +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +# endif +#else +# define __ST_TIME(X) \ + __time_t st_##X##time; \ + unsigned long st_##X##timensec +#endif + + struct stat { __dev_t st_dev; /* Device. */ @@ -36,28 +71,26 @@ struct stat __ino64_t st_ino; /* File serial number. */ #else __ino_t st_ino; /* File serial number. */ - int __pad1; + int __pad0; /* 64-bit st_ino. */ #endif - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ __dev_t st_rdev; /* Device number, if device. */ __off_t st_size; /* Size of file, in bytes. */ - __time_t st_atime; /* Time of last access. */ - __time_t st_mtime; /* Time of last modification. */ - __time_t st_ctime; /* Time of last status change. */ #ifdef __USE_FILE_OFFSET64 __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */ #else __blkcnt_t st_blocks; /* Nr. 512-byte blocks allocated. */ - int __pad2; + int __pad1; /* 64-bit st_blocks. */ #endif + __mode_t st_mode; /* File mode. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ __blksize_t st_blksize; /* Optimal block size for I/O. */ - unsigned int st_flags; - unsigned int st_gen; - int __pad3; - long __unused[4]; + __nlink_t st_nlink; /* Link count. */ + int __pad2; /* Real padding. */ + __ST_TIME(a); /* Time of last access. */ + __ST_TIME(m); /* Time of last modification. */ + __ST_TIME(c); /* Time of last status change. */ + long __unused[3]; }; #ifdef __USE_LARGEFILE64 @@ -66,27 +99,28 @@ struct stat64 { __dev_t st_dev; /* Device. */ __ino64_t st_ino; /* File serial number. */ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ __dev_t st_rdev; /* Device number, if device. */ __off_t st_size; /* Size of file, in bytes. */ - __time_t st_atime; /* Time of last access. */ - __time_t st_mtime; /* Time of last modification. */ - __time_t st_ctime; /* Time of last status change. */ __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */ + __mode_t st_mode; /* File mode. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ __blksize_t st_blksize; /* Optimal block size for I/O. */ - unsigned int st_flags; - unsigned int st_gen; - int __pad3; - long __unused[4]; + __nlink_t st_nlink; /* Link count. */ + int __pad0; /* Real padding. */ + __ST_TIME(a); /* Time of last access. */ + __ST_TIME(m); /* Time of last modification. */ + __ST_TIME(c); /* Time of last status change. */ + long __unused[3]; }; #endif +#undef __ST_TIME + /* Tell code we have these members. */ #define _STATBUF_ST_BLKSIZE #define _STATBUF_ST_RDEV +#define _STATBUF_ST_NSEC /* Encoding of the file mode. */ diff --git a/libc/sysdeps/linux/alpha/bits/syscalls.h b/libc/sysdeps/linux/alpha/bits/syscalls.h index 3c227e643..561d4bf15 100644 --- a/libc/sysdeps/linux/alpha/bits/syscalls.h +++ b/libc/sysdeps/linux/alpha/bits/syscalls.h @@ -9,12 +9,12 @@ * programs. */ #include <bits/sysnum.h> -#ifndef __set_errno -# define __set_errno(val) (*__errno_location ()) = (val) -#endif - #ifndef __ASSEMBLER__ +#include <errno.h> + +#define SYS_ify(syscall_name) (__NR_##syscall_name) + #define _syscall_return(type) \ return (_sc_err ? __set_errno(_sc_ret), _sc_ret = -1L : 0), (type) _sc_ret diff --git a/libc/sysdeps/linux/alpha/brk.S b/libc/sysdeps/linux/alpha/brk.S index 05c3b2c43..42c7368b4 100644 --- a/libc/sysdeps/linux/alpha/brk.S +++ b/libc/sysdeps/linux/alpha/brk.S @@ -30,13 +30,13 @@ .section .bss .align 3 .globl __curbrk + .hidden __curbrk __curbrk: .skip 8 .type __curbrk,@object .size __curbrk,8 #else .comm __curbrk, 8 #endif -libc_hidden_data_def(__curbrk) .text .globl brk; diff --git a/libc/sysdeps/linux/alpha/fpu_control.h b/libc/sysdeps/linux/alpha/fpu_control.h index 28acdf170..cdffcfb9d 100644 --- a/libc/sysdeps/linux/alpha/fpu_control.h +++ b/libc/sysdeps/linux/alpha/fpu_control.h @@ -100,7 +100,9 @@ /* Type of the control word. */ typedef unsigned int fpu_control_t; +#if 0 /* Default control word set at startup. */ extern fpu_control_t __fpu_control; +#endif #endif /* _ALPHA_FPU_CONTROL */ diff --git a/libc/sysdeps/linux/arm/bits/fcntl.h b/libc/sysdeps/linux/arm/bits/fcntl.h index 536851525..c7d667a6a 100644 --- a/libc/sysdeps/linux/arm/bits/fcntl.h +++ b/libc/sysdeps/linux/arm/bits/fcntl.h @@ -21,35 +21,34 @@ # error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead." #endif - #include <sys/types.h> +#ifdef __USE_GNU +# include <bits/uio.h> +#endif + /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ -#define O_ACCMODE 0003 -#define O_RDONLY 00 -#define O_WRONLY 01 -#define O_RDWR 02 -#define O_CREAT 0100 /* not fcntl */ -#define O_EXCL 0200 /* not fcntl */ -#define O_NOCTTY 0400 /* not fcntl */ -#define O_TRUNC 01000 /* not fcntl */ -#define O_APPEND 02000 -#define O_NONBLOCK 04000 +#define O_ACCMODE 0003 +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 +#define O_CREAT 0100 /* not fcntl */ +#define O_EXCL 0200 /* not fcntl */ +#define O_NOCTTY 0400 /* not fcntl */ +#define O_TRUNC 01000 /* not fcntl */ +#define O_APPEND 02000 +#define O_NONBLOCK 04000 #define O_NDELAY O_NONBLOCK -#define O_SYNC 010000 -#define O_FSYNC O_SYNC -#define O_ASYNC 020000 +#define O_SYNC 010000 +#define O_FSYNC O_SYNC +#define O_ASYNC 020000 #ifdef __USE_GNU -# define O_DIRECTORY 040000 /* Must be a directory. */ +# define O_DIRECTORY 040000 /* Must be a directory. */ # define O_NOFOLLOW 0100000 /* Do not follow links. */ # define O_DIRECT 0200000 /* Direct disk access. */ -# define O_NOATIME 01000000 /* Do not set atime. */ -#endif - -#ifdef __USE_LARGEFILE64 -# define O_LARGEFILE 0400000 +# define O_NOATIME 01000000 /* Do not set atime. */ #endif /* For now Linux has synchronisity options for data and read operations. @@ -60,13 +59,16 @@ # define O_RSYNC O_SYNC /* Synchronize read operations. */ #endif +#ifdef __USE_LARGEFILE64 +# define O_LARGEFILE 0400000 +#endif + /* 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. */ - #ifndef __USE_FILE_OFFSET64 # define F_GETLK 5 /* Get record locking info. */ # define F_SETLK 6 /* Set record locking info (non-blocking). */ @@ -104,12 +106,12 @@ #define F_WRLCK 1 /* Write lock. */ #define F_UNLCK 2 /* Remove lock. */ -/* for old implementation of bsd flock () */ +/* For old implementation of bsd flock(). */ #define F_EXLCK 4 /* or 3 */ #define F_SHLCK 8 /* or 4 */ #ifdef __USE_BSD -/* Operations for bsd flock(), also used by the kernel implementation */ +/* Operations for bsd flock(), also used by the kernel implementation. */ # define LOCK_SH 1 /* shared lock */ # define LOCK_EX 2 /* exclusive lock */ # define LOCK_NB 4 /* or'd with one of the above to prevent @@ -180,16 +182,54 @@ struct flock64 # define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ #endif -/* Linux-specific operations for posix_fadvise. */ + #ifdef __USE_GNU -# define LINUX_FADV_ASYNC_WRITE 32 /* Start writeout on range. */ -# define LINUX_FADV_WRITE_WAIT 33 /* Wait upon writeout to range. */ +/* Flags for SYNC_FILE_RANGE. */ +# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages + in the range before performing the + write. */ +# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those + dirty pages in the range which are + not presently under writeback. */ +# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in + the range after performing the + write. */ + +/* Flags for SPLICE and VMSPLICE. */ +# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */ +# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing + (but we may still block on the fd + we splice from/to). */ +# define SPLICE_F_MORE 4 /* Expect more data. */ +# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */ #endif __BEGIN_DECLS +#if 0 /*def __USE_GNU*/ + /* Provide kernel hint to read ahead. */ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) __THROW; + +/* Selective file content synch'ing. */ +extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, + unsigned int __flags); + + +/* Splice address range into a pipe. */ +extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count, + unsigned int __flags); + +/* Splice two files together. */ +extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags) + __THROW; + +/* In-kernel implementation of tee for pipe buffers. */ +extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags) + __THROW; + +#endif + __END_DECLS diff --git a/libc/sysdeps/linux/arm/bits/huge_val.h b/libc/sysdeps/linux/arm/bits/huge_val.h index 625cdc5c3..a215f3c0b 100644 --- a/libc/sysdeps/linux/arm/bits/huge_val.h +++ b/libc/sysdeps/linux/arm/bits/huge_val.h @@ -1,7 +1,8 @@ -/* `HUGE_VAL' constants for IEEE 754 machines (where it is infinity). +/* `HUGE_VAL' constant for IEEE 754 machines (where it is infinity). Used by <stdlib.h> and <math.h> functions for overflow. ARM version. - Copyright (C) 1992, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. + Copyright (C) 1992, 95, 96, 97, 98, 99, 2000, 2004 + 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 @@ -23,24 +24,25 @@ # error "Never use <bits/huge_val.h> directly; include <math.h> instead." #endif -#include <features.h> - /* IEEE positive infinity (-HUGE_VAL is negative infinity). */ -#ifdef __GNUC__ - -# if __GNUC_PREREQ(2,96) - -# define HUGE_VAL (__extension__ 0x1.0p2047) - -# else +#if __GNUC_PREREQ(3,3) +# define HUGE_VAL (__builtin_huge_val()) +#elif __GNUC_PREREQ(2,96) +# define HUGE_VAL (__extension__ 0x1.0p2047) +#elif defined __GNUC__ -# define HUGE_VAL \ +#ifndef __CONFIG_ARM_EABI__ +# define HUGE_VAL \ (__extension__ \ ((union { unsigned __l __attribute__((__mode__(__DI__))); double __d; }) \ { __l: 0x000000007ff00000ULL }).__d) - -# endif +#else +# define HUGE_VAL \ + (__extension__ \ + ((union { unsigned __l __attribute__((__mode__(__DI__))); double __d; }) \ + { __l: 0x7ff0000000000000ULL }).__d) +#endif #else /* not GCC */ @@ -48,57 +50,23 @@ typedef union { unsigned char __c[8]; double __d; } __huge_val_t; +#ifndef __CONFIG_ARM_EABI__ # if __BYTE_ORDER == __BIG_ENDIAN # define __HUGE_VAL_bytes { 0, 0, 0, 0, 0x7f, 0xf0, 0, 0 } # endif # if __BYTE_ORDER == __LITTLE_ENDIAN # define __HUGE_VAL_bytes { 0, 0, 0xf0, 0x7f, 0, 0, 0, 0 } # endif +#else +# if __BYTE_ORDER == __BIG_ENDIAN +# define __HUGE_VAL_bytes { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } +# endif +# if __BYTE_ORDER == __LITTLE_ENDIAN +# define __HUGE_VAL_bytes { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } +# endif +#endif static __huge_val_t __huge_val = { __HUGE_VAL_bytes }; # define HUGE_VAL (__huge_val.__d) #endif /* GCC. */ - - -/* ISO C99 extensions: (float) HUGE_VALF and (long double) HUGE_VALL. */ - -#ifdef __USE_ISOC99 - -# ifdef __GNUC__ - -# if __GNUC_PREREQ(2,96) - -# define HUGE_VALF (__extension__ 0x1.0p255f) - -# else - -# define HUGE_VALF \ - (__extension__ \ - ((union { unsigned __l __attribute__((__mode__(__SI__))); float __d; }) \ - { __l: 0x7f800000UL }).__d) - -# endif - -# else /* not GCC */ - -typedef union { unsigned char __c[4]; float __f; } __huge_valf_t; - -# if __BYTE_ORDER == __BIG_ENDIAN -# define __HUGE_VALF_bytes { 0x7f, 0x80, 0, 0 } -# endif -# if __BYTE_ORDER == __LITTLE_ENDIAN -# define __HUGE_VALF_bytes { 0, 0, 0x80, 0x7f } -# endif - -static __huge_valf_t __huge_valf = { __HUGE_VALF_bytes }; -# define HUGE_VALF (__huge_valf.__f) - -# endif /* GCC. */ - - -/* Generally there is no separate `long double' format and it is the - same as `double'. */ -# define HUGE_VALL HUGE_VAL - -#endif /* __USE_ISOC99. */ diff --git a/libc/sysdeps/linux/arm/bits/mathdef.h b/libc/sysdeps/linux/arm/bits/mathdef.h index 44d7f0dde..e013e74b7 100644 --- a/libc/sysdeps/linux/arm/bits/mathdef.h +++ b/libc/sysdeps/linux/arm/bits/mathdef.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2000, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -29,10 +29,6 @@ typedef float float_t; /* `float' expressions are evaluated as typedef double double_t; /* `double' expressions are evaluated as `double'. */ -/* Define `INFINITY' as value of type `float'. */ -# define INFINITY HUGE_VALF - - /* The values returned by `ilogb' for 0 and NaN respectively. */ # define FP_ILOGB0 (-2147483647) # define FP_ILOGBNAN (2147483647) diff --git a/libc/sysdeps/linux/arm/bits/mman.h b/libc/sysdeps/linux/arm/bits/mman.h index 7430f15b3..828ec944c 100644 --- a/libc/sysdeps/linux/arm/bits/mman.h +++ b/libc/sysdeps/linux/arm/bits/mman.h @@ -1,5 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/ARM version. - Copyright (C) 1997, 2000, 2003, 2005 Free Software Foundation, Inc. + Copyright (C) 1997, 2000, 2003, 2005, 2006 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 @@ -18,7 +18,7 @@ 02111-1307 USA. */ #ifndef _SYS_MMAN_H -# error "Never include this file directly. Use <sys/mman.h> instead" +# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead." #endif /* The following definitions basically come from the kernel headers. @@ -88,6 +88,9 @@ # 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. */ +# define MADV_REMOVE 9 /* Remove these pages and resources. */ +# define MADV_DONTFORK 10 /* Do not inherit across fork. */ +# define MADV_DOFORK 11 /* Do inherit across fork. */ #endif /* The POSIX people had to invent similar names for the same things. */ diff --git a/libc/sysdeps/linux/arm/bits/syscalls.h b/libc/sysdeps/linux/arm/bits/syscalls.h index d25d1824e..64c625f6d 100644 --- a/libc/sysdeps/linux/arm/bits/syscalls.h +++ b/libc/sysdeps/linux/arm/bits/syscalls.h @@ -9,19 +9,17 @@ * programs. */ #include <bits/sysnum.h> -#ifndef __set_errno -# define __set_errno(val) (*__errno_location ()) = (val) -#endif -#ifndef SYS_ify -# define SYS_ify(syscall_name) (__NR_##syscall_name) -#endif - /* Some of the sneaky macros in the code were taken from glibc-2.3.2/sysdeps/unix/sysv/linux/arm/sysdep.h */ -#ifdef __ASSEMBLER__ +#ifndef __ASSEMBLER__ + +#include <errno.h> + +#define SYS_ify(syscall_name) (__NR_##syscall_name) + /* Call a given syscall, with arguments loaded. For EABI, we must save and restore r7 for the syscall number. Unlike the DO_CALL macro in glibc, this macro does not load syscall arguments. */ diff --git a/libc/sysdeps/linux/arm/brk.c b/libc/sysdeps/linux/arm/brk.c index 3d606e533..47179901f 100644 --- a/libc/sysdeps/linux/arm/brk.c +++ b/libc/sysdeps/linux/arm/brk.c @@ -24,7 +24,7 @@ libc_hidden_proto(brk) /* This must be initialized data because commons can't have aliases. */ -void *__curbrk = 0; +void *__curbrk attribute_hidden = 0; int brk (void *addr) { diff --git a/libc/sysdeps/linux/arm/bsd-_setjmp.S b/libc/sysdeps/linux/arm/bsd-_setjmp.S index 4e36143f8..f70073266 100644 --- a/libc/sysdeps/linux/arm/bsd-_setjmp.S +++ b/libc/sysdeps/linux/arm/bsd-_setjmp.S @@ -21,10 +21,6 @@ We cannot do it in C because it must be a tail-call, so frame-unwinding in setjmp doesn't clobber the state restored by longjmp. */ -#define _SETJMP_H -#define _ASM -#include <bits/setjmp.h> - .global _setjmp .type _setjmp,%function .align 2 diff --git a/libc/sysdeps/linux/arm/bsd-setjmp.S b/libc/sysdeps/linux/arm/bsd-setjmp.S index e803d1583..6253c6675 100644 --- a/libc/sysdeps/linux/arm/bsd-setjmp.S +++ b/libc/sysdeps/linux/arm/bsd-setjmp.S @@ -21,10 +21,6 @@ We cannot do it in C because it must be a tail-call, so frame-unwinding in setjmp doesn't clobber the state restored by longjmp. */ -#define _SETJMP_H -#define _ASM -#include <bits/setjmp.h> - .global setjmp .type setjmp,%function .align 2 diff --git a/libc/sysdeps/linux/arm/fpu_control.h b/libc/sysdeps/linux/arm/fpu_control.h index 31d81ea29..1170c9e97 100644 --- a/libc/sysdeps/linux/arm/fpu_control.h +++ b/libc/sysdeps/linux/arm/fpu_control.h @@ -89,7 +89,7 @@ typedef unsigned int fpu_control_t; #define _FPU_GETCW(cw) ({ \ register int __t1, __t2; \ \ - __asm__ volatile ( \ + __asm__ __volatile__ ( \ "cfmvr64l %1, mvdx0\n\t" \ "cfmvr64h %2, mvdx0\n\t" \ "cfmv32sc mvdx0, dspsc\n\t" \ @@ -103,7 +103,7 @@ typedef unsigned int fpu_control_t; #define _FPU_SETCW(cw) ({ \ register int __t0, __t1, __t2; \ \ - __asm__ volatile ( \ + __asm__ __volatile__ ( \ "cfmvr64l %1, mvdx0\n\t" \ "cfmvr64h %2, mvdx0\n\t" \ "cfmv64lr mvdx0, %0\n\t" \ @@ -195,7 +195,9 @@ typedef unsigned int fpu_control_t; #endif /* __MAVERICK__ */ +#if 0 /* Default control word set at startup. */ extern fpu_control_t __fpu_control; +#endif #endif /* _FPU_CONTROL_H */ diff --git a/libc/sysdeps/linux/arm/ioperm.c b/libc/sysdeps/linux/arm/ioperm.c index a0a4e7d1d..1ae2297cb 100644 --- a/libc/sysdeps/linux/arm/ioperm.c +++ b/libc/sysdeps/linux/arm/ioperm.c @@ -222,40 +222,40 @@ libc_hidden_def(ioperm) void outb(unsigned char b, unsigned long int port) { - *((volatile unsigned char *)(IO_ADDR (port))) = b; + *((__volatile__ unsigned char *)(IO_ADDR (port))) = b; } void outw(unsigned short b, unsigned long int port) { - *((volatile unsigned short *)(IO_ADDR (port))) = b; + *((__volatile__ unsigned short *)(IO_ADDR (port))) = b; } void outl(unsigned long b, unsigned long int port) { - *((volatile unsigned long *)(IO_ADDR (port))) = b; + *((__volatile__ unsigned long *)(IO_ADDR (port))) = b; } unsigned char inb (unsigned long int port) { - return *((volatile unsigned char *)(IO_ADDR (port))); + return *((__volatile__ unsigned char *)(IO_ADDR (port))); } unsigned short int inw(unsigned long int port) { - return *((volatile unsigned short *)(IO_ADDR (port))); + return *((__volatile__ unsigned short *)(IO_ADDR (port))); } unsigned long int inl(unsigned long int port) { - return *((volatile unsigned long *)(IO_ADDR (port))); + return *((__volatile__ unsigned long *)(IO_ADDR (port))); } diff --git a/libc/sysdeps/linux/arm/setjmp.S b/libc/sysdeps/linux/arm/setjmp.S index dea6f5675..ceea96a40 100644 --- a/libc/sysdeps/linux/arm/setjmp.S +++ b/libc/sysdeps/linux/arm/setjmp.S @@ -18,9 +18,6 @@ 02111-1307 USA. */ #include <features.h> -#define _SETJMP_H -#define _ASM -#include <bits/setjmp.h> .global __sigsetjmp .type __sigsetjmp,%function diff --git a/libc/sysdeps/linux/arm/sys/ucontext.h b/libc/sysdeps/linux/arm/sys/ucontext.h index 1260ee594..9ecff7b59 100644 --- a/libc/sysdeps/linux/arm/sys/ucontext.h +++ b/libc/sysdeps/linux/arm/sys/ucontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1998, 1999, 2001, 2006 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,12 +24,15 @@ #include <features.h> #include <signal.h> #include <sys/procfs.h> + +/* We need the signal context definitions even if they are not used + included in <signal.h>. */ #include <bits/sigcontext.h> typedef int greg_t; /* Number of general registers. */ -#define NGREG 16 +#define NGREG 18 /* Container for all general registers. */ typedef elf_gregset_t gregset_t; @@ -74,21 +77,21 @@ enum /* Structure to describe FPU registers. */ typedef elf_fpregset_t fpregset_t; -/* Context to describe whole processor state. */ -typedef struct - { - gregset_t gregs; - fpregset_t fpregs; - } mcontext_t; +/* Context to describe whole processor state. This only describes + the core registers; coprocessor registers get saved elsewhere + (e.g. in uc_regspace, or somewhere unspecified on the stack + during non-RT signal handlers). */ +typedef struct sigcontext mcontext_t; /* Userlevel context. */ typedef struct ucontext -{ - unsigned long uc_flags; - struct ucontext *uc_link; - stack_t uc_stack; - struct sigcontext uc_mcontext; - sigset_t uc_sigmask; /* mask last for extensibility */ -} ucontext_t; + { + unsigned long uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + __sigset_t uc_sigmask; + unsigned long uc_regspace[128] __attribute__((__aligned__(8))); + } ucontext_t; #endif /* sys/ucontext.h */ diff --git a/libc/sysdeps/linux/arm/syscall.c b/libc/sysdeps/linux/arm/syscall.c index 33d9f5fea..60fbcf89b 100644 --- a/libc/sysdeps/linux/arm/syscall.c +++ b/libc/sysdeps/linux/arm/syscall.c @@ -15,14 +15,14 @@ long syscall(long sysnum, long a, long b, long c, long d, long e, long f) { #if !defined(__thumb__) - register long _r0 asm("r0")=(long)(sysnum); - register long _r6 asm("r6")=(long)(f); - register long _r5 asm("r5")=(long)(e); - register long _r4 asm("r4")=(long)(d); - register long _r3 asm("r3")=(long)(c); - register long _r2 asm("r2")=(long)(b); - register long _r1 asm("r1")=(long)(a); - asm volatile( + register long _r0 __asm__("r0")=(long)(sysnum); + register long _r6 __asm__("r6")=(long)(f); + register long _r5 __asm__("r5")=(long)(e); + register long _r4 __asm__("r4")=(long)(d); + register long _r3 __asm__("r3")=(long)(c); + register long _r2 __asm__("r2")=(long)(b); + register long _r1 __asm__("r1")=(long)(a); + __asm__ __volatile__( "swi %1" : "=r"(_r0) : "i"(__NR_syscall), "r"(_r0), "r"(_r1), @@ -30,14 +30,14 @@ long syscall(long sysnum, long a, long b, long c, long d, long e, long f) "r"(_r6) : "memory"); #else - register long _r7 asm("r7")=(long)(sysnum); - register long _r5 asm("r5")=(long)(f); - register long _r4 asm("r4")=(long)(e); - register long _r3 asm("r3")=(long)(d); - register long _r2 asm("r2")=(long)(c); - register long _r1 asm("r1")=(long)(b); - register long _r0 asm("r0")=(long)(a); - asm volatile( + register long _r7 __asm__("r7")=(long)(sysnum); + register long _r5 __asm__("r5")=(long)(f); + register long _r4 __asm__("r4")=(long)(e); + register long _r3 __asm__("r3")=(long)(d); + register long _r2 __asm__("r2")=(long)(c); + register long _r1 __asm__("r1")=(long)(b); + register long _r0 __asm__("r0")=(long)(a); + __asm__ __volatile__( "swi 0" : "=r"(_r0) : "r"(_r0), "r"(_r1), "r"(_r2), "r"(_r3), diff --git a/libc/sysdeps/linux/bfin/bits/fcntl.h b/libc/sysdeps/linux/bfin/bits/fcntl.h index 4b41b4715..ebf925acf 100644 --- a/libc/sysdeps/linux/bfin/bits/fcntl.h +++ b/libc/sysdeps/linux/bfin/bits/fcntl.h @@ -23,6 +23,9 @@ #include <sys/types.h> +#ifdef __USE_GNU +# include <bits/uio.h> +#endif /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ @@ -178,3 +181,45 @@ struct flock64 # define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */ # define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ #endif + +#ifdef __USE_GNU +# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages + in the range before performing the + write. */ +# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those + dirty pages in the range which are + not presently under writeback. */ +# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in + the range after performing the + write. */ +#endif + +__BEGIN_DECLS + +#if 0 /*def __USE_GNU*/ + +/* Provide kernel hint to read ahead. */ +extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) + __THROW; + + +/* Selective file content synch'ing. */ +extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, + unsigned int __flags); + + +/* Splice address range into a pipe. */ +extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count, + unsigned int __flags); + +/* Splice two files together. */ +extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags) + __THROW; + +/* In-kernel implementation of tee for pipe buffers. */ +extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags) + __THROW; + +#endif + +__END_DECLS diff --git a/libc/sysdeps/linux/bfin/bits/kernel_stat.h b/libc/sysdeps/linux/bfin/bits/kernel_stat.h index f10f72ae1..1bfdb8e44 100644 --- a/libc/sysdeps/linux/bfin/bits/kernel_stat.h +++ b/libc/sysdeps/linux/bfin/bits/kernel_stat.h @@ -29,22 +29,20 @@ struct kernel_stat { }; struct kernel_stat64 { - unsigned char __pad0[6]; unsigned short st_dev; - unsigned char __pad1[2]; + unsigned char __pad0[10]; #define _HAVE_STAT64___ST_INO unsigned long __st_ino; unsigned int st_mode; unsigned int st_nlink; unsigned long st_uid; unsigned long st_gid; - unsigned char __pad2[6]; unsigned short st_rdev; - unsigned char __pad3[2]; + unsigned char __pad3[10]; long long st_size; unsigned long st_blksize; - unsigned long __pad4; /* future possible st_blocks high bits */ unsigned long st_blocks; /* Number 512-byte blocks allocated. */ + unsigned long __pad4; /* future possible st_blocks high bits */ unsigned long st_atime; unsigned long __pad5; unsigned long st_mtime; @@ -53,5 +51,5 @@ struct kernel_stat64 { unsigned long __pad7; /* will be high 32 bits of ctime someday */ unsigned long long st_ino; }; -#endif /* _BITS_STAT_STRUCT_H */ +#endif /* _BITS_STAT_STRUCT_H */ diff --git a/libc/sysdeps/linux/bfin/bits/mman.h b/libc/sysdeps/linux/bfin/bits/mman.h index c75ff4b0d..06767a9c0 100644 --- a/libc/sysdeps/linux/bfin/bits/mman.h +++ b/libc/sysdeps/linux/bfin/bits/mman.h @@ -72,6 +72,7 @@ /* Flags for `mremap'. */ #ifdef __USE_GNU # define MREMAP_MAYMOVE 1 +# define MREMAP_FIXED 2 #endif /* Advice to `madvise'. */ diff --git a/libc/sysdeps/linux/bfin/bits/syscalls.h b/libc/sysdeps/linux/bfin/bits/syscalls.h index 475d193ce..2309f7f6d 100644 --- a/libc/sysdeps/linux/bfin/bits/syscalls.h +++ b/libc/sysdeps/linux/bfin/bits/syscalls.h @@ -9,15 +9,11 @@ * programs. */ #include <bits/sysnum.h> -#ifndef __set_errno -# define __set_errno(val) ((*__errno_location ()) = (val)) -#endif +#ifndef __ASSEMBLER__ -#ifndef SYS_ify -# define SYS_ify(syscall_name) (__NR_##syscall_name) -#endif +#include <errno.h> -#ifndef __ASSEMBLER__ +#define SYS_ify(syscall_name) (__NR_##syscall_name) /* user-visible error numbers are in the range -1 - -4095: see <asm-frv/errno.h> */ #if defined _LIBC && !defined __set_errno diff --git a/libc/sysdeps/linux/bfin/brk.c b/libc/sysdeps/linux/bfin/brk.c index 5735321bb..620c0b683 100644 --- a/libc/sysdeps/linux/bfin/brk.c +++ b/libc/sysdeps/linux/bfin/brk.c @@ -11,7 +11,7 @@ libc_hidden_proto(brk) /* This must be initialized data because commons can't have aliases. */ -void * __curbrk = 0; +void * __curbrk attribute_hidden = 0; int brk (void *addr) { diff --git a/libc/sysdeps/linux/cris/__init_brk.c b/libc/sysdeps/linux/cris/__init_brk.c index df41f9b4c..c8c6a37e7 100644 --- a/libc/sysdeps/linux/cris/__init_brk.c +++ b/libc/sysdeps/linux/cris/__init_brk.c @@ -5,10 +5,9 @@ #include <errno.h> #include "sysdep.h" -void * __curbrk = 0; +void * __curbrk attribute_hidden = 0; -extern int __init_brk (void); -libc_hidden_proto(__init_brk) +extern int __init_brk (void) attribute_hidden; int __init_brk (void) { @@ -31,4 +30,3 @@ __init_brk (void) } return 0; } -libc_hidden_def(__init_brk) diff --git a/libc/sysdeps/linux/cris/bits/fcntl.h b/libc/sysdeps/linux/cris/bits/fcntl.h index 36799aa50..8baa20555 100644 --- a/libc/sysdeps/linux/cris/bits/fcntl.h +++ b/libc/sysdeps/linux/cris/bits/fcntl.h @@ -24,6 +24,9 @@ #include <sys/types.h> +#ifdef __USE_GNU +# include <bits/uio.h> +#endif /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ @@ -180,10 +183,44 @@ struct flock64 # define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ #endif +#ifdef __USE_GNU +# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages + in the range before performing the + write. */ +# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those + dirty pages in the range which are + not presently under writeback. */ +# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in + the range after performing the + write. */ +#endif + __BEGIN_DECLS +#if 0 /*def __USE_GNU*/ + /* Provide kernel hint to read ahead. */ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) __THROW; + +/* Selective file content synch'ing. */ +extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, + unsigned int __flags); + + +/* Splice address range into a pipe. */ +extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count, + unsigned int __flags); + +/* Splice two files together. */ +extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags) + __THROW; + +/* In-kernel implementation of tee for pipe buffers. */ +extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags) + __THROW; + +#endif + __END_DECLS diff --git a/libc/sysdeps/linux/cris/bits/syscalls.h b/libc/sysdeps/linux/cris/bits/syscalls.h index ce68c04d4..8b74518ce 100644 --- a/libc/sysdeps/linux/cris/bits/syscalls.h +++ b/libc/sysdeps/linux/cris/bits/syscalls.h @@ -8,16 +8,11 @@ /* Include the __NR_<name> definitions. */ #include <bits/sysnum.h> -#if 0 -#ifndef __set_errno -#define __set_errno(val) (*__errno_location()) = (val) -#endif -#endif +#ifndef __ASSEMBLER__ -#undef SYS_ify -#define SYS_ify(syscall_name) (__NR_##syscall_name) +#include <errno.h> -#ifndef __ASSEMBLER__ +#define SYS_ify(syscall_name) (__NR_##syscall_name) #undef _syscall0 #define _syscall0(type,name) \ diff --git a/libc/sysdeps/linux/cris/brk.c b/libc/sysdeps/linux/cris/brk.c index 8183aabf3..938b15714 100644 --- a/libc/sysdeps/linux/cris/brk.c +++ b/libc/sysdeps/linux/cris/brk.c @@ -9,13 +9,10 @@ #include <errno.h> #include "sysdep.h" -libc_hidden_proto(brk) - -extern void * __curbrk; - -extern int __init_brk (void); -libc_hidden_proto(__init_brk) +extern void * __curbrk attribute_hidden; +extern int __init_brk (void) attribute_hidden; +libc_hidden_proto(brk) int brk(void * end_data_seg) { if (__init_brk () == 0) { diff --git a/libc/sysdeps/linux/cris/sbrk.c b/libc/sysdeps/linux/cris/sbrk.c index 934dc90c4..f3fab95bb 100644 --- a/libc/sysdeps/linux/cris/sbrk.c +++ b/libc/sysdeps/linux/cris/sbrk.c @@ -10,13 +10,10 @@ #include <errno.h> #include "sysdep.h" -libc_hidden_proto(sbrk) - -extern void * __curbrk; - -extern int __init_brk (void); -libc_hidden_proto(__init_brk) +extern void * __curbrk attribute_hidden; +extern int __init_brk (void) attribute_hidden; +libc_hidden_proto(sbrk) void * sbrk(intptr_t increment) { diff --git a/libc/sysdeps/linux/frv/__init_brk.c b/libc/sysdeps/linux/frv/__init_brk.c index b688f98af..07cf32022 100644 --- a/libc/sysdeps/linux/frv/__init_brk.c +++ b/libc/sysdeps/linux/frv/__init_brk.c @@ -4,13 +4,12 @@ #include <unistd.h> #include <sys/syscall.h> -void * __curbrk = 0; +void * __curbrk attribute_hidden = 0; #define __NR__brk __NR_brk attribute_hidden _syscall1(void *, _brk, void *, ptr); -extern int __init_brk(void); -libc_hidden_proto(__init_brk) +extern int __init_brk(void) attribute_hidden; int __init_brk (void) { @@ -25,4 +24,3 @@ __init_brk (void) } return 0; } -libc_hidden_def(__init_brk) diff --git a/libc/sysdeps/linux/frv/bits/syscalls.h b/libc/sysdeps/linux/frv/bits/syscalls.h index 23219d602..fae1079bd 100644 --- a/libc/sysdeps/linux/frv/bits/syscalls.h +++ b/libc/sysdeps/linux/frv/bits/syscalls.h @@ -9,12 +9,12 @@ * programs. */ #include <bits/sysnum.h> -#ifndef SYS_ify -# define SYS_ify(syscall_name) (__NR_##syscall_name) -#endif - #ifndef __ASSEMBLER__ +#include <errno.h> + +#define SYS_ify(syscall_name) (__NR_##syscall_name) + /* user-visible error numbers are in the range -1 - -4095: see <asm-frv/errno.h> */ #if defined _LIBC && !defined __set_errno # define __syscall_return(type, res) \ diff --git a/libc/sysdeps/linux/frv/brk.c b/libc/sysdeps/linux/frv/brk.c index b26f74fec..c69c97ad6 100644 --- a/libc/sysdeps/linux/frv/brk.c +++ b/libc/sysdeps/linux/frv/brk.c @@ -9,14 +9,11 @@ #include <unistd.h> #include <sys/syscall.h> -libc_hidden_proto(brk) - -extern void * __curbrk; - -extern int __init_brk (void); -libc_hidden_proto(__init_brk) +extern void * __curbrk attribute_hidden; +extern int __init_brk (void) attribute_hidden; extern void *_brk(void *ptr) attribute_hidden; +libc_hidden_proto(brk) int brk(void * end_data_seg) { if (__init_brk () == 0) diff --git a/libc/sysdeps/linux/frv/sbrk.c b/libc/sysdeps/linux/frv/sbrk.c index fd760985e..a1ff2a148 100644 --- a/libc/sysdeps/linux/frv/sbrk.c +++ b/libc/sysdeps/linux/frv/sbrk.c @@ -4,14 +4,11 @@ #include <unistd.h> #include <sys/syscall.h> -libc_hidden_proto(sbrk) - -extern void * __curbrk; - -extern int __init_brk (void); -libc_hidden_proto(__init_brk) +extern void * __curbrk attribute_hidden; +extern int __init_brk (void) attribute_hidden; extern void *_brk(void *ptr) attribute_hidden; +libc_hidden_proto(sbrk) void * sbrk(intptr_t increment) { diff --git a/libc/sysdeps/linux/frv/setjmp.S b/libc/sysdeps/linux/frv/setjmp.S index 455e61178..66008d12a 100644 --- a/libc/sysdeps/linux/frv/setjmp.S +++ b/libc/sysdeps/linux/frv/setjmp.S @@ -1,8 +1,3 @@ -#include <features.h> -#define _SETJMP_H -#define _ASM -#include <bits/setjmp.h> - .text /* This just does a tail-call to `__sigsetjmp (ARG, 0)'. diff --git a/libc/sysdeps/linux/h8300/__longjmp.S b/libc/sysdeps/linux/h8300/__longjmp.S index 2233644d0..5cffa3e5f 100644 --- a/libc/sysdeps/linux/h8300/__longjmp.S +++ b/libc/sysdeps/linux/h8300/__longjmp.S @@ -1,7 +1,3 @@ -#define _ASM -#define _SETJMP_H -#include <bits/setjmp.h> - #ifdef __H8300S__ .h8300s #else diff --git a/libc/sysdeps/linux/h8300/brk.c b/libc/sysdeps/linux/h8300/brk.c index 0da4286e7..668e6fe70 100644 --- a/libc/sysdeps/linux/h8300/brk.c +++ b/libc/sysdeps/linux/h8300/brk.c @@ -9,11 +9,10 @@ #include <unistd.h> #include <sys/syscall.h> -libc_hidden_proto(brk) - /* This must be initialized data because commons can't have aliases. */ -void *__curbrk = 0; +void *__curbrk attribute_hidden = 0; +libc_hidden_proto(brk) int brk (void *addr) { void *newbrk; diff --git a/libc/sysdeps/linux/hppa/bits/fcntl.h b/libc/sysdeps/linux/hppa/bits/fcntl.h index 9d967c647..4141a37c5 100644 --- a/libc/sysdeps/linux/hppa/bits/fcntl.h +++ b/libc/sysdeps/linux/hppa/bits/fcntl.h @@ -23,7 +23,9 @@ #endif #include <sys/types.h> - +#ifdef __USE_GNU +# include <bits/uio.h> +#endif /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ @@ -44,10 +46,10 @@ #ifdef __USE_GNU -# define O_DIRECT 00040000 /* direct disk access hint - currently ignored */ -# define O_DIRECTORY 00010000 /* must be a directory */ -# define O_NOFOLLOW 00000200 /* don't follow links */ -# define O_NOATIME 04000000 /* Do not set atime. */ +# define O_DIRECT 00040000 /* Direct disk access. */ +# define O_DIRECTORY 00010000 /* Must be a directory. */ +# define O_NOFOLLOW 00000200 /* Do not follow links. */ +# define O_NOATIME 04000000 /* Do not set atime. */ #endif #ifdef __USE_LARGEFILE64 @@ -74,7 +76,6 @@ # define F_SETLK F_SETLK64 /* Set record locking info (non-blocking). */ # define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */ #endif - #define F_GETLK64 8 /* Get record locking info. */ #define F_SETLK64 9 /* Set record locking info (non-blocking). */ #define F_SETLKW64 10 /* Set record locking info (blocking). */ @@ -172,10 +173,50 @@ struct flock64 # define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ #endif +#ifdef __USE_GNU +# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages + in the range before performing the + write. */ +# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those + dirty pages in the range which are + not presently under writeback. */ +# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in + the range after performing the + write. */ + +/* Flags for SPLICE and VMSPLICE. */ +# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */ +# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing + (but we may still block on the fd + we splice from/to). */ +# define SPLICE_F_MORE 4 /* Expect more data. */ +# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */ +#endif + __BEGIN_DECLS +#if 0 /*def __USE_GNU*/ + /* Provide kernel hint to read ahead. */ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) __THROW; +/* Selective file content synch'ing. */ +extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, + unsigned int __flags); + +/* Splice address range into a pipe. */ +extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count, + unsigned int __flags); + +/* Splice two files together. */ +extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags) + __THROW; + +/* In-kernel implementation of tee for pipe buffers. */ +extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags) + __THROW; + +#endif + __END_DECLS diff --git a/libc/sysdeps/linux/hppa/bits/mman.h b/libc/sysdeps/linux/hppa/bits/mman.h index 0b23bd322..54531ecf2 100644 --- a/libc/sysdeps/linux/hppa/bits/mman.h +++ b/libc/sysdeps/linux/hppa/bits/mman.h @@ -53,14 +53,20 @@ #define MCL_CURRENT 1 /* lock all current mappings */ #define MCL_FUTURE 2 /* lock all future mappings */ -#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 /* dont need these pages */ -#define MADV_SPACEAVAIL 5 /* insure that resources are reserved */ -#define MADV_VPS_PURGE 6 /* Purge pages from VM page cache */ -#define MADV_VPS_INHERIT 7 /* Inherit parents page size */ +/* Advice to "madvise" */ +#ifdef __USE_BSD +# 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 /* dont need these pages */ +# define MADV_SPACEAVAIL 5 /* insure that resources are reserved */ +# define MADV_VPS_PURGE 6 /* Purge pages from VM page cache */ +# define MADV_VPS_INHERIT 7 /* Inherit parents page size */ +# define MADV_REMOVE 9 /* Remove these pages and resources. */ +# define MADV_DONTFORK 10 /* Do not inherit across fork. */ +# define MADV_DOFORK 11 /* Do inherit across fork. */ +#endif /* The range 12-64 is reserved for page size specification. */ #define MADV_4K_PAGES 12 /* Use 4K pages */ diff --git a/libc/sysdeps/linux/hppa/bits/syscalls.h b/libc/sysdeps/linux/hppa/bits/syscalls.h index cb80138f5..365f5b4b1 100644 --- a/libc/sysdeps/linux/hppa/bits/syscalls.h +++ b/libc/sysdeps/linux/hppa/bits/syscalls.h @@ -9,12 +9,10 @@ * programs. */ #include <bits/sysnum.h> -#ifndef __set_errno -# define __set_errno(val) (*__errno_location ()) = (val) -#endif - #ifndef __ASSEMBLER__ +#include <errno.h> + #define SYS_ify(syscall_name) __NR_##syscall_name /* Assume all syscalls are done from PIC code just to be diff --git a/libc/sysdeps/linux/hppa/brk.c b/libc/sysdeps/linux/hppa/brk.c index b57c3328a..dab2d57ca 100644 --- a/libc/sysdeps/linux/hppa/brk.c +++ b/libc/sysdeps/linux/hppa/brk.c @@ -21,11 +21,10 @@ #include <sys/syscall.h> #include <unistd.h> -libc_hidden_proto(brk) - /* This must be initialized data because commons can't have aliases. */ -void *__curbrk = 0; +void *__curbrk attribute_hidden = 0; +libc_hidden_proto(brk) int brk (void *addr) { diff --git a/libc/sysdeps/linux/hppa/clone.S b/libc/sysdeps/linux/hppa/clone.S index f6e5568d0..599575d24 100644 --- a/libc/sysdeps/linux/hppa/clone.S +++ b/libc/sysdeps/linux/hppa/clone.S @@ -26,37 +26,64 @@ #include <bits/errno.h> #include <sys/syscall.h> -/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg) */ +/* Non-thread code calls __clone with the following parameters: + int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg) + + NPTL Code will call __clone with the following parameters: + int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg, + int *parent_tidptr, struct user_desc *newtls, int *child_pidptr) + + The code should not mangle the extra input registers. + Syscall expects: Input to __clone: + 4(r25) - function pointer (r26, arg0) + 0(r25) - argument (r23, arg3) + r26 - clone flags. (r24, arg2) + r25+64 - user stack pointer. (r25, arg1) + r24 - parent tid pointer. (stack - 52) + r23 - struct user_desc newtls pointer. (stack - 56) + r22 - child tid pointer. (stack - 60) + r20 - clone syscall number (constant) + */ .text -.global clone -.type clone,%function -clone: - /* FIXME: I have no idea how profiling works on hppa. */ +.global __clone +.type __clone,%function +__clone: /* Sanity check arguments. */ - comib,= 0,%arg0,.Lerror /* no NULL function pointers */ ldi -EINVAL,%ret0 - comib,= 0,%arg1,.Lerror /* no NULL stack pointers */ - nop + comib,=,n 0,%arg0,.Lerror /* no NULL function pointers */ + comib,=,n 0,%arg1,.Lerror /* no NULL stack pointers */ /* Save the fn ptr and arg on the new stack. */ - stwm %arg0,64(%arg1) - stw %arg3,-60(%arg1) + stwm %r26,64(%r25) + stw %r23,-60(%r25) + /* Clone arguments are (int flags, void * child_stack) */ + copy %r24,%r26 /* flags are first */ + /* User stack pointer is in the correct register already */ + + /* Load args from stack... */ + ldw -52(%sp), %r24 /* Load parent_tidptr */ + ldw -56(%sp), %r23 /* Load newtls */ + ldw -60(%sp), %r22 /* Load child_tidptr */ + + /* Create frame to get r3 free */ + copy %sp, %r21 + stwm %r3, 64(%sp) + stw %r21, -4(%sp) /* Save the PIC register. */ #ifdef __PIC__ - stw %r19,-32(%sr0, %sp) /* parent */ + copy %r19, %r3 /* parent */ #endif /* Do the system call */ - copy %arg2,%arg0 ble 0x100(%sr2,%r0) ldi __NR_clone,%r20 ldi -4096,%r1 comclr,>>= %r1,%ret0,%r0 /* Note: unsigned compare. */ - b,n .Lerror + b,n .LerrorRest comib,=,n 0,%ret0,thread_start @@ -65,18 +92,25 @@ clone: since we return immediately. */ bv %r0(%rp) - nop - - /* Something bad happened -- no child created */ -.Lerror: + ldwm -64(%sp), %r3 +.LerrorRest: /* Restore the PIC register on error */ #ifdef __PIC__ - ldw -32(%sr0, %sp), %r19 /* parent */ + copy %r3, %r19 /* parent */ #endif + /* Something bad happened -- no child created */ +.Lerror: + + /* Set errno, save ret0 so we return with that value. */ + copy %ret0, %r3 b __syscall_error sub %r0,%ret0,%arg0 + copy %r3, %ret0 + /* Return after setting errno, and restoring ret0 */ + bv %r0(%rp) + ldwm -64(%sp), %r3 thread_start: @@ -90,10 +124,12 @@ thread_start: bl $$dyncall,%r31 copy %r31,%rp - bl HIDDEN_JUMPTARGET(_exit),%rp + bl _exit,%rp copy %ret0,%arg0 /* Die horribly. */ - iitlbp %r0,(%r0) + iitlbp %r0,(%sr0,%r0) .size clone,.-clone + +weak_alias (__clone, clone) diff --git a/libc/sysdeps/linux/hppa/setjmp.S b/libc/sysdeps/linux/hppa/setjmp.S index c2ba4fb1b..fdc4c424b 100644 --- a/libc/sysdeps/linux/hppa/setjmp.S +++ b/libc/sysdeps/linux/hppa/setjmp.S @@ -17,11 +17,6 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define _ASM -#define _SETJMP_H -#include <bits/setjmp.h> - - .text .align 4 .import __sigjmp_save, code diff --git a/libc/sysdeps/linux/i386/bits/atomic.h b/libc/sysdeps/linux/i386/bits/atomic.h index c74876175..e0c5ae79c 100644 --- a/libc/sysdeps/linux/i386/bits/atomic.h +++ b/libc/sysdeps/linux/i386/bits/atomic.h @@ -19,6 +19,9 @@ #include <stdint.h> +#if defined __CONFIG_GENERIC_I386__ || defined __CONFIG_I386__ +# warning this file is only good for 486 or better +#endif typedef int8_t atomic8_t; typedef uint8_t uatomic8_t; diff --git a/libc/sysdeps/linux/i386/bits/byteswap.h b/libc/sysdeps/linux/i386/bits/byteswap.h index d08a342ab..33af20888 100644 --- a/libc/sysdeps/linux/i386/bits/byteswap.h +++ b/libc/sysdeps/linux/i386/bits/byteswap.h @@ -1,5 +1,5 @@ /* Macros to swap the order of bytes in integer values. - Copyright (C) 1997, 1998, 2000, 2002 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 2000, 2002, 2003 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 @@ -28,60 +28,78 @@ #define __bswap_constant_16(x) \ ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)) -#if defined __GNUC__ && __GNUC__ >= 2 -# define __bswap_16(x) \ +#ifdef __GNUC__ +# if __GNUC__ >= 2 +# define __bswap_16(x) \ (__extension__ \ - ({ register unsigned short int __v; \ - if (__builtin_constant_p (x)) \ - __v = __bswap_constant_16 (x); \ + ({ register unsigned short int __v, __x = (x); \ + if (__builtin_constant_p (__x)) \ + __v = __bswap_constant_16 (__x); \ else \ - __asm__ __volatile__ ("rorw $8, %w0" \ - : "=r" (__v) \ - : "0" ((unsigned short int) (x)) \ - : "cc"); \ + __asm__ ("rorw $8, %w0" \ + : "=r" (__v) \ + : "0" (__x) \ + : "cc"); \ __v; })) -#else +# else /* This is better than nothing. */ -# define __bswap_16(x) __bswap_constant_16 (x) +# define __bswap_16(x) \ + (__extension__ \ + ({ register unsigned short int __x = (x); __bswap_constant_16 (__x); })) +# endif +#else +static __inline unsigned short int +__bswap_16 (unsigned short int __bsx) +{ + return __bswap_constant_16 (__bsx); +} #endif - /* Swap bytes in 32 bit value. */ #define __bswap_constant_32(x) \ ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \ (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)) -#if defined __GNUC__ && __GNUC__ >= 2 +#ifdef __GNUC__ +# if __GNUC__ >= 2 /* To swap the bytes in a word the i486 processors and up provide the `bswap' opcode. On i386 we have to use three instructions. */ -# if !defined __i486__ && !defined __pentium__ && !defined __pentiumpro__ -# define __bswap_32(x) \ +# if !defined __i486__ && !defined __pentium__ && !defined __pentiumpro__ \ + && !defined __pentium4__ +# define __bswap_32(x) \ (__extension__ \ - ({ register unsigned int __v; \ - if (__builtin_constant_p (x)) \ - __v = __bswap_constant_32 (x); \ + ({ register unsigned int __v, __x = (x); \ + if (__builtin_constant_p (__x)) \ + __v = __bswap_constant_32 (__x); \ else \ - __asm__ __volatile__ ("rorw $8, %w0;" \ - "rorl $16, %0;" \ - "rorw $8, %w0" \ - : "=r" (__v) \ - : "0" ((unsigned int) (x)) \ - : "cc"); \ + __asm__ ("rorw $8, %w0;" \ + "rorl $16, %0;" \ + "rorw $8, %w0" \ + : "=r" (__v) \ + : "0" (__x) \ + : "cc"); \ __v; })) -# else -# define __bswap_32(x) \ +# else +# define __bswap_32(x) \ (__extension__ \ - ({ register unsigned int __v; \ - if (__builtin_constant_p (x)) \ - __v = __bswap_constant_32 (x); \ + ({ register unsigned int __v, __x = (x); \ + if (__builtin_constant_p (__x)) \ + __v = __bswap_constant_32 (__x); \ else \ - __asm__ __volatile__ ("bswap %0" \ - : "=r" (__v) \ - : "0" ((unsigned int) (x))); \ + __asm__ ("bswap %0" : "=r" (__v) : "0" (__x)); \ __v; })) +# endif +# else +# define __bswap_32(x) \ + (__extension__ \ + ({ register unsigned int __x = (x); __bswap_constant_32 (__x); })) # endif #else -# define __bswap_32(x) __bswap_constant_32 (x) +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __bswap_constant_32 (__bsx); +} #endif diff --git a/libc/sysdeps/linux/i386/bits/fcntl.h b/libc/sysdeps/linux/i386/bits/fcntl.h index 8c9159f0f..30fcc8367 100644 --- a/libc/sysdeps/linux/i386/bits/fcntl.h +++ b/libc/sysdeps/linux/i386/bits/fcntl.h @@ -22,8 +22,11 @@ # error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead." #endif - #include <sys/types.h> +#ifdef __USE_GNU +# include <bits/uio.h> +#endif + /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ @@ -180,16 +183,45 @@ struct flock64 # define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ #endif -/* Linux-specific operations for posix_fadvise. */ + #ifdef __USE_GNU -# define LINUX_FADV_ASYNC_WRITE 32 /* Start writeout on range. */ -# define LINUX_FADV_WRITE_WAIT 33 /* Wait upon writeout to range. */ +# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages + in the range before performing the + write. */ +# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those + dirty pages in the range which are + not presently under writeback. */ +# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in + the range after performing the + write. */ #endif __BEGIN_DECLS +#if 0 /*def __USE_GNU*/ + /* Provide kernel hint to read ahead. */ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) __THROW; + +/* Selective file content synch'ing. */ +extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, + unsigned int __flags); + + +/* Splice address range into a pipe. */ +extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count, + unsigned int __flags); + +/* Splice two files together. */ +extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags) + __THROW; + +/* In-kernel implementation of tee for pipe buffers. */ +extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags) + __THROW; + +#endif + __END_DECLS diff --git a/libc/sysdeps/linux/i386/bits/mathdef.h b/libc/sysdeps/linux/i386/bits/mathdef.h index fe928daa6..a3786fc81 100644 --- a/libc/sysdeps/linux/i386/bits/mathdef.h +++ b/libc/sysdeps/linux/i386/bits/mathdef.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 1999, 2000, 2004 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 @@ -23,6 +23,13 @@ #if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF # define _MATH_H_MATHDEF 1 +# if defined __FLT_EVAL_METHOD__ && __FLT_EVAL_METHOD__ == 0 +/* When using -mfpmath=sse, values are computed with the precission of the + used type. */ +typedef float float_t; /* `float' expressions are evaluated as `float'. */ +typedef double double_t; /* `double' expressions are evaluated as + `double'. */ +# else /* The ix87 FPUs evaluate all values in the 80 bit floating-point format which is also available for the user as `long double'. Therefore we define: */ @@ -30,12 +37,14 @@ typedef long double float_t; /* `float' expressions are evaluated as `long double'. */ typedef long double double_t; /* `double' expressions are evaluated as `long double'. */ - -/* Define `INFINITY' as value of type `float'. */ -# define INFINITY HUGE_VALF +# endif /* The values returned by `ilogb' for 0 and NaN respectively. */ # define FP_ILOGB0 (-2147483647 - 1) # define FP_ILOGBNAN (-2147483647 - 1) #endif /* ISO C99 */ + +#if !defined __NO_LONG_DOUBLE_MATH && !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ +# define __NO_LONG_DOUBLE_MATH 1 +#endif diff --git a/libc/sysdeps/linux/i386/bits/mathinline.h b/libc/sysdeps/linux/i386/bits/mathinline.h index 489032624..e04ce9509 100644 --- a/libc/sysdeps/linux/i386/bits/mathinline.h +++ b/libc/sysdeps/linux/i386/bits/mathinline.h @@ -1,5 +1,6 @@ /* Inline math functions for i387. - Copyright (C) 1995,96,97,98,99,2000,2001 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 + Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by John C. Bowman <bowman@math.ualberta.ca>, 1995. @@ -30,19 +31,18 @@ #if defined __USE_ISOC99 && defined __GNUC__ && __GNUC__ >= 2 -# if __GNUC_PREREQ (2,97) /* GCC 2.97 and up have builtins that actually can be used. */ -# define isgreater(x, y) __builtin_isgreater (x, y) -# define isgreaterequal(x, y) __builtin_isgreaterequal (x, y) -# define isless(x, y) __builtin_isless (x, y) -# define islessequal(x, y) __builtin_islessequal (x, y) -# define islessgreater(x, y) __builtin_islessgreater (x, y) -# define isunordered(x, y) __builtin_isunordered (x, y) -# else +# if !__GNUC_PREREQ (2,97) /* ISO C99 defines some macros to perform unordered comparisons. The ix87 FPU supports this with special opcodes and we should use them. These must not be inline functions since we have to be able to handle all floating-point types. */ +# undef isgreater +# undef isgreaterequal +# undef isless +# undef islessequal +# undef islessgreater +# undef isunordered # ifdef __i686__ /* For the PentiumPro and more recent processors we can provide better code. */ @@ -217,7 +217,7 @@ __NTH (__signbitl (long double __x)) __inline_mathcode_ (float, __CONCAT(func,f), arg, code) \ __inline_mathcode_ (long double, __CONCAT(func,l), arg, code) # define __inline_mathcodeNP(func, arg, code) \ - __inline_mathcodeNP_ (double, func, arg, code) \ + __inline_mathcodeNP_ (double, func, arg, code) \ __inline_mathcodeNP_ (float, __CONCAT(func,f), arg, code) \ __inline_mathcodeNP_ (long double, __CONCAT(func,l), arg, code) # define __inline_mathcode2(func, arg1, arg2, code) \ @@ -225,7 +225,7 @@ __NTH (__signbitl (long double __x)) __inline_mathcode2_ (float, __CONCAT(func,f), arg1, arg2, code) \ __inline_mathcode2_ (long double, __CONCAT(func,l), arg1, arg2, code) # define __inline_mathcodeNP2(func, arg1, arg2, code) \ - __inline_mathcodeNP2_ (double, func, arg1, arg2, code) \ + __inline_mathcodeNP2_ (double, func, arg1, arg2, code) \ __inline_mathcodeNP2_ (float, __CONCAT(func,f), arg1, arg2, code) \ __inline_mathcodeNP2_ (long double, __CONCAT(func,l), arg1, arg2, code) # define __inline_mathcode3(func, arg1, arg2, arg3, code) \ @@ -234,7 +234,7 @@ __NTH (__signbitl (long double __x)) __inline_mathcode3_ (long double, __CONCAT(func,l), arg1, arg2, arg3, code) # define __inline_mathcodeNP3(func, arg1, arg2, arg3, code) \ __inline_mathcodeNP3_ (double, func, arg1, arg2, arg3, code) \ - __inline_mathcodeNP3_ (float, __CONCAT(func,f), arg1, arg2, arg3, code) \ + __inline_mathcodeNP3_ (float, __CONCAT(func,f), arg1, arg2, arg3, code) \ __inline_mathcodeNP3_ (long double, __CONCAT(func,l), arg1, arg2, arg3, code) #else # define __inline_mathcode(func, arg, code) \ @@ -363,7 +363,13 @@ __NTH (__sincosl (long double __x, long double *__sinx, long double *__cosx)) /* Optimized inline implementation, sometimes with reduced precision and/or argument range. */ -# define __expm1_code \ +# if __GNUC_PREREQ (3, 5) +# define __expm1_code \ + register long double __temp; \ + __temp = __builtin_expm1l (__x); \ + return __temp ? __temp : __x +# else +# define __expm1_code \ register long double __value; \ register long double __exponent; \ register long double __temp; \ @@ -381,11 +387,15 @@ __NTH (__sincosl (long double __x, long double *__sinx, long double *__cosx)) ("fscale # 2^int(x * log2(e))\n\t" \ : "=t" (__temp) : "0" (1.0), "u" (__exponent)); \ __temp -= 1.0; \ - return __temp + __value ? __temp + __value : __x + __temp += __value; \ + return __temp ? __temp : __x +# endif __inline_mathcodeNP_ (long double, __expm1l, __x, __expm1_code) - -# define __exp_code \ +# if __GNUC_PREREQ (3, 4) +__inline_mathcodeNP_ (long double, __expl, __x, return __builtin_expl (__x)) +# else +# define __exp_code \ register long double __value; \ register long double __exponent; \ __asm __volatile__ \ @@ -404,28 +414,39 @@ __inline_mathcodeNP_ (long double, __expm1l, __x, __expm1_code) return __value __inline_mathcodeNP (exp, __x, __exp_code) __inline_mathcodeNP_ (long double, __expl, __x, __exp_code) +# endif +# if !__GNUC_PREREQ (3, 5) __inline_mathcodeNP (tan, __x, \ register long double __value; \ - register long double __value2 __attribute_used__; \ + register long double __value2 __attribute__ ((__unused__)); \ __asm __volatile__ \ ("fptan" \ : "=t" (__value2), "=u" (__value) : "0" (__x)); \ return __value) +# endif #endif /* __FAST_MATH__ */ -#define __atan2_code \ +#if __GNUC_PREREQ (3, 4) +__inline_mathcodeNP2_ (long double, __atan2l, __y, __x, + return __builtin_atan2l (__y, __x)) +#else +# define __atan2_code \ register long double __value; \ __asm __volatile__ \ ("fpatan" \ : "=t" (__value) : "0" (__x), "u" (__y) : "st(1)"); \ return __value +# ifdef __FAST_MATH__ __inline_mathcodeNP2 (atan2, __y, __x, __atan2_code) +# endif __inline_mathcodeNP2_ (long double, __atan2l, __y, __x, __atan2_code) +#endif +#if defined __FAST_MATH__ && !__GNUC_PREREQ (3, 5) __inline_mathcodeNP2 (fmod, __x, __y, \ register long double __value; \ __asm __volatile__ \ @@ -435,15 +456,25 @@ __inline_mathcodeNP2 (fmod, __x, __y, \ "jp 1b" \ : "=t" (__value) : "0" (__x), "u" (__y) : "ax", "cc"); \ return __value) +#endif +#ifdef __FAST_MATH__ +# if !__GNUC_PREREQ (3,3) __inline_mathopNP (sqrt, "fsqrt") __inline_mathopNP_ (long double, __sqrtl, "fsqrt") +# define __libc_sqrtl(n) __sqrtl (n) +# else +# define __libc_sqrtl(n) __builtin_sqrtl (n) +# endif +#endif #if __GNUC_PREREQ (2, 8) __inline_mathcodeNP_ (double, fabs, __x, return __builtin_fabs (__x)) +# if defined __USE_MISC || defined __USE_ISOC99 __inline_mathcodeNP_ (float, fabsf, __x, return __builtin_fabsf (__x)) __inline_mathcodeNP_ (long double, fabsl, __x, return __builtin_fabsl (__x)) +# endif __inline_mathcodeNP_ (long double, __fabsl, __x, return __builtin_fabsl (__x)) #else __inline_mathop (fabs, "fabs") @@ -451,19 +482,26 @@ __inline_mathop_ (long double, __fabsl, "fabs") #endif #ifdef __FAST_MATH__ +# if !__GNUC_PREREQ (3, 4) /* The argument range of this inline version is reduced. */ __inline_mathopNP (sin, "fsin") /* The argument range of this inline version is reduced. */ __inline_mathopNP (cos, "fcos") __inline_mathop_declNP (log, "fldln2; fxch; fyl2x", "0" (__x) : "st(1)") +# endif + +# if !__GNUC_PREREQ (3, 5) __inline_mathop_declNP (log10, "fldlg2; fxch; fyl2x", "0" (__x) : "st(1)") -__inline_mathcodeNP (asin, __x, return __atan2l (__x, __sqrtl (1.0 - __x * __x))) -__inline_mathcodeNP (acos, __x, return __atan2l (__sqrtl (1.0 - __x * __x), __x)) -#endif /* __FAST_MATH__ */ +__inline_mathcodeNP (asin, __x, return __atan2l (__x, __libc_sqrtl (1.0 - __x * __x))) +__inline_mathcodeNP (acos, __x, return __atan2l (__libc_sqrtl (1.0 - __x * __x), __x)) +# endif +# if !__GNUC_PREREQ (3, 4) __inline_mathop_declNP (atan, "fld1; fpatan", "0" (__x) : "st(1)") +# endif +#endif /* __FAST_MATH__ */ __inline_mathcode_ (long double, __sgn1l, __x, \ __extension__ union { long double __xld; unsigned int __xi[3]; } __n = \ @@ -511,7 +549,8 @@ __inline_mathcodeNP (ceil, __x, \ __asm __volatile ("fldcw %0" : : "m" (__cw)); \ return __value) -#define __ldexp_code \ +#ifdef __FAST_MATH__ +# define __ldexp_code \ register long double __value; \ __asm __volatile__ \ ("fscale" \ @@ -523,6 +562,7 @@ __NTH (ldexp (double __x, int __y)) { __ldexp_code; } +#endif /* Optimized versions for some non-standardized functions. */ @@ -530,12 +570,12 @@ __NTH (ldexp (double __x, int __y)) # ifdef __FAST_MATH__ __inline_mathcodeNP (expm1, __x, __expm1_code) -# endif /* We cannot rely on M_SQRT being defined. So we do it for ourself here. */ -# define __M_SQRT2 1.41421356237309504880L /* sqrt(2) */ +# define __M_SQRT2 1.41421356237309504880L /* sqrt(2) */ +# if !__GNUC_PREREQ (3, 5) __inline_mathcodeNP (log1p, __x, \ register long double __value; \ if (__fabsl (__x) >= 1.0 - 0.5 * __M_SQRT2) \ @@ -547,24 +587,27 @@ __inline_mathcodeNP (log1p, __x, \ "fyl2xp1" \ : "=t" (__value) : "0" (__x) : "st(1)"); \ return __value) +# endif /* The argument range of the inline version of asinhl is slightly reduced. */ __inline_mathcodeNP (asinh, __x, \ register long double __y = __fabsl (__x); \ - return (log1pl (__y * __y / (__sqrtl (__y * __y + 1.0) + 1.0) + __y) \ + return (log1pl (__y * __y / (__libc_sqrtl (__y * __y + 1.0) + 1.0) + __y) \ * __sgn1l (__x))) __inline_mathcodeNP (acosh, __x, \ - return logl (__x + __sqrtl (__x - 1.0) * __sqrtl (__x + 1.0))) + return logl (__x + __libc_sqrtl (__x - 1.0) * __libc_sqrtl (__x + 1.0))) __inline_mathcodeNP (atanh, __x, \ register long double __y = __fabsl (__x); \ return -0.5 * log1pl (-(__y + __y) / (1.0 + __y)) * __sgn1l (__x)) /* The argument range of the inline version of hypotl is slightly reduced. */ -__inline_mathcodeNP2 (hypot, __x, __y, return __sqrtl (__x * __x + __y * __y)) +__inline_mathcodeNP2 (hypot, __x, __y, + return __libc_sqrtl (__x * __x + __y * __y)) +# if !__GNUC_PREREQ (3, 5) __inline_mathcodeNP(logb, __x, \ register long double __value; \ register long double __junk; \ @@ -572,13 +615,17 @@ __inline_mathcodeNP(logb, __x, \ ("fxtract\n\t" \ : "=t" (__junk), "=u" (__value) : "0" (__x)); \ return __value) +# endif +# endif #endif #ifdef __USE_ISOC99 -#ifdef __FAST_MATH__ +# ifdef __FAST_MATH__ + +# if !__GNUC_PREREQ (3, 5) __inline_mathop_declNP (log2, "fld1; fxch; fyl2x", "0" (__x) : "st(1)") -#endif /* __FAST_MATH__ */ +# endif __MATH_INLINE float __NTH (ldexpf (float __x, int __y)) @@ -592,13 +639,12 @@ __NTH (ldexpl (long double __x, int __y)) __ldexp_code; } -#ifdef __FAST_MATH__ __inline_mathcodeNP3 (fma, __x, __y, __z, return (__x * __y) + __z) __inline_mathopNP (rint, "frndint") -#endif /* __FAST_MATH__ */ +# endif /* __FAST_MATH__ */ -#define __lrint_code \ +# define __lrint_code \ long int __lrintres; \ __asm__ __volatile__ \ ("fistpl %0" \ @@ -619,9 +665,9 @@ __NTH (lrintl (long double __x)) { __lrint_code; } -#undef __lrint_code +# undef __lrint_code -#define __llrint_code \ +# define __llrint_code \ long long int __llrintres; \ __asm__ __volatile__ \ ("fistpll %0" \ @@ -642,13 +688,14 @@ __NTH (llrintl (long double __x)) { __llrint_code; } -#undef __llrint_code +# undef __llrint_code #endif #ifdef __USE_MISC +# if defined __FAST_MATH__ && !__GNUC_PREREQ (3, 5) __inline_mathcodeNP2 (drem, __x, __y, \ register double __value; \ register int __clobbered; \ @@ -659,6 +706,7 @@ __inline_mathcodeNP2 (drem, __x, __y, \ "jp 1b" \ : "=t" (__value), "=&a" (__clobbered) : "0" (__x), "u" (__y) : "cc"); \ return __value) +# endif /* This function is used in the `isfinite' macro. */ @@ -671,15 +719,15 @@ __NTH (__finite (double __x)) } /* Miscellaneous functions */ -#ifdef __FAST_MATH__ +# ifdef __FAST_MATH__ __inline_mathcode (__coshm1, __x, \ register long double __exm1 = __expm1l (__fabsl (__x)); \ return 0.5 * (__exm1 / (__exm1 + 1.0)) * __exm1) __inline_mathcode (__acosh1p, __x, \ - return log1pl (__x + __sqrtl (__x) * __sqrtl (__x + 2.0))) + return log1pl (__x + __libc_sqrtl (__x) * __libc_sqrtl (__x + 2.0))) -#endif /* __FAST_MATH__ */ +# endif /* __FAST_MATH__ */ #endif /* __USE_MISC */ /* Undefine some of the large macros which are not used anymore. */ diff --git a/libc/sysdeps/linux/i386/bits/mman.h b/libc/sysdeps/linux/i386/bits/mman.h index f198fa4b9..00cb98239 100644 --- a/libc/sysdeps/linux/i386/bits/mman.h +++ b/libc/sysdeps/linux/i386/bits/mman.h @@ -88,7 +88,7 @@ # 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. */ -# define MADV_REMOVE 5 /* Remove these pages and resources. */ +# define MADV_REMOVE 9 /* Remove these pages and resources. */ # define MADV_DONTFORK 10 /* Do not inherit across fork. */ # define MADV_DOFORK 11 /* Do inherit across fork. */ #endif diff --git a/libc/sysdeps/linux/i386/bits/select.h b/libc/sysdeps/linux/i386/bits/select.h index 2892ab556..972bfb685 100644 --- a/libc/sysdeps/linux/i386/bits/select.h +++ b/libc/sysdeps/linux/i386/bits/select.h @@ -20,10 +20,6 @@ # error "Never use <bits/select.h> directly; include <sys/select.h> instead." #endif -#undef __FD_ZERO -#undef __FD_SET -#undef __FD_CLR -#undef __FD_ISSET #if defined __GNUC__ && __GNUC__ >= 2 diff --git a/libc/sysdeps/linux/i386/bits/syscalls.h b/libc/sysdeps/linux/i386/bits/syscalls.h index 58475e3af..73f858521 100644 --- a/libc/sysdeps/linux/i386/bits/syscalls.h +++ b/libc/sysdeps/linux/i386/bits/syscalls.h @@ -4,8 +4,6 @@ # error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead." #endif -#include <errno.h> - /* This includes the `__NR_<name>' syscall numbers taken from the Linux kernel * header files. It also defines the traditional `SYS_<name>' macros for older * programs. */ @@ -18,6 +16,10 @@ #ifndef __ASSEMBLER__ +#include <errno.h> + +#define SYS_ify(syscall_name) (__NR_##syscall_name) + /* We need some help from the assembler to generate optimal code. We define some macros here which later will be used. */ diff --git a/libc/sysdeps/linux/i386/brk.c b/libc/sysdeps/linux/i386/brk.c index fcf7f3b33..eda8ad9ce 100644 --- a/libc/sysdeps/linux/i386/brk.c +++ b/libc/sysdeps/linux/i386/brk.c @@ -21,11 +21,10 @@ #include <unistd.h> #include <sys/syscall.h> -libc_hidden_proto(brk) - /* This must be initialized data because commons can't have aliases. */ -void *__curbrk = 0; +void *__curbrk attribute_hidden = 0; +libc_hidden_proto(brk) int brk (void *addr) { void *__unbounded newbrk, *__unbounded scratch; diff --git a/libc/sysdeps/linux/i386/fpu_control.h b/libc/sysdeps/linux/i386/fpu_control.h index ed9bf388a..c6cb005d7 100644 --- a/libc/sysdeps/linux/i386/fpu_control.h +++ b/libc/sysdeps/linux/i386/fpu_control.h @@ -1,5 +1,5 @@ /* FPU control word bits. i387 version. - Copyright (C) 1993,1995,1996,1997,1998,2000,2001 Free Software Foundation, Inc. + Copyright (C) 1993,1995-1998,2000,2001,2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Olaf Flebbe. @@ -88,11 +88,17 @@ /* Type of the control word. */ typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__))); -/* Macros for accessing the hardware control word. */ -#define _FPU_GETCW(cw) __asm__ ("fnstcw %0" : "=m" (*&cw)) -#define _FPU_SETCW(cw) __asm__ ("fldcw %0" : : "m" (*&cw)) +/* Macros for accessing the hardware control word. + Note that the use of these macros is no sufficient anymore with + recent hardware. Some floating point operations are executed in + the SSE/SSE2 engines which have their own control and status register. */ +#define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw)) +#define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw)) + +#if 0 /* Default control word set at startup. */ extern fpu_control_t __fpu_control; +#endif #endif /* fpu_control.h */ diff --git a/libc/sysdeps/linux/ia64/bits/fcntl.h b/libc/sysdeps/linux/ia64/bits/fcntl.h index 94e534d97..46b38937d 100644 --- a/libc/sysdeps/linux/ia64/bits/fcntl.h +++ b/libc/sysdeps/linux/ia64/bits/fcntl.h @@ -23,6 +23,9 @@ #include <sys/types.h> +#ifdef __USE_GNU +# include <bits/uio.h> +#endif /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ @@ -174,16 +177,45 @@ struct flock64 # define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ #endif -/* Linux-specific operations for posix_fadvise. */ + #ifdef __USE_GNU -# define LINUX_FADV_ASYNC_WRITE 32 /* Start writeout on range. */ -# define LINUX_FADV_WRITE_WAIT 33 /* Wait upon writeout to range. */ +# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages + in the range before performing the + write. */ +# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those + dirty pages in the range which are + not presently under writeback. */ +# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in + the range after performing the + write. */ #endif __BEGIN_DECLS +#if 0 /*def __USE_GNU*/ + /* Provide kernel hint to read ahead. */ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) __THROW; + +/* Selective file content synch'ing. */ +extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, + unsigned int __flags); + + +/* Splice address range into a pipe. */ +extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count, + unsigned int __flags); + +/* Splice two files together. */ +extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags) + __THROW; + +/* In-kernel implementation of tee for pipe buffers. */ +extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags) + __THROW; + +#endif + __END_DECLS diff --git a/libc/sysdeps/linux/ia64/bits/mman.h b/libc/sysdeps/linux/ia64/bits/mman.h index 86344962a..a27a30fc0 100644 --- a/libc/sysdeps/linux/ia64/bits/mman.h +++ b/libc/sysdeps/linux/ia64/bits/mman.h @@ -89,7 +89,7 @@ # 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. */ -# define MADV_REMOVE 5 /* Remove these pages and resources. */ +# define MADV_REMOVE 9 /* Remove these pages and resources. */ # define MADV_DONTFORK 10 /* Do not inherit across fork. */ # define MADV_DOFORK 11 /* Do inherit across fork. */ #endif diff --git a/libc/sysdeps/linux/ia64/bits/stat.h b/libc/sysdeps/linux/ia64/bits/stat.h index b59d5e024..a5a121b28 100644 --- a/libc/sysdeps/linux/ia64/bits/stat.h +++ b/libc/sysdeps/linux/ia64/bits/stat.h @@ -39,12 +39,27 @@ struct stat int pad0; __dev_t st_rdev; /* Device number, if device. */ __off_t st_size; /* Size of file, in bytes. */ +#if 0 /*def __USE_MISC*/ + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the <sys/stat.h> header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +#else __time_t st_atime; /* Time of last access. */ unsigned long int st_atimensec; /* Nscecs of last access. */ __time_t st_mtime; /* Time of last modification. */ unsigned long int st_mtimensec; /* Nsecs of last modification. */ __time_t st_ctime; /* Time of last status change. */ unsigned long int st_ctimensec; /* Nsecs of last status change. */ +#endif __blksize_t st_blksize; /* Optimal block size for I/O. */ __blkcnt_t st_blocks; /* Nr. 512-byte blocks allocated. */ long int __unused[3]; @@ -63,12 +78,27 @@ struct stat64 int pad0; __dev_t st_rdev; /* Device number, if device. */ __off_t st_size; /* Size of file, in bytes. */ +#if 0 /*def __USE_MISC*/ + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the <sys/stat.h> header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +#else __time_t st_atime; /* Time of last access. */ unsigned long int st_atimensec; /* Nscecs of last access. */ __time_t st_mtime; /* Time of last modification. */ unsigned long int st_mtimensec; /* Nsecs of last modification. */ __time_t st_ctime; /* Time of last status change. */ unsigned long int st_ctimensec; /* Nsecs of last status change. */ +#endif __blksize_t st_blksize; /* Optimal block size for I/O. */ __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */ long int __unused[3]; diff --git a/libc/sysdeps/linux/ia64/bits/syscalls.h b/libc/sysdeps/linux/ia64/bits/syscalls.h index c5da7d91f..666468a7a 100644 --- a/libc/sysdeps/linux/ia64/bits/syscalls.h +++ b/libc/sysdeps/linux/ia64/bits/syscalls.h @@ -31,17 +31,14 @@ * programs. */ #include <bits/sysnum.h> -#ifndef __set_errno -# define __set_errno(val) (*__errno_location ()) = (val) -#endif +#ifndef __ASSEMBLER__ +#include <errno.h> -#ifndef __ASSEMBLER__ +#define SYS_ify(syscall_name) (__NR_##syscall_name) #undef IA64_USE_NEW_STUB -#define SYS_ify(syscall_name) __NR_##syscall_name - /* taken from asm-ia64/break.h */ #define __IA64_BREAK_SYSCALL 0x100000 #define ___IA64_BREAK_SYSCALL "0x100000" diff --git a/libc/sysdeps/linux/ia64/brk.S b/libc/sysdeps/linux/ia64/brk.S index 6d146a579..e9974d515 100644 --- a/libc/sysdeps/linux/ia64/brk.S +++ b/libc/sysdeps/linux/ia64/brk.S @@ -25,6 +25,7 @@ #include <asm/errno.h> .global __curbrk + .hidden __curbrk .type __curbrk,@object .size __curbrk,8 .data @@ -34,7 +35,7 @@ __curbrk: weak_alias (__curbrk, ___brk_addr) -LEAF(__brk) +LEAF(brk) .regstk 1, 0, 0, 0 DO_CALL(__NR_brk) cmp.ltu p6, p0 = ret0, in0 @@ -47,6 +48,5 @@ LEAF(__brk) st8 [r9] = ret0 mov ret0 = 0 ret -END(__brk) - -weak_alias (__brk, brk) +END(brk) +libc_hidden_def(brk) diff --git a/libc/sysdeps/linux/ia64/vfork.S b/libc/sysdeps/linux/ia64/vfork.S index c9d485b5d..d100443b7 100644 --- a/libc/sysdeps/linux/ia64/vfork.S +++ b/libc/sysdeps/linux/ia64/vfork.S @@ -20,8 +20,11 @@ #include "sysdep.h" #define _SIGNAL_H #include <bits/signum.h> -#define _SCHED_H -#include <bits/sched.h> + +/* The following are defined in linux/sched.h, which unfortunately */ +/* is not safe for inclusion in an assembly file. */ +#define CLONE_VM 0x00000100 /* set if VM shared between processes */ +#define CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */ /* pid_t vfork(void); */ /* Implemented as __clone_syscall(CLONE_VFORK | CLONE_VM | SIGCHLD, 0) */ @@ -36,6 +39,6 @@ ENTRY(__vfork) (p6) br.cond.spnt.few __syscall_error ret PSEUDO_END(__vfork) +libc_hidden_weak (vfork) weak_alias (__vfork, vfork) -libc_hidden_weak (vfork) diff --git a/libc/sysdeps/linux/m68k/bits/fcntl.h b/libc/sysdeps/linux/m68k/bits/fcntl.h index 90c0a481e..6983cd410 100644 --- a/libc/sysdeps/linux/m68k/bits/fcntl.h +++ b/libc/sysdeps/linux/m68k/bits/fcntl.h @@ -23,6 +23,9 @@ #include <sys/types.h> +#ifdef __USE_GNU +# include <bits/uio.h> +#endif /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ @@ -179,10 +182,44 @@ struct flock64 # define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ #endif +#ifdef __USE_GNU +# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages + in the range before performing the + write. */ +# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those + dirty pages in the range which are + not presently under writeback. */ +# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in + the range after performing the + write. */ +#endif + __BEGIN_DECLS +#if 0 /*def __USE_GNU*/ + /* Provide kernel hint to read ahead. */ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) __THROW; + +/* Selective file content synch'ing. */ +extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, + unsigned int __flags); + + +/* Splice address range into a pipe. */ +extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count, + unsigned int __flags); + +/* Splice two files together. */ +extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags) + __THROW; + +/* In-kernel implementation of tee for pipe buffers. */ +extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags) + __THROW; + +#endif + __END_DECLS diff --git a/libc/sysdeps/linux/m68k/bits/mathdef.h b/libc/sysdeps/linux/m68k/bits/mathdef.h index 90146f17a..a69e93089 100644 --- a/libc/sysdeps/linux/m68k/bits/mathdef.h +++ b/libc/sysdeps/linux/m68k/bits/mathdef.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 1999, 2000, 2004 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 @@ -31,11 +31,12 @@ typedef long double float_t; /* `float' expressions are evaluated as typedef long double double_t; /* `double' expressions are evaluated as `long double'. */ -/* Define `INFINITY' as value of type `float'. */ -# define INFINITY HUGE_VALF - /* The values returned by `ilogb' for 0 and NaN respectively. */ # define FP_ILOGB0 (-2147483647 - 1) # define FP_ILOGBNAN (2147483647) #endif /* ISO C99 */ + +#if !defined __NO_LONG_DOUBLE_MATH && !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ +# define __NO_LONG_DOUBLE_MATH 1 +#endif diff --git a/libc/sysdeps/linux/m68k/bits/mathinline.h b/libc/sysdeps/linux/m68k/bits/mathinline.h index 81aab8881..acbac47aa 100644 --- a/libc/sysdeps/linux/m68k/bits/mathinline.h +++ b/libc/sysdeps/linux/m68k/bits/mathinline.h @@ -1,5 +1,6 @@ /* Definitions of inline math functions implemented by the m68881/2. - Copyright (C) 1991,92,93,94,96,97,98,99,2000 Free Software Foundation, Inc. + Copyright (C) 1991,92,93,94,96,97,98,99,2000,2002, 2003, 2004 + 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,52 +21,60 @@ #ifdef __GNUC__ #ifdef __USE_ISOC99 - +/* GCC 3.1 and up have builtins that actually can be used. */ +# if !__GNUC_PREREQ (3,1) /* ISO C99 defines some macros to perform unordered comparisons. The m68k FPU supports this with special opcodes and we should use them. These must not be inline functions since we have to be able to handle all floating-point types. */ -# define isgreater(x, y) \ +# undef isgreater +# undef isgreaterequal +# undef isless +# undef islessequal +# undef islessgreater +# undef isunordered +# define isgreater(x, y) \ __extension__ \ ({ char __result; \ __asm__ ("fcmp%.x %2,%1; fsogt %0" \ : "=dm" (__result) : "f" (x), "f" (y)); \ __result != 0; }) -# define isgreaterequal(x, y) \ +# define isgreaterequal(x, y) \ __extension__ \ ({ char __result; \ __asm__ ("fcmp%.x %2,%1; fsoge %0" \ : "=dm" (__result) : "f" (x), "f" (y)); \ __result != 0; }) -# define isless(x, y) \ +# define isless(x, y) \ __extension__ \ ({ char __result; \ __asm__ ("fcmp%.x %2,%1; fsolt %0" \ : "=dm" (__result) : "f" (x), "f" (y)); \ __result != 0; }) -# define islessequal(x, y) \ +# define islessequal(x, y) \ __extension__ \ ({ char __result; \ __asm__ ("fcmp%.x %2,%1; fsole %0" \ : "=dm" (__result) : "f" (x), "f" (y)); \ __result != 0; }) -# define islessgreater(x, y) \ +# define islessgreater(x, y) \ __extension__ \ ({ char __result; \ __asm__ ("fcmp%.x %2,%1; fsogl %0" \ : "=dm" (__result) : "f" (x), "f" (y)); \ __result != 0; }) -# define isunordered(x, y) \ +# define isunordered(x, y) \ __extension__ \ ({ char __result; \ __asm__ ("fcmp%.x %2,%1; fsun %0" \ : "=dm" (__result) : "f" (x), "f" (y)); \ __result != 0; }) +# endif /* GCC 3.1 */ #endif @@ -101,7 +110,7 @@ #if defined __USE_MISC || defined __USE_ISOC99 # define __inline_mathop(func, op) \ __inline_mathop1(double, func, op) \ - __inline_mathop1(float, __CONCAT(func,f), op) \ + __inline_mathop1(float, __CONCAT(func,f), op) \ __inline_mathop1(long double, __CONCAT(func,l), op) #else # define __inline_mathop(func, op) \ @@ -166,29 +175,7 @@ __inline_mathop(trunc, intrz) for the function names. */ #define __inline_functions(float_type, s) \ -__m81_inline float_type \ -__m81_u(__CONCAT(__frexp,s))(float_type __value, int *__expptr) \ -{ \ - float_type __mantissa, __exponent; \ - int __iexponent; \ - unsigned long __fpsr; \ - __asm("ftst%.x %1\n" \ - "fmove%.l %/fpsr, %0" : "=dm" (__fpsr) : "f" (__value)); \ - if (__fpsr & (7 << 24)) \ - { \ - /* Not finite or zero. */ \ - *__expptr = 0; \ - return __value; \ - } \ - __asm("fgetexp%.x %1, %0" : "=f" (__exponent) : "f" (__value)); \ - __iexponent = (int) __exponent + 1; \ - *__expptr = __iexponent; \ - __asm("fscale%.l %2, %0" : "=f" (__mantissa) \ - : "0" (__value), "dmi" (-__iexponent)); \ - return __mantissa; \ -} \ - \ -__m81_defun (float_type, __CONCAT(__floor,s), (float_type __x)) \ +__m81_defun (float_type, __CONCAT(__floor,s), (float_type __x)) \ { \ float_type __result; \ unsigned long int __ctrl_reg; \ @@ -204,7 +191,7 @@ __m81_defun (float_type, __CONCAT(__floor,s), (float_type __x)) \ return __result; \ } \ \ -__m81_defun (float_type, __CONCAT(__ceil,s), (float_type __x)) \ +__m81_defun (float_type, __CONCAT(__ceil,s), (float_type __x)) \ { \ float_type __result; \ unsigned long int __ctrl_reg; \ @@ -230,7 +217,7 @@ __inline_functions(long double,l) #ifdef __USE_MISC # define __inline_functions(float_type, s) \ -__m81_defun (int, __CONCAT(__isinf,s), (float_type __value)) \ +__m81_defun (int, __CONCAT(__isinf,s), (float_type __value)) \ { \ /* There is no branch-condition for infinity, \ so we must extract and examine the condition codes manually. */ \ @@ -240,7 +227,7 @@ __m81_defun (int, __CONCAT(__isinf,s), (float_type __value)) \ return (__fpsr & (2 << 24)) ? (__fpsr & (8 << 24) ? -1 : 1) : 0; \ } \ \ -__m81_defun (int, __CONCAT(__finite,s), (float_type __value)) \ +__m81_defun (int, __CONCAT(__finite,s), (float_type __value)) \ { \ /* There is no branch-condition for infinity, so we must extract and \ examine the condition codes manually. */ \ @@ -268,7 +255,7 @@ __inline_functions(long double,l) #if defined __USE_MISC || defined __USE_XOPEN # define __inline_functions(float_type, s) \ -__m81_defun (int, __CONCAT(__isnan,s), (float_type __value)) \ +__m81_defun (int, __CONCAT(__isnan,s), (float_type __value)) \ { \ char __result; \ __asm("ftst%.x %1\n" \ @@ -288,7 +275,7 @@ __inline_functions(long double,l) #ifdef __USE_ISOC99 # define __inline_functions(float_type, s) \ -__m81_defun (int, __CONCAT(__signbit,s), (float_type __value)) \ +__m81_defun (int, __CONCAT(__signbit,s), (float_type __value)) \ { \ /* There is no branch-condition for the sign bit, so we must extract \ and examine the condition codes manually. */ \ @@ -298,7 +285,7 @@ __m81_defun (int, __CONCAT(__signbit,s), (float_type __value)) \ return (__fpsr >> 27) & 1; \ } \ \ -__m81_defun (float_type, __CONCAT(__scalbln,s), \ + __m81_defun (float_type, __CONCAT(__scalbln,s), \ (float_type __x, long int __n)) \ { \ return __CONCAT(__scalbn,s) (__x, __n); \ @@ -364,10 +351,10 @@ __inline_functions (long double,l) /* Note that there must be no whitespace before the argument passed for NAME, to make token pasting work correctly with -traditional. */ # define __inline_forward_c(rettype, name, args1, args2) \ -extern __inline rettype __attribute__((__const__)) \ -name args1 \ -{ \ - return __CONCAT(__,name) args2; \ +extern __inline rettype __attribute__((__const__)) \ + name args1 \ +{ \ + return __CONCAT(__,name) args2; \ } # define __inline_forward(rettype, name, args1, args2) \ @@ -376,8 +363,6 @@ extern __inline rettype name args1 \ return __CONCAT(__,name) args2; \ } -__inline_forward(double,frexp, (double __value, int *__expptr), - (__value, __expptr)) __inline_forward_c(double,floor, (double __x), (__x)) __inline_forward_c(double,ceil, (double __x), (__x)) # ifdef __USE_MISC @@ -406,8 +391,6 @@ __inline_forward(void,sincos, (double __x, double *__sinx, double *__cosx), # if defined __USE_MISC || defined __USE_ISOC99 -__inline_forward(float,frexpf, (float __value, int *__expptr), - (__value, __expptr)) __inline_forward_c(float,floorf, (float __x), (__x)) __inline_forward_c(float,ceilf, (float __x), (__x)) # ifdef __USE_MISC @@ -428,8 +411,6 @@ __inline_forward(void,sincosf, (float __x, float *__sinx, float *__cosx), (__x, __sinx, __cosx)) # endif -__inline_forward(long double,frexpl, (long double __value, int *__expptr), - (__value, __expptr)) __inline_forward_c(long double,floorl, (long double __x), (__x)) __inline_forward_c(long double,ceill, (long double __x), (__x)) # ifdef __USE_MISC diff --git a/libc/sysdeps/linux/m68k/bits/stat.h b/libc/sysdeps/linux/m68k/bits/stat.h index a435240cd..a0fefbe2b 100644 --- a/libc/sysdeps/linux/m68k/bits/stat.h +++ b/libc/sysdeps/linux/m68k/bits/stat.h @@ -61,12 +61,27 @@ struct stat #else __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ #endif +#if 0 /*def __USE_MISC*/ + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the <sys/stat.h> header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +#else __time_t st_atime; /* Time of last access. */ unsigned long int st_atimensec; /* Nscecs of last access. */ __time_t st_mtime; /* Time of last modification. */ unsigned long int st_mtimensec; /* Nsecs of last modification. */ __time_t st_ctime; /* Time of last status change. */ unsigned long int st_ctimensec; /* Nsecs of last status change. */ +#endif #ifndef __USE_FILE_OFFSET64 unsigned long int __unused4; unsigned long int __unused5; @@ -92,12 +107,24 @@ struct stat64 __blksize_t st_blksize; /* Optimal block size for I/O. */ __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ +#if 0 /*def __USE_MISC*/ + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the <sys/stat.h> header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +#else __time_t st_atime; /* Time of last access. */ unsigned long int st_atimensec; /* Nscecs of last access. */ __time_t st_mtime; /* Time of last modification. */ unsigned long int st_mtimensec; /* Nsecs of last modification. */ __time_t st_ctime; /* Time of last status change. */ unsigned long int st_ctimensec; /* Nsecs of last status change. */ +#endif __ino64_t st_ino; /* File serial number. */ }; #endif diff --git a/libc/sysdeps/linux/m68k/fpu_control.h b/libc/sysdeps/linux/m68k/fpu_control.h index 1b2ba87c9..484bad3b9 100644 --- a/libc/sysdeps/linux/m68k/fpu_control.h +++ b/libc/sysdeps/linux/m68k/fpu_control.h @@ -1,4 +1,4 @@ -/* FPU control word definitions. PowerPC version. +/* 68k FPU control word definitions. Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -20,50 +20,84 @@ #ifndef _FPU_CONTROL_H #define _FPU_CONTROL_H -/* rounding control */ -#define _FPU_RC_NEAREST 0x00 /* RECOMMENDED */ -#define _FPU_RC_DOWN 0x03 -#define _FPU_RC_UP 0x02 -#define _FPU_RC_ZERO 0x01 +/* + * Motorola floating point control register bits. + * + * 31-16 -> reserved (read as 0, ignored on write) + * 15 -> enable trap for BSUN exception + * 14 -> enable trap for SNAN exception + * 13 -> enable trap for OPERR exception + * 12 -> enable trap for OVFL exception + * 11 -> enable trap for UNFL exception + * 10 -> enable trap for DZ exception + * 9 -> enable trap for INEX2 exception + * 8 -> enable trap for INEX1 exception + * 7-6 -> Precision Control + * 5-4 -> Rounding Control + * 3-0 -> zero (read as 0, write as 0) + * + * + * Precision Control: + * 00 - round to extended precision + * 01 - round to single precision + * 10 - round to double precision + * 11 - undefined + * + * Rounding Control: + * 00 - rounding to nearest (RN) + * 01 - rounding toward zero (RZ) + * 10 - rounding (down)toward minus infinity (RM) + * 11 - rounding (up) toward plus infinity (RP) + * + * The hardware default is 0x0000. I choose 0x5400. + */ -#define _FPU_MASK_NI 0x04 /* non-ieee mode */ +#include <features.h> /* masking of interrupts */ -#define _FPU_MASK_ZM 0x10 /* zero divide */ -#define _FPU_MASK_OM 0x40 /* overflow */ -#define _FPU_MASK_UM 0x20 /* underflow */ -#define _FPU_MASK_XM 0x08 /* inexact */ -#define _FPU_MASK_IM 0x80 /* invalid operation */ +#define _FPU_MASK_BSUN 0x8000 +#define _FPU_MASK_SNAN 0x4000 +#define _FPU_MASK_OPERR 0x2000 +#define _FPU_MASK_OVFL 0x1000 +#define _FPU_MASK_UNFL 0x0800 +#define _FPU_MASK_DZ 0x0400 +#define _FPU_MASK_INEX1 0x0200 +#define _FPU_MASK_INEX2 0x0100 -#define _FPU_RESERVED 0xffffff00 /* These bits are reserved are not changed. */ +/* precision control */ +#define _FPU_EXTENDED 0x00 /* RECOMMENDED */ +#define _FPU_DOUBLE 0x80 +#define _FPU_SINGLE 0x40 /* DO NOT USE */ -/* The fdlibm code requires no interrupts for exceptions. */ -#define _FPU_DEFAULT 0x00000000 /* Default value. */ +/* rounding control */ +#define _FPU_RC_NEAREST 0x00 /* RECOMMENDED */ +#define _FPU_RC_ZERO 0x10 +#define _FPU_RC_DOWN 0x20 +#define _FPU_RC_UP 0x30 -/* IEEE: same as above, but (some) exceptions; - we leave the 'inexact' exception off. - */ -#define _FPU_IEEE 0x000000f0 +#define _FPU_RESERVED 0xFFFF000F /* Reserved bits in fpucr */ + + +/* Now two recommended fpucr */ + +/* The fdlibm code requires no interrupts for exceptions. Don't + change the rounding mode, it would break long double I/O! */ +#define _FPU_DEFAULT 0x00000000 + +/* IEEE: same as above, but exceptions. We must make it non-zero so + that __setfpucw works. This bit will be ignored. */ +#define _FPU_IEEE 0x00000001 /* Type of the control word. */ typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__SI__))); /* Macros for accessing the hardware control word. */ -#define _FPU_GETCW(__cw) ( { \ - union { double d; fpu_control_t cw[2]; } \ - tmp __attribute__ ((__aligned__(8))); \ - __asm__ ("mffs 0; stfd%U0 0,%0" : "=m" (tmp.d) : : "fr0"); \ - (__cw)=tmp.cw[1]; \ - tmp.cw[1]; } ) -#define _FPU_SETCW(__cw) { \ - union { double d; fpu_control_t cw[2]; } \ - tmp __attribute__ ((__aligned__(8))); \ - tmp.cw[0] = 0xFFF80000; /* More-or-less arbitrary; this is a QNaN. */ \ - tmp.cw[1] = __cw; \ - __asm__ ("lfd%U0 0,%0; mtfsf 255,0" : : "m" (tmp.d) : "fr0"); \ -} +#define _FPU_GETCW(cw) __asm__ ("fmove%.l %!, %0" : "=dm" (cw)) +#define _FPU_SETCW(cw) __asm__ volatile ("fmove%.l %0, %!" : : "dm" (cw)) +#if 0 /* Default control word set at startup. */ extern fpu_control_t __fpu_control; +#endif -#endif /* _FPU_CONTROL_H */ +#endif /* _M68K_FPU_CONTROL_H */ diff --git a/libc/sysdeps/linux/nios/bits/fcntl.h b/libc/sysdeps/linux/nios/bits/fcntl.h index e2974b9f7..b3e12f41e 100644 --- a/libc/sysdeps/linux/nios/bits/fcntl.h +++ b/libc/sysdeps/linux/nios/bits/fcntl.h @@ -23,6 +23,9 @@ #include <sys/types.h> +#ifdef __USE_GNU +# include <bits/uio.h> +#endif /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ @@ -178,3 +181,45 @@ struct flock64 # define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */ # define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ #endif + +#ifdef __USE_GNU +# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages + in the range before performing the + write. */ +# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those + dirty pages in the range which are + not presently under writeback. */ +# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in + the range after performing the + write. */ +#endif + +__BEGIN_DECLS + +#if 0 /*def __USE_GNU*/ + +/* Provide kernel hint to read ahead. */ +extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) + __THROW; + + +/* Selective file content synch'ing. */ +extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, + unsigned int __flags); + + +/* Splice address range into a pipe. */ +extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count, + unsigned int __flags); + +/* Splice two files together. */ +extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags) + __THROW; + +/* In-kernel implementation of tee for pipe buffers. */ +extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags) + __THROW; + +#endif + +__END_DECLS diff --git a/libc/sysdeps/linux/nios/bits/mathdef.h b/libc/sysdeps/linux/nios/bits/mathdef.h index 44d7f0dde..e013e74b7 100644 --- a/libc/sysdeps/linux/nios/bits/mathdef.h +++ b/libc/sysdeps/linux/nios/bits/mathdef.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2000, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -29,10 +29,6 @@ typedef float float_t; /* `float' expressions are evaluated as typedef double double_t; /* `double' expressions are evaluated as `double'. */ -/* Define `INFINITY' as value of type `float'. */ -# define INFINITY HUGE_VALF - - /* The values returned by `ilogb' for 0 and NaN respectively. */ # define FP_ILOGB0 (-2147483647) # define FP_ILOGBNAN (2147483647) diff --git a/libc/sysdeps/linux/nios/brk.c b/libc/sysdeps/linux/nios/brk.c index 2c252f90c..8e626a7fb 100644 --- a/libc/sysdeps/linux/nios/brk.c +++ b/libc/sysdeps/linux/nios/brk.c @@ -21,11 +21,10 @@ #include <sys/syscall.h> #include <errno.h> -libc_hidden_proto(brk) - /* This must be initialized data because commons can't have aliases. */ -void *__curbrk = 0; +void *__curbrk attribute_hidden = 0; +libc_hidden_proto(brk) int brk (void *addr) { void *newbrk; diff --git a/libc/sysdeps/linux/nios/fpu_control.h b/libc/sysdeps/linux/nios/fpu_control.h index b7cdf2f3e..9c3174574 100644 --- a/libc/sysdeps/linux/nios/fpu_control.h +++ b/libc/sysdeps/linux/nios/fpu_control.h @@ -91,7 +91,9 @@ typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__SI__))); #define _FPU_GETCW(cw) __asm__ ("cfc1 %0,$31" : "=r" (cw)) #define _FPU_SETCW(cw) __asm__ ("ctc1 %0,$31" : : "r" (cw)) +#if 0 /* Default control word set at startup. */ extern fpu_control_t __fpu_control; +#endif #endif /* fpu_control.h */ diff --git a/libc/sysdeps/linux/nios2/bits/fcntl.h b/libc/sysdeps/linux/nios2/bits/fcntl.h index 4b41b4715..ebf925acf 100644 --- a/libc/sysdeps/linux/nios2/bits/fcntl.h +++ b/libc/sysdeps/linux/nios2/bits/fcntl.h @@ -23,6 +23,9 @@ #include <sys/types.h> +#ifdef __USE_GNU +# include <bits/uio.h> +#endif /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ @@ -178,3 +181,45 @@ struct flock64 # define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */ # define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ #endif + +#ifdef __USE_GNU +# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages + in the range before performing the + write. */ +# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those + dirty pages in the range which are + not presently under writeback. */ +# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in + the range after performing the + write. */ +#endif + +__BEGIN_DECLS + +#if 0 /*def __USE_GNU*/ + +/* Provide kernel hint to read ahead. */ +extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) + __THROW; + + +/* Selective file content synch'ing. */ +extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, + unsigned int __flags); + + +/* Splice address range into a pipe. */ +extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count, + unsigned int __flags); + +/* Splice two files together. */ +extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags) + __THROW; + +/* In-kernel implementation of tee for pipe buffers. */ +extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags) + __THROW; + +#endif + +__END_DECLS diff --git a/libc/sysdeps/linux/nios2/bits/mathdef.h b/libc/sysdeps/linux/nios2/bits/mathdef.h index 44d7f0dde..e013e74b7 100644 --- a/libc/sysdeps/linux/nios2/bits/mathdef.h +++ b/libc/sysdeps/linux/nios2/bits/mathdef.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2000, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -29,10 +29,6 @@ typedef float float_t; /* `float' expressions are evaluated as typedef double double_t; /* `double' expressions are evaluated as `double'. */ -/* Define `INFINITY' as value of type `float'. */ -# define INFINITY HUGE_VALF - - /* The values returned by `ilogb' for 0 and NaN respectively. */ # define FP_ILOGB0 (-2147483647) # define FP_ILOGBNAN (2147483647) diff --git a/libc/sysdeps/linux/nios2/brk.c b/libc/sysdeps/linux/nios2/brk.c index 1711e609c..8d6288793 100644 --- a/libc/sysdeps/linux/nios2/brk.c +++ b/libc/sysdeps/linux/nios2/brk.c @@ -21,11 +21,10 @@ #include <sys/syscall.h> #include <errno.h> -libc_hidden_proto(brk) - /* This must be initialized data because commons can't have aliases. */ -void *__curbrk = 0; +void *__curbrk attribute_hidden = 0; +libc_hidden_proto(brk) int brk (void *addr) { void *newbrk; diff --git a/libc/sysdeps/linux/nios2/clone.c b/libc/sysdeps/linux/nios2/clone.c index 019ca31bc..78dcac1af 100644 --- a/libc/sysdeps/linux/nios2/clone.c +++ b/libc/sysdeps/linux/nios2/clone.c @@ -14,9 +14,10 @@ */ #include <errno.h> +#include <sched.h> #include <sys/syscall.h> -int clone (int (*fn)(void *arg), void *child_stack, int flags, void *arg) +int clone (int (*fn)(void *arg), void *child_stack, int flags, void *arg, ...) { register unsigned long rval asm ("r2") = -EINVAL; diff --git a/libc/sysdeps/linux/nios2/fpu_control.h b/libc/sysdeps/linux/nios2/fpu_control.h index b7cdf2f3e..9c3174574 100644 --- a/libc/sysdeps/linux/nios2/fpu_control.h +++ b/libc/sysdeps/linux/nios2/fpu_control.h @@ -91,7 +91,9 @@ typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__SI__))); #define _FPU_GETCW(cw) __asm__ ("cfc1 %0,$31" : "=r" (cw)) #define _FPU_SETCW(cw) __asm__ ("ctc1 %0,$31" : : "r" (cw)) +#if 0 /* Default control word set at startup. */ extern fpu_control_t __fpu_control; +#endif #endif /* fpu_control.h */ diff --git a/libc/sysdeps/linux/powerpc/bits/fcntl.h b/libc/sysdeps/linux/powerpc/bits/fcntl.h index 4e8b61a39..c2ed000af 100644 --- a/libc/sysdeps/linux/powerpc/bits/fcntl.h +++ b/libc/sysdeps/linux/powerpc/bits/fcntl.h @@ -22,8 +22,11 @@ # error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead." #endif - #include <sys/types.h> +#ifdef __USE_GNU +# include <bits/uio.h> +#endif + /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ @@ -180,16 +183,45 @@ struct flock64 # define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ #endif -/* Linux-specific operations for posix_fadvise. */ + #ifdef __USE_GNU -# define LINUX_FADV_ASYNC_WRITE 32 /* Start writeout on range. */ -# define LINUX_FADV_WRITE_WAIT 33 /* Wait upon writeout to range. */ +# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages + in the range before performing the + write. */ +# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those + dirty pages in the range which are + not presently under writeback. */ +# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in + the range after performing the + write. */ #endif __BEGIN_DECLS +#if 0 /*def __USE_GNU*/ + /* Provide kernel hint to read ahead. */ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) __THROW; + +/* Selective file content synch'ing. */ +extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, + unsigned int __flags); + + +/* Splice address range into a pipe. */ +extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count, + unsigned int __flags); + +/* Splice two files together. */ +extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags) + __THROW; + +/* In-kernel implementation of tee for pipe buffers. */ +extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags) + __THROW; + +#endif + __END_DECLS diff --git a/libc/sysdeps/linux/powerpc/bits/fenvinline.h b/libc/sysdeps/linux/powerpc/bits/fenvinline.h index 552c8c9db..f7700a49e 100644 --- a/libc/sysdeps/linux/powerpc/bits/fenvinline.h +++ b/libc/sysdeps/linux/powerpc/bits/fenvinline.h @@ -1,5 +1,6 @@ /* Inline floating-point environment handling functions for powerpc. - Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997, 1998, 1999, 2006 + Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -22,8 +23,9 @@ /* Inline definition for fegetround. */ # define fegetround() \ (__extension__ ({ int __fegetround_result; \ - __asm__ ("mcrfs 7,7 ; mfcr %0" \ - : "=r"(__fegetround_result) : : "cr7"); \ + __asm__ __volatile__ \ + ("mcrfs 7,7 ; mfcr %0" \ + : "=r"(__fegetround_result) : : "cr7"); \ __fegetround_result & 3; })) /* The weird 'i#*X' constraints on the following suppress a gcc diff --git a/libc/sysdeps/linux/powerpc/bits/ipc.h b/libc/sysdeps/linux/powerpc/bits/ipc.h index 3cb593a61..4f45aca36 100644 --- a/libc/sysdeps/linux/powerpc/bits/ipc.h +++ b/libc/sysdeps/linux/powerpc/bits/ipc.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1995-1999, 2000, 2002 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 @@ -38,17 +38,25 @@ /* Special key values. */ #define IPC_PRIVATE ((__key_t) 0) /* Private key. */ + /* Data structure used to pass permission information to IPC operations. */ struct ipc_perm { - __key_t __key; /* Key. */ - __uid_t uid; /* Owner's user ID. */ - __gid_t gid; /* Owner's group ID. */ - __uid_t cuid; /* Creator's user ID. */ - __gid_t cgid; /* Creator's group ID. */ - __mode_t mode; /* Read/write permission. */ + __key_t __key; /* Key. */ + __uid_t uid; /* Owner's user ID. */ + __gid_t gid; /* Owner's group ID. */ + __uid_t cuid; /* Creator's user ID. */ + __gid_t cgid; /* Creator's group ID. */ + __mode_t mode; /* Read/write permission. */ +#if 0 unsigned long __seq; /* Sequence number. */ unsigned int __pad2; unsigned long long int __unused1; unsigned long long int __unused2; +#else + __uint32_t __seq; /* Sequence number. */ + __uint32_t __pad1; + __uint64_t __unused1; + __uint64_t __unused2; +#endif }; diff --git a/libc/sysdeps/linux/powerpc/bits/mathdef.h b/libc/sysdeps/linux/powerpc/bits/mathdef.h index 5eaf41ea6..a076fb6d7 100644 --- a/libc/sysdeps/linux/powerpc/bits/mathdef.h +++ b/libc/sysdeps/linux/powerpc/bits/mathdef.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1997,1998,1999,2000,2003,2004,2006 + 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 @@ -39,12 +40,6 @@ typedef float float_t; /* `float' expressions are evaluated as typedef double double_t; /* `double' expressions are evaluated as `double'. */ -/* Signal that types stay as they were declared. */ -# define FLT_EVAL_METHOD 0 - -/* Define `INFINITY' as value of type `float'. */ -# define INFINITY HUGE_VALF - # else /* For `gcc -traditional', `float' expressions are evaluated as `double'. */ @@ -53,9 +48,6 @@ typedef double float_t; /* `float' expressions are evaluated as typedef double double_t; /* `double' expressions are evaluated as `double'. */ -/* Define `INFINITY' as value of type `float'. */ -# define INFINITY HUGE_VALF - # endif # else @@ -63,9 +55,6 @@ typedef double double_t; /* `double' expressions are evaluated as typedef double float_t; typedef double double_t; -/* Define `INFINITY' as value of type `float'. */ -# define INFINITY HUGE_VALF - # endif /* The values returned by `ilogb' for 0 and NaN respectively. */ @@ -75,7 +64,12 @@ typedef double double_t; #endif /* ISO C99 */ #ifndef __NO_LONG_DOUBLE_MATH +#include <bits/wordsize.h> /* Signal that we do not really have a `long double'. The disables the declaration of all the `long double' function variants. */ -# define __NO_LONG_DOUBLE_MATH 1 +# if __WORDSIZE == 32 +# define __NO_LONG_DOUBLE_MATH 1 +# elif !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ +# define __NO_LONG_DOUBLE_MATH 1 +# endif #endif diff --git a/libc/sysdeps/linux/powerpc/bits/mathinline.h b/libc/sysdeps/linux/powerpc/bits/mathinline.h index 76f68c1a1..87985a744 100644 --- a/libc/sysdeps/linux/powerpc/bits/mathinline.h +++ b/libc/sysdeps/linux/powerpc/bits/mathinline.h @@ -1,5 +1,6 @@ /* Inline math functions for powerpc. - Copyright (C) 1995,1996,1997,1998,1999,2000 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2004, 2006 + Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -17,20 +18,20 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#if defined __GNUC__ && !defined _SOFT_FLOAT - -#ifdef __USE_ISOC99 -# if __GNUC_PREREQ (2,96) +#ifndef _MATH_H +# error "Never use <bits/mathinline.h> directly; include <math.h> instead." +#endif -# define isgreater(x, y) __builtin_isgreater (x, y) -# define isgreaterequal(x, y) __builtin_isgreaterequal (x, y) -# define isless(x, y) __builtin_isless (x, y) -# define islessequal(x, y) __builtin_islessequal (x, y) -# define islessgreater(x, y) __builtin_islessgreater (x, y) -# define isunordered(x, y) __builtin_isunordered (x, y) +#ifdef __cplusplus +# define __MATH_INLINE __inline +#else +# define __MATH_INLINE extern __inline +#endif /* __cplusplus */ -# else +#if defined __GNUC__ && !defined _SOFT_FLOAT +#ifdef __USE_ISOC99 +# if !__GNUC_PREREQ (2,97) # define __unordered_cmp(x, y) \ (__extension__ \ ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \ @@ -39,6 +40,13 @@ : "cr7"); \ __r; })) +# undef isgreater +# undef isgreaterequal +# undef isless +# undef islessequal +# undef islessgreater +# undef isunordered + # define isgreater(x, y) (__unordered_cmp (x, y) >> 2 & 1) # define isgreaterequal(x, y) ((__unordered_cmp (x, y) & 6) != 0) # define isless(x, y) (__unordered_cmp (x, y) >> 3 & 1) @@ -47,24 +55,38 @@ # define isunordered(x, y) (__unordered_cmp (x, y) & 1) # endif /* __GNUC_PREREQ (2,97) */ + +/* The gcc, version 2.7 or below, has problems with all this inlining + code. So disable it for this version of the compiler. */ +# if __GNUC_PREREQ (2, 8) +/* Test for negative number. Used in the signbit() macro. */ +__MATH_INLINE int +__NTH (__signbitf (float __x)) +{ + __extension__ union { float __f; int __i; } __u = { __f: __x }; + return __u.__i < 0; +} +__MATH_INLINE int +__NTH (__signbit (double __x)) +{ + __extension__ union { double __d; int __i[2]; } __u = { __d: __x }; + return __u.__i[0] < 0; +} +# endif #endif /* __USE_ISOC99 */ #if !defined __NO_MATH_INLINES && defined __OPTIMIZE__ -#ifdef __cplusplus -# define __MATH_INLINE __inline -#else -# define __MATH_INLINE extern __inline -#endif /* __cplusplus */ - #ifdef __USE_ISOC99 + +# ifndef __powerpc64__ __MATH_INLINE long int lrint (double __x) __THROW; __MATH_INLINE long int __NTH (lrint (double __x)) { union { double __d; - long int __ll[2]; + int __ll[2]; } __u; __asm__ ("fctiw %0,%1" : "=f"(__u.__d) : "f"(__x)); return __u.__ll[1]; @@ -76,26 +98,85 @@ __NTH (lrintf (float __x)) { union { double __d; - long int __ll[2]; + int __ll[2]; } __u; __asm__ ("fctiw %0,%1" : "=f"(__u.__d) : "f"(__x)); return __u.__ll[1]; } +# endif __MATH_INLINE double fdim (double __x, double __y) __THROW; __MATH_INLINE double __NTH (fdim (double __x, double __y)) { - return __x < __y ? 0 : __x - __y; + return __x <= __y ? 0 : __x - __y; } __MATH_INLINE float fdimf (float __x, float __y) __THROW; __MATH_INLINE float __NTH (fdimf (float __x, float __y)) { - return __x < __y ? 0 : __x - __y; + return __x <= __y ? 0 : __x - __y; } #endif /* __USE_ISOC99 */ #endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */ + +/* This code is used internally in the GNU libc. */ +#if 0 /*def __LIBC_INTERNAL_MATH_INLINES*/ + +#include <sysdep.h> +#include <ldsodefs.h> +#include <dl-procinfo.h> + +# if __WORDSIZE == 64 || defined _ARCH_PWR4 +# define __CPU_HAS_FSQRT 1 +# else +# define __CPU_HAS_FSQRT ((GLRO(dl_hwcap) & PPC_FEATURE_64) != 0) +# endif + +extern double __slow_ieee754_sqrt (double); +__MATH_INLINE double +__NTH (__ieee754_sqrt (double __x)) +{ + double __z; + + /* If the CPU is 64-bit we can use the optional FP instructions. */ + if (__CPU_HAS_FSQRT) + { + /* Volatile is required to prevent the compiler from moving the + fsqrt instruction above the branch. */ + __asm __volatile ( + " fsqrt %0,%1\n" + : "=f" (__z) + : "f" (__x)); + } + else + __z = __slow_ieee754_sqrt(__x); + + return __z; +} + +extern float __slow_ieee754_sqrtf (float); +__MATH_INLINE float +__NTH (__ieee754_sqrtf (float __x)) +{ + float __z; + + /* If the CPU is 64-bit we can use the optional FP instructions. */ + if (__CPU_HAS_FSQRT) + { + /* Volatile is required to prevent the compiler from moving the + fsqrts instruction above the branch. */ + __asm __volatile ( + " fsqrts %0,%1\n" + : "=f" (__z) + : "f" (__x)); + } + else + __z = __slow_ieee754_sqrtf(__x); + + return __z; +} +#endif /* __LIBC_INTERNAL_MATH_INLINES */ #endif /* __GNUC__ && !_SOFT_FLOAT */ diff --git a/libc/sysdeps/linux/powerpc/bits/mman.h b/libc/sysdeps/linux/powerpc/bits/mman.h index 580e93886..e03ab7ff8 100644 --- a/libc/sysdeps/linux/powerpc/bits/mman.h +++ b/libc/sysdeps/linux/powerpc/bits/mman.h @@ -89,7 +89,7 @@ # 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. */ -# define MADV_REMOVE 5 /* Remove these pages and resources. */ +# define MADV_REMOVE 9 /* Remove these pages and resources. */ # define MADV_DONTFORK 10 /* Do not inherit across fork. */ # define MADV_DOFORK 11 /* Do inherit across fork. */ #endif diff --git a/libc/sysdeps/linux/powerpc/bits/stat.h b/libc/sysdeps/linux/powerpc/bits/stat.h index af71f275e..f4a8de14b 100644 --- a/libc/sysdeps/linux/powerpc/bits/stat.h +++ b/libc/sysdeps/linux/powerpc/bits/stat.h @@ -69,12 +69,27 @@ struct stat # else __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ # endif +#if 0 /*def __USE_MISC*/ + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the <sys/stat.h> header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +#else __time_t st_atime; /* Time of last access. */ unsigned long int st_atimensec; /* Nscecs of last access. */ __time_t st_mtime; /* Time of last modification. */ unsigned long int st_mtimensec; /* Nsecs of last modification. */ __time_t st_ctime; /* Time of last status change. */ unsigned long int st_ctimensec; /* Nsecs of last status change. */ +#endif unsigned long int __unused4; unsigned long int __unused5; }; @@ -94,12 +109,27 @@ struct stat64 __off64_t st_size; /* Size of file, in bytes. */ __blksize_t st_blksize; /* Optimal block size for I/O. */ __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ +#if 0 /*def __USE_MISC*/ + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the <sys/stat.h> header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +#else __time_t st_atime; /* Time of last access. */ unsigned long int st_atimensec; /* Nscecs of last access. */ __time_t st_mtime; /* Time of last modification. */ unsigned long int st_mtimensec; /* Nsecs of last modification. */ __time_t st_ctime; /* Time of last status change. */ unsigned long int st_ctimensec; /* Nsecs of last status change. */ +#endif unsigned long int __unused4; unsigned long int __unused5; }; @@ -133,12 +163,27 @@ struct stat # else __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ # endif +#if 0 /*def __USE_MISC*/ + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the <sys/stat.h> header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +#else __time_t st_atime; /* Time of last access. */ unsigned long int st_atimensec; /* Nscecs of last access. */ __time_t st_mtime; /* Time of last modification. */ unsigned long int st_mtimensec; /* Nsecs of last modification. */ __time_t st_ctime; /* Time of last status change. */ unsigned long int st_ctimensec; /* Nsecs of last status change. */ +#endif unsigned long int __unused4; unsigned long int __unused5; unsigned long int __unused6; @@ -158,12 +203,27 @@ struct stat64 __off64_t st_size; /* Size of file, in bytes. */ __blksize_t st_blksize; /* Optimal block size for I/O. */ __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ +#if 0 /*def __USE_MISC*/ + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the <sys/stat.h> header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +#else __time_t st_atime; /* Time of last access. */ unsigned long int st_atimensec; /* Nscecs of last access. */ __time_t st_mtime; /* Time of last modification. */ unsigned long int st_mtimensec; /* Nsecs of last modification. */ __time_t st_ctime; /* Time of last status change. */ unsigned long int st_ctimensec; /* Nsecs of last status change. */ +#endif unsigned long int __unused4; unsigned long int __unused5; unsigned long int __unused6; diff --git a/libc/sysdeps/linux/powerpc/bits/syscalls.h b/libc/sysdeps/linux/powerpc/bits/syscalls.h index e28c380ee..ae269b876 100644 --- a/libc/sysdeps/linux/powerpc/bits/syscalls.h +++ b/libc/sysdeps/linux/powerpc/bits/syscalls.h @@ -5,13 +5,13 @@ # error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead." #endif -#include <errno.h> - /* This includes the `__NR_<name>' syscall numbers taken from the Linux kernel * header files. It also defines the traditional `SYS_<name>' macros for older * programs. */ #include <bits/sysnum.h> +#ifndef __ASSEMBLER__ + /* Define a macro which expands inline into the wrapper code for a system call. This use is for internal calls that do not need to handle errors normally. It will never touch errno. @@ -20,6 +20,10 @@ "sc; bnslr+" sequence) and CR (where only CR0.SO is clobbered to signal an error return status). */ +#include <errno.h> + +#define SYS_ify(syscall_name) (__NR_##syscall_name) + # undef INLINE_SYSCALL #if 1 # define INLINE_SYSCALL(name, nr, args...) \ @@ -164,5 +168,5 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6 return (type) INLINE_SYSCALL(name, 6, arg1, arg2, arg3, arg4, arg5, arg6); \ } +#endif /* __ASSEMBLER__ */ #endif /* _BITS_SYSCALLS_H */ - diff --git a/libc/sysdeps/linux/powerpc/brk.S b/libc/sysdeps/linux/powerpc/brk.S index b06dc0c94..25155ad46 100644 --- a/libc/sysdeps/linux/powerpc/brk.S +++ b/libc/sysdeps/linux/powerpc/brk.S @@ -29,6 +29,7 @@ .section .bss .align 4 .globl __curbrk + .hidden __curbrk __curbrk: .skip 4 .type __curbrk,@object .size __curbrk,4 @@ -69,4 +70,4 @@ brk: .size brk,.-brk libc_hidden_def(brk) -#endif +#endif diff --git a/libc/sysdeps/linux/powerpc/fpu_control.h b/libc/sysdeps/linux/powerpc/fpu_control.h index 1b2ba87c9..2df9ba0e7 100644 --- a/libc/sysdeps/linux/powerpc/fpu_control.h +++ b/libc/sysdeps/linux/powerpc/fpu_control.h @@ -63,7 +63,9 @@ typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__SI__))); __asm__ ("lfd%U0 0,%0; mtfsf 255,0" : : "m" (tmp.d) : "fr0"); \ } +#if 0 /* Default control word set at startup. */ extern fpu_control_t __fpu_control; +#endif #endif /* _FPU_CONTROL_H */ diff --git a/libc/sysdeps/linux/sh/__init_brk.c b/libc/sysdeps/linux/sh/__init_brk.c index 9f5ee867b..bb0692448 100644 --- a/libc/sysdeps/linux/sh/__init_brk.c +++ b/libc/sysdeps/linux/sh/__init_brk.c @@ -4,13 +4,12 @@ #include <unistd.h> #include <sys/syscall.h> -void * __curbrk = 0; +void * __curbrk attribute_hidden = 0; #define __NR__brk __NR_brk attribute_hidden _syscall1(void *, _brk, void *, ptr); -extern int __init_brk (void); -libc_hidden_proto(__init_brk) +extern int __init_brk (void) attribute_hidden; int __init_brk (void) { @@ -25,4 +24,3 @@ __init_brk (void) } return 0; } -libc_hidden_def(__init_brk) diff --git a/libc/sysdeps/linux/sh/bits/fcntl.h b/libc/sysdeps/linux/sh/bits/fcntl.h index 8c9159f0f..30fcc8367 100644 --- a/libc/sysdeps/linux/sh/bits/fcntl.h +++ b/libc/sysdeps/linux/sh/bits/fcntl.h @@ -22,8 +22,11 @@ # error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead." #endif - #include <sys/types.h> +#ifdef __USE_GNU +# include <bits/uio.h> +#endif + /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ @@ -180,16 +183,45 @@ struct flock64 # define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ #endif -/* Linux-specific operations for posix_fadvise. */ + #ifdef __USE_GNU -# define LINUX_FADV_ASYNC_WRITE 32 /* Start writeout on range. */ -# define LINUX_FADV_WRITE_WAIT 33 /* Wait upon writeout to range. */ +# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages + in the range before performing the + write. */ +# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those + dirty pages in the range which are + not presently under writeback. */ +# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in + the range after performing the + write. */ #endif __BEGIN_DECLS +#if 0 /*def __USE_GNU*/ + /* Provide kernel hint to read ahead. */ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) __THROW; + +/* Selective file content synch'ing. */ +extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, + unsigned int __flags); + + +/* Splice address range into a pipe. */ +extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count, + unsigned int __flags); + +/* Splice two files together. */ +extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags) + __THROW; + +/* In-kernel implementation of tee for pipe buffers. */ +extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags) + __THROW; + +#endif + __END_DECLS diff --git a/libc/sysdeps/linux/sh/bits/huge_val.h b/libc/sysdeps/linux/sh/bits/huge_val.h index e476d796b..732b06503 100644 --- a/libc/sysdeps/linux/sh/bits/huge_val.h +++ b/libc/sysdeps/linux/sh/bits/huge_val.h @@ -1,7 +1,8 @@ /* `HUGE_VAL' constants for IEEE 754 machines (where it is infinity). Used by <stdlib.h> and <math.h> functions for overflow. SH version. - Copyright (C) 1992, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. + Copyright (C) 1992, 95, 96, 97, 98, 99, 2000, 2004 + 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 @@ -23,25 +24,19 @@ # error "Never use <bits/huge_val.h> directly; include <math.h> instead." #endif -#include <features.h> - /* IEEE positive infinity (-HUGE_VAL is negative infinity). */ -#ifdef __GNUC__ - -# if __GNUC_PREREQ(2,96) - -# define HUGE_VAL (__extension__ 0x1.0p2047) - -# else +#if __GNUC_PREREQ(3,3) +# define HUGE_VAL (__builtin_huge_val()) +#elif __GNUC_PREREQ(2,96) +# define HUGE_VAL (__extension__ 0x1.0p2047) +#elif defined __GNUC__ # define HUGE_VAL \ (__extension__ \ ((union { unsigned __l __attribute__((__mode__(__DI__))); double __d; }) \ { __l: 0x000000007ff00000ULL }).__d) -# endif - #else /* not GCC */ # include <endian.h> @@ -59,46 +54,3 @@ static __huge_val_t __huge_val = { __HUGE_VAL_bytes }; # define HUGE_VAL (__huge_val.__d) #endif /* GCC. */ - - -/* ISO C99 extensions: (float) HUGE_VALF and (long double) HUGE_VALL. */ - -#ifdef __USE_ISOC99 - -# ifdef __GNUC__ - -# if __GNUC_PREREQ(2,96) - -# define HUGE_VALF (__extension__ 0x1.0p255f) - -# else - -# define HUGE_VALF \ - (__extension__ \ - ((union { unsigned __l __attribute__((__mode__(__SI__))); float __d; }) \ - { __l: 0x7f800000UL }).__d) - -# endif - -# else /* not GCC */ - -typedef union { unsigned char __c[4]; float __f; } __huge_valf_t; - -# if __BYTE_ORDER == __BIG_ENDIAN -# define __HUGE_VALF_bytes { 0x7f, 0x80, 0, 0 } -# endif -# if __BYTE_ORDER == __LITTLE_ENDIAN -# define __HUGE_VALF_bytes { 0, 0, 0x80, 0x7f } -# endif - -static __huge_valf_t __huge_valf = { __HUGE_VALF_bytes }; -# define HUGE_VALF (__huge_valf.__f) - -# endif /* GCC. */ - - -/* Generally there is no separate `long double' format and it is the - same as `double'. */ -# define HUGE_VALL HUGE_VAL - -#endif /* __USE_ISOC99. */ diff --git a/libc/sysdeps/linux/sh/bits/mman.h b/libc/sysdeps/linux/sh/bits/mman.h index 3c10334a4..7a6b572a4 100644 --- a/libc/sysdeps/linux/sh/bits/mman.h +++ b/libc/sysdeps/linux/sh/bits/mman.h @@ -88,7 +88,7 @@ # 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. */ -# define MADV_REMOVE 5 /* Remove these pages and resources. */ +# define MADV_REMOVE 9 /* Remove these pages and resources. */ # define MADV_DONTFORK 10 /* Do not inherit across fork. */ # define MADV_DOFORK 11 /* Do inherit across fork. */ #endif diff --git a/libc/sysdeps/linux/sh/bits/syscalls.h b/libc/sysdeps/linux/sh/bits/syscalls.h index 55b227f71..83b20f63e 100644 --- a/libc/sysdeps/linux/sh/bits/syscalls.h +++ b/libc/sysdeps/linux/sh/bits/syscalls.h @@ -9,15 +9,12 @@ * programs. */ #include <bits/sysnum.h> -#ifndef __set_errno -# define __set_errno(val) (*__errno_location ()) = (val) -#endif -#ifndef SYS_ify -# define SYS_ify(syscall_name) (__NR_##syscall_name) -#endif - #ifndef __ASSEMBLER__ +#include <errno.h> + +#define SYS_ify(syscall_name) (__NR_##syscall_name) + /* user-visible error numbers are in the range -1 - -125: see <asm-sh/errno.h> */ #define __syscall_return(type, res) \ do { \ diff --git a/libc/sysdeps/linux/sh/brk.c b/libc/sysdeps/linux/sh/brk.c index b26f74fec..c69c97ad6 100644 --- a/libc/sysdeps/linux/sh/brk.c +++ b/libc/sysdeps/linux/sh/brk.c @@ -9,14 +9,11 @@ #include <unistd.h> #include <sys/syscall.h> -libc_hidden_proto(brk) - -extern void * __curbrk; - -extern int __init_brk (void); -libc_hidden_proto(__init_brk) +extern void * __curbrk attribute_hidden; +extern int __init_brk (void) attribute_hidden; extern void *_brk(void *ptr) attribute_hidden; +libc_hidden_proto(brk) int brk(void * end_data_seg) { if (__init_brk () == 0) diff --git a/libc/sysdeps/linux/sh/fpu_control.h b/libc/sysdeps/linux/sh/fpu_control.h index 43eb9e549..db3cc4557 100644 --- a/libc/sysdeps/linux/sh/fpu_control.h +++ b/libc/sysdeps/linux/sh/fpu_control.h @@ -20,6 +20,8 @@ #ifndef _FPU_CONTROL_H #define _FPU_CONTROL_H +#warning This file is only correct for sh4 + /* masking of interrupts */ #define _FPU_MASK_VM 0x0800 /* Invalid operation */ #define _FPU_MASK_ZM 0x0400 /* Division by zero */ @@ -50,7 +52,9 @@ typedef unsigned int fpu_control_t; #define _FPU_SETCW(cw) __asm__ ("lds %0,fpscr" : : "r" (cw)) #endif +#if 0 /* Default control word set at startup. */ extern fpu_control_t __fpu_control; +#endif #endif /* _FPU_CONTROL_H */ diff --git a/libc/sysdeps/linux/sh/sbrk.c b/libc/sysdeps/linux/sh/sbrk.c index fd760985e..a1ff2a148 100644 --- a/libc/sysdeps/linux/sh/sbrk.c +++ b/libc/sysdeps/linux/sh/sbrk.c @@ -4,14 +4,11 @@ #include <unistd.h> #include <sys/syscall.h> -libc_hidden_proto(sbrk) - -extern void * __curbrk; - -extern int __init_brk (void); -libc_hidden_proto(__init_brk) +extern void * __curbrk attribute_hidden; +extern int __init_brk (void) attribute_hidden; extern void *_brk(void *ptr) attribute_hidden; +libc_hidden_proto(sbrk) void * sbrk(intptr_t increment) { diff --git a/libc/sysdeps/linux/sh/sys/user.h b/libc/sysdeps/linux/sh/sys/user.h index 522475f79..7f31bb62d 100644 --- a/libc/sysdeps/linux/sh/sys/user.h +++ b/libc/sysdeps/linux/sh/sys/user.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1998, 1999, 2000, 2003 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 @@ -23,4 +23,6 @@ #include <asm/user.h> +#undef start_thread + #endif /* sys/user.h */ diff --git a/libc/sysdeps/linux/sh64/__init_brk.c b/libc/sysdeps/linux/sh64/__init_brk.c index 9f5ee867b..bb0692448 100644 --- a/libc/sysdeps/linux/sh64/__init_brk.c +++ b/libc/sysdeps/linux/sh64/__init_brk.c @@ -4,13 +4,12 @@ #include <unistd.h> #include <sys/syscall.h> -void * __curbrk = 0; +void * __curbrk attribute_hidden = 0; #define __NR__brk __NR_brk attribute_hidden _syscall1(void *, _brk, void *, ptr); -extern int __init_brk (void); -libc_hidden_proto(__init_brk) +extern int __init_brk (void) attribute_hidden; int __init_brk (void) { @@ -25,4 +24,3 @@ __init_brk (void) } return 0; } -libc_hidden_def(__init_brk) diff --git a/libc/sysdeps/linux/sh64/bits/syscalls.h b/libc/sysdeps/linux/sh64/bits/syscalls.h index e6190303a..9b4efc2e5 100644 --- a/libc/sysdeps/linux/sh64/bits/syscalls.h +++ b/libc/sysdeps/linux/sh64/bits/syscalls.h @@ -9,15 +9,12 @@ * programs. */ #include <bits/sysnum.h> -#ifndef __set_errno -# define __set_errno(val) (*__errno_location ()) = (val) -#endif -#ifndef SYS_ify -# define SYS_ify(syscall_name) (__NR_##syscall_name) -#endif - #ifndef __ASSEMBLER__ +#include <errno.h> + +#define SYS_ify(syscall_name) (__NR_##syscall_name) + /* user-visible error numbers are in the range -1 - -125: see <asm-sh64/errno.h> */ #define __syscall_return(type, res) \ do { \ diff --git a/libc/sysdeps/linux/sh64/brk.c b/libc/sysdeps/linux/sh64/brk.c index b26f74fec..c69c97ad6 100644 --- a/libc/sysdeps/linux/sh64/brk.c +++ b/libc/sysdeps/linux/sh64/brk.c @@ -9,14 +9,11 @@ #include <unistd.h> #include <sys/syscall.h> -libc_hidden_proto(brk) - -extern void * __curbrk; - -extern int __init_brk (void); -libc_hidden_proto(__init_brk) +extern void * __curbrk attribute_hidden; +extern int __init_brk (void) attribute_hidden; extern void *_brk(void *ptr) attribute_hidden; +libc_hidden_proto(brk) int brk(void * end_data_seg) { if (__init_brk () == 0) diff --git a/libc/sysdeps/linux/sh64/sbrk.c b/libc/sysdeps/linux/sh64/sbrk.c index fd760985e..a1ff2a148 100644 --- a/libc/sysdeps/linux/sh64/sbrk.c +++ b/libc/sysdeps/linux/sh64/sbrk.c @@ -4,14 +4,11 @@ #include <unistd.h> #include <sys/syscall.h> -libc_hidden_proto(sbrk) - -extern void * __curbrk; - -extern int __init_brk (void); -libc_hidden_proto(__init_brk) +extern void * __curbrk attribute_hidden; +extern int __init_brk (void) attribute_hidden; extern void *_brk(void *ptr) attribute_hidden; +libc_hidden_proto(sbrk) void * sbrk(intptr_t increment) { diff --git a/libc/sysdeps/linux/sparc/bits/fcntl.h b/libc/sysdeps/linux/sparc/bits/fcntl.h index b7f46e403..5314a5240 100644 --- a/libc/sysdeps/linux/sparc/bits/fcntl.h +++ b/libc/sysdeps/linux/sparc/bits/fcntl.h @@ -24,6 +24,9 @@ #include <sys/types.h> #include <bits/wordsize.h> +#ifdef __USE_GNU +# include <bits/uio.h> +#endif /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ @@ -199,16 +202,45 @@ struct flock64 # define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ #endif -/* Linux-specific operations for posix_fadvise. */ + #ifdef __USE_GNU -# define LINUX_FADV_ASYNC_WRITE 32 /* Start writeout on range. */ -# define LINUX_FADV_WRITE_WAIT 33 /* Wait upon writeout to range. */ +# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages + in the range before performing the + write. */ +# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those + dirty pages in the range which are + not presently under writeback. */ +# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in + the range after performing the + write. */ #endif __BEGIN_DECLS +#if 0 /*def __USE_GNU*/ + /* Provide kernel hint to read ahead. */ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) __THROW; + +/* Selective file content synch'ing. */ +extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, + unsigned int __flags); + + +/* Splice address range into a pipe. */ +extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count, + unsigned int __flags); + +/* Splice two files together. */ +extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags) + __THROW; + +/* In-kernel implementation of tee for pipe buffers. */ +extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags) + __THROW; + +#endif + __END_DECLS diff --git a/libc/sysdeps/linux/sparc/bits/mathdef.h b/libc/sysdeps/linux/sparc/bits/mathdef.h index c292a4189..7f9bbee81 100644 --- a/libc/sysdeps/linux/sparc/bits/mathdef.h +++ b/libc/sysdeps/linux/sparc/bits/mathdef.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 1999, 2000, 2004, 2006 + 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 @@ -35,18 +36,12 @@ typedef float float_t; typedef double double_t; -/* Define `INFINITY' as value of type `float'. */ -# define INFINITY HUGE_VALF - # else /* For `gcc -traditional', `float' expressions are evaluated as `double'. */ typedef double float_t; typedef double double_t; -/* Define `INFINITY' as value of type `float'. */ -# define INFINITY HUGE_VALF - # endif # else @@ -54,9 +49,6 @@ typedef double double_t; typedef double float_t; typedef double double_t; -/* Define `INFINITY' as value of type `float'. */ -# define INFINITY HUGE_VALF - # endif /* The values returned by `ilogb' for 0 and NaN respectively. */ @@ -72,6 +64,8 @@ typedef double double_t; The disables the declaration of all the `long double' function variants. */ # define __NO_LONG_DOUBLE_MATH 1 +# elif !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ +# define __NO_LONG_DOUBLE_MATH 1 # endif #endif diff --git a/libc/sysdeps/linux/sparc/bits/mathinline.h b/libc/sysdeps/linux/sparc/bits/mathinline.h index f4bb278ed..9dd784d12 100644 --- a/libc/sysdeps/linux/sparc/bits/mathinline.h +++ b/libc/sysdeps/linux/sparc/bits/mathinline.h @@ -1,5 +1,6 @@ /* Inline math functions for SPARC. - Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2001, 2002, 2004, 2006 + Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek <jakub@redhat.com>. @@ -26,27 +27,62 @@ #ifdef __GNUC__ -#ifdef __USE_ISOC99 +#if defined __USE_ISOC99 && !__GNUC_PREREQ (3, 0) +# undef isgreater +# undef isgreaterequal +# undef isless +# undef islessequal +# undef islessgreater +# undef isunordered # if __WORDSIZE == 32 -# define __unordered_cmp(x, y) \ +# ifndef __NO_LONG_DOUBLE_MATH + +# define __unordered_cmp(x, y) \ + (__extension__ \ + ({ unsigned __r; \ + if (sizeof (x) == 4 && sizeof (y) == 4) \ + { \ + float __x = (x); float __y = (y); \ + __asm__ ("fcmps %1,%2; st %%fsr, %0" : "=m" (__r) : "f" (__x), \ + "f" (__y) : "cc"); \ + } \ + else if (sizeof (x) <= 8 && sizeof (y) <= 8) \ + { \ + double __x = (x); double __y = (y); \ + __asm__ ("fcmpd\t%1,%2\n\tst\t%%fsr,%0" : "=m" (__r) : "f" (__x), \ + "f" (__y) : "cc"); \ + } \ + else \ + { \ + long double __x = (x); long double __y = (y); \ + extern int _Q_cmp (const long double a, const long double b); \ + __r = _Q_cmp (__x, __y) << 10; \ + } \ + __r; })) + +# else + +# define __unordered_cmp(x, y) \ (__extension__ \ ({ unsigned __r; \ - if (sizeof(x) == 4 && sizeof(y) == 4) \ + if (sizeof (x) == 4 && sizeof (y) == 4) \ { \ float __x = (x); float __y = (y); \ - __asm__("fcmps %1,%2; st %%fsr, %0" : "=m" (__r) : "f" (__x), \ - "f" (__y) : "cc"); \ + __asm__ ("fcmps %1,%2; st %%fsr, %0" : "=m" (__r) : "f" (__x), \ + "f" (__y) : "cc"); \ } \ else \ { \ double __x = (x); double __y = (y); \ - __asm__("fcmpd\t%1,%2\n\tst\t%%fsr,%0" : "=m" (__r) : "f" (__x), \ - "f" (__y) : "cc"); \ + __asm__ ("fcmpd\t%1,%2\n\tst\t%%fsr,%0" : "=m" (__r) : "f" (__x), \ + "f" (__y) : "cc"); \ } \ __r; })) +# endif + # define isgreater(x, y) ((__unordered_cmp (x, y) & (3 << 10)) == (2 << 10)) # define isgreaterequal(x, y) ((__unordered_cmp (x, y) & (1 << 10)) == 0) # define isless(x, y) ((__unordered_cmp (x, y) & (3 << 10)) == (1 << 10)) @@ -59,22 +95,22 @@ # define __unordered_v9cmp(x, y, op, qop) \ (__extension__ \ ({ unsigned __r; \ - if (sizeof(x) == 4 && sizeof(y) == 4) \ + if (sizeof (x) == 4 && sizeof (y) == 4) \ { \ float __x = (x); float __y = (y); \ - __asm__("fcmps\t%%fcc3,%1,%2\n\tmov" op "\t%%fcc3,1,%0" \ - : "=r" (__r) : "f" (__x), "f" (__y), "0" (0) : "cc"); \ + __asm__ ("fcmps\t%%fcc3,%1,%2\n\tmov" op "\t%%fcc3,1,%0" \ + : "=r" (__r) : "f" (__x), "f" (__y), "0" (0) : "cc"); \ } \ - else if (sizeof(x) <= 8 && sizeof(y) <= 8) \ + else if (sizeof (x) <= 8 && sizeof (y) <= 8) \ { \ double __x = (x); double __y = (y); \ - __asm__("fcmpd\t%%fcc3,%1,%2\n\tmov" op "\t%%fcc3,1,%0" \ - : "=r" (__r) : "f" (__x), "f" (__y), "0" (0) : "cc"); \ + __asm__ ("fcmpd\t%%fcc3,%1,%2\n\tmov" op "\t%%fcc3,1,%0" \ + : "=r" (__r) : "f" (__x), "f" (__y), "0" (0) : "cc"); \ } \ else \ { \ long double __x = (x); long double __y = (y); \ - extern int _Qp_cmp(const long double *a, const long double *b); \ + extern int _Qp_cmp (const long double *a, const long double *b); \ __r = qop; \ } \ __r; })) @@ -121,11 +157,20 @@ __NTH (__signbit (double __x)) return __u.__i[0] < 0; } +# ifndef __NO_LONG_DOUBLE_MATH +__MATH_INLINE int +__NTH (__signbitl (long double __x)) +{ + __extension__ union { long double __l; int __i[4]; } __u = { __l: __x }; + return __u.__i[0] < 0; +} +# else __MATH_INLINE int __NTH (__signbitl (long double __x)) { return __signbit ((double)__x); } +# endif # else /* sparc64 */ @@ -147,7 +192,7 @@ __NTH (__signbitl (long double __x)) # endif /* __USE_ISOC99 */ -# ifndef __NO_MATH_INLINES +# if !defined __NO_MATH_INLINES && !__GNUC_PREREQ (3, 2) __MATH_INLINE double __NTH (sqrt (double __x)) @@ -174,9 +219,16 @@ __NTH (sqrtl (long double __x)) _Qp_sqrt (&__r, &__x); return __r; } +# elif !defined __NO_LONG_DOUBLE_MATH +__MATH_INLINE long double +sqrtl (long double __x) __THROW +{ + extern long double _Q_sqrt (__const__ long double); + return _Q_sqrt (__x); +} # endif /* sparc64 */ -# endif /* !__NO_MATH_INLINES */ +# endif /* !__NO_MATH_INLINES && !GCC 3.2+ */ /* This code is used internally in the GNU libc. */ # ifdef __LIBC_INTERNAL_MATH_INLINES @@ -205,6 +257,13 @@ __ieee754_sqrtl (long double __x) _Qp_sqrt(&__r, &__x); return __r; } +# elif !defined __NO_LONG_DOUBLE_MATH +__MATH_INLINE long double +__ieee754_sqrtl (long double __x) +{ + extern long double _Q_sqrt (__const__ long double); + return _Q_sqrt (__x); +} # endif /* sparc64 */ # endif /* __LIBC_INTERNAL_MATH_INLINES */ # endif /* gcc 2.8+ */ @@ -217,14 +276,14 @@ __MATH_INLINE double __NTH (fdim (double __x, double __y)); __MATH_INLINE double __NTH (fdim (double __x, double __y)) { - return __x < __y ? 0 : __x - __y; + return __x <= __y ? 0 : __x - __y; } __MATH_INLINE float __NTH (fdimf (float __x, float __y)); __MATH_INLINE float __NTH (fdimf (float __x, float __y)) { - return __x < __y ? 0 : __x - __y; + return __x <= __y ? 0 : __x - __y; } # endif /* !__NO_MATH_INLINES */ diff --git a/libc/sysdeps/linux/sparc/bits/mman.h b/libc/sysdeps/linux/sparc/bits/mman.h index 8de270f93..be2b7eb28 100644 --- a/libc/sysdeps/linux/sparc/bits/mman.h +++ b/libc/sysdeps/linux/sparc/bits/mman.h @@ -91,7 +91,7 @@ # define MADV_WILLNEED 3 /* Will need these pages. */ # define MADV_DONTNEED 4 /* Don't need these pages. */ # define MADV_FREE 5 /* Content can be freed (Solaris). */ -# define MADV_REMOVE 6 /* Remove these pages and resources. */ +# define MADV_REMOVE 9 /* Remove these pages and resources. */ # define MADV_DONTFORK 10 /* Do not inherit across fork. */ # define MADV_DOFORK 11 /* Do inherit across fork. */ #endif diff --git a/libc/sysdeps/linux/sparc/bits/stat.h b/libc/sysdeps/linux/sparc/bits/stat.h index cc454117b..8dcfacd66 100644 --- a/libc/sysdeps/linux/sparc/bits/stat.h +++ b/libc/sysdeps/linux/sparc/bits/stat.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1992,95,96,97,98,99,2000,2001,2002 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2006 + 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 @@ -60,12 +61,27 @@ struct stat #else __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ #endif +#if 0 /*def __USE_MISC*/ + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the <sys/stat.h> header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +#else __time_t st_atime; /* Time of last access. */ unsigned long int st_atimensec; /* Nscecs of last access. */ __time_t st_mtime; /* Time of last modification. */ unsigned long int st_mtimensec; /* Nsecs of last modification. */ __time_t st_ctime; /* Time of last status change. */ unsigned long int st_ctimensec; /* Nsecs of last status change. */ +#endif unsigned long int __unused4; unsigned long int __unused5; }; @@ -88,12 +104,27 @@ struct stat64 __blksize_t st_blksize; /* Optimal block size for I/O. */ __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ +#if 0 /*def __USE_MISC*/ + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the <sys/stat.h> header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +#else __time_t st_atime; /* Time of last access. */ unsigned long int st_atimensec; /* Nscecs of last access. */ __time_t st_mtime; /* Time of last modification. */ unsigned long int st_mtimensec; /* Nsecs of last modification. */ __time_t st_ctime; /* Time of last status change. */ unsigned long int st_ctimensec; /* Nsecs of last status change. */ +#endif unsigned long int __unused4; unsigned long int __unused5; }; diff --git a/libc/sysdeps/linux/sparc/bits/syscalls.h b/libc/sysdeps/linux/sparc/bits/syscalls.h index b8865d453..b0f953972 100644 --- a/libc/sysdeps/linux/sparc/bits/syscalls.h +++ b/libc/sysdeps/linux/sparc/bits/syscalls.h @@ -11,12 +11,12 @@ * programs. */ #include <bits/sysnum.h> -#ifndef __set_errno -# define __set_errno(val) (*__errno_location ()) = (val) -#endif - #ifndef __ASSEMBLER__ +#include <errno.h> + +#define SYS_ify(syscall_name) (__NR_##syscall_name) + #undef __SYSCALL_STRING #if __WORDSIZE == 32 # define __SYSCALL_STRING \ diff --git a/libc/sysdeps/linux/sparc/bits/wordsize.h b/libc/sysdeps/linux/sparc/bits/wordsize.h index cbe862f50..c0e600ed5 100644 --- a/libc/sysdeps/linux/sparc/bits/wordsize.h +++ b/libc/sysdeps/linux/sparc/bits/wordsize.h @@ -1,24 +1,20 @@ -/* Copyright (C) 1999 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. */ +/* Determine the wordsize from the preprocessor defines. */ #if defined __arch64__ || defined __sparcv9 -# define __WORDSIZE 64 +# define __WORDSIZE 64 #else -# define __WORDSIZE 32 +# define __WORDSIZE 32 #endif +#if 0 /* uClibc: done in mathdefs.h: !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL*/ + +# if __WORDSIZE == 32 +/* Signal that in 32bit ABI we didn't used to have a `long double'. + The changes all the `long double' function variants to be redirects + to the double functions. */ +# define __LONG_DOUBLE_MATH_OPTIONAL 1 +# ifndef __LONG_DOUBLE_128__ +# define __NO_LONG_DOUBLE_MATH 1 +# endif +# endif +#endif diff --git a/libc/sysdeps/linux/sparc/brk.c b/libc/sysdeps/linux/sparc/brk.c index f6d5281d2..7791f55e5 100644 --- a/libc/sysdeps/linux/sparc/brk.c +++ b/libc/sysdeps/linux/sparc/brk.c @@ -21,11 +21,11 @@ #include <unistd.h> #include <sys/syscall.h> -libc_hidden_proto(brk) /* This must be initialized data because commons can't have aliases. */ -void *__curbrk = 0; +void *__curbrk attribute_hidden = 0; +libc_hidden_proto(brk) int brk (void *addr) { void *newbrk; diff --git a/libc/sysdeps/linux/sparc/fpu_control.h b/libc/sysdeps/linux/sparc/fpu_control.h index b29734ce2..41ab0a917 100644 --- a/libc/sysdeps/linux/sparc/fpu_control.h +++ b/libc/sysdeps/linux/sparc/fpu_control.h @@ -67,7 +67,9 @@ typedef unsigned long int fpu_control_t; # define _FPU_SETCW(cw) __asm__ ("ld %0,%%fsr" : : "m" (*&cw)) #endif +#if 0 /* Default control word set at startup. */ extern fpu_control_t __fpu_control; +#endif #endif /* fpu_control.h */ diff --git a/libc/sysdeps/linux/vax/bits/fcntl.h b/libc/sysdeps/linux/vax/bits/fcntl.h index 0c94c6b9a..be3e6cc4f 100644 --- a/libc/sysdeps/linux/vax/bits/fcntl.h +++ b/libc/sysdeps/linux/vax/bits/fcntl.h @@ -23,6 +23,9 @@ #include <sys/types.h> +#ifdef __USE_GNU +# include <bits/uio.h> +#endif /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ @@ -139,3 +142,55 @@ struct flock64 # define FNONBLOCK O_NONBLOCK # define FNDELAY O_NDELAY #endif /* Use BSD. */ + +/* Advise to `posix_fadvise'. */ +#ifdef __USE_XOPEN2K +# define POSIX_FADV_NORMAL 0 /* No further special treatment. */ +# define POSIX_FADV_RANDOM 1 /* Expect random page references. */ +# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */ +# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */ +# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */ +# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ +#endif + +#ifdef __USE_GNU +# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages + in the range before performing the + write. */ +# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those + dirty pages in the range which are + not presently under writeback. */ +# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in + the range after performing the + write. */ +#endif + +__BEGIN_DECLS + +#if 0 /*def __USE_GNU*/ + +/* Provide kernel hint to read ahead. */ +extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) + __THROW; + + +/* Selective file content synch'ing. */ +extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, + unsigned int __flags); + + +/* Splice address range into a pipe. */ +extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count, + unsigned int __flags); + +/* Splice two files together. */ +extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags) + __THROW; + +/* In-kernel implementation of tee for pipe buffers. */ +extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags) + __THROW; + +#endif + +__END_DECLS diff --git a/libc/sysdeps/linux/vax/bits/syscalls.h b/libc/sysdeps/linux/vax/bits/syscalls.h index caa62118d..f80b40539 100644 --- a/libc/sysdeps/linux/vax/bits/syscalls.h +++ b/libc/sysdeps/linux/vax/bits/syscalls.h @@ -9,13 +9,11 @@ * programs. */ #include <bits/sysnum.h> -#ifndef __set_errno -# define __set_errno(val) (*__errno_location())=(val) -#endif +#ifndef __ASSEMBLER__ -#ifndef SYS_ify -# define SYS_ify(syscall_name) (__NR_##syscall_name) -#endif +#include <errno.h> + +#define SYS_ify(syscall_name) (__NR_##syscall_name) #undef _syscall_return #define _syscall_return(type) \ @@ -261,4 +259,5 @@ type name (type1 arg1, \ _syscall_return (type); \ } +#endif /* __ASSEMBLER__ */ #endif /* _BITS_SYSCALLS_H */ diff --git a/libc/sysdeps/linux/vax/brk.c b/libc/sysdeps/linux/vax/brk.c index c8105b639..47fd3e529 100644 --- a/libc/sysdeps/linux/vax/brk.c +++ b/libc/sysdeps/linux/vax/brk.c @@ -22,10 +22,7 @@ #include <sys/syscall.h> /* This must be initialized data because commons can't have aliases. */ -extern void *__curbrk; -libc_hidden_proto(__curbrk) -void *__curbrk = NULL; -libc_hidden_data_def(__curbrk) +void *__curbrk attribute_hidden = NULL; libc_hidden_proto(brk) int diff --git a/libc/sysdeps/linux/vax/clone.S b/libc/sysdeps/linux/vax/clone.S index 0e9331e64..086adc685 100644 --- a/libc/sysdeps/linux/vax/clone.S +++ b/libc/sysdeps/linux/vax/clone.S @@ -18,8 +18,6 @@ /* clone() is even more special than fork() as it mucks with stacks and invokes a function in the right context after its all over. */ -#include <features.h> -#include <bits/errno.h> #include <sys/syscall.h> #warning "This file contains a hardcoded constant for SYS_clone" diff --git a/libc/sysdeps/linux/x86_64/bits/fcntl.h b/libc/sysdeps/linux/x86_64/bits/fcntl.h index 712007c36..f69bcf60e 100644 --- a/libc/sysdeps/linux/x86_64/bits/fcntl.h +++ b/libc/sysdeps/linux/x86_64/bits/fcntl.h @@ -21,9 +21,12 @@ # error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead." #endif - #include <sys/types.h> #include <bits/wordsize.h> +#ifdef __USE_GNU +# include <bits/uio.h> +#endif + /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ @@ -194,16 +197,45 @@ struct flock64 # define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ #endif -/* Linux-specific operations for posix_fadvise. */ + #ifdef __USE_GNU -# define LINUX_FADV_ASYNC_WRITE 32 /* Start writeout on range. */ -# define LINUX_FADV_WRITE_WAIT 33 /* Wait upon writeout to range. */ +# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages + in the range before performing the + write. */ +# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those + dirty pages in the range which are + not presently under writeback. */ +# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in + the range after performing the + write. */ #endif __BEGIN_DECLS +#if 0 /*def __USE_GNU*/ + /* Provide kernel hint to read ahead. */ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) __THROW; + +/* Selective file content synch'ing. */ +extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, + unsigned int __flags); + + +/* Splice address range into a pipe. */ +extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count, + unsigned int __flags); + +/* Splice two files together. */ +extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags) + __THROW; + +/* In-kernel implementation of tee for pipe buffers. */ +extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags) + __THROW; + +#endif + __END_DECLS diff --git a/libc/sysdeps/linux/x86_64/bits/mathdef.h b/libc/sysdeps/linux/x86_64/bits/mathdef.h index 37665c209..b0567e4d4 100644 --- a/libc/sysdeps/linux/x86_64/bits/mathdef.h +++ b/libc/sysdeps/linux/x86_64/bits/mathdef.h @@ -23,14 +23,30 @@ #if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF # define _MATH_H_MATHDEF 1 +# include <bits/wordsize.h> + +# if __WORDSIZE == 64 || (defined __FLT_EVAL_METHOD__ && __FLT_EVAL_METHOD__ == 0) /* The x86-64 architecture computes values with the precission of the - used type. */ + used type. Similarly for -m32 -mfpmath=sse. */ typedef float float_t; /* `float' expressions are evaluated as `float'. */ typedef double double_t; /* `double' expressions are evaluated as `double'. */ +# else +/* The ix87 FPUs evaluate all values in the 80 bit floating-point format + which is also available for the user as `long double'. Therefore we + define: */ +typedef long double float_t; /* `float' expressions are evaluated as + `long double'. */ +typedef long double double_t; /* `double' expressions are evaluated as + `long double'. */ +# endif /* The values returned by `ilogb' for 0 and NaN respectively. */ # define FP_ILOGB0 (-2147483647 - 1) # define FP_ILOGBNAN (-2147483647 - 1) #endif /* ISO C99 */ + +#if !defined __NO_LONG_DOUBLE_MATH && !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ +# define __NO_LONG_DOUBLE_MATH 1 +#endif diff --git a/libc/sysdeps/linux/x86_64/bits/mman.h b/libc/sysdeps/linux/x86_64/bits/mman.h index 880390055..535c9edcf 100644 --- a/libc/sysdeps/linux/x86_64/bits/mman.h +++ b/libc/sysdeps/linux/x86_64/bits/mman.h @@ -89,7 +89,7 @@ # 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. */ -# define MADV_REMOVE 5 /* Remove these pages and resources. */ +# define MADV_REMOVE 9 /* Remove these pages and resources. */ # define MADV_DONTFORK 10 /* Do not inherit across fork. */ # define MADV_DOFORK 11 /* Do inherit across fork. */ #endif diff --git a/libc/sysdeps/linux/x86_64/bits/stat.h b/libc/sysdeps/linux/x86_64/bits/stat.h index ddc292a34..3a9c7740a 100644 --- a/libc/sysdeps/linux/x86_64/bits/stat.h +++ b/libc/sysdeps/linux/x86_64/bits/stat.h @@ -78,12 +78,27 @@ struct stat #else __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ #endif +#if 0 /*def __USE_MISC*/ + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the <sys/stat.h> header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +#else __time_t st_atime; /* Time of last access. */ unsigned long int st_atimensec; /* Nscecs of last access. */ __time_t st_mtime; /* Time of last modification. */ unsigned long int st_mtimensec; /* Nsecs of last modification. */ __time_t st_ctime; /* Time of last status change. */ unsigned long int st_ctimensec; /* Nsecs of last status change. */ +#endif #if __WORDSIZE == 64 long int __unused[3]; #else @@ -124,12 +139,27 @@ struct stat64 #endif __blksize_t st_blksize; /* Optimal block size for I/O. */ __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */ +#if 0 /*def __USE_MISC*/ + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the <sys/stat.h> header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +#else __time_t st_atime; /* Time of last access. */ unsigned long int st_atimensec; /* Nscecs of last access. */ __time_t st_mtime; /* Time of last modification. */ unsigned long int st_mtimensec; /* Nsecs of last modification. */ __time_t st_ctime; /* Time of last status change. */ unsigned long int st_ctimensec; /* Nsecs of last status change. */ +#endif #if __WORDSIZE == 64 long int __unused[3]; #else diff --git a/libc/sysdeps/linux/x86_64/bits/syscalls.h b/libc/sysdeps/linux/x86_64/bits/syscalls.h index d44f637ac..afd97c0b0 100644 --- a/libc/sysdeps/linux/x86_64/bits/syscalls.h +++ b/libc/sysdeps/linux/x86_64/bits/syscalls.h @@ -9,10 +9,6 @@ * programs. */ #include <bits/sysnum.h> -#ifndef __set_errno -# define __set_errno(val) (*__errno_location ()) = (val) -#endif - /* Some of the sneaky macros in the code were taken from glibc-2.2.5/sysdeps/unix/sysv/linux/x86_64/sysdep.h @@ -20,6 +16,10 @@ #ifndef __ASSEMBLER__ +#include <errno.h> + +#define SYS_ify(syscall_name) (__NR_##syscall_name) + #undef _syscall0 #define _syscall0(type,name) \ type name(void) \ diff --git a/libc/sysdeps/linux/x86_64/brk.c b/libc/sysdeps/linux/x86_64/brk.c index 09d911066..22f006d7e 100644 --- a/libc/sysdeps/linux/x86_64/brk.c +++ b/libc/sysdeps/linux/x86_64/brk.c @@ -21,11 +21,10 @@ #include <unistd.h> #include <sys/syscall.h> -libc_hidden_proto(brk) - /* This must be initialized data because commons can't have aliases. */ -void *__curbrk = 0; +void *__curbrk attribute_hidden = 0; +libc_hidden_proto(brk) int brk (void *addr) { void *__unbounded newbrk; diff --git a/libc/sysdeps/linux/x86_64/bsd-_setjmp.S b/libc/sysdeps/linux/x86_64/bsd-_setjmp.S index 91c587988..d5f9ae1b8 100644 --- a/libc/sysdeps/linux/x86_64/bsd-_setjmp.S +++ b/libc/sysdeps/linux/x86_64/bsd-_setjmp.S @@ -21,10 +21,6 @@ We cannot do it in C because it must be a tail-call, so frame-unwinding in setjmp doesn't clobber the state restored by longjmp. */ -#define _ASM -#define _SETJMP_H -#include <bits/setjmp.h> - .global _setjmp .type _setjmp,%function .align 16 diff --git a/libc/sysdeps/linux/x86_64/clone.S b/libc/sysdeps/linux/x86_64/clone.S index 2dc9a502c..b93c2d9a4 100644 --- a/libc/sysdeps/linux/x86_64/clone.S +++ b/libc/sysdeps/linux/x86_64/clone.S @@ -23,8 +23,9 @@ #define _ERRNO_H 1 #include <bits/errno.h> #include <sys/syscall.h> -#define _SCHED_H -#include <bits/sched.h> + +#define CLONE_VM 0x00000100 +#define CLONE_THREAD 0x00010000 /* The userland implementation is: int clone (int (*fn)(void *arg), void *child_stack, int flags, void *arg), diff --git a/libc/sysdeps/linux/x86_64/fpu_control.h b/libc/sysdeps/linux/x86_64/fpu_control.h index 3eae48e0d..6e9b3b362 100644 --- a/libc/sysdeps/linux/x86_64/fpu_control.h +++ b/libc/sysdeps/linux/x86_64/fpu_control.h @@ -95,7 +95,9 @@ typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__))); #define _FPU_GETCW(cw) __asm__ ("fnstcw %0" : "=m" (*&cw)) #define _FPU_SETCW(cw) __asm__ ("fldcw %0" : : "m" (*&cw)) +#if 0 /* Default control word set at startup. */ extern fpu_control_t __fpu_control; +#endif #endif /* fpu_control.h */ |
