diff options
Diffstat (limited to 'libc/ports/sysdeps/unix/sysv')
23 files changed, 409 insertions, 1372 deletions
diff --git a/libc/ports/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h b/libc/ports/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h index 4c5507114..2d5f20b46 100644 --- a/libc/ports/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h +++ b/libc/ports/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h @@ -20,18 +20,6 @@ # 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 01000 /* not fcntl */ #define O_TRUNC 02000 /* not fcntl */ #define O_EXCL 04000 /* not fcntl */ @@ -39,41 +27,21 @@ #define O_NONBLOCK 00004 #define O_APPEND 00010 -#define O_NDELAY O_NONBLOCK #define O_SYNC 020040000 -#define O_FSYNC O_SYNC -#define O_ASYNC 020000 /* fcntl, for BSD compatibility */ -#ifdef __USE_XOPEN2K8 -# define O_DIRECTORY 0100000 /* Must be a directory. */ -# define O_NOFOLLOW 0200000 /* Do not follow links. */ -# define O_CLOEXEC 010000000 /* Set close_on_exec. */ -#endif -#ifdef __USE_GNU -# define O_DIRECT 02000000 /* Direct disk access. */ -# define O_NOATIME 04000000 /* Do not set atime. */ -# define O_PATH 040000000 /* Resolve pathname but do not open file. */ -#endif +#define __O_DIRECTORY 0100000 /* Must be a directory. */ +#define __O_NOFOLLOW 0200000 /* Do not follow links. */ +#define __O_CLOEXEC 010000000 /* Set close_on_exec. */ + +#define __O_DIRECT 02000000 /* Direct disk access. */ +#define __O_NOATIME 04000000 /* Do not set atime. */ +#define __O_PATH 040000000 /* Resolve pathname but do not open file. */ -#ifdef __USE_LARGEFILE64 /* Not necessary, files are always with 64bit off_t. */ -# define O_LARGEFILE 0 -#endif +#define __O_LARGEFILE 0 -/* For now Linux has synchronisity options for data and read operations. - We define the symbols here but let them do the same as O_SYNC since - this is a superset. */ -#if defined __USE_POSIX199309 || defined __USE_UNIX98 -# define O_DSYNC 040000 /* Synchronize data. */ -# define O_RSYNC O_SYNC /* Synchronize read operations. */ -#endif +#define __O_DSYNC 040000 /* Synchronize data. */ -/* 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. */ #define F_GETLK 7 /* Get record locking info. */ #define F_SETLK 8 /* Set record locking info (non-blocking). */ #define F_SETLKW 9 /* Set record locking info (blocking). */ @@ -81,32 +49,8 @@ #define F_SETLK64 F_SETLK /* Set record locking info (non-blocking). */ #define F_SETLKW64 F_SETLKW /* Set record locking info (blocking). */ -#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K8 -# define F_SETOWN 5 /* Get owner of socket (receiver of SIGIO). */ -# define F_GETOWN 6 /* Set owner of socket (receiver of SIGIO). */ -#endif - -#ifdef __USE_GNU -# define F_SETSIG 10 /* Set number of signal to be sent. */ -# define F_GETSIG 11 /* Get number of signal to be sent. */ -# define F_SETOWN_EX 15 /* Get owner (thread receiving SIGIO). */ -# define F_GETOWN_EX 16 /* Set owner (thread receiving SIGIO). */ -#endif - -#ifdef __USE_GNU -# define F_SETLEASE 1024 /* Set a lease. */ -# define F_GETLEASE 1025 /* Enquire what lease is active. */ -# define F_NOTIFY 1026 /* Request notfications on a directory. */ -# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */ -# define F_GETPIPE_SZ 1032 /* Set pipe page size array. */ -#endif -#ifdef __USE_XOPEN2K8 -# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with - close-on-exit set. */ -#endif - -/* for F_[GET|SET]FD */ -#define FD_CLOEXEC 1 /* actually anything with low bit set goes */ +#define __F_SETOWN 5 /* Get owner of socket (receiver of SIGIO). */ +#define __F_GETOWN 6 /* Set owner of socket (receiver of SIGIO). */ /* For posix fcntl() and `l_type' field of a `struct flock' for lockf() */ #define F_RDLCK 1 /* Read lock. */ @@ -117,33 +61,6 @@ #define F_EXLCK 16 /* or 3 */ #define F_SHLCK 32 /* or 4 */ -/* Operations for bsd flock(), also used by the kernel implementation */ -#ifdef __USE_BSD -# 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 - blocking */ -# define LOCK_UN 8 /* remove lock */ -#endif - -#ifdef __USE_GNU -# define LOCK_MAND 32 /* This is a mandatory flock: */ -# define LOCK_READ 64 /* ... which allows concurrent read operations. */ -# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */ -# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */ -#endif - -#ifdef __USE_GNU -/* Types of directory notifications that may be requested with F_NOTIFY. */ -# define DN_ACCESS 0x00000001 /* File accessed. */ -# define DN_MODIFY 0x00000002 /* File modified. */ -# define DN_CREATE 0x00000004 /* File created. */ -# define DN_DELETE 0x00000008 /* File removed. */ -# define DN_RENAME 0x00000010 /* File renamed. */ -# define DN_ATTRIB 0x00000020 /* File changed attibutes. */ -# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */ -#endif - /* We don't need to support __USE_FILE_OFFSET64. */ struct flock { @@ -165,137 +82,5 @@ struct flock64 }; #endif -#ifdef __USE_GNU -/* Owner types. */ -enum __pid_type - { - F_OWNER_TID = 0, /* Kernel thread. */ - F_OWNER_PID, /* Process. */ - F_OWNER_PGRP, /* Process group. */ - F_OWNER_GID = F_OWNER_PGRP /* Alternative, obsolete name. */ - }; - -/* Structure to use with F_GETOWN_EX and F_SETOWN_EX. */ -struct f_owner_ex - { - enum __pid_type type; /* Owner type of ID. */ - __pid_t pid; /* ID of owner. */ - }; -#endif - -/* Define some more compatibility macros to be backward compatible with - BSD systems which did not managed to hide these kernel macros. */ -#ifdef __USE_BSD -# define FAPPEND O_APPEND -# define FFSYNC O_FSYNC -# define FASYNC O_ASYNC -# 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 -/* 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. */ - -/* File handle structure. */ -struct file_handle -{ - unsigned int handle_bytes; - int handle_type; - /* File identifier. */ - unsigned char f_handle[0]; -}; - -/* Maximum handle size (for now). */ -# define MAX_HANDLE_SZ 128 -#endif - -__BEGIN_DECLS - -#ifdef __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 __offset, __off64_t __count, - unsigned int __flags); - - -/* Splice address range into a pipe. */ -extern ssize_t vmsplice (int __fdout, const struct iovec *__iov, - size_t __count, unsigned int __flags); - -/* Splice two files together. */ -extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout, - __off64_t *__offout, size_t __len, - unsigned int __flags); - -/* In-kernel implementation of tee for pipe buffers. */ -extern ssize_t tee (int __fdin, int __fdout, size_t __len, - unsigned int __flags); - -/* Reserve storage for the data of the file associated with FD. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -# ifndef __USE_FILE_OFFSET64 -extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len); -# else -# ifdef __REDIRECT -extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset, - __off64_t __len), - fallocate64); -# else -# define fallocate fallocate64 -# endif -# endif -# ifdef __USE_LARGEFILE64 -extern int fallocate64 (int __fd, int __mode, __off64_t __offset, - __off64_t __len); -# endif - -/* Map file name to file handle. */ -extern int name_to_handle_at (int __dfd, const char *__name, - struct file_handle *__handle, int *__mnt_id, - int __flags) __THROW; - -/* Open file using the file handle. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -extern int open_by_handle_at (int __mountdirfd, struct file_handle *__handle, - int __flags); - -#endif - -__END_DECLS +/* Include generic Linux declarations. */ +#include <bits/fcntl-linux.h> diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h b/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h index 5811361e3..9d1218273 100644 --- a/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h +++ b/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. +/* Copyright (C) 2005-2012 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 @@ -86,6 +86,18 @@ __ret; \ }) +#define lll_futex_timed_wait_bitset(futexp, val, timespec, clockbit, private) \ + ({ \ + INTERNAL_SYSCALL_DECL (__err); \ + long int __ret; \ + int __op = FUTEX_WAIT_BITSET | clockbit; \ + __ret = INTERNAL_SYSCALL (futex, __err, 6, (futexp), \ + __lll_private_flag (__op, private), \ + (val), (timespec), NULL /* Unused. */, \ + FUTEX_BITSET_MATCH_ANY); \ + __ret; \ + }) + #define lll_futex_wake(futexp, nr, private) \ ({ \ INTERNAL_SYSCALL_DECL (__err); \ diff --git a/libc/ports/sysdeps/unix/sysv/linux/generic/bits/fcntl.h b/libc/ports/sysdeps/unix/sysv/linux/generic/bits/fcntl.h index a8f20bd0b..56a914b7e 100644 --- a/libc/ports/sysdeps/unix/sysv/linux/generic/bits/fcntl.h +++ b/libc/ports/sysdeps/unix/sysv/linux/generic/bits/fcntl.h @@ -1,5 +1,5 @@ /* O_*, F_*, FD_* bit values for the generic Linux ABI. - Copyright (C) 2011 Free Software Foundation, Inc. + Copyright (C) 2011-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011. @@ -21,147 +21,10 @@ # 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 a few file systems. */ -#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 04010000 -#define O_FSYNC O_SYNC -#define O_ASYNC 020000 -#ifdef __USE_XOPEN2K8 -# define O_DIRECTORY 0200000 /* Must be a directory. */ -# define O_NOFOLLOW 0400000 /* Do not follow links. */ -# define O_CLOEXEC 02000000 /* Set close_on_exec. */ -#endif -#ifdef __USE_GNU -# define O_DIRECT 040000 /* Direct disk access. */ -# define O_NOATIME 01000000 /* Do not set atime. */ -# define O_PATH 010000000 /* Resolve pathname but do not open file. */ -#endif - -/* For now Linux has synchronisity options for data and read operations. - We define the symbols here but let them do the same as O_SYNC since - this is a superset. */ -#if defined __USE_POSIX199309 || defined __USE_UNIX98 -# define O_DSYNC 010000 /* Synchronize data. */ -# define O_RSYNC O_SYNC /* Synchronize read operations. */ -#endif - -#ifdef __USE_LARGEFILE64 -# if __WORDSIZE == 64 -# define O_LARGEFILE 0 -# else -# define O_LARGEFILE 0100000 -# endif -#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. */ #if __WORDSIZE == 64 -# define F_GETLK 5 /* Get record locking info. */ -# define F_SETLK 6 /* Set record locking info (non-blocking). */ -# define F_SETLKW 7 /* Set record locking info (blocking). */ -/* Not necessary, we always have 64-bit offsets. */ -# define F_GETLK64 5 /* Get record locking info. */ -# define F_SETLK64 6 /* Set record locking info (non-blocking). */ -# define F_SETLKW64 7 /* Set record locking info (blocking). */ -#else -# ifndef __USE_FILE_OFFSET64 -# define F_GETLK 5 /* Get record locking info. */ -# define F_SETLK 6 /* Set record locking info (non-blocking). */ -# define F_SETLKW 7 /* Set record locking info (blocking). */ -# else -# define F_GETLK F_GETLK64 /* Get record locking info. */ -# 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 12 /* Get record locking info. */ -# define F_SETLK64 13 /* Set record locking info (non-blocking). */ -# define F_SETLKW64 14 /* Set record locking info (blocking). */ -#endif - -#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K8 -# define F_SETOWN 8 /* Get owner (process receiving SIGIO). */ -# define F_GETOWN 9 /* Set owner (process receiving SIGIO). */ -#endif - -#ifdef __USE_GNU -# define F_SETSIG 10 /* Set number of signal to be sent. */ -# define F_GETSIG 11 /* Get number of signal to be sent. */ -# define F_SETOWN_EX 15 /* Get owner (thread receiving SIGIO). */ -# define F_GETOWN_EX 16 /* Set owner (thread receiving SIGIO). */ -#endif - -#ifdef __USE_GNU -# define F_SETLEASE 1024 /* Set a lease. */ -# define F_GETLEASE 1025 /* Enquire what lease is active. */ -# define F_NOTIFY 1026 /* Request notfications on a directory. */ -# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */ -# define F_GETPIPE_SZ 1032 /* Set pipe page size array. */ -#endif -#ifdef __USE_XOPEN2K8 -# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with - close-on-exit set. */ -#endif - -/* For F_[GET|SET]FD. */ -#define FD_CLOEXEC 1 /* actually anything with low bit set goes */ - -/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */ -#define F_RDLCK 0 /* Read lock. */ -#define F_WRLCK 1 /* Write lock. */ -#define F_UNLCK 2 /* Remove lock. */ - -/* 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. */ -# 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 - blocking */ -# define LOCK_UN 8 /* remove lock */ -#endif - -#ifdef __USE_GNU -# define LOCK_MAND 32 /* This is a mandatory flock: */ -# define LOCK_READ 64 /* ... which allows concurrent read operations. */ -# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */ -# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */ -#endif - -#ifdef __USE_GNU -/* Types of directory notifications that may be requested with F_NOTIFY. */ -# define DN_ACCESS 0x00000001 /* File accessed. */ -# define DN_MODIFY 0x00000002 /* File modified. */ -# define DN_CREATE 0x00000004 /* File created. */ -# define DN_DELETE 0x00000008 /* File removed. */ -# define DN_RENAME 0x00000010 /* File renamed. */ -# define DN_ATTRIB 0x00000020 /* File changed attibutes. */ -# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */ +# define __O_LARGEFILE 0 #endif struct flock @@ -189,151 +52,5 @@ struct flock64 }; #endif -#ifdef __USE_GNU -/* Owner types. */ -enum __pid_type - { - F_OWNER_TID = 0, /* Kernel thread. */ - F_OWNER_PID, /* Process. */ - F_OWNER_PGRP, /* Process group. */ - F_OWNER_GID = F_OWNER_PGRP /* Alternative, obsolete name. */ - }; - -/* Structure to use with F_GETOWN_EX and F_SETOWN_EX. */ -struct f_owner_ex - { - enum __pid_type type; /* Owner type of ID. */ - __pid_t pid; /* ID of owner. */ - }; -#endif - -/* Define some more compatibility macros to be backward compatible with - BSD systems which did not managed to hide these kernel macros. */ -#ifdef __USE_BSD -# define FAPPEND O_APPEND -# define FFSYNC O_FSYNC -# define FASYNC O_ASYNC -# 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 -/* 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. */ - - -/* File handle structure. */ -struct file_handle -{ - unsigned int handle_bytes; - int handle_type; - /* File identifier. */ - unsigned char f_handle[0]; -}; - -/* Maximum handle size (for now). */ -# define MAX_HANDLE_SZ 128 -#endif - -__BEGIN_DECLS - -#ifdef __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. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -extern int sync_file_range (int __fd, __off64_t __offset, __off64_t __count, - unsigned int __flags); - - -/* Splice address range into a pipe. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -extern ssize_t vmsplice (int __fdout, const struct iovec *__iov, - size_t __count, unsigned int __flags); - -/* Splice two files together. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout, - __off64_t *__offout, size_t __len, - unsigned int __flags); - -/* In-kernel implementation of tee for pipe buffers. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -extern ssize_t tee (int __fdin, int __fdout, size_t __len, - unsigned int __flags); - -/* Reserve storage for the data of the file associated with FD. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -# ifndef __USE_FILE_OFFSET64 -extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len); -# else -# ifdef __REDIRECT -extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset, - __off64_t __len), - fallocate64); -# else -# define fallocate fallocate64 -# endif -# endif -# ifdef __USE_LARGEFILE64 -extern int fallocate64 (int __fd, int __mode, __off64_t __offset, - __off64_t __len); -# endif - - -/* Map file name to file handle. */ -extern int name_to_handle_at (int __dfd, const char *__name, - struct file_handle *__handle, int *__mnt_id, - int __flags) __THROW; - -/* Open file using the file handle. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -extern int open_by_handle_at (int __mountdirfd, struct file_handle *__handle, - int __flags); - -#endif /* use GNU */ - -__END_DECLS +/* Include generic Linux declarations. */ +#include <bits/fcntl-linux.h> diff --git a/libc/ports/sysdeps/unix/sysv/linux/generic/sysctl.c b/libc/ports/sysdeps/unix/sysv/linux/generic/sysctl.c index 0bdb78660..0212e1a8a 100644 --- a/libc/ports/sysdeps/unix/sysv/linux/generic/sysctl.c +++ b/libc/ports/sysdeps/unix/sysv/linux/generic/sysctl.c @@ -30,4 +30,3 @@ sysctl (int *name, int nlen, void *oldval, size_t *oldlenp, return -1; } stub_warning (sysctl) -#include <stub-tag.h> diff --git a/libc/ports/sysdeps/unix/sysv/linux/generic/ustat.c b/libc/ports/sysdeps/unix/sysv/linux/generic/ustat.c index 7611e82f0..d6a23090c 100644 --- a/libc/ports/sysdeps/unix/sysv/linux/generic/ustat.c +++ b/libc/ports/sysdeps/unix/sysv/linux/generic/ustat.c @@ -30,4 +30,3 @@ ustat (dev_t dev, struct ustat *ubuf) return -1; } stub_warning (ustat) -#include <stub-tag.h> diff --git a/libc/ports/sysdeps/unix/sysv/linux/hppa/bits/fcntl.h b/libc/ports/sysdeps/unix/sysv/linux/hppa/bits/fcntl.h index c0e949eea..47a7ed285 100644 --- a/libc/ports/sysdeps/unix/sysv/linux/hppa/bits/fcntl.h +++ b/libc/ports/sysdeps/unix/sysv/linux/hppa/bits/fcntl.h @@ -1,6 +1,5 @@ /* O_*, F_*, FD_* bit values for Linux. - Copyright (C) 1995-1999, 2000, 2002, 2004, 2010, 2011 - Free Software Foundation, Inc. + Copyright (C) 1995-2012 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 @@ -21,134 +20,41 @@ # 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 a few file systems. */ -#define O_ACCMODE 0003 -#define O_RDONLY 00 -#define O_WRONLY 01 -#define O_RDWR 02 #define O_CREAT 00000400 /* not fcntl */ #define O_EXCL 00002000 /* not fcntl */ #define O_NOCTTY 00400000 /* not fcntl */ -#define O_TRUNC 00001000 /* not fcntl */ #define O_APPEND 00000010 #define O_NONBLOCK 00200004 /* HPUX has separate NDELAY & NONBLOCK */ -#define O_NDELAY O_NONBLOCK -#define O_SYNC 00100000 -#define O_FSYNC O_SYNC -#define O_ASYNC 020000 -#define O_BLKSEEK 00000100 /* HPUX only */ +#define __O_DSYNC 01000000 +#define __O_RSYNC 02000000 /* HPUX only */ +#define __O_SYNC 01000000 +#define O_SYNC (__O_SYNC|__O_DSYNC) -#ifdef __USE_XOPEN2K8 -# define O_DIRECTORY 000010000 /* Must be a directory. */ -# define O_NOFOLLOW 000000200 /* Do not follow links. */ -# define O_CLOEXEC 010000000 /* Set close_on_exec. */ -#endif -#ifdef __USE_GNU -# define O_DIRECT 040000 /* Direct disk access. */ -# define O_NOATIME 004000000 /* Do not set atime. */ -#endif +#define O_BLKSEEK 00000100 /* HPUX only */ -/* For now Linux has synchronisity options for data and read operations. - We define the symbols here but let them do the same as O_SYNC since - this is a superset. */ -#if defined __USE_POSIX199309 || defined __USE_UNIX98 -# define O_DSYNC 01000000 /* HPUX only */ -# define O_RSYNC 02000000 /* HPUX only */ -#endif +#define __O_DIRECTORY 000010000 /* Must be a directory. */ +#define __O_NOFOLLOW 000000200 /* Do not follow links. */ +#define __O_CLOEXEC 010000000 /* Set close_on_exec. */ +#define __O_NOATIME 004000000 /* Do not set atime. */ +#define __O_PATH 020000000 -#ifdef __USE_LARGEFILE64 -# define O_LARGEFILE 00004000 -#endif +#define __O_LARGEFILE 00004000 -/* 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). */ -# define F_SETLKW 7 /* Set record locking info (blocking). */ -#else -# define F_GETLK F_GETLK64 /* Get record locking info. */ -# 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). */ -#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K8 -# define F_GETOWN 11 /* Get owner of socket (receiver of SIGIO). */ -# define F_SETOWN 12 /* Set owner of socket (receiver of SIGIO). */ -#endif - -#ifdef __USE_GNU -# define F_SETSIG 13 /* Set number of signal to be sent. */ -# define F_GETSIG 14 /* Get number of signal to be sent. */ -# define F_SETOWN_EX 15 /* Get owner (thread receiving SIGIO). */ -# define F_GETOWN_EX 16 /* Set owner (thread receiving SIGIO). */ -#endif - -#ifdef __USE_GNU -# define F_SETLEASE 1024 /* Set a lease. */ -# define F_GETLEASE 1025 /* Enquire what lease is active. */ -# define F_NOTIFY 1026 /* Request notfications on a directory. */ -# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */ -# define F_GETPIPE_SZ 1032 /* Set pipe page size array. */ -#endif -#ifdef __USE_XOPEN2K8 -# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with - close-on-exit set. */ -#endif +#define __F_GETOWN 11 /* Get owner of socket (receiver of SIGIO). */ +#define __F_SETOWN 12 /* Set owner of socket (receiver of SIGIO). */ -/* For F_[GET|SET]FD. */ -#define FD_CLOEXEC 1 /* actually anything with low bit set goes */ +#define __F_SETSIG 13 /* Set number of signal to be sent. */ +#define __F_GETSIG 14 /* Get number of signal to be sent. */ /* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */ #define F_RDLCK 1 /* Read lock. */ #define F_WRLCK 2 /* Write lock. */ #define F_UNLCK 3 /* Remove lock. */ -/* 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. */ -# 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 - blocking */ -# define LOCK_UN 8 /* remove lock */ -#endif - -#ifdef __USE_GNU -# define LOCK_MAND 32 /* This is a mandatory flock: */ -# define LOCK_READ 64 /* ... which allows concurrent read operations. */ -# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */ -# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */ -#endif - -#ifdef __USE_GNU -/* Types of directory notifications that may be requested with F_NOTIFY. */ -# define DN_ACCESS 0x00000001 /* File accessed. */ -# define DN_MODIFY 0x00000002 /* File modified. */ -# define DN_CREATE 0x00000004 /* File created. */ -# define DN_DELETE 0x00000008 /* File removed. */ -# define DN_RENAME 0x00000010 /* File renamed. */ -# define DN_ATTRIB 0x00000020 /* File changed attibutes. */ -# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */ -#endif - struct flock { short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ @@ -174,148 +80,5 @@ struct flock64 }; #endif -#ifdef __USE_GNU -/* Owner types. */ -enum __pid_type - { - F_OWNER_TID = 0, /* Kernel thread. */ - F_OWNER_PID, /* Process. */ - F_OWNER_PGRP, /* Process group. */ - F_OWNER_GID = F_OWNER_PGRP /* Alternative, obsolete name. */ - }; - -/* Structure to use with F_GETOWN_EX and F_SETOWN_EX. */ -struct f_owner_ex - { - enum __pid_type type; /* Owner type of ID. */ - __pid_t pid; /* ID of owner. */ - }; -#endif - -/* Define some more compatibility macros to be backward compatible with - BSD systems which did not managed to hide these kernel macros. */ -#ifdef __USE_BSD -# define FAPPEND O_APPEND -# define FFSYNC O_FSYNC -# define FASYNC O_ASYNC -# 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 -/* 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. */ - - -/* File handle structure. */ -struct file_handle -{ - unsigned int handle_bytes; - int handle_type; - /* File identifier. */ - unsigned char f_handle[0]; -}; - -/* Maximum handle size (for now). */ -# define MAX_HANDLE_SZ 128 -#endif - -__BEGIN_DECLS - -#ifdef __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 __offset, __off64_t __count, - unsigned int __flags); - - -/* Splice address range into a pipe. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -extern ssize_t vmsplice (int __fdout, const struct iovec *__iov, - size_t __count, unsigned int __flags); - -/* Splice two files together. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout, - __off64_t *__offout, size_t __len, - unsigned int __flags); - -/* In-kernel implementation of tee for pipe buffers. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -extern ssize_t tee (int __fdin, int __fdout, size_t __len, - unsigned int __flags); - -/* Reserve storage for the data of the file associated with FD. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -# ifndef __USE_FILE_OFFSET64 -extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len); -# else -# ifdef __REDIRECT -extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset, - __off64_t __len), - fallocate64); -# else -# define fallocate fallocate64 -# endif -# endif -# ifdef __USE_LARGEFILE64 -extern int fallocate64 (int __fd, int __mode, __off64_t __offset, - __off64_t __len); -# endif - - -/* Map file name to file handle. */ -extern int name_to_handle_at (int __dfd, const char *__name, - struct file_handle *__handle, int *__mnt_id, - int __flags) __THROW; - -/* Open file using the file handle. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -extern int open_by_handle_at (int __mountdirfd, struct file_handle *__handle, - int __flags); - -#endif - -__END_DECLS +/* Include generic Linux declarations. */ +#include <bits/fcntl-linux.h> diff --git a/libc/ports/sysdeps/unix/sysv/linux/hppa/sysdep.h b/libc/ports/sysdeps/unix/sysv/linux/hppa/sysdep.h index 83dd599c6..1825d315b 100644 --- a/libc/ports/sysdeps/unix/sysv/linux/hppa/sysdep.h +++ b/libc/ports/sysdeps/unix/sysv/linux/hppa/sysdep.h @@ -1,6 +1,5 @@ /* Assembler macros for PA-RISC. - Copyright (C) 1999, 2001, 2002, 2003, 2007 - Free Software Foundation, Inc. + Copyright (C) 1999-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper, <drepper@cygnus.com>, August 1999. Linux/PA-RISC changes by Philipp Rumpf, <prumpf@tux.org>, March 2000. @@ -21,7 +20,6 @@ #include <asm/unistd.h> #include <sysdeps/generic/sysdep.h> -#include <sys/syscall.h> /* In order to get __set_errno() definition in INLINE_SYSCALL. */ #ifndef __ASSEMBLER__ @@ -29,37 +27,33 @@ #endif #undef ASM_LINE_SEP -#define ASM_LINE_SEP ! +#define ASM_LINE_SEP ! #undef SYS_ify #define SYS_ify(syscall_name) (__NR_##syscall_name) -/* WARNING: TREG must be a callee saves register so - that it doesn't have to be restored after a call +/* The vfork, fork, and clone syscalls clobber r19 + * and r21. We list r21 as either clobbered or as an + * input to a 6-argument syscall. We must save and + * restore r19 in both PIC and non-PIC cases. + */ +/* WARNING: TREG must be a callee saves register so + that it doesn't have to be restored after a call to another function */ -#ifdef PIC -# define TREG %r3 -# define SAVE_PIC(SREG) copy %r19, SREG ASM_LINE_SEP -# define LOAD_PIC(LREG) copy LREG, %r19 ASM_LINE_SEP +#define TREG 4 +#define SAVE_PIC(SREG) \ + copy %r19, SREG ASM_LINE_SEP \ + .cfi_register 19, SREG +#define LOAD_PIC(LREG) \ + copy LREG , %r19 ASM_LINE_SEP \ + .cfi_restore 19 /* Inline assembly defines */ -# define TREG_ASM "%r4" /* Cant clobber r3, it holds framemarker */ -# define SAVE_ASM_PIC " copy %%r19, %" TREG_ASM "\n" -# define LOAD_ASM_PIC " copy %" TREG_ASM ", %%r19\n" -# define CLOB_TREG TREG_ASM , -# define PIC_REG_DEF register unsigned long __r19 asm("r19"); -# define PIC_REG_USE , "r" (__r19) -#else -# define TREG %r3 -# define SAVE_PIC(SREG) nop ASM_LINE_SEP -# define LOAD_PIC(LREG) nop ASM_LINE_SEP -/* Inline assembly defines */ -# define TREG_ASM -# define SAVE_ASM_PIC "nop \n" -# define LOAD_ASM_PIC "nop \n" -# define CLOB_TREG -# define PIC_REG_DEF -# define PIC_REG_USE -#endif +#define TREG_ASM "%r4" /* Cant clobber r3, it holds framemarker */ +#define SAVE_ASM_PIC " copy %%r19, %" TREG_ASM "\n" +#define LOAD_ASM_PIC " copy %" TREG_ASM ", %%r19\n" +#define CLOB_TREG TREG_ASM , +#define PIC_REG_DEF register unsigned long __r19 asm("r19"); +#define PIC_REG_USE , "r" (__r19) #ifdef __ASSEMBLER__ @@ -126,12 +120,14 @@ .align ALIGNARG(4) ASM_LINE_SEP \ .export C_SYMBOL_NAME(name) ASM_LINE_SEP \ .type C_SYMBOL_NAME(name),@function ASM_LINE_SEP \ + cfi_startproc ASM_LINE_SEP \ C_LABEL(name) ASM_LINE_SEP \ .PROC ASM_LINE_SEP \ .CALLINFO FRAME=64,CALLS,SAVE_RP,ENTRY_GR=3 ASM_LINE_SEP \ .ENTRY ASM_LINE_SEP \ /* SAVE_RP says we do */ ASM_LINE_SEP \ stw %rp, -20(%sr0,%sp) ASM_LINE_SEP \ + .cfi_offset 2, -20 ASM_LINE_SEP \ /*FIXME: Call mcount? (carefull with stack!) */ /* Some syscall wrappers do not call other functions, and @@ -141,22 +137,25 @@ .align ALIGNARG(4) ASM_LINE_SEP \ .export C_SYMBOL_NAME(name) ASM_LINE_SEP \ .type C_SYMBOL_NAME(name),@function ASM_LINE_SEP \ + cfi_startproc ASM_LINE_SEP \ C_LABEL(name) ASM_LINE_SEP \ .PROC ASM_LINE_SEP \ .CALLINFO FRAME=64,NO_CALLS,SAVE_RP,ENTRY_GR=3 ASM_LINE_SEP \ .ENTRY ASM_LINE_SEP \ /* SAVE_RP says we do */ ASM_LINE_SEP \ stw %rp, -20(%sr0,%sp) ASM_LINE_SEP \ + .cfi_offset 2, -20 ASM_LINE_SEP \ /*FIXME: Call mcount? (carefull with stack!) */ #undef END #define END(name) \ .EXIT ASM_LINE_SEP \ .PROCEND ASM_LINE_SEP \ + cfi_endproc ASM_LINE_SEP \ .size C_SYMBOL_NAME(name), .-C_SYMBOL_NAME(name) ASM_LINE_SEP -/* If compiled for profiling, call `mcount' at the start - of each function. No, don't bother. gcc will put the +/* If compiled for profiling, call `mcount' at the start + of each function. No, don't bother. gcc will put the call in for us. */ #define CALL_MCOUNT /* Do nothing. */ @@ -169,9 +168,7 @@ which means ENTRY(name) DO_CALL(...) - nop - bv 0(2) - nop + bv,n 0(2) */ #define PSEUDO(name, syscall_name, args) \ @@ -179,8 +176,7 @@ /* If necc. load args from stack */ ASM_LINE_SEP \ DOARGS_##args ASM_LINE_SEP \ DO_CALL (syscall_name, args) ASM_LINE_SEP \ - UNDOARGS_##args ASM_LINE_SEP \ - nop ASM_LINE_SEP + UNDOARGS_##args ASM_LINE_SEP #define ret \ /* Return value set by ERRNO code */ ASM_LINE_SEP \ @@ -195,8 +191,7 @@ ENTRY_LEAF (name) ASM_LINE_SEP \ DOARGS_##args ASM_LINE_SEP \ DO_CALL_NOERRNO (syscall_name, args) ASM_LINE_SEP \ - UNDOARGS_##args ASM_LINE_SEP \ - nop ASM_LINE_SEP + UNDOARGS_##args ASM_LINE_SEP #define ret_NOERRNO ret @@ -210,8 +205,7 @@ ENTRY_LEAF (name) ASM_LINE_SEP \ DOARGS_##args ASM_LINE_SEP \ DO_CALL_ERRVAL (syscall_name, args) ASM_LINE_SEP \ - UNDOARGS_##args ASM_LINE_SEP \ - nop ASM_LINE_SEP + UNDOARGS_##args ASM_LINE_SEP #define ret_ERRVAL ret @@ -289,8 +283,12 @@ #define DO_CALL(syscall_name, args) \ /* Create a frame */ ASM_LINE_SEP \ stwm TREG, 64(%sp) ASM_LINE_SEP \ + .cfi_offset TREG, 0 ASM_LINE_SEP \ + .cfi_adjust_cfa_offset 64 ASM_LINE_SEP \ stw %sp, -4(%sp) ASM_LINE_SEP \ + .cfi_offset 30, -4 ASM_LINE_SEP \ stw %r19, -32(%sp) ASM_LINE_SEP \ + .cfi_offset 19, -32 ASM_LINE_SEP \ /* Save r19 */ ASM_LINE_SEP \ SAVE_PIC(TREG) ASM_LINE_SEP \ /* Do syscall, delay loads # */ ASM_LINE_SEP \ @@ -313,8 +311,10 @@ L(pre_end): ASM_LINE_SEP \ /* Restore our frame, restoring TREG */ ASM_LINE_SEP \ ldwm -64(%sp), TREG ASM_LINE_SEP \ + .cfi_adjust_cfa_offset -64 ASM_LINE_SEP \ /* Restore return pointer */ ASM_LINE_SEP \ - ldw -20(%sp),%rp ASM_LINE_SEP + ldw -20(%sp),%rp ASM_LINE_SEP \ + .cfi_restore 2 ASM_LINE_SEP /* We do nothing with the return, except hand it back to someone else */ #undef DO_CALL_NOERRNO @@ -386,13 +386,13 @@ L(pre_end): ASM_LINE_SEP \ /* INTERNAL_SYSCALL_DECL - Allows us to setup some function static value to use within the context of the syscall INTERNAL_SYSCALL_ERROR_P - Returns 0 if it wasn't an error, 1 otherwise - You are allowed to use the syscall result (val) and the DECL error + You are allowed to use the syscall result (val) and the DECL error variable to determine what went wrong. INTERLAL_SYSCALL_ERRNO - Munges the val/err pair into the error number. In our case we just flip the sign. */ #undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) +#define INTERNAL_SYSCALL_DECL(err) #undef INTERNAL_SYSCALL_ERROR_P #define INTERNAL_SYSCALL_ERROR_P(val, err) \ diff --git a/libc/ports/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h b/libc/ports/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h index 51965b710..990ae73bc 100644 --- a/libc/ports/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h +++ b/libc/ports/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h @@ -1,6 +1,5 @@ /* O_*, F_*, FD_* bit values for Linux/IA64. - Copyright (C) 1999, 2000, 2004, 2006, 2007, 2009, 2010, 2011 - Free Software Foundation, Inc. + Copyright (C) 1999-2012 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 @@ -21,132 +20,14 @@ # 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 a few file systems. */ -#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 04010000 -#define O_FSYNC O_SYNC -#define O_ASYNC 020000 - -#ifdef __USE_XOPEN2K8 -# define O_DIRECTORY 0200000 /* must be a directory */ -# define O_NOFOLLOW 0400000 /* don't follow links */ -# define O_CLOEXEC 02000000 /* Set close_on_exec. */ -#endif -#ifdef __USE_GNU -# define O_DIRECT 040000 -# define O_NOATIME 01000000 /* Do not set atime. */ -# define O_PATH 010000000 /* Resolve pathname but do not open file. */ -#endif - -#ifdef __USE_LARGEFILE64 /* Not necessary, files are always with 64bit off_t. */ -# define O_LARGEFILE 0 -#endif - -/* For now Linux has synchronisity options for data and read operations. - We define the symbols here but let them do the same as O_SYNC since - this is a superset. */ -#if defined __USE_POSIX199309 || defined __USE_UNIX98 -# define O_DSYNC 010000 /* Synchronize data. */ -# define O_RSYNC O_SYNC /* Synchronize read operations. */ -#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. */ -#define F_GETLK 5 /* Get record locking info. */ -#define F_SETLK 6 /* Set record locking info (non-blocking). */ -#define F_SETLKW 7 /* Set record locking info (blocking). */ +#define __O_LARGEFILE 0 /* Not necessary, we always have 64-bit offsets. */ #define F_GETLK64 5 /* Get record locking info. */ #define F_SETLK64 6 /* Set record locking info (non-blocking). */ #define F_SETLKW64 7 /* Set record locking info (blocking). */ -#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K8 -# define F_SETOWN 8 /* Get owner (process receiving SIGIO). */ -# define F_GETOWN 9 /* Set owner (process receiving SIGIO). */ -#endif - -#ifdef __USE_GNU -# define F_SETSIG 10 /* Set number of signal to be sent. */ -# define F_GETSIG 11 /* Get number of signal to be sent. */ -# define F_SETOWN_EX 15 /* Get owner (thread receiving SIGIO). */ -# define F_GETOWN_EX 16 /* Set owner (thread receiving SIGIO). */ -#endif - -#ifdef __USE_GNU -# define F_SETLEASE 1024 /* Set a lease. */ -# define F_GETLEASE 1025 /* Enquire what lease is active. */ -# define F_NOTIFY 1026 /* Request notfications on a directory. */ -# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */ -# define F_GETPIPE_SZ 1032 /* Set pipe page size array. */ -#endif -#ifdef __USE_XOPEN2K8 -# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with - close-on-exit set. */ -#endif - -/* For F_[GET|SET]FD. */ -#define FD_CLOEXEC 1 /* actually anything with low bit set goes */ - -/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */ -#define F_RDLCK 0 /* Read lock. */ -#define F_WRLCK 1 /* Write lock. */ -#define F_UNLCK 2 /* Remove lock. */ - -/* 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 */ -# 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 - blocking */ -# define LOCK_UN 8 /* remove lock */ -#endif - -#ifdef __USE_GNU -# define LOCK_MAND 32 /* This is a mandatory flock: */ -# define LOCK_READ 64 /* ... which allows concurrent read operations. */ -# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */ -# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */ -#endif - - -#ifdef __USE_GNU -/* Types of directory notifications that may be requested with F_NOTIFY. */ -# define DN_ACCESS 0x00000001 /* File accessed. */ -# define DN_MODIFY 0x00000002 /* File modified. */ -# define DN_CREATE 0x00000004 /* File created. */ -# define DN_DELETE 0x00000008 /* File removed. */ -# define DN_RENAME 0x00000010 /* File renamed. */ -# define DN_ATTRIB 0x00000020 /* File changed attibutes. */ -# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */ -#endif - /* We don't need to support __USE_FILE_OFFSET64. */ struct flock { @@ -168,152 +49,5 @@ struct flock64 }; #endif -#ifdef __USE_GNU -/* Owner types. */ -enum __pid_type - { - F_OWNER_TID = 0, /* Kernel thread. */ - F_OWNER_PID, /* Process. */ - F_OWNER_PGRP, /* Process group. */ - F_OWNER_GID = F_OWNER_PGRP /* Alternative, obsolete name. */ - }; - -/* Structure to use with F_GETOWN_EX and F_SETOWN_EX. */ -struct f_owner_ex - { - enum __pid_type type; /* Owner type of ID. */ - __pid_t pid; /* ID of owner. */ - }; -#endif - - -/* Define some more compatibility macros to be backward compatible with - BSD systems which did not managed to hide these kernel macros. */ -#ifdef __USE_BSD -# define FAPPEND O_APPEND -# define FFSYNC O_FSYNC -# define FASYNC O_ASYNC -# 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 -/* 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. */ - - -/* File handle structure. */ -struct file_handle -{ - unsigned int handle_bytes; - int handle_type; - /* File identifier. */ - unsigned char f_handle[0]; -}; - -/* Maximum handle size (for now). */ -# define MAX_HANDLE_SZ 128 -#endif - -__BEGIN_DECLS - -#ifdef __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. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -extern int sync_file_range (int __fd, __off64_t __offset, __off64_t __count, - unsigned int __flags); - - -/* Splice address range into a pipe. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -extern ssize_t vmsplice (int __fdout, const struct iovec *__iov, - size_t __count, unsigned int __flags); - -/* Splice two files together. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout, - __off64_t *__offout, size_t __len, - unsigned int __flags); - -/* In-kernel implementation of tee for pipe buffers. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -extern ssize_t tee (int __fdin, int __fdout, size_t __len, - unsigned int __flags); - -/* Reserve storage for the data of the file associated with FD. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -# ifndef __USE_FILE_OFFSET64 -extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len); -# else -# ifdef __REDIRECT -extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset, - __off64_t __len), - fallocate64); -# else -# define fallocate fallocate64 -# endif -# endif -# ifdef __USE_LARGEFILE64 -extern int fallocate64 (int __fd, int __mode, __off64_t __offset, - __off64_t __len); -# endif - - -/* Map file name to file handle. */ -extern int name_to_handle_at (int __dfd, const char *__name, - struct file_handle *__handle, int *__mnt_id, - int __flags) __THROW; - -/* Open file using the file handle. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -extern int open_by_handle_at (int __mountdirfd, struct file_handle *__handle, - int __flags); - -#endif - -__END_DECLS +/* Include generic Linux declarations. */ +#include <bits/fcntl-linux.h> diff --git a/libc/ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h b/libc/ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h index 946cfa2ca..04f8a1c1b 100644 --- a/libc/ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h +++ b/libc/ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h @@ -1,5 +1,5 @@ /* O_*, F_*, FD_* bit values for Linux. - Copyright (C) 2000, 2004, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. + Copyright (C) 2000-2012 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,133 +20,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 - located on a few file systems. */ -#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 04010000 -#define O_FSYNC O_SYNC -#define O_ASYNC 020000 - -#ifdef __USE_XOPEN2K8 -# define O_DIRECTORY 040000 /* Must be a directory. */ -# define O_NOFOLLOW 0100000 /* Do not follow links. */ -# define O_CLOEXEC 02000000 /* Set close_on_exec. */ -#endif -#ifdef __USE_GNU -# define O_DIRECT 0200000 /* Direct disk access. */ -# define O_NOATIME 01000000 /* Do not set atime. */ -# define O_PATH 010000000 /* Resolve pathname but do not open file. */ -#endif - -/* For now Linux has synchronisity options for data and read operations. - We define the symbols here but let them do the same as O_SYNC since - this is a superset. */ -#if defined __USE_POSIX199309 || defined __USE_UNIX98 -# define O_DSYNC 010000 /* Synchronize data. */ -# 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). */ -# define F_SETLKW 7 /* Set record locking info (blocking). */ -#else -# define F_GETLK F_GETLK64 /* Get record locking info. */ -# 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 12 /* Get record locking info. */ -#define F_SETLK64 13 /* Set record locking info (non-blocking). */ -#define F_SETLKW64 14 /* Set record locking info (blocking). */ - -#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K8 -# define F_SETOWN 8 /* Get owner of socket (receiver of SIGIO). */ -# define F_GETOWN 9 /* Set owner of socket (receiver of SIGIO). */ -#endif - -#ifdef __USE_GNU -# define F_SETSIG 10 /* Set number of signal to be sent. */ -# define F_GETSIG 11 /* Get number of signal to be sent. */ -# define F_SETOWN_EX 15 /* Get owner (thread receiving SIGIO). */ -# define F_GETOWN_EX 16 /* Set owner (thread receiving SIGIO). */ -#endif - -#ifdef __USE_GNU -# define F_SETLEASE 1024 /* Set a lease. */ -# define F_GETLEASE 1025 /* Enquire what lease is active. */ -# define F_NOTIFY 1026 /* Request notfications on a directory. */ -# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */ -# define F_GETPIPE_SZ 1032 /* Set pipe page size array. */ -#endif -#ifdef __USE_XOPEN2K8 -# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with - close-on-exit set. */ -#endif - -/* For F_[GET|SET]FD. */ -#define FD_CLOEXEC 1 /* actually anything with low bit set goes */ - -/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */ -#define F_RDLCK 0 /* Read lock. */ -#define F_WRLCK 1 /* Write lock. */ -#define F_UNLCK 2 /* Remove lock. */ - -/* 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. */ -# 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 - blocking */ -# define LOCK_UN 8 /* remove lock */ -#endif - -#ifdef __USE_GNU -# define LOCK_MAND 32 /* This is a mandatory flock: */ -# define LOCK_READ 64 /* ... which allows concurrent read operations. */ -# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */ -# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */ -#endif - -#ifdef __USE_GNU -/* Types of directory notifications that may be requested with F_NOTIFY. */ -# define DN_ACCESS 0x00000001 /* File accessed. */ -# define DN_MODIFY 0x00000002 /* File modified. */ -# define DN_CREATE 0x00000004 /* File created. */ -# define DN_DELETE 0x00000008 /* File removed. */ -# define DN_RENAME 0x00000010 /* File renamed. */ -# define DN_ATTRIB 0x00000020 /* File changed attibutes. */ -# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */ -#endif +#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_LARGEFILE 0400000 struct flock { @@ -173,148 +50,5 @@ struct flock64 }; #endif -#ifdef __USE_GNU -/* Owner types. */ -enum __pid_type - { - F_OWNER_TID = 0, /* Kernel thread. */ - F_OWNER_PID, /* Process. */ - F_OWNER_PGRP, /* Process group. */ - F_OWNER_GID = F_OWNER_PGRP /* Alternative, obsolete name. */ - }; - -/* Structure to use with F_GETOWN_EX and F_SETOWN_EX. */ -struct f_owner_ex - { - enum __pid_type type; /* Owner type of ID. */ - __pid_t pid; /* ID of owner. */ - }; -#endif - -/* Define some more compatibility macros to be backward compatible with - BSD systems which did not managed to hide these kernel macros. */ -#ifdef __USE_BSD -# define FAPPEND O_APPEND -# define FFSYNC O_FSYNC -# define FASYNC O_ASYNC -# 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 -/* 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. */ - - -/* File handle structure. */ -struct file_handle -{ - unsigned int handle_bytes; - int handle_type; - /* File identifier. */ - unsigned char f_handle[0]; -}; - -/* Maximum handle size (for now). */ -# define MAX_HANDLE_SZ 128 -#endif - -__BEGIN_DECLS - -#ifdef __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 __offset, __off64_t __count, - unsigned int __flags); - - -/* Splice address range into a pipe. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -extern ssize_t vmsplice (int __fdout, const struct iovec *__iov, - size_t __count, unsigned int __flags); - -/* Splice two files together. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout, - __off64_t *__offout, size_t __len, - unsigned int __flags); - -/* In-kernel implementation of tee for pipe buffers. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -extern ssize_t tee (int __fdin, int __fdout, size_t __len, - unsigned int __flags); - -/* Reserve storage for the data of the file associated with FD. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -# ifndef __USE_FILE_OFFSET64 -extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len); -# else -# ifdef __REDIRECT -extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset, - __off64_t __len), - fallocate64); -# else -# define fallocate fallocate64 -# endif -# endif -# ifdef __USE_LARGEFILE64 -extern int fallocate64 (int __fd, int __mode, __off64_t __offset, - __off64_t __len); -# endif - - -/* Map file name to file handle. */ -extern int name_to_handle_at (int __dfd, const char *__name, - struct file_handle *__handle, int *__mnt_id, - int __flags) __THROW; - -/* Open file using the file handle. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -extern int open_by_handle_at (int __mountdirfd, struct file_handle *__handle, - int __flags); - -#endif - -__END_DECLS +/* Include generic Linux declarations. */ +#include <bits/fcntl-linux.h> diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/Makefile b/libc/ports/sysdeps/unix/sysv/linux/mips/Makefile index 99c554ff6..66ba621da 100644 --- a/libc/ports/sysdeps/unix/sysv/linux/mips/Makefile +++ b/libc/ports/sysdeps/unix/sysv/linux/mips/Makefile @@ -8,15 +8,42 @@ sysdep_routines += cachectl cacheflush sysmips _test_and_set sysdep_headers += sys/cachectl.h sys/sysmips.h sys/tas.h endif -# _MIPS_SIM_ABI32 == 1, _MIPS_SIM_NABI32 == 2, _MIPS_SIM_ABI64 == 3 -abi-variants := o32 n32 n64 +# Get value of default-abi. +include $(common-objpfx)default-abi.make + +abi-variants := o32_soft o32_hard n32_soft n32_hard n64_soft n64_hard + +ifeq (,$(filter $(default-abi),$(abi-variants))) +Unknown ABI, must be one of $(abi-variants) +endif + abi-includes := sgidefs.h -abi-o32-options := -D_MIPS_SIM=1 -abi-o32-condition := _MIPS_SIM == _MIPS_SIM_ABI32 -abi-n32-options := -D_MIPS_SIM=2 -abi-n32-condition := _MIPS_SIM == _MIPS_SIM_NABI32 -abi-n64-options := -D_MIPS_SIM=3 -abi-n64-condition := _MIPS_SIM == _MIPS_SIM_ABI64 + +# _MIPS_SIM_ABI32 == 1, _MIPS_SIM_NABI32 == 2, _MIPS_SIM_ABI64 == 3 +abi-o32_soft-options := -U_MIPS_SIM -D_MIPS_SIM=1 \ + -D__mips_soft_float -U__mips_hard_float +abi-o32_soft-condition := defined(__mips_soft_float) \ + && (_MIPS_SIM == _MIPS_SIM_ABI32) +abi-o32_hard-options := -U_MIPS_SIM -D_MIPS_SIM=1 \ + -D__mips_hard_float -U__mips_soft_float +abi-o32_hard-condition := defined(__mips_hard_float) \ + && (_MIPS_SIM == _MIPS_SIM_ABI32) +abi-n32_soft-options := -U_MIPS_SIM -D_MIPS_SIM=2 \ + -D__mips_soft_float -U__mips_hard_float +abi-n32_soft-condition := defined(__mips_soft_float) \ + && (_MIPS_SIM == _MIPS_SIM_NABI32) +abi-n32_hard-options := -U_MIPS_SIM -D_MIPS_SIM=2 \ + -D__mips_hard_float -U__mips_soft_float +abi-n32_hard-condition := defined(__mips_hard_float) \ + && (_MIPS_SIM == _MIPS_SIM_NABI32) +abi-n64_soft-options := -U_MIPS_SIM -D_MIPS_SIM=3 \ + -D__mips_soft_float -U__mips_hard_float +abi-n64_soft-condition := defined(__mips_soft_float) \ + && (_MIPS_SIM == _MIPS_SIM_ABI64) +abi-n64_hard-options := -U_MIPS_SIM -D_MIPS_SIM=3 \ + -D__mips_hard_float -U__mips_soft_float +abi-n64_hard-condition := defined(__mips_hard_float) \ + && (_MIPS_SIM == _MIPS_SIM_ABI64) ifeq ($(subdir),elf) ifeq ($(build-shared),yes) diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/configure b/libc/ports/sysdeps/unix/sysv/linux/mips/configure index 051432df8..cecfc9d84 100644 --- a/libc/ports/sysdeps/unix/sysv/linux/mips/configure +++ b/libc/ports/sysdeps/unix/sysv/linux/mips/configure @@ -1,6 +1,112 @@ # This file is generated from configure.in by Autoconf. DO NOT EDIT! # Local configure fragment for sysdeps/unix/sysv/linux/mips. + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #if (_MIPS_SIM != _ABIO32) + #error Not O32 ABI + #endif +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + libc_mips_abi=o32 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #if (_MIPS_SIM != _ABIN32) + #error Not N32 ABI + #endif +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + libc_mips_abi=n32 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #if (_MIPS_SIM != _ABI64) + #error Not 64 ABI + #endif +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + libc_mips_abi=n64 +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test -z "$libc_mips_abi"; then + as_fn_error $? "could not determine what ABI the compiler is using" "$LINENO" 5 +fi + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #if !defined(__mips_soft_float) + #error Not soft ABI + #endif +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + libc_mips_float=soft +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #if !defined(__mips_hard_float) + #error Not hard ABI + #endif +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + libc_mips_float=hard +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test -z "$libc_mips_float"; then + as_fn_error $? "could not determine if compiler is using hard or soft floating point ABI" "$LINENO" 5 +fi + +echo "default-abi := ${libc_mips_abi}_${libc_mips_float}" > default-abi.make + case "$prefix" in /usr | /usr/) # 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib. diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/configure.in b/libc/ports/sysdeps/unix/sysv/linux/mips/configure.in index 18e8bbc5c..167779eaf 100644 --- a/libc/ports/sysdeps/unix/sysv/linux/mips/configure.in +++ b/libc/ports/sysdeps/unix/sysv/linux/mips/configure.in @@ -2,6 +2,50 @@ sinclude(./aclocal.m4)dnl Autoconf lossage GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. # Local configure fragment for sysdeps/unix/sysv/linux/mips. +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([ + #if (_MIPS_SIM != _ABIO32) + #error Not O32 ABI + #endif])], + [libc_mips_abi=o32], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([ + #if (_MIPS_SIM != _ABIN32) + #error Not N32 ABI + #endif])], + [libc_mips_abi=n32], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([ + #if (_MIPS_SIM != _ABI64) + #error Not 64 ABI + #endif])], + [libc_mips_abi=n64], + [])])]) + +if test -z "$libc_mips_abi"; then + AC_MSG_ERROR([could not determine what ABI the compiler is using]) +fi + +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([ + #if !defined(__mips_soft_float) + #error Not soft ABI + #endif])], + [libc_mips_float=soft], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([ + #if !defined(__mips_hard_float) + #error Not hard ABI + #endif])], + [libc_mips_float=hard], + [])]) + +if test -z "$libc_mips_float"; then + AC_MSG_ERROR([could not determine if compiler is using hard or soft floating point ABI]) +fi + +echo "default-abi := ${libc_mips_abi}_${libc_mips_float}" > default-abi.make + case "$prefix" in /usr | /usr/) # 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib. diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/Makefile b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/Makefile deleted file mode 100644 index 77e91218a..000000000 --- a/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/Makefile +++ /dev/null @@ -1 +0,0 @@ -default-abi := o32 diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/sync_file_range.c b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/sync_file_range.c index 2dc110ba7..1d345efcf 100644 --- a/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/sync_file_range.c +++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/sync_file_range.c @@ -54,6 +54,4 @@ sync_file_range (int fd, __off64_t from, __off64_t to, unsigned int flags) return -1; } stub_warning (sync_file_range) - -# include <stub-tag.h> #endif diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/Makefile b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/Makefile deleted file mode 100644 index 2368c4038..000000000 --- a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/Makefile +++ /dev/null @@ -1 +0,0 @@ -default-abi := n32 diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/nptl/libc.abilist b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/nptl/libc.abilist index 2a0e2a2d9..df2e63728 100644 --- a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/nptl/libc.abilist +++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/nptl/libc.abilist @@ -1392,6 +1392,11 @@ GLIBC_2.16 timespec_get F GLIBC_2.17 GLIBC_2.17 A + clock_getcpuclockid F + clock_getres F + clock_gettime F + clock_nanosleep F + clock_settime F secure_getenv F GLIBC_2.2 GLIBC_2.2 A diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/Makefile b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/Makefile deleted file mode 100644 index fed17ba64..000000000 --- a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/Makefile +++ /dev/null @@ -1 +0,0 @@ -default-abi := n64 diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h b/libc/ports/sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h index 9c1701167..9c3d3d16d 100644 --- a/libc/ports/sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h +++ b/libc/ports/sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h @@ -86,6 +86,18 @@ INTERNAL_SYSCALL_ERROR_P (__ret, __err) ? -__ret : __ret; \ }) +#define lll_futex_timed_wait_bitset(futexp, val, timespec, clockbit, private) \ + ({ \ + INTERNAL_SYSCALL_DECL (__err); \ + long int __ret; \ + int __op = FUTEX_WAIT_BITSET | clockbit; \ + __ret = INTERNAL_SYSCALL (futex, __err, 6, (long) (futexp), \ + __lll_private_flag (__op, private), \ + (val), (timespec), NULL /* Unused. */, \ + FUTEX_BITSET_MATCH_ANY); \ + INTERNAL_SYSCALL_ERROR_P (__ret, __err) ? -__ret : __ret; \ + }) + #define lll_futex_wake(futexp, nr, private) \ ({ \ INTERNAL_SYSCALL_DECL (__err); \ diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist index f2682b39c..0efc6b55c 100644 --- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist +++ b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist @@ -1774,13 +1774,13 @@ GLIBC_2.16 timespec_get F GLIBC_2.17 GLIBC_2.17 A + __ppc_get_timebase_freq F clock_getcpuclockid F clock_getres F clock_gettime F clock_nanosleep F clock_settime F secure_getenv F - __ppc_get_timebase_freq F GLIBC_2.2 GLIBC_2.2 A _IO_adjust_wcolumn F diff --git a/libc/ports/sysdeps/unix/sysv/linux/tile/Makefile b/libc/ports/sysdeps/unix/sysv/linux/tile/Makefile index 0cbfdd0e3..1c0c968dc 100644 --- a/libc/ports/sysdeps/unix/sysv/linux/tile/Makefile +++ b/libc/ports/sysdeps/unix/sysv/linux/tile/Makefile @@ -13,3 +13,7 @@ sysdep_headers += sys/dataplane.h sysdep_routines += set_dataplane endif + +ifeq ($(subdir),elf) +sysdep_routines += dl-vdso +endif diff --git a/libc/ports/sysdeps/unix/sysv/linux/tile/bits/libc-vdso.h b/libc/ports/sysdeps/unix/sysv/linux/tile/bits/libc-vdso.h new file mode 100644 index 000000000..b972720b3 --- /dev/null +++ b/libc/ports/sysdeps/unix/sysv/linux/tile/bits/libc-vdso.h @@ -0,0 +1,30 @@ +/* Resolve function pointers to VDSO functions. + Copyright (C) 2012 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, see + <http://www.gnu.org/licenses/>. */ + + +#ifndef _LIBC_VDSO_H +#define _LIBC_VDSO_H + +#ifdef SHARED + +extern long int (*__vdso_gettimeofday) (struct timeval *, void *) + attribute_hidden; + +#endif + +#endif /* _LIBC_VDSO_H */ diff --git a/libc/ports/sysdeps/unix/sysv/linux/tile/gettimeofday.c b/libc/ports/sysdeps/unix/sysv/linux/tile/gettimeofday.c new file mode 100644 index 000000000..92136d54b --- /dev/null +++ b/libc/ports/sysdeps/unix/sysv/linux/tile/gettimeofday.c @@ -0,0 +1,37 @@ +/* Copyright (C) 2012 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, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> +#include <stddef.h> +#include <sys/time.h> +#include <time.h> +#include <bits/libc-vdso.h> + +int +__gettimeofday (struct timeval *tv, struct timezone *tz) +{ +#ifdef SHARED + /* If the vDSO is available we use it. */ + if (__vdso_gettimeofday != NULL) + return __vdso_gettimeofday (tv, tz); +#endif + return INLINE_SYSCALL (gettimeofday, 2, tv, tz); +} + +libc_hidden_def (__gettimeofday) +weak_alias (__gettimeofday, gettimeofday) +libc_hidden_weak (gettimeofday) diff --git a/libc/ports/sysdeps/unix/sysv/linux/tile/init-first.c b/libc/ports/sysdeps/unix/sysv/linux/tile/init-first.c new file mode 100644 index 000000000..9ff63c1d1 --- /dev/null +++ b/libc/ports/sysdeps/unix/sysv/linux/tile/init-first.c @@ -0,0 +1,34 @@ +/* Copyright (C) 2012 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, see + <http://www.gnu.org/licenses/>. */ + +#ifdef SHARED +#include <dl-vdso.h> +#include <bits/libc-vdso.h> + +long int (*__vdso_gettimeofday) (struct timeval *, void *) attribute_hidden; + +static inline void +_libc_vdso_platform_setup (void) +{ + PREPARE_VERSION (linux26, "LINUX_2.6", 61765110); + __vdso_gettimeofday = _dl_vdso_vsym ("__vdso_gettimeofday", &linux26); +} + +#define VDSO_SETUP _libc_vdso_platform_setup +#endif + +#include <csu/init-first.c> |