oweals/musl.git
13 years agomake mktemp match the historic behavior, and update functions that use it
Rich Felker [Sat, 19 Feb 2011 14:40:07 +0000 (09:40 -0500)]
make mktemp match the historic behavior, and update functions that use it

the historic mktemp is supposed to blank the template string on
failure, rather than returning 0. just zero the first character so
that mkstemp and mkdtemp can still retry with O(1) space requirement.

13 years agofix major bug created from copying mkdtemp logic
Rich Felker [Sat, 19 Feb 2011 14:34:28 +0000 (09:34 -0500)]
fix major bug created from copying mkdtemp logic

13 years agoadd syscall wrappers for inotify
Rich Felker [Sat, 19 Feb 2011 07:52:29 +0000 (02:52 -0500)]
add syscall wrappers for inotify

13 years agocleanup cruft left from when kernel and user time_t disagreed
Rich Felker [Sat, 19 Feb 2011 07:28:42 +0000 (02:28 -0500)]
cleanup cruft left from when kernel and user time_t disagreed

13 years agoprototype wait3 and wait4
Rich Felker [Sat, 19 Feb 2011 07:26:11 +0000 (02:26 -0500)]
prototype wait3 and wait4

13 years agoadd missing WIFCONTINUED macro and improve WIFSIGNALED
Rich Felker [Sat, 19 Feb 2011 07:23:29 +0000 (02:23 -0500)]
add missing WIFCONTINUED macro and improve WIFSIGNALED

13 years agoprototypes for brk and sbrk
Rich Felker [Sat, 19 Feb 2011 06:02:46 +0000 (01:02 -0500)]
prototypes for brk and sbrk

13 years agosupport the ugly and deprecated ucontext and sigcontext header stuff...
Rich Felker [Sat, 19 Feb 2011 03:03:03 +0000 (22:03 -0500)]
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...

13 years agoadd pthread_atfork interface
Rich Felker [Sat, 19 Feb 2011 00:52:42 +0000 (19:52 -0500)]
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.

13 years agomajor improvements to temp file name generator
Rich Felker [Fri, 18 Feb 2011 22:04:56 +0000 (17:04 -0500)]
major improvements to temp file name generator

use current time in nanoseconds and some potentially-random (if aslr
is enabled) pointer values for the initial tempfile name generation,
and step via a cheap linear prng on collisions. limit the number of
retry attempts to prevent denial of service attacks even if an
attacker can guess the filenames.

13 years agoreformat mkstemp like mkdtemp
Rich Felker [Fri, 18 Feb 2011 21:32:33 +0000 (16:32 -0500)]
reformat mkstemp like mkdtemp

this is cleaner and makes it easy to impose a limit on the number of
retries later if it seems desirable to do so.

13 years agoadd portable lchown (trivial to support and a few ancient things want it..)
Rich Felker [Fri, 18 Feb 2011 04:13:46 +0000 (23:13 -0500)]
add portable lchown (trivial to support and a few ancient things want it..)

13 years agoprepare WHATSNEW for release v0.6.0
Rich Felker [Fri, 18 Feb 2011 00:15:08 +0000 (19:15 -0500)]
prepare WHATSNEW for release

13 years agodocument in config.mak sample that x86_64 is supported
Rich Felker [Thu, 17 Feb 2011 23:30:41 +0000 (18:30 -0500)]
document in config.mak sample that x86_64 is supported

13 years agoupdate WHATSNEW in preparation for release
Rich Felker [Thu, 17 Feb 2011 22:57:50 +0000 (17:57 -0500)]
update WHATSNEW in preparation for release

13 years agoavoid deleting the lib/empty file
Rich Felker [Thu, 17 Feb 2011 22:57:26 +0000 (17:57 -0500)]
avoid deleting the lib/empty file

13 years agoreorganize pthread data structures and move the definitions to alltypes.h
Rich Felker [Thu, 17 Feb 2011 22:16:20 +0000 (17:16 -0500)]
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.

13 years agonew solution for empty lib dir (old one had some problems)
Rich Felker [Thu, 17 Feb 2011 22:12:52 +0000 (17:12 -0500)]
new solution for empty lib dir (old one had some problems)

13 years agoimprove Makefile handling of git checkouts with missing lib/ and config.mak
Rich Felker [Thu, 17 Feb 2011 20:15:03 +0000 (15:15 -0500)]
improve Makefile handling of git checkouts with missing lib/ and config.mak

13 years agomake daemon try the operations that might fail before fork rather than after
Rich Felker [Thu, 17 Feb 2011 15:30:00 +0000 (10:30 -0500)]
make daemon try the operations that might fail before fork rather than after

13 years agodaemon should check for failures and return -1
Rich Felker [Thu, 17 Feb 2011 15:28:56 +0000 (10:28 -0500)]
daemon should check for failures and return -1

13 years agodon't compare elements with themselves during qsort.
Rich Felker [Thu, 17 Feb 2011 05:03:24 +0000 (00:03 -0500)]
don't compare elements with themselves during qsort.

this is actually a workaround for a bug in gcc, whereby it asserts
inequality of the keys being compared...

13 years agoucontext is no longer in the standard, so use gnu-friendly struct name
Rich Felker [Thu, 17 Feb 2011 04:36:26 +0000 (23:36 -0500)]
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...

13 years agosome gnu software wrongly uses "struct siginfo" instead of siginfo_t...
Rich Felker [Thu, 17 Feb 2011 03:37:26 +0000 (22:37 -0500)]
some gnu software wrongly uses "struct siginfo" instead of siginfo_t...

13 years agoadd to pthread.h: pthread_mutex_timedlock and sched.h, time.h
Rich Felker [Thu, 17 Feb 2011 02:21:26 +0000 (21:21 -0500)]
add to pthread.h: pthread_mutex_timedlock and sched.h, time.h

13 years agofix printf %n specifier - missing breaks had it clobbering memory
Rich Felker [Wed, 16 Feb 2011 23:19:46 +0000 (18:19 -0500)]
fix printf %n specifier - missing breaks had it clobbering memory

13 years agopatch by njk, simplifies thread register initialization for x86_64
Rich Felker [Wed, 16 Feb 2011 14:50:57 +0000 (09:50 -0500)]
patch by njk, simplifies thread register initialization for x86_64

It's not necessary to save any registers on the stack across syscall in
x86_64 __set_thread_area.  Don't waste cycles or bytes on it.

13 years agopatch from njk: make x86_64 __uniclone branchless.
Rich Felker [Wed, 16 Feb 2011 14:49:54 +0000 (09:49 -0500)]
patch from njk: make x86_64 __uniclone branchless.

13 years agofix compile failure: legacy cuserid needs to define feature test
Rich Felker [Wed, 16 Feb 2011 14:30:56 +0000 (09:30 -0500)]
fix compile failure: legacy cuserid needs to define feature test

13 years agomove stdio stuff that's not arch-specific out of bits
Rich Felker [Wed, 16 Feb 2011 00:47:22 +0000 (19:47 -0500)]
move stdio stuff that's not arch-specific out of bits

13 years agoprotect some limit constants with feature test macros on x86_64
Rich Felker [Wed, 16 Feb 2011 00:16:37 +0000 (19:16 -0500)]
protect some limit constants with feature test macros on x86_64

13 years agofix the types of some integer constant limits in headers
Rich Felker [Wed, 16 Feb 2011 00:15:45 +0000 (19:15 -0500)]
fix the types of some integer constant limits in headers

13 years agofix missing EXIT_* in stdlib.h after header cleanup
Rich Felker [Tue, 15 Feb 2011 22:33:52 +0000 (17:33 -0500)]
fix missing EXIT_* in stdlib.h after header cleanup

13 years agofeature test support in unistd.h
Rich Felker [Tue, 15 Feb 2011 21:28:36 +0000 (16:28 -0500)]
feature test support in unistd.h

13 years agofix directory reading on x86_64
Rich Felker [Tue, 15 Feb 2011 21:08:48 +0000 (16:08 -0500)]
fix directory reading on x86_64

13 years agoprototype for gnu strcasestr (currently a stub)
Rich Felker [Tue, 15 Feb 2011 21:08:19 +0000 (16:08 -0500)]
prototype for gnu strcasestr (currently a stub)

13 years agofix x86_64 wrongly reporting itself as ILP32 instead of LP64
Rich Felker [Tue, 15 Feb 2011 20:56:58 +0000 (15:56 -0500)]
fix x86_64 wrongly reporting itself as ILP32 instead of LP64

13 years agonews for upcoming release
Rich Felker [Tue, 15 Feb 2011 20:52:26 +0000 (15:52 -0500)]
news for upcoming release

13 years agofix another error from header cleanup, missing size_t in time.h
Rich Felker [Tue, 15 Feb 2011 20:25:31 +0000 (15:25 -0500)]
fix another error from header cleanup, missing size_t in time.h

13 years agofix broken signal.h from header cleanup
Rich Felker [Tue, 15 Feb 2011 20:10:00 +0000 (15:10 -0500)]
fix broken signal.h from header cleanup

13 years agosome docs fixes for x86_64
Rich Felker [Tue, 15 Feb 2011 19:52:11 +0000 (14:52 -0500)]
some docs fixes for x86_64

13 years agoremove standalone syscall cruft
Rich Felker [Tue, 15 Feb 2011 19:39:02 +0000 (14:39 -0500)]
remove standalone syscall cruft

this was originally written for an early draft of the library where
non-standard functions would reside in a static library separate from
the shared libc.so, which would implement a pure standard. the idea
was not to depend on an implementation-dependent __syscall_ret
function in the main libc. but it turned out to be better to put
everything in a single library for both static and dynamic linking
uses, and thus the (incomplete) remnants of this feature were just
enlarging the source and binary.

13 years agofix some type leakage (timer_t) from x86_64 commit
Rich Felker [Tue, 15 Feb 2011 19:32:46 +0000 (14:32 -0500)]
fix some type leakage (timer_t) from x86_64 commit

13 years agoOptimize x86_64 atomics to take advantage of 64-bitness.
Nicholas J. Kain [Tue, 15 Feb 2011 13:26:46 +0000 (08:26 -0500)]
Optimize x86_64 atomics to take advantage of 64-bitness.

13 years agoRemove __syscall_lseek from x86_64 syscall.h.
Nicholas J. Kain [Tue, 15 Feb 2011 13:21:47 +0000 (08:21 -0500)]
Remove __syscall_lseek from x86_64 syscall.h.

13 years agoUpdate x86_64 bits to mirror (modulo platform differences) the latest changes
Nicholas J. Kain [Tue, 15 Feb 2011 13:02:33 +0000 (08:02 -0500)]
Update x86_64 bits to mirror (modulo platform differences) the latest changes
to i386.

13 years agoPort musl to x86-64. One giant commit!
Nicholas J. Kain [Tue, 15 Feb 2011 12:32:09 +0000 (07:32 -0500)]
Port musl to x86-64.  One giant commit!

13 years agoyet another ugly legacy syscall rename...
Rich Felker [Tue, 15 Feb 2011 10:52:27 +0000 (05:52 -0500)]
yet another ugly legacy syscall rename...

13 years agofix getrlimit handling on 32-bit systems, and ease porting to 64-bit
Rich Felker [Tue, 15 Feb 2011 10:42:27 +0000 (05:42 -0500)]
fix getrlimit handling on 32-bit systems, and ease porting to 64-bit

13 years agosplit off arch-specific stdarg.h stuff
Rich Felker [Tue, 15 Feb 2011 10:06:15 +0000 (05:06 -0500)]
split off arch-specific stdarg.h stuff

13 years agocleanup socketcall syscall interface to ease porting to sane(r) archs
Rich Felker [Tue, 15 Feb 2011 09:40:40 +0000 (04:40 -0500)]
cleanup socketcall syscall interface to ease porting to sane(r) archs

13 years agofinish moving 32-bit-specific junk out of source files.
Rich Felker [Tue, 15 Feb 2011 09:12:19 +0000 (04:12 -0500)]
finish moving 32-bit-specific junk out of source files.

13 years agomove arch-specific internal headers into place
Rich Felker [Tue, 15 Feb 2011 09:00:40 +0000 (04:00 -0500)]
move arch-specific internal headers into place

13 years agofinish unifying thread register handling in preparation for porting
Rich Felker [Tue, 15 Feb 2011 08:56:52 +0000 (03:56 -0500)]
finish unifying thread register handling in preparation for porting

13 years agobegin unifying clone/thread management interface in preparation for porting
Rich Felker [Tue, 15 Feb 2011 08:24:58 +0000 (03:24 -0500)]
begin unifying clone/thread management interface in preparation for porting

13 years agomake pthread_create return EAGAIN on resource failure, as required by POSIX
Rich Felker [Tue, 15 Feb 2011 07:20:21 +0000 (02:20 -0500)]
make pthread_create return EAGAIN on resource failure, as required by POSIX

13 years agopreparing build system to handle ports - step 1
Rich Felker [Tue, 15 Feb 2011 05:33:23 +0000 (00:33 -0500)]
preparing build system to handle ports - step 1

13 years agoadd previously-missing ios646.h v0.5.9
Rich Felker [Tue, 15 Feb 2011 02:59:38 +0000 (21:59 -0500)]
add previously-missing ios646.h

13 years agoadd WHATSNEW file for 0.5.9 release
Rich Felker [Tue, 15 Feb 2011 02:58:53 +0000 (21:58 -0500)]
add WHATSNEW file for 0.5.9 release

13 years agoguard against hard links to non-ordinary-files when reading tcb shadow
Rich Felker [Tue, 15 Feb 2011 02:15:07 +0000 (21:15 -0500)]
guard against hard links to non-ordinary-files when reading tcb shadow

13 years agomore header cleanup and conformance fixes - string.h
Rich Felker [Tue, 15 Feb 2011 01:53:15 +0000 (20:53 -0500)]
more header cleanup and conformance fixes - string.h

13 years agomore header cleanup and conformance fixes - locale.h, time.h
Rich Felker [Tue, 15 Feb 2011 01:45:37 +0000 (20:45 -0500)]
more header cleanup and conformance fixes - locale.h, time.h

13 years agoheader cleanup, conformance fixes - signals
Rich Felker [Tue, 15 Feb 2011 01:33:54 +0000 (20:33 -0500)]
header cleanup, conformance fixes - signals

13 years agoupdate various bits headers for new linux additions
Rich Felker [Tue, 15 Feb 2011 01:03:55 +0000 (20:03 -0500)]
update various bits headers for new linux additions

based on patch by nik

13 years agoanother pointer signedness fix
Rich Felker [Tue, 15 Feb 2011 00:40:20 +0000 (19:40 -0500)]
another pointer signedness fix

13 years agofix some pointer signedness issues (this was invalid C)
Rich Felker [Tue, 15 Feb 2011 00:37:01 +0000 (19:37 -0500)]
fix some pointer signedness issues (this was invalid C)

13 years agomore header fixes, minor warning fix
Rich Felker [Tue, 15 Feb 2011 00:33:11 +0000 (19:33 -0500)]
more header fixes, minor warning fix

13 years agoensure standard functions mk[sd]temp don't depend on removed function mktemp
Rich Felker [Tue, 15 Feb 2011 00:18:06 +0000 (19:18 -0500)]
ensure standard functions mk[sd]temp don't depend on removed function mktemp

13 years agoput confstr.c with the other conf functions
Rich Felker [Tue, 15 Feb 2011 00:13:18 +0000 (19:13 -0500)]
put confstr.c with the other conf functions

13 years agomajor bugfix for sigset_t (it was mistakenly 1024 bytes instead of bits)
Rich Felker [Mon, 14 Feb 2011 23:45:58 +0000 (18:45 -0500)]
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.

13 years agoextensive header cleanup for standards conformance & correctness
Rich Felker [Mon, 14 Feb 2011 23:41:25 +0000 (18:41 -0500)]
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

13 years agobegin namespace-cleanup of standard C headers
Rich Felker [Mon, 14 Feb 2011 10:10:10 +0000 (05:10 -0500)]
begin namespace-cleanup of standard C headers

13 years agouse a more-correct integer type, and silence 64-bit warnings as a bonus
Rich Felker [Mon, 14 Feb 2011 04:38:21 +0000 (23:38 -0500)]
use a more-correct integer type, and silence 64-bit warnings as a bonus

13 years agoexplicitly release crt/* to the public domain
Rich Felker [Mon, 14 Feb 2011 04:32:01 +0000 (23:32 -0500)]
explicitly release crt/* to the public domain

13 years agofixed missing cast in the non-i386 version of shmat (preparation for ports)
Rich Felker [Mon, 14 Feb 2011 04:26:51 +0000 (23:26 -0500)]
fixed missing cast in the non-i386 version of shmat (preparation for ports)

13 years agocleanup multibyte stuff to remove ugly casts, sanitize the ptr align casts
Rich Felker [Mon, 14 Feb 2011 04:08:18 +0000 (23:08 -0500)]
cleanup multibyte stuff to remove ugly casts, sanitize the ptr align casts

13 years agocleaning up syscalls in preparation for x86_64 port
Rich Felker [Mon, 14 Feb 2011 03:45:42 +0000 (22:45 -0500)]
cleaning up syscalls in preparation for x86_64 port

- hide all the legacy xxxxxx32 name cruft in syscall.h so the actual
source files can be clean and uniform across all archs.

- cleanup llseek/lseek and mmap2/mmap handling for 32/64 bit systems

- alternate implementation for nice if the target lacks nice syscall

13 years agosyscall cleanup for umount2
Rich Felker [Mon, 14 Feb 2011 02:29:36 +0000 (21:29 -0500)]
syscall cleanup for umount2

13 years agouse umount2 syscall for umount (new targets lack old 1-arg umount)
Rich Felker [Mon, 14 Feb 2011 02:28:43 +0000 (21:28 -0500)]
use umount2 syscall for umount (new targets lack old 1-arg umount)

13 years agoreorganize thread exit code, make pthread_exit call cancellation handlers (pt2)
Rich Felker [Mon, 14 Feb 2011 00:58:30 +0000 (19:58 -0500)]
reorganize thread exit code, make pthread_exit call cancellation handlers (pt2)

13 years agoreorganize thread exit code, make pthread_exit call cancellation handlers
Rich Felker [Mon, 14 Feb 2011 00:50:47 +0000 (19:50 -0500)]
reorganize thread exit code, make pthread_exit call cancellation handlers

13 years agoadded missing O_NDELAY
Rich Felker [Mon, 14 Feb 2011 00:02:57 +0000 (19:02 -0500)]
added missing O_NDELAY

13 years agofix previous commit that broke sigreturn. looks like the asm is needed.
Rich Felker [Mon, 14 Feb 2011 00:01:43 +0000 (19:01 -0500)]
fix previous commit that broke sigreturn. looks like the asm is needed.

13 years agoensure that musl is compiled as C99 code & XSI option is available in headers
Rich Felker [Sun, 13 Feb 2011 21:48:39 +0000 (16:48 -0500)]
ensure that musl is compiled as C99 code & XSI option is available in headers

13 years agofix omission that kept sa_restorer from being used
Rich Felker [Sun, 13 Feb 2011 21:46:33 +0000 (16:46 -0500)]
fix omission that kept sa_restorer from being used

13 years agoensure that the compiler doesn't try to reorder around atomic ops
Rich Felker [Sat, 12 Feb 2011 05:26:24 +0000 (00:26 -0500)]
ensure that the compiler doesn't try to reorder around atomic ops

13 years agoinitial check-in, version 0.5.0 v0.5.0
Rich Felker [Sat, 12 Feb 2011 05:22:29 +0000 (00:22 -0500)]
initial check-in, version 0.5.0