diff -uNr dietlibc-0.20/.#CHANGES.1.312 dietlibc-0.21/.#CHANGES.1.312 --- dietlibc-0.20/.#CHANGES.1.312 Fri Jul 26 11:43:35 2002 +++ dietlibc-0.21/.#CHANGES.1.312 Wed Dec 31 16:00:00 1969 @@ -1,825 +0,0 @@ -0.19: - current gcc cvs makes __thread a keyword (Eric Troan) - be more strict regarding hostile DNS packets. - fix ia64 compile problems (Gerrit Pape) - make killpg a function and not a macro (broke bash 2.05b) - add sparc/strlen.S from Thomas Ogrisegg - add more space to ARM __jmp_buf in setjmp.h (Andre) - -0.18: - add stpcpy (from Thomas Ogrisegg) - check in mktime fix (from Luc Van Oostenryck) - add libm2.s from contrib to i386 (oops, how long has it been sitting - there?) - add truncate64 and ftruncate64 and prototype for truncate (only had ftruncate) - Michal Ludvig ported the diet libc to the x86_64 architecture (the - upcoming AMD Hammer chips!). You can't even buy the chips yet and - the diet libc already supports it! Amazing ;-) - Michal's patch also fixed several of the outstanding warnings. Thanks! - Andre sent a patch to add ARM profiling. He says it does not work - yet, but it's a start. - added getdents64 backwards compatibility and include it in large file - support #defines - perror now checks if the message is NULL like glibc (Thomas Ogrisegg) - ftell did not take ungetc into account (Kevin Ryde through Debian). - Thomas Ogrisegg sent a port to IA64! - sigaddset, sigdelset and setismember segfaulted for signal 0 (Gunnar Ritter) - Enrico Scholz reported several bugs in the header files. - change __malloc__ to __attribute_malloc__ - add pa-risc socketcall (but see TODO) (Felix J. Ogris) - fix *rand48 initialization (Kevin Ryde) - fnmatch infinite loop fix (Piotr Esden-Tempski) - make signal() into a sigaction wrapper function - add memrchr (Emil) - remove __attribute__((const)) from getpid() (Yuri Kozlov) - make getserv* also work if proto is NULL (Jens Låås) - now clone on parisc works (Thomas Ogrisegg) - getopt* fix from Thomas Walpuski - add syscall() to libcompat (Thomas Ogrisegg) - fix strncpy and strrchr i386 assembly versions for dynamic linking - (John K. Hohm) - allow short option grouping in getopt* (Ralf Wildenhues) - make the DNS resolver IPv6 transport capable (WANT_IPV6_DNS) - mention -v in diet.1 (Bryan Henderson) - auto-detect gcc 3 on i386 and remove compiler option warnings - putenv tweak (Thomas Ogrisegg) - add missing socket syscalls for PA-RISC and IA64 (Thomas Ogrisegg) - add cpio.h and tar.h (Thomas Ogrisegg) - change opendir/readdir/closedir from malloc to mmap (Thomas Ogrisegg) - cleanups from Florian LaRoche - -0.17: - fix several bugs in getservent_r - Gunnar Ritter reported the following: - moved tcgetpgrp and tcsetpgrp to unistd.h - adjusted lstat->lstat64 #define to make it work with function pointers - move __dietlibc__ #define from features.h to diet - Thomas Ogrisegg sent x86 memccpy and strncpy routines and introduced - an dietfeatures.h #define WANT_FULL_POSIX_COMPAT - Thomas also sent me profiling support (so far only on x86, but - profiling/PORTING describes what needs to be done for other - architectures)! - add contrib/dprof.c, also from Thomas. - Andreas Krennmair sent a patch to add the BSD regex interface to - libcompat - Andre noticed that __dtostr never sets first to false. Oops! - Andre has provided a largely untested patch that seems to fix the problem. - Igor Gilitschenski sent a patch for the "%8.7lx" issue. - abort did not flush all stdio streams - fix some nasty regular expression bugs - write a stupid malloc checker (contrib/debug-realloc.c) to help me - debug my regular expressions. Please read contrib/debug-realloc.txt - our i386 memchr,memcmp were broken for the count=0 case - fix DNS domain search - i386 memccpy exchanged esi and edi :-( I should do more checks before - accepting external code... - -0.16: - "diet -v" or "diet -Os" segfaulted without further arguments. - Andre found two very embarassing bugs in my four lines of md5 glue. - I need to get more sleep. - Thanks Ogrisegg found that ptrace does not work as documented and - provided a wrapper that emulates the glibc behaviour. - Dirk Engling saved 8 bytes and 4 cycles in the ARM clone() - fix ptrace.h for S/390 and ARM - provide a PORTING document so we don't lose track of which file need - to be touched to port the diet libc to a new platform. - remove a few warnings - provide a prototype for usleep. - make __dtostr work on ARM by using long instead of long long. - Idea by Dirk Engling. - fix an argument counting bug in *scanf (Thomas Ogrisegg) - Forgot an #endif in asm/sigcontext.h (Mike Castle) - Kurt Garloff sent in patches to - fix struct termios on non-x86 architectures - printf("%+05d\n",500) was broken (Raimar Falke told me, Olaf fixed it) - create libcompat.a (and move daemon to it) - add getdelim and getline - *printf now recognize 'z' integer flag (and ignore it) - Dirk Engling provided a strcpy.S for ARM. - Olaf: fixed *scanf familie. It hadn't wored with "long long". - Hans Lermen fixed i386/getenv.S - diet -Os no longer discards -fpic and -fno-pic - fix i386 rand/random to use correct RAND_MAX (thanks, Jaroslav - Macodiseas) - sys/ipc.h now includes sys/types.h - Olaf: started to make the sparc64 port - scandir should not sort if compar() is NULL (reported by Andrea Marrosu) - -0.15: - vfork sucks. I reverted to the old behavior where vfork==fork. - fix bsearch (and remove i386 assembly bsearch, needs to be redone). - Thanks Ogrisegg sent a patch to make the PA-RISC unified syscall - thread-safe! - remove vfork and add alarm to dynamic syscalls. - fix diet-dyn to link in dyn_dstop.o and not dyn_stop.o. - The MD5 code generated unaligned accesses when passed an unaligned - pointer on little endian ARM and MIPS. - MIPS unified syscall didn't compile anymore. - Put up new mipsel target to cross compile for little endian mips. - The mips target will again explicitly set endianness to big endian. - Compiling natively on a MIPS box should not touch the endianness. - Duh, when we removed return0, we broke tzset when the time zone parser - was disabled. Uwe Ohse noticed this. Thanks! - Fix gethostbyname to match host names case insensitively in /etc/hosts. - Oops, this was reported 6 weeks ago but I overlooked the email. - Thanks, Denis Rachal! - vsnprintf's zero termination was broken. - Uwe Ohse found a few more bugs: - Remove WANT_BUGGY_GLIBC_STRSEP. The Linux man page is broken, glibc - does it correctly. - Make inet_aton use strtoul instead of strtol - fdopen would close the file descriptor if it could not malloc the - buffer. - strftime updates. - Make _FILE_OFFSET_BITS includes -Wundef clean - Andre found a typo in endian.h for big endian mips - Ryan told me that fmod was not included in libm. Oops. - strstr(whatever,"") returned NULL, not whatever. Found by a new test - suite entry for strstr that I wrote. - Thomas Ogrisegg suggested or sent patches for the following: - add for profiling support. - make strncpy a #define in string.h to save a few bytes. - an i386 assembler getenv implementation (roughly half the size) - add grantpt, ptsname, unlockpt - add a getenv test suite entry. - Andre contributed an ARM assembler md5 implementation and he fixed mmap - on ARM. - add glibc macro names in sys/reboot.h. Mentioned by Laurent G. Bercot - getservent_r did not parse lines without aliases. Thanks, Jaroslav - Macodiseas! - fix MIPS start code (argv[0] was always corrupt) - removed annoying -Wconversion gcc switch - add -v to diet.c and fix MIPS CFLAGS in diet. Thanks, Johannes Stezenbach - Kurt Garloff sent these diffs: - add fdatasync (and make it a pthread cancellation point) - numerous alpha issues, like using .quad instead of .long for - offsets, change strip to -strip in Makefile (so a failing strip does - not abort the make), try to be more friendly to the gcc 2.96 that - SuSE 7.1 AXP ships with. - -0.14: - fix brk again (missing __brk, trivial oversight) - a new i386/atol.S that is 4 bytes smaller (and faster, too!). Thanks, - Thomas Ogrisegg! - Thomas also contributed a PA-RISC port including testandset, so - libpthread will work once we implement clone! Great work, Thomas. - made the fake locale more believable. - If you need gettext, use http://www.ca.postgresql.org/~petere/gettext.html - moved _exit into the unified syscall on x86. - Uwe Ohse found many more bugs: - getpass EINTR handling, ttyname, sysconf_cpus with SLASH_PROC_OK, - liblatin1 was more or less completely broken if you gave it chars as - arguments, not ints (signedness). execvp had a buffer overflow in - case a PATH element exceeded PATH_MAX, but it's not a security - problem since setuid programs need to set their path to some known - value anyway. - hasmntopt did not work with foo=bar style options - Uwe also improved ftw's stack usage. - Put movl instead of popl rationale in comment in i386/unified.S since - three people have suggested saving a few bytes with popl now ;) - I discovered __attribute__((malloc)) and started using it. For gcc 3, - it improves the optimizer when functions return malloced pointers. - Steven Rostedt pointed out that my setvbuf was broken with regard to - size==0 and sent a patch to fix it. - Thomas Ogrisegg made setenv smaller. - Olaf: implemented the parisc clone and an atomic testandset, modified the - libpthread to respect the parisc UPgrowing stack. still non functional, - because the unified syscall uses errno :( - tcgetospeed read from the wrong termios field. Thanks, Gunnar Ritter! - Fixed asprintf (relied on vsnprintf(NULL,...) to return length but - don't write anything which was no longer the case. It also - allocated one byte unnecessarily, which Uwe Ohse found. - Fix ttyname (readlink does not \0-terminate, forgot to do that). - -0.13: - add readdir64 and automatic mapping if _FILE_OFFSET_BITS == 64 - make diet not include the linker safeguard stuff when preprocessing - Olaf: port to S/390! - me: fix vfork (it was put into dietlibc.a twice) - res_query did not initialize last - diet (not diet-dyn, of course) now adds -static to the gcc command line - fixed fflush on input streams (tic from ncurses exposed this) - duh, there is an alarm system call, too, so we use it and not setitimer - fix comparison in gmtime_r that caused Jan 1 to be converted to Dec 32. - rewrote __dtostr (it also has one more argument now) - Thanks to Erik Troan for bringing these to my attention: - make putenv behave like glibc (putenv("HOME") == unsetenv("HOME")) - fix strncat for the case where n == 0 (security implications?) - fix bsearch (it didn't find the very last element in the array, same - bug in both the C and the i386 assembly version). - fixed FNM_PATHNAME in fnmatch - fix brk (the syscall was documented incorrectly in the Linux man page) - Thanks, Thomas Ogrisegg! - added negated character classes to fnmatch (not required by POSIX) - make the utmp routines open utmp read-only if read-write doesn't work. - remove syscalls.c directory, it is obsolete now with unified syscalls - -0.12: - more contributions from Frank Klemm. - iconv can now do UCS-2, too. - Imported several x86 assembly routines from Wouter van Kleunen. - Lots of bug fixes, and several more i386 specific versions of common - routines to make them smaller. - add memmem (a GNU extension that looks useful) - several changes from Michal Ludvig: inttypes.h gets C99 macros, - add pivot_root syscall, %n for *scanf. - add adjtimex (thanks, Laurent BERCOT) - add Frank Klemm's optimized md5 - add -Os option to diet (see diet.1). - several IPv6 constants and HZ were missing, thanks Johannes Kloos. - add 32-bit uid/gid syscalls. - add rand48 (thanks, Johannes Kloos) - fixed a lot of bugs in getopt* (thanks, Johannes) - add strxfrm and tweak limits.h. glib-1.3.8 now compiles without changes. - add a few more module syscalls. modutils-2.4.9 now compiles without changes. - fix gethostent alias list termination. Major oops. - add execle and two DNS constants (from Johannes Kloos). - opendir did not close-on-exec (thanks, Laurent Bercot). - DNS will now properly signal errors and set h_errno. - A few more cleanups (thanks, Andreas Jabs and Matthias Andree). - Added an uber-cool linker safeguard feature! Idea by Matthias Andree. - If you enable WANT_SAFEGUARD in dietfeatures.h, diet will include an - external reference to a symbol that is only in the diet libc. So, - when you accidentally link a diet libc compiled object file against - glibc, the linker will barf. This will bloat your object files, but - you can remove all the references with "strip -R .note" from - the binaries in the end (which you should do anyway). - fix ARM unified syscall (select did not work). - add getpwent_r ala glibc and replace getpwent - do the same for getgrent and getspent - remove entlib (new code is smaller) - rewrite getserv* to use parselib (and provide ..._r, too) - add getpwnam_r and getpwuid_r - rewrite getproto* to use parselib (and protive ..._r, too) - Olaf muddled with the dynamic linker. It's a clean-room - implementation in the sense that it once worked for Olaf in a clean - room ;) - add if_nameindex and if_freenameindex. - fixed arm unified syscalls to work with current binutils (; is no - longer a line separator but starts a comment, switched to .macro) - changed all st_[cma]time types to signed long so comparisons against - LONG_MIN will work correctly. (GNU tar does this) - fixed two bugs regarding ungetc. - add getusershell, setusershell, endusershell (for vs_ftpd) - add prctl, dirfd (also for vs_ftpd) - fixed strftime (was completely hosed) - added real make install target - -0.11: - fix major oops in DNS routines (only with WANT_FULL_RESOLV_CONF enabled). - fix vsscanf bug (Thanks, David Chappell). - add floor, ceil and memchr prototypes. - add __builtin_expect and expect #defines for gcc versions below 3.0 - cleaner errno vs __errno_location handling - add placeholder iconv (iconv_open will always return EINVAL) - try to remove kernel 2.4 header dependency in IPv6 sockaddr_in6 - initialization of getaddrinfo. - fix vsnprintf %X (printed lower case) - I wrote a new getopt. It appears to actually work (it is POSIX - compliant, it does not sort argv like the GNU version) and is only - a little over 300 bytes on x86. - Guillaume Cottenceau just wrote me that strncat should be even more - broken than it already is: it should append n bytes AND THEN \0! - I wonder how many programmers have produces off-by-one errors here... - Fix regexec offset return. autoconf now believes that diet libc has - POSIX regular expressions. - Fix fnmatch (a/b/* matched a/b/c/d even if FNM_PATHNAME was set) - Fix regular expression match for x* when there is no x at all. - Fix memory leak in error case in gethostbyname(2|). Thanks, Dietz Pröpper. - Add %h to vsnprintf. - Add FAQ. - Make %h work for signed numbers and add %hh to vsnprintf. - initgroups ignored the group argument :-( - remove printf references and nested functions from glob. - added an errno in libpthread that will display a prominent linker - warning. - started getting rid of kernel headers. Big task! :-( - add res_mkquery. The diet libc can now compile and link mtr. - Olaf: added a lot of code in libdl (not yet complete), changed the - startup code to make it work with his libdl and ld.so (needs still work - too) - __dns_readstartfiles only took the first domain or search path. - Thanks, Anthony de Boer - Olaf: added clone and a new unified_syscall for PowerPC - also dynlinker is now available (i386 only at this time) - crufted together a stdarg.h implementation from the various gcc headers. - implement getopt_long (ugh, the GNU people need professional help) - fixed word delimiters in regex (they looked for space, i.e. "," did - not work as delimiter) - errno.h now declares sys_errlist and sys_nerr. - added mkdtemp. - Uwe Ohse reported all of the following bugs: - ttyname should return 0 if !isatty. - realpath returns NULL if "." cannot be opened - putenv erroneously accepted (and mishandled) entries without "=". - popen returned 255 instead of 127 if /bin/sh could not be run. - fgetc did not set the internal EOF indicator on EOF. - bsearch contained an assumption about integer arithmetic overflow - behavior. - system did not set SIGCHLD and thus contained a race. - popen did not set close-on-exec and could leak an fd on malloc error. - daemon did not check whether open returns an fd below 3 - perror did not save errno. - Olaf: Peter Jones reported some problems with perror; strerror had the - same problem. - Peter also posted a patch to atexit/exit. With some modifications it is - now implemented. - Unbuffered stdio and ungetc can no longer be disabled. I will try to - implement part of it using ELF weak symbols. - Added minimal sysconf (tehe) from David Chappell. - Added overflow handling for strtoul and strtol. - Added WANT_ETC_HOSTS in dietfeatures.h and made gethostbyname/2 use - it before falling back to DNS if enabled. - Added a littie backwards compatibility cruft for gpm (man, do these - sources stink!) - Added openpty. - Squeeze a few bytes off the is* routines, courtesy of Peter Jones. - Fix fseek return value. - Add dirname and basename. - Add a few i386 math routines contributed by Frank Klemm. - Fixed getservent (did not allow _ and - in the aliases). - Thanks, Oden Eriksson - Added a float.h so configure believes we have ANSI header files. - Fix a lot more stdio bugs that Uwe Ohse pointed out. - Olaf: has added a new scanf and printf core that is suitable for all - scanf and printf function implementations - Imported a few more functions and optimizations from Frank Klemm (he - also rewrote dtostr to have more precision) - Olaf: checked in a new sig* function family (based on rt_sig*). - legacy <2.2 signal-handling doesn't work at the moment. - Made rudimentary iconv that can convert back and forth between - iso-8859-1, utf-8 and ucs-4 (for debugging). - Thanks to Markus Kuhn for the excellent utf-8(7)! - -0.10: - update getpagesize. - add personality. - add "%*s" and "%*.*s" support to vsnprintf. - add putchar (apparently arm-linux-gcc will substitute printf("\n") - with putchar('\n') behind your back...?! - import include/scsi/ from glibc. - add iopl. - add execl and sigdelset prototypes. - add getopt_long stuff to getopt.h (may compile but won't link). - add RPC headers (no code yet). - add mlockall, munlockall - make "diet gcc foo.c" work. - added Sun RPC code and removed as many warnings as possible in a - heroic act of self-mutilation. - added getproto* and getdtablesize for the RPC cruft :-( - added getpass. mount from util-linux actually compiles now! - fix the sig*set routines. mount actually works now *bg* - fix fwrite dividing by zero when trying to fwrite n records of size 0. - added an initial regex implementation (3500 bytes!!!). - add llseek and lseek64 with optional lseek fall-back. - add res_init. - add asprintf (ugh, what an ugly function). - expanded arpa/nameser.h to include backwards compatibility defines - add ut_name alias to ut_host in struct utmp. - add inet_ntop, inet_pton, gethostbyname2. - add sysinfo, recvmsg, sendmsg. - add endmntent, getmntent, setmntent. - fix fnmatch (thanks, Guillaume Cottenceau!) - add setenv. - remove __restrict from mntent.h, add __restrict__ removal alias for - older gcc versions in sys/cdefs.h. - add rlim_t, sig_atomic_t declarations. - add sigsetjmp #define for __sigsetjmp (oops). - (Thanks to Chris Siebenmann for these three bug reports) - add a gruesome hack to printf floating point to accept %f and kludge - together support for %.2f. Don't look at the code, please! - fixed tcsetpgrp (oops, this is embarassing! Thanks, Chris Siebenmann) - imported fix for entlib by Jeff Garzik. - add glob implementation from Guillaume Cottenceau (Thanks!!) - add libdl fragments from Olaf (Yeah! One step closer to dynamic linking!) - add REG_ICASE and word start/end handling to my regular expressions. - my regular expressions now actually match substrings (i.e. "foobar" to "bar"). - wrap getcwd to comply to man page (the syscall returns the number of - bytes, not the buffer) - add realpath. - fix vfprintf. - fix *scanf %s zero termination. - add abs, labs, llabs. - add , ioperm syscall. - add flock to - fixes to bsearch and the regular expressions. - add fake herror. - add scandir and alphasort. - add killpg - implemented a gross hack to make libpthread compile when - dietfeatures.h does not define WANT_THREAD_SAFE (it's empty then). - add getaddrinfo and freeaddrinfo (man, what a fucked up interface!) - fix sigsuspend (syscall had completely fscked up arguments!) - RLIM_INFINITY from the kernel is broken. Thanks to Chris Siebenmann - for sending a patch. - add getserv*. - add WANT_FULL_RESOLV_CONF so that the DNS routines use "domain" and - "search" from resolv.conf. - -0.9: - fixed initgroups (oops) - Cleanup appending file open for stdio (thanks, James Antill) - imported vfprintf fix from James Antill. - add fnmatch - change index, rindex and bcmp as weak ELF symbols (were #defined before) - Olaf added character classes to *scanf. - Put object and library files into a separate directory (bin-$ARCH). - Add "cross" make target to make all architectures. - Add "diet" program and man page. - Add getgrnam, getgrgid - Add cfmakeraw (Thanks, Antonio Musumeci) - localtime won't call gettimeofday when the tzfile parser is used. - -0.8: - vsnprintf(0,...) estimated the length of strings with a padding width - incorrectly. - new reboot() from Olaf. - added prototypes for getsockopt and setsockopt. - added experimental sem* and shm* - define EXIT_SUCCESS and EXIT_FAILURE - added setvbuf (only changes mode, not buffer) - added dietwarning.h (woohoo, linker warnings!) and used it to warn of - insecurity (system, sprintf) or bloat (printf and stdio). - added qsort() and bsearch(). Benchmark on 1000 random ints: - glibc: 679414 cycles qsort and 3352 cycles bsearch - diet libc: 300010 cycles qsort, 553 cycles bsearch - I have no idea why glibc is so slow. - added __isnan (references by libm.a from glibc). - added popen() and pclose(). Now the diet libc can link slsh (from - S-Lang!) - corrected usleep. It was more of an msleep until now. - corrected __dtostr (it looped when trying to format "0.0"). - several fixes to stdio (thanks to S-Lang's excellent test suite!) - added ungetc (does it work?) - added inet_aton (yuck!) - added gethostbyname, gethostbyaddr, gethostbyname_r and gethostbyaddr_r - added h_errno and __h_errno_location - added inet_ntoa - added setpgrp and getpgrp, strsignal and execv (thanks, Olaf) - add bcopy, index, rindex macros - add isgraph and isxdigit - add strftime (ugh!!!) - Olaf fixed strftime, gmtime_r leap year bug. - Jeff Garzik contributed a spec file. I put it in contrib and hope - everbody knows what to do with it... - Olaf checked in a ton of libpthread stuff. - added mkstemp using /dev/urandom (harder to guess than getpid()). - add large file backwards compatibility support (so gzip will run on - kernel 2.2 and 2.0) - added shutdown - added nice - added pseudo-locale support for is* (they are now weak aliases, - isupper -> __isupper_ascii etc). So, for example, liblatin1 can - overwrite the default is* functions. - added liblatin1.a - added tzfile implementation (does it work for anyone else?) - added syslog(3) (thanks to Rene Müller!) - Jeff Garzik contributed getgr*, getpw* and getsp* in one tiny package. - Thanks! - merged duplicate code in execv and execvp into exec_lib.o - -0.7.2: - added several prototypes to already implemented functions and - . Thanks for Abraham for pointing this out. - added prototypes for process group and dup syscalls. Thanks to - Abraham again. He also contributed an implementation for daemon(), - an ugly BSD hack. I decided to diversify the lib/ directory a - little and now created a libugly/ directory for stuff like system() - and daemon() ;-) - added libstdio and moved all that stdio crap from lib/ there. The - idea is to start separating now what we will separate for shared - libraries anyway. - optimized x86 unified-syscall by Olaf. - added limits.h, removed __ARCHBITS from endian.h (use __WORDSIZE from - limits.h instead) - added remove.c and enough cruft to limits.h to make it compile lzo, - lzop and bzip2. - added mktime, asctime_r, asctime and ctime (needed for gzip). - Someone will need to implement a reader for the glibc localtime file - format some day (man tzfile, ugh!) :-( - added unlink prototype to unistd.h. - added gmtime and gmtime_r. - fixed sparc unified syscall error handling (please upgrade!). - removed readdir glibc compatibility cruft. - removed stat glibc compatibility cruft. - oops, my fread was broken for pipes. - Olaf found a bug in pipe() for sparc, too. - -0.7.1: - optimized away the static arrays from __ltostr and __lltostr. - optimized away the static arrays (and more!) from strtoul and strtoull. - added system (by Olaf). - added tolower and toupper - added getopt from Olaf (~600 bytes on x86!) - added clone for mips (by Olaf). - fixed longjmp and setjmp on sparc not to require glibc include files. - added pause for all (by Olaf). - added __attribute__ ((__const__)) to ctype.h - added isupper and islower. - added putc and putchar as macros. - added strcasecmp and strncasecmp (thanks to Abraham vd Merwe for - insightful discussions and patches I partially used for the last three) - added getpriority and setpriority (also by Abraham) - oops, I broke strtoul in a recent optimization attempt. - oi, setjmp and longjmp were broken on other platforms, too! - Thanks to Sébastien Côté for reporting this. - -0.7: - clone support for i386,alpha,arm and sparc by Olaf. - Initial dynamic loading glue for i386, also by Olaf. - We don't have a dynamic loader yet, so this is not yet usable. - added readv, sigdelset, sigaltstack, sigfillset, sigismember, usleep, - vsprintf, writev, all by Olaf. - imported readdir fix from Guillaume. Mhh, can the kernel interface - really be this broken? - Found a kludgy way to detect whether the kernel includes define struct - stat64 (they also define STAT64_HAS_BROKEN_ST_INO). If this does - not work for you, please tell me! - Removed bogus __seek_types enum, it's a bunch of #defines now. - Fixed stdio line buffering. The code was already there but I forgot - to mark stdio and stdout as line buffered. This should really be - done dynamically using isatty, though. - Removed superfluous "if (1)" in execvp.c - -0.6.14: - *scanf did not append the 0 byte for %s. - added creat and changed creat to call open directly instead of open64. - did for fread what 0.6.10 did for fwrite. - repaired buffered stdio a little (line buffering is still not - supported). - [All of these bugs have been reported by Guillaume. Thanks!] - added __pure__ to strchr and strrchr in - -0.6.13: - included COPYING to make clear that the diet libc is covered by the - GNU General Public License (and _not_ the LGPL). That means that - you need to obtain a license from me if you want to use the diet - libc in a proprietary program that you want to distribute. - The x86 unified syscall swapped arguments #4 and #5 and noone - noticed until now! Thanks to Guillaume Cottenceau for reporting - this! - The malloc had a subtle bug with small allocations that could cause - segfault. Guillaume reported it, Olaf fixed it. - -0.6.12: - added assert, statfs and fstatfs - added include/net/if.h so fget compiles again. - -0.6.11: - added putenv. - -0.6.10: - fixed fwrite. It returned the number of bytes written, not the number - of records. Thanks to Albert D. Cahalan for pointing this out. - fixed fgets. It returned EOF on empty lines. Thanks, Erik Frey. - added brk and sbrk. harold@nb.com.sg made me do it. - -0.6.9: - fixed execvp not to return on ENOENT - did for {open|read|close|seek|tell}dir what I did for stat before. - The glibc compatibility part is currently non-functional. - fixed white space handling in sscanf " (" would not match " (". - fixed printf to accept 'l' flag. - fixed getpwuid (ignored last line) - -0.6.8: - Olaf contributed initial thread-safe syscalls for i386, alpha, sparc, - mips and arm. I did the one for ppc. They can be enabled in dietfeatures.h. - added strlcpy and strlcat from OpenBSD. - added stat64, fstat64 and lstat64. - added endian.h and made ending of strlen.c endianness-aware - added string routines size tweak to dietfeatures.h. Most of the - string routines have been unrolled. This is up to three times as - fast but creates up to three times larger code. Now you can disable - the unrolling. - added sendfile. - I also added pread. It works on x86 and sparc but not on ppc and mips. - I have no idea what's going on. strace disagrees with the kernel. - Can anyone help? I asked the Linux kernel mailing list for help, too. - added a few aliases of the type __libc_open for open. nm on - libpthreads.so indicates that we will need them. - -0.6.7: - the sources now compile without warnings with -Wall. - printf now prints "(null)" when %s is passed NULL. This can be - removed with WANT_NULL_PRINTF in dietfeatures.h - added vfprintf, execl, ttyname. - stat, lstat and fstat are now #defined to __dietstat, __dietlstat and - __dietfstat so they can use the normal kernel struct stat. - stat, lstat and fstat are now C wrappers that convert to the glibc - struct stat. So we can avoid that overhead for programs that use - dietlibc headers. - -0.6.6: - changed the Makefiles so you can now set CFLAGS on the command line - added memccmp (analogous to memccpy) and strncmp. - Olaf fixed another bug in the sparc unified syscall. - Paul Clifford contributed a C version of his strlen.S that is much - more efficient than the previous strlen on all platforms! It also - looks like technology from Roswell. ;-} - added a "real" stdio. Well, almost. Please contribute! - added dietfeatures.h so you can remove features you don't need. - removed debug code from vsnprintf that changed \0 to ' ' (argh!). - stdio now works with simple programs and minigzip from libz. - stdio uses some major trickery to avoid linking the stdio, stderr and - stdout (and reserving space for them) when they are not used. - -0.6.5: - Red Plait found several bugs in diet libc, - most of them bugs in the new header files, but also missing sigset - functions. - Paul Clifford contributed an assembly strlen.S for ARM and fixed - several bugs. - Fixed ppc/setjmp and mips/pipe. - Olaf contributed a new sparc unified syscall. - -0.6.4: - declared is* static inline in getservent. - added assert_fail, strtoul, isalpha, isdigit, isalnum, isascii. - changed strlen to return 0 when passed NULL. - new, much smaller unified syscall for MIPS. Thanks to Olaf the Mad - Scientist who actually implemented this without access to a MIPS - box, just from reading the architecture manual. And it worked out - of the box. - started a set of system includes, mainly so that I can use lcc and - my alpha-linux cross compiler (which is unable to cross-compile - glibc). diet libc can now be compiled without any include files - from a normal libc. The includes do declare more than diet libc - currently delivers and they are still far from complete for real - applications. - I will only add assembly versions that are smaller _and_ faster than - the C version. Larger routines are only accepted if they are called - very often and are substantially faster. - added i386 assembly strchr, which is smaller and faster than the old - version. It is, however, larger than the version contributed by - proton (thanks, anyway). - added i386 strlen (31% faster, 14% smaller) - "make t" will now create a map file called "mapfile". - -0.6.3: - added sys_errlist, strerror and perror - added isblank - added atol - -0.6.2: - mmap for ARM didn't compile. Thanks, Paul! - -0.6.1: - split mmap into the architecture specific subdirectories. - getenv now copes with environ==NULL, thanks Paul Clifford. - Paul also contributed a smaller ARM startup code. - -0.6: - strcat returned the wrong result. Thanks, Dietz Pröpper. - strtod now understands a negative exponent (oops, thanks Bertram Barth) - Port to arm-linux-gnu, but on the Netwinder I use for testing the - __dtostr does not work (I have no idea why!) - The MIPS port now uses (much smaller) non-PIC code. That means that - the applications you link against diet libc also have to be compiled - non-PIC. I suggest copying the CFLAGS from the diet libc Makefile. - Thanks to Ralf Bächle for helping me with this! - I made subdirectories for the architectures and use VPATH to override - VPATH so that make finds the source file automatically. That should - simplify the sources greatly. - Olaf Dreesen contributed Alpha support including setjmp and longjmp! - ARM and MIPS now also have setjmp and longjmp - "compile" and "load" are now make targets. Use them for djb programs. - added contrib/elftrunc.c which will remove unnecessary ELF headers. - Again, contributed from Olaf. Great work! - -0.5.12: - printf also does signed numbers. - If you don't use atexit, dietlibc now does not link exit, only _exit. - *printf now correctly returns the number of bytes written. - Olaf contributed experimental sscanf and vsscanf implementations. - If passed NULL as buffer, snprintf will not write anything but still - return the number of bytes it would have written. - Initial MIPS port! (Oh, the agony!) - No setjmp and longjmp support yet! Please contribute! - I even implemented unified syscalls for MIPS. Still, MIPS code is - almost twice the size of SPARC code. If anyone knows why: please - tell me! - -0.5.11: - I implemented new unified syscalls for x86, sparc and ppc, this time based - on .s files and not .c files, and I moved the syscalls into - subdirectores to clean the dietlibc sources up a little. - A binary consisting of printf("%s is %d\n","olaf",23) is now - 2864 bytes on sparc - 2488 bytes on intel - I kludgily implemented fprintf(stdout,... and fprintf(stderr,... - to make a few more applications work. - Olaf Dreesen also implemented some unified syscall stuff for x86. - He discovered that with our unified syscall interface it actually - costs <10 bytes total to make all system calls thread safe! - I implemented atexit() (can register up to 4 callbacks). - I implemented strtod and __dtostr (the opposite). Now we can add - floating point support to vsnprintf and sscanf! - -0.5.10: - I actually saw that I can not only merge the errno handling code of - the system calls on x86, I can also merge the rest (including the - arguments) except for setting the system call number. All those - system calls are now just a jump to a unified system call handler. - I got rid of x86openclose again. The savings are substantial: - chown from embutils went from 7664 to 7184 bytes! - If I'd move the system call wrappers to assembly language, I could - even reduce the alignment (does not matter since it's just a jump - anyway) and get rid of the "ret" behind each jump (one byte per - system call!) - -0.5.9: - added memchr, strpbrk, strstr, strtol, isspace (hehe) - fixed strdup - fixed return values for strcpy and strcat (thanks to Norbert Berzen) - Olaf Dreesen contributed a strtol and initial {sn|vsn|}printf implementation - (no signed integers, only strings and unsigned integers (but - supporting octal, hex and decimal). Thanks, Olaf! (by the way: - that code must be wonderful, I don't understand it at all *bg*) - Olaf's printf does understand padding like in "%08d" and "%8d" and - automatically pads pointers with '0'. - Rewrote the x86 start code, old: 22 instructions, new: 12 instructions. - Thanks to proton for inspiration on this. - The new x86 start code also does not reference exit any more, thus saving - 64 bytes for executables that don't call exit explicitly. - [insert maniacal laughter] EVERY BYTE COUNTS!1!! ;-) - Moved errno and environ to start.S, saving no byte binary size but - speeding up compilation and slightly shortening dietlibc.a ;-) - For x86: joined open and close into one assembler file, sharing the - errno handling. This is a feasibility test and it actually saves a - few bytes. I think I will reimplement the _syscall[1-6] macros on - all platforms now to share the errno handling code for them. - -0.5.8: - fixed strchr to be able to look for 0. - - added _llseek, ftruncate, getpgid, getresgid, getresuid, getsid, - memccpy, memmove, mprotect, setregid, setresgid, setresuid, setreuid, - strncpy, swapon, truncate, strtok, strtok_r, strspn, strcspn (all - contributed by Olaf Dreesen) - - added execvp, getcwd - - fixed __xmknod - - Note: can it be that the ftw interface really is so broken that I - cannot implement it without having to implement some searching data - structure? I included an experimental ftw implementation that will - not follow symlinks. - -0.5.7: - oops, if_nametoindex was broken! - -0.5.6: - ported to ppc-linux. - fixed i386 sigsetjmp (I mistyped the function name) - included sigjmp.c - -0.5.5: - added wait, sys_siglist, longjmp/setjmp/sigsetjmp for i386 and sparc - actually, it wasn't fork that wasn't working for sparc, it was pipe. - I fixed it now. - dietlibc/SPARC assumes -msupersparc (does not provide div, mul, etc) - fixed readdir to use getdents and not the intel inline asm - -0.5.4: - ported to sparclinux (sparc32 only). Beware: does not work yet. - added raise, abort, readlink, strcat, geteuid, geteuid, wait3, access - -0.5.3: - added tcsetattr and getenv to compile e3 - -0.5.2: - added vhangup, tcgetattr, isatty and memcmp for fgetty - (http://www.fefe.de/fgetty/) - added localtime from uC-libc. - -0.5.1: - stat and friends actually work now. Yuck! Another case of - translation between kernel and userland. Why can't the kernel - people and the libc people simply agree on a standard? - removed many unnecessary includes to speed up compilation. - added -fomit-frame-pointer and i386 compilation target to reduce code size. - inlined socketcall to reduce code size. - "load" and "compile" are examples for djb code. - -0.5: - Olaf Dreesen contributed a much smaller implementation of malloc and friends. - each object file is now treated with "strip -x -R .note -R .comment" - split each system call into a separate object file - added ntohs, htons, alarm, if_indextoname and if_nametoindex - -0.4.1: - oops, the strchr implementation was wrong. Thanks Jens Laas! - -0.4: - copied opendir and friends from uC-libc. - added getservent and getservby* in gerservent.c - -0.3: - remove readdir system call - added getdents system call - added getpwnam/getpwuid implementation in getpwnam.c - added a few string functions (in str*.c) - diff -uNr dietlibc-0.20/.#CHANGES.1.324 dietlibc-0.21/.#CHANGES.1.324 --- dietlibc-0.20/.#CHANGES.1.324 Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/.#CHANGES.1.324 Sun Aug 11 09:03:21 2002 @@ -0,0 +1,839 @@ +0.20: + umount and stime for x86_64 (Gwenole Beauchesne) + some malloc fixes for very big numbers (Enrico Scholz, me) + x86_64 unified syscall did not preserve rbx violating ABI (Gwenole) + realpath fix if path did not contain a slash (Gwenole) + add ucontext + add asm/statfs.h to work around people using + +0.19: + current gcc cvs makes __thread a keyword (Eric Troan) + be more strict regarding hostile DNS packets (me) + fix ia64 compile problems (Gerrit Pape) + make killpg a function and not a macro (broke bash 2.05b) + fix ia64 start code and unified syscall (me) + add sparc/strlen.S from Thomas Ogrisegg + add more space to ARM __jmp_buf in setjmp.h (Andre) + fix libcompat/syscall.S (did't compile on arm) + add integer overflow fix in xdr_array after bugtraq advisory (me) + fix x86_64 socket calls and mmap (and some more) (Gwenole Beauchesne) + add calloc integer overflow fix after RUS-CERT advisory (me) + add fread and fwrite integer overflow fix (me) + +0.18: + add stpcpy (from Thomas Ogrisegg) + check in mktime fix (from Luc Van Oostenryck) + add libm2.s from contrib to i386 (oops, how long has it been sitting + there?) + add truncate64 and ftruncate64 and prototype for truncate (only had ftruncate) + Michal Ludvig ported the diet libc to the x86_64 architecture (the + upcoming AMD Hammer chips!). You can't even buy the chips yet and + the diet libc already supports it! Amazing ;-) + Michal's patch also fixed several of the outstanding warnings. Thanks! + Andre sent a patch to add ARM profiling. He says it does not work + yet, but it's a start. + added getdents64 backwards compatibility and include it in large file + support #defines + perror now checks if the message is NULL like glibc (Thomas Ogrisegg) + ftell did not take ungetc into account (Kevin Ryde through Debian). + Thomas Ogrisegg sent a port to IA64! + sigaddset, sigdelset and setismember segfaulted for signal 0 (Gunnar Ritter) + Enrico Scholz reported several bugs in the header files. + change __malloc__ to __attribute_malloc__ + add pa-risc socketcall (but see TODO) (Felix J. Ogris) + fix *rand48 initialization (Kevin Ryde) + fnmatch infinite loop fix (Piotr Esden-Tempski) + make signal() into a sigaction wrapper function + add memrchr (Emil) + remove __attribute__((const)) from getpid() (Yuri Kozlov) + make getserv* also work if proto is NULL (Jens Låås) + now clone on parisc works (Thomas Ogrisegg) + getopt* fix from Thomas Walpuski + add syscall() to libcompat (Thomas Ogrisegg) + fix strncpy and strrchr i386 assembly versions for dynamic linking + (John K. Hohm) + allow short option grouping in getopt* (Ralf Wildenhues) + make the DNS resolver IPv6 transport capable (WANT_IPV6_DNS) + mention -v in diet.1 (Bryan Henderson) + auto-detect gcc 3 on i386 and remove compiler option warnings + putenv tweak (Thomas Ogrisegg) + add missing socket syscalls for PA-RISC and IA64 (Thomas Ogrisegg) + add cpio.h and tar.h (Thomas Ogrisegg) + change opendir/readdir/closedir from malloc to mmap (Thomas Ogrisegg) + cleanups from Florian LaRoche + +0.17: + fix several bugs in getservent_r + Gunnar Ritter reported the following: + moved tcgetpgrp and tcsetpgrp to unistd.h + adjusted lstat->lstat64 #define to make it work with function pointers + move __dietlibc__ #define from features.h to diet + Thomas Ogrisegg sent x86 memccpy and strncpy routines and introduced + an dietfeatures.h #define WANT_FULL_POSIX_COMPAT + Thomas also sent me profiling support (so far only on x86, but + profiling/PORTING describes what needs to be done for other + architectures)! + add contrib/dprof.c, also from Thomas. + Andreas Krennmair sent a patch to add the BSD regex interface to + libcompat + Andre noticed that __dtostr never sets first to false. Oops! + Andre has provided a largely untested patch that seems to fix the problem. + Igor Gilitschenski sent a patch for the "%8.7lx" issue. + abort did not flush all stdio streams + fix some nasty regular expression bugs + write a stupid malloc checker (contrib/debug-realloc.c) to help me + debug my regular expressions. Please read contrib/debug-realloc.txt + our i386 memchr,memcmp were broken for the count=0 case + fix DNS domain search + i386 memccpy exchanged esi and edi :-( I should do more checks before + accepting external code... + +0.16: + "diet -v" or "diet -Os" segfaulted without further arguments. + Andre found two very embarassing bugs in my four lines of md5 glue. + I need to get more sleep. + Thanks Ogrisegg found that ptrace does not work as documented and + provided a wrapper that emulates the glibc behaviour. + Dirk Engling saved 8 bytes and 4 cycles in the ARM clone() + fix ptrace.h for S/390 and ARM + provide a PORTING document so we don't lose track of which file need + to be touched to port the diet libc to a new platform. + remove a few warnings + provide a prototype for usleep. + make __dtostr work on ARM by using long instead of long long. + Idea by Dirk Engling. + fix an argument counting bug in *scanf (Thomas Ogrisegg) + Forgot an #endif in asm/sigcontext.h (Mike Castle) + Kurt Garloff sent in patches to + fix struct termios on non-x86 architectures + printf("%+05d\n",500) was broken (Raimar Falke told me, Olaf fixed it) + create libcompat.a (and move daemon to it) + add getdelim and getline + *printf now recognize 'z' integer flag (and ignore it) + Dirk Engling provided a strcpy.S for ARM. + Olaf: fixed *scanf familie. It hadn't wored with "long long". + Hans Lermen fixed i386/getenv.S + diet -Os no longer discards -fpic and -fno-pic + fix i386 rand/random to use correct RAND_MAX (thanks, Jaroslav + Macodiseas) + sys/ipc.h now includes sys/types.h + Olaf: started to make the sparc64 port + scandir should not sort if compar() is NULL (reported by Andrea Marrosu) + +0.15: + vfork sucks. I reverted to the old behavior where vfork==fork. + fix bsearch (and remove i386 assembly bsearch, needs to be redone). + Thanks Ogrisegg sent a patch to make the PA-RISC unified syscall + thread-safe! + remove vfork and add alarm to dynamic syscalls. + fix diet-dyn to link in dyn_dstop.o and not dyn_stop.o. + The MD5 code generated unaligned accesses when passed an unaligned + pointer on little endian ARM and MIPS. + MIPS unified syscall didn't compile anymore. + Put up new mipsel target to cross compile for little endian mips. + The mips target will again explicitly set endianness to big endian. + Compiling natively on a MIPS box should not touch the endianness. + Duh, when we removed return0, we broke tzset when the time zone parser + was disabled. Uwe Ohse noticed this. Thanks! + Fix gethostbyname to match host names case insensitively in /etc/hosts. + Oops, this was reported 6 weeks ago but I overlooked the email. + Thanks, Denis Rachal! + vsnprintf's zero termination was broken. + Uwe Ohse found a few more bugs: + Remove WANT_BUGGY_GLIBC_STRSEP. The Linux man page is broken, glibc + does it correctly. + Make inet_aton use strtoul instead of strtol + fdopen would close the file descriptor if it could not malloc the + buffer. + strftime updates. + Make _FILE_OFFSET_BITS includes -Wundef clean + Andre found a typo in endian.h for big endian mips + Ryan told me that fmod was not included in libm. Oops. + strstr(whatever,"") returned NULL, not whatever. Found by a new test + suite entry for strstr that I wrote. + Thomas Ogrisegg suggested or sent patches for the following: + add for profiling support. + make strncpy a #define in string.h to save a few bytes. + an i386 assembler getenv implementation (roughly half the size) + add grantpt, ptsname, unlockpt + add a getenv test suite entry. + Andre contributed an ARM assembler md5 implementation and he fixed mmap + on ARM. + add glibc macro names in sys/reboot.h. Mentioned by Laurent G. Bercot + getservent_r did not parse lines without aliases. Thanks, Jaroslav + Macodiseas! + fix MIPS start code (argv[0] was always corrupt) + removed annoying -Wconversion gcc switch + add -v to diet.c and fix MIPS CFLAGS in diet. Thanks, Johannes Stezenbach + Kurt Garloff sent these diffs: + add fdatasync (and make it a pthread cancellation point) + numerous alpha issues, like using .quad instead of .long for + offsets, change strip to -strip in Makefile (so a failing strip does + not abort the make), try to be more friendly to the gcc 2.96 that + SuSE 7.1 AXP ships with. + +0.14: + fix brk again (missing __brk, trivial oversight) + a new i386/atol.S that is 4 bytes smaller (and faster, too!). Thanks, + Thomas Ogrisegg! + Thomas also contributed a PA-RISC port including testandset, so + libpthread will work once we implement clone! Great work, Thomas. + made the fake locale more believable. + If you need gettext, use http://www.ca.postgresql.org/~petere/gettext.html + moved _exit into the unified syscall on x86. + Uwe Ohse found many more bugs: + getpass EINTR handling, ttyname, sysconf_cpus with SLASH_PROC_OK, + liblatin1 was more or less completely broken if you gave it chars as + arguments, not ints (signedness). execvp had a buffer overflow in + case a PATH element exceeded PATH_MAX, but it's not a security + problem since setuid programs need to set their path to some known + value anyway. + hasmntopt did not work with foo=bar style options + Uwe also improved ftw's stack usage. + Put movl instead of popl rationale in comment in i386/unified.S since + three people have suggested saving a few bytes with popl now ;) + I discovered __attribute__((malloc)) and started using it. For gcc 3, + it improves the optimizer when functions return malloced pointers. + Steven Rostedt pointed out that my setvbuf was broken with regard to + size==0 and sent a patch to fix it. + Thomas Ogrisegg made setenv smaller. + Olaf: implemented the parisc clone and an atomic testandset, modified the + libpthread to respect the parisc UPgrowing stack. still non functional, + because the unified syscall uses errno :( + tcgetospeed read from the wrong termios field. Thanks, Gunnar Ritter! + Fixed asprintf (relied on vsnprintf(NULL,...) to return length but + don't write anything which was no longer the case. It also + allocated one byte unnecessarily, which Uwe Ohse found. + Fix ttyname (readlink does not \0-terminate, forgot to do that). + +0.13: + add readdir64 and automatic mapping if _FILE_OFFSET_BITS == 64 + make diet not include the linker safeguard stuff when preprocessing + Olaf: port to S/390! + me: fix vfork (it was put into dietlibc.a twice) + res_query did not initialize last + diet (not diet-dyn, of course) now adds -static to the gcc command line + fixed fflush on input streams (tic from ncurses exposed this) + duh, there is an alarm system call, too, so we use it and not setitimer + fix comparison in gmtime_r that caused Jan 1 to be converted to Dec 32. + rewrote __dtostr (it also has one more argument now) + Thanks to Erik Troan for bringing these to my attention: + make putenv behave like glibc (putenv("HOME") == unsetenv("HOME")) + fix strncat for the case where n == 0 (security implications?) + fix bsearch (it didn't find the very last element in the array, same + bug in both the C and the i386 assembly version). + fixed FNM_PATHNAME in fnmatch + fix brk (the syscall was documented incorrectly in the Linux man page) + Thanks, Thomas Ogrisegg! + added negated character classes to fnmatch (not required by POSIX) + make the utmp routines open utmp read-only if read-write doesn't work. + remove syscalls.c directory, it is obsolete now with unified syscalls + +0.12: + more contributions from Frank Klemm. + iconv can now do UCS-2, too. + Imported several x86 assembly routines from Wouter van Kleunen. + Lots of bug fixes, and several more i386 specific versions of common + routines to make them smaller. + add memmem (a GNU extension that looks useful) + several changes from Michal Ludvig: inttypes.h gets C99 macros, + add pivot_root syscall, %n for *scanf. + add adjtimex (thanks, Laurent BERCOT) + add Frank Klemm's optimized md5 + add -Os option to diet (see diet.1). + several IPv6 constants and HZ were missing, thanks Johannes Kloos. + add 32-bit uid/gid syscalls. + add rand48 (thanks, Johannes Kloos) + fixed a lot of bugs in getopt* (thanks, Johannes) + add strxfrm and tweak limits.h. glib-1.3.8 now compiles without changes. + add a few more module syscalls. modutils-2.4.9 now compiles without changes. + fix gethostent alias list termination. Major oops. + add execle and two DNS constants (from Johannes Kloos). + opendir did not close-on-exec (thanks, Laurent Bercot). + DNS will now properly signal errors and set h_errno. + A few more cleanups (thanks, Andreas Jabs and Matthias Andree). + Added an uber-cool linker safeguard feature! Idea by Matthias Andree. + If you enable WANT_SAFEGUARD in dietfeatures.h, diet will include an + external reference to a symbol that is only in the diet libc. So, + when you accidentally link a diet libc compiled object file against + glibc, the linker will barf. This will bloat your object files, but + you can remove all the references with "strip -R .note" from + the binaries in the end (which you should do anyway). + fix ARM unified syscall (select did not work). + add getpwent_r ala glibc and replace getpwent + do the same for getgrent and getspent + remove entlib (new code is smaller) + rewrite getserv* to use parselib (and provide ..._r, too) + add getpwnam_r and getpwuid_r + rewrite getproto* to use parselib (and protive ..._r, too) + Olaf muddled with the dynamic linker. It's a clean-room + implementation in the sense that it once worked for Olaf in a clean + room ;) + add if_nameindex and if_freenameindex. + fixed arm unified syscalls to work with current binutils (; is no + longer a line separator but starts a comment, switched to .macro) + changed all st_[cma]time types to signed long so comparisons against + LONG_MIN will work correctly. (GNU tar does this) + fixed two bugs regarding ungetc. + add getusershell, setusershell, endusershell (for vs_ftpd) + add prctl, dirfd (also for vs_ftpd) + fixed strftime (was completely hosed) + added real make install target + +0.11: + fix major oops in DNS routines (only with WANT_FULL_RESOLV_CONF enabled). + fix vsscanf bug (Thanks, David Chappell). + add floor, ceil and memchr prototypes. + add __builtin_expect and expect #defines for gcc versions below 3.0 + cleaner errno vs __errno_location handling + add placeholder iconv (iconv_open will always return EINVAL) + try to remove kernel 2.4 header dependency in IPv6 sockaddr_in6 + initialization of getaddrinfo. + fix vsnprintf %X (printed lower case) + I wrote a new getopt. It appears to actually work (it is POSIX + compliant, it does not sort argv like the GNU version) and is only + a little over 300 bytes on x86. + Guillaume Cottenceau just wrote me that strncat should be even more + broken than it already is: it should append n bytes AND THEN \0! + I wonder how many programmers have produces off-by-one errors here... + Fix regexec offset return. autoconf now believes that diet libc has + POSIX regular expressions. + Fix fnmatch (a/b/* matched a/b/c/d even if FNM_PATHNAME was set) + Fix regular expression match for x* when there is no x at all. + Fix memory leak in error case in gethostbyname(2|). Thanks, Dietz Pröpper. + Add %h to vsnprintf. + Add FAQ. + Make %h work for signed numbers and add %hh to vsnprintf. + initgroups ignored the group argument :-( + remove printf references and nested functions from glob. + added an errno in libpthread that will display a prominent linker + warning. + started getting rid of kernel headers. Big task! :-( + add res_mkquery. The diet libc can now compile and link mtr. + Olaf: added a lot of code in libdl (not yet complete), changed the + startup code to make it work with his libdl and ld.so (needs still work + too) + __dns_readstartfiles only took the first domain or search path. + Thanks, Anthony de Boer + Olaf: added clone and a new unified_syscall for PowerPC + also dynlinker is now available (i386 only at this time) + crufted together a stdarg.h implementation from the various gcc headers. + implement getopt_long (ugh, the GNU people need professional help) + fixed word delimiters in regex (they looked for space, i.e. "," did + not work as delimiter) + errno.h now declares sys_errlist and sys_nerr. + added mkdtemp. + Uwe Ohse reported all of the following bugs: + ttyname should return 0 if !isatty. + realpath returns NULL if "." cannot be opened + putenv erroneously accepted (and mishandled) entries without "=". + popen returned 255 instead of 127 if /bin/sh could not be run. + fgetc did not set the internal EOF indicator on EOF. + bsearch contained an assumption about integer arithmetic overflow + behavior. + system did not set SIGCHLD and thus contained a race. + popen did not set close-on-exec and could leak an fd on malloc error. + daemon did not check whether open returns an fd below 3 + perror did not save errno. + Olaf: Peter Jones reported some problems with perror; strerror had the + same problem. + Peter also posted a patch to atexit/exit. With some modifications it is + now implemented. + Unbuffered stdio and ungetc can no longer be disabled. I will try to + implement part of it using ELF weak symbols. + Added minimal sysconf (tehe) from David Chappell. + Added overflow handling for strtoul and strtol. + Added WANT_ETC_HOSTS in dietfeatures.h and made gethostbyname/2 use + it before falling back to DNS if enabled. + Added a littie backwards compatibility cruft for gpm (man, do these + sources stink!) + Added openpty. + Squeeze a few bytes off the is* routines, courtesy of Peter Jones. + Fix fseek return value. + Add dirname and basename. + Add a few i386 math routines contributed by Frank Klemm. + Fixed getservent (did not allow _ and - in the aliases). + Thanks, Oden Eriksson + Added a float.h so configure believes we have ANSI header files. + Fix a lot more stdio bugs that Uwe Ohse pointed out. + Olaf: has added a new scanf and printf core that is suitable for all + scanf and printf function implementations + Imported a few more functions and optimizations from Frank Klemm (he + also rewrote dtostr to have more precision) + Olaf: checked in a new sig* function family (based on rt_sig*). + legacy <2.2 signal-handling doesn't work at the moment. + Made rudimentary iconv that can convert back and forth between + iso-8859-1, utf-8 and ucs-4 (for debugging). + Thanks to Markus Kuhn for the excellent utf-8(7)! + +0.10: + update getpagesize. + add personality. + add "%*s" and "%*.*s" support to vsnprintf. + add putchar (apparently arm-linux-gcc will substitute printf("\n") + with putchar('\n') behind your back...?! + import include/scsi/ from glibc. + add iopl. + add execl and sigdelset prototypes. + add getopt_long stuff to getopt.h (may compile but won't link). + add RPC headers (no code yet). + add mlockall, munlockall + make "diet gcc foo.c" work. + added Sun RPC code and removed as many warnings as possible in a + heroic act of self-mutilation. + added getproto* and getdtablesize for the RPC cruft :-( + added getpass. mount from util-linux actually compiles now! + fix the sig*set routines. mount actually works now *bg* + fix fwrite dividing by zero when trying to fwrite n records of size 0. + added an initial regex implementation (3500 bytes!!!). + add llseek and lseek64 with optional lseek fall-back. + add res_init. + add asprintf (ugh, what an ugly function). + expanded arpa/nameser.h to include backwards compatibility defines + add ut_name alias to ut_host in struct utmp. + add inet_ntop, inet_pton, gethostbyname2. + add sysinfo, recvmsg, sendmsg. + add endmntent, getmntent, setmntent. + fix fnmatch (thanks, Guillaume Cottenceau!) + add setenv. + remove __restrict from mntent.h, add __restrict__ removal alias for + older gcc versions in sys/cdefs.h. + add rlim_t, sig_atomic_t declarations. + add sigsetjmp #define for __sigsetjmp (oops). + (Thanks to Chris Siebenmann for these three bug reports) + add a gruesome hack to printf floating point to accept %f and kludge + together support for %.2f. Don't look at the code, please! + fixed tcsetpgrp (oops, this is embarassing! Thanks, Chris Siebenmann) + imported fix for entlib by Jeff Garzik. + add glob implementation from Guillaume Cottenceau (Thanks!!) + add libdl fragments from Olaf (Yeah! One step closer to dynamic linking!) + add REG_ICASE and word start/end handling to my regular expressions. + my regular expressions now actually match substrings (i.e. "foobar" to "bar"). + wrap getcwd to comply to man page (the syscall returns the number of + bytes, not the buffer) + add realpath. + fix vfprintf. + fix *scanf %s zero termination. + add abs, labs, llabs. + add , ioperm syscall. + add flock to + fixes to bsearch and the regular expressions. + add fake herror. + add scandir and alphasort. + add killpg + implemented a gross hack to make libpthread compile when + dietfeatures.h does not define WANT_THREAD_SAFE (it's empty then). + add getaddrinfo and freeaddrinfo (man, what a fucked up interface!) + fix sigsuspend (syscall had completely fscked up arguments!) + RLIM_INFINITY from the kernel is broken. Thanks to Chris Siebenmann + for sending a patch. + add getserv*. + add WANT_FULL_RESOLV_CONF so that the DNS routines use "domain" and + "search" from resolv.conf. + +0.9: + fixed initgroups (oops) + Cleanup appending file open for stdio (thanks, James Antill) + imported vfprintf fix from James Antill. + add fnmatch + change index, rindex and bcmp as weak ELF symbols (were #defined before) + Olaf added character classes to *scanf. + Put object and library files into a separate directory (bin-$ARCH). + Add "cross" make target to make all architectures. + Add "diet" program and man page. + Add getgrnam, getgrgid + Add cfmakeraw (Thanks, Antonio Musumeci) + localtime won't call gettimeofday when the tzfile parser is used. + +0.8: + vsnprintf(0,...) estimated the length of strings with a padding width + incorrectly. + new reboot() from Olaf. + added prototypes for getsockopt and setsockopt. + added experimental sem* and shm* + define EXIT_SUCCESS and EXIT_FAILURE + added setvbuf (only changes mode, not buffer) + added dietwarning.h (woohoo, linker warnings!) and used it to warn of + insecurity (system, sprintf) or bloat (printf and stdio). + added qsort() and bsearch(). Benchmark on 1000 random ints: + glibc: 679414 cycles qsort and 3352 cycles bsearch + diet libc: 300010 cycles qsort, 553 cycles bsearch + I have no idea why glibc is so slow. + added __isnan (references by libm.a from glibc). + added popen() and pclose(). Now the diet libc can link slsh (from + S-Lang!) + corrected usleep. It was more of an msleep until now. + corrected __dtostr (it looped when trying to format "0.0"). + several fixes to stdio (thanks to S-Lang's excellent test suite!) + added ungetc (does it work?) + added inet_aton (yuck!) + added gethostbyname, gethostbyaddr, gethostbyname_r and gethostbyaddr_r + added h_errno and __h_errno_location + added inet_ntoa + added setpgrp and getpgrp, strsignal and execv (thanks, Olaf) + add bcopy, index, rindex macros + add isgraph and isxdigit + add strftime (ugh!!!) + Olaf fixed strftime, gmtime_r leap year bug. + Jeff Garzik contributed a spec file. I put it in contrib and hope + everbody knows what to do with it... + Olaf checked in a ton of libpthread stuff. + added mkstemp using /dev/urandom (harder to guess than getpid()). + add large file backwards compatibility support (so gzip will run on + kernel 2.2 and 2.0) + added shutdown + added nice + added pseudo-locale support for is* (they are now weak aliases, + isupper -> __isupper_ascii etc). So, for example, liblatin1 can + overwrite the default is* functions. + added liblatin1.a + added tzfile implementation (does it work for anyone else?) + added syslog(3) (thanks to Rene Müller!) + Jeff Garzik contributed getgr*, getpw* and getsp* in one tiny package. + Thanks! + merged duplicate code in execv and execvp into exec_lib.o + +0.7.2: + added several prototypes to already implemented functions and + . Thanks for Abraham for pointing this out. + added prototypes for process group and dup syscalls. Thanks to + Abraham again. He also contributed an implementation for daemon(), + an ugly BSD hack. I decided to diversify the lib/ directory a + little and now created a libugly/ directory for stuff like system() + and daemon() ;-) + added libstdio and moved all that stdio crap from lib/ there. The + idea is to start separating now what we will separate for shared + libraries anyway. + optimized x86 unified-syscall by Olaf. + added limits.h, removed __ARCHBITS from endian.h (use __WORDSIZE from + limits.h instead) + added remove.c and enough cruft to limits.h to make it compile lzo, + lzop and bzip2. + added mktime, asctime_r, asctime and ctime (needed for gzip). + Someone will need to implement a reader for the glibc localtime file + format some day (man tzfile, ugh!) :-( + added unlink prototype to unistd.h. + added gmtime and gmtime_r. + fixed sparc unified syscall error handling (please upgrade!). + removed readdir glibc compatibility cruft. + removed stat glibc compatibility cruft. + oops, my fread was broken for pipes. + Olaf found a bug in pipe() for sparc, too. + +0.7.1: + optimized away the static arrays from __ltostr and __lltostr. + optimized away the static arrays (and more!) from strtoul and strtoull. + added system (by Olaf). + added tolower and toupper + added getopt from Olaf (~600 bytes on x86!) + added clone for mips (by Olaf). + fixed longjmp and setjmp on sparc not to require glibc include files. + added pause for all (by Olaf). + added __attribute__ ((__const__)) to ctype.h + added isupper and islower. + added putc and putchar as macros. + added strcasecmp and strncasecmp (thanks to Abraham vd Merwe for + insightful discussions and patches I partially used for the last three) + added getpriority and setpriority (also by Abraham) + oops, I broke strtoul in a recent optimization attempt. + oi, setjmp and longjmp were broken on other platforms, too! + Thanks to Sébastien Côté for reporting this. + +0.7: + clone support for i386,alpha,arm and sparc by Olaf. + Initial dynamic loading glue for i386, also by Olaf. + We don't have a dynamic loader yet, so this is not yet usable. + added readv, sigdelset, sigaltstack, sigfillset, sigismember, usleep, + vsprintf, writev, all by Olaf. + imported readdir fix from Guillaume. Mhh, can the kernel interface + really be this broken? + Found a kludgy way to detect whether the kernel includes define struct + stat64 (they also define STAT64_HAS_BROKEN_ST_INO). If this does + not work for you, please tell me! + Removed bogus __seek_types enum, it's a bunch of #defines now. + Fixed stdio line buffering. The code was already there but I forgot + to mark stdio and stdout as line buffered. This should really be + done dynamically using isatty, though. + Removed superfluous "if (1)" in execvp.c + +0.6.14: + *scanf did not append the 0 byte for %s. + added creat and changed creat to call open directly instead of open64. + did for fread what 0.6.10 did for fwrite. + repaired buffered stdio a little (line buffering is still not + supported). + [All of these bugs have been reported by Guillaume. Thanks!] + added __pure__ to strchr and strrchr in + +0.6.13: + included COPYING to make clear that the diet libc is covered by the + GNU General Public License (and _not_ the LGPL). That means that + you need to obtain a license from me if you want to use the diet + libc in a proprietary program that you want to distribute. + The x86 unified syscall swapped arguments #4 and #5 and noone + noticed until now! Thanks to Guillaume Cottenceau for reporting + this! + The malloc had a subtle bug with small allocations that could cause + segfault. Guillaume reported it, Olaf fixed it. + +0.6.12: + added assert, statfs and fstatfs + added include/net/if.h so fget compiles again. + +0.6.11: + added putenv. + +0.6.10: + fixed fwrite. It returned the number of bytes written, not the number + of records. Thanks to Albert D. Cahalan for pointing this out. + fixed fgets. It returned EOF on empty lines. Thanks, Erik Frey. + added brk and sbrk. harold@nb.com.sg made me do it. + +0.6.9: + fixed execvp not to return on ENOENT + did for {open|read|close|seek|tell}dir what I did for stat before. + The glibc compatibility part is currently non-functional. + fixed white space handling in sscanf " (" would not match " (". + fixed printf to accept 'l' flag. + fixed getpwuid (ignored last line) + +0.6.8: + Olaf contributed initial thread-safe syscalls for i386, alpha, sparc, + mips and arm. I did the one for ppc. They can be enabled in dietfeatures.h. + added strlcpy and strlcat from OpenBSD. + added stat64, fstat64 and lstat64. + added endian.h and made ending of strlen.c endianness-aware + added string routines size tweak to dietfeatures.h. Most of the + string routines have been unrolled. This is up to three times as + fast but creates up to three times larger code. Now you can disable + the unrolling. + added sendfile. + I also added pread. It works on x86 and sparc but not on ppc and mips. + I have no idea what's going on. strace disagrees with the kernel. + Can anyone help? I asked the Linux kernel mailing list for help, too. + added a few aliases of the type __libc_open for open. nm on + libpthreads.so indicates that we will need them. + +0.6.7: + the sources now compile without warnings with -Wall. + printf now prints "(null)" when %s is passed NULL. This can be + removed with WANT_NULL_PRINTF in dietfeatures.h + added vfprintf, execl, ttyname. + stat, lstat and fstat are now #defined to __dietstat, __dietlstat and + __dietfstat so they can use the normal kernel struct stat. + stat, lstat and fstat are now C wrappers that convert to the glibc + struct stat. So we can avoid that overhead for programs that use + dietlibc headers. + +0.6.6: + changed the Makefiles so you can now set CFLAGS on the command line + added memccmp (analogous to memccpy) and strncmp. + Olaf fixed another bug in the sparc unified syscall. + Paul Clifford contributed a C version of his strlen.S that is much + more efficient than the previous strlen on all platforms! It also + looks like technology from Roswell. ;-} + added a "real" stdio. Well, almost. Please contribute! + added dietfeatures.h so you can remove features you don't need. + removed debug code from vsnprintf that changed \0 to ' ' (argh!). + stdio now works with simple programs and minigzip from libz. + stdio uses some major trickery to avoid linking the stdio, stderr and + stdout (and reserving space for them) when they are not used. + +0.6.5: + Red Plait found several bugs in diet libc, + most of them bugs in the new header files, but also missing sigset + functions. + Paul Clifford contributed an assembly strlen.S for ARM and fixed + several bugs. + Fixed ppc/setjmp and mips/pipe. + Olaf contributed a new sparc unified syscall. + +0.6.4: + declared is* static inline in getservent. + added assert_fail, strtoul, isalpha, isdigit, isalnum, isascii. + changed strlen to return 0 when passed NULL. + new, much smaller unified syscall for MIPS. Thanks to Olaf the Mad + Scientist who actually implemented this without access to a MIPS + box, just from reading the architecture manual. And it worked out + of the box. + started a set of system includes, mainly so that I can use lcc and + my alpha-linux cross compiler (which is unable to cross-compile + glibc). diet libc can now be compiled without any include files + from a normal libc. The includes do declare more than diet libc + currently delivers and they are still far from complete for real + applications. + I will only add assembly versions that are smaller _and_ faster than + the C version. Larger routines are only accepted if they are called + very often and are substantially faster. + added i386 assembly strchr, which is smaller and faster than the old + version. It is, however, larger than the version contributed by + proton (thanks, anyway). + added i386 strlen (31% faster, 14% smaller) + "make t" will now create a map file called "mapfile". + +0.6.3: + added sys_errlist, strerror and perror + added isblank + added atol + +0.6.2: + mmap for ARM didn't compile. Thanks, Paul! + +0.6.1: + split mmap into the architecture specific subdirectories. + getenv now copes with environ==NULL, thanks Paul Clifford. + Paul also contributed a smaller ARM startup code. + +0.6: + strcat returned the wrong result. Thanks, Dietz Pröpper. + strtod now understands a negative exponent (oops, thanks Bertram Barth) + Port to arm-linux-gnu, but on the Netwinder I use for testing the + __dtostr does not work (I have no idea why!) + The MIPS port now uses (much smaller) non-PIC code. That means that + the applications you link against diet libc also have to be compiled + non-PIC. I suggest copying the CFLAGS from the diet libc Makefile. + Thanks to Ralf Bächle for helping me with this! + I made subdirectories for the architectures and use VPATH to override + VPATH so that make finds the source file automatically. That should + simplify the sources greatly. + Olaf Dreesen contributed Alpha support including setjmp and longjmp! + ARM and MIPS now also have setjmp and longjmp + "compile" and "load" are now make targets. Use them for djb programs. + added contrib/elftrunc.c which will remove unnecessary ELF headers. + Again, contributed from Olaf. Great work! + +0.5.12: + printf also does signed numbers. + If you don't use atexit, dietlibc now does not link exit, only _exit. + *printf now correctly returns the number of bytes written. + Olaf contributed experimental sscanf and vsscanf implementations. + If passed NULL as buffer, snprintf will not write anything but still + return the number of bytes it would have written. + Initial MIPS port! (Oh, the agony!) + No setjmp and longjmp support yet! Please contribute! + I even implemented unified syscalls for MIPS. Still, MIPS code is + almost twice the size of SPARC code. If anyone knows why: please + tell me! + +0.5.11: + I implemented new unified syscalls for x86, sparc and ppc, this time based + on .s files and not .c files, and I moved the syscalls into + subdirectores to clean the dietlibc sources up a little. + A binary consisting of printf("%s is %d\n","olaf",23) is now + 2864 bytes on sparc + 2488 bytes on intel + I kludgily implemented fprintf(stdout,... and fprintf(stderr,... + to make a few more applications work. + Olaf Dreesen also implemented some unified syscall stuff for x86. + He discovered that with our unified syscall interface it actually + costs <10 bytes total to make all system calls thread safe! + I implemented atexit() (can register up to 4 callbacks). + I implemented strtod and __dtostr (the opposite). Now we can add + floating point support to vsnprintf and sscanf! + +0.5.10: + I actually saw that I can not only merge the errno handling code of + the system calls on x86, I can also merge the rest (including the + arguments) except for setting the system call number. All those + system calls are now just a jump to a unified system call handler. + I got rid of x86openclose again. The savings are substantial: + chown from embutils went from 7664 to 7184 bytes! + If I'd move the system call wrappers to assembly language, I could + even reduce the alignment (does not matter since it's just a jump + anyway) and get rid of the "ret" behind each jump (one byte per + system call!) + +0.5.9: + added memchr, strpbrk, strstr, strtol, isspace (hehe) + fixed strdup + fixed return values for strcpy and strcat (thanks to Norbert Berzen) + Olaf Dreesen contributed a strtol and initial {sn|vsn|}printf implementation + (no signed integers, only strings and unsigned integers (but + supporting octal, hex and decimal). Thanks, Olaf! (by the way: + that code must be wonderful, I don't understand it at all *bg*) + Olaf's printf does understand padding like in "%08d" and "%8d" and + automatically pads pointers with '0'. + Rewrote the x86 start code, old: 22 instructions, new: 12 instructions. + Thanks to proton for inspiration on this. + The new x86 start code also does not reference exit any more, thus saving + 64 bytes for executables that don't call exit explicitly. + [insert maniacal laughter] EVERY BYTE COUNTS!1!! ;-) + Moved errno and environ to start.S, saving no byte binary size but + speeding up compilation and slightly shortening dietlibc.a ;-) + For x86: joined open and close into one assembler file, sharing the + errno handling. This is a feasibility test and it actually saves a + few bytes. I think I will reimplement the _syscall[1-6] macros on + all platforms now to share the errno handling code for them. + +0.5.8: + fixed strchr to be able to look for 0. + + added _llseek, ftruncate, getpgid, getresgid, getresuid, getsid, + memccpy, memmove, mprotect, setregid, setresgid, setresuid, setreuid, + strncpy, swapon, truncate, strtok, strtok_r, strspn, strcspn (all + contributed by Olaf Dreesen) + + added execvp, getcwd + + fixed __xmknod + + Note: can it be that the ftw interface really is so broken that I + cannot implement it without having to implement some searching data + structure? I included an experimental ftw implementation that will + not follow symlinks. + +0.5.7: + oops, if_nametoindex was broken! + +0.5.6: + ported to ppc-linux. + fixed i386 sigsetjmp (I mistyped the function name) + included sigjmp.c + +0.5.5: + added wait, sys_siglist, longjmp/setjmp/sigsetjmp for i386 and sparc + actually, it wasn't fork that wasn't working for sparc, it was pipe. + I fixed it now. + dietlibc/SPARC assumes -msupersparc (does not provide div, mul, etc) + fixed readdir to use getdents and not the intel inline asm + +0.5.4: + ported to sparclinux (sparc32 only). Beware: does not work yet. + added raise, abort, readlink, strcat, geteuid, geteuid, wait3, access + +0.5.3: + added tcsetattr and getenv to compile e3 + +0.5.2: + added vhangup, tcgetattr, isatty and memcmp for fgetty + (http://www.fefe.de/fgetty/) + added localtime from uC-libc. + +0.5.1: + stat and friends actually work now. Yuck! Another case of + translation between kernel and userland. Why can't the kernel + people and the libc people simply agree on a standard? + removed many unnecessary includes to speed up compilation. + added -fomit-frame-pointer and i386 compilation target to reduce code size. + inlined socketcall to reduce code size. + "load" and "compile" are examples for djb code. + +0.5: + Olaf Dreesen contributed a much smaller implementation of malloc and friends. + each object file is now treated with "strip -x -R .note -R .comment" + split each system call into a separate object file + added ntohs, htons, alarm, if_indextoname and if_nametoindex + +0.4.1: + oops, the strchr implementation was wrong. Thanks Jens Laas! + +0.4: + copied opendir and friends from uC-libc. + added getservent and getservby* in gerservent.c + +0.3: + remove readdir system call + added getdents system call + added getpwnam/getpwuid implementation in getpwnam.c + added a few string functions (in str*.c) + diff -uNr dietlibc-0.20/CHANGES dietlibc-0.21/CHANGES --- dietlibc-0.20/CHANGES Sun Aug 11 18:08:14 2002 +++ dietlibc-0.21/CHANGES Fri Oct 4 12:38:09 2002 @@ -1,3 +1,21 @@ +0.21: + use gcc's size_t, ptrdiff_t and wchar_t types (Olaf) + use -G 8 on MIPS to reduce code size (Johannes Stezenbach) + add munlock (Jens Låås) + argh, atexit fell victim to bit rot (or maybe Olaf) + add WANT_INET_ADDR_DNS to make gethostbyname not look up IP numbers + but use them to fill in the struct hostent directly. + signal is now a correct signal (Olaf) + read optimizer cflags for diet -Os gcc from ~/.diet/gcc, overriding + the built-in defaults. + add file "SECURITY". I will document design tradeoffs that have + security implications there. + fixed regex LINEEND condition + add .size directive to i386 syscalls + shove a few more bytes off the i386 socket calls + setjmp, longjmp and clone for x86_64 are now implemented but not tested (Olaf) + fix sparc signals + 0.20: calloc was botched umount and stime for x86_64 (Gwenole Beauchesne) @@ -5,6 +23,7 @@ x86_64 unified syscall did not preserve rbx violating ABI (Gwenole) realpath fix if path did not contain a slash (Gwenole) add ucontext + add asm/statfs.h to work around people using 0.19: current gcc cvs makes __thread a keyword (Eric Troan) diff -uNr dietlibc-0.20/Makefile dietlibc-0.21/Makefile --- dietlibc-0.20/Makefile Wed Aug 7 10:30:49 2002 +++ dietlibc-0.21/Makefile Fri Sep 27 05:26:34 2002 @@ -8,7 +8,7 @@ BINDIR=${prefix}/bin MAN1DIR=${prefix}/man/man1 -MYARCH=$(shell uname -m | sed -e 's/i[4-9]86/i386/' -e 's/armv[3-6][lb]/arm/') +MYARCH:=$(shell uname -m | sed -e 's/i[4-9]86/i386/' -e 's/armv[3-6][lb]/arm/') # This extra-ugly cruft is here so make will not run uname and sed each # time it looks at $(OBJDIR). This alone sped up running make when @@ -180,7 +180,9 @@ $(OBJDIR)/libdietc.so: $(OBJDIR)/dietlibc.a $(CROSS)ld -whole-archive -shared -o $@ $^ -dyn: dynlinker/diet-linux.so dyn_lib +dyn: dyn_lib + +#dyn: dynlinker/diet-linux.so dyn_lib # added dynamic linker $(OBJDIR)/libdl.a: $(LIBDLOBJ) @@ -189,7 +191,7 @@ dynlinker/diet-linux.so: $(OBJDIR)/libdl.a make -C dynlinker -dyn_lib: $(PICODIR) $(PICODIR)/libdietc.so $(PICODIR)/dstart.o \ +dyn_lib: $(PICODIR) $(PICODIR)/libc.so $(PICODIR)/dstart.o \ $(PICODIR)/dyn_so_start.o $(PICODIR)/dyn_start.o $(PICODIR)/dyn_stop.o \ $(PICODIR)/libpthread.so $(PICODIR)/libdl.so $(PICODIR)/libcompat.so \ $(PICODIR)/diet-dyn $(PICODIR)/diet-dyn-i @@ -224,17 +226,20 @@ DYN_LIBCOMPAT_OBJS = $(patsubst $(OBJDIR)/%.o,$(PICODIR)/%.o,$(LIBCOMPATOBJ)) -$(PICODIR)/libdietc.so: $(PICODIR) $(DYN_LIBC_OBJ) - $(CROSS)$(CC) -nostdlib -shared -o $@ $(CFLAGS) -fPIC $(DYN_LIBC_OBJ) -Wl,-soname=libc.so +$(PICODIR)/libc.so: $(PICODIR) $(DYN_LIBC_OBJ) + $(CROSS)$(CC) -nostdlib -shared -o $@ $(CFLAGS) -fPIC $(DYN_LIBC_OBJ) -lgcc -Wl,-soname=libc.so $(PICODIR)/libpthread.so: $(DYN_PTHREAD_OBJS) dietfeatures.h - $(CROSS)$(CC) -nostdlib -shared -o $@ $(CFLAGS) -fPIC $(DYN_PTHREAD_OBJS) -L$(PICODIR) -ldietc -Wl,-soname=libpthread.so + $(CROSS)$(CC) -nostdlib -shared -o $@ $(CFLAGS) -fPIC $(DYN_PTHREAD_OBJS) -L$(PICODIR) -lc -Wl,-soname=libpthread.so + +$(PICODIR)/libdl.so: libdl/_dl_main.c dietfeatures.h + $(CROSS)$(CC) -D__OD_CLEAN_ROOM -DNODIETREF -fPIC -nostdlib -shared -o $@ $(CFLAGS) -I. -Iinclude libdl/_dl_main.c -Wl,-soname=libdl.so -$(PICODIR)/libdl.so: $(DYN_LIBDL_OBJS) dietfeatures.h - $(CROSS)$(CC) -nostdlib -shared -o $@ $(CFLAGS) -fPIC $(DYN_LIBDL_OBJS) -L$(PICODIR) -ldietc -Wl,-soname=libdl.so +#$(PICODIR)/libdl.so: $(DYN_LIBDL_OBJS) dietfeatures.h +# $(CROSS)$(CC) -nostdlib -shared -o $@ $(CFLAGS) -fPIC $(DYN_LIBDL_OBJS) -L$(PICODIR) -ldietc -Wl,-soname=libdl.so $(PICODIR)/libcompat.so: $(DYN_LIBCOMPAT_OBJS) dietfeatures.h - $(CROSS)$(CC) -nostdlib -shared -o $@ $(CFLAGS) -fPIC $(DYN_LIBCOMPAT_OBJS) -L$(PICODIR) -ldietc -Wl,-soname=libcompat.so + $(CROSS)$(CC) -nostdlib -shared -o $@ $(CFLAGS) -fPIC $(DYN_LIBCOMPAT_OBJS) -L$(PICODIR) -lc -Wl,-soname=libcompat.so @@ -259,13 +264,21 @@ $(CROSS)strip -R .command -R .note $@ $(PICODIR)/diet-dyn: $(PICODIR)/start.o $(PICODIR)/dyn_start.o diet.c - $(CROSS)$(CC) -Iinclude $(CFLAGS) -nostdlib -o $@ $^ -DDIETHOME=\"$(HOME)\" -D__DYN_LIB -DVERSION=\"$(VERSION)\" -L$(PICODIR) -ldietc -lgcc $(PICODIR)/dyn_stop.o -Wl,-dynamic-linker=$(HOME)/dynlinker/diet-linux.so + $(CROSS)$(CC) -Iinclude $(CFLAGS) -nostdlib -o $@ $^ -DDIETHOME=\"$(HOME)\" -D__DYN_LIB -DVERSION=\"$(VERSION)\" -L$(PICODIR) -lc -lgcc $(PICODIR)/dyn_stop.o -Wl,-dynamic-linker=$(HOME)/$(PICODIR)/libdl.so $(CROSS)strip -R .command -R .note $@ +#$(PICODIR)/diet-dyn: $(PICODIR)/start.o $(PICODIR)/dyn_start.o diet.c +# $(CROSS)$(CC) -Iinclude $(CFLAGS) -nostdlib -o $@ $^ -DDIETHOME=\"$(HOME)\" -D__DYN_LIB -DVERSION=\"$(VERSION)\" -L$(PICODIR) -ldietc -lgcc $(PICODIR)/dyn_stop.o -Wl,-dynamic-linker=$(HOME)/dynlinker/diet-linux.so +# $(CROSS)strip -R .command -R .note $@ + $(PICODIR)/diet-dyn-i: $(PICODIR)/start.o $(PICODIR)/dyn_start.o diet.c - $(CROSS)$(CC) -Iinclude $(CFLAGS) -nostdlib -o $@ $^ -DDIETHOME=\"$(prefix)\" -D__DYN_LIB -DVERSION=\"$(VERSION)\" -L$(PICODIR) -ldietc -lgcc $(PICODIR)/dyn_stop.o -Wl,-dynamic-linker=$(ILIBDIR)/diet-linux.so -DINSTALLVERSION + $(CROSS)$(CC) -Iinclude $(CFLAGS) -nostdlib -o $@ $^ -DDIETHOME=\"$(prefix)\" -D__DYN_LIB -DVERSION=\"$(VERSION)\" -L$(PICODIR) -lc -lgcc $(PICODIR)/dyn_stop.o -Wl,-dynamic-linker=$(ILIBDIR)/libdl.so -DINSTALLVERSION $(CROSS)strip -R .command -R .note $@ +#$(PICODIR)/diet-dyn-i: $(PICODIR)/start.o $(PICODIR)/dyn_start.o diet.c +# $(CROSS)$(CC) -Iinclude $(CFLAGS) -nostdlib -o $@ $^ -DDIETHOME=\"$(prefix)\" -D__DYN_LIB -DVERSION=\"$(VERSION)\" -L$(PICODIR) -ldietc -lgcc $(PICODIR)/dyn_stop.o -Wl,-dynamic-linker=$(ILIBDIR)/diet-linux.so -DINSTALLVERSION +# $(CROSS)strip -R .command -R .note $@ + $(OBJDIR)/djb: $(OBJDIR)/compile $(OBJDIR)/load $(OBJDIR)/compile: @@ -305,10 +318,12 @@ $(INSTALL) -m 644 $(OBJDIR)/libm.a $(OBJDIR)/libpthread.a $(OBJDIR)/librpc.a \ $(OBJDIR)/liblatin1.a $(OBJDIR)/libcompat.a $(DESTDIR)$(ILIBDIR) $(INSTALL) -m 644 $(OBJDIR)/dietlibc.a $(DESTDIR)$(ILIBDIR)/libc.a +ifeq ($(MYARCH),$(ARCH)) $(INSTALL) $(OBJDIR)/diet-i $(DESTDIR)$(BINDIR)/diet - -$(INSTALL) $(OBJDIR)/pstart.o $(OBJDIR)/libgmon.a $(OBJDIR)/dyn_start.o $(OBJDIR)/dyn_stop.o $(DESTDIR)$(ILIBDIR) -$(INSTALL) $(PICODIR)/diet-dyn-i $(DESTDIR)$(BINDIR)/diet-dyn - -$(INSTALL) $(PICODIR)/libdietc.so $(DESTDIR)$(ILIBDIR)/libc.so +endif + -$(INSTALL) $(OBJDIR)/pstart.o $(OBJDIR)/libgmon.a $(OBJDIR)/dyn_start.o $(OBJDIR)/dyn_stop.o $(DESTDIR)$(ILIBDIR) + -$(INSTALL) $(PICODIR)/libc.so $(DESTDIR)$(ILIBDIR)/libc.so -$(INSTALL) $(PICODIR)/libpthread.so $(DESTDIR)$(ILIBDIR)/libpthread.so -$(INSTALL) $(PICODIR)/libdl.so $(DESTDIR)$(ILIBDIR)/libdl.so -$(INSTALL) $(PICODIR)/libcompat.so $(DESTDIR)$(ILIBDIR)/libcompat.so @@ -317,7 +332,7 @@ -$(INSTALL) $(PICODIR)/dstart.o $(PICODIR)/dyn_so_start.o $(DESTDIR)$(ILIBDIR) -$(INSTALL) dynlinker/diet-linux.so $(DESTDIR)$(ILIBDIR)/diet-linux.so $(INSTALL) -m 644 diet.1 $(DESTDIR)$(MAN1DIR)/diet.1 - if test -f $(PICODIR)/libdietc.so -a ! -f $(DESTDIR)/etc/diet.ld.conf; then echo "$(ILIBDIR)" > $(DESTDIR)/etc/diet.ld.conf; fi + if test -f $(PICODIR)/libc.so -a ! -f $(DESTDIR)/etc/diet.ld.conf; then echo "$(ILIBDIR)" > $(DESTDIR)/etc/diet.ld.conf; fi for i in `find include -name \*.h`; do install -m 644 -D $$i $(DESTDIR)$(prefix)/$$i; done .PHONY: sparc ppc mips arm alpha i386 parisc mipsel powerpc s390 sparc64 @@ -405,4 +420,8 @@ $(OBJDIR)/strncpy.o: dietfeatures.h $(OBJDIR)/strxfrm.o: dietfeatures.h +# these depend on dietfeatures.h for WANT_INET_ADDR_DNS +$(OBJDIR)/gethostbyname_r.o: dietfeatures.h + + # CFLAGS+=-W -Wshadow -Wid-clash-31 -Wpointer-arith -Wcast-align -Wstrict-prototypes -Wwrite-strings diff -uNr dietlibc-0.20/SECURITY dietlibc-0.21/SECURITY --- dietlibc-0.20/SECURITY Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/SECURITY Fri Oct 4 12:38:39 2002 @@ -0,0 +1,13 @@ +The diet libc was written with small code and embedded devices in mind, +not with security for network servers. + +Of course we still try to avoid buffer overflows, but there are some +parts of the code where tradeoffs have been made. This file is meant to +document them. + + 1. The DNS routines do not check whether the answer came from the IP + of the DNS server. The rationale is that people who can sniff the + network to find out the query, source port and DNS sequence number + can also spoof DNS packets to appear to come from the server we + asked, so it does not actually increase security to have that + check. diff -uNr dietlibc-0.20/THANKS dietlibc-0.21/THANKS --- dietlibc-0.20/THANKS Fri Feb 22 06:29:26 2002 +++ dietlibc-0.21/THANKS Fri Aug 30 16:58:56 2002 @@ -3,7 +3,7 @@ he implemented pthreads (wow!) and his now writing a dynamic linker, and he ported the diet libc to S/390. -Thomas Ogrisegg ported the diet libc to PA-RISC and fixed a few things. +Thomas Ogrisegg ported the diet libc to PA-RISC and IA64 and fixed a few things. I initially took some syscalls from Redhat minilibc, but the code has been completely replaced now. @@ -24,3 +24,8 @@ I also grabbed code from glibc (mostly assembly routines), and looked at the OpenBSD libc for inspiration. + +Michal Ludvig did the porting to x86_64 and Gwenole Beauchesne helped +finish the port. + +Johannes Stezenbach improved the MIPS port. diff -uNr dietlibc-0.20/alpha/__longjmp.S dietlibc-0.21/alpha/__longjmp.S --- dietlibc-0.20/alpha/__longjmp.S Mon Jul 2 09:06:48 2001 +++ dietlibc-0.21/alpha/__longjmp.S Mon Sep 16 10:49:49 2002 @@ -1,5 +1,3 @@ -#ifdef __alpha__ - #include .text @@ -19,7 +17,7 @@ ldq $26, (JB_PC*8) ($16) /* ra */ ldq $fp, (JB_FP*8) ($16) /* fp */ - ldq $1, (JB_SP*8) ($16) /* sp */ + ldq $sp, (JB_SP*8) ($16) /* sp */ ldt $f2, (JB_F2*8) ($16) /* f2 */ ldt $f3, (JB_F3*8) ($16) /* f3 */ @@ -31,9 +29,5 @@ ldt $f9, (JB_F9*8) ($16) /* f9 */ cmoveq $0, 0x1, $0 - mov $1, $sp ret $31, ($26), 1 - - -#endif diff -uNr dietlibc-0.20/alpha/setjmp.S dietlibc-0.21/alpha/setjmp.S --- dietlibc-0.20/alpha/setjmp.S Mon Jul 2 09:06:48 2001 +++ dietlibc-0.21/alpha/setjmp.S Mon Sep 16 10:49:49 2002 @@ -1,17 +1,16 @@ #include .text +.weak setjmp +.type setjmp,@function +setjmp: +.weak __setjmp +.type __setjmp,@function +__setjmp: + mov 0, $17 .global __sigsetjmp .type __sigsetjmp,@function __sigsetjmp: -1: - ldgp $gp, 0($gp) - - mov $sp, $1 - lda $sp, -16($sp) - - stq $26, 0($sp) /* save ra */ - stq $9, (JB_S0*8) ($16) /* s0 */ stq $10, (JB_S1*8) ($16) /* s1 */ stq $11, (JB_S2*8) ($16) /* s2 */ @@ -21,7 +20,7 @@ stq $26, (JB_PC*8) ($16) /* ra */ stq $fp, (JB_FP*8) ($16) /* fp */ - stq $1, (JB_SP*8) ($16) /* sp */ + stq $sp, (JB_SP*8) ($16) /* sp */ stt $f2, (JB_F2*8) ($16) /* f2 */ stt $f3, (JB_F3*8) ($16) /* f3 */ @@ -32,19 +31,5 @@ stt $f8, (JB_F8*8) ($16) /* f8 */ stt $f9, (JB_F9*8) ($16) /* f9 */ - br $26, __sigjmp_save /* call __sigjmp_save */ + br $31, __sigjmp_save /* jmp __sigjmp_save */ - ldq $26, 0($sp) /* restore ra */ - - lda $sp, 16($sp) - ret $31, ($26), 1 /* back to caller */ - -.weak setjmp -.type setjmp,@function -setjmp: -.weak __setjmp -.type __setjmp,@function -__setjmp: - ldgp $gp, 0($gp) - mov 0, $17 - br 1b diff -uNr dietlibc-0.20/alpha/start.S dietlibc-0.21/alpha/start.S --- dietlibc-0.20/alpha/start.S Mon Jun 18 12:19:43 2001 +++ dietlibc-0.21/alpha/start.S Fri Sep 13 04:58:57 2002 @@ -1,5 +1,3 @@ -#ifdef __alpha__ - .text .align 2 .set noreorder @@ -33,5 +31,3 @@ #endif mov $0, $16 jsr $26, exit /* YES, CALL! for threads and atexit ! (+4 byte) */ - -#endif diff -uNr dietlibc-0.20/arm/dyn_syscalls.S dietlibc-0.21/arm/dyn_syscalls.S --- dietlibc-0.20/arm/dyn_syscalls.S Tue May 7 17:08:00 2002 +++ dietlibc-0.21/arm/dyn_syscalls.S Fri Sep 27 05:26:34 2002 @@ -24,6 +24,7 @@ str r1, [r0] mvn r0, #0 +#include "dietuglyweaks.h" mov pc, lr /* ok now include all syscalls.s (*.S) and sysdep *.S */ @@ -147,7 +148,7 @@ #include "../syscalls.s/setsid.S" #include "../syscalls.s/setuid.S" #include "../syscalls.s/sigaltstack.S" -#include "../syscalls.s/signal.S" +//#include "../syscalls.s/signal.S" #include "../syscalls.s/socketcall.S" #include "../syscalls.s/stat.S" #include "../syscalls.s/stat64.S" @@ -197,6 +198,9 @@ #include "../syscalls.s/truncate64.S" /* other asm-files w.o. changes ... */ +__exit: + swi $__NR_exit + eor pc,lr,lr #define _exit __exit #include "clone.S" #undef _exit diff -uNr dietlibc-0.20/arm/strlen.S dietlibc-0.21/arm/strlen.S --- dietlibc-0.20/arm/strlen.S Thu Feb 28 08:09:57 2002 +++ dietlibc-0.21/arm/strlen.S Fri Sep 27 05:26:34 2002 @@ -43,3 +43,5 @@ .Lmagic: .word 0x01010101 +.Lstrlen: + .size strlen,.Lstrlen-strlen diff -uNr dietlibc-0.20/diet.1 dietlibc-0.21/diet.1 --- dietlibc-0.20/diet.1 Tue Jul 2 18:32:42 2002 +++ dietlibc-0.21/diet.1 Wed Aug 21 15:13:17 2002 @@ -23,5 +23,9 @@ When passed the -Os option before the gcc argument, diet will mangle the gcc options to include the best known for-size optimization settings for the platform. +.SH FILES +~/.diet/\fIcompiler\fR may contain compiler options as you would +specify them on the command line, i.e. separated by spaces. Those will +then be used instead of the built-in defaults for diet -Os. .SH AUTHOR Felix von Leitner diff -uNr dietlibc-0.20/diet.c dietlibc-0.21/diet.c --- dietlibc-0.20/diet.c Wed Aug 7 10:30:49 2002 +++ dietlibc-0.21/diet.c Mon Sep 16 10:49:49 2002 @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -32,7 +33,7 @@ "sparc64","-Os","-m64",0, "alpha","-Os","-fomit-frame-pointer",0, "arm","-Os","-fomit-frame-pointer",0, - "mips","-Os","-fomit-frame-pointer","-mno-abicalls","-G","0","-fno-pic",0, + "mips","-Os","-fomit-frame-pointer","-mno-abicalls","-G","8","-fno-pic",0, "ppc","-Os","-fomit-frame-pointer","-mpowerpc-gpopt","-mpowerpc-gfxopt",0, "s390","-Os","-fomit-frame-pointer",0, "sh","-Os","-fomit-frame-pointer",0, @@ -62,6 +63,7 @@ char dashstatic[]="-static"; int i; int mangleopts=0; + char manglebuf[1024]; #ifdef INSTALLVERSION strcpy(platform,DIETHOME "/lib-"); @@ -102,12 +104,14 @@ if (!argv[1]) goto usage; { char *tmp=strchr(argv[1],0)-2; - char *tmp2; + char *tmp2,*tmp3; char *cc=argv[1]; if (tmp90) error("platform name too long!\n"); shortplatform=platform+len; memmove(shortplatform,argv[1],(size_t)(tmp2-cc)); @@ -201,7 +205,7 @@ if (!strcmp(argv[i],"-o")) if (!compile) _link=1; #endif - newargv=alloca(sizeof(char*)*(argc+22)); + newargv=alloca(sizeof(char*)*(argc+100)); a=alloca(strlen(diethome)+20); b=alloca(strlen(platform)+20); c=alloca(strlen(platform)+20); @@ -217,11 +221,7 @@ #endif #else strcpy(b,platform); strcat(b,"/dstart.o"); -#ifdef INSTALLVERSION strcpy(c,"-lc"); -#else - strcpy(c,"-ldietc"); -#endif #endif #ifdef WANT_DYNAMIC @@ -280,6 +280,34 @@ *dest++="-D__dietlibc__"; if (mangleopts) { const char **o=Os; + + { + int fd; + char* tmp=getenv("HOME"); + if (tmp) { + if (strlen(tmp)+strlen(cc)<900) { + strcpy(manglebuf,tmp); + strcat(manglebuf,"/.diet/"); + strcat(manglebuf,cc); + if ((fd=open(manglebuf,O_RDONLY))>=0) { + int len=read(fd,manglebuf,1023); + if (len>0) { + int i; + manglebuf[len]=0; + *dest++=manglebuf; + for (i=1; i #include +#include #include "../libdl/_dl_int.h" struct elf_aux { diff -uNr dietlibc-0.20/findcflags.sh dietlibc-0.21/findcflags.sh --- dietlibc-0.20/findcflags.sh Wed Jul 3 07:07:58 2002 +++ dietlibc-0.21/findcflags.sh Wed Aug 21 15:19:58 2002 @@ -1,5 +1,5 @@ #!/bin/sh -version=`${1:-gcc} -v 2>&1 |grep version|sed 's/gcc version //'` +version=`${1:-gcc} -v 2>&1 |sed -n '/gcc version/ {s/gcc version //;p;}'` case $version in 2.9*) echo -march=i386 -Os -fomit-frame-pointer -malign-functions=0 -malign-jumps=0 -malign-loops=0 -mpreferred-stack-boundary=2 ;; 3.0*) echo -march=i386 -Os -fomit-frame-pointer -malign-functions=0 -malign-jumps=0 -malign-loops=0 -mpreferred-stack-boundary=2 ;; diff -uNr dietlibc-0.20/i386/accept.S dietlibc-0.21/i386/accept.S --- dietlibc-0.20/i386/accept.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/i386/accept.S Tue Aug 27 06:46:09 2002 @@ -0,0 +1,4 @@ +#include +#include + +__socketcall(accept,ACCEPT) diff -uNr dietlibc-0.20/i386/bind.S dietlibc-0.21/i386/bind.S --- dietlibc-0.20/i386/bind.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/i386/bind.S Tue Aug 27 06:49:36 2002 @@ -0,0 +1,4 @@ +#include +#include + +__socketcall(bind,BIND) diff -uNr dietlibc-0.20/i386/connect.S dietlibc-0.21/i386/connect.S --- dietlibc-0.20/i386/connect.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/i386/connect.S Tue Aug 27 06:49:36 2002 @@ -0,0 +1,4 @@ +#include +#include + +__socketcall(connect,CONNECT) diff -uNr dietlibc-0.20/i386/cos.S dietlibc-0.21/i386/cos.S --- dietlibc-0.20/i386/cos.S Tue Jul 17 17:20:09 2001 +++ dietlibc-0.21/i386/cos.S Tue Aug 27 06:27:49 2002 @@ -7,5 +7,5 @@ fcos ret -.ende: -.size cos,.ende-cos +.Lende: +.size cos,.Lende-cos diff -uNr dietlibc-0.20/i386/dyn_syscalls.S dietlibc-0.21/i386/dyn_syscalls.S --- dietlibc-0.20/i386/dyn_syscalls.S Sun Aug 11 18:08:29 2002 +++ dietlibc-0.21/i386/dyn_syscalls.S Fri Sep 13 13:03:56 2002 @@ -48,7 +48,6 @@ #include "../syscalls.s/pipe.S" #include "../syscalls.s/poll.S" #include "../syscalls.s/readv.S" -#include "../syscalls.s/socketcall.S" #include "../syscalls.s/stat.S" #include "../syscalls.s/stat64.S" #include "../syscalls.s/truncate.S" @@ -232,6 +231,34 @@ #include "../syscalls.s/truncate64.S" #include "../syscalls.s/ftruncate64.S" +#undef __PIC__ +#undef __socketcall +/* oh what a kludge! */ +#define socketcall .Lsocketcall +#include "../i386/send.S" +#include "../i386/recv.S" +#include "../i386/socket.S" +#include "../i386/accept.S" +#include "../i386/shutdown.S" +#include "../i386/socketpair.S" +#include "../i386/setsockopt.S" +#include "../i386/sendto.S" +#include "../i386/sendmsg.S" +#include "../i386/recvmsg.S" +#include "../i386/recvfrom.S" +#include "../i386/listen.S" +#include "../i386/getsockopt.S" +#include "../i386/getsockname.S" +#include "../i386/getpeername.S" +#include "../i386/connect.S" +#include "../i386/bind.S" +#undef socketcall +.Lsocketcall: +#include "../i386/socketcall.S" +#define __PIC__ +#undef __socketcall + + /* so now this was the last u.s.c. */ /* other asm-files ... */ diff -uNr dietlibc-0.20/i386/getenv.S dietlibc-0.21/i386/getenv.S --- dietlibc-0.20/i386/getenv.S Thu Mar 7 08:52:13 2002 +++ dietlibc-0.21/i386/getenv.S Fri Sep 13 16:12:54 2002 @@ -1,7 +1,8 @@ #include "PIC.h" .text -.globl getenv +.global getenv +.type getenv,@function getenv: pushl %esi pushl %edi diff -uNr dietlibc-0.20/i386/getpeername.S dietlibc-0.21/i386/getpeername.S --- dietlibc-0.20/i386/getpeername.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/i386/getpeername.S Tue Aug 27 06:49:36 2002 @@ -0,0 +1,4 @@ +#include +#include + +__socketcall(getpeername,GETPEERNAME) diff -uNr dietlibc-0.20/i386/getsockname.S dietlibc-0.21/i386/getsockname.S --- dietlibc-0.20/i386/getsockname.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/i386/getsockname.S Tue Aug 27 06:49:36 2002 @@ -0,0 +1,4 @@ +#include +#include + +__socketcall(getsockname,GETSOCKNAME) diff -uNr dietlibc-0.20/i386/getsockopt.S dietlibc-0.21/i386/getsockopt.S --- dietlibc-0.20/i386/getsockopt.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/i386/getsockopt.S Tue Aug 27 06:49:36 2002 @@ -0,0 +1,4 @@ +#include +#include + +__socketcall(getsockopt,GETSOCKOPT) diff -uNr dietlibc-0.20/i386/listen.S dietlibc-0.21/i386/listen.S --- dietlibc-0.20/i386/listen.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/i386/listen.S Tue Aug 27 06:49:36 2002 @@ -0,0 +1,4 @@ +#include +#include + +__socketcall(listen,LISTEN) diff -uNr dietlibc-0.20/i386/mcount.S dietlibc-0.21/i386/mcount.S --- dietlibc-0.20/i386/mcount.S Tue Apr 2 08:01:24 2002 +++ dietlibc-0.21/i386/mcount.S Fri Sep 13 16:12:54 2002 @@ -12,6 +12,7 @@ /* .section ".profile" */ .text .globl mcount +.type mcount,@function mcount: /* save all generic registers which diff -uNr dietlibc-0.20/i386/memccpy.S dietlibc-0.21/i386/memccpy.S --- dietlibc-0.20/i386/memccpy.S Fri May 3 06:34:49 2002 +++ dietlibc-0.21/i386/memccpy.S Fri Sep 27 05:26:34 2002 @@ -10,7 +10,8 @@ */ .text -.globl memccpy +.global memccpy +.type memccpy,@function memccpy: pushl %esi pushl %edi @@ -34,3 +35,5 @@ popl %edi popl %esi ret +.Lende: +.size memccpy,.Lende-memccpy diff -uNr dietlibc-0.20/i386/recv.S dietlibc-0.21/i386/recv.S --- dietlibc-0.20/i386/recv.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/i386/recv.S Tue Aug 27 06:45:42 2002 @@ -0,0 +1,4 @@ +#include +#include + +__socketcall(recv,RECV) diff -uNr dietlibc-0.20/i386/recvfrom.S dietlibc-0.21/i386/recvfrom.S --- dietlibc-0.20/i386/recvfrom.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/i386/recvfrom.S Tue Aug 27 06:49:36 2002 @@ -0,0 +1,4 @@ +#include +#include + +__socketcall(recvfrom,RECVFROM) diff -uNr dietlibc-0.20/i386/recvmsg.S dietlibc-0.21/i386/recvmsg.S --- dietlibc-0.20/i386/recvmsg.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/i386/recvmsg.S Tue Aug 27 06:49:36 2002 @@ -0,0 +1,4 @@ +#include +#include + +__socketcall(recvmsg,RECVMSG) diff -uNr dietlibc-0.20/i386/send.S dietlibc-0.21/i386/send.S --- dietlibc-0.20/i386/send.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/i386/send.S Tue Aug 27 06:44:59 2002 @@ -0,0 +1,4 @@ +#include +#include + +__socketcall(send,SEND) diff -uNr dietlibc-0.20/i386/sendmsg.S dietlibc-0.21/i386/sendmsg.S --- dietlibc-0.20/i386/sendmsg.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/i386/sendmsg.S Tue Aug 27 06:49:36 2002 @@ -0,0 +1,4 @@ +#include +#include + +__socketcall(sendmsg,SENDMSG) diff -uNr dietlibc-0.20/i386/sendto.S dietlibc-0.21/i386/sendto.S --- dietlibc-0.20/i386/sendto.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/i386/sendto.S Tue Aug 27 06:49:36 2002 @@ -0,0 +1,4 @@ +#include +#include + +__socketcall(sendto,SENDTO) diff -uNr dietlibc-0.20/i386/setsockopt.S dietlibc-0.21/i386/setsockopt.S --- dietlibc-0.20/i386/setsockopt.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/i386/setsockopt.S Tue Aug 27 06:49:36 2002 @@ -0,0 +1,4 @@ +#include +#include + +__socketcall(setsockopt,SETSOCKOPT) diff -uNr dietlibc-0.20/i386/shutdown.S dietlibc-0.21/i386/shutdown.S --- dietlibc-0.20/i386/shutdown.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/i386/shutdown.S Tue Aug 27 06:46:51 2002 @@ -0,0 +1,4 @@ +#include +#include + +__socketcall(shutdown,SHUTDOWN) diff -uNr dietlibc-0.20/i386/socket.S dietlibc-0.21/i386/socket.S --- dietlibc-0.20/i386/socket.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/i386/socket.S Tue Aug 27 06:45:55 2002 @@ -0,0 +1,4 @@ +#include +#include + +__socketcall(socket,SOCKET) diff -uNr dietlibc-0.20/i386/socketcall.S dietlibc-0.21/i386/socketcall.S --- dietlibc-0.20/i386/socketcall.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/i386/socketcall.S Fri Sep 13 16:12:54 2002 @@ -0,0 +1,17 @@ +#include + +.text +.global socketcall +.type socketcall,@function +socketcall: + leal 4(%esp), %ecx + pushl %ecx + movzbl %al,%eax + pushl %eax + movb $__NR_socketcall,%al + call __unified_syscall + popl %ecx + popl %ecx + retl +.Lende: +.size socketcall,.Lende-socketcall diff -uNr dietlibc-0.20/i386/socketpair.S dietlibc-0.21/i386/socketpair.S --- dietlibc-0.20/i386/socketpair.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/i386/socketpair.S Tue Aug 27 06:49:36 2002 @@ -0,0 +1,4 @@ +#include +#include + +__socketcall(socketpair,SOCKETPAIR) diff -uNr dietlibc-0.20/i386/start.S dietlibc-0.21/i386/start.S --- dietlibc-0.20/i386/start.S Tue Apr 2 07:54:28 2002 +++ dietlibc-0.21/i386/start.S Fri Sep 27 05:26:34 2002 @@ -1,7 +1,6 @@ #include "dietfeatures.h" #include "PIC.h" -#ifdef __i386__ .text .global _start _start: @@ -49,5 +48,4 @@ hlt /* die now ! will ya ... */ .Lstart: .size _start,.Lstart-_start -#endif diff -uNr dietlibc-0.20/i386/stpcpy.S dietlibc-0.21/i386/stpcpy.S --- dietlibc-0.20/i386/stpcpy.S Fri May 3 13:17:47 2002 +++ dietlibc-0.21/i386/stpcpy.S Fri Sep 13 16:12:54 2002 @@ -1,5 +1,6 @@ .text -.globl stpcpy +.global stpcpy +.type stpcpy,@function stpcpy: pushl %edi pushl %esi @@ -17,3 +18,5 @@ popl %esi popl %edi ret +.Lende: +.size stpcpy,.Lende-stpcpy diff -uNr dietlibc-0.20/i386/syscalls.h dietlibc-0.21/i386/syscalls.h --- dietlibc-0.20/i386/syscalls.h Thu Jun 28 07:10:57 2001 +++ dietlibc-0.21/i386/syscalls.h Fri Sep 13 06:10:35 2002 @@ -231,7 +231,9 @@ .global sym; \ sym: \ movb $__NR_##name,%al; \ - jmp __unified_syscall + jmp __unified_syscall; \ +.Lend##sym: ; \ +.size sym,.Lend##sym-sym #define syscall(name,sym) \ .text; \ @@ -239,5 +241,22 @@ .global sym; \ sym: \ movb $__NR_##name,%al; \ - jmp __unified_syscall + jmp __unified_syscall; \ +.Lend##sym: ; \ +.size sym,.Lend##sym-sym +#ifndef __PIC__ +#define __socketcall(name,NAME) \ +.text; \ +.type name,@function; \ +.weak name; \ +name: ; \ +.global __libc_##name; \ +__libc_##name: ; \ + movb $SYS_##NAME,%al; \ + jmp socketcall; \ +.Lend##name:; \ +.size name,.Lend##name-name +#else +#define __socketcall(name,NAME) +#endif diff -uNr dietlibc-0.20/i386/unified.S dietlibc-0.21/i386/unified.S --- dietlibc-0.20/i386/unified.S Sun Aug 11 18:08:29 2002 +++ dietlibc-0.21/i386/unified.S Mon Sep 16 10:49:49 2002 @@ -5,11 +5,11 @@ .weak exit exit: .global _exit +.type _exit,@function _exit: movb $1,%al -#ifndef __DYN_LIB .global __unified_syscall -#endif +.type __unified_syscall,@function __unified_syscall: movzbl %al, %eax push %edi diff -uNr dietlibc-0.20/ia64/syscalls.h dietlibc-0.21/ia64/syscalls.h --- dietlibc-0.20/ia64/syscalls.h Mon May 13 02:29:36 2002 +++ dietlibc-0.21/ia64/syscalls.h Mon Sep 16 10:49:50 2002 @@ -202,9 +202,10 @@ br __unified_syscall; #define syscall_weak(name, sym, wsym) \ - .text; \ - .globl sym; \ - .weak wsym; \ +.text; \ +.weak wsym; \ +wsym: \ +.globl sym; \ sym: \ mov r15 = __NR_##name; \ br __unified_syscall; diff -uNr dietlibc-0.20/include/.#signal.h.1.24 dietlibc-0.21/include/.#signal.h.1.24 --- dietlibc-0.20/include/.#signal.h.1.24 Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/include/.#signal.h.1.24 Fri Sep 13 04:58:24 2002 @@ -0,0 +1,335 @@ +#ifndef _SIGNAL_H +#define _SIGNAL_H + +#include + +#define __WANT_POSIX1B_SIGNALS__ + +#include +#include + +#define NSIG 32 + +#ifdef __mips__ +#define _NSIG 128 +#else +#define _NSIG 64 +#endif + +#define SIGHUP 1 +#define SIGINT 2 +#define SIGQUIT 3 +#define SIGILL 4 +#define SIGTRAP 5 +#define SIGABRT 6 +#define SIGIOT 6 +#define SIGBUS 7 +#define SIGFPE 8 +#define SIGKILL 9 +#define SIGUSR1 10 +#define SIGSEGV 11 +#define SIGUSR2 12 +#define SIGPIPE 13 +#define SIGALRM 14 +#define SIGTERM 15 +#define SIGSTKFLT 16 +#define SIGCHLD 17 +#define SIGCLD SIGCHLD +#define SIGCONT 18 +#define SIGSTOP 19 +#define SIGTSTP 20 +#define SIGTTIN 21 +#define SIGTTOU 22 +#define SIGURG 23 +#define SIGXCPU 24 +#define SIGXFSZ 25 +#define SIGVTALRM 26 +#define SIGPROF 27 +#define SIGWINCH 28 +#define SIGIO 29 +#define SIGPOLL SIGIO +#define SIGPWR 30 +#define SIGSYS 31 +#define SIGUNUSED 31 + +/* These should not be considered constants from userland. */ +#define SIGRTMIN 32 +#define SIGRTMAX (_NSIG-1) + +/* SA_FLAGS values: */ +#define SA_NOCLDSTOP 0x00000001 +#define SA_NOCLDWAIT 0x00000002 /* not supported yet */ +#define SA_SIGINFO 0x00000004 +#define SA_RESTORER 0x04000000 +#define SA_ONSTACK 0x08000000 +#define SA_RESTART 0x10000000 +#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */ +#define SA_NODEFER 0x40000000 +#define SA_RESETHAND 0x80000000 + +/* ugh, historic Linux legacy, for gpm :-( */ +#define SA_NOMASK SA_NODEFER +#define SA_ONESHOT SA_RESETHAND + +/* sigaltstack controls */ +#define SS_ONSTACK 1 +#define SS_DISABLE 2 + +#define MINSIGSTKSZ 2048 +#define SIGSTKSZ 8192 + +#define SIG_BLOCK 0 /* for blocking signals */ +#define SIG_UNBLOCK 1 /* for unblocking signals */ +#define SIG_SETMASK 2 /* for setting the signal mask */ + +typedef int sig_atomic_t; + +typedef void (*sighandler_t)(int); + +#ifdef _BSD_SOURCE +typedef sighandler_t sig_t; +#endif + +#define SIG_DFL ((sighandler_t)0) /* default signal handling */ +#define SIG_IGN ((sighandler_t)1) /* ignore signal */ +#define SIG_ERR ((sighandler_t)-1) /* error return from signal */ + +typedef union sigval { + int sival_int; + void *sival_ptr; +} sigval_t; + +#define SI_MAX_SIZE 128 +#define SI_PAD_SIZE ((SI_MAX_SIZE/sizeof(int)) - 3) + +typedef struct siginfo { + int si_signo; + int si_errno; + int si_code; + union { + int _pad[SI_PAD_SIZE]; + /* kill() */ + struct { + pid_t _pid; /* sender's pid */ + uid_t _uid; /* sender's uid */ + } _kill; + /* POSIX.1b timers */ + struct { + unsigned int _timer1; + unsigned int _timer2; + } _timer; + /* POSIX.1b signals */ + struct { + pid_t _pid; /* sender's pid */ + uid_t _uid; /* sender's uid */ + sigval_t _sigval; + } _rt; + /* SIGCHLD */ + struct { + pid_t _pid; /* which child */ + uid_t _uid; /* sender's uid */ + int _status; /* exit code */ + clock_t _utime; + clock_t _stime; + } _sigchld; + /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ + struct { + void *_addr; /* faulting insn/memory ref. */ + } _sigfault; + /* SIGPOLL */ + struct { + int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ + int _fd; + } _sigpoll; + } _sifields; +} siginfo_t; + +/* + * How these fields are to be accessed. + */ +#define si_pid _sifields._kill._pid +#define si_uid _sifields._kill._uid +#define si_status _sifields._sigchld._status +#define si_utime _sifields._sigchld._utime +#define si_stime _sifields._sigchld._stime +#define si_value _sifields._rt._sigval +#define si_int _sifields._rt._sigval.sival_int +#define si_ptr _sifields._rt._sigval.sival_ptr +#define si_addr _sifields._sigfault._addr +#define si_band _sifields._sigpoll._band +#define si_fd _sifields._sigpoll._fd + +/* Values for `si_code'. Positive values are reserved for kernel-generated + signals. */ +enum { + SI_ASYNCNL = -6, /* Sent by asynch name lookup completion. */ +# define SI_ASYNCNL SI_ASYNCNL + SI_SIGIO, /* Sent by queued SIGIO. */ +# define SI_SIGIO SI_SIGIO + SI_ASYNCIO, /* Sent by AIO completion. */ +# define SI_ASYNCIO SI_ASYNCIO + SI_MESGQ, /* Sent by real time mesq state change. */ +# define SI_MESGQ SI_MESGQ + SI_TIMER, /* Sent by timer expiration. */ +# define SI_TIMER SI_TIMER + SI_QUEUE, /* Sent by sigqueue. */ +# define SI_QUEUE SI_QUEUE + SI_USER, /* Sent by kill, sigsend, raise. */ +# define SI_USER SI_USER + SI_KERNEL = 0x80 /* Send by kernel. */ +#define SI_KERNEL SI_KERNEL +}; + + +/* `si_code' values for SIGILL signal. */ +enum { + ILL_ILLOPC = 1, /* Illegal opcode. */ +# define ILL_ILLOPC ILL_ILLOPC + ILL_ILLOPN, /* Illegal operand. */ +# define ILL_ILLOPN ILL_ILLOPN + ILL_ILLADR, /* Illegal addressing mode. */ +# define ILL_ILLADR ILL_ILLADR + ILL_ILLTRP, /* Illegal trap. */ +# define ILL_ILLTRP ILL_ILLTRP + ILL_PRVOPC, /* Privileged opcode. */ +# define ILL_PRVOPC ILL_PRVOPC + ILL_PRVREG, /* Privileged register. */ +# define ILL_PRVREG ILL_PRVREG + ILL_COPROC, /* Coprocessor error. */ +# define ILL_COPROC ILL_COPROC + ILL_BADSTK /* Internal stack error. */ +# define ILL_BADSTK ILL_BADSTK +}; + +/* `si_code' values for SIGFPE signal. */ +enum { + FPE_INTDIV = 1, /* Integer divide by zero. */ +# define FPE_INTDIV FPE_INTDIV + FPE_INTOVF, /* Integer overflow. */ +# define FPE_INTOVF FPE_INTOVF + FPE_FLTDIV, /* Floating point divide by zero. */ +# define FPE_FLTDIV FPE_FLTDIV + FPE_FLTOVF, /* Floating point overflow. */ +# define FPE_FLTOVF FPE_FLTOVF + FPE_FLTUND, /* Floating point underflow. */ +# define FPE_FLTUND FPE_FLTUND + FPE_FLTRES, /* Floating point inexact result. */ +# define FPE_FLTRES FPE_FLTRES + FPE_FLTINV, /* Floating point invalid operation. */ +# define FPE_FLTINV FPE_FLTINV + FPE_FLTSUB /* Subscript out of range. */ +# define FPE_FLTSUB FPE_FLTSUB +}; + +/* `si_code' values for SIGSEGV signal. */ +enum { + SEGV_MAPERR = 1, /* Address not mapped to object. */ +# define SEGV_MAPERR SEGV_MAPERR + SEGV_ACCERR /* Invalid permissions for mapped object. */ +# define SEGV_ACCERR SEGV_ACCERR +}; + +/* `si_code' values for SIGBUS signal. */ +enum { + BUS_ADRALN = 1, /* Invalid address alignment. */ +# define BUS_ADRALN BUS_ADRALN + BUS_ADRERR, /* Non-existant physical address. */ +# define BUS_ADRERR BUS_ADRERR + BUS_OBJERR /* Object specific hardware error. */ +# define BUS_OBJERR BUS_OBJERR +}; + +/* `si_code' values for SIGTRAP signal. */ +enum { + TRAP_BRKPT = 1, /* Process breakpoint. */ +# define TRAP_BRKPT TRAP_BRKPT + TRAP_TRACE /* Process trace trap. */ +# define TRAP_TRACE TRAP_TRACE +}; + +/* `si_code' values for SIGCHLD signal. */ +enum { + CLD_EXITED = 1, /* Child has exited. */ +# define CLD_EXITED CLD_EXITED + CLD_KILLED, /* Child was killed. */ +# define CLD_KILLED CLD_KILLED + CLD_DUMPED, /* Child terminated abnormally. */ +# define CLD_DUMPED CLD_DUMPED + CLD_TRAPPED, /* Traced child has trapped. */ +# define CLD_TRAPPED CLD_TRAPPED + CLD_STOPPED, /* Child has stopped. */ +# define CLD_STOPPED CLD_STOPPED + CLD_CONTINUED /* Stopped child has continued. */ +# define CLD_CONTINUED CLD_CONTINUED +}; + +/* `si_code' values for SIGPOLL signal. */ +enum { + POLL_IN = 1, /* Data input available. */ +# define POLL_IN POLL_IN + POLL_OUT, /* Output buffers available. */ +# define POLL_OUT POLL_OUT + POLL_MSG, /* Input message available. */ +# define POLL_MSG POLL_MSG + POLL_ERR, /* I/O error. */ +# define POLL_ERR POLL_ERR + POLL_PRI, /* High priority input available. */ +# define POLL_PRI POLL_PRI + POLL_HUP /* Device disconnected. */ +# define POLL_HUP POLL_HUP +}; + +#define _NSIG_WORDS ((_NSIG/sizeof(long))>>3) + +typedef struct { + unsigned long sig[_NSIG_WORDS]; +} sigset_t; + +struct sigaction { + union { + sighandler_t _sa_handler; + void (*_sa_sigaction)(int, siginfo_t*, void*); + } _u; + unsigned long sa_flags; + void (*sa_restorer)(void); + sigset_t sa_mask; +}; + +#define sa_handler _u._sa_handler +#define sa_sigaction _u._sa_sigaction + +typedef struct sigaltstack { + void *ss_sp; + int ss_flags; + size_t ss_size; +} stack_t; + +int sigaltstack(const struct sigaltstack *newstack, struct sigaltstack *oldstack) __THROW; + +int sigemptyset(sigset_t *set) __THROW; +int sigfillset(sigset_t *set) __THROW; +int sigaddset(sigset_t *set, int signum) __THROW; +int sigdelset(sigset_t *set, int signum) __THROW; +int sigismember(const sigset_t *set, int signo) __THROW; +int sigsuspend(const sigset_t *mask) __THROW; +int sigpending(sigset_t *set) __THROW; +int sigprocmask(int how, const sigset_t *set, sigset_t *oldset) __THROW; + + +sighandler_t signal(int signum, sighandler_t action); + +int raise (int sig) __THROW; +int kill(pid_t pid, int sig) __THROW; + +int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact) __THROW; + +int sigtimedwait(const sigset_t *mask, siginfo_t *info, const struct timespec *ts) __THROW; +int sigqueueinfo(int pid, int sig, siginfo_t *info) __THROW; +int siginterrupt(int sig, int flag) __THROW; + +/* 0 is OK ! kernel puts in MAX_THREAD_TIMEOUT :) */ +#define sigwaitinfo(m, i) sigtimedwait((m),(i),0) + +extern const char *const sys_siglist[]; + +#endif diff -uNr dietlibc-0.20/include/asm/statfs.h dietlibc-0.21/include/asm/statfs.h --- dietlibc-0.20/include/asm/statfs.h Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/include/asm/statfs.h Sun Aug 11 09:02:37 2002 @@ -0,0 +1 @@ +#include diff -uNr dietlibc-0.20/include/limits.h dietlibc-0.21/include/limits.h --- dietlibc-0.20/include/limits.h Mon Aug 5 13:27:35 2002 +++ dietlibc-0.21/include/limits.h Tue Sep 17 12:28:32 2002 @@ -9,6 +9,18 @@ #define SCHAR_MAX 0x7f #define UCHAR_MAX 0xff +#ifdef __CHAR_UNSIGNED__ +#undef CHAR_MIN +#define CHAR_MIN 0 +#undef CHAR_MAX +#define CHAR_MAX UCHAR_MAX +#else +#undef CHAR_MIN +#define CHAR_MIN SCHAR_MIN +#undef CHAR_MAX +#define CHAR_MAX SCHAR_MAX +#endif + #define SHRT_MIN (-SHRT_MAX-1) #define SHRT_MAX 0x7fff #define USHRT_MAX 0xffff diff -uNr dietlibc-0.20/include/pthread.h dietlibc-0.21/include/pthread.h --- dietlibc-0.20/include/pthread.h Fri Jul 26 11:44:09 2002 +++ dietlibc-0.21/include/pthread.h Mon Aug 26 14:44:49 2002 @@ -181,7 +181,7 @@ /* ONCE */ typedef int pthread_once_t; -#define PTHREAD_ONCE_INIT 0 +#define PTHREAD_ONCE_INIT PTHREAD_SPIN_UNLOCKED int __pthread_once(pthread_once_t* once_control, void (*init_routine)(void)); int pthread_once(pthread_once_t* once_control, void (*init_routine)(void)); diff -uNr dietlibc-0.20/include/setjmp.h dietlibc-0.21/include/setjmp.h --- dietlibc-0.20/include/setjmp.h Fri Jul 26 15:53:15 2002 +++ dietlibc-0.21/include/setjmp.h Fri Aug 30 16:58:57 2002 @@ -18,15 +18,17 @@ #ifdef __x86_64__ #ifndef __ASSEMBLER__ -typedef long __jmp_buf[6]; +typedef long __jmp_buf[8]; #endif -# define JB_BX 0 -# define JB_SI 1 -# define JB_DI 2 -# define JB_BP 3 -# define JB_SP 4 -# define JB_PC 5 -# define JB_SIZE 48 +# define JB_RBX 0 +# define JB_RBP 1 +# define JB_R12 2 +# define JB_R13 3 +# define JB_R14 4 +# define JB_R15 5 +# define JB_RSP 6 +# define JB_PC 7 +# define JB_SIZE 64 #endif #ifdef __s390__ diff -uNr dietlibc-0.20/include/setjmp.h.orig dietlibc-0.21/include/setjmp.h.orig --- dietlibc-0.20/include/setjmp.h.orig Fri Jan 11 09:49:03 2002 +++ dietlibc-0.21/include/setjmp.h.orig Wed Dec 31 16:00:00 1969 @@ -1,150 +0,0 @@ -#ifndef _SETJMP_H -#define _SETJMP_H - -#include - -#ifdef __i386__ -#ifndef __ASSEMBLER__ -typedef int __jmp_buf[6]; -#endif -# define JB_BX 0 -# define JB_SI 1 -# define JB_DI 2 -# define JB_BP 3 -# define JB_SP 4 -# define JB_PC 5 -# define JB_SIZE 24 -#endif - -#ifdef __s390__ -#ifndef __ASSEMBLER__ -typedef struct { - long int gregs[10]; - long fpregs[4]; -} __jmp_buf[1]; -#endif -#define __JB_GPR6 0 -#define __JB_GPR7 1 -#define __JB_GPR8 2 -#define __JB_GPR9 3 -#define __JB_GPR10 4 -#define __JB_GPR11 5 -#define __JB_GPR12 6 -#define __JB_GPR13 7 -#define __JB_GPR14 8 -#define __JB_GPR15 9 - -#define _JMPBUF_UNWINDS(jmpbuf, address) ((int) (address) < (jmpbuf)->gregs[__JB_GPR15]) -#endif - -#ifdef __alpha__ -#define JB_S0 0 -#define JB_S1 1 -#define JB_S2 2 -#define JB_S3 3 -#define JB_S4 4 -#define JB_S5 5 -#define JB_PC 6 -#define JB_FP 7 -#define JB_SP 8 -#define JB_F2 9 -#define JB_F3 10 -#define JB_F4 11 -#define JB_F5 12 -#define JB_F6 13 -#define JB_F7 14 -#define JB_F8 15 -#define JB_F9 16 -#ifndef __ASSEMBLER__ -typedef long int __jmp_buf[17]; -#endif -#endif - -#ifdef __mips__ -#ifndef __ASSEMBLER__ -typedef struct - { - void * __pc; /* Program counter. */ - void * __sp; /* Stack pointer. */ - int __regs[8]; /* Callee-saved registers s0 through s7. */ - void * __fp; /* The frame pointer. */ - void * __gp; /* The global pointer. */ - int __fpc_csr; /* Floating point status register. */ - double __fpregs[6]; /* Callee-saved floating point registers. */ - } __jmp_buf[1]; -#endif -#endif - -#ifdef __sparc__ -#define JB_SP 0 -#define JB_FP 1 -#define JB_PC 2 -#ifndef __ASSEMBLER__ -typedef int __jmp_buf[3]; -#endif -#endif - -#ifdef __arm__ -#define __JMP_BUF_SP 8 -#ifndef __ASSEMBLER__ -typedef int __jmp_buf[10]; -#endif -#endif - -#ifdef __powerpc__ -# define JB_GPR1 0 /* Also known as the stack pointer */ -# define JB_GPR2 1 -# define JB_LR 2 /* The address we will return to */ -# define JB_GPRS 3 /* GPRs 14 through 31 are saved, 18 in total */ -# define JB_CR 21 /* Condition code registers. */ -# define JB_FPRS 22 /* FPRs 14 through 31 are saved, 18*2 words total */ -# define JB_SIZE (58*4) -#ifndef __ASSEMBLER__ -typedef long int __jmp_buf[58]; -#endif -#endif - -#ifdef __hppa__ -#ifndef __ASSEMBLER__ -typedef double __jmp_buf[21]; -#endif -#endif - -#ifndef __ASSEMBLER__ - -//typedef int sig_atomic_t; -#define __sig_atomic_t sig_atomic_t - -# define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int))) -typedef struct - { - unsigned long int __val[_SIGSET_NWORDS]; - } __sigset_t; - -/* Calling environment, plus possibly a saved signal mask. */ -typedef struct __jmp_buf_tag /* C++ doesn't like tagless structs. */ - { - /* NOTE: The machine-dependent definitions of `__sigsetjmp' - assume that a `jmp_buf' begins with a `__jmp_buf'. - Do not move this member or add others before it. */ - __jmp_buf __jmpbuf; /* Calling environment. */ - int __mask_was_saved; /* Saved the signal mask? */ - __sigset_t __saved_mask; /* Saved signal mask. */ - } jmp_buf[1]; - -extern int __sigsetjmp (jmp_buf __env, int __savemask) __THROW; - -extern void longjmp (jmp_buf __env, int __val) - __THROW __attribute__ ((__noreturn__)); - -typedef jmp_buf sigjmp_buf; - -extern void siglongjmp (sigjmp_buf __env, int __val) - __THROW __attribute__ ((__noreturn__)); - -#define setjmp(env) __sigsetjmp(env,0) -#define sigsetjmp(a,b) __sigsetjmp(a,b) - -#endif - -#endif diff -uNr dietlibc-0.20/include/signal.h dietlibc-0.21/include/signal.h --- dietlibc-0.20/include/signal.h Sat Jul 20 08:42:57 2002 +++ dietlibc-0.21/include/signal.h Fri Oct 4 12:35:05 2002 @@ -23,18 +23,20 @@ #define SIGTRAP 5 #define SIGABRT 6 #define SIGIOT 6 -#define SIGBUS 7 #define SIGFPE 8 #define SIGKILL 9 -#define SIGUSR1 10 #define SIGSEGV 11 -#define SIGUSR2 12 #define SIGPIPE 13 #define SIGALRM 14 #define SIGTERM 15 +#define SIGUNUSED 31 +#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__arm__) \ + || defined(__s390__) || defined(__ia64__) +#define SIGBUS 7 +#define SIGUSR1 10 +#define SIGUSR2 12 #define SIGSTKFLT 16 #define SIGCHLD 17 -#define SIGCLD SIGCHLD #define SIGCONT 18 #define SIGSTOP 19 #define SIGTSTP 20 @@ -47,25 +49,149 @@ #define SIGPROF 27 #define SIGWINCH 28 #define SIGIO 29 -#define SIGPOLL SIGIO #define SIGPWR 30 #define SIGSYS 31 +#elif defined(__alpha__) || defined(__sparc__) +#define SIGEMT 7 +#define SIGBUS 10 +#define SIGSYS 12 +#define SIGURG 16 +#define SIGSTOP 17 +#define SIGTSTP 18 +#define SIGCONT 19 +#define SIGCHLD 20 +#define SIGTTIN 21 +#define SIGTTOU 22 +#define SIGIO 23 +#define SIGXCPU 24 +#define SIGXFSZ 25 +#define SIGVTALRM 26 +#define SIGPROF 27 +#define SIGWINCH 28 +#define SIGPWR 29 +#define SIGUSR1 30 +#define SIGUSR2 31 +#if defined(__alpha__) +#define SIGINFO SIGPWR +#endif +#elif defined(__mips__) +#define SIGEMT 7 +#define SIGBUS 10 +#define SIGSYS 12 +#define SIGUSR1 16 +#define SIGUSR2 17 +#define SIGCHLD 18 +#define SIGPWR 19 +#define SIGWINCH 20 +#define SIGURG 21 +#define SIGIO 22 +#define SIGSTOP 23 +#define SIGTSTP 24 +#define SIGCONT 25 +#define SIGTTIN 26 +#define SIGTTOU 27 +#define SIGVTALRM 28 +#define SIGPROF 29 +#define SIGXCPU 30 +#define SIGXFSZ 31 +#elif defined(__hppa__) +#define SIGEMT 7 +#define SIGBUS 10 +#define SIGSYS 12 +#define SIGUSR1 16 +#define SIGUSR2 17 +#define SIGCHLD 18 +#define SIGPWR 19 +#define SIGVTALRM 20 +#define SIGPROF 21 +#define SIGIO 22 +#define SIGWINCH 23 +#define SIGSTOP 24 +#define SIGTSTP 25 +#define SIGCONT 26 +#define SIGTTIN 27 +#define SIGTTOU 28 +#define SIGURG 29 +#define SIGLOST 30 #define SIGUNUSED 31 +#define SIGRESERVE SIGUNUSE +#define SIGXCPU 33 +#define SIGXFSZ 34 +#define SIGSTKFLT 36 + +#else +#error signal layout not yet known +#endif + +#define SIGCLD SIGCHLD +#define SIGLOST SIGPWR +#define SIGPOLL SIGIO /* These should not be considered constants from userland. */ +#ifdef __hppa__ +#define SIGRTMIN 37 +#else #define SIGRTMIN 32 +#endif #define SIGRTMAX (_NSIG-1) /* SA_FLAGS values: */ +#if defined(__alpha__) +#define SA_ONSTACK 0x00000001 +#define SA_RESTART 0x00000002 +#define SA_NOCLDSTOP 0x00000004 +#define SA_NODEFER 0x00000008 +#define SA_RESETHAND 0x00000010 +#define SA_NOCLDWAIT 0x00000020 /* not supported yet */ +#define SA_SIGINFO 0x00000040 +#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */ +#elif defined(__hppa__) +#define SA_ONSTACK 0x00000001 +#define SA_RESETHAND 0x00000004 +#define SA_NOCLDSTOP 0x00000008 +#define SA_SIGINFO 0x00000010 +#define SA_NODEFER 0x00000020 +#define SA_RESTART 0x00000040 +#define SA_NOCLDWAIT 0x00000080 /* not supported yet */ +#define _SA_SIGGFAULT 0x00000100 /* HPUX */ +#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */ +#define SA_RESTORER 0x04000000 /* obsolete -- ignored */ +#elif defined (__sparc__) +#define SV_SSTACK 1 /* This signal handler should use sig-stack */ +#define SV_INTR 2 /* Sig return should not restart system call */ +#define SV_RESET 4 /* Set handler to SIG_DFL upon taken signal */ +#define SV_IGNCHILD 8 /* Do not send SIGCHLD */ + +#define SA_NOCLDSTOP SV_IGNCHILD +#define SA_STACK SV_SSTACK +#define SA_ONSTACK SV_SSTACK +#define SA_RESTART SV_INTR +#define SA_RESETHAND SV_RESET +#define SA_INTERRUPT 0x10 +#define SA_DEFER 0x20 +#define SA_SHIRQ 0x40 +#define SA_NOCLDWAIT 0x100»··/* not supported yet */ +#define SA_SIGINFO 0x200 +#else +#if defined (__mips__) +#define SA_NOCLDSTOP 0x00000001 +#define SA_SIGINFO 0x00000008 +#define SA_NOCLDWAIT 0x00010000 /* Not supported yet */ +#else #define SA_NOCLDSTOP 0x00000001 #define SA_NOCLDWAIT 0x00000002 /* not supported yet */ #define SA_SIGINFO 0x00000004 +#endif +#if defined(__arm__) +#define SA_THIRTYTWO 0x02000000 +#endif #define SA_RESTORER 0x04000000 #define SA_ONSTACK 0x08000000 #define SA_RESTART 0x10000000 #define SA_INTERRUPT 0x20000000 /* dummy -- ignored */ #define SA_NODEFER 0x40000000 #define SA_RESETHAND 0x80000000 +#endif /* ugh, historic Linux legacy, for gpm :-( */ #define SA_NOMASK SA_NODEFER @@ -159,6 +285,126 @@ #define si_band _sifields._sigpoll._band #define si_fd _sifields._sigpoll._fd +/* Values for `si_code'. Positive values are reserved for kernel-generated + signals. */ +enum { + SI_ASYNCNL = -6, /* Sent by asynch name lookup completion. */ +# define SI_ASYNCNL SI_ASYNCNL + SI_SIGIO, /* Sent by queued SIGIO. */ +# define SI_SIGIO SI_SIGIO + SI_ASYNCIO, /* Sent by AIO completion. */ +# define SI_ASYNCIO SI_ASYNCIO + SI_MESGQ, /* Sent by real time mesq state change. */ +# define SI_MESGQ SI_MESGQ + SI_TIMER, /* Sent by timer expiration. */ +# define SI_TIMER SI_TIMER + SI_QUEUE, /* Sent by sigqueue. */ +# define SI_QUEUE SI_QUEUE + SI_USER, /* Sent by kill, sigsend, raise. */ +# define SI_USER SI_USER + SI_KERNEL = 0x80 /* Send by kernel. */ +#define SI_KERNEL SI_KERNEL +}; + + +/* `si_code' values for SIGILL signal. */ +enum { + ILL_ILLOPC = 1, /* Illegal opcode. */ +# define ILL_ILLOPC ILL_ILLOPC + ILL_ILLOPN, /* Illegal operand. */ +# define ILL_ILLOPN ILL_ILLOPN + ILL_ILLADR, /* Illegal addressing mode. */ +# define ILL_ILLADR ILL_ILLADR + ILL_ILLTRP, /* Illegal trap. */ +# define ILL_ILLTRP ILL_ILLTRP + ILL_PRVOPC, /* Privileged opcode. */ +# define ILL_PRVOPC ILL_PRVOPC + ILL_PRVREG, /* Privileged register. */ +# define ILL_PRVREG ILL_PRVREG + ILL_COPROC, /* Coprocessor error. */ +# define ILL_COPROC ILL_COPROC + ILL_BADSTK /* Internal stack error. */ +# define ILL_BADSTK ILL_BADSTK +}; + +/* `si_code' values for SIGFPE signal. */ +enum { + FPE_INTDIV = 1, /* Integer divide by zero. */ +# define FPE_INTDIV FPE_INTDIV + FPE_INTOVF, /* Integer overflow. */ +# define FPE_INTOVF FPE_INTOVF + FPE_FLTDIV, /* Floating point divide by zero. */ +# define FPE_FLTDIV FPE_FLTDIV + FPE_FLTOVF, /* Floating point overflow. */ +# define FPE_FLTOVF FPE_FLTOVF + FPE_FLTUND, /* Floating point underflow. */ +# define FPE_FLTUND FPE_FLTUND + FPE_FLTRES, /* Floating point inexact result. */ +# define FPE_FLTRES FPE_FLTRES + FPE_FLTINV, /* Floating point invalid operation. */ +# define FPE_FLTINV FPE_FLTINV + FPE_FLTSUB /* Subscript out of range. */ +# define FPE_FLTSUB FPE_FLTSUB +}; + +/* `si_code' values for SIGSEGV signal. */ +enum { + SEGV_MAPERR = 1, /* Address not mapped to object. */ +# define SEGV_MAPERR SEGV_MAPERR + SEGV_ACCERR /* Invalid permissions for mapped object. */ +# define SEGV_ACCERR SEGV_ACCERR +}; + +/* `si_code' values for SIGBUS signal. */ +enum { + BUS_ADRALN = 1, /* Invalid address alignment. */ +# define BUS_ADRALN BUS_ADRALN + BUS_ADRERR, /* Non-existant physical address. */ +# define BUS_ADRERR BUS_ADRERR + BUS_OBJERR /* Object specific hardware error. */ +# define BUS_OBJERR BUS_OBJERR +}; + +/* `si_code' values for SIGTRAP signal. */ +enum { + TRAP_BRKPT = 1, /* Process breakpoint. */ +# define TRAP_BRKPT TRAP_BRKPT + TRAP_TRACE /* Process trace trap. */ +# define TRAP_TRACE TRAP_TRACE +}; + +/* `si_code' values for SIGCHLD signal. */ +enum { + CLD_EXITED = 1, /* Child has exited. */ +# define CLD_EXITED CLD_EXITED + CLD_KILLED, /* Child was killed. */ +# define CLD_KILLED CLD_KILLED + CLD_DUMPED, /* Child terminated abnormally. */ +# define CLD_DUMPED CLD_DUMPED + CLD_TRAPPED, /* Traced child has trapped. */ +# define CLD_TRAPPED CLD_TRAPPED + CLD_STOPPED, /* Child has stopped. */ +# define CLD_STOPPED CLD_STOPPED + CLD_CONTINUED /* Stopped child has continued. */ +# define CLD_CONTINUED CLD_CONTINUED +}; + +/* `si_code' values for SIGPOLL signal. */ +enum { + POLL_IN = 1, /* Data input available. */ +# define POLL_IN POLL_IN + POLL_OUT, /* Output buffers available. */ +# define POLL_OUT POLL_OUT + POLL_MSG, /* Input message available. */ +# define POLL_MSG POLL_MSG + POLL_ERR, /* I/O error. */ +# define POLL_ERR POLL_ERR + POLL_PRI, /* High priority input available. */ +# define POLL_PRI POLL_PRI + POLL_HUP /* Device disconnected. */ +# define POLL_HUP POLL_HUP +}; + #define _NSIG_WORDS ((_NSIG/sizeof(long))>>3) typedef struct { @@ -166,6 +412,30 @@ } sigset_t; struct sigaction { +#if defined(__alpha__) + union { + sighandler_t _sa_handler; + void (*_sa_sigaction)(int, siginfo_t*, void*); + } _u; + sigset_t sa_mask; + unsigned long sa_flags; +#elif defined(__ia64__) || defined(__hppa__) + union { + sighandler_t _sa_handler; + void (*_sa_sigaction)(int, siginfo_t*, void*); + } _u; + unsigned long sa_flags; + sigset_t sa_mask; +#elif defined(__mips__) + unsigned long sa_flags; + union { + sighandler_t _sa_handler; + void (*_sa_sigaction)(int, siginfo_t*, void*); + } _u; + sigset_t sa_mask; + void (*sa_restorer)(void); + int sa_resv[1]; +#else /* arm, i386, ppc, s390, sparc, saprc64, x86_64 */ union { sighandler_t _sa_handler; void (*_sa_sigaction)(int, siginfo_t*, void*); @@ -173,15 +443,22 @@ unsigned long sa_flags; void (*sa_restorer)(void); sigset_t sa_mask; +#endif }; #define sa_handler _u._sa_handler #define sa_sigaction _u._sa_sigaction typedef struct sigaltstack { +#if defined(__mips__) + void *ss_sp; + size_t ss_size; + int ss_flags; +#else void *ss_sp; int ss_flags; size_t ss_size; +#endif } stack_t; int sigaltstack(const struct sigaltstack *newstack, struct sigaltstack *oldstack) __THROW; diff -uNr dietlibc-0.20/include/stddef.h dietlibc-0.21/include/stddef.h --- dietlibc-0.20/include/stddef.h Mon May 13 05:47:01 2002 +++ dietlibc-0.21/include/stddef.h Mon Aug 19 01:30:59 2002 @@ -3,9 +3,15 @@ /* ugh. This is normally provided by gcc. */ +#ifdef __GNUC__ +typedef __PTRDIFF_TYPE__ ptrdiff_t; +typedef __SIZE_TYPE__ size_t; +typedef __WCHAR_TYPE__ wchar_t; +#else typedef signed long ptrdiff_t; typedef unsigned long size_t; typedef int wchar_t; +#endif #ifndef NULL #define NULL (void*)0 diff -uNr dietlibc-0.20/include/stdlib.h dietlibc-0.21/include/stdlib.h --- dietlibc-0.20/include/stdlib.h Mon Jul 8 13:55:42 2002 +++ dietlibc-0.21/include/stdlib.h Fri Sep 13 05:07:19 2002 @@ -19,7 +19,9 @@ int system (const char * string) __THROW; int atexit(void (*function)(void)) __THROW; +float strtof(const char *nptr, char **endptr) __THROW; double strtod(const char *nptr, char **endptr) __THROW; +long double strtold(const char *nptr, char **endptr) __THROW; long int strtol(const char *nptr, char **endptr, int base) __THROW; unsigned long int strtoul(const char *nptr, char **endptr, int base) __THROW; diff -uNr dietlibc-0.20/include/sys/mman.h dietlibc-0.21/include/sys/mman.h --- dietlibc-0.20/include/sys/mman.h Mon May 13 07:53:25 2002 +++ dietlibc-0.21/include/sys/mman.h Mon Aug 19 01:30:59 2002 @@ -174,6 +174,7 @@ int mlockall(int flags) __THROW; int mlock(const void *addr, size_t len) __THROW; +int munlock(const void *addr, size_t len) __THROW; int munlockall(void) __THROW; int madvise(void *start, size_t length, int advice) __THROW; diff -uNr dietlibc-0.20/include/sys/ptrace.h dietlibc-0.21/include/sys/ptrace.h --- dietlibc-0.20/include/sys/ptrace.h Sat Jul 20 10:29:31 2002 +++ dietlibc-0.21/include/sys/ptrace.h Mon Aug 19 01:43:35 2002 @@ -21,6 +21,23 @@ #define PTRACE_SYSCALL 24 +#define PT_TRACE_ME PTRACE_TRACEME +#define PT_READ_I PTRACE_PEEKTEXT +#define PT_READ_D PTRACE_PEEKDATA +#define PT_READ_U PTRACE_READ_U +#define PT_WRITE_I PTRACE_POKETEXT +#define PT_WRITE_D PTRACE_POKEDATA +#define PT_WRITE_U PTRACE_POKEUSER +#define PT_CONTINUE PTRACE_CONT +#define PT_KILL PTRACE_KILL +#define PT_STEP PTRACE_SINGLESTEP +#define PT_GETREGS PTRACE_GETREGS +#define PT_SETREGS PTRACE_SETREGS +#define PT_GETFPREGS PTRACE_GETFPREGS +#define PT_SETFPREGS PTRACE_SETFPREGS +#define PT_ATTACH PTRACE_ATTACH +#define PT_DETACH PTRACE_DETACH + #if defined(__i386__) #define EBX 0 #define ECX 1 diff -uNr dietlibc-0.20/include/sys/socket.h dietlibc-0.21/include/sys/socket.h --- dietlibc-0.20/include/sys/socket.h Tue Jul 2 15:55:20 2002 +++ dietlibc-0.21/include/sys/socket.h Fri Sep 13 04:58:57 2002 @@ -47,8 +47,13 @@ #define SO_ACCEPTCONN 30 /* Socket types. */ +#ifdef __mips__ +#define SOCK_DGRAM 1 /* datagram (conn.less) socket */ +#define SOCK_STREAM 2 /* stream (connection) socket */ +#else #define SOCK_STREAM 1 /* stream (connection) socket */ #define SOCK_DGRAM 2 /* datagram (conn.less) socket */ +#endif #define SOCK_RAW 3 /* raw socket */ #define SOCK_RDM 4 /* reliably-delivered message */ #define SOCK_SEQPACKET 5 /* sequential packet socket */ @@ -278,6 +283,8 @@ #define SHUT_RDWR 2 int shutdown(int s, int how) __THROW; +int socketpair(int d, int type, int protocol, int sv[2]); + /* currently not supported: */ #define NI_NOFQDN 1 diff -uNr dietlibc-0.20/include/sys/stat.h dietlibc-0.21/include/sys/stat.h --- dietlibc-0.20/include/sys/stat.h Mon May 13 07:53:25 2002 +++ dietlibc-0.21/include/sys/stat.h Mon Sep 16 10:49:50 2002 @@ -3,29 +3,30 @@ #include #include +#include -#if defined(__i386__) || defined(__x86_64__) +#if defined(__i386__) struct stat { - unsigned short st_dev; - unsigned short __pad1; - unsigned long st_ino; - unsigned short st_mode; - unsigned short st_nlink; - unsigned short st_uid; - unsigned short st_gid; - unsigned short st_rdev; - unsigned short __pad2; - unsigned long st_size; - unsigned long st_blksize; - unsigned long st_blocks; - signed long st_atime; - unsigned long __unused1; - signed long st_mtime; - unsigned long __unused2; - signed long st_ctime; - unsigned long __unused3; - unsigned long __unused4; - unsigned long __unused5; + unsigned short st_dev; + unsigned short __pad1; + unsigned long st_ino; + unsigned short st_mode; + unsigned short st_nlink; + unsigned short st_uid; + unsigned short st_gid; + unsigned short st_rdev; + unsigned short __pad2; + unsigned long st_size; + unsigned long st_blksize; + unsigned long st_blocks; + signed long st_atime; + unsigned long __unused1; + signed long st_mtime; + unsigned long __unused2; + signed long st_ctime; + unsigned long __unused3; + unsigned long __unused4; + unsigned long __unused5; }; struct stat64 { @@ -170,14 +171,14 @@ struct stat64 { unsigned long st_dev; unsigned long st_pad0[3]; /* Reserved for st_dev expansion */ - ino_t st_ino; - mode_t st_mode; - nlink_t st_nlink; - uid_t st_uid; - gid_t st_gid; +__extension__ unsigned long long st_ino; + unsigned int st_mode; + unsigned int st_nlink; + unsigned int st_uid; + unsigned int st_gid; unsigned long st_rdev; unsigned long st_pad1[3]; /* Reserved for st_rdev expansion */ -__extension__ long long st_size; +__extension__ long long st_size; /* * Actually this should be timestruc_t st_atime, st_mtime and st_ctime * but we don't have it under Linux. @@ -189,7 +190,8 @@ time_t st_ctime; unsigned long reserved2; /* Reserved for st_atime expansion */ unsigned long st_blksize; -__extension__ long long st_blocks; + unsigned long st_pad2; +__extension__ long long st_blocks; }; #elif defined(__powerpc__) struct stat { @@ -197,20 +199,20 @@ ino_t st_ino; mode_t st_mode; nlink_t st_nlink; - uid_t st_uid; - gid_t st_gid; + uid_t st_uid; + gid_t st_gid; dev_t st_rdev; off_t st_size; - unsigned long st_blksize; - unsigned long st_blocks; - signed long st_atime; - unsigned long __unused1; - signed long st_mtime; - unsigned long __unused2; - signed long st_ctime; - unsigned long __unused3; - unsigned long __unused4; - unsigned long __unused5; + unsigned long st_blksize; + unsigned long st_blocks; + signed long st_atime; + unsigned long __unused1; + signed long st_mtime; + unsigned long __unused2; + signed long st_ctime; + unsigned long __unused3; + unsigned long __unused4; + unsigned long __unused5; }; /* This matches struct stat64 in glibc2.1. @@ -239,26 +241,26 @@ }; #elif defined(__arm__) struct stat { - unsigned short st_dev; - unsigned short __pad1; - unsigned long st_ino; - unsigned short st_mode; - unsigned short st_nlink; - unsigned short st_uid; - unsigned short st_gid; - unsigned short st_rdev; - unsigned short __pad2; - unsigned long st_size; - unsigned long st_blksize; - unsigned long st_blocks; - signed long st_atime; - unsigned long __unused1; - signed long st_mtime; - unsigned long __unused2; - signed long st_ctime; - unsigned long __unused3; - unsigned long __unused4; - unsigned long __unused5; + unsigned short st_dev; + unsigned short __pad1; + unsigned long st_ino; + unsigned short st_mode; + unsigned short st_nlink; + unsigned short st_uid; + unsigned short st_gid; + unsigned short st_rdev; + unsigned short __pad2; + unsigned long st_size; + unsigned long st_blksize; + unsigned long st_blocks; + signed long st_atime; + unsigned long __unused1; + signed long st_mtime; + unsigned long __unused2; + signed long st_ctime; + unsigned long __unused3; + unsigned long __unused4; + unsigned long __unused5; }; /* This matches struct stat64 in glibc2.1, hence the absolutely @@ -298,32 +300,32 @@ }; #elif defined(__s390__) struct stat { - unsigned short st_dev; - unsigned short __pad1; - unsigned long st_ino; - unsigned short st_mode; - unsigned short st_nlink; - unsigned short st_uid; - unsigned short st_gid; - unsigned short st_rdev; - unsigned short __pad2; - unsigned long st_size; - unsigned long st_blksize; - unsigned long st_blocks; - unsigned long st_atime; - unsigned long __unused1; - unsigned long st_mtime; - unsigned long __unused2; - unsigned long st_ctime; - unsigned long __unused3; - unsigned long __unused4; - unsigned long __unused5; + unsigned short st_dev; + unsigned short __pad1; + unsigned long st_ino; + unsigned short st_mode; + unsigned short st_nlink; + unsigned short st_uid; + unsigned short st_gid; + unsigned short st_rdev; + unsigned short __pad2; + unsigned long st_size; + unsigned long st_blksize; + unsigned long st_blocks; + unsigned long st_atime; + unsigned long __unused1; + unsigned long st_mtime; + unsigned long __unused2; + unsigned long st_ctime; + unsigned long __unused3; + unsigned long __unused4; + unsigned long __unused5; }; struct stat64 { unsigned char __pad0[6]; unsigned short st_dev; unsigned int __pad1; -#define STAT64_HAS_BROKEN_ST_INO 1 +#define STAT64_HAS_BROKEN_ST_INO 1 unsigned long __st_ino; unsigned int st_mode; unsigned int st_nlink; @@ -373,6 +375,7 @@ struct stat64 { unsigned long long st_dev; unsigned int __pad1; +#define STAT64_HAS_BROKEN_ST_INO 1 unsigned long __st_ino; unsigned long st_mode; unsigned long st_nlink; @@ -393,27 +396,49 @@ unsigned long long st_ino; }; +#elif defined(__x86_64__) +struct stat { + unsigned long st_dev; + unsigned long st_ino; + unsigned long st_nlink; + unsigned int st_mode; + unsigned int st_uid; + unsigned int st_gid; + unsigned int __pad0; + unsigned long st_rdev; + unsigned long st_size; + unsigned long st_blksize; + unsigned long st_blocks; + unsigned long st_atime; + unsigned long __reserved0; + unsigned long st_mtime; + unsigned long __reserved1; + unsigned long st_ctime; + unsigned long __reserved2; + long __unused[3]; +}; + #elif defined(__ia64__) struct stat { - unsigned long st_dev; - unsigned long st_ino; - unsigned long st_nlink; - unsigned int st_mode; - unsigned int st_uid; - unsigned int st_gid; - unsigned int __pad; - unsigned long st_rdev; - unsigned long st_size; - unsigned long st_atime; - unsigned long reserved; - unsigned long st_mtime; - unsigned long reserved2; - unsigned long st_ctime; - unsigned long reserved3; - unsigned long st_blksize; - long st_blocks; - unsigned long pad[3]; + unsigned long st_dev; + unsigned long st_ino; + unsigned long st_nlink; + unsigned int st_mode; + unsigned int st_uid; + unsigned int st_gid; + unsigned int __pad; + unsigned long st_rdev; + unsigned long st_size; + unsigned long st_atime; + unsigned long reserved; + unsigned long st_mtime; + unsigned long reserved2; + unsigned long st_ctime; + unsigned long reserved3; + unsigned long st_blksize; + long st_blocks; + unsigned long pad[3]; }; #endif @@ -453,21 +478,16 @@ #define S_IWOTH 00002 #define S_IXOTH 00001 -#ifndef STAT64_HAS_BROKEN_ST_INO -#define __NO_STAT64 -#endif - extern int stat(const char *__file, struct stat *__buf) __THROW; extern int fstat(int __fd, struct stat *__buf) __THROW; extern int lstat(const char *__file, struct stat *__buf) __THROW; -#ifdef __NO_STAT64 -#undef _FILE_OFFSET_BITS +#if __WORDSIZE == 64 +#define __NO_STAT64 #else extern int stat64(const char *__file, struct stat64 *__buf) __THROW; extern int fstat64(int __fd, struct stat64 *__buf) __THROW; extern int lstat64(const char *__file, struct stat64 *__buf) __THROW; -#endif #if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64 #define lstat lstat64 @@ -476,6 +496,7 @@ #define pread pread64 #define pwrite pwrite64 #endif +#endif #define major(dev) (((dev)>>8) & 0xff) #define minor(dev) ((dev) & 0xff) diff -uNr dietlibc-0.20/include/sys/vfs.h dietlibc-0.21/include/sys/vfs.h --- dietlibc-0.20/include/sys/vfs.h Fri Jun 15 12:05:17 2001 +++ dietlibc-0.21/include/sys/vfs.h Fri Sep 13 04:58:57 2002 @@ -13,9 +13,14 @@ long f_bsize; long f_blocks; long f_bfree; +#ifndef __mips__ long f_bavail; +#endif long f_files; long f_ffree; +#ifdef __mips__ + long f_bavail; +#endif __kernel_fsid_t f_fsid; long f_namelen; long f_spare[6]; diff -uNr dietlibc-0.20/include/sysexits.h dietlibc-0.21/include/sysexits.h --- dietlibc-0.20/include/sysexits.h Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/include/sysexits.h Tue Sep 17 12:26:02 2002 @@ -0,0 +1,26 @@ +#ifndef _SYSEXITS_H +#define _SYSEXITS_H 1 + +#define EX_OK 0 + +#define EX__BASE 64 + +#define EX_USAGE 64 +#define EX_DATAERR 65 +#define EX_NOINPUT 66 +#define EX_NOUSER 67 +#define EX_NOHOST 68 +#define EX_UNAVAILABLE 69 +#define EX_SOFTWARE 70 +#define EX_OSERR 71 +#define EX_OSFILE 72 +#define EX_CANTCREAT 73 +#define EX_IOERR 74 +#define EX_TEMPFAIL 75 +#define EX_PROTOCOL 76 +#define EX_NOPERM 77 +#define EX_CONFIG 78 + +#define EX__MAX 78 + +#endif diff -uNr dietlibc-0.20/include/termios.h dietlibc-0.21/include/termios.h --- dietlibc-0.20/include/termios.h Sat May 11 07:11:38 2002 +++ dietlibc-0.21/include/termios.h Tue Sep 17 12:28:32 2002 @@ -22,6 +22,22 @@ }; /* modem lines */ +#ifdef __mips__ +#define TIOCM_LE 0x001 +#define TIOCM_DTR 0x002 +#define TIOCM_RTS 0x004 +#define TIOCM_ST 0x010 +#define TIOCM_SR 0x020 +#define TIOCM_CTS 0x040 +#define TIOCM_CAR 0x100 +#define TIOCM_RNG 0x200 +#define TIOCM_DSR 0x400 +#define TIOCM_CD TIOCM_CAR +#define TIOCM_RI TIOCM_RNG +#define TIOCM_OUT1 0x2000 +#define TIOCM_OUT2 0x4000 +#define TIOCM_LOOP 0x8000 +#else #define TIOCM_LE 0x001 #define TIOCM_DTR 0x002 #define TIOCM_RTS 0x004 @@ -36,6 +52,7 @@ #define TIOCM_OUT1 0x2000 #define TIOCM_OUT2 0x4000 #define TIOCM_LOOP 0x8000 +#endif /* line disciplines */ #define N_TTY 0 @@ -53,6 +70,7 @@ #define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ #define N_HDLC 13 /* synchronous HDLC */ #define N_SYNC_PPP 14 /* synchronous PPP */ +#define N_HCI 15 /* Bluetooth HCI UART */ typedef unsigned char cc_t; typedef unsigned int speed_t; @@ -108,23 +126,99 @@ #endif /* c_cc characters */ -#define VINTR 0 -#define VQUIT 1 -#define VERASE 2 -#define VKILL 3 -#define VEOF 4 -#define VTIME 5 -#define VMIN 6 -#define VSWTC 7 -#define VSTART 8 -#define VSTOP 9 -#define VSUSP 10 -#define VEOL 11 +#if defined(__alpha__) +#define VEOF 0 +#define VEOL 1 +#define VEOL2 2 +#define VERASE 3 +#define VWERASE 4 +#define VKILL 5 +#define VREPRINT 6 +#define VSWTC 7 +#define VINTR 8 +#define VQUIT 9 +#define VSUSP 10 +#define VSTART 12 +#define VSTOP 13 +#define VLNEXT 14 +#define VDISCARD 15 +#define VMIN 16 +#define VTIME 17 +#elif defined(__mips__) +#define VINTR 0 +#define VQUIT 1 +#define VERASE 2 +#define VKILL 3 +#define VMIN 4 +#define VTIME 5 +#define VEOL2 6 +#define VSWTC 7 +#define VSWTCH VSWTC +#define VSTART 8 +#define VSTOP 9 +#define VSUSP 10 #define VREPRINT 12 #define VDISCARD 13 #define VWERASE 14 -#define VLNEXT 15 -#define VEOL2 16 +#define VLNEXT 15 +#define VEOF 16 +#define VEOL 17 +#elif defined(__powerpc__) +#define VINTR 0 +#define VQUIT 1 +#define VERASE 2 +#define VKILL 3 +#define VEOF 4 +#define VMIN 5 +#define VEOL 6 +#define VTIME 7 +#define VEOL2 8 +#define VSWTC 9 +#define VWERASE 10 +#define VREPRINT 11 +#define VSUSP 12 +#define VSTART 13 +#define VSTOP 14 +#define VLNEXT 15 +#define VDISCARD 16 +#elif defined(__sparc__) +#define VINTR 0 +#define VQUIT 1 +#define VERASE 2 +#define VKILL 3 +#define VEOF 4 +#define VEOL 5 +#define VEOL2 6 +#define VSWTC 7 +#define VSTART 8 +#define VSTOP 9 +#define VSUSP 10 +#define VDSUSP 11 +#define VREPRINT 12 +#define VDISCARD 13 +#define VWERASE 14 +#define VLNEXT 15 +#define VMIN 16 +#define VTIME 17 +#else /* arm, i386, parisc, s390, x86_64 */ +#define VINTR 0 +#define VQUIT 1 +#define VERASE 2 +#define VKILL 3 +#define VEOF 4 +#define VTIME 5 +#define VMIN 6 +#define VSWTC 7 +#define VSTART 8 +#define VSTOP 9 +#define VSUSP 10 +#define VEOL 11 +#define VREPRINT 12 +#define VDISCARD 13 +#define VWERASE 14 +#define VLNEXT 15 +#define VEOL2 16 +#endif /* c_iflag bits */ #define IGNBRK 0000001 @@ -239,7 +333,11 @@ #define ECHOCTL 0001000 #define ECHOPRT 0002000 #define ECHOKE 0004000 +#ifdef __mips__ +#define FLUSHO 0020000 +#else #define FLUSHO 0010000 +#endif #define PENDIN 0040000 #define IEXTEN 0100000 diff -uNr dietlibc-0.20/lib/__v_printf.c dietlibc-0.21/lib/__v_printf.c --- dietlibc-0.20/lib/__v_printf.c Tue Jul 2 17:22:01 2002 +++ dietlibc-0.21/lib/__v_printf.c Fri Sep 27 05:26:35 2002 @@ -7,14 +7,14 @@ #include "dietwarning.h" static inline unsigned int skip_to(const unsigned char *format) { - int unsigned nr; + unsigned int nr; for (nr=0; format[nr] && (format[nr]!='%'); ++nr); return nr; } #define A_WRITE(fn,buf,sz) ((fn)->put((void*)(buf),(sz),(fn)->data)) -static char* pad_line[16]= { " ", "0000000000000000", }; +static const char pad_line[2][16]= { " ", "0000000000000000", }; static inline int write_pad(struct arg_printf* fn, int len, int padwith) { int nr=0; for (;len>15;len-=16,nr+=16) { @@ -67,7 +67,7 @@ /* FLAGS */ case '#': - flag_hash=1; + flag_hash=-1; case 'z': goto inn_printf; @@ -141,6 +141,7 @@ #endif sz = strlen(s); if (flag_dot && sz>preci) sz=preci; + flag_dot^=flag_dot; print_out: if (width && (!flag_left)) { @@ -149,6 +150,11 @@ ++s; --sz; --width; } + if (flag_hash>0) { + A_WRITE(fn,s,flag_hash); len+=flag_hash; + s+=flag_hash; sz-=flag_hash; + width-=flag_hash; + } // len+=write_pad(fn,(signed int)width-(signed int)sz,padwith); if (flag_dot) { len+=write_pad(fn,(signed int)width-(signed int)preci,padwith); @@ -168,7 +174,7 @@ sz=0; goto num_printf; case 'p': - flag_hash=1; + flag_hash=2; ch='x'; case 'X': flag_upcase=(ch=='X'); @@ -178,6 +184,7 @@ if (flag_hash) { buf[1]='0'; buf[2]=ch; + flag_hash=2; sz=2; } goto num_printf; @@ -193,6 +200,7 @@ sz=0; if (flag_hash) { buf[1]='0'; + flag_hash=1; ++sz; } diff -uNr dietlibc-0.20/lib/accept.c dietlibc-0.21/lib/accept.c --- dietlibc-0.20/lib/accept.c Tue Aug 14 09:56:49 2001 +++ dietlibc-0.21/lib/accept.c Tue Aug 27 06:21:07 2002 @@ -2,18 +2,11 @@ extern int socketcall(int callno,long* args); -#ifdef __i386__ -int __libc_accept(int a); - -int __libc_accept(int a) { - return socketcall(SYS_ACCEPT, (long*)&a); -#else int __libc_accept(int a, void * addr, void * addr2); int __libc_accept(int a, void * addr, void * addr2) { unsigned long args[] = { a, (long) addr, (long) addr2 }; return socketcall(SYS_ACCEPT, args); -#endif } int accept(int a, void * addr, void * addr2) __attribute__((weak,alias("__libc_accept"))); diff -uNr dietlibc-0.20/lib/alloc.c dietlibc-0.21/lib/alloc.c --- dietlibc-0.20/lib/alloc.c Thu Aug 8 04:36:47 2002 +++ dietlibc-0.21/lib/alloc.c Mon Aug 19 01:30:59 2002 @@ -46,7 +46,7 @@ #ifdef __i386__ /* regparm exists only on i386 */ -static void *do_mmap(unsigned long size) __attribute__((regparm(1))); +static void *do_mmap(size_t size) __attribute__((regparm(1))); static size_t get_index(size_t _size) __attribute__((regparm(1))); static void* __small_malloc(size_t _size) __attribute__((regparm(1))); #endif diff -uNr dietlibc-0.20/lib/atexit.c dietlibc-0.21/lib/atexit.c --- dietlibc-0.20/lib/atexit.c Sun Aug 11 18:08:30 2002 +++ dietlibc-0.21/lib/atexit.c Tue Aug 20 13:04:01 2002 @@ -17,12 +17,15 @@ } extern void _exit(int code) __attribute__((noreturn)); +extern void __thread_doexit(); +void __libc_exit(int code); void __libc_exit(int code) { register int i=atexit_counter; + __thread_doexit(); while(i) { __atexitlist[--i](); } _exit(code); } -void exit(int code) __attribute__((weak,alias("__libc_exit"))); +void exit(int code) __attribute__((alias("__libc_exit"))); diff -uNr dietlibc-0.20/lib/bind.c dietlibc-0.21/lib/bind.c --- dietlibc-0.20/lib/bind.c Tue Aug 14 09:56:50 2001 +++ dietlibc-0.21/lib/bind.c Tue Aug 27 06:21:13 2002 @@ -2,16 +2,10 @@ extern int socketcall(int callno,long* args); -#ifdef __i386__ -int __libc_bind(int a); -int __libc_bind(int a) { - return socketcall(SYS_BIND, (long*)&a); -#else int __libc_bind(int a, void * b, int c); int __libc_bind(int a, void * b, int c) { unsigned long args[] = { a, (long) b, c }; return socketcall(SYS_BIND, args); -#endif } int bind(int a, void * b, int c) __attribute__((weak,alias("__libc_bind"))); diff -uNr dietlibc-0.20/lib/connect.c dietlibc-0.21/lib/connect.c --- dietlibc-0.20/lib/connect.c Sat Feb 23 12:27:09 2002 +++ dietlibc-0.21/lib/connect.c Tue Aug 27 06:21:22 2002 @@ -2,16 +2,10 @@ extern int socketcall(int callno,long* args); -#ifdef __i386__ -int __libc_connect(int a); -int __libc_connect(int a) { - return socketcall(SYS_CONNECT, (long*)&a); -#else int __libc_connect(int a, void * b, int c); int __libc_connect(int a, void * b, int c) { unsigned long args[] = { a, (long) b, c }; return socketcall(SYS_CONNECT, args); -#endif } int connect(int a, void * b, int c) __attribute__((weak,alias("__libc_connect"))); diff -uNr dietlibc-0.20/lib/ftw.c dietlibc-0.21/lib/ftw.c --- dietlibc-0.20/lib/ftw.c Mon Feb 25 06:50:04 2002 +++ dietlibc-0.21/lib/ftw.c Sat Aug 31 08:21:24 2002 @@ -5,6 +5,7 @@ #include #include #include +#include "dietdirent.h" int ftw(const char*dir,int(*f)(const char*file,const struct stat*sb,int flag),int dpth){ char* cd; @@ -38,7 +39,7 @@ if(r){closedir(d);return r;} if(flg==FTW_D&&dpth){ r=ftw(filename,f,dpth-1); - chdir(dir); + fchdir(d->fd); if (r){closedir(d);return r;} } } diff -uNr dietlibc-0.20/lib/getpeername.c dietlibc-0.21/lib/getpeername.c --- dietlibc-0.20/lib/getpeername.c Tue Aug 14 09:56:50 2001 +++ dietlibc-0.21/lib/getpeername.c Tue Aug 27 06:21:28 2002 @@ -3,16 +3,10 @@ extern int socketcall(int callno,long* args); -#ifdef __i386__ -int __libc_getpeername(int a); -int __libc_getpeername(int a) { - return socketcall(SYS_GETPEERNAME, (long*)&a); -#else int __libc_getpeername(int a, void * b, int *c); int __libc_getpeername(int a, void * b, int *c) { unsigned long args[] = { a, (long) b, (long) c }; return socketcall(SYS_GETPEERNAME, args); -#endif } int getpeername(int a, struct sockaddr* b, socklen_t *c) __attribute__((weak,alias("__libc_getpeername"))); diff -uNr dietlibc-0.20/lib/getsockname.c dietlibc-0.21/lib/getsockname.c --- dietlibc-0.20/lib/getsockname.c Tue Aug 14 09:56:50 2001 +++ dietlibc-0.21/lib/getsockname.c Tue Aug 27 06:21:31 2002 @@ -3,16 +3,10 @@ extern int socketcall(int callno,long* args); -#ifdef __i386__ -int __libc_getsockname(int a); -int __libc_getsockname(int a) { - return socketcall(SYS_GETSOCKNAME, (long*)&a); -#else int __libc_getsockname(int a, void * b, int c); int __libc_getsockname(int a, void * b, int c) { unsigned long args[] = { a, (long) b, c }; return socketcall(SYS_GETSOCKNAME, args); -#endif } int getsockname(int a, struct sockaddr* b, socklen_t* c) __attribute__((weak,alias("__libc_getsockname"))); diff -uNr dietlibc-0.20/lib/getsockopt.c dietlibc-0.21/lib/getsockopt.c --- dietlibc-0.20/lib/getsockopt.c Tue Aug 14 09:56:50 2001 +++ dietlibc-0.21/lib/getsockopt.c Tue Aug 27 06:21:34 2002 @@ -3,16 +3,10 @@ extern int socketcall(int callno,long* args); -#ifdef __i386__ -int __libc_getsockopt(int a); -int __libc_getsockopt(int a) { - return socketcall(SYS_GETSOCKOPT, (long*)&a); -#else int __libc_getsockopt(int a, int b, int c, void *d, int e); int __libc_getsockopt(int a, int b, int c, void *d, int e) { unsigned long args[] = { a, b, c, (long)d, e }; return socketcall(SYS_GETSOCKOPT, args); -#endif } int getsockopt(int s, int level, int optname, void * optval, socklen_t *optlen) __attribute__((weak,alias("__libc_getsockopt"))); diff -uNr dietlibc-0.20/lib/listen.c dietlibc-0.21/lib/listen.c --- dietlibc-0.20/lib/listen.c Tue Aug 14 09:56:50 2001 +++ dietlibc-0.21/lib/listen.c Tue Aug 27 06:21:37 2002 @@ -3,16 +3,10 @@ extern int socketcall(int callno,long* args); -#ifdef __i386__ -int __libc_listen(int a); -int __libc_listen(int a) { - return socketcall(SYS_LISTEN, (long*)&a); -#else int __libc_listen(int a, int b); int __libc_listen(int a, int b) { unsigned long args[] = { a, b, 0 }; return socketcall(SYS_LISTEN, args); -#endif } int listen(int s, int backlog) __attribute__((weak,alias("__libc_listen"))); diff -uNr dietlibc-0.20/lib/recv.c dietlibc-0.21/lib/recv.c --- dietlibc-0.20/lib/recv.c Tue Aug 14 09:56:50 2001 +++ dietlibc-0.21/lib/recv.c Tue Aug 27 06:21:41 2002 @@ -3,16 +3,10 @@ extern int socketcall(int callno,long* args); -#ifdef __i386__ -int __libc_recv(int a); -int __libc_recv(int a) { - return socketcall(SYS_RECV,(long*)&a); -#else int __libc_recv(int a, const void * b, size_t c, int flags); int __libc_recv(int a, const void * b, size_t c, int flags) { unsigned long args[] = { a, (long) b, c, flags }; return socketcall(SYS_RECV, args); -#endif } int recv(int a, const void * b, size_t c, int flags) diff -uNr dietlibc-0.20/lib/recvfrom.c dietlibc-0.21/lib/recvfrom.c --- dietlibc-0.20/lib/recvfrom.c Tue Aug 14 09:56:50 2001 +++ dietlibc-0.21/lib/recvfrom.c Tue Aug 27 06:21:44 2002 @@ -3,16 +3,10 @@ extern int socketcall(int callno,long* args); -#ifdef __i386__ -int __libc_recvfrom(int a); -int __libc_recvfrom(int a) { - return socketcall(SYS_RECVFROM, (long*)&a); -#else int __libc_recvfrom(int a, const void * b, size_t c, int flags, void *to, void *tolen); int __libc_recvfrom(int a, const void * b, size_t c, int flags, void *to, void *tolen) { unsigned long args[] = { a, (long) b, c, flags, (long) to, (long) tolen }; return socketcall(SYS_RECVFROM, args); -#endif } int recvfrom(int a, const void * b, size_t c, int flags, void *to, void *tolen) diff -uNr dietlibc-0.20/lib/recvmsg.c dietlibc-0.21/lib/recvmsg.c --- dietlibc-0.20/lib/recvmsg.c Tue Aug 14 09:56:50 2001 +++ dietlibc-0.21/lib/recvmsg.c Tue Aug 27 06:21:47 2002 @@ -3,16 +3,10 @@ extern int socketcall(int callno,long* args); -#ifdef __i386__ -int __libc_recvmsg(int a); -int __libc_recvmsg(int a) { - return socketcall(SYS_RECVMSG, (long*)&a); -#else int __libc_recvmsg(int a, struct msghdr* msg, int flags); int __libc_recvmsg(int a, struct msghdr* msg, int flags) { unsigned long args[] = { a, (long) msg, flags }; return socketcall(SYS_RECVMSG, args); -#endif } int recvmsg(int a, struct msghdr *msg, int flags) diff -uNr dietlibc-0.20/lib/send.c dietlibc-0.21/lib/send.c --- dietlibc-0.20/lib/send.c Tue Aug 14 09:56:50 2001 +++ dietlibc-0.21/lib/send.c Tue Aug 27 06:21:51 2002 @@ -3,16 +3,10 @@ extern int socketcall(int callno,long* args); -#ifdef __i386__ -int __libc_send(int a); -int __libc_send(int a) { - return socketcall(SYS_SEND, (long*)&a); -#else int __libc_send(int a, const void * b, size_t c, int flags); int __libc_send(int a, const void * b, size_t c, int flags) { unsigned long args[] = { a, (long) b, c, flags }; return socketcall(SYS_SEND, args); -#endif } int send(int a, const void * b, size_t c, int flags) diff -uNr dietlibc-0.20/lib/sendmsg.c dietlibc-0.21/lib/sendmsg.c --- dietlibc-0.20/lib/sendmsg.c Tue Aug 14 09:56:50 2001 +++ dietlibc-0.21/lib/sendmsg.c Tue Aug 27 06:21:56 2002 @@ -3,16 +3,10 @@ extern int socketcall(int callno,long* args); -#ifdef __i386__ -int __libc_sendmsg(int a); -int __libc_sendmsg(int a) { - return socketcall(SYS_SENDMSG, (long*)&a); -#else int __libc_sendmsg(int a, const struct msghdr* msg, int flags); int __libc_sendmsg(int a, const struct msghdr* msg, int flags) { unsigned long args[] = { a, (long) msg, flags }; return socketcall(SYS_SENDMSG, args); -#endif } int sendmsg(int a, const struct msghdr *msg, int flags) diff -uNr dietlibc-0.20/lib/sendto.c dietlibc-0.21/lib/sendto.c --- dietlibc-0.20/lib/sendto.c Tue Aug 14 09:56:50 2001 +++ dietlibc-0.21/lib/sendto.c Tue Aug 27 06:21:58 2002 @@ -3,16 +3,10 @@ extern int socketcall(int callno,long* args); -#ifdef __i386__ -int __libc_sendto(int a); -int __libc_sendto(int a) { - return socketcall(SYS_SENDTO, (long*)&a); -#else int __libc_sendto(int a, const void * b, size_t c, int flags, void *to, int tolen); int __libc_sendto(int a, const void * b, size_t c, int flags, void *to, int tolen) { unsigned long args[] = { a, (long) b, c, flags, (long) to, tolen }; return socketcall(SYS_SENDTO, args); -#endif } int sendto(int a, const void * b, size_t c, int flags, const struct sockaddr* to, socklen_t tolen) diff -uNr dietlibc-0.20/lib/setsockopt.c dietlibc-0.21/lib/setsockopt.c --- dietlibc-0.20/lib/setsockopt.c Tue Aug 14 09:56:50 2001 +++ dietlibc-0.21/lib/setsockopt.c Tue Aug 27 06:22:04 2002 @@ -3,16 +3,10 @@ extern int socketcall(int callno,long* args); -#ifdef __i386__ -int __libc_setsockopt(int a); -int __libc_setsockopt(int a) { - return socketcall(SYS_SETSOCKOPT, (long*)&a); -#else int __libc_setsockopt(int a, int b, int c, void *d, void *e); int __libc_setsockopt(int a, int b, int c, void *d, void *e) { unsigned long args[] = { a, b, c, (long)d, (long) e }; return socketcall(SYS_SETSOCKOPT, args); -#endif } int setsockopt(int s, int level, int optname, const void* optval, socklen_t optlen) __attribute__((weak,alias("__libc_setsockopt"))); diff -uNr dietlibc-0.20/lib/shutdown.c dietlibc-0.21/lib/shutdown.c --- dietlibc-0.20/lib/shutdown.c Tue Aug 14 09:56:50 2001 +++ dietlibc-0.21/lib/shutdown.c Tue Aug 27 06:22:08 2002 @@ -3,16 +3,10 @@ extern int socketcall(int callno,long* args); -#ifdef __i386__ -int __libc_shutdown(int s); -int __libc_shutdown(int s) { - return socketcall(SYS_SHUTDOWN, (long*)&s); -#else int __libc_shutdown(int s, int how); int __libc_shutdown(int s, int how) { unsigned long args[] = { s, (long) how, 0 }; return socketcall(SYS_SHUTDOWN, args); -#endif } int shutdown(int s, int how) __attribute__((weak,alias("__libc_shutdown"))); diff -uNr dietlibc-0.20/lib/sigaction.c dietlibc-0.21/lib/sigaction.c --- dietlibc-0.20/lib/sigaction.c Mon Jul 23 12:24:34 2001 +++ dietlibc-0.21/lib/sigaction.c Tue Aug 20 13:04:01 2002 @@ -2,6 +2,10 @@ int __rt_sigaction(int signum, const struct sigaction *act, struct sigaction *oldact, long nr); -int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact) { +int __libc_sigaction(int signum, const struct sigaction *act, struct sigaction *oldact); +int __libc_sigaction(int signum, const struct sigaction *act, struct sigaction *oldact) { return __rt_sigaction(signum, act, oldact, _NSIG/8); } + +int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact) +__attribute__((weak,alias("__libc_sigaction"))); diff -uNr dietlibc-0.20/lib/signal.c dietlibc-0.21/lib/signal.c --- dietlibc-0.20/lib/signal.c Wed May 29 06:48:11 2002 +++ dietlibc-0.21/lib/signal.c Fri Sep 6 12:17:00 2002 @@ -5,7 +5,7 @@ sa.sa_handler=action; sigemptyset(&sa.sa_mask); sigaddset(&sa.sa_mask,signum); - sa.sa_flags=SA_RESTART; + sa.sa_flags=SA_RESTART|SA_RESETHAND; if (sigaction(signum,&sa,&oa)) return SIG_ERR; return oa.sa_handler; diff -uNr dietlibc-0.20/lib/socket.c dietlibc-0.21/lib/socket.c --- dietlibc-0.20/lib/socket.c Tue Aug 14 09:56:50 2001 +++ dietlibc-0.21/lib/socket.c Tue Aug 27 06:18:53 2002 @@ -2,16 +2,10 @@ extern int socketcall(int callno,long* args); -#ifdef __i386__ -int __libc_socket(int a); -int __libc_socket(int a) { - return socketcall(SYS_SOCKET, (long*)&a); -#else int __libc_socket(int a, int b, int c); int __libc_socket(int a, int b, int c) { unsigned long args[] = { a, b, c }; return socketcall(SYS_SOCKET, args); -#endif } int socket(int a,int b,int c) __attribute__((weak,alias("__libc_socket"))); diff -uNr dietlibc-0.20/lib/socketpair.c dietlibc-0.21/lib/socketpair.c --- dietlibc-0.20/lib/socketpair.c Mon Feb 25 06:50:05 2002 +++ dietlibc-0.21/lib/socketpair.c Tue Aug 27 06:22:16 2002 @@ -2,16 +2,10 @@ extern int socketcall(int callno,long* args); -#ifdef __i386__ -int __libc_socketpair(int a); -int __libc_socketpair(int a) { - return socketcall(SYS_SOCKETPAIR, (long*)&a); -#else int __libc_socketpair(int a, int type, int protocol, int sv[2]); int __libc_socketpair(int a, int type, int protocol, int sv[2]) { unsigned long args[] = { a, type, protocol, (long)sv }; return socketcall(SYS_SOCKETPAIR, args); -#endif } int socketpair(int d, int type, int protocol, int sv[2]) diff -uNr dietlibc-0.20/lib/strtof.c dietlibc-0.21/lib/strtof.c --- dietlibc-0.20/lib/strtof.c Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/lib/strtof.c Fri Sep 13 05:06:34 2002 @@ -0,0 +1,66 @@ +#include +#include +#include + +float strtof(const char* s, char** endptr) { + register const char* p = s; + register float value = 0.; + int sign = +1; + float factor; + unsigned int expo; + + while ( isspace(*p) ) + p++; + + switch (*p) { + case '-': sign = -1; + case '+': p++; + default : break; + } + + while ( (unsigned int)(*p - '0') < 10u ) + value = value*10 + (*p++ - '0'); + + if ( *p == '.' ) { + factor = 1.; + + p++; + while ( (unsigned int)(*p - '0') < 10u ) { + factor *= 0.1; + value += (*p++ - '0') * factor; + } + } + + if ( (*p | 32) == 'e' ) { + expo = 0; + factor = 10.L; + + switch (*++p) { // ja hier weiß ich nicht, was mindestens nach einem 'E' folgenden MUSS. + case '-': factor = 0.1; + case '+': p++; + break; + case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': + break; + default : value = 0.L; + p = s; + goto done; + } + + while ( (unsigned int)(*p - '0') < 10u ) + expo = 10 * expo + (*p++ - '0'); + + while ( 1 ) { + if ( expo & 1 ) + value *= factor; + if ( (expo >>= 1) == 0 ) + break; + factor *= factor; + } + } + +done: + if ( endptr != NULL ) + *endptr = (char*)p; + + return value * sign; +} diff -uNr dietlibc-0.20/lib/strtold.c dietlibc-0.21/lib/strtold.c --- dietlibc-0.20/lib/strtold.c Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/lib/strtold.c Fri Sep 13 05:07:03 2002 @@ -0,0 +1,66 @@ +#include +#include +#include + +long double strtold(const char* s, char** endptr) { + register const char* p = s; + register long double value = 0.L; + int sign = +1; + long double factor; + unsigned int expo; + + while ( isspace(*p) ) + p++; + + switch (*p) { + case '-': sign = -1; + case '+': p++; + default : break; + } + + while ( (unsigned int)(*p - '0') < 10u ) + value = value*10 + (*p++ - '0'); + + if ( *p == '.' ) { + factor = 1.; + + p++; + while ( (unsigned int)(*p - '0') < 10u ) { + factor *= 0.1; + value += (*p++ - '0') * factor; + } + } + + if ( (*p | 32) == 'e' ) { + expo = 0; + factor = 10.L; + + switch (*++p) { // ja hier weiß ich nicht, was mindestens nach einem 'E' folgenden MUSS. + case '-': factor = 0.1; + case '+': p++; + break; + case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': + break; + default : value = 0.L; + p = s; + goto done; + } + + while ( (unsigned int)(*p - '0') < 10u ) + expo = 10 * expo + (*p++ - '0'); + + while ( 1 ) { + if ( expo & 1 ) + value *= factor; + if ( (expo >>= 1) == 0 ) + break; + factor *= factor; + } + } + +done: + if ( endptr != NULL ) + *endptr = (char*)p; + + return value * sign; +} diff -uNr dietlibc-0.20/lib/sys_siglist.c dietlibc-0.21/lib/sys_siglist.c --- dietlibc-0.20/lib/sys_siglist.c Tue Jan 9 09:57:43 2001 +++ dietlibc-0.21/lib/sys_siglist.c Fri Sep 27 05:26:35 2002 @@ -1,37 +1,174 @@ -const char *const sys_siglist[] = - { - "Signal 0", - "Hangup", - "Interrupt", - "Quit", - "Illegal instruction", - "Trace/breakpoint trap", - "IOT trap", - "EMT trap", - "Floating point exception", - "Killed", - "Bus error", - "Segmentation fault", - "Bad system call", - "Broken pipe", - "Alarm clock", - "Terminated", - "Urgent I/O condition", - "Stopped (signal)", - "Stopped", - "Continued", - "Child exited", - "Stopped (tty input)", - "Stopped (tty output)", - "I/O possible", - "CPU time limit exceeded", - "File size limit exceeded", - "Virtual timer expired", - "Profiling timer expired", - "Window changed", - "Resource lost", - "User defined signal 1", - "User defined signal 2", - 0 - }; +const char *const sys_siglist[] = { + "Signal 0", + "Hangup", + "Interrupt", + "Quit", + "Illegal instruction", + "Trace/breakpoint trap", + "ABRT/IOT trap", +#if defined(__alpha__) || defined(__sparc__) || defined(__mips__) || defined(__hppa__) + "EMT trap", +#else + "Bus error", +#endif + "Floating point exception", + "Killed", +#if defined(__alpha__) || defined(__sparc__) || defined(__mips__) || defined(__hppa__) + "Bus error", +#else + "User defined signal 1", +#endif + "Segmentation fault", +#if defined(__alpha__) || defined(__sparc__) || defined(__mips__) || defined(__hppa__) + "Bad system call", +#else + "User defined signal 2", +#endif + "Broken pipe", + "Alarm clock", + "Terminated", +#if defined(__hppa__) + "User defined signal 1", + "User defined signal 2", + "Child exited", + "Power lost", + "Virtual timer expired", + "Profiling timer expired", + "I/O possible", + "Window changed", + "Stopped (signal)", + "Stopped", + "Continued", + "Stopped (tty input)", + "Stopped (tty output)", + "Urgent I/O condition", + "Power lost", + "Unknown", + "Unknown", + "CPU time limit exceeded", + "File size limit exceeded", + "Unknown", + "Stack fault", +#elif defined(__mips__) + "User defined signal 1", + "User defined signal 2", + "Child exited", + "Power lost", + "Window changed", + "Urgent I/O condition", + "I/O possible", + "Stopped (signal)", + "Stopped", + "Continued", + "Stopped (tty input)", + "Stopped (tty output)", + "Virtual timer expired", + "Profiling timer expired", + "CPU time limit exceeded", + "File size limit exceeded", +#elif defined(__alpha__) || defined(__sparc__) + "Urgent I/O condition", + "Stopped (signal)", + "Stopped", + "Continued", + "Child exited", + "Stopped (tty input)", + "Stopped (tty output)", + "I/O possible", + "CPU time limit exceeded", + "File size limit exceeded", + "Virtual timer expired", + "Profiling timer expired", + "Window changed", + "Power/Resource lost", + "User defined signal 1", + "User defined signal 2", +#else + "Stack fault", + "Child exited", + "Continued", + "Stopped (signal)", + "Stopped", + "Stopped (tty input)", + "Stopped (tty output)", + "Urgent I/O condition", + "CPU time limit exceeded", + "File size limit exceeded", + "Virtual timer expired", + "Profiling timer expired", + "Window changed", + "I/O possible", + "Power lost", + "Bad system call", +#endif +#ifndef __hppa__ + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", +#endif + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", +#ifdef __mips__ + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", + "Real time signal", +#endif + 0 +}; diff -uNr dietlibc-0.20/libcruft/__prepare_parse.c dietlibc-0.21/libcruft/__prepare_parse.c --- dietlibc-0.20/libcruft/__prepare_parse.c Tue Jan 29 07:43:01 2002 +++ dietlibc-0.21/libcruft/__prepare_parse.c Fri Sep 13 04:58:57 2002 @@ -11,7 +11,7 @@ fd=open(filename,O_RDONLY); if (fd>=0) { s->buflen=lseek(fd,0,SEEK_END); - s->buffirst=mmap(0,s->buflen,PROT_READ,MAP_SHARED,fd,0); + s->buffirst=mmap(0,s->buflen,PROT_READ,MAP_PRIVATE,fd,0); if (s->buffirst==(const unsigned char*)-1) s->buffirst=0; close(fd); diff -uNr dietlibc-0.20/libcruft/gethostbyaddr_r.c dietlibc-0.21/libcruft/gethostbyaddr_r.c --- dietlibc-0.20/libcruft/gethostbyaddr_r.c Mon Feb 25 06:50:05 2002 +++ dietlibc-0.21/libcruft/gethostbyaddr_r.c Wed Sep 18 09:51:01 2002 @@ -65,11 +65,20 @@ } strcpy(tmp,".ip6.int"); } else return 1; - res= __dns_gethostbyx_r(tmpbuf,result,buf+4,buflen-4,RESULT,h_errnop,12); /* 12 == ns_t_ptr */ + if (buflenh_length=4; + result->h_addrtype=format; + } + memcpy(buf,addr,result->h_length); result->h_addr_list[0]=buf; - result->h_addr_list[1]=buf; - *(int*)buf=*(int*)addr; + result->h_addr_list[1]=0; } return res; } diff -uNr dietlibc-0.20/libcruft/gethostbyname_r.c dietlibc-0.21/libcruft/gethostbyname_r.c --- dietlibc-0.20/libcruft/gethostbyname_r.c Thu Feb 7 06:57:42 2002 +++ dietlibc-0.21/libcruft/gethostbyname_r.c Mon Aug 19 02:40:45 2002 @@ -21,6 +21,26 @@ result->h_name=buf; if (buflenh_addr_list=(char**)(buf+strlen(name)+1); + result->h_addr_list+=sizeof(unsigned long)-((unsigned long)(result->h_addr_list)&(sizeof(unsigned long)-1)); + result->h_addr_list[0]=(char*)&result->h_addr_list[2]; + if (inet_pton(AF_INET,name,result->h_addr_list[0])) { + result->h_addrtype=AF_INET; + result->h_length=4; +commonip: + result->h_aliases=result->h_addr_list+2*sizeof(char**); + result->h_aliases[0]=0; + result->h_addr_list[1]=0; + *RESULT=result; + *h_errnop=0; + return 0; + } else if (inet_pton(AF_INET6,name,result->h_addr_list[0])) { + result->h_addrtype=AF_INET6; + result->h_length=16; + goto commonip; + } +#endif #ifdef WANT_ETC_HOSTS { struct hostent* r; diff -uNr dietlibc-0.20/libdl/README dietlibc-0.21/libdl/README --- dietlibc-0.20/libdl/README Sun Mar 17 11:42:35 2002 +++ dietlibc-0.21/libdl/README Fri Sep 13 07:37:31 2002 @@ -2,6 +2,11 @@ written by Olaf Dreesen +Fri Sep 13 16:28:42 CEST 2002 + +this unified libdl/dynlinker is now the default. + + Mon Mar 11 19:44:20 CET 2002 the unified libdl/dynlinker now seems to stand the NORMAL usage so I think diff -uNr dietlibc-0.20/libdl/_dl_int.h dietlibc-0.21/libdl/_dl_int.h --- dietlibc-0.20/libdl/_dl_int.h Sun Mar 17 11:42:35 2002 +++ dietlibc-0.21/libdl/_dl_int.h Fri Sep 13 07:37:31 2002 @@ -129,7 +129,7 @@ int _dl_relocate(struct _dl_handle* dh, _dl_rel_t *rel, int num); /* dlerror.c */ -extern int _dl_error; +extern unsigned int _dl_error; extern const char* _dl_error_location; extern const char* _dl_error_data; #endif diff -uNr dietlibc-0.20/libdl/_dl_load.c dietlibc-0.21/libdl/_dl_load.c --- dietlibc-0.20/libdl/_dl_load.c Sun Mar 17 11:42:36 2002 +++ dietlibc-0.21/libdl/_dl_load.c Fri Aug 30 16:58:57 2002 @@ -49,7 +49,7 @@ Elf_Phdr *ph; int ld_nr=0; - Elf_Phdr *ld[4]={0,0,0,0}; + Elf_Phdr **ld=0; Elf_Phdr *dyn=0; if (fd==-1) return 0; @@ -77,6 +77,11 @@ ph=(Elf_Phdr*)&buf[eh->e_phoff]; for (i=0; ie_phnum; i++) { + if (ph[i].p_type==PT_LOAD) ++ld_nr; + } + ld=alloca(ld_nr*sizeof(Elf_Phdr)); + + for (ld_nr=i=0; ie_phnum; i++) { if (ph[i].p_type==PT_LOAD) { ld[ld_nr++]=ph+i; } diff -uNr dietlibc-0.20/libdl/_dl_main.c dietlibc-0.21/libdl/_dl_main.c --- dietlibc-0.20/libdl/_dl_main.c Fri Jun 7 09:39:18 2002 +++ dietlibc-0.21/libdl/_dl_main.c Fri Sep 13 16:12:54 2002 @@ -476,6 +476,7 @@ Elf_Phdr*ld[4]={0,0,0,0}; Elf_Phdr*dyn=0; + if (0) { pathname=0; } /* no unused parameter */ if (fd==-1) return 0; if (_dl_sys_fstat(fd,&st)<0) { @@ -688,7 +689,7 @@ /* TEXT RELOCATIONS POSSIBLE -> NO SHARED OBJECT */ case DT_TEXTREL: #ifdef DEBUG - pf(__func__": found possible textrelocation -> "); pf(dh->name); pf("is no compiled as a shared library\n"); + pf(__func__": found possible textrelocation -> "); pf(dh->name); pf(" is not compiled as a shared library\n"); #endif _dl_error_data=dh->name; _dl_error=3; @@ -702,6 +703,7 @@ pf(__func__": unknown "); ph(_dynamic[i].d_tag); pf(", "); ph(_dynamic[i].d_un.d_val); pf("\n"); #endif #endif + break; } } @@ -951,7 +953,7 @@ struct _dl_handle*prog,*mydh; struct _dl_handle my_dh; Elf_Dyn*prog_dynamic=0; - int i; + unsigned int i; if (0) _dl_main(argc,argv,envp,_dynamic); /* TRICK: no warning */ diff -uNr dietlibc-0.20/libdl/dlerror.c dietlibc-0.21/libdl/dlerror.c --- dietlibc-0.20/libdl/dlerror.c Sun Mar 17 11:42:36 2002 +++ dietlibc-0.21/libdl/dlerror.c Fri Sep 13 07:37:31 2002 @@ -2,12 +2,12 @@ #include "_dl_int.h" #ifdef __DIET_LD_SO__ -static int _dl_error; +static unsigned int _dl_error; static const char*_dl_error_location; static const char*_dl_error_data; #else #include -int _dl_error; +unsigned int _dl_error; const char*_dl_error_location; const char*_dl_error_data; #endif diff -uNr dietlibc-0.20/libregex/rx.c dietlibc-0.21/libregex/rx.c --- dietlibc-0.20/libregex/rx.c Mon Aug 5 13:27:36 2002 +++ dietlibc-0.21/libregex/rx.c Sat Aug 24 06:29:39 2002 @@ -153,7 +153,7 @@ #ifdef DEBUG printf("matching atom LINEEND against \"%s\"\n",s); #endif - if ((*s && *s!='\n') || (eflags®_NOTEOL)==0) break; + if ((*s && *s!='\n') || (eflags®_NOTEOL)) break; goto match; case WORDSTART: #ifdef DEBUG diff -uNr dietlibc-0.20/libugly/strsignal.c dietlibc-0.21/libugly/strsignal.c --- dietlibc-0.20/libugly/strsignal.c Tue Jun 4 16:40:00 2002 +++ dietlibc-0.21/libugly/strsignal.c Fri Sep 27 05:26:35 2002 @@ -3,9 +3,8 @@ #include const char* strsignal(int sig) { - if (sig<=SIGUNUSED) return sys_siglist[sig]; - else if ((sig>=SIGRTMIN)&&(sig<=SIGRTMAX)) - return "Real time signal"; + if (sig<=SIGRTMAX) + return sys_siglist[sig]; else return "(unknown signal)"; } diff -uNr dietlibc-0.20/libugly/tzfile.c dietlibc-0.21/libugly/tzfile.c --- dietlibc-0.20/libugly/tzfile.c Fri Jul 26 11:44:10 2002 +++ dietlibc-0.21/libugly/tzfile.c Fri Sep 13 04:58:57 2002 @@ -21,7 +21,7 @@ tzlen=0; if ((fd=open("/etc/localtime",O_RDONLY))<0) return; len=lseek(fd,0,SEEK_END); - if ((tzfile=mmap(0,len,PROT_READ,MAP_SHARED,fd,0))==MAP_FAILED) return; + if ((tzfile=mmap(0,len,PROT_READ,MAP_PRIVATE,fd,0))==MAP_FAILED) return; close(fd); if (ntohl(*(int*)tzfile) != 0x545a6966) return; tzlen=len; diff -uNr dietlibc-0.20/mips/Makefile.add dietlibc-0.21/mips/Makefile.add --- dietlibc-0.20/mips/Makefile.add Mon Feb 18 07:21:23 2002 +++ dietlibc-0.21/mips/Makefile.add Fri Sep 13 04:58:57 2002 @@ -1,5 +1,3 @@ -LIBOBJ+=$(OBJDIR)/setjmp_aux.o - # Now this needs explanation. # mips-linux is per default big endian. Then they ported it to little # endian MIPS (Windoze CE handhelds mostly) and named the architecture @@ -11,5 +9,5 @@ ifeq ($(CROSS),mips-linux-) ENDIAN=-EB endif -CFLAGS+=$(ENDIAN) -Os -G 0 -fstrict-aliasing -fno-pic -mno-abicalls +CFLAGS+=$(ENDIAN) -Os -G 8 -fstrict-aliasing -fno-pic -mno-abicalls VPATH:=mips:syscalls.s:$(VPATH) diff -uNr dietlibc-0.20/mips/__longjmp.S dietlibc-0.21/mips/__longjmp.S --- dietlibc-0.20/mips/__longjmp.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/mips/__longjmp.S Thu Sep 12 04:47:31 2002 @@ -0,0 +1,36 @@ +.text +.align 2 +.global __longjmp +.ent __longjmp +__longjmp: + /* restore FP callee-save regiser */ + l.d $f20, 56($4) + l.d $f22, 64($4) + l.d $f24, 72($4) + l.d $f26, 80($4) + l.d $f28, 88($4) + l.d $f30, 96($4) + /* restore Coprocessor Status Register */ + lw $2, 48($4) + lw $gp, 44($4) + ctc1 $2, $31 + /* restore callee-save register */ + lw $25, 0($4) /* ra */ + lw $29, 4($4) /* sp */ + lw $16, 8($4) /* s0 */ + lw $17, 12($4) /* s1 */ + lw $18, 16($4) /* s2 */ + lw $19, 20($4) /* s3 */ + lw $20, 24($4) /* s4 */ + lw $21, 28($4) /* s5 */ + lw $22, 32($4) /* s6 */ + lw $23, 36($4) /* s7 */ + lw $30, 40($4) /* fp */ + + /* never return 0 */ + move $2, $5 + bne $5, $0, $L3 + li $2, 1 +$L3: + jr $25 +.end __longjmp diff -uNr dietlibc-0.20/mips/__longjmp.c dietlibc-0.21/mips/__longjmp.c --- dietlibc-0.20/mips/__longjmp.c Tue Jan 9 09:57:43 2001 +++ dietlibc-0.21/mips/__longjmp.c Wed Dec 31 16:00:00 1969 @@ -1,84 +0,0 @@ -/* Copyright (C) 1992, 1995, 1997, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Brendan Kehoe (brendan@zen.org). - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - -#undef __longjmp - -#ifndef __GNUC__ - #error This file uses GNU C extensions; you must compile with GCC. -#endif - -void -__longjmp (env, val_arg) - __jmp_buf env; - int val_arg; -{ - /* gcc 1.39.19 miscompiled the longjmp routine (as it did setjmp before - the hack around it); force it to use $a1 for the longjmp value. - Without this it saves $a1 in a register which gets clobbered - along the way. */ - register int val asm ("a1"); - - /* Pull back the floating point callee-saved registers. */ - asm volatile ("l.d $f20, %0" : : "m" (env[0].__fpregs[0])); - asm volatile ("l.d $f22, %0" : : "m" (env[0].__fpregs[1])); - asm volatile ("l.d $f24, %0" : : "m" (env[0].__fpregs[2])); - asm volatile ("l.d $f26, %0" : : "m" (env[0].__fpregs[3])); - asm volatile ("l.d $f28, %0" : : "m" (env[0].__fpregs[4])); - asm volatile ("l.d $f30, %0" : : "m" (env[0].__fpregs[5])); - - /* Restore the stack pointer. */ - asm volatile ("lw $29, %0" : : "m" (env[0].__sp)); - - /* Get and reconstruct the floating point csr. */ - asm volatile ("lw $2, %0" : : "m" (env[0].__fpc_csr)); - asm volatile ("ctc1 $2, $31"); - - /* Get the FP. */ - asm volatile ("lw $30, %0" : : "m" (env[0].__fp)); - - /* Get the GP. */ - asm volatile ("lw $gp, %0" : : "m" (env[0].__gp)); - - /* Get the callee-saved registers. */ - asm volatile ("lw $16, %0" : : "m" (env[0].__regs[0])); - asm volatile ("lw $17, %0" : : "m" (env[0].__regs[1])); - asm volatile ("lw $18, %0" : : "m" (env[0].__regs[2])); - asm volatile ("lw $19, %0" : : "m" (env[0].__regs[3])); - asm volatile ("lw $20, %0" : : "m" (env[0].__regs[4])); - asm volatile ("lw $21, %0" : : "m" (env[0].__regs[5])); - asm volatile ("lw $22, %0" : : "m" (env[0].__regs[6])); - asm volatile ("lw $23, %0" : : "m" (env[0].__regs[7])); - - /* Get the PC. */ - asm volatile ("lw $25, %0" : : "m" (env[0].__pc)); - - /* Give setjmp 1 if given a 0, or what they gave us if non-zero. */ - if (val == 0) - asm volatile ("li $2, 1"); - else - asm volatile ("move $2, %0" : : "r" (val)); - - asm volatile ("jr $25"); - - /* Avoid `volatile function does return' warnings. */ - for (;;); -} diff -uNr dietlibc-0.20/mips/accept.S dietlibc-0.21/mips/accept.S --- dietlibc-0.20/mips/accept.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/mips/accept.S Thu Sep 12 06:07:47 2002 @@ -0,0 +1,3 @@ +#include "syscalls.h" + +syscall_weak(accept,accept,__libc_accept) diff -uNr dietlibc-0.20/mips/bind.S dietlibc-0.21/mips/bind.S --- dietlibc-0.20/mips/bind.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/mips/bind.S Thu Sep 12 06:11:22 2002 @@ -0,0 +1,3 @@ +#include "syscalls.h" + +syscall(bind,bind) diff -uNr dietlibc-0.20/mips/connect.S dietlibc-0.21/mips/connect.S --- dietlibc-0.20/mips/connect.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/mips/connect.S Thu Sep 12 06:07:47 2002 @@ -0,0 +1,3 @@ +#include "syscalls.h" + +syscall_weak(connect,connect,__libc_connect) diff -uNr dietlibc-0.20/mips/getpeername.S dietlibc-0.21/mips/getpeername.S --- dietlibc-0.20/mips/getpeername.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/mips/getpeername.S Thu Sep 12 06:07:47 2002 @@ -0,0 +1,3 @@ +#include "syscalls.h" + +syscall(getpeername,getpeername) diff -uNr dietlibc-0.20/mips/getsockname.S dietlibc-0.21/mips/getsockname.S --- dietlibc-0.20/mips/getsockname.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/mips/getsockname.S Thu Sep 12 06:07:47 2002 @@ -0,0 +1,3 @@ +#include "syscalls.h" + +syscall(getsockname,getsockname) diff -uNr dietlibc-0.20/mips/getsockopt.S dietlibc-0.21/mips/getsockopt.S --- dietlibc-0.20/mips/getsockopt.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/mips/getsockopt.S Thu Sep 12 06:07:47 2002 @@ -0,0 +1,3 @@ +#include "syscalls.h" + +syscall(getsockopt,getsockopt) diff -uNr dietlibc-0.20/mips/listen.S dietlibc-0.21/mips/listen.S --- dietlibc-0.20/mips/listen.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/mips/listen.S Thu Sep 12 06:07:47 2002 @@ -0,0 +1,3 @@ +#include "syscalls.h" + +syscall(listen,listen) diff -uNr dietlibc-0.20/mips/recv.S dietlibc-0.21/mips/recv.S --- dietlibc-0.20/mips/recv.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/mips/recv.S Thu Sep 12 06:07:47 2002 @@ -0,0 +1,3 @@ +#include "syscalls.h" + +syscall_weak(recv,recv,__libc_recv) diff -uNr dietlibc-0.20/mips/recvfrom.S dietlibc-0.21/mips/recvfrom.S --- dietlibc-0.20/mips/recvfrom.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/mips/recvfrom.S Thu Sep 12 06:07:47 2002 @@ -0,0 +1,3 @@ +#include "syscalls.h" + +syscall_weak(recvfrom,recvfrom,__libc_recvfrom) diff -uNr dietlibc-0.20/mips/recvmsg.S dietlibc-0.21/mips/recvmsg.S --- dietlibc-0.20/mips/recvmsg.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/mips/recvmsg.S Thu Sep 12 06:07:47 2002 @@ -0,0 +1,3 @@ +#include "syscalls.h" + +syscall(recvmsg,recvmsg) diff -uNr dietlibc-0.20/mips/send.S dietlibc-0.21/mips/send.S --- dietlibc-0.20/mips/send.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/mips/send.S Thu Sep 12 06:07:47 2002 @@ -0,0 +1,3 @@ +#include "syscalls.h" + +syscall_weak(send,send,__libc_send) diff -uNr dietlibc-0.20/mips/sendmsg.S dietlibc-0.21/mips/sendmsg.S --- dietlibc-0.20/mips/sendmsg.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/mips/sendmsg.S Thu Sep 12 06:07:47 2002 @@ -0,0 +1,3 @@ +#include "syscalls.h" + +syscall(sendmsg,sendmsg) diff -uNr dietlibc-0.20/mips/sendto.S dietlibc-0.21/mips/sendto.S --- dietlibc-0.20/mips/sendto.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/mips/sendto.S Thu Sep 12 06:07:47 2002 @@ -0,0 +1,3 @@ +#include "syscalls.h" + +syscall_weak(sendto,sendto,__libc_sendto) diff -uNr dietlibc-0.20/mips/setjmp.S dietlibc-0.21/mips/setjmp.S --- dietlibc-0.20/mips/setjmp.S Mon Aug 13 08:38:41 2001 +++ dietlibc-0.21/mips/setjmp.S Fri Sep 13 04:58:57 2002 @@ -1,15 +1,39 @@ -#define a2 $6 -#define a3 $7 -#define sp $29 /* stack pointer */ -#define fp $30 /* frame pointer */ -#define t9 $25 - .text +.align 2 +setjmp: +.global __setjmp +.ent __setjmp +__setjmp: + li $5, 0 /* don't save sigmask */ +.end __setjmp .global __sigsetjmp -.type __sigsetjmp,@function +.ent __sigsetjmp __sigsetjmp: - la t9, __sigsetjmp_aux - move a2, sp - move a3, fp - jr t9 - + /* where to jump later */ + la $25, __sigjmp_save + /* callee save floating point save registers (double) */ + s.d $f20, 56($4) /* fs0 */ + s.d $f22, 64($4) /* fs1 */ + s.d $f24, 72($4) /* fs2 */ + s.d $f26, 80($4) /* fs3 */ + s.d $f28, 88($4) /* fs4 */ + s.d $f30, 96($4) /* fs6 */ + /* save coprocessor status register */ + cfc1 $2, $31 + /* callee save register */ + sw $gp, 44($4) + sw $2, 48($4) + sw $31, 0($4) /* ra */ + sw $29, 4($4) /* sp */ + sw $16, 8($4) /* s0 */ + sw $17, 12($4) /* s1 */ + sw $18, 16($4) /* s2 */ + sw $19, 20($4) /* s3 */ + sw $20, 24($4) /* s4 */ + sw $21, 28($4) /* s5 */ + sw $22, 32($4) /* s6 */ + sw $23, 36($4) /* s7 */ + sw $30, 40($4) /* fp */ + j $25 +.end __sigsetjmp +.weak setjmp diff -uNr dietlibc-0.20/mips/setjmp_aux.c dietlibc-0.21/mips/setjmp_aux.c --- dietlibc-0.20/mips/setjmp_aux.c Mon Mar 5 09:24:40 2001 +++ dietlibc-0.21/mips/setjmp_aux.c Wed Dec 31 16:00:00 1969 @@ -1,66 +0,0 @@ -/* Copyright (C) 1996, 1997, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Brendan Kehoe (brendan@zen.org). - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -/* This function is only called via the assembly language routine - __sigsetjmp, which arranges to pass in the stack pointer and the frame - pointer. We do things this way because it's difficult to reliably - access them in C. */ -extern int __sigjmp_save(jmp_buf env, int savemask); - -int -__sigsetjmp_aux (jmp_buf env, int savemask, int sp, int fp) -{ - /* Store the floating point callee-saved registers... */ - asm volatile ("s.d $f20, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[0])); - asm volatile ("s.d $f22, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[1])); - asm volatile ("s.d $f24, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[2])); - asm volatile ("s.d $f26, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[3])); - asm volatile ("s.d $f28, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[4])); - asm volatile ("s.d $f30, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[5])); - - /* .. and the PC; */ - asm volatile ("sw $31, %0" : : "m" (env[0].__jmpbuf[0].__pc)); - - /* .. and the stack pointer; */ - env[0].__jmpbuf[0].__sp = (void *) sp; - - /* .. and the FP; it'll be in s8. */ - env[0].__jmpbuf[0].__fp = (void *) fp; - - /* .. and the GP; */ - asm volatile ("sw $gp, %0" : : "m" (env[0].__jmpbuf[0].__gp)); - - /* .. and the callee-saved registers; */ - asm volatile ("sw $16, %0" : : "m" (env[0].__jmpbuf[0].__regs[0])); - asm volatile ("sw $17, %0" : : "m" (env[0].__jmpbuf[0].__regs[1])); - asm volatile ("sw $18, %0" : : "m" (env[0].__jmpbuf[0].__regs[2])); - asm volatile ("sw $19, %0" : : "m" (env[0].__jmpbuf[0].__regs[3])); - asm volatile ("sw $20, %0" : : "m" (env[0].__jmpbuf[0].__regs[4])); - asm volatile ("sw $21, %0" : : "m" (env[0].__jmpbuf[0].__regs[5])); - asm volatile ("sw $22, %0" : : "m" (env[0].__jmpbuf[0].__regs[6])); - asm volatile ("sw $23, %0" : : "m" (env[0].__jmpbuf[0].__regs[7])); - - /* .. and finally get and reconstruct the floating point csr. */ - asm ("cfc1 %0, $31" : "=r" (env[0].__jmpbuf[0].__fpc_csr)); - - /* Save the signal mask if requested. */ - return __sigjmp_save (env, savemask); -} diff -uNr dietlibc-0.20/mips/setsockopt.S dietlibc-0.21/mips/setsockopt.S --- dietlibc-0.20/mips/setsockopt.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/mips/setsockopt.S Thu Sep 12 06:07:47 2002 @@ -0,0 +1,3 @@ +#include "syscalls.h" + +syscall(setsockopt,setsockopt) diff -uNr dietlibc-0.20/mips/shutdown.S dietlibc-0.21/mips/shutdown.S --- dietlibc-0.20/mips/shutdown.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/mips/shutdown.S Thu Sep 12 06:11:22 2002 @@ -0,0 +1,3 @@ +#include "syscalls.h" + +syscall(shutdown,shutdown) diff -uNr dietlibc-0.20/mips/socket.S dietlibc-0.21/mips/socket.S --- dietlibc-0.20/mips/socket.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/mips/socket.S Thu Sep 12 06:07:47 2002 @@ -0,0 +1,3 @@ +#include "syscalls.h" + +syscall(socket,socket) diff -uNr dietlibc-0.20/mips/socketcall.S dietlibc-0.21/mips/socketcall.S --- dietlibc-0.20/mips/socketcall.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/mips/socketcall.S Thu Sep 12 06:11:22 2002 @@ -0,0 +1,5 @@ +#include "syscalls.h" + +/* + * Doesn't exist on mips ( accept, bind, ... are SYSCALLS !?! ) + */ diff -uNr dietlibc-0.20/mips/socketpair.S dietlibc-0.21/mips/socketpair.S --- dietlibc-0.20/mips/socketpair.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/mips/socketpair.S Thu Sep 12 06:07:47 2002 @@ -0,0 +1,3 @@ +#include "syscalls.h" + +syscall(socketpair,socketpair) diff -uNr dietlibc-0.20/mips/start.S dietlibc-0.21/mips/start.S --- dietlibc-0.20/mips/start.S Sun Mar 17 11:42:37 2002 +++ dietlibc-0.21/mips/start.S Mon Aug 19 01:30:59 2002 @@ -4,16 +4,25 @@ #define a0 4 #define a1 5 #define a2 6 +#define gp 28 .text .global __start .type __start,@function __start: +#ifdef __pic__ +/* initialize gp pointer */ .set noreorder bltzal $0,0f nop 0: .cpload $31 .set reorder +#else + /* _gp is provided by the linker and points into the middle of the + * "small data" section (.sdata and .sbss) allocated by the + * -G 8 compiler option */ + la $gp, _gp +#endif move $ra, $zero /* prime stack frame */ lw $a0, 0($sp) /* load argc */ addu $a1, $sp, 4 /* load argv. huh? should be 4, right? */ diff -uNr dietlibc-0.20/ppc/__testandset.S dietlibc-0.21/ppc/__testandset.S --- dietlibc-0.20/ppc/__testandset.S Thu Jun 7 15:14:27 2001 +++ dietlibc-0.21/ppc/__testandset.S Mon Sep 16 10:49:51 2002 @@ -2,10 +2,10 @@ .type __testandset,@function .align 2 __testandset: - lwarx 5,0,3 +1: lwarx 5,0,3 li 0,1 stwcx. 0,0,3 - bne __testandset + bne- 1b mr 3,5 blr .size __testandset,.-__testandset diff -uNr dietlibc-0.20/ppc/start.S dietlibc-0.21/ppc/start.S --- dietlibc-0.20/ppc/start.S Mon Jun 18 12:19:43 2001 +++ dietlibc-0.21/ppc/start.S Fri Sep 27 05:26:35 2002 @@ -1,5 +1,3 @@ -#ifdef __powerpc__ - .text .global _start .type _start,@function @@ -42,6 +40,3 @@ .section ".data" __data_start: - -#endif - diff -uNr dietlibc-0.20/s390/clone.S dietlibc-0.21/s390/clone.S --- dietlibc-0.20/s390/clone.S Mon Feb 25 08:00:32 2002 +++ dietlibc-0.21/s390/clone.S Mon Sep 16 10:49:51 2002 @@ -32,6 +32,6 @@ .Lerror: basr %r1, %r0 -.L0: al %r1, [.L1-.L0](%r1) +.L2: al %r1, [.L3-.L2](%r1) br %r1 -.L1: .long __error_unified_syscall-.L0 +.L3: .long __error_unified_syscall-.L0 diff -uNr dietlibc-0.20/sparc/start.S dietlibc-0.21/sparc/start.S --- dietlibc-0.20/sparc/start.S Thu Nov 29 05:25:17 2001 +++ dietlibc-0.21/sparc/start.S Mon Sep 16 10:49:52 2002 @@ -1,4 +1,3 @@ -#ifdef __sparc__ .section ".text" .align 4 .global _start @@ -47,7 +46,5 @@ ret nop - .size _start, .-_start -#endif diff -uNr dietlibc-0.20/sparc64/longjmp.S dietlibc-0.21/sparc64/longjmp.S --- dietlibc-0.20/sparc64/longjmp.S Tue Mar 26 05:07:38 2002 +++ dietlibc-0.21/sparc64/longjmp.S Mon Sep 16 10:49:52 2002 @@ -11,7 +11,7 @@ .type __libc_longjmp,function __libc_longjmp: movrz %o1, 1, %o1 /* never return 0 in setjmp */ - stx %o1, [ %o0+O_g1 ] /* save return value in context */ + stx %o1, [ %o0+MC_G1 ] /* save return value in context */ ld [ %o0+FLAG_SAVEMASK ], %o1 /* has setjmp saved the signalmask ? */ ta 0x6f /* setcontext / restore context */ .size __libc_longjmp,.-__libc_longjmp diff -uNr dietlibc-0.20/syscalls.s/munlock.S dietlibc-0.21/syscalls.s/munlock.S --- dietlibc-0.20/syscalls.s/munlock.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/syscalls.s/munlock.S Wed Aug 14 06:52:20 2002 @@ -0,0 +1,3 @@ +#include "syscalls.h" + +syscall(munlock,munlock) diff -uNr dietlibc-0.20/test/atexit.c dietlibc-0.21/test/atexit.c --- dietlibc-0.20/test/atexit.c Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/test/atexit.c Mon Aug 19 01:54:10 2002 @@ -0,0 +1,10 @@ +#include +#include + +void blah(void) { + write(2,"atexit\n",7); +} + +main() { + atexit(blah); +} diff -uNr dietlibc-0.20/test/flush.c dietlibc-0.21/test/flush.c --- dietlibc-0.20/test/flush.c Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/test/flush.c Mon Aug 19 01:51:25 2002 @@ -0,0 +1,6 @@ +#include + +main() { + FILE* f=fopen("testing","w"); + fputs("testing",f); +} diff -uNr dietlibc-0.20/test/gethostbyaddr.c dietlibc-0.21/test/gethostbyaddr.c --- dietlibc-0.20/test/gethostbyaddr.c Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/test/gethostbyaddr.c Wed Sep 18 06:19:10 2002 @@ -0,0 +1,16 @@ +#include +#include +#include +#include + +int main() { + struct in_addr bar; + struct hostent *foo; + inet_aton("160.45.10.8",&bar); + foo=gethostbyaddr(&bar,4,AF_INET); + if (foo) { + int i; + for (i=0; foo->h_addr_list[i]; ++i) + printf("%s -> %s\n",foo->h_name,inet_ntoa(*(struct in_addr*)foo->h_addr_list[i])); + } +} diff -uNr dietlibc-0.20/test/gethostbyname.c dietlibc-0.21/test/gethostbyname.c --- dietlibc-0.20/test/gethostbyname.c Thu May 2 14:32:06 2002 +++ dietlibc-0.21/test/gethostbyname.c Wed Sep 18 09:44:28 2002 @@ -6,7 +6,7 @@ struct in_addr bar; struct hostent *foo; // foo=gethostbyname("zeit.fu-berlin.de"); - foo=gethostbyname("knuth"); + foo=gethostbyname("ftp.fu-berlin.de"); if (foo) printf("%s -> %s\n",foo->h_name,inet_ntoa(*(struct in_addr*)foo->h_addr)); /* printf("%g %g\n",1e-10,1e10); */ diff -uNr dietlibc-0.20/test/ltostr.c dietlibc-0.21/test/ltostr.c --- dietlibc-0.20/test/ltostr.c Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/test/ltostr.c Mon Aug 19 02:45:18 2002 @@ -0,0 +1,10 @@ +#include +#include + +main() { + char buf[1024]; + assert(__ltostr(buf,10,1723,10,0)==4); assert(!strcmp(buf,"1723")); + assert(__ltostr(buf,3,1723,10,0)==2); assert(!strcmp(buf,"23")); + assert(__ltostr(buf,2,0x1234,16,0)==1); assert(!strcmp(buf,"4")); + assert(__ltostr(buf,3,0xFEFE,16,1)==2); assert(!strcmp(buf,"FE")); +} diff -uNr dietlibc-0.20/test/memcpy.c dietlibc-0.21/test/memcpy.c --- dietlibc-0.20/test/memcpy.c Mon Apr 29 12:02:54 2002 +++ dietlibc-0.21/test/memcpy.c Mon Aug 26 17:06:50 2002 @@ -6,5 +6,6 @@ assert(memcpy(test,"blubber",8)==test); assert(!memcmp(test,"blubber",8)); assert(memcpy(0,0,0)==0); + assert(memcpy(test,"foobar",3) && test[2]=='o'); return 0; } diff -uNr dietlibc-0.20/test/regex.c dietlibc-0.21/test/regex.c --- dietlibc-0.20/test/regex.c Mon Aug 5 13:27:36 2002 +++ dietlibc-0.21/test/regex.c Sat Aug 24 06:29:39 2002 @@ -36,8 +36,12 @@ printf("regcomp %d\n",regcomp(&r,"^([A-Za-z ]+>|[]>:|}][]>:|}]*)",REG_EXTENDED|REG_NEWLINE|REG_NOSUB|REG_ICASE)); printf("regexec %d\n",regexec(&r,"fnord",1,0,0)); #endif +#if 0 printf("regcomp %d\n",regcomp(&r,"^Subject:",REG_EXTENDED|REG_ICASE)); printf("regexec %d\n",regexec(&r,"Subject: duh",1,0,0)); +#endif + printf("regcomp %d\n",regcomp(&r,"^To:([^@]*)?$",REG_EXTENDED|REG_ICASE|REG_NOSUB)); + printf("regexec %d\n",regexec(&r,"To: ",1,0,0)); regfree(&r); return 0; } diff -uNr dietlibc-0.20/x86_64/__longjmp.S dietlibc-0.21/x86_64/__longjmp.S --- dietlibc-0.20/x86_64/__longjmp.S Wed Dec 31 16:00:00 1969 +++ dietlibc-0.21/x86_64/__longjmp.S Fri Aug 30 09:40:22 2002 @@ -0,0 +1,26 @@ +#include +#include "dietwarning.h" + +.text +.global __longjmp +.type __longjmp,@function +__longjmp: + mov $1,%eax + /* Restore the return address now. */ + movq (JB_PC*8)(%rdi),%rdx + /* Restore registers. */ + movq (JB_RBX*8)(%rdi),%rbx + movq (JB_RBP*8)(%rdi),%rbp + movq (JB_R12*8)(%rdi),%r12 + movq (JB_R13*8)(%rdi),%r13 + movq (JB_R14*8)(%rdi),%r14 + movq (JB_R15*8)(%rdi),%r15 + movq (JB_RSP*8)(%rdi),%rsp + /* never return 0 */ + test %esi,%esi + cmovne %esi,%eax + /* Jump to saved PC. */ + jmp *%rdx +.size __longjmp,.-__longjmp; + +link_warning("__longjmp","longjmp() not yet tested") diff -uNr dietlibc-0.20/x86_64/__longjmp.c dietlibc-0.21/x86_64/__longjmp.c --- dietlibc-0.20/x86_64/__longjmp.c Wed May 8 18:01:17 2002 +++ dietlibc-0.21/x86_64/__longjmp.c Wed Dec 31 16:00:00 1969 @@ -1,11 +0,0 @@ -#include -#include "dietwarning.h" - -void __longjmp(jmp_buf env, int val); -void __longjmp(jmp_buf env, int val) -{ - return; -} - -link_warning("__longjmp","error: __longjmp not yet supported") - diff -uNr dietlibc-0.20/x86_64/__testandset.S dietlibc-0.21/x86_64/__testandset.S --- dietlibc-0.20/x86_64/__testandset.S Wed May 8 18:01:17 2002 +++ dietlibc-0.21/x86_64/__testandset.S Mon Sep 16 10:49:52 2002 @@ -4,10 +4,9 @@ .global __testandset .type __testandset,@function __testandset: - xor %rax, %rax - mov 0x8(%rsp),%rdx - inc %rax - xchg %rax,(%rdx) + xorl %eax,%eax + incl %eax + xchg %rax,(%rdi) ret link_warning("__testandset", "warning: __testandset() was never tested!") diff -uNr dietlibc-0.20/x86_64/clone.S dietlibc-0.21/x86_64/clone.S --- dietlibc-0.20/x86_64/clone.S Wed May 8 18:01:17 2002 +++ dietlibc-0.21/x86_64/clone.S Fri Aug 30 16:58:58 2002 @@ -9,8 +9,56 @@ .type __clone,@function .global __clone __clone: - mov $-EINVAL, %rax + movl $-EINVAL,%eax + testq %rdi,%rdi /* have non null thread_funcion */ + jz .Lclone_error + testq %rsi,%rsi /* have non null child_stack pointer */ + jz .Lclone_error + + /* put the parameters on thread stack */ + subq $16,%rsi + movq %rcx,8(%rsi) /* thread parameter */ + movq %rdi,0(%rsi) /* thread function */ + + /* syscall */ + movq %rdx,%rdi + movl $__NR_clone,%eax + syscall + cmpl $0,%eax + jl .Lclone_error + jne .Lreturn + +.thread_start: + /* call thread function */ + popq %rax + popq %rdi + call *%rax + /* exit a thread */ + movq %rax,%rdi +#ifdef PIC + jmp _exit@PLT +#else + jmp _exit +#endif + +.Lclone_error: + /* set errno */ + negl %eax + pushq %rax +#ifdef PIC + call __errno_location@PLT +#else + call __errno_location +#endif + popq %rcx + movl %ecx,(%rax) + orq $-1, %rax + +.Lreturn: + /* just return */ ret -link_warning("clone", "warning: clone() not yet implemented") -link_warning("__clone", "warning: clone() not yet implemented") +link_warning("clone", "warning: clone() not yet tested") +link_warning("__clone", "warning: clone() not yet tested") +//link_warning("clone", "warning: clone() not yet implemented") +//link_warning("__clone", "warning: clone() not yet implemented") diff -uNr dietlibc-0.20/x86_64/mmap.S dietlibc-0.21/x86_64/mmap.S --- dietlibc-0.20/x86_64/mmap.S Wed Aug 7 10:30:50 2002 +++ dietlibc-0.21/x86_64/mmap.S Fri Sep 6 12:17:01 2002 @@ -5,5 +5,5 @@ .type mmap,@function mmap: mov %rcx,%r10 - mov $__NR_mmap,%rax + mov $__NR_mmap,%al jmp __unified_syscall diff -uNr dietlibc-0.20/x86_64/setjmp.S dietlibc-0.21/x86_64/setjmp.S --- dietlibc-0.20/x86_64/setjmp.S Wed May 8 18:01:17 2002 +++ dietlibc-0.21/x86_64/setjmp.S Fri Aug 30 16:58:58 2002 @@ -8,14 +8,30 @@ .globl __setjmp .type __setjmp,@function __setjmp: - ret + xorq %rsi,%rsi .globl __sigsetjmp .type __sigsetjmp,@function __sigsetjmp: - ret + movq %rbx,(JB_RBX*8)(%rdi) + movq %rbp,(JB_RBP*8)(%rdi) + movq %r12,(JB_R12*8)(%rdi) + movq %r13,(JB_R13*8)(%rdi) + movq %r14,(JB_R14*8)(%rdi) + movq %r15,(JB_R15*8)(%rdi) + leaq 8(%rsp),%rdx + movq %rdx,(JB_RSP*8)(%rdi) + movq (%rsp),%rdx + movq %rdx,(JB_PC*8)(%rdi) +#ifdef PIC + jmp __sigjmp_save@PLT +#else + jmp __sigjmp_save +#endif .size __sigsetjmp,.-__sigsetjmp; -link_warning("setjmp","error: setjmp() not yet implemented") -link_warning("__sigsetjmp","error: setjmp() not yet implemented") +link_warning("setjmp","setjmp() not yet tested") +link_warning("__sigsetjmp","setjmp() not yet tested") +//link_warning("setjmp","error: setjmp() not yet implemented") +//link_warning("__sigsetjmp","error: setjmp() not yet implemented") diff -uNr dietlibc-0.20/x86_64/start.S dietlibc-0.21/x86_64/start.S --- dietlibc-0.20/x86_64/start.S Sun Aug 11 18:08:30 2002 +++ dietlibc-0.21/x86_64/start.S Fri Sep 27 05:26:36 2002 @@ -1,6 +1,5 @@ #include "dietfeatures.h" -#ifdef __x86_64__ .text .global _start _start: @@ -36,5 +35,4 @@ hlt .Lstart: .size _start,.Lstart-_start -#endif diff -uNr dietlibc-0.20/x86_64/umount.S dietlibc-0.21/x86_64/umount.S --- dietlibc-0.20/x86_64/umount.S Tue Aug 6 04:44:28 2002 +++ dietlibc-0.21/x86_64/umount.S Fri Sep 6 12:17:02 2002 @@ -4,6 +4,6 @@ .global umount .type umount,@function umount: - mov $__NR_umount2,%rax + mov $__NR_umount2,%al xorq %rsi,%rsi jmp __unified_syscall diff -uNr dietlibc-0.20/x86_64/waitpid.S dietlibc-0.21/x86_64/waitpid.S --- dietlibc-0.20/x86_64/waitpid.S Mon Aug 5 11:08:41 2002 +++ dietlibc-0.21/x86_64/waitpid.S Fri Sep 6 12:17:02 2002 @@ -8,6 +8,5 @@ .global __libc_waitpid __libc_waitpid: mov $0,%r10 - mov $__NR_wait4,%rax - call __unified_syscall - ret + mov $__NR_wait4,%al + jmp __unified_syscall