From 4cc4b30426c5e5a0ecf912791e3f27312438d10e Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 3 Jun 2008 08:11:56 +0000 Subject: - adds several config-options to allow for turning off certain features like o UCLIBC_HAS_GNU_ERROR o UCLIBC_HAS_BSD_ERR o UCLIBC_HAS_PTY o UCLIBC_HAS_GETPT (1) o UCLIBC_SYSCALL_STUBS o UCLIBC_SYSCALL_STUB_WARNING o UCLIBC_LINUX_SPECIFIC (2) o UCLIBC_BSD_SPECIFIC (3) o UCLIBC_NTP_LEGACY (4) o UCLIBC_SV4_DEPRECATED (5) o UCLIBC_HAVE_REALTIME (6) o UCLIBC_HAVE_ADVANCED_REALTIME (7) o UCLIBC_HAVE_EPOLL (8) o UCLIBC_HAVE_XATTR (9) o UCLIBC_HAVE_PROFILING (10) (1) make non-standard getpt optional and implement standard posix_openpt (2) fstatfs(), inotify_*(), ioperm(), iopl(), madvise(), modify_ldt(), personality() ppoll(), setresuid() (3) mincore(), getdomainname(), setdomainname() (4) ntp_adjtime(), ntp_gettime() aliases (5) ustat() [use statfs(2) in your code instead] (6) All marked as "(REALTIME)" in SUSv3 (7) All marked as "(ADVANCED REALTIME)" in SUSv3 (8) epoll_create(), epoll_ctl(), epoll_wait() (9) all Extended Attributes (10) helpers for gcc's -finstrument-functions - Fixes _dl_exit() - Implements sleep(3) for !UCLIBC_HAVE_REALTIME - Implements usleep(3) for !UCLIBC_HAVE_REALTIME - adds #warning about incorrect posix_fadvise{,64}() - removes unused and unwanted uselib() Net outcome is that an allnoconfig with HAVE_SHARED is now about 88k instead of formerly 130k. --- include/fcntl.h | 4 ++-- include/mqueue.h | 8 ++++++-- include/netinet/in.h | 2 ++ include/signal.h | 7 ++++--- include/stdlib.h | 5 +++-- include/sys/mman.h | 10 ++++++---- include/sys/poll.h | 2 +- include/sys/statfs.h | 2 ++ include/sys/timex.h | 2 ++ include/time.h | 10 ++++++---- include/unistd.h | 9 ++++++--- 11 files changed, 40 insertions(+), 21 deletions(-) (limited to 'include') diff --git a/include/fcntl.h b/include/fcntl.h index a43890215..adeabaebb 100644 --- a/include/fcntl.h +++ b/include/fcntl.h @@ -177,7 +177,7 @@ extern int lockf64 (int __fd, int __cmd, __off64_t __len); # endif #endif -#ifdef __USE_XOPEN2K +#if defined __USE_XOPEN2K && defined __UCLIBC_HAS_ADVANCED_REALTIME__ /* Advice the system about the expected behaviour of the application with respect to the file associated with FD. */ # ifndef __USE_FILE_OFFSET64 @@ -199,7 +199,7 @@ extern int posix_fadvise64 (int __fd, __off64_t __offset, __off64_t __len, #endif -#if 0 +#if 0 // && defined __UCLIBC_HAS_ADVANCED_REALTIME__ /* FIXME -- uClibc should probably implement these... */ diff --git a/include/mqueue.h b/include/mqueue.h index 1ccad5bba..f75b50611 100644 --- a/include/mqueue.h +++ b/include/mqueue.h @@ -20,6 +20,8 @@ #define _MQUEUE_H 1 #include +#if defined __UCLIBC_HAS_REALTIME__ || \ + defined __UCLIBC_HAS_ADVANCED_REALTIME__ #include #include #define __need_sigevent_t @@ -28,9 +30,10 @@ #include /* Get the definition of mqd_t and struct mq_attr. */ #include +#endif __BEGIN_DECLS - +#if defined __UCLIBC_HAS_REALTIME__ /* Establish connection between a process and a message queue NAME and return message queue descriptor or (mqd_t) -1 on error. OFLAG determines the type of access used. If O_CREAT is on OFLAG, the third argument is @@ -69,8 +72,9 @@ extern ssize_t mq_receive (mqd_t __mqdes, char *__msg_ptr, size_t __msg_len, /* Add message pointed by MSG_PTR to message queue MQDES. */ extern int mq_send (mqd_t __mqdes, const char *__msg_ptr, size_t __msg_len, unsigned int __msg_prio); +#endif -#ifdef __USE_XOPEN2K +#if defined __USE_XOPEN2K && defined __UCLIBC_HAS_ADVANCED_REALTIME__ /* Receive the oldest from highest priority messages in message queue MQDES, stop waiting if ABS_TIMEOUT expires. */ extern ssize_t mq_timedreceive (mqd_t __mqdes, char *__restrict __msg_ptr, diff --git a/include/netinet/in.h b/include/netinet/in.h index 018b39b70..6bfc5e780 100644 --- a/include/netinet/in.h +++ b/include/netinet/in.h @@ -216,6 +216,7 @@ extern const struct in6_addr in6addr_loopback; /* ::1 */ #include +#if 1 /* defined __UCLIBC_HAS_IPV4__ */ /* Structure describing an Internet socket address. */ struct sockaddr_in { @@ -229,6 +230,7 @@ struct sockaddr_in sizeof (in_port_t) - sizeof (struct in_addr)]; }; +#endif /* Ditto, for IPv6. */ struct sockaddr_in6 diff --git a/include/signal.h b/include/signal.h index 288febd01..3eaee4931 100644 --- a/include/signal.h +++ b/include/signal.h @@ -73,7 +73,7 @@ typedef __uid_t uid_t; /* Type of a signal handler. */ typedef void (*__sighandler_t) (int); - +#if defined __UCLIBC_HAS_OBSOLETE_SYSV_SIGNAL__ /* The X/Open definition of `signal' specifies the SVID semantic. Use the additional function `sysv_signal' when X/Open compatibility is requested. */ @@ -83,6 +83,7 @@ extern __sighandler_t __sysv_signal (int __sig, __sighandler_t __handler) extern __sighandler_t sysv_signal (int __sig, __sighandler_t __handler) __THROW; #endif +#endif /* __UCLIBC_HAS_OBSOLETE_SYSV_SIGNAL__ */ /* Set the handler for the signal SIG to HANDLER, returning the old handler, or SIG_ERR on error. @@ -268,7 +269,7 @@ extern int sigpending (sigset_t *__set) __THROW __nonnull ((1)); extern int sigwait (__const sigset_t *__restrict __set, int *__restrict __sig) __nonnull ((1, 2)); -# ifdef __USE_POSIX199309 +# if defined __USE_POSIX199309 && defined __UCLIBC_HAS_REALTIME__ /* Select any of pending signals from SET and place information in INFO. This function is a cancellation point and therefore not marked with @@ -363,7 +364,7 @@ extern int sigaltstack (__const struct sigaltstack *__restrict __ss, #endif /* use BSD or X/Open Unix. */ -#ifdef __USE_XOPEN_EXTENDED +#if defined __USE_XOPEN_EXTENDED && defined __UCLIBC_HAS_OBSOLETE_BSD_SIGNAL__ /* Simplified interface for signal management. */ /* Add SIG to the calling process' signal mask. */ diff --git a/include/stdlib.h b/include/stdlib.h index 276f1ba66..354134906 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -489,7 +489,7 @@ extern void cfree (void *__ptr) __THROW; extern void *valloc (size_t __size) __THROW __attribute_malloc__ __wur; #endif -#ifdef __USE_XOPEN2K +#if defined __USE_XOPEN2K && defined __UCLIBC_HAS_ADVANCED_REALTIME__ /* Allocate memory of SIZE bytes with an alignment of ALIGNMENT. */ extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) __THROW __nonnull ((1)) __wur; @@ -817,7 +817,7 @@ extern int posix_openpt (int __oflag) __wur; #ifdef __USE_XOPEN /* The next four functions all take a master pseudo-tty fd and perform an operation on the associated slave: */ - +#ifdef __UCLIBC_HAS_PTY__ /* Chown the slave to the calling user. */ extern int grantpt (int __fd) __THROW; @@ -829,6 +829,7 @@ extern int unlockpt (int __fd) __THROW; the master FD is open on, or NULL on errors. The returned storage is good until the next call to this function. */ extern char *ptsname (int __fd) __THROW __wur; +#endif /* __UCLIBC_HAS_PTY__ */ #endif #ifdef __USE_GNU diff --git a/include/sys/mman.h b/include/sys/mman.h index 7bb1595bb..326685f61 100644 --- a/include/sys/mman.h +++ b/include/sys/mman.h @@ -98,17 +98,18 @@ static inline int msync (void *__addr, size_t __len, int __flags) { return 0; } #endif -#ifdef __USE_BSD +#if defined __USE_BSD && defined __UCLIBC_LINUX_SPECIFIC__ /* Advise the system about particular usage patterns the program follows for the region starting at ADDR and extending LEN bytes. */ extern int madvise (void *__addr, size_t __len, int __advice) __THROW; #endif -#ifdef __USE_XOPEN2K +#if defined __USE_XOPEN2K && defined __UCLIBC_HAS_ADVANCED_REALTIME__ /* This is the POSIX name for this function. */ extern int posix_madvise (void *__addr, size_t __len, int __advice) __THROW; #endif -#ifdef __ARCH_USE_MMU__ +#if defined __UCLIBC_HAS_REALTIME__ +# ifdef __ARCH_USE_MMU__ /* Guarantee all whole pages mapped by the range [ADDR,ADDR+LEN) to be memory resident. */ @@ -135,8 +136,9 @@ static inline int munlock (__const void *__addr, size_t __len) { return 0; } static inline int mlockall (int __flags) { return 0; } static inline int munlockall (void) { return 0; } #endif +#endif /* __UCLIBC_HAS_REALTIME__ */ -#ifdef __USE_MISC +#if defined __USE_MISC && defined __UCLIBC_BSD_SPECIFIC__ /* mincore returns the memory residency status of the pages in the current process's address space specified by [start, start + len). The status is returned in a vector of bytes. The least significant diff --git a/include/sys/poll.h b/include/sys/poll.h index 70f0d3159..a298dac15 100644 --- a/include/sys/poll.h +++ b/include/sys/poll.h @@ -59,7 +59,7 @@ __BEGIN_DECLS __THROW. */ extern int poll (struct pollfd *__fds, nfds_t __nfds, int __timeout); -#ifdef __USE_GNU +#if defined __USE_GNU && defined __UCLIBC_LINUX_SPECIFIC__ /* Like poll, but before waiting the threads signal mask is replaced with that specified in the fourth parameter. For better usability, the timeout value is specified using a TIMESPEC object. diff --git a/include/sys/statfs.h b/include/sys/statfs.h index 3b2226b41..f4177d4c9 100644 --- a/include/sys/statfs.h +++ b/include/sys/statfs.h @@ -45,6 +45,7 @@ extern int statfs64 (__const char *__file, struct statfs64 *__buf) __THROW __nonnull ((1, 2)); #endif +#if defined __UCLIBC_LINUX_SPECIFIC__ /* Return information about the filesystem containing the file FILDES refers to. */ #ifndef __USE_FILE_OFFSET64 @@ -62,6 +63,7 @@ extern int __REDIRECT_NTH (fstatfs, (int __fildes, struct statfs *__buf), extern int fstatfs64 (int __fildes, struct statfs64 *__buf) __THROW __nonnull ((2)); #endif +#endif /* __UCLIBC_LINUX_SPECIFIC__ */ __END_DECLS diff --git a/include/sys/timex.h b/include/sys/timex.h index 773a5ab8d..d2020a6d2 100644 --- a/include/sys/timex.h +++ b/include/sys/timex.h @@ -119,8 +119,10 @@ __BEGIN_DECLS extern int __adjtimex (struct timex *__ntx) __THROW; extern int adjtimex (struct timex *__ntx) __THROW; +#if defined __UCLIBC_NTP_LEGACY__ extern int ntp_gettime (struct ntptimeval *__ntv) __THROW; extern int ntp_adjtime (struct timex *__tntx) __THROW; +#endif __END_DECLS diff --git a/include/time.h b/include/time.h index d25b40845..8fca37b55 100644 --- a/include/time.h +++ b/include/time.h @@ -329,6 +329,7 @@ extern int dysize (int __year) __THROW __attribute__ ((__const__)); # ifdef __USE_POSIX199309 +# if defined __UCLIBC_HAS_REALTIME__ /* Pause execution for a number of nanoseconds. This function is a cancellation point and therefore not marked with @@ -346,10 +347,10 @@ extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __THROW; /* Set clock CLOCK_ID to value TP. */ extern int clock_settime (clockid_t __clock_id, __const struct timespec *__tp) __THROW; - +#endif /* __UCLIBC_HAS_REALTIME__ */ #ifdef __UCLIBC_MJN3_ONLY__ #warning "mjn3 FIXME: a bunch of unimplemented function prototypes." -# ifdef __USE_XOPEN2K +# if defined __USE_XOPEN2K && defined __UCLIBC_HAS_ADVANCED_REALTIME__ /* High-resolution sleep with the specified clock. This function is a cancellation point and therefore not marked with @@ -363,7 +364,7 @@ extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __THROW; # endif #endif /* __UCLIBC_MJN3_ONLY__ */ - +# if defined __UCLIBC_HAS_REALTIME__ /* Create new per-process timer using CLOCK_ID. */ extern int timer_create (clockid_t __clock_id, struct sigevent *__restrict __evp, @@ -383,7 +384,8 @@ extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) /* Get expiration overrun for timer TIMERID. */ extern int timer_getoverrun (timer_t __timerid) __THROW; -# endif +# endif /* __UCLIBC_HAS_REALTIME__ */ +# endif /* __USE_POSIX199309 */ #ifdef __UCLIBC_MJN3_ONLY__ diff --git a/include/unistd.h b/include/unistd.h index 3b72b8222..e0219e770 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -703,10 +703,12 @@ extern int getresuid (__uid_t *__ruid, __uid_t *__euid, __uid_t *__suid) extern int getresgid (__gid_t *__rgid, __gid_t *__egid, __gid_t *__sgid) __THROW; +#if defined __UCLIBC_LINUX_SPECIFIC__ /* Set the real user ID, effective user ID, and saved-set user ID, of the calling process to RUID, EUID, and SUID, respectively. */ extern int setresuid (__uid_t __ruid, __uid_t __euid, __uid_t __suid) __THROW; +#endif /* Set the real group ID, effective group ID, and saved-set group ID, of the calling process to RGID, EGID, and SGID, respectively. */ @@ -857,7 +859,7 @@ extern int sethostname (__const char *__name, size_t __len) This call is restricted to the super-user. */ extern int sethostid (long int __id) __THROW __wur; - +#if defined __UCLIBC_BSD_SPECIFIC__ /* Get and set the NIS (aka YP) domain name, if any. Called just like `gethostname' and `sethostname'. The NIS domain name is usually the empty string when not using NIS. */ @@ -865,7 +867,7 @@ extern int getdomainname (char *__name, size_t __len) __THROW __nonnull ((1)) __wur; extern int setdomainname (__const char *__name, size_t __len) __THROW __nonnull ((1)) __wur; - +#endif /* Revoke access permissions to all processes currently communicating with the control terminal, and then send a SIGHUP signal to the process @@ -1064,7 +1066,8 @@ extern int lockf64 (int __fd, int __cmd, __off64_t __len) __wur; __result; })) #endif -#if defined __USE_POSIX199309 || defined __USE_UNIX98 +#if (defined __USE_POSIX199309 || defined __USE_UNIX98) \ + && defined __UCLIBC_HAS_REALTIME__ /* Synchronize at least the data part of a file with the underlying media. */ extern int fdatasync (int __fildes) __THROW; -- cgit v1.2.3