From bugs at busybox.net Mon Jul 2 09:19:47 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Mon, 2 Jul 2007 09:19:47 -0700 Subject: [uClibc 0001413]: fseek() does not propagate back errno Message-ID: A NOTE has been added to this issue. ====================================================================== http://busybox.net/bugs/view.php?id=1413 ====================================================================== Reported By: kiltedknight Assigned To: uClibc ====================================================================== Project: uClibc Issue ID: 1413 Category: Standards Compliance Reproducibility: always Severity: major Priority: normal Status: assigned ====================================================================== Date Submitted: 06-29-2007 10:01 PDT Last Modified: 07-02-2007 09:19 PDT ====================================================================== Summary: fseek() does not propagate back errno Description: Compile and run the attached C program linked against uClibc. Both lseek() and fseek() return -1 as evidenced by the output coming from perror(), but fseek() has errno = 0, while lseek() has errno = ESPIPE. ====================================================================== ---------------------------------------------------------------------- chombourger - 06-30-07 14:37 ---------------------------------------------------------------------- Using the latest (svn) uClibc, your program produces the following output in my test environment: lseek: Illegal seek fseek: Illegal seek Bug already fixed? Do you have LFS enabled (I do)? I will try checking with 0.9.28.1 ---------------------------------------------------------------------- kiltedknight - 07-02-07 09:19 ---------------------------------------------------------------------- We found the problem with 0.9.28.3. Is this fixed with 0.9.29? And yes, we have LFS enabled. Issue History Date Modified Username Field Change ====================================================================== 06-29-07 10:01 kiltedknight New Issue 06-29-07 10:01 kiltedknight Status new => assigned 06-29-07 10:01 kiltedknight Assigned To => uClibc 06-29-07 10:01 kiltedknight File Added: seek_test.c 06-29-07 10:01 kiltedknight Issue Monitored: kiltedknight 06-30-07 14:30 chombourger Note Added: 0002541 06-30-07 14:37 chombourger Note Edited: 0002541 07-01-07 22:25 chombourger Issue Monitored: chombourger 07-02-07 09:19 kiltedknight Note Added: 0002543 ====================================================================== From bugs at busybox.net Mon Jul 2 12:15:10 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Mon, 2 Jul 2007 12:15:10 -0700 Subject: [uClibc 0001413]: fseek() does not propagate back errno Message-ID: <8b3953bf9b0eb92a3b0a83fc2123cc9a@bugs.busybox.net> A NOTE has been added to this issue. ====================================================================== http://busybox.net/bugs/view.php?id=1413 ====================================================================== Reported By: kiltedknight Assigned To: uClibc ====================================================================== Project: uClibc Issue ID: 1413 Category: Standards Compliance Reproducibility: always Severity: major Priority: normal Status: assigned ====================================================================== Date Submitted: 06-29-2007 10:01 PDT Last Modified: 07-02-2007 12:15 PDT ====================================================================== Summary: fseek() does not propagate back errno Description: Compile and run the attached C program linked against uClibc. Both lseek() and fseek() return -1 as evidenced by the output coming from perror(), but fseek() has errno = 0, while lseek() has errno = ESPIPE. ====================================================================== ---------------------------------------------------------------------- chombourger - 06-30-07 14:37 ---------------------------------------------------------------------- Using the latest (svn) uClibc, your program produces the following output in my test environment: lseek: Illegal seek fseek: Illegal seek Bug already fixed? Do you have LFS enabled (I do)? I will try checking with 0.9.28.1 ---------------------------------------------------------------------- kiltedknight - 07-02-07 09:19 ---------------------------------------------------------------------- We found the problem with 0.9.28.3. Is this fixed with 0.9.29? And yes, we have LFS enabled. ---------------------------------------------------------------------- kiltedknight - 07-02-07 12:15 ---------------------------------------------------------------------- Close out the bug, please. We found the error in the system call, not uClibc. Issue History Date Modified Username Field Change ====================================================================== 06-29-07 10:01 kiltedknight New Issue 06-29-07 10:01 kiltedknight Status new => assigned 06-29-07 10:01 kiltedknight Assigned To => uClibc 06-29-07 10:01 kiltedknight File Added: seek_test.c 06-29-07 10:01 kiltedknight Issue Monitored: kiltedknight 06-30-07 14:30 chombourger Note Added: 0002541 06-30-07 14:37 chombourger Note Edited: 0002541 07-01-07 22:25 chombourger Issue Monitored: chombourger 07-02-07 09:19 kiltedknight Note Added: 0002543 07-02-07 12:15 kiltedknight Note Added: 0002544 ====================================================================== From sjhill at uclibc.org Wed Jul 11 17:58:45 2007 From: sjhill at uclibc.org (sjhill at uclibc.org) Date: Wed, 11 Jul 2007 17:58:45 -0700 (PDT) Subject: svn commit: trunk/uClibc/libc/sysdeps/linux/mips Message-ID: <20070712005845.80D3AA65B0@busybox.net> Author: sjhill Date: 2007-07-11 17:58:41 -0700 (Wed, 11 Jul 2007) New Revision: 19068 Log: Fix broken syscall() function since the original patch did not work. Modified: trunk/uClibc/libc/sysdeps/linux/mips/syscall.S Changeset: Modified: trunk/uClibc/libc/sysdeps/linux/mips/syscall.S =================================================================== --- trunk/uClibc/libc/sysdeps/linux/mips/syscall.S 2007-07-11 15:01:42 UTC (rev 19067) +++ trunk/uClibc/libc/sysdeps/linux/mips/syscall.S 2007-07-12 00:58:41 UTC (rev 19068) @@ -29,6 +29,8 @@ .type syscall, at function .ent syscall syscall: + .set noreorder + .cpload t9; move v0, a0 /* Load system call number from first arg. */ move a0, a1 /* Move the next three args up a register. */ move a1, a2 @@ -55,15 +57,15 @@ lw v0,7*4(sp) /* for system call restarts */ #endif syscall /* Do the system call. */ + bnez a3, 1f #ifdef __mips64 daddiu sp,sp,16 #else addiu sp,sp,32 #endif - bnez a3, 1f j ra /* Return to caller. */ 1: - move a0,v0 /* Pass return val to C function. */ + move a0,v0 /* Pass return val to C function. */ #ifdef __PIC__ PTR_LA t9, __syscall_error From sjhill at uclibc.org Wed Jul 11 17:59:00 2007 From: sjhill at uclibc.org (sjhill at uclibc.org) Date: Wed, 11 Jul 2007 17:59:00 -0700 (PDT) Subject: svn commit: branches/uClibc-nptl/libc/sysdeps/linux/mips Message-ID: <20070712005900.D6AF0A65B8@busybox.net> Author: sjhill Date: 2007-07-11 17:59:00 -0700 (Wed, 11 Jul 2007) New Revision: 19069 Log: Fix broken syscall() function since the original patch did not work. Modified: branches/uClibc-nptl/libc/sysdeps/linux/mips/syscall.S Changeset: Modified: branches/uClibc-nptl/libc/sysdeps/linux/mips/syscall.S =================================================================== --- branches/uClibc-nptl/libc/sysdeps/linux/mips/syscall.S 2007-07-12 00:58:41 UTC (rev 19068) +++ branches/uClibc-nptl/libc/sysdeps/linux/mips/syscall.S 2007-07-12 00:59:00 UTC (rev 19069) @@ -17,8 +17,8 @@ 02111-1307 USA. */ #include -#include -#include +#include +#include #ifdef __PIC__ .option pic2 @@ -29,6 +29,8 @@ .type syscall, at function .ent syscall syscall: + .set noreorder + .cpload t9; move v0, a0 /* Load system call number from first arg. */ move a0, a1 /* Move the next three args up a register. */ move a1, a2 @@ -55,11 +57,21 @@ lw v0,7*4(sp) /* for system call restarts */ #endif syscall /* Do the system call. */ + bnez a3, 1f #ifdef __mips64 daddiu sp,sp,16 #else addiu sp,sp,32 #endif j ra /* Return to caller. */ +1: + move a0,v0 /* Pass return val to C function. */ + +#ifdef __PIC__ + PTR_LA t9, __syscall_error + jr t9 +#else + j __syscall_error +#endif .end syscall .size syscall,.-syscall From vda at uclibc.org Sat Jul 14 07:52:27 2007 From: vda at uclibc.org (vda at uclibc.org) Date: Sat, 14 Jul 2007 07:52:27 -0700 (PDT) Subject: svn commit: trunk/uClibc/include/sys Message-ID: <20070714145227.B628AA616F@busybox.net> Author: vda Date: 2007-07-14 07:52:24 -0700 (Sat, 14 Jul 2007) New Revision: 19087 Log: syslog.h: allow prioritynames[]/facilitynames[] to be defined const (selectable by #defining SYSLOG_NAMES_CONST) Modified: trunk/uClibc/include/sys/syslog.h Changeset: Modified: trunk/uClibc/include/sys/syslog.h =================================================================== --- trunk/uClibc/include/sys/syslog.h 2007-07-14 11:33:10 UTC (rev 19086) +++ trunk/uClibc/include/sys/syslog.h 2007-07-14 14:52:24 UTC (rev 19087) @@ -71,6 +71,9 @@ int c_val; } CODE; +#ifdef SYSLOG_NAMES_CONST +const +#endif CODE prioritynames[] = { { "alert", LOG_ALERT }, @@ -119,6 +122,9 @@ #define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3) #ifdef SYSLOG_NAMES +#ifdef SYSLOG_NAMES_CONST +const +#endif CODE facilitynames[] = { { "auth", LOG_AUTH }, From sjhill at uclibc.org Sat Jul 14 20:01:26 2007 From: sjhill at uclibc.org (sjhill at uclibc.org) Date: Sat, 14 Jul 2007 20:01:26 -0700 (PDT) Subject: svn commit: branches/uClibc-nptl/libc/sysdeps/linux/common/bits Message-ID: <20070715030126.97115A6890@busybox.net> Author: sjhill Date: 2007-07-14 20:01:25 -0700 (Sat, 14 Jul 2007) New Revision: 19093 Log: Remove baud limit. Modified: branches/uClibc-nptl/libc/sysdeps/linux/common/bits/termios.h Changeset: Modified: branches/uClibc-nptl/libc/sysdeps/linux/common/bits/termios.h =================================================================== --- branches/uClibc-nptl/libc/sysdeps/linux/common/bits/termios.h 2007-07-15 01:13:25 UTC (rev 19092) +++ branches/uClibc-nptl/libc/sysdeps/linux/common/bits/termios.h 2007-07-15 03:01:25 UTC (rev 19093) @@ -156,7 +156,6 @@ #endif #define B57600 0010001 #define B115200 0010002 -#if 0 /* limited on uClibc, keep in sync w/ cfsetspeed.c */ #define B230400 0010003 #define B460800 0010004 #define B500000 0010005 @@ -171,9 +170,6 @@ #define B3500000 0010016 #define B4000000 0010017 #define __MAX_BAUD B4000000 -#else -#define __MAX_BAUD B115200 -#endif #ifdef __USE_MISC # define CIBAUD 002003600000 /* input baud rate (not used) */ # define CMSPAR 010000000000 /* mark or space (stick) parity */ From sjhill at uclibc.org Tue Jul 17 20:08:37 2007 From: sjhill at uclibc.org (sjhill at uclibc.org) Date: Tue, 17 Jul 2007 20:08:37 -0700 (PDT) Subject: svn commit: trunk/uClibc/ldso/ldso/sparc Message-ID: <20070718030837.A64C1A6805@busybox.net> Author: sjhill Date: 2007-07-17 20:08:36 -0700 (Tue, 17 Jul 2007) New Revision: 19151 Log: Apply patch as submitted by Blue Smurfy Swirly for Sparc32. Modified: trunk/uClibc/ldso/ldso/sparc/dl-sysdep.h Changeset: Modified: trunk/uClibc/ldso/ldso/sparc/dl-sysdep.h =================================================================== --- trunk/uClibc/ldso/ldso/sparc/dl-sysdep.h 2007-07-17 23:22:49 UTC (rev 19150) +++ trunk/uClibc/ldso/ldso/sparc/dl-sysdep.h 2007-07-18 03:08:36 UTC (rev 19151) @@ -83,10 +83,16 @@ #endif /* 4096 bytes alignment */ +#if defined(__sparc_v9__) /* ...but 8192 is required for mmap() on sparc64 kernel */ #define PAGE_ALIGN 0xffffe000 #define ADDR_ALIGN 0x1fff #define OFFS_ALIGN 0x7fffe000 +#elif defined(__sparc_v8__) +#define PAGE_ALIGN 0xfffff000 +#define ADDR_ALIGN 0xfff +#define OFFS_ALIGN 0x7ffff000 +#endif /* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so PLT entries should not be allowed to define the value. From sjhill at uclibc.org Tue Jul 17 20:16:05 2007 From: sjhill at uclibc.org (sjhill at uclibc.org) Date: Tue, 17 Jul 2007 20:16:05 -0700 (PDT) Subject: svn commit: trunk/uClibc/libc/sysdeps/linux/common/bits Message-ID: <20070718031605.CC69BA659E@busybox.net> Author: sjhill Date: 2007-07-17 20:16:05 -0700 (Tue, 17 Jul 2007) New Revision: 19152 Log: Enable all of the remaining baud rates. All of the other architectures have them enabled, so let's go all the way. There was a quick discussion on IRC about making the max baud rate configurable. That requires a bunch of #ifdef salting throughout all of the 'termios.h' files for the pre-processor to chew on. I'm going to pass on that for now. Modified: trunk/uClibc/libc/sysdeps/linux/common/bits/termios.h Changeset: Modified: trunk/uClibc/libc/sysdeps/linux/common/bits/termios.h =================================================================== --- trunk/uClibc/libc/sysdeps/linux/common/bits/termios.h 2007-07-18 03:08:36 UTC (rev 19151) +++ trunk/uClibc/libc/sysdeps/linux/common/bits/termios.h 2007-07-18 03:16:05 UTC (rev 19152) @@ -156,7 +156,6 @@ #endif #define B57600 0010001 #define B115200 0010002 -#if 0 /* limited on uClibc, keep in sync w/ cfsetspeed.c */ #define B230400 0010003 #define B460800 0010004 #define B500000 0010005 @@ -171,9 +170,6 @@ #define B3500000 0010016 #define B4000000 0010017 #define __MAX_BAUD B4000000 -#else -#define __MAX_BAUD B115200 -#endif #ifdef __USE_MISC # define CIBAUD 002003600000 /* input baud rate (not used) */ # define CMSPAR 010000000000 /* mark or space (stick) parity */ From vda at uclibc.org Wed Jul 18 15:30:45 2007 From: vda at uclibc.org (vda at uclibc.org) Date: Wed, 18 Jul 2007 15:30:45 -0700 (PDT) Subject: svn commit: trunk/uClibc/libcrypt Message-ID: <20070718223045.B8157A6848@busybox.net> Author: vda Date: 2007-07-18 15:30:43 -0700 (Wed, 18 Jul 2007) New Revision: 19161 Log: des.c: move 0.5k of static data on stack, they are used only temporarily by des_init. Modified: trunk/uClibc/libcrypt/des.c Changeset: Modified: trunk/uClibc/libcrypt/des.c =================================================================== --- trunk/uClibc/libcrypt/des.c 2007-07-18 22:03:40 UTC (rev 19160) +++ trunk/uClibc/libcrypt/des.c 2007-07-18 22:30:43 UTC (rev 19161) @@ -70,7 +70,6 @@ * struct crypt_data to make this really reentrant... */ static u_char inv_key_perm[64]; static u_char inv_comp_perm[56]; -static u_char u_sbox[8][64]; static u_char un_pbox[32]; static u_int32_t en_keysl[16], en_keysr[16]; static u_int32_t de_keysl[16], de_keysr[16]; @@ -194,7 +193,6 @@ }; static const u_char bits8[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }; -static const u_int32_t *bits28, *bits24; static int @@ -218,12 +216,15 @@ static void des_init(void) { + static int des_initialised = 0; + int i, j, b, k, inbit, obit; u_int32_t *p, *il, *ir, *fl, *fr; - static int des_initialised = 0; + const u_int32_t *bits28, *bits24; + u_char u_sbox[8][64]; if (des_initialised==1) - return; + return; old_rawkey0 = old_rawkey1 = 0L; saltbits = 0L; From vda at uclibc.org Wed Jul 18 15:31:32 2007 From: vda at uclibc.org (vda at uclibc.org) Date: Wed, 18 Jul 2007 15:31:32 -0700 (PDT) Subject: svn commit: trunk/uClibc/libc/sysdeps/linux/common Message-ID: <20070718223132.38BA8A6848@busybox.net> Author: vda Date: 2007-07-18 15:31:31 -0700 (Wed, 18 Jul 2007) New Revision: 19162 Log: include/sys/mman.h says that msync exists only on MMU. Make msync.c agree on this. Modified: trunk/uClibc/libc/sysdeps/linux/common/msync.c Changeset: Modified: trunk/uClibc/libc/sysdeps/linux/common/msync.c =================================================================== --- trunk/uClibc/libc/sysdeps/linux/common/msync.c 2007-07-18 22:30:43 UTC (rev 19161) +++ trunk/uClibc/libc/sysdeps/linux/common/msync.c 2007-07-18 22:31:31 UTC (rev 19162) @@ -14,9 +14,13 @@ #include +#ifdef __ARCH_USE_MMU__ + extern __typeof(msync) __libc_msync; #define __NR___libc_msync __NR_msync _syscall3(int, __libc_msync, void *, addr, size_t, length, int, flags); weak_alias(__libc_msync,msync) #endif + +#endif From vda at uclibc.org Wed Jul 18 15:32:40 2007 From: vda at uclibc.org (vda at uclibc.org) Date: Wed, 18 Jul 2007 15:32:40 -0700 (PDT) Subject: svn commit: trunk/uClibc/libc/unistd Message-ID: <20070718223240.0C3FFA6848@busybox.net> Author: vda Date: 2007-07-18 15:32:40 -0700 (Wed, 18 Jul 2007) New Revision: 19163 Log: execXp should go to next PATH dir on any error except ENOEXEC, not just on ENOENT (in particular, on EPERM). At least glibc does so. Fixing this. Modified: trunk/uClibc/libc/unistd/exec.c Changeset: Modified: trunk/uClibc/libc/unistd/exec.c =================================================================== --- trunk/uClibc/libc/unistd/exec.c 2007-07-18 22:31:31 UTC (rev 19162) +++ trunk/uClibc/libc/unistd/exec.c 2007-07-18 22:32:40 UTC (rev 19163) @@ -235,11 +235,11 @@ if (strchr(path, '/')) { execve(path, argv, __environ); - CHECK_ENOEXEC: if (errno == ENOEXEC) { char **nargv; EXEC_ALLOC_SIZE(size2) /* Do NOT add a semicolon! */ size_t n; + RUN_BIN_SH: /* Need the dimension - 1. We omit counting the trailing * NULL but we actually omit the first entry. */ for (n=0 ; argv[n] ; n++) {} @@ -292,9 +292,9 @@ seen_small = 1; - if (errno != ENOENT) { + if (errno == ENOEXEC) { path = s; - goto CHECK_ENOEXEC; + goto RUN_BIN_SH; } NEXT: From bugs at busybox.net Mon Jul 23 06:31:06 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Mon, 23 Jul 2007 06:31:06 -0700 Subject: [uClibc 0001413]: fseek() does not propagate back errno Message-ID: The following issue has been CLOSED ====================================================================== http://busybox.net/bugs/view.php?id=1413 ====================================================================== Reported By: kiltedknight Assigned To: uClibc ====================================================================== Project: uClibc Issue ID: 1413 Category: Standards Compliance Reproducibility: always Severity: major Priority: normal Status: closed Resolution: open Fixed in Version: ====================================================================== Date Submitted: 06-29-2007 10:01 PDT Last Modified: 07-23-2007 06:31 PDT ====================================================================== Summary: fseek() does not propagate back errno Description: Compile and run the attached C program linked against uClibc. Both lseek() and fseek() return -1 as evidenced by the output coming from perror(), but fseek() has errno = 0, while lseek() has errno = ESPIPE. ====================================================================== ---------------------------------------------------------------------- chombourger - 06-30-07 14:37 ---------------------------------------------------------------------- Using the latest (svn) uClibc, your program produces the following output in my test environment: lseek: Illegal seek fseek: Illegal seek Bug already fixed? Do you have LFS enabled (I do)? I will try checking with 0.9.28.1 ---------------------------------------------------------------------- kiltedknight - 07-02-07 09:19 ---------------------------------------------------------------------- We found the problem with 0.9.28.3. Is this fixed with 0.9.29? And yes, we have LFS enabled. ---------------------------------------------------------------------- kiltedknight - 07-02-07 12:15 ---------------------------------------------------------------------- Close out the bug, please. We found the error in the system call, not uClibc. ---------------------------------------------------------------------- bernhardf - 07-23-07 06:31 ---------------------------------------------------------------------- Closing upon reporter's request. Issue History Date Modified Username Field Change ====================================================================== 06-29-07 10:01 kiltedknight New Issue 06-29-07 10:01 kiltedknight Status new => assigned 06-29-07 10:01 kiltedknight Assigned To => uClibc 06-29-07 10:01 kiltedknight File Added: seek_test.c 06-29-07 10:01 kiltedknight Issue Monitored: kiltedknight 06-30-07 14:30 chombourger Note Added: 0002541 06-30-07 14:37 chombourger Note Edited: 0002541 07-01-07 22:25 chombourger Issue Monitored: chombourger 07-02-07 09:19 kiltedknight Note Added: 0002543 07-02-07 12:15 kiltedknight Note Added: 0002544 07-04-07 14:29 chombourger Issue End Monitor: chombourger 07-23-07 06:31 bernhardf Status assigned => closed 07-23-07 06:31 bernhardf Note Added: 0002637 ====================================================================== From bugs at busybox.net Tue Jul 24 13:09:30 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Tue, 24 Jul 2007 13:09:30 -0700 Subject: [uClibc 0001440]: fputc sets invalid stream->__bufpos when __WRITE fails Message-ID: <9b8e40c529004164c52284aa1bc7a36c@busybox.net> The following issue has been SUBMITTED. ====================================================================== http://busybox.net/bugs/view.php?id=1440 ====================================================================== Reported By: Dwight Engen Assigned To: uClibc ====================================================================== Project: uClibc Issue ID: 1440 Category: Stdio Reproducibility: always Severity: minor Priority: normal Status: assigned ====================================================================== Date Submitted: 07-24-2007 13:09 PDT Last Modified: 07-24-2007 13:09 PDT ====================================================================== Summary: fputc sets invalid stream->__bufpos when __WRITE fails Description: Attached is a test case and a fix for a bug in uclibc fputc when write(2) returns an error. The internal stream->__bufpos is set incorrectly. This could happen on a real system when for example the disk is full. We simulate it here by setting RLIMIT_FSIZE very small. The stream must be in line buffered mode. The reasoning for the fix is that __stdio_WRITE already has reduced stream->__bufpos for the \n so there is no need for fputc to __STDIO_STREAM_BUFFER_UNADD. Note that with glibc, it appears the stream gets purged when an error on write occurs, uclibc's attempt to buffer the data in the stream is nicer. ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 07-24-07 13:09 Dwight Engen New Issue 07-24-07 13:09 Dwight Engen Status new => assigned 07-24-07 13:09 Dwight Engen Assigned To => uClibc 07-24-07 13:09 Dwight Engen File Added: testit.c ====================================================================== From sjhill at uclibc.org Sat Jul 28 11:49:09 2007 From: sjhill at uclibc.org (sjhill at uclibc.org) Date: Sat, 28 Jul 2007 11:49:09 -0700 (PDT) Subject: svn commit: branches/uClibc-nptl/libc/sysdeps/linux/common Message-ID: <20070728184909.148FEA475A@busybox.net> Author: sjhill Date: 2007-07-28 11:49:08 -0700 (Sat, 28 Jul 2007) New Revision: 19305 Log: Not quite yet. Removed: branches/uClibc-nptl/libc/sysdeps/linux/common/sched_getaffinity.c branches/uClibc-nptl/libc/sysdeps/linux/common/sched_setaffinity.c Changeset: Deleted: branches/uClibc-nptl/libc/sysdeps/linux/common/sched_getaffinity.c =================================================================== --- branches/uClibc-nptl/libc/sysdeps/linux/common/sched_getaffinity.c 2007-07-28 17:30:05 UTC (rev 19304) +++ branches/uClibc-nptl/libc/sysdeps/linux/common/sched_getaffinity.c 2007-07-28 18:49:08 UTC (rev 19305) @@ -1,52 +0,0 @@ -/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include -#ifdef __USE_GNU - -#include -#include -#include - -#ifdef INTERNAL_SYSCALL /* remove this when all archs has this #defined */ - -#include -#include -#include - -libc_hidden_proto(memset) - -#define __NR___syscall_sched_getaffinity __NR_sched_getaffinity -static inline _syscall3(int, __syscall_sched_getaffinity, __kernel_pid_t, pid, - size_t, cpusetsize, cpu_set_t *, cpuset); - -int sched_getaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *cpuset) -{ - int res = (__syscall_sched_getaffinity(pid, MIN(INT_MAX, cpusetsize), - cpuset)); - - if (res != -1) { - /* Clean the rest of the memory the kernel didn't do. */ - memset ((char *) cpuset + res, '\0', cpusetsize - res); - - res = 0; - } - return res; -} -#endif -#endif Deleted: branches/uClibc-nptl/libc/sysdeps/linux/common/sched_setaffinity.c =================================================================== --- branches/uClibc-nptl/libc/sysdeps/linux/common/sched_setaffinity.c 2007-07-28 17:30:05 UTC (rev 19304) +++ branches/uClibc-nptl/libc/sysdeps/linux/common/sched_setaffinity.c 2007-07-28 18:49:08 UTC (rev 19305) @@ -1,78 +0,0 @@ -/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include -#ifdef __USE_GNU - -#include -#include -#include - -#ifdef INTERNAL_SYSCALL /* remove this when all archs has this #defined */ - -#include -#include -#include -#include -#include - -libc_hidden_proto(getpid) - -#define __NR___syscall_sched_setaffinity __NR_sched_setaffinity -static inline _syscall3(int, __syscall_sched_setaffinity, __kernel_pid_t, pid, - size_t, cpusetsize, cpu_set_t *, cpuset); - -static size_t __kernel_cpumask_size; - -int sched_setaffinity(pid_t pid, size_t cpusetsize, const cpu_set_t *cpuset) -{ - size_t cnt; - if (unlikely (__kernel_cpumask_size == 0)) { - INTERNAL_SYSCALL_DECL (err); - int res; - size_t psize = 128; - void *p = alloca (psize); - - while (res = INTERNAL_SYSCALL (sched_getaffinity, err, 3, getpid (), - psize, p), - INTERNAL_SYSCALL_ERROR_P (res, err) - && INTERNAL_SYSCALL_ERRNO (res, err) == EINVAL) - p = extend_alloca (p, psize, 2 * psize); - - if (res == 0 || INTERNAL_SYSCALL_ERROR_P (res, err)) { - __set_errno (INTERNAL_SYSCALL_ERRNO (res, err)); - return -1; - } - - __kernel_cpumask_size = res; - } - - /* We now know the size of the kernel cpumask_t. Make sure the user - does not request to set a bit beyond that. */ - for (cnt = __kernel_cpumask_size; cnt < cpusetsize; ++cnt) - if (((char *) cpuset)[cnt] != '\0') { - /* Found a nonzero byte. This means the user request cannot be - fulfilled. */ - __set_errno (EINVAL); - return -1; - } - - return INLINE_SYSCALL (sched_setaffinity, 3, pid, cpusetsize, cpuset); -} -#endif -#endif From sjhill at uclibc.org Sat Jul 28 11:52:07 2007 From: sjhill at uclibc.org (sjhill at uclibc.org) Date: Sat, 28 Jul 2007 11:52:07 -0700 (PDT) Subject: svn commit: branches/uClibc-nptl/libc/inet/rpc Message-ID: <20070728185207.58FFCA465D@busybox.net> Author: sjhill Date: 2007-07-28 11:52:06 -0700 (Sat, 28 Jul 2007) New Revision: 19306 Log: This should not be visible and currently the TLS access fails unless it is marked as 'static'. Will investigate this later. Modified: branches/uClibc-nptl/libc/inet/rpc/rpc_thread.c Changeset: Modified: branches/uClibc-nptl/libc/inet/rpc/rpc_thread.c =================================================================== --- branches/uClibc-nptl/libc/inet/rpc/rpc_thread.c 2007-07-28 18:49:08 UTC (rev 19305) +++ branches/uClibc-nptl/libc/inet/rpc/rpc_thread.c 2007-07-28 18:52:06 UTC (rev 19306) @@ -22,7 +22,7 @@ /* Variable used in non-threaded applications or for the first thread. */ static struct rpc_thread_variables __libc_tsd_RPC_VARS_mem; -__libc_tsd_define (, RPC_VARS) +__libc_tsd_define (static, RPC_VARS) /* * Task-variable destructor From sjhill at uclibc.org Sat Jul 28 11:52:47 2007 From: sjhill at uclibc.org (sjhill at uclibc.org) Date: Sat, 28 Jul 2007 11:52:47 -0700 (PDT) Subject: svn commit: branches/uClibc-nptl/libc/sysdeps/linux/common/bits Message-ID: <20070728185247.B02A4A465D@busybox.net> Author: sjhill Date: 2007-07-28 11:52:47 -0700 (Sat, 28 Jul 2007) New Revision: 19307 Log: Fix TLS modifier. Modified: branches/uClibc-nptl/libc/sysdeps/linux/common/bits/uClibc_errno.h Changeset: Modified: branches/uClibc-nptl/libc/sysdeps/linux/common/bits/uClibc_errno.h =================================================================== --- branches/uClibc-nptl/libc/sysdeps/linux/common/bits/uClibc_errno.h 2007-07-28 18:52:06 UTC (rev 19306) +++ branches/uClibc-nptl/libc/sysdeps/linux/common/bits/uClibc_errno.h 2007-07-28 18:52:47 UTC (rev 19307) @@ -19,7 +19,7 @@ # else # define errno errno # endif -extern __thread int errno __attribute_tls_model_ie; +extern __thread int errno attribute_tls_model_ie; # endif /* USE___THREAD */ #endif /* IS_IN_rtld */ From vda at uclibc.org Sun Jul 29 07:45:29 2007 From: vda at uclibc.org (vda at uclibc.org) Date: Sun, 29 Jul 2007 07:45:29 -0700 (PDT) Subject: svn commit: trunk/uClibc: ldso/ldso/i386 ldso/ldso/x86_64 libc/str etc... Message-ID: <20070729144529.46633A6048@busybox.net> Author: vda Date: 2007-07-29 07:45:26 -0700 (Sun, 29 Jul 2007) New Revision: 19326 Log: Remove stray code alignment (.align 16 and .align 4 directives) from i386 and x86_64. Modified: trunk/uClibc/ldso/ldso/i386/dl-startup.h trunk/uClibc/ldso/ldso/i386/resolve.S trunk/uClibc/ldso/ldso/x86_64/dl-startup.h trunk/uClibc/ldso/ldso/x86_64/resolve.S trunk/uClibc/libc/string/sparc/_glibc_inc.h trunk/uClibc/libc/string/x86_64/_glibc_inc.h trunk/uClibc/libc/string/x86_64/memset.S trunk/uClibc/libc/string/x86_64/strcat.S trunk/uClibc/libc/string/x86_64/strchr.S trunk/uClibc/libc/string/x86_64/strcpy.S trunk/uClibc/libc/string/x86_64/strcspn.S trunk/uClibc/libc/string/x86_64/strlen.S trunk/uClibc/libc/sysdeps/linux/i386/__longjmp.S trunk/uClibc/libc/sysdeps/linux/i386/bsd-_setjmp.S trunk/uClibc/libc/sysdeps/linux/i386/bsd-setjmp.S trunk/uClibc/libc/sysdeps/linux/i386/mmap64.S trunk/uClibc/libc/sysdeps/linux/i386/setjmp.S trunk/uClibc/libc/sysdeps/linux/i386/sigaction.c trunk/uClibc/libc/sysdeps/linux/i386/syscall.S trunk/uClibc/libc/sysdeps/linux/i386/vfork.S trunk/uClibc/libc/sysdeps/linux/sparc/_math_inc.h trunk/uClibc/libc/sysdeps/linux/x86_64/__longjmp.S trunk/uClibc/libc/sysdeps/linux/x86_64/bsd-_setjmp.S trunk/uClibc/libc/sysdeps/linux/x86_64/bsd-setjmp.S trunk/uClibc/libc/sysdeps/linux/x86_64/clone.S trunk/uClibc/libc/sysdeps/linux/x86_64/setjmp.S trunk/uClibc/libc/sysdeps/linux/x86_64/sigaction.c trunk/uClibc/libc/sysdeps/linux/x86_64/syscall.S trunk/uClibc/libc/sysdeps/linux/x86_64/vfork.S Changeset: Modified: trunk/uClibc/ldso/ldso/i386/dl-startup.h =================================================================== --- trunk/uClibc/ldso/ldso/i386/dl-startup.h 2007-07-29 14:17:48 UTC (rev 19325) +++ trunk/uClibc/ldso/ldso/i386/dl-startup.h 2007-07-29 14:45:26 UTC (rev 19326) @@ -5,7 +5,6 @@ */ __asm__ ( " .text\n" - " .align 16\n" " .globl _start\n" " .type _start, at function\n" "_start:\n" Modified: trunk/uClibc/ldso/ldso/i386/resolve.S =================================================================== --- trunk/uClibc/ldso/ldso/i386/resolve.S 2007-07-29 14:17:48 UTC (rev 19325) +++ trunk/uClibc/ldso/ldso/i386/resolve.S 2007-07-29 14:45:26 UTC (rev 19326) @@ -21,7 +21,6 @@ */ .text -.align 4 .globl _dl_linux_resolve .type _dl_linux_resolve, at function Modified: trunk/uClibc/ldso/ldso/x86_64/dl-startup.h =================================================================== --- trunk/uClibc/ldso/ldso/x86_64/dl-startup.h 2007-07-29 14:17:48 UTC (rev 19325) +++ trunk/uClibc/ldso/ldso/x86_64/dl-startup.h 2007-07-29 14:45:26 UTC (rev 19326) @@ -8,7 +8,6 @@ */ __asm__ ( " .text\n" - " .align 16\n" " .global _start\n" " .type _start,%function\n" "_start:\n" Modified: trunk/uClibc/ldso/ldso/x86_64/resolve.S =================================================================== --- trunk/uClibc/ldso/ldso/x86_64/resolve.S 2007-07-29 14:17:48 UTC (rev 19325) +++ trunk/uClibc/ldso/ldso/x86_64/resolve.S 2007-07-29 14:45:26 UTC (rev 19326) @@ -26,7 +26,6 @@ .global _dl_linux_resolve .type _dl_linux_resolve,%function -.align 16 _dl_linux_resolve: subq $56,%rsp Modified: trunk/uClibc/libc/string/sparc/_glibc_inc.h =================================================================== --- trunk/uClibc/libc/string/sparc/_glibc_inc.h 2007-07-29 14:17:48 UTC (rev 19325) +++ trunk/uClibc/libc/string/sparc/_glibc_inc.h 2007-07-29 14:45:26 UTC (rev 19326) @@ -6,6 +6,8 @@ #include #include +/* Is alignment really needed? */ + #if __WORDSIZE == 32 # define ENTRY_ALIGN 4 #else Modified: trunk/uClibc/libc/string/x86_64/_glibc_inc.h =================================================================== --- trunk/uClibc/libc/string/x86_64/_glibc_inc.h 2007-07-29 14:17:48 UTC (rev 19325) +++ trunk/uClibc/libc/string/x86_64/_glibc_inc.h 2007-07-29 14:45:26 UTC (rev 19326) @@ -6,15 +6,8 @@ #include #include -#if __WORDSIZE == 32 -# define ENTRY_ALIGN 4 -#else -# define ENTRY_ALIGN 2 -#endif - #define ENTRY(sym) \ .global sym; \ - .align ENTRY_ALIGN; \ .type sym,%function; \ sym: Modified: trunk/uClibc/libc/string/x86_64/memset.S =================================================================== --- trunk/uClibc/libc/string/x86_64/memset.S 2007-07-29 14:17:48 UTC (rev 19325) +++ trunk/uClibc/libc/string/x86_64/memset.S 2007-07-29 14:45:26 UTC (rev 19326) @@ -71,7 +71,7 @@ jae 11f .p2align 4 -3: /* Copy 64 bytes. */ +3: /* Fill 64 bytes. */ mov %r8,(%rcx) mov %r8,0x8(%rcx) mov %r8,0x10(%rcx) @@ -84,7 +84,7 @@ dec %rax jne 3b -4: /* Copy final bytes. */ +4: /* Fill final bytes. */ and $0x3f,%edx mov %rdx,%rax shr $0x3,%rax @@ -107,7 +107,7 @@ jne 8b 9: #if BZERO_P - nop + nop /* huh?? */ #else /* Load result (only if used as memset). */ mov %rdi,%rax /* start address of destination is result */ @@ -115,7 +115,7 @@ retq .p2align 4 -11: /* Copy 64 bytes without polluting the cache. */ +11: /* Fill 64 bytes without polluting the cache. */ /* We could use movntdq %xmm0,(%rcx) here to further speed up for large cases but let's not use XMM registers. */ movnti %r8,(%rcx) Modified: trunk/uClibc/libc/string/x86_64/strcat.S =================================================================== --- trunk/uClibc/libc/string/x86_64/strcat.S 2007-07-29 14:17:48 UTC (rev 19325) +++ trunk/uClibc/libc/string/x86_64/strcat.S 2007-07-29 14:45:26 UTC (rev 19326) @@ -21,6 +21,7 @@ #include "_glibc_inc.h" +/* Seems to be unrolled too much */ .text ENTRY (BP_SYM (strcat)) Modified: trunk/uClibc/libc/string/x86_64/strchr.S =================================================================== --- trunk/uClibc/libc/string/x86_64/strchr.S 2007-07-29 14:17:48 UTC (rev 19325) +++ trunk/uClibc/libc/string/x86_64/strchr.S 2007-07-29 14:45:26 UTC (rev 19326) @@ -20,6 +20,7 @@ #include "_glibc_inc.h" +/* Seems to be unrolled too much */ .text ENTRY (BP_SYM (strchr)) Modified: trunk/uClibc/libc/string/x86_64/strcpy.S =================================================================== --- trunk/uClibc/libc/string/x86_64/strcpy.S 2007-07-29 14:17:48 UTC (rev 19325) +++ trunk/uClibc/libc/string/x86_64/strcpy.S 2007-07-29 14:45:26 UTC (rev 19326) @@ -20,6 +20,8 @@ #include "_glibc_inc.h" +/* Seems to be unrolled too much */ + #ifndef USE_AS_STPCPY # define STRCPY strcpy #endif Modified: trunk/uClibc/libc/string/x86_64/strcspn.S =================================================================== --- trunk/uClibc/libc/string/x86_64/strcspn.S 2007-07-29 14:17:48 UTC (rev 19325) +++ trunk/uClibc/libc/string/x86_64/strcspn.S 2007-07-29 14:45:26 UTC (rev 19326) @@ -25,6 +25,9 @@ #include "_glibc_inc.h" +/* Seems to be unrolled too much */ +/* (and why testb $0xff, %cl, not testb %cl, %cl?) */ + /* BEWARE: `#ifdef strcspn' means that strcspn is redefined as `strpbrk' */ #define STRPBRK_P (defined strcspn) Modified: trunk/uClibc/libc/string/x86_64/strlen.S =================================================================== --- trunk/uClibc/libc/string/x86_64/strlen.S 2007-07-29 14:17:48 UTC (rev 19325) +++ trunk/uClibc/libc/string/x86_64/strlen.S 2007-07-29 14:45:26 UTC (rev 19326) @@ -20,6 +20,7 @@ #include "_glibc_inc.h" +/* Seems to be unrolled too much */ .text ENTRY (strlen) Modified: trunk/uClibc/libc/sysdeps/linux/i386/__longjmp.S =================================================================== --- trunk/uClibc/libc/sysdeps/linux/i386/__longjmp.S 2007-07-29 14:17:48 UTC (rev 19325) +++ trunk/uClibc/libc/sysdeps/linux/i386/__longjmp.S 2007-07-29 14:45:26 UTC (rev 19326) @@ -24,7 +24,6 @@ .global __longjmp .type __longjmp,%function -.align 4 __longjmp: movl 4(%esp), %ecx /* User's jmp_buf in %ecx. */ movl 8(%esp), %eax /* Second argument is return value. */ Modified: trunk/uClibc/libc/sysdeps/linux/i386/bsd-_setjmp.S =================================================================== --- trunk/uClibc/libc/sysdeps/linux/i386/bsd-_setjmp.S 2007-07-29 14:17:48 UTC (rev 19325) +++ trunk/uClibc/libc/sysdeps/linux/i386/bsd-_setjmp.S 2007-07-29 14:45:26 UTC (rev 19326) @@ -27,7 +27,6 @@ .global _setjmp .type _setjmp,%function -.align 4 _setjmp: xorl %eax, %eax movl 4 (%esp), %edx Modified: trunk/uClibc/libc/sysdeps/linux/i386/bsd-setjmp.S =================================================================== --- trunk/uClibc/libc/sysdeps/linux/i386/bsd-setjmp.S 2007-07-29 14:17:48 UTC (rev 19325) +++ trunk/uClibc/libc/sysdeps/linux/i386/bsd-setjmp.S 2007-07-29 14:45:26 UTC (rev 19326) @@ -23,7 +23,6 @@ .global setjmp .type setjmp,%function -.align 4 setjmp: movl 4 (%esp), %eax /* Save registers. */ Modified: trunk/uClibc/libc/sysdeps/linux/i386/mmap64.S =================================================================== --- trunk/uClibc/libc/sysdeps/linux/i386/mmap64.S 2007-07-29 14:17:48 UTC (rev 19325) +++ trunk/uClibc/libc/sysdeps/linux/i386/mmap64.S 2007-07-29 14:45:26 UTC (rev 19326) @@ -40,7 +40,6 @@ .text .global mmap64 .type mmap64,%function -.align 1<<4 mmap64: /* Save registers. */ Modified: trunk/uClibc/libc/sysdeps/linux/i386/setjmp.S =================================================================== --- trunk/uClibc/libc/sysdeps/linux/i386/setjmp.S 2007-07-29 14:17:48 UTC (rev 19325) +++ trunk/uClibc/libc/sysdeps/linux/i386/setjmp.S 2007-07-29 14:45:26 UTC (rev 19326) @@ -24,7 +24,6 @@ .global __sigsetjmp .type __sigsetjmp,%function -.align 4 __sigsetjmp: movl 4 (%esp), %eax Modified: trunk/uClibc/libc/sysdeps/linux/i386/sigaction.c =================================================================== --- trunk/uClibc/libc/sysdeps/linux/i386/sigaction.c 2007-07-29 14:17:48 UTC (rev 19325) +++ trunk/uClibc/libc/sysdeps/linux/i386/sigaction.c 2007-07-29 14:45:26 UTC (rev 19326) @@ -145,7 +145,6 @@ __asm__ \ ( \ ".text\n" \ - " .align 16\n" \ "__" #name ":\n" \ " movl $" #syscall ", %eax\n" \ " int $0x80" \ @@ -163,7 +162,6 @@ __asm__ \ ( \ ".text\n" \ - " .align 8\n" \ "__" #name ":\n" \ " popl %eax\n" \ " movl $" #syscall ", %eax\n" \ Modified: trunk/uClibc/libc/sysdeps/linux/i386/syscall.S =================================================================== --- trunk/uClibc/libc/sysdeps/linux/i386/syscall.S 2007-07-29 14:17:48 UTC (rev 19325) +++ trunk/uClibc/libc/sysdeps/linux/i386/syscall.S 2007-07-29 14:45:26 UTC (rev 19326) @@ -23,7 +23,6 @@ .text .global syscall .type syscall,%function -.align 4 syscall: pushl %ebp pushl %edi Modified: trunk/uClibc/libc/sysdeps/linux/i386/vfork.S =================================================================== --- trunk/uClibc/libc/sysdeps/linux/i386/vfork.S 2007-07-29 14:17:48 UTC (rev 19325) +++ trunk/uClibc/libc/sysdeps/linux/i386/vfork.S 2007-07-29 14:45:26 UTC (rev 19326) @@ -15,7 +15,6 @@ .global __vfork .hidden __vfork .type __vfork,%function -.align 1<<4 __vfork: popl %ecx Modified: trunk/uClibc/libc/sysdeps/linux/sparc/_math_inc.h =================================================================== --- trunk/uClibc/libc/sysdeps/linux/sparc/_math_inc.h 2007-07-29 14:17:48 UTC (rev 19325) +++ trunk/uClibc/libc/sysdeps/linux/sparc/_math_inc.h 2007-07-29 14:45:26 UTC (rev 19326) @@ -9,6 +9,8 @@ #define __ASSEMBLY__ #include +/* Is alignment really needed? */ + #if __WORDSIZE == 32 # define ENTRY_ALIGN 4 #else Modified: trunk/uClibc/libc/sysdeps/linux/x86_64/__longjmp.S =================================================================== --- trunk/uClibc/libc/sysdeps/linux/x86_64/__longjmp.S 2007-07-29 14:17:48 UTC (rev 19325) +++ trunk/uClibc/libc/sysdeps/linux/x86_64/__longjmp.S 2007-07-29 14:45:26 UTC (rev 19326) @@ -26,7 +26,6 @@ void __longjmp (__jmp_buf env, int val). */ .global __longjmp .type __longjmp,%function -.align 16 __longjmp: /* Restore registers. */ movq (JB_RBX*8)(%rdi),%rbx Modified: trunk/uClibc/libc/sysdeps/linux/x86_64/bsd-_setjmp.S =================================================================== --- trunk/uClibc/libc/sysdeps/linux/x86_64/bsd-_setjmp.S 2007-07-29 14:17:48 UTC (rev 19325) +++ trunk/uClibc/libc/sysdeps/linux/x86_64/bsd-_setjmp.S 2007-07-29 14:45:26 UTC (rev 19326) @@ -23,7 +23,6 @@ .global _setjmp .type _setjmp,%function -.align 16 _setjmp: xorq %rsi, %rsi jmp __sigsetjmp at PLT Modified: trunk/uClibc/libc/sysdeps/linux/x86_64/bsd-setjmp.S =================================================================== --- trunk/uClibc/libc/sysdeps/linux/x86_64/bsd-setjmp.S 2007-07-29 14:17:48 UTC (rev 19325) +++ trunk/uClibc/libc/sysdeps/linux/x86_64/bsd-setjmp.S 2007-07-29 14:45:26 UTC (rev 19326) @@ -23,7 +23,6 @@ .global setjmp .type setjmp,%function -.align 16 setjmp: movq $1, %rsi jmp __sigsetjmp at PLT Modified: trunk/uClibc/libc/sysdeps/linux/x86_64/clone.S =================================================================== --- trunk/uClibc/libc/sysdeps/linux/x86_64/clone.S 2007-07-29 14:17:48 UTC (rev 19325) +++ trunk/uClibc/libc/sysdeps/linux/x86_64/clone.S 2007-07-29 14:45:26 UTC (rev 19326) @@ -53,7 +53,6 @@ .text .global clone .type clone,%function -.align 4 clone: /* Sanity check arguments. */ movq $-EINVAL,%rax Modified: trunk/uClibc/libc/sysdeps/linux/x86_64/setjmp.S =================================================================== --- trunk/uClibc/libc/sysdeps/linux/x86_64/setjmp.S 2007-07-29 14:17:48 UTC (rev 19325) +++ trunk/uClibc/libc/sysdeps/linux/x86_64/setjmp.S 2007-07-29 14:45:26 UTC (rev 19326) @@ -23,7 +23,6 @@ .global __sigsetjmp .type __sigsetjmp,%function -.align 4 __sigsetjmp: /* Save registers. */ movq %rbx, (JB_RBX*8)(%rdi) Modified: trunk/uClibc/libc/sysdeps/linux/x86_64/sigaction.c =================================================================== --- trunk/uClibc/libc/sysdeps/linux/x86_64/sigaction.c 2007-07-29 14:17:48 UTC (rev 19325) +++ trunk/uClibc/libc/sysdeps/linux/x86_64/sigaction.c 2007-07-29 14:45:26 UTC (rev 19326) @@ -138,7 +138,6 @@ asm \ ( \ ".text\n" \ - ".align 16\n" \ "__" #name ":\n" \ " movq $" #syscall ", %rax\n" \ " syscall\n" \ Modified: trunk/uClibc/libc/sysdeps/linux/x86_64/syscall.S =================================================================== --- trunk/uClibc/libc/sysdeps/linux/x86_64/syscall.S 2007-07-29 14:17:48 UTC (rev 19325) +++ trunk/uClibc/libc/sysdeps/linux/x86_64/syscall.S 2007-07-29 14:45:26 UTC (rev 19326) @@ -26,7 +26,6 @@ .text .globl syscall .type syscall,%function -.align 16 syscall: movq %rdi, %rax /* Syscall number -> rax. */ movq %rsi, %rdi /* shift arg1 - arg5. */ Modified: trunk/uClibc/libc/sysdeps/linux/x86_64/vfork.S =================================================================== --- trunk/uClibc/libc/sysdeps/linux/x86_64/vfork.S 2007-07-29 14:17:48 UTC (rev 19325) +++ trunk/uClibc/libc/sysdeps/linux/x86_64/vfork.S 2007-07-29 14:45:26 UTC (rev 19326) @@ -32,7 +32,6 @@ .global __vfork .hidden __vfork .type __vfork,%function -.align 16 __vfork: From vda at uclibc.org Mon Jul 30 09:51:56 2007 From: vda at uclibc.org (vda at uclibc.org) Date: Mon, 30 Jul 2007 09:51:56 -0700 (PDT) Subject: svn commit: trunk/uClibc: include libc/stdlib Message-ID: <20070730165156.EC5A2A4640@busybox.net> Author: vda Date: 2007-07-30 09:51:48 -0700 (Mon, 30 Jul 2007) New Revision: 19341 Log: introduce __uc_malloc, so that users can intercept libc internal OOM. Added: trunk/uClibc/libc/stdlib/__uc_malloc.c Modified: trunk/uClibc/include/malloc.h trunk/uClibc/libc/stdlib/Makefile.in Changeset: Modified: trunk/uClibc/include/malloc.h =================================================================== --- trunk/uClibc/include/malloc.h 2007-07-30 14:22:25 UTC (rev 19340) +++ trunk/uClibc/include/malloc.h 2007-07-30 16:51:48 UTC (rev 19341) @@ -183,6 +183,13 @@ #endif /* __MALLOC_STANDARD__ */ +/* uClibc may use malloc internally in situations where user can not be + * notified about out-of-memory condition. In this situation uClibc will + * call __uc_malloc_failed if it is non-NULL, and retry allocation + * if it returns. If __uc_malloc_failed is NULL, uclubc will _exit(1). + * NB: do not use stdio in __uc_malloc_failed handler! */ +extern void *__uc_malloc(size_t size); +extern void (*__uc_malloc_failed)(size_t size); #ifdef __cplusplus } /* end of extern "C" */ Modified: trunk/uClibc/libc/stdlib/Makefile.in =================================================================== --- trunk/uClibc/libc/stdlib/Makefile.in 2007-07-30 14:22:25 UTC (rev 19340) +++ trunk/uClibc/libc/stdlib/Makefile.in 2007-07-30 16:51:48 UTC (rev 19341) @@ -15,7 +15,7 @@ getpt.c ptsname.c grantpt.c unlockpt.c drand48-iter.c jrand48.c \ jrand48_r.c lrand48.c lrand48_r.c mrand48.c mrand48_r.c nrand48.c \ nrand48_r.c rand_r.c srand48.c srand48_r.c seed48.c seed48_r.c \ - valloc.c posix_memalign.c a64l.c l64a.c + valloc.c posix_memalign.c a64l.c l64a.c __uc_malloc.c ifeq ($(UCLIBC_HAS_ARC4RANDOM),y) CSRC += arc4random.c endif Added: trunk/uClibc/libc/stdlib/__uc_malloc.c =================================================================== --- trunk/uClibc/libc/stdlib/__uc_malloc.c (rev 0) +++ trunk/uClibc/libc/stdlib/__uc_malloc.c 2007-07-30 16:51:48 UTC (rev 19341) @@ -0,0 +1,41 @@ +/* vi: set sw=4 ts=4: */ +/* uClibc internal malloc. + Copyright (C) 1991, 1992 Free Software Foundation, Inc. + +This 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. + +This 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 this library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. + + The author may be reached (Email) at the address mike@@ai.mit.edu, + or (US mail) as Mike Haertel c/o Free Software Foundation. */ + +#include +#include +#include + +void (*__uc_malloc_failed)(size_t size); + +void *__uc_malloc(size_t size) +{ + void *p; + + while (1) { + p = malloc(size); + if (!size || p) + return p; + if (!__uc_malloc_failed) + _exit(1); + __uc_malloc_failed(size); + } +} From vda at uclibc.org Mon Jul 30 09:52:23 2007 From: vda at uclibc.org (vda at uclibc.org) Date: Mon, 30 Jul 2007 09:52:23 -0700 (PDT) Subject: svn commit: trunk/uClibc/libcrypt Message-ID: <20070730165223.2640EA465D@busybox.net> Author: vda Date: 2007-07-30 09:52:23 -0700 (Mon, 30 Jul 2007) New Revision: 19342 Log: convert des.c to use __uc_malloc (-70 kbytes of bss) Modified: trunk/uClibc/libcrypt/des.c Changeset: Modified: trunk/uClibc/libcrypt/des.c =================================================================== --- trunk/uClibc/libcrypt/des.c 2007-07-30 16:51:48 UTC (rev 19341) +++ trunk/uClibc/libcrypt/des.c 2007-07-30 16:52:23 UTC (rev 19342) @@ -64,34 +64,69 @@ #include #include #include +#include +#include #include "libcrypt.h" -/* Re-entrantify me -- all this junk needs to be in - * struct crypt_data to make this really reentrant... */ -static u_char inv_key_perm[64]; -static u_char inv_comp_perm[56]; -static u_char un_pbox[32]; -static u_int32_t en_keysl[16], en_keysr[16]; -static u_int32_t de_keysl[16], de_keysr[16]; -static u_int32_t ip_maskl[8][256], ip_maskr[8][256]; -static u_int32_t fp_maskl[8][256], fp_maskr[8][256]; -static u_int32_t key_perm_maskl[8][128], key_perm_maskr[8][128]; -static u_int32_t comp_maskl[8][128], comp_maskr[8][128]; -static u_int32_t saltbits; -static u_int32_t old_salt; -static u_int32_t old_rawkey0, old_rawkey1; +/* We allocate memory for tables on first use, instead of using + * static buffers - ~70k of statics is not NOMMU-friendly. */ +struct crypt_data { + u_int32_t saltbits; /* referenced 5 times */ + u_int32_t old_salt; /* 3 times */ + u_int32_t old_rawkey0, old_rawkey1; /* 3 times each */ + u_char un_pbox[32]; /* 2 times */ + u_char inv_comp_perm[56]; /* 3 times */ + u_char inv_key_perm[64]; /* 3 times */ + char des_initialised; /* 2 times */ + char __des_crypt_out[21]; /* private buffer for __des_crypt() */ + u_int32_t en_keysl[16], en_keysr[16]; /* 2 times each */ + u_int32_t de_keysl[16], de_keysr[16]; /* 2 times each */ + u_int32_t ip_maskl[8][256], ip_maskr[8][256]; /* 9 times each */ + u_int32_t fp_maskl[8][256], fp_maskr[8][256]; /* 9 times each */ + u_int32_t key_perm_maskl[8][128], key_perm_maskr[8][128]; /* 9 times */ + u_int32_t comp_maskl[8][128], comp_maskr[8][128]; /* 9 times each */ +}; +static struct crypt_data *__uc_des_data; +#define D (*__uc_des_data) +#define saltbits (D.saltbits ) +#define old_salt (D.old_salt ) +#define old_rawkey0 (D.old_rawkey0 ) +#define old_rawkey1 (D.old_rawkey1 ) +#define un_pbox (D.un_pbox ) +#define inv_comp_perm (D.inv_comp_perm ) +#define inv_key_perm (D.inv_key_perm ) +#define des_initialised (D.des_initialised) +#define __des_crypt_out (D.__des_crypt_out) +#define en_keysl (D.en_keysl ) +#define en_keysr (D.en_keysr ) +#define de_keysl (D.de_keysl ) +#define de_keysr (D.de_keysr ) +#define ip_maskl (D.ip_maskl ) +#define ip_maskr (D.ip_maskr ) +#define fp_maskl (D.fp_maskl ) +#define fp_maskr (D.fp_maskr ) +#define key_perm_maskl (D.key_perm_maskl ) +#define key_perm_maskr (D.key_perm_maskr ) +#define comp_maskl (D.comp_maskl ) +#define comp_maskr (D.comp_maskr ) /* Static stuff that stays resident and doesn't change after * being initialized, and therefore doesn't need to be made * reentrant. */ -static u_char init_perm[64], final_perm[64]; -static u_char m_sbox[4][4096]; -static u_int32_t psbox[4][256]; +struct const_crypt_data { + u_char init_perm[64], final_perm[64]; /* referenced 2 times each */ + u_char m_sbox[4][4096]; /* 5 times */ + u_int32_t psbox[4][256]; /* 5 times */ +}; +static struct const_crypt_data *__uc_des_C_ptr; +#define C (*__uc_des_C_ptr) +#define init_perm (C.init_perm ) +#define final_perm (C.final_perm) +#define m_sbox (C.m_sbox ) +#define psbox (C.psbox ) - - /* A pile of data */ static const u_char ascii64[] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; @@ -216,16 +251,19 @@ static void des_init(void) { - static int des_initialised = 0; - int i, j, b, k, inbit, obit; u_int32_t *p, *il, *ir, *fl, *fr; const u_int32_t *bits28, *bits24; u_char u_sbox[8][64]; - if (des_initialised==1) + if (des_initialised) return; + if (!__uc_des_C_ptr) { + /* No need to zero it out, it is fully initialized below */ + __uc_des_C_ptr = __uc_malloc(sizeof(C)); + } + old_rawkey0 = old_rawkey1 = 0L; saltbits = 0L; old_salt = 0L; @@ -459,7 +497,8 @@ * l_in, r_in, l_out, and r_out are in pseudo-"big-endian" format. */ u_int32_t l, r, *kl, *kr, *kl1, *kr1; - u_int32_t f, r48l, r48r; + u_int32_t f = f; /* silence gcc */ + u_int32_t r48l, r48r; int round; if (count == 0) { @@ -605,6 +644,9 @@ u_int32_t packed_keys[2]; u_char *p; + if (!__uc_des_data) + __uc_des_data = memset(__uc_malloc(sizeof(D)), 0, sizeof(D)); + p = (u_char *) packed_keys; for (i = 0; i < 8; i++) { @@ -624,6 +666,9 @@ u_char *p; int i, j; + /* if user didn't call setkey() before and __uc_des_data + * is NULL, it's user's own fault. */ + des_init(); setup_salt(0L); @@ -640,12 +685,21 @@ block[(i << 5) | j] = (io[i] & bits32[j]) ? 1 : 0; } + char *__des_crypt(const unsigned char *key, const unsigned char *setting) { u_int32_t count, salt, l, r0, r1, keybuf[2]; u_char *p, *q; - static char output[21]; +/* Used to have static char output[21] here, but since we already + * allocate ~70k for des tables, we can carve out 21 bytes + * from that memory instead */ +#define output __des_crypt_out + + if (!__uc_des_data) { + __uc_des_data = memset(__uc_malloc(sizeof(D)), 0, sizeof(D)); + } + des_init(); /* From vda at uclibc.org Mon Jul 30 09:53:45 2007 From: vda at uclibc.org (vda at uclibc.org) Date: Mon, 30 Jul 2007 09:53:45 -0700 (PDT) Subject: svn commit: trunk/uClibc: libc/inet libcrypt Message-ID: <20070730165345.BCED5A4756@busybox.net> Author: vda Date: 2007-07-30 09:53:44 -0700 (Mon, 30 Jul 2007) New Revision: 19343 Log: patch #3: make resolv.c use __uc_malloc Modified: trunk/uClibc/libc/inet/resolv.c trunk/uClibc/libcrypt/des.c Changeset: Modified: trunk/uClibc/libc/inet/resolv.c =================================================================== --- trunk/uClibc/libc/inet/resolv.c 2007-07-30 16:52:23 UTC (rev 19342) +++ trunk/uClibc/libc/inet/resolv.c 2007-07-30 16:53:44 UTC (rev 19343) @@ -146,6 +146,7 @@ #include #include #include +#include #include #include #include @@ -1122,13 +1123,17 @@ struct hostent *gethostbyname(const char *name) { - static struct hostent h; - static char buf[sizeof(struct in_addr) + + static struct { + struct hostent h; + char buf[sizeof(struct in_addr) + sizeof(struct in_addr *)*2 + sizeof(char *)*(ALIAS_DIM) + 384/*namebuffer*/ + 32/* margin */]; + } *sp; struct hostent *hp; - gethostbyname_r(name, &h, buf, sizeof(buf), &hp, &h_errno); + free(sp); + sp = __uc_malloc(sizeof(*sp)); + gethostbyname_r(name, &sp->h, sp->buf, sizeof(sp->buf), &hp, &h_errno); return hp; } @@ -1142,13 +1147,17 @@ #ifndef __UCLIBC_HAS_IPV6__ return family == AF_INET ? gethostbyname(name) : (struct hostent*)0; #else /* __UCLIBC_HAS_IPV6__ */ - static struct hostent h; - static char buf[sizeof(struct in6_addr) + + static struct { + struct hostent h; + char buf[sizeof(struct in6_addr) + sizeof(struct in6_addr *)*2 + sizeof(char *)*(ALIAS_DIM) + 384/*namebuffer*/ + 32/* margin */]; + } *sp; struct hostent *hp; - gethostbyname2_r(name, family, &h, buf, sizeof(buf), &hp, &h_errno); + free(sp); + sp = __uc_malloc(sizeof(*sp)); + gethostbyname2_r(name, family, &sp->h, sp->buf, sizeof(sp->buf), &hp, &h_errno); return hp; #endif /* __UCLIBC_HAS_IPV6__ */ @@ -1496,17 +1505,21 @@ #ifdef L_gethostbyaddr struct hostent *gethostbyaddr (const void *addr, socklen_t len, int type) { - static struct hostent h; - static char buf[ + static struct { + struct hostent h; + char buf[ #ifndef __UCLIBC_HAS_IPV6__ sizeof(struct in_addr) + sizeof(struct in_addr *)*2 + #else sizeof(struct in6_addr) + sizeof(struct in6_addr *)*2 + #endif /* __UCLIBC_HAS_IPV6__ */ sizeof(char *)*(ALIAS_DIM) + 384/*namebuffer*/ + 32/* margin */]; + } *sp; struct hostent *hp; - gethostbyaddr_r(addr, len, type, &h, buf, sizeof(buf), &hp, &h_errno); + free(sp); + sp = __uc_malloc(sizeof(*sp)); + gethostbyaddr_r(addr, len, type, &sp->h, sp->buf, sizeof(sp->buf), &hp, &h_errno); return hp; } @@ -1725,8 +1738,9 @@ struct hostent *gethostent (void) { - static struct hostent h; - static char buf[ + static struct { + struct hostent h; + char buf[ #ifndef __UCLIBC_HAS_IPV6__ sizeof(struct in_addr) + sizeof(struct in_addr *)*2 + #else @@ -1734,10 +1748,13 @@ #endif /* __UCLIBC_HAS_IPV6__ */ sizeof(char *)*(ALIAS_DIM) + 80/*namebuffer*/ + 2/* margin */]; + } *sp; struct hostent *host; + free(sp); + sp = __uc_malloc(sizeof(*sp)); __UCLIBC_MUTEX_LOCK(mylock); - gethostent_r(&h, buf, sizeof(buf), &host, &h_errno); + gethostent_r(&sp->h, sp->buf, sizeof(sp->buf), &host, &h_errno); __UCLIBC_MUTEX_UNLOCK(mylock); return(host); } Modified: trunk/uClibc/libcrypt/des.c =================================================================== --- trunk/uClibc/libcrypt/des.c 2007-07-30 16:52:23 UTC (rev 19342) +++ trunk/uClibc/libcrypt/des.c 2007-07-30 16:53:44 UTC (rev 19343) @@ -697,6 +697,7 @@ #define output __des_crypt_out if (!__uc_des_data) { + /* If malloc returns NULL, we just segfault. Other ideas? */ __uc_des_data = memset(__uc_malloc(sizeof(D)), 0, sizeof(D)); } From vda at uclibc.org Mon Jul 30 09:54:07 2007 From: vda at uclibc.org (vda at uclibc.org) Date: Mon, 30 Jul 2007 09:54:07 -0700 (PDT) Subject: svn commit: trunk/uClibc/libc/pwd_grp Message-ID: <20070730165407.01490A465D@busybox.net> Author: vda Date: 2007-07-30 09:54:07 -0700 (Mon, 30 Jul 2007) New Revision: 19344 Log: make pwd_grp.c use __uc_malloc Modified: trunk/uClibc/libc/pwd_grp/pwd_grp.c Changeset: Modified: trunk/uClibc/libc/pwd_grp/pwd_grp.c =================================================================== --- trunk/uClibc/libc/pwd_grp/pwd_grp.c 2007-07-30 16:53:44 UTC (rev 19343) +++ trunk/uClibc/libc/pwd_grp/pwd_grp.c 2007-07-30 16:54:07 UTC (rev 19344) @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -157,11 +158,15 @@ struct passwd *fgetpwent(FILE *stream) { - static char buffer[__UCLIBC_PWD_BUFFER_SIZE__]; - static struct passwd resultbuf; + static struct { + char buffer[__UCLIBC_PWD_BUFFER_SIZE__]; + struct passwd resultbuf; + } *sp; struct passwd *result; - fgetpwent_r(stream, &resultbuf, buffer, sizeof(buffer), &result); + free(sp); + sp = __uc_malloc(sizeof(*sp)); + fgetpwent_r(stream, &sp->resultbuf, sp->buffer, sizeof(sp->buffer), &result); return result; } #endif @@ -175,11 +180,15 @@ struct group *fgetgrent(FILE *stream) { - static char buffer[__UCLIBC_GRP_BUFFER_SIZE__]; - static struct group resultbuf; + static struct { + char buffer[__UCLIBC_GRP_BUFFER_SIZE__]; + struct group resultbuf; + } *sp; struct group *result; - fgetgrent_r(stream, &resultbuf, buffer, sizeof(buffer), &result); + free(sp); + sp = __uc_malloc(sizeof(*sp)); + fgetgrent_r(stream, &sp->resultbuf, sp->buffer, sizeof(sp->buffer), &result); return result; } #endif @@ -192,11 +201,15 @@ struct spwd *fgetspent(FILE *stream) { - static char buffer[__UCLIBC_PWD_BUFFER_SIZE__]; - static struct spwd resultbuf; + static struct { + char buffer[__UCLIBC_PWD_BUFFER_SIZE__]; + struct spwd resultbuf; + } *sp; struct spwd *result; - fgetspent_r(stream, &resultbuf, buffer, sizeof(buffer), &result); + free(sp); + sp = __uc_malloc(sizeof(*sp)); + fgetspent_r(stream, &sp->resultbuf, sp->buffer, sizeof(sp->buffer), &result); return result; } @@ -298,11 +311,15 @@ struct passwd *getpwuid(uid_t uid) { - static char buffer[__UCLIBC_PWD_BUFFER_SIZE__]; - static struct passwd resultbuf; + static struct { + char buffer[__UCLIBC_PWD_BUFFER_SIZE__]; + struct passwd resultbuf; + } *sp; struct passwd *result; - getpwuid_r(uid, &resultbuf, buffer, sizeof(buffer), &result); + free(sp); + sp = __uc_malloc(sizeof(*sp)); + getpwuid_r(uid, &sp->resultbuf, sp->buffer, sizeof(sp->buffer), &result); return result; } @@ -314,11 +331,15 @@ struct group *getgrgid(gid_t gid) { - static char buffer[__UCLIBC_GRP_BUFFER_SIZE__]; - static struct group resultbuf; + static struct { + char buffer[__UCLIBC_GRP_BUFFER_SIZE__]; + struct group resultbuf; + } *sp; struct group *result; - getgrgid_r(gid, &resultbuf, buffer, sizeof(buffer), &result); + free(sp); + sp = __uc_malloc(sizeof(*sp)); + getgrgid_r(gid, &sp->resultbuf, sp->buffer, sizeof(sp->buffer), &result); return result; } @@ -361,11 +382,15 @@ struct spwd *getspuid(uid_t uid) { - static char buffer[__UCLIBC_PWD_BUFFER_SIZE__]; - static struct spwd resultbuf; + static struct { + char buffer[__UCLIBC_PWD_BUFFER_SIZE__]; + struct spwd resultbuf; + } *sp; struct spwd *result; - getspuid_r(uid, &resultbuf, buffer, sizeof(buffer), &result); + free(sp); + sp = __uc_malloc(sizeof(*sp)); + getspuid_r(uid, &sp->resultbuf, sp->buffer, sizeof(sp->buffer), &result); return result; } @@ -377,11 +402,15 @@ struct passwd *getpwnam(const char *name) { - static char buffer[__UCLIBC_PWD_BUFFER_SIZE__]; - static struct passwd resultbuf; + static struct { + char buffer[__UCLIBC_PWD_BUFFER_SIZE__]; + struct passwd resultbuf; + } *sp; struct passwd *result; - getpwnam_r(name, &resultbuf, buffer, sizeof(buffer), &result); + free(sp); + sp = __uc_malloc(sizeof(*sp)); + getpwnam_r(name, &sp->resultbuf, sp->buffer, sizeof(sp->buffer), &result); return result; } @@ -393,11 +422,15 @@ struct group *getgrnam(const char *name) { - static char buffer[__UCLIBC_GRP_BUFFER_SIZE__]; - static struct group resultbuf; + static struct { + char buffer[__UCLIBC_GRP_BUFFER_SIZE__]; + struct group resultbuf; + } *sp; struct group *result; - getgrnam_r(name, &resultbuf, buffer, sizeof(buffer), &result); + free(sp); + sp = __uc_malloc(sizeof(*sp)); + getgrnam_r(name, &sp->resultbuf, sp->buffer, sizeof(sp->buffer), &result); return result; } @@ -409,11 +442,15 @@ struct spwd *getspnam(const char *name) { - static char buffer[__UCLIBC_PWD_BUFFER_SIZE__]; - static struct spwd resultbuf; + static struct { + char buffer[__UCLIBC_PWD_BUFFER_SIZE__]; + struct spwd resultbuf; + } *sp; struct spwd *result; - getspnam_r(name, &resultbuf, buffer, sizeof(buffer), &result); + free(sp); + sp = __uc_malloc(sizeof(*sp)); + getspnam_r(name, &sp->resultbuf, sp->buffer, sizeof(sp->buffer), &result); return result; } @@ -626,11 +663,15 @@ struct passwd *getpwent(void) { - static char line_buff[__UCLIBC_PWD_BUFFER_SIZE__]; - static struct passwd pwd; + static struct { + char line_buff[__UCLIBC_PWD_BUFFER_SIZE__]; + struct passwd pwd; + } *sp; struct passwd *result; - getpwent_r(&pwd, line_buff, sizeof(line_buff), &result); + free(sp); + sp = __uc_malloc(sizeof(*sp)); + getpwent_r(&sp->pwd, sp->line_buff, sizeof(sp->line_buff), &result); return result; } @@ -642,11 +683,15 @@ struct group *getgrent(void) { - static char line_buff[__UCLIBC_GRP_BUFFER_SIZE__]; - static struct group gr; + static struct { + char line_buff[__UCLIBC_GRP_BUFFER_SIZE__]; + struct group gr; + } *sp; struct group *result; - getgrent_r(&gr, line_buff, sizeof(line_buff), &result); + free(sp); + sp = __uc_malloc(sizeof(*sp)); + getgrent_r(&sp->gr, sp->line_buff, sizeof(sp->line_buff), &result); return result; } @@ -658,11 +703,15 @@ struct spwd *getspent(void) { - static char line_buff[__UCLIBC_PWD_BUFFER_SIZE__]; - static struct spwd spwd; + static struct { + char line_buff[__UCLIBC_PWD_BUFFER_SIZE__]; + struct spwd spwd; + } *sp; struct spwd *result; - getspent_r(&spwd, line_buff, sizeof(line_buff), &result); + free(sp); + sp = __uc_malloc(sizeof(*sp)); + getspent_r(&sp->spwd, sp->line_buff, sizeof(sp->line_buff), &result); return result; } @@ -674,11 +723,13 @@ struct spwd *sgetspent(const char *string) { - static char line_buff[__UCLIBC_PWD_BUFFER_SIZE__]; - static struct spwd spwd; + static struct { + char line_buff[__UCLIBC_PWD_BUFFER_SIZE__]; + struct spwd spwd; + } *sp; struct spwd *result; - sgetspent_r(string, &spwd, line_buff, sizeof(line_buff), &result); + sgetspent_r(string, &sp->spwd, sp->line_buff, sizeof(sp->line_buff), &result); return result; } From vda at uclibc.org Mon Jul 30 09:54:32 2007 From: vda at uclibc.org (vda at uclibc.org) Date: Mon, 30 Jul 2007 09:54:32 -0700 (PDT) Subject: svn commit: trunk/uClibc/libc: misc/utmp unistd Message-ID: <20070730165432.95355A6041@busybox.net> Author: vda Date: 2007-07-30 09:54:31 -0700 (Mon, 30 Jul 2007) New Revision: 19345 Log: make utent.c, getpass.c use __uc_malloc Modified: trunk/uClibc/libc/misc/utmp/utent.c trunk/uClibc/libc/unistd/getpass.c Changeset: Modified: trunk/uClibc/libc/misc/utmp/utent.c =================================================================== --- trunk/uClibc/libc/misc/utmp/utent.c 2007-07-30 16:54:07 UTC (rev 19344) +++ trunk/uClibc/libc/misc/utmp/utent.c 2007-07-30 16:54:31 UTC (rev 19345) @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -36,9 +37,10 @@ /* Some global crap */ +static const char default_file_name[] = _PATH_UTMP; + static int static_fd = -1; -static struct utmp static_utmp; -static const char default_file_name[] = _PATH_UTMP; +static struct utmp *static_utmp; static const char *static_ut_name = (const char *) default_file_name; /* This function must be called with the LOCK held */ @@ -89,9 +91,11 @@ return NULL; } - if (read(utmp_fd, (char *) &static_utmp, sizeof(struct utmp)) == sizeof(struct utmp)) + free(static_utmp); + static_utmp = __uc_malloc(sizeof(*static_utmp)); + if (read(utmp_fd, (char *) static_utmp, sizeof(*static_utmp)) == sizeof(*static_utmp)) { - ret = &static_utmp; + ret = static_utmp; } return ret; Modified: trunk/uClibc/libc/unistd/getpass.c =================================================================== --- trunk/uClibc/libc/unistd/getpass.c 2007-07-30 16:54:07 UTC (rev 19344) +++ trunk/uClibc/libc/unistd/getpass.c 2007-07-30 16:54:31 UTC (rev 19345) @@ -20,7 +20,7 @@ #include #include #include -#include +#include #if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_XOPEN2K) @@ -52,12 +52,16 @@ getpass (prompt) const char *prompt; { + static char *buf; + FILE *in, *out; struct termios s, t; int tty_changed; - static char buf[PWD_BUFFER_SIZE]; int nread; + free(buf); + buf = __uc_malloc(PWD_BUFFER_SIZE); + /* Try to write to and read from the terminal if we can. If we can't open the terminal, use stderr and stdin. */ From vda at uclibc.org Mon Jul 30 09:55:05 2007 From: vda at uclibc.org (vda at uclibc.org) Date: Mon, 30 Jul 2007 09:55:05 -0700 (PDT) Subject: svn commit: trunk/uClibc: libc/inet libcrypt Message-ID: <20070730165505.DE4CBA606E@busybox.net> Author: vda Date: 2007-07-30 09:55:05 -0700 (Mon, 30 Jul 2007) New Revision: 19346 Log: make getnetent.c, md5.c use __uc_malloc Modified: trunk/uClibc/libc/inet/getnetent.c trunk/uClibc/libcrypt/md5.c Changeset: Modified: trunk/uClibc/libc/inet/getnetent.c =================================================================== --- trunk/uClibc/libc/inet/getnetent.c 2007-07-30 16:54:31 UTC (rev 19345) +++ trunk/uClibc/libc/inet/getnetent.c 2007-07-30 16:55:05 UTC (rev 19346) @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -32,14 +33,9 @@ #include __UCLIBC_MUTEX_STATIC(mylock, PTHREAD_MUTEX_INITIALIZER); +static const char NETDB[] = _PATH_NETWORKS; - -#define MAXALIASES 35 -static const char NETDB[] = _PATH_NETWORKS; static FILE *netf = NULL; -static char *line = NULL; -static struct netent net; -static char *net_aliases[MAXALIASES]; int _net_stayopen attribute_hidden; @@ -83,6 +79,22 @@ return ((char *)0); } +#define MAXALIASES 35 +static struct { + char *line; + struct netent net; + char *net_aliases[MAXALIASES]; +} *sp; +#define line (sp->line) +#define net (sp->net) +#define net_aliases (sp->net_aliases) +#define INIT_SP() { \ + if (!sp) { \ + sp = __uc_malloc(sizeof(*sp)); \ + line = NULL; \ + } \ +} + libc_hidden_proto(getnetent) struct netent *getnetent(void) { @@ -90,6 +102,8 @@ register char *cp, **q; struct netent *rv = NULL; + INIT_SP(); + __UCLIBC_MUTEX_LOCK(mylock); if (netf == NULL && (netf = fopen(NETDB, "r" )) == NULL) { goto DONE; Modified: trunk/uClibc/libcrypt/md5.c =================================================================== --- trunk/uClibc/libcrypt/md5.c 2007-07-30 16:54:31 UTC (rev 19345) +++ trunk/uClibc/libcrypt/md5.c 2007-07-30 16:55:05 UTC (rev 19346) @@ -76,6 +76,7 @@ #include #include #include +#include #include #include #include @@ -95,7 +96,10 @@ static void __md5_Transform __P((u_int32_t [4], const unsigned char [64])); -static const unsigned char __md5__magic[] = "$1$"; /* This string is magic for this algorithm. Having +#define MD5_MAGIC_STR "$1$" +#define MD5_MAGIC_LEN (sizeof(MD5_MAGIC_STR) - 1) +static const unsigned char __md5__magic[] = MD5_MAGIC_STR; + /* This string is magic for this algorithm. Having it this way, we can get better later on */ static const unsigned char __md5_itoa64[] = /* 0 ... 63 => ascii - 64 */ "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; @@ -534,21 +538,24 @@ char *__md5_crypt(const unsigned char *pw, const unsigned char *salt) { /* Static stuff */ - static const unsigned char *sp, *ep; - static char passwd[120], *p; + static char *passwd; + const unsigned char *sp, *ep; + char *p; unsigned char final[17]; /* final[16] exists only to aid in looping */ - int sl,pl,i,__md5__magic_len,pw_len; + int sl,pl,i,pw_len; struct MD5Context ctx,ctx1; unsigned long l; + if (!passwd) + passwd = __uc_malloc(120); + /* Refine the Salt first */ sp = salt; /* If it starts with the magic string, then skip that */ - __md5__magic_len = strlen(__md5__magic); - if(!strncmp(sp,__md5__magic,__md5__magic_len)) - sp += __md5__magic_len; + if(!strncmp(sp,__md5__magic,MD5_MAGIC_LEN)) + sp += MD5_MAGIC_LEN; /* It stops at the first '$', max 8 chars */ for(ep=sp;*ep && *ep != '$' && ep < (sp+8);ep++) @@ -564,7 +571,7 @@ __md5_Update(&ctx,pw,pw_len); /* Then our magic string */ - __md5_Update(&ctx,__md5__magic,__md5__magic_len); + __md5_Update(&ctx,__md5__magic,MD5_MAGIC_LEN); /* Then the raw salt */ __md5_Update(&ctx,sp,sl); From vda at uclibc.org Mon Jul 30 10:02:07 2007 From: vda at uclibc.org (vda at uclibc.org) Date: Mon, 30 Jul 2007 10:02:07 -0700 (PDT) Subject: svn commit: trunk/uClibc/libc: inet inet/rpc misc/mntent misc/regex mis etc... Message-ID: <20070730170207.19C65A6092@busybox.net> Author: vda Date: 2007-07-30 10:02:06 -0700 (Mon, 30 Jul 2007) New Revision: 19347 Log: make regex_old.c, ruserpass.c use __uc_malloc, replace "buf = malloc(BUFSIZ); if (!buf) abort();" by __uc_malloc elsewhere. With last 7 patches together uclibc has 3k of static data total with fairly big .config and with 2k being used for 2 x BUFSIZ stdio buffer: text data bss dec hex filename 114 132 2048 2294 8f6 _stdio.o (ex lib/libc.a) total data 593 total bss 3062 Modified: trunk/uClibc/libc/inet/getnetent.c trunk/uClibc/libc/inet/getproto.c trunk/uClibc/libc/inet/getservice.c trunk/uClibc/libc/inet/rpc/ruserpass.c trunk/uClibc/libc/misc/mntent/mntent.c trunk/uClibc/libc/misc/regex/regex_old.c trunk/uClibc/libc/misc/ttyent/getttyent.c Changeset: Modified: trunk/uClibc/libc/inet/getnetent.c =================================================================== --- trunk/uClibc/libc/inet/getnetent.c 2007-07-30 16:55:05 UTC (rev 19346) +++ trunk/uClibc/libc/inet/getnetent.c 2007-07-30 17:02:06 UTC (rev 19347) @@ -111,9 +111,7 @@ again: if (!line) { - line = malloc(BUFSIZ + 1); - if (!line) - abort(); + line = __uc_malloc(BUFSIZ + 1); } p = fgets(line, BUFSIZ, netf); Modified: trunk/uClibc/libc/inet/getproto.c =================================================================== --- trunk/uClibc/libc/inet/getproto.c 2007-07-30 16:55:05 UTC (rev 19346) +++ trunk/uClibc/libc/inet/getproto.c 2007-07-30 17:02:06 UTC (rev 19347) @@ -59,6 +59,7 @@ #include #include #include +#include #include libc_hidden_proto(fopen) @@ -86,9 +87,7 @@ static void __initbuf(void) { if (!static_aliases) { - static_aliases = malloc(SBUFSIZE); - if (!static_aliases) - abort(); + static_aliases = __uc_malloc(SBUFSIZE); } } Modified: trunk/uClibc/libc/inet/getservice.c =================================================================== --- trunk/uClibc/libc/inet/getservice.c 2007-07-30 16:55:05 UTC (rev 19346) +++ trunk/uClibc/libc/inet/getservice.c 2007-07-30 17:02:06 UTC (rev 19347) @@ -59,6 +59,7 @@ #include #include #include +#include #include #include #include @@ -89,9 +90,7 @@ static void __initbuf(void) { if (!servbuf) { - servbuf = malloc(SBUFSIZE); - if (!servbuf) - abort(); + servbuf = __uc_malloc(SBUFSIZE); } } Modified: trunk/uClibc/libc/inet/rpc/ruserpass.c =================================================================== --- trunk/uClibc/libc/inet/rpc/ruserpass.c 2007-07-30 16:55:05 UTC (rev 19346) +++ trunk/uClibc/libc/inet/rpc/ruserpass.c 2007-07-30 17:02:06 UTC (rev 19347) @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -79,7 +80,7 @@ #define ID 10 #define MACHINE 11 -static char tokval[100]; +static char *tokval; /* [100] */ static const char tokstr[] = { @@ -152,6 +153,9 @@ if (mydomain==NULL) { mydomain=myname + strlen(myname); } + + if (!tokval) + tokval = __uc_malloc(100); next: while ((t = token())) switch(t) { Modified: trunk/uClibc/libc/misc/mntent/mntent.c =================================================================== --- trunk/uClibc/libc/misc/mntent/mntent.c 2007-07-30 16:55:05 UTC (rev 19346) +++ trunk/uClibc/libc/misc/mntent/mntent.c 2007-07-30 17:02:06 UTC (rev 19347) @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -84,9 +85,7 @@ __UCLIBC_MUTEX_LOCK(mylock); if (!buff) { - buff = malloc(BUFSIZ); - if (!buff) - abort(); + buff = __uc_malloc(BUFSIZ); } tmp = getmntent_r(filep, &mnt, buff, BUFSIZ); Modified: trunk/uClibc/libc/misc/regex/regex_old.c =================================================================== --- trunk/uClibc/libc/misc/regex/regex_old.c 2007-07-30 16:55:05 UTC (rev 19346) +++ trunk/uClibc/libc/misc/regex/regex_old.c 2007-07-30 17:02:06 UTC (rev 19347) @@ -35,6 +35,7 @@ #include #include #include +#include #include libc_hidden_proto(memset) @@ -306,7 +307,7 @@ # else /* not SYNTAX_TABLE */ -static char re_syntax_table[CHAR_SET_SIZE]; +static char *re_syntax_table; /* [CHAR_SET_SIZE] */ static void init_syntax_once PARAMS ((void)); @@ -314,12 +315,14 @@ init_syntax_once () { register int c; - static int done = 0; + static char done; if (done) return; - bzero (re_syntax_table, sizeof re_syntax_table); + re_syntax_table = __uc_malloc(CHAR_SET_SIZE); + bzero (re_syntax_table, CHAR_SET_SIZE); + for (c = 0; c < CHAR_SET_SIZE; ++c) if (ISALNUM (c)) re_syntax_table[c] = Sword; Modified: trunk/uClibc/libc/misc/ttyent/getttyent.c =================================================================== --- trunk/uClibc/libc/misc/ttyent/getttyent.c 2007-07-30 16:55:05 UTC (rev 19346) +++ trunk/uClibc/libc/misc/ttyent/getttyent.c 2007-07-30 17:02:06 UTC (rev 19347) @@ -34,6 +34,7 @@ #include #include #include +#include #ifdef __UCLIBC_HAS_THREADS__ #include #endif @@ -132,9 +133,7 @@ return (NULL); if (!line) { - line = malloc(BUFSIZ); - if (!line) - abort(); + line = __uc_malloc(BUFSIZ); } __STDIO_ALWAYS_THREADLOCK(tf); From bugs at busybox.net Tue Jul 31 05:55:20 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Tue, 31 Jul 2007 05:55:20 -0700 Subject: [uClibc 0001452]: rint() bad on x86. Message-ID: <7b79e14b4471c0a133b4fdf8a20d97e0@bugs.uclibc.org> The following issue has been SUBMITTED. ====================================================================== http://busybox.net/bugs/view.php?id=1452 ====================================================================== Reported By: chmeee Assigned To: uClibc ====================================================================== Project: uClibc Issue ID: 1452 Category: Architecture Specific Reproducibility: always Severity: minor Priority: normal Status: assigned ====================================================================== Date Submitted: 07-31-2007 05:55 PDT Last Modified: 07-31-2007 05:55 PDT ====================================================================== Summary: rint() bad on x86. Description: On x86 with Linux uclibc's rint() function returns bad results. This was tracked down to Linux's defaulting to 80-bit floating point rounding, and uclibc's 64-bit function. There are two ways of dealing with this: 1) Reset FPU to 64-bit precision. 2) Import glibc's functions for this and its variants. I'm currently working on doing the latter in my personal tree, and will submit a patch when I finish. ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 07-31-07 05:55 chmeee New Issue 07-31-07 05:55 chmeee Status new => assigned 07-31-07 05:55 chmeee Assigned To => uClibc ======================================================================