Commit Graph

353 Commits

Author SHA1 Message Date
Rich Felker
c2b18f3531 fcntl.h: move macros that do not vary between archs out of bits 2011-04-14 21:49:22 -04:00
Rich Felker
33a3f202d1 add useless type fd_mask. it's in the reserved namespace. 2011-04-14 16:23:31 -04:00
Rich Felker
07e865cc5a numerous fixes to sysv ipc
some of these definitions were just plain wrong, others based on
outdated ancient "non-64" versions of the kernel interface.

as much as possible has now been moved out of bits/*

these changes break abi (the old abi for these functions was wrong),
but since they were not working anyway it can hardly matter.
2011-04-13 16:45:43 -04:00
Rich Felker
b5b43b6d62 add syslog.h cruft for syslogd to use... 2011-04-13 16:13:49 -04:00
Rich Felker
b778a2ba69 add profile for getmntent_r 2011-04-13 15:24:26 -04:00
Rich Felker
45a3219944 fix typos on RLIM_NLIMITS, remove _GNU_SOURCE test for it
RLIM_* is in the reserved namespace for this header
2011-04-13 13:22:19 -04:00
Rich Felker
cac7d837cc fix and cleanup suseconds_t/timeval stuff (broken on 64-bit)
trash in the upper 32 bits was making the kernel sleep forever in
select on 64-bit systems.
2011-04-13 13:16:49 -04:00
Rich Felker
3f44f298e4 fix prototypes/signature for setgroups, etc. 2011-04-13 09:03:22 -04:00
Rich Felker
0f5b43550c fix incorrect GNU sighandler_t typedef 2011-04-13 08:45:28 -04:00
Rich Felker
6597f9ac13 implement memrchr (nonstandard) and optimize strrchr in terms of it 2011-04-13 08:36:29 -04:00
Rich Felker
750b738e53 add ptsname_r (nonstandard) and split ptsname (standard) to separate file
this eliminates the ugly static buffer in programs that use ptsname_r.
2011-04-13 08:35:32 -04:00
Rich Felker
c546be175c move bswap functions to static inline in byteswap.h 2011-04-12 13:04:17 -04:00
Rich Felker
0729fd9fd9 utmpx.h is no longer under standards, so expose ut_exit structure 2011-04-12 12:03:33 -04:00
Rich Felker
7ecab79f58 add some traditional aliases to stat.h 2011-04-12 12:01:20 -04:00
Rich Felker
209f2bbd95 add missing rlimit macros 2011-04-12 11:50:14 -04:00
Rich Felker
43b2e9bf26 more types cleanup
the basic idea is that the only things in alltypes.h should be types
that either vary from system to system (in practice, not just in
theoretical la-la land - this is the implementation so we choose what
constraints we want to impose on ports) or which are needed by
multiple system headers.
2011-04-11 10:48:52 -04:00
Rich Felker
28bde3b787 cleanup types stuff in headers, fix missing u_int*_t in sys/types.h 2011-04-11 10:38:00 -04:00
Rich Felker
2555fe1b6d add some ugly legacy type names in sys/types.h (u_char etc.) 2011-04-10 22:47:43 -04:00
Rich Felker
691b20bec0 add legacy BSD-style timer*() macros in sys/time.h 2011-04-10 22:46:46 -04:00
Rich Felker
4a19634f07 add missing UTIME_* macros in sys/stat.h 2011-04-10 18:32:59 -04:00
Rich Felker
095ad15673 fix typo in sys/msg.h 2011-04-06 17:50:38 -04:00
Rich Felker
2b55a619e4 add IN_LOOPBACKNET constant (nonstandard but in reserved namespace) 2011-04-06 15:44:39 -04:00
Rich Felker
1fee6186fe fix prototype for strsep 2011-04-06 14:28:29 -04:00
Rich Felker
104d013441 fix incorrect (and conflicting on LP64 archs) types for sysv ipc msgq functions 2011-04-06 00:02:20 -04:00
Rich Felker
0438e9fd63 getopt.h is a GNU-getopt-specific header. always expose GNU functions. 2011-04-05 15:45:24 -04:00
Rich Felker
5788d97221 add sysexits.h legacy header 2011-04-05 15:40:36 -04:00
Rich Felker
e72180083e add more legacy functions: setlinebuf and setbuffer 2011-04-05 12:25:31 -04:00
Rich Felker
8b61c81693 alternate name for syslog.h 2011-04-05 12:13:54 -04:00
Rich Felker
39e48531ef support the nonstandard err.h interfaces
note that unlike the originals, these do not print the program
name/argv[0] because we have not saved it anywhere. this could be
changed in __libc_start_main if desired.
2011-04-05 11:16:49 -04:00
Rich Felker
2155afd73e prototype getdtablesize (nonstandard function) 2011-04-03 18:15:36 -04:00
Rich Felker
1db283bf19 add setresuid/setresgid functions (nonstandard) 2011-04-03 16:20:57 -04:00
Rich Felker
06baa2b56c d_fileno alias for d_ino in dirent
this is nonstandard but since POSIX reserved d_ prefix in dirent.h we
might as well define it unconditionally. some programs depend on it.
2011-04-03 10:24:59 -04:00
Rich Felker
5243e5f160 remove obsolete and useless useconds_t type 2011-04-01 21:10:01 -04:00
Rich Felker
3df3d4f512 fix misspelled PTHREAD_CANCELED constant 2011-04-01 20:48:02 -04:00
Rich Felker
a5323c5768 add some missing prototypes for nonstandard functions (strsep, clearenv) 2011-03-30 14:14:26 -04:00
Rich Felker
1c1aa32eea missing prototype for wcscoll (stub) 2011-03-29 18:30:27 -04:00
Rich Felker
80c4dcd253 implement POSIX timers
this implementation is superior to the glibc/nptl implementation, in
that it gives true realtime behavior. there is no risk of timer
expiration events being lost due to failed thread creation or failed
malloc, because the thread is created as time creation time, and
reused until the timer is deleted.
2011-03-29 13:01:25 -04:00
Rich Felker
ef839c73d7 prototype for getpass 2011-03-28 20:43:51 -04:00
Rich Felker
ea343364a7 match glibc/lsb cancellation abi on i386
glibc made the ridiculous choice to use pass-by-register calling
convention for these functions, which is impossible to duplicate
directly on non-gcc compilers. instead, we use ugly asm to wrap and
convert the calling convention. presumably this works with every
compiler anyone could potentially want to use.
2011-03-25 22:13:57 -04:00
Rich Felker
685e40bb09 syscall overhaul part two - unify public and internal syscall interface
with this patch, the syscallN() functions are no longer needed; a
variadic syscall() macro allows syscalls with anywhere from 0 to 6
arguments to be made with a single macro name. also, manually casting
each non-integer argument with (long) is no longer necessary; the
casts are hidden in the macros.

some source files which depended on being able to define the old macro
SYSCALL_RETURNS_ERRNO have been modified to directly use __syscall()
instead of syscall(). references to SYSCALL_SIGSET_SIZE and SYSCALL_LL
have also been changed.

x86_64 has not been tested, and may need a follow-up commit to fix any
minor bugs/oversights.
2011-03-19 21:36:10 -04:00
Rich Felker
b0e83133e2 add some ioctl stuff to sys/mount.h 2011-03-19 18:58:32 -04:00
Rich Felker
d00ff2950e overhaul syscall interface
this commit shuffles around the location of syscall definitions so
that we can make a syscall() library function with both SYS_* and
__NR_* style syscall names available to user applications, provides
the syscall() library function, and optimizes the code that performs
the actual inline syscalls in the library itself.

previously on i386 when built as PIC (shared library), syscalls were
incurring bus lock (lock prefix) overhead at entry and exit, due to
the way the ebx register was being loaded (xchg instruction with a
memory operand). now the xchg takes place between two registers.

further cleanup to arch/$(ARCH)/syscall.h is planned.
2011-03-19 18:51:42 -04:00
Rich Felker
56fd65e861 some linux headers useful from user apps.
i'm still not sure whether it's a good idea to include or use any of
these, but i'll add them for now. it may make more sense to just add
official kernel headers to the include path for compiling programs
that need them.
2011-03-18 21:53:30 -04:00
Rich Felker
f5ba2bc9ca various legacy and linux-specific stuff
this commit is part of an effort to make more of busybox work
out-of-the-box.
2011-03-18 21:52:26 -04:00
Rich Felker
e18b563821 implement [v]swprintf 2011-03-18 09:19:09 -04:00
Rich Felker
047e434ef5 implement robust mutexes
some of this code should be cleaned up, e.g. using macros for some of
the bit flags, masks, etc. nonetheless, the code is believed to be
working and correct at this point.
2011-03-17 20:41:37 -04:00
Rich Felker
b446c55b6f remove some old cruft from sys/types.h 2011-03-14 11:49:17 -04:00
Rich Felker
d8d19f4d46 pthread.h needs clockid_t
actually it gets this from time.h if _POSIX_C_SOURCE or any other
feature test macros are defined, but it breaks if they're not.
2011-03-12 21:54:19 -05:00
Rich Felker
f1821fce81 missing const in some pthread_attr_* prototypes 2011-03-11 09:46:31 -05:00
Rich Felker
81af503610 fix sem_open and sem_close to obey posix semantics
multiple opens of the same named semaphore must return the same
pointer, and only the last close can unmap it. thus the ugly global
state keeping track of mappings. the maximum number of distinct named
semaphores that can be opened is limited sufficiently small that the
linear searches take trivial time, especially compared to the syscall
overhead of these functions.
2011-03-10 21:34:19 -05:00
Rich Felker
91f7db2621 fix typos in dirent.h 2011-03-08 17:34:26 -05:00
Rich Felker
ac12eb91bd fcntl.h should make availabel the mode constants from sys/stat.h
also remove some legacy nonsense that crept in.
2011-03-08 12:35:35 -05:00
Rich Felker
5d0d6d9836 add macros for use with d_type extension field in dirent 2011-03-07 18:32:36 -05:00
Rich Felker
7d57e05fa8 add prototypes for pthread_condattr_* and pthread_rwlockattr_* 2011-03-07 16:45:48 -05:00
Rich Felker
03dcc3417c preliminaries to adding POSIX semaphores 2011-03-03 18:32:26 -05:00
Rich Felker
a53d2f3425 namespace cleanup in sys/mman.h 2011-03-03 00:32:15 -05:00
Rich Felker
eda8e9da76 implement futimens and utimensat 2011-02-27 03:48:57 -05:00
Rich Felker
b1b465c438 cleanup namespace in sys/time.h 2011-02-27 03:48:19 -05:00
Rich Felker
f2374ed852 implement fexecve 2011-02-27 02:59:23 -05:00
Rich Felker
2a195dd31c fix missing prototype for strsignal 2011-02-26 23:50:26 -05:00
Rich Felker
73d310e1d2 apply feature test protection to memccpy 2011-02-24 12:36:04 -05:00
Rich Felker
46b99426e1 prototypes for GNU asprintf/vasprintf 2011-02-20 17:17:09 -05:00
Rich Felker
f552c792c7 include sys/sysmacros.h from sys/types.h when _GNU_SOURCE is defined 2011-02-20 16:34:10 -05:00
Rich Felker
b1b752372f fix typo in inotify structure 2011-02-20 16:21:39 -05:00
Rich Felker
eee150f39c make real symbols for the legacy (nonstandardized) utmp functions
this is needed in the long term for ABI compatibility anyway, and in
the immediate, it helps with building broken programs like GNU screen
that try to prototype the functions themselves rather than using the
header.
2011-02-20 15:06:26 -05:00
Rich Felker
d6a1e0c79e resolve some header namespace non-issues
after re-reading 2.2.2 of POSIX 2008, all of these are in the correct
reserved namespaces and do not need protection.
2011-02-20 02:44:52 -05:00
Rich Felker
855df698c4 move the GNU siginfo renaming so it doesn't lead to mismatching names 2011-02-20 01:48:51 -05:00
Rich Felker
2b43ef8fc7 make sys/param.h not depend on PATH_MAX and NAME_MAX
this is a nonstandard header used only by backwards programs, but for
some reason it's extremely popular. the recent namespace cleanup fixes
broke it, because PATH_MAX and NAME_MAX will not be defined unless an
approriate feature test macro has been defined. moreover, it's too
late to just #define _GNU_SOURCE in param.h, since limits.h may have
already been included.

let's just hard-code standard values and be done with it.
2011-02-20 00:28:10 -05:00
Rich Felker
5316d083ec fix typo in wordexp.h (note that the function is still unimplemented) 2011-02-19 12:44:36 -05:00
Rich Felker
095a5ae6f2 add syscall wrappers for inotify 2011-02-19 02:52:29 -05:00
Rich Felker
52874c82a8 prototype wait3 and wait4 2011-02-19 02:26:11 -05:00
Rich Felker
b386d81862 prototypes for brk and sbrk 2011-02-19 01:02:46 -05:00
Rich Felker
ad2fe25041 support the ugly and deprecated ucontext and sigcontext header stuff...
only the structures, not the functions from ucontext.h, are supported
at this point. the main goal of this commit is to make modern gcc with
dwarf2 unwinding build without errors.

honestly, it probably doesn't matter how we define these as long as
they have members with the right names to prevent errors while
compiling libgcc. the only time they will be used is for propagating
exceptions across signal-handler boundaries, which invokes undefined
behavior anyway. but as-is, they're probably correct and may be useful
to various low-level applications dealing with virtualization, jit
code generation, and so on...
2011-02-18 22:03:03 -05:00
Rich Felker
e9417fffb3 add pthread_atfork interface
note that this presently does not handle consistency of the libc's own
global state during forking. as per POSIX 2008, if the parent process
was threaded, the child process may only call async-signal-safe
functions until one of the exec-family functions is called, so the
current behavior is believed to be conformant even if non-ideal. it
may be improved at some later time.
2011-02-18 19:52:42 -05:00
Rich Felker
d5ca067c7b add portable lchown (trivial to support and a few ancient things want it..) 2011-02-17 23:13:46 -05:00
Rich Felker
e882756311 reorganize pthread data structures and move the definitions to alltypes.h
this allows sys/types.h to provide the pthread types, as required by
POSIX. this design also facilitates forcing ABI-compatible sizes in
the arch-specific alltypes.h, while eliminating the need for
developers changing the internals of the pthread types to poke around
with arch-specific headers they may not be able to test.
2011-02-17 17:16:20 -05:00
Rich Felker
798a12ecc4 ucontext is no longer in the standard, so use gnu-friendly struct name
note that this header is still bogus and needs a lot of work and
factoring into arch-dependent parts...
2011-02-16 23:36:26 -05:00
Rich Felker
417dbe92cb some gnu software wrongly uses "struct siginfo" instead of siginfo_t... 2011-02-16 22:37:26 -05:00
Rich Felker
56b784d603 add to pthread.h: pthread_mutex_timedlock and sched.h, time.h 2011-02-16 21:21:26 -05:00
Rich Felker
571312de5f move stdio stuff that's not arch-specific out of bits 2011-02-15 19:47:22 -05:00
Rich Felker
f451462098 fix the types of some integer constant limits in headers 2011-02-15 19:15:45 -05:00
Rich Felker
6d36c2098b fix missing EXIT_* in stdlib.h after header cleanup 2011-02-15 17:33:52 -05:00
Rich Felker
1d72953787 feature test support in unistd.h 2011-02-15 16:28:36 -05:00
Rich Felker
26f3551419 prototype for gnu strcasestr (currently a stub) 2011-02-15 16:08:19 -05:00
Rich Felker
4e30249643 fix another error from header cleanup, missing size_t in time.h 2011-02-15 15:25:31 -05:00
Rich Felker
3eb9feaa88 fix broken signal.h from header cleanup 2011-02-15 15:10:00 -05:00
Rich Felker
44460c6d1e fix some type leakage (timer_t) from x86_64 commit 2011-02-15 14:32:46 -05:00
Nicholas J. Kain
1e12632591 Port musl to x86-64. One giant commit! 2011-02-15 07:32:09 -05:00
Rich Felker
13a026bd79 split off arch-specific stdarg.h stuff 2011-02-15 05:06:15 -05:00
Rich Felker
1355fdca7c preparing build system to handle ports - step 1 2011-02-15 00:33:23 -05:00
Rich Felker
8f4865c8d2 add previously-missing ios646.h 2011-02-14 21:59:38 -05:00
Rich Felker
ca1aa5bae9 more header cleanup and conformance fixes - string.h 2011-02-14 20:53:15 -05:00
Rich Felker
131b5be2f4 more header cleanup and conformance fixes - locale.h, time.h 2011-02-14 20:45:37 -05:00
Rich Felker
1322cb82a3 header cleanup, conformance fixes - signals 2011-02-14 20:33:54 -05:00
Rich Felker
c316b28445 update various bits headers for new linux additions
based on patch by nik
2011-02-14 20:03:55 -05:00
Rich Felker
c247ebdd98 more header fixes, minor warning fix 2011-02-14 19:33:11 -05:00
Rich Felker
e8362c8b51 major bugfix for sigset_t (it was mistakenly 1024 bytes instead of bits)
note that object files using sigset_t (or struct sigaction) need to be
recompiled to work correctly after this fix.
2011-02-14 18:45:58 -05:00
Rich Felker
74eea628cf extensive header cleanup for standards conformance & correctness
thanks to Peter Mazinger (psm) for pointing many of these issues out
and submitting a patch on which this commit is loosely based
2011-02-14 18:41:25 -05:00
Rich Felker
80695b1d1e begin namespace-cleanup of standard C headers 2011-02-14 05:10:10 -05:00
Rich Felker
1a9a2ff7b0 reorganize thread exit code, make pthread_exit call cancellation handlers (pt2) 2011-02-13 19:58:30 -05:00
Rich Felker
f38c154be2 added missing O_NDELAY 2011-02-13 19:02:57 -05:00
Rich Felker
e1d8d25a50 fix omission that kept sa_restorer from being used 2011-02-13 16:46:33 -05:00
Rich Felker
0b44a0315b initial check-in, version 0.5.0 2011-02-12 00:22:29 -05:00