From vda at uclibc.org Thu May 1 05:14:25 2008 From: vda at uclibc.org (vda at uclibc.org) Date: Thu, 1 May 2008 05:14:25 -0700 (PDT) Subject: svn commit: trunk/uClibc/extra/scripts Message-ID: <20080501121425.96E783C644@busybox.net> Author: vda Date: 2008-05-01 05:14:25 -0700 (Thu, 01 May 2008) New Revision: 21904 Log: install_headers: do not exit if unifdef "fails", it's ok Modified: trunk/uClibc/extra/scripts/install_headers.sh Changeset: Modified: trunk/uClibc/extra/scripts/install_headers.sh =================================================================== --- trunk/uClibc/extra/scripts/install_headers.sh 2008-04-30 13:58:31 UTC (rev 21903) +++ trunk/uClibc/extra/scripts/install_headers.sh 2008-05-01 12:14:25 UTC (rev 21904) @@ -42,7 +42,10 @@ if test -d "$1/$filename"; then mkdir -p "$2/$filename" 2>/dev/null else - "$top_builddir/extra/scripts/unifdef" -UUCLIBC_INTERNAL "$1/$filename" >"$2/$filename" || exit + # NB: unifdef exits with 1 if output is not + # exactly the same as input. That's ok. + # Do not abort the script if unifdef "fails"! + "$top_builddir/extra/scripts/unifdef" -UUCLIBC_INTERNAL "$1/$filename" >"$2/$filename" fi done ) From aldot at uclibc.org Fri May 2 00:18:29 2008 From: aldot at uclibc.org (aldot at uclibc.org) Date: Fri, 2 May 2008 00:18:29 -0700 (PDT) Subject: svn commit: trunk/uClibc/libc/sysdeps/linux: common i386/bits Message-ID: <20080502071829.D901C3C67D@busybox.net> Author: aldot Date: 2008-05-02 00:18:29 -0700 (Fri, 02 May 2008) New Revision: 21916 Log: - add vmsplice, splice, tee (Timo Ter?\195?\164s) - pull bits/fcntl.h from glibc (Timo Ter?\195?\164s) Added: trunk/uClibc/libc/sysdeps/linux/common/splice.c trunk/uClibc/libc/sysdeps/linux/common/tee.c trunk/uClibc/libc/sysdeps/linux/common/vmsplice.c Modified: trunk/uClibc/libc/sysdeps/linux/i386/bits/fcntl.h Changeset: Added: trunk/uClibc/libc/sysdeps/linux/common/splice.c =================================================================== --- trunk/uClibc/libc/sysdeps/linux/common/splice.c (rev 0) +++ trunk/uClibc/libc/sysdeps/linux/common/splice.c 2008-05-02 07:18:29 UTC (rev 21916) @@ -0,0 +1,28 @@ +/* vi: set sw=4 ts=4: */ +/* + * splice() for uClibc + * + * Copyright (C) 2000-2006 Erik Andersen + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include +#include + +libc_hidden_proto(splice) + +#ifdef __NR_splice +_syscall6(ssize_t, splice, int, __fdin, __off64_t *, __offin, int, __fdout, + __off64_t *, __offout, size_t, __len, unsigned int, __flags); +#else +ssize_t splice(int __fdin, __off64_t *__offin, int __fdout, + __off64_t *__offout, size_t __len, unsigned int __flags) +{ + __set_errno(ENOSYS); + return -1; +} +#endif + +libc_hidden_def(splice) + Added: trunk/uClibc/libc/sysdeps/linux/common/tee.c =================================================================== --- trunk/uClibc/libc/sysdeps/linux/common/tee.c (rev 0) +++ trunk/uClibc/libc/sysdeps/linux/common/tee.c 2008-05-02 07:18:29 UTC (rev 21916) @@ -0,0 +1,28 @@ +/* vi: set sw=4 ts=4: */ +/* + * tee() for uClibc + * + * Copyright (C) 2000-2006 Erik Andersen + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include +#include + +libc_hidden_proto(tee) + +#ifdef __NR_tee +_syscall4(ssize_t, tee, int, __fdin, int, __fdout, size_t, __len, + unsigned int, __flags); +#else +ssize_t tee(int __fdin, int __fdout, size_t __len, unsigned int __flags) +{ + __set_errno(ENOSYS); + return -1; +} +#endif + +libc_hidden_def(tee) + + Added: trunk/uClibc/libc/sysdeps/linux/common/vmsplice.c =================================================================== --- trunk/uClibc/libc/sysdeps/linux/common/vmsplice.c (rev 0) +++ trunk/uClibc/libc/sysdeps/linux/common/vmsplice.c 2008-05-02 07:18:29 UTC (rev 21916) @@ -0,0 +1,28 @@ +/* vi: set sw=4 ts=4: */ +/* + * vmsplice() for uClibc + * + * Copyright (C) 2000-2006 Erik Andersen + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include +#include + +libc_hidden_proto(vmsplice) + +#ifdef __NR_vmsplice +_syscall4(ssize_t, vmsplice, int, __fdout, const struct iovec *, __iov, + size_t, __count, unsigned int, __flags); +#else +ssize_t vmsplice(int __fdout, const struct iovec *__iov, size_t __count, + unsigned int __flags) +{ + __set_errno(ENOSYS); + return -1; +} +#endif + +libc_hidden_def(vmsplice) + Modified: trunk/uClibc/libc/sysdeps/linux/i386/bits/fcntl.h =================================================================== --- trunk/uClibc/libc/sysdeps/linux/i386/bits/fcntl.h 2008-05-01 19:33:44 UTC (rev 21915) +++ trunk/uClibc/libc/sysdeps/linux/i386/bits/fcntl.h 2008-05-02 07:18:29 UTC (rev 21916) @@ -1,5 +1,5 @@ /* O_*, F_*, FD_* bit values for Linux. - Copyright (C) 1995, 1996, 1997, 1998, 2000, 2004, 2006 + Copyright (C) 1995, 1996, 1997, 1998, 2000, 2004, 2006, 2007, 2008 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -50,6 +50,7 @@ # define O_DIRECTORY 0200000 /* Must be a directory. */ # define O_NOFOLLOW 0400000 /* Do not follow links. */ # define O_NOATIME 01000000 /* Do not set atime. */ +# define O_CLOEXEC 02000000 /* Set close_on_exec. */ #endif /* For now Linux has synchronisity options for data and read operations. @@ -97,9 +98,11 @@ # define F_SETLEASE 1024 /* Set a lease. */ # define F_GETLEASE 1025 /* Enquire what lease is active. */ # define F_NOTIFY 1026 /* Request notfications on a directory. */ +# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with + close-on-exit set. */ #endif -/* For F_[GET|SET]FL. */ +/* For F_[GET|SET]FD. */ #define FD_CLOEXEC 1 /* actually anything with low bit set goes */ /* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */ @@ -185,6 +188,7 @@ #ifdef __USE_GNU +/* Flags for SYNC_FILE_RANGE. */ # define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages in the range before performing the write. */ @@ -194,6 +198,14 @@ # define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in the range after performing the write. */ + +/* Flags for SPLICE and VMSPLICE. */ +# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */ +# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing + (but we may still block on the fd + we splice from/to). */ +# define SPLICE_F_MORE 4 /* Expect more data. */ +# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */ #endif __BEGIN_DECLS @@ -209,20 +221,20 @@ /* Selective file content synch'ing. */ extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, unsigned int __flags); +#endif - /* Splice address range into a pipe. */ -extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count, - unsigned int __flags); +extern ssize_t vmsplice (int __fdout, const struct iovec *__iov, + size_t __count, unsigned int __flags); /* Splice two files together. */ -extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags) - __THROW; +extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout, + __off64_t *__offout, size_t __len, + unsigned int __flags); /* In-kernel implementation of tee for pipe buffers. */ -extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags) - __THROW; -#endif +extern ssize_t tee (int __fdin, int __fdout, size_t __len, + unsigned int __flags); #endif From carmelo at uclibc.org Fri May 2 06:57:02 2008 From: carmelo at uclibc.org (carmelo at uclibc.org) Date: Fri, 2 May 2008 06:57:02 -0700 (PDT) Subject: svn commit: trunk/uClibc: extra/locale extra/locale/programs inclu etc... Message-ID: <20080502135702.87C853C65B@busybox.net> Author: carmelo Date: 2008-05-02 06:57:02 -0700 (Fri, 02 May 2008) New Revision: 21923 Log: Added implementation for 'locale' command. Signed-off-by: Filippo Arcidiacono Added: trunk/uClibc/extra/locale/programs/ trunk/uClibc/extra/locale/programs/categories.def trunk/uClibc/extra/locale/programs/locale.c Modified: trunk/uClibc/include/langinfo.h trunk/uClibc/utils/Makefile.in Changeset: Added: trunk/uClibc/extra/locale/programs/categories.def =================================================================== --- trunk/uClibc/extra/locale/programs/categories.def (rev 0) +++ trunk/uClibc/extra/locale/programs/categories.def 2008-05-02 13:57:02 UTC (rev 21923) @@ -0,0 +1,357 @@ +/* + * + * Copyright (c) 2008 STMicroelectronics Ltd + * Filippo Arcidiacono (filippo.arcidiacono at st.com) + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + * + * Taken from glibc 2.6 + * + */ + + +/* Definition of all available locale categories and their items. -*- C -*- + + These definitions are used by the 'locale' the program. + + The general format of the descriptions is like this: + + DEFINE_CATEGORY (ID, name, ( items ), setlocale-postload) + + where items itself is an array of entries in the form + + { ID, name, standard, value-type, min, max } + + The usage of the load, check, output functions depends on the individual + program code which loads this file. + + The various value types for the items are `string', `stringarray', `byte' + `bytearray', and `word'. These cover all possible values in the current + locale definitions. `min' and `max' can be individually used again. */ + +#ifndef NO_POSTLOAD +#define NO_POSTLOAD NULL +#endif + +#if 0 +DEFINE_CATEGORY +( + LC_COLLATE, "LC_COLLATE", + ( + DEFINE_ELEMENT (_NL_COLLATE_NRULES, "collate-nrules", std, word) + DEFINE_ELEMENT (_NL_COLLATE_RULESETS, "collate-rulesets", std, string) + DEFINE_ELEMENT (_NL_COLLATE_TABLEMB, "collate-tablemb", std, wstring) + DEFINE_ELEMENT (_NL_COLLATE_WEIGHTMB, "collate-weightmb", std, wstring) + DEFINE_ELEMENT (_NL_COLLATE_EXTRAMB, "collate-extramb", std, wstring) + DEFINE_ELEMENT (_NL_COLLATE_INDIRECTMB, "collate-indirectmb", std, wstring) + DEFINE_ELEMENT (_NL_COLLATE_TABLEWC, "collate-tablewc", std, wstring) + DEFINE_ELEMENT (_NL_COLLATE_WEIGHTWC, "collate-weightwc", std, wstring) + DEFINE_ELEMENT (_NL_COLLATE_EXTRAWC, "collate-extrawc", std, wstring) + DEFINE_ELEMENT (_NL_COLLATE_INDIRECTWC, "collate-indirectwc", std, wstring) + DEFINE_ELEMENT (_NL_COLLATE_SYMB_HASH_SIZEMB, "collate-symb-hash-sizemb", std, word) + DEFINE_ELEMENT (_NL_COLLATE_SYMB_TABLEMB, "collate-symb-tablemb", std, wstring) + DEFINE_ELEMENT (_NL_COLLATE_SYMB_EXTRAMB, "collate-symb-extramb", std, wstring) + DEFINE_ELEMENT (_NL_COLLATE_COLLSEQMB, "collate-collseqmb", std, wstring) + DEFINE_ELEMENT (_NL_COLLATE_COLLSEQWC, "collate-collseqwc", std, wstring) + DEFINE_ELEMENT (_NL_COLLATE_CODESET, "collate-codeset", std, string) + ), NO_POSTLOAD) +#endif + + +/* The actual definition of ctype is meaningless here. It is hard coded in + the code because it has to be handled very specially. Only the names of + the functions and the value types are important. */ +DEFINE_CATEGORY +( + LC_CTYPE, "LC_CTYPE", + ( +#if 0 + DEFINE_ELEMENT (_NL_CTYPE_CLASS, "ctype-class", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_TOUPPER, "ctype-toupper", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_TOLOWER, "ctype-tolower", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_CLASS32, "ctype-class32", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_CLASS_NAMES, "ctype-class-names", std, stringlist, 10, 32) + DEFINE_ELEMENT (_NL_CTYPE_MAP_NAMES, "ctype-map-names", std, stringlist, 2, 32) + DEFINE_ELEMENT (_NL_CTYPE_WIDTH, "ctype-width", std, bytearray) + DEFINE_ELEMENT (_NL_CTYPE_MB_CUR_MAX, "ctype-mb-cur-max", std, word) + DEFINE_ELEMENT (_NL_CTYPE_CODESET_NAME, "charmap", std, string) + DEFINE_ELEMENT (_NL_CTYPE_TOUPPER32, "ctype-toupper32", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_TOLOWER32, "ctype-tolower32", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_CLASS_OFFSET, "ctype-class-offset", std, word) + DEFINE_ELEMENT (_NL_CTYPE_MAP_OFFSET, "ctype-map-offset", std, word) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS_MB_LEN, "ctype-indigits_mb-len", std, word) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS0_MB, "ctype-indigits0_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS1_MB, "ctype-indigits1_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS2_MB, "ctype-indigits2_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS3_MB, "ctype-indigits3_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS4_MB, "ctype-indigits4_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS5_MB, "ctype-indigits5_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS6_MB, "ctype-indigits6_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS7_MB, "ctype-indigits7_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS8_MB, "ctype-indigits8_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS9_MB, "ctype-indigits9_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS_WC_LEN, "ctype-indigits_wc-len", std, word) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS0_WC, "ctype-indigits0_wc", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS1_WC, "ctype-indigits1_wc", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS2_WC, "ctype-indigits2_wc", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS3_WC, "ctype-indigits3_wc", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS4_WC, "ctype-indigits4_wc", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS5_WC, "ctype-indigits5_wc", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS6_WC, "ctype-indigits6_wc", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS7_WC, "ctype-indigits7_wc", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS8_WC, "ctype-indigits8_wc", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_INDIGITS9_WC, "ctype-indigits9_wc", std, wstring) +#endif + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT0_MB, "ctype-outdigit0_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT1_MB, "ctype-outdigit1_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT2_MB, "ctype-outdigit2_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT3_MB, "ctype-outdigit3_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT4_MB, "ctype-outdigit4_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT5_MB, "ctype-outdigit5_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT6_MB, "ctype-outdigit6_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT7_MB, "ctype-outdigit7_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT8_MB, "ctype-outdigit8_mb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT9_MB, "ctype-outdigit9_mb", std, string) +#if 0 + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT0_WC, "ctype-outdigit0_wc", std, word) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT1_WC, "ctype-outdigit1_wc", std, word) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT2_WC, "ctype-outdigit2_wc", std, word) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT3_WC, "ctype-outdigit3_wc", std, word) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT4_WC, "ctype-outdigit4_wc", std, word) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT5_WC, "ctype-outdigit5_wc", std, word) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT6_WC, "ctype-outdigit6_wc", std, word) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT7_WC, "ctype-outdigit7_wc", std, word) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT8_WC, "ctype-outdigit8_wc", std, word) + DEFINE_ELEMENT (_NL_CTYPE_OUTDIGIT9_WC, "ctype-outdigit9_wc", std, word) + DEFINE_ELEMENT (_NL_CTYPE_TRANSLIT_TAB_SIZE, "ctype-translit-tab-size", std, word) + DEFINE_ELEMENT (_NL_CTYPE_TRANSLIT_FROM_IDX, "ctype-translit-from-idx", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_TRANSLIT_FROM_TBL, "ctype-translit-from-tbl", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_TRANSLIT_TO_IDX, "ctype-translit-to-idx", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_TRANSLIT_TO_TBL, "ctype-translit-to-tbl", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_TRANSLIT_DEFAULT_MISSING_LEN, "ctype-translit-default-missing-len", std, word) + DEFINE_ELEMENT (_NL_CTYPE_TRANSLIT_DEFAULT_MISSING, "ctype-translit-default-missing", std, wstring) + DEFINE_ELEMENT (_NL_CTYPE_TRANSLIT_IGNORE_LEN, "ctype-translit-ignore-len", std, word) + DEFINE_ELEMENT (_NL_CTYPE_TRANSLIT_IGNORE, "ctype-translit-ignore", std, string) + DEFINE_ELEMENT (_NL_CTYPE_MAP_TO_NONASCII, "map-to-nonascii", std, word) +#endif + ), _nl_postload_ctype) + + +DEFINE_CATEGORY +( + LC_MONETARY, "LC_MONETARY", + ( + DEFINE_ELEMENT (INT_CURR_SYMBOL, "int_curr_symbol", std, string) + DEFINE_ELEMENT (CURRENCY_SYMBOL, "currency_symbol", std, string) + DEFINE_ELEMENT (MON_DECIMAL_POINT, "mon_decimal_point", std, string) + DEFINE_ELEMENT (MON_THOUSANDS_SEP, "mon_thousands_sep", std, string) + DEFINE_ELEMENT (MON_GROUPING, "mon_grouping", std, bytearray) + DEFINE_ELEMENT (POSITIVE_SIGN, "positive_sign", std, string) + DEFINE_ELEMENT (NEGATIVE_SIGN, "negative_sign", std, string) + DEFINE_ELEMENT (INT_FRAC_DIGITS, "int_frac_digits", std, byte) + DEFINE_ELEMENT (FRAC_DIGITS, "frac_digits", std, byte) + DEFINE_ELEMENT (P_CS_PRECEDES, "p_cs_precedes", std, byte, 0, 1) + DEFINE_ELEMENT (P_SEP_BY_SPACE, "p_sep_by_space", std, byte, 0, 2) + DEFINE_ELEMENT (N_CS_PRECEDES, "n_cs_precedes", std, byte, 0, 1) + DEFINE_ELEMENT (N_SEP_BY_SPACE, "n_sep_by_space", std, byte, 0, 2) + DEFINE_ELEMENT (P_SIGN_POSN, "p_sign_posn", std, byte, 0, 4) + DEFINE_ELEMENT (N_SIGN_POSN, "n_sign_posn", std, byte, 0, 4) + DEFINE_ELEMENT (__INT_P_CS_PRECEDES, "int_p_cs_precedes", std, byte, 0, 1) + DEFINE_ELEMENT (__INT_P_SEP_BY_SPACE, "int_p_sep_by_space", std, byte, 0, 2) + DEFINE_ELEMENT (__INT_N_CS_PRECEDES, "int_n_cs_precedes", std, byte, 0, 1) + DEFINE_ELEMENT (__INT_N_SEP_BY_SPACE, "int_n_sep_by_space", std, byte, 0, 2) + DEFINE_ELEMENT (__INT_P_SIGN_POSN, "int_p_sign_posn", std, byte, 0, 4) + DEFINE_ELEMENT (__INT_N_SIGN_POSN, "int_n_sign_posn", std, byte, 0, 4) +#if 0 + DEFINE_ELEMENT (_NL_MONETARY_DUO_INT_CURR_SYMBOL, "duo_int_curr_symbol", std, string) + DEFINE_ELEMENT (_NL_MONETARY_DUO_CURRENCY_SYMBOL, "duo_currency_symbol", std, string) + DEFINE_ELEMENT (_NL_MONETARY_DUO_INT_FRAC_DIGITS, "duo_int_frac_digits", std, byte) + DEFINE_ELEMENT (_NL_MONETARY_DUO_FRAC_DIGITS, "duo_frac_digits", std, byte) + DEFINE_ELEMENT (_NL_MONETARY_DUO_P_CS_PRECEDES, "duo_p_cs_precedes", std, byte, 0, 1) + DEFINE_ELEMENT (_NL_MONETARY_DUO_P_SEP_BY_SPACE, "duo_p_sep_by_space", std, byte, 0, 2) + DEFINE_ELEMENT (_NL_MONETARY_DUO_N_CS_PRECEDES, "duo_n_cs_precedes", std, byte, 0, 1) + DEFINE_ELEMENT (_NL_MONETARY_DUO_N_SEP_BY_SPACE, "duo_n_sep_by_space", std, byte, 0, 2) + DEFINE_ELEMENT (_NL_MONETARY_DUO_INT_P_CS_PRECEDES, "duo_int_p_cs_precedes", std, byte, 0, 1) + DEFINE_ELEMENT (_NL_MONETARY_DUO_INT_P_SEP_BY_SPACE, "duo_int_p_sep_by_space", std, byte, 0, 2) + DEFINE_ELEMENT (_NL_MONETARY_DUO_INT_N_CS_PRECEDES, "duo_int_n_cs_precedes", std, byte, 0, 1) + DEFINE_ELEMENT (_NL_MONETARY_DUO_INT_N_SEP_BY_SPACE, "duo_int_n_sep_by_space", std, byte, 0, 2) + DEFINE_ELEMENT (_NL_MONETARY_DUO_P_SIGN_POSN, "duo_p_sign_posn", std, byte, 0, 4) + DEFINE_ELEMENT (_NL_MONETARY_DUO_N_SIGN_POSN, "duo_n_sign_posn", std, byte, 0, 4) + DEFINE_ELEMENT (_NL_MONETARY_DUO_INT_P_SIGN_POSN, "duo_int_p_sign_posn", std, byte, 0, 4) + DEFINE_ELEMENT (_NL_MONETARY_DUO_INT_N_SIGN_POSN, "duo_int_n_sign_posn", std, byte, 0, 4) + DEFINE_ELEMENT (_NL_MONETARY_UNO_VALID_FROM, "uno_valid_from", std, word) + DEFINE_ELEMENT (_NL_MONETARY_UNO_VALID_TO, "uno_valid_to", std, word) + DEFINE_ELEMENT (_NL_MONETARY_DUO_VALID_FROM, "duo_valid_from", std, word) + DEFINE_ELEMENT (_NL_MONETARY_DUO_VALID_TO, "duo_valid_to", std, word) + DEFINE_ELEMENT (_NL_MONETARY_CONVERSION_RATE, "conversion_rate", std, wordarray, 2, 2) + DEFINE_ELEMENT (_NL_MONETARY_DECIMAL_POINT_WC, "monetary-decimal-point-wc", std, word) + DEFINE_ELEMENT (_NL_MONETARY_THOUSANDS_SEP_WC, "monetary-thousands-sep-wc", std, word) + DEFINE_ELEMENT (_NL_MONETARY_CODESET, "monetary-codeset", std, string) +#else + DEFINE_ELEMENT (_NL_MONETARY_CRNCYSTR, "monetary-crncystr", std, string) +#endif + ), NO_POSTLOAD) + + +DEFINE_CATEGORY +( + LC_NUMERIC, "LC_NUMERIC", + ( + DEFINE_ELEMENT (DECIMAL_POINT, "decimal_point", std, string) + DEFINE_ELEMENT (THOUSANDS_SEP, "thousands_sep", std, string) + DEFINE_ELEMENT (GROUPING, "grouping", std, bytearray) +#if 0 + DEFINE_ELEMENT (_NL_NUMERIC_DECIMAL_POINT_WC, "numeric-decimal-point-wc", std, word) + DEFINE_ELEMENT (_NL_NUMERIC_THOUSANDS_SEP_WC, "numeric-thousands-sep-wc", std, word) + DEFINE_ELEMENT (_NL_NUMERIC_CODESET, "numeric-codeset", std, string) +#endif + + ), NO_POSTLOAD) + + +DEFINE_CATEGORY +( + LC_TIME, "LC_TIME", + ( + DEFINE_ELEMENT (ABDAY_1, "abday", std, stringarray, 7, 7) + DEFINE_ELEMENT (DAY_1, "day", std, stringarray, 7, 7) + DEFINE_ELEMENT (ABMON_1, "abmon", std, stringarray, 12, 12) + DEFINE_ELEMENT (MON_1, "mon", std, stringarray, 12, 12) + DEFINE_ELEMENT (AM_STR, "am_pm", std, stringarray, 2, 2) + DEFINE_ELEMENT (D_T_FMT, "d_t_fmt", std, string) + DEFINE_ELEMENT (D_FMT, "d_fmt", std, string) + DEFINE_ELEMENT (T_FMT, "t_fmt", std, string) + DEFINE_ELEMENT (T_FMT_AMPM, "t_fmt_ampm", std, string) + DEFINE_ELEMENT (ERA, "era", opt, stringlist, 0, 100) + DEFINE_ELEMENT (ERA_YEAR, "era_year", opt, string) + DEFINE_ELEMENT (ERA_D_FMT, "era_d_fmt", opt, string) + DEFINE_ELEMENT (ALT_DIGITS, "alt_digits", opt, stringlist, 100, 100) + DEFINE_ELEMENT (ERA_D_T_FMT, "era_d_t_fmt", opt, string) + DEFINE_ELEMENT (ERA_T_FMT, "era_t_fmt", opt, string) +#if 0 + DEFINE_ELEMENT (_NL_TIME_ERA_NUM_ENTRIES, "time-era-num-entries", opt, word) + DEFINE_ELEMENT (_NL_TIME_ERA_ENTRIES, "time-era-entries", opt, string) + DEFINE_ELEMENT (_NL_WABDAY_1, "wide-abday", std, wstringarray, 7, 7) + DEFINE_ELEMENT (_NL_WDAY_1, "wide-day", std, wstringarray, 7, 7) + DEFINE_ELEMENT (_NL_WABMON_1, "wide-abmon", std, wstringarray, 12, 12) + DEFINE_ELEMENT (_NL_WMON_1, "wide-mon", std, wstringarray, 12, 12) + DEFINE_ELEMENT (_NL_WAM_STR, "wide-am_pm", std, wstringarray, 2, 2) + DEFINE_ELEMENT (_NL_WD_T_FMT, "wide-d_t_fmt", std, wstring) + DEFINE_ELEMENT (_NL_WD_FMT, "wide-d_fmt", std, wstring) + DEFINE_ELEMENT (_NL_WT_FMT, "wide-t_fmt", std, wstring) + DEFINE_ELEMENT (_NL_WT_FMT_AMPM, "wide-t_fmt_ampm", std, wstring) + DEFINE_ELEMENT (_NL_WERA_YEAR, "wide-era_year", opt, wstring) + DEFINE_ELEMENT (_NL_WERA_D_FMT, "wide-era_d_fmt", opt, wstring) + DEFINE_ELEMENT (_NL_WALT_DIGITS, "wide-alt_digits", opt, wstringlist, 1000, 100) + DEFINE_ELEMENT (_NL_WERA_D_T_FMT, "wide-era_d_t_fmt", opt, wstring) + DEFINE_ELEMENT (_NL_WERA_T_FMT, "wide-era_t_fmt", opt, wstring) + DEFINE_ELEMENT (_NL_TIME_WEEK_NDAYS, "week-ndays", std, byte) + DEFINE_ELEMENT (_NL_TIME_WEEK_1STDAY, "week-1stday", std, word) + DEFINE_ELEMENT (_NL_TIME_WEEK_1STWEEK, "week-1stweek", std, byte) + DEFINE_ELEMENT (_NL_TIME_FIRST_WEEKDAY, "first_weekday", std, byte) + DEFINE_ELEMENT (_NL_TIME_FIRST_WORKDAY, "first_workday", std, byte) + DEFINE_ELEMENT (_NL_TIME_CAL_DIRECTION, "cal_direction", std, byte) + DEFINE_ELEMENT (_NL_TIME_TIMEZONE, "timezone", std, string) + DEFINE_ELEMENT (_DATE_FMT, "date_fmt", opt, string) + DEFINE_ELEMENT (_NL_W_DATE_FMT, "wide-date_fmt", opt, wstring) + DEFINE_ELEMENT (_NL_TIME_CODESET, "time-codeset", std, string) +#endif + ), NO_POSTLOAD) + + +DEFINE_CATEGORY +( + LC_MESSAGES, "LC_MESSAGES", + ( + DEFINE_ELEMENT (YESEXPR, "yesexpr", std, string) + DEFINE_ELEMENT (NOEXPR, "noexpr", std, string) + DEFINE_ELEMENT (YESSTR, "yesstr", opt, string) + DEFINE_ELEMENT (NOSTR, "nostr", opt, string) +#if 0 + DEFINE_ELEMENT (_NL_MESSAGES_CODESET, "messages-codeset", std, string) +#endif + ), NO_POSTLOAD) + +#if 0 +DEFINE_CATEGORY +( + LC_PAPER, "LC_PAPER", + ( + DEFINE_ELEMENT (_NL_PAPER_HEIGHT, "height", std, word) + DEFINE_ELEMENT (_NL_PAPER_WIDTH, "width", std, word) + DEFINE_ELEMENT (_NL_PAPER_CODESET, "paper-codeset", std, string) + ), NO_POSTLOAD) + +DEFINE_CATEGORY +( + LC_NAME, "LC_NAME", + ( + DEFINE_ELEMENT (_NL_NAME_NAME_FMT, "name_fmt", std, string) + DEFINE_ELEMENT (_NL_NAME_NAME_GEN, "name_gen", std, string) + DEFINE_ELEMENT (_NL_NAME_NAME_MR, "name_mr", std, string) + DEFINE_ELEMENT (_NL_NAME_NAME_MRS, "name_mrs", std, string) + DEFINE_ELEMENT (_NL_NAME_NAME_MISS, "name_miss", std, string) + DEFINE_ELEMENT (_NL_NAME_NAME_MS, "name_ms", std, string) + DEFINE_ELEMENT (_NL_NAME_CODESET, "name-codeset", std, string) + ), NO_POSTLOAD) + +DEFINE_CATEGORY +( + LC_ADDRESS, "LC_ADDRESS", + ( + DEFINE_ELEMENT (_NL_ADDRESS_POSTAL_FMT, "postal_fmt", std, string) + DEFINE_ELEMENT (_NL_ADDRESS_COUNTRY_NAME, "country_name", std, string) + DEFINE_ELEMENT (_NL_ADDRESS_COUNTRY_POST, "country_post", std, string) + DEFINE_ELEMENT (_NL_ADDRESS_COUNTRY_AB2, "country_ab2", std, string) + DEFINE_ELEMENT (_NL_ADDRESS_COUNTRY_AB3, "country_ab3", std, string) + DEFINE_ELEMENT (_NL_ADDRESS_COUNTRY_CAR, "country_car", std, string) + DEFINE_ELEMENT (_NL_ADDRESS_COUNTRY_NUM, "country_num", std, word) + DEFINE_ELEMENT (_NL_ADDRESS_COUNTRY_ISBN, "country_isbn", std, string) + DEFINE_ELEMENT (_NL_ADDRESS_LANG_NAME, "lang_name", std, string) + DEFINE_ELEMENT (_NL_ADDRESS_LANG_AB, "lang_ab", std, string) + DEFINE_ELEMENT (_NL_ADDRESS_LANG_TERM, "lang_term", std, string) + DEFINE_ELEMENT (_NL_ADDRESS_LANG_LIB, "lang_lib", std, string) + DEFINE_ELEMENT (_NL_ADDRESS_CODESET, "address-codeset", std, string) + ), NO_POSTLOAD) + +DEFINE_CATEGORY +( + LC_TELEPHONE, "LC_TELEPHONE", + ( + DEFINE_ELEMENT (_NL_TELEPHONE_TEL_INT_FMT, "tel_int_fmt", std, string) + DEFINE_ELEMENT (_NL_TELEPHONE_TEL_DOM_FMT, "tel_dom_fmt", std, string) + DEFINE_ELEMENT (_NL_TELEPHONE_INT_SELECT, "int_select", std, string) + DEFINE_ELEMENT (_NL_TELEPHONE_INT_PREFIX, "int_prefix", std, string) + DEFINE_ELEMENT (_NL_TELEPHONE_CODESET, "telephone-codeset", std, string) + ), NO_POSTLOAD) + +DEFINE_CATEGORY +( + LC_MEASUREMENT, "LC_MEASUREMENT", + ( + DEFINE_ELEMENT (_NL_MEASUREMENT_MEASUREMENT, "measurement", std, byte) + DEFINE_ELEMENT (_NL_MEASUREMENT_CODESET, "measurement-codeset", std, string) + ), NO_POSTLOAD) + +DEFINE_CATEGORY +( + LC_IDENTIFICATION, "LC_IDENTIFICATION", + ( + DEFINE_ELEMENT (_NL_IDENTIFICATION_TITLE, "title", std, string) + DEFINE_ELEMENT (_NL_IDENTIFICATION_SOURCE, "source", std, string) + DEFINE_ELEMENT (_NL_IDENTIFICATION_ADDRESS, "address", std, string) + DEFINE_ELEMENT (_NL_IDENTIFICATION_CONTACT, "contact", std, string) + DEFINE_ELEMENT (_NL_IDENTIFICATION_EMAIL, "email", std, string) + DEFINE_ELEMENT (_NL_IDENTIFICATION_TEL, "tel", std, string) + DEFINE_ELEMENT (_NL_IDENTIFICATION_FAX, "fax", std, string) + DEFINE_ELEMENT (_NL_IDENTIFICATION_LANGUAGE, "language", std, string) + DEFINE_ELEMENT (_NL_IDENTIFICATION_TERRITORY, "territory", std, string) + DEFINE_ELEMENT (_NL_IDENTIFICATION_AUDIENCE, "audience", std, string) + DEFINE_ELEMENT (_NL_IDENTIFICATION_APPLICATION, "application", std, string) + DEFINE_ELEMENT (_NL_IDENTIFICATION_ABBREVIATION, "abbreviation", std, string) + DEFINE_ELEMENT (_NL_IDENTIFICATION_REVISION, "revision", std, string) + DEFINE_ELEMENT (_NL_IDENTIFICATION_DATE, "date", std, string) + DEFINE_ELEMENT (_NL_IDENTIFICATION_CATEGORY, "category", std, stringarray, 13, 13) + DEFINE_ELEMENT (_NL_IDENTIFICATION_CODESET, "identification-codeset", std, string) + ), NO_POSTLOAD) +#endif Added: trunk/uClibc/extra/locale/programs/locale.c =================================================================== --- trunk/uClibc/extra/locale/programs/locale.c (rev 0) +++ trunk/uClibc/extra/locale/programs/locale.c 2008-05-02 13:57:02 UTC (rev 21923) @@ -0,0 +1,466 @@ +/* + * + * Copyright (c) 2008 STMicroelectronics Ltd + * Filippo Arcidiacono (filippo.arcidiacono at st.com) + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + * + * A 'locale' command implementation for uClibc. + * + */ + + +#include +#include +#include +#include +#include + +typedef struct { + unsigned char idx_name; + char dot_cs; /* 0 if no codeset specified */ + char cs; + unsigned char lc_ctype_row; + unsigned char lc_numeric_row; + unsigned char lc_monetary_row; + unsigned char lc_time_row; + unsigned char lc_collate_row; + unsigned char lc_messages_row; +} locale_entry; + +/* Need to include this before locale.h and xlocale.h! */ +#include + +#undef CODESET_LIST +#define CODESET_LIST (__locale_mmap->codeset_list) +#include +#define LOCALE_NAMES (__locale_mmap->locale_names5) +#define LOCALES (__locale_mmap->locales) +#define LOCALE_AT_MODIFIERS (__locale_mmap->locale_at_modifiers) +#define CATEGORY_NAMES (__locale_mmap->lc_names) + +#define GET_CODESET_NAME(N) (CODESET_LIST + *(CODESET_LIST + N - 3)) +#define GET_LOCALE_ENTRY(R) (locale_entry *)(LOCALES + (__LOCALE_DATA_WIDTH_LOCALES * R)) +#define GET_CATEGORY_NAME(X) (CATEGORY_NAMES + *(CATEGORY_NAMES + X)) +#define GET_LOCALE_NAME(I) (const char *)(LOCALE_NAMES + 5 * (I - 1)) + +static const char utf8[] = "UTF-8"; +static const char ascii[] = "ASCII"; + +/* If set print the name of the category. */ +static int show_category_name = 0; + +/* If set print the name of the item. */ +static int show_keyword_name = 0; + +/* If set print the usage command. */ +static int show_usage = 0; + +/* Print names of all available locales. */ +static int do_all = 0; + +/* Print names of all available character maps. */ +static int do_charmaps = 0; + +static int remaining = 0; + +/* We can map the types of the entries into a few categories. */ +enum value_type +{ + none, + string, + stringarray, + byte, + bytearray, + word, + stringlist, + wordarray, + wstring, + wstringarray, + wstringlist +}; + +/* Definition of the data structure which represents a category and its + items. */ +struct category +{ + int cat_id; + const char *name; + size_t number; + struct cat_item + { + int item_id; + const char *name; + enum { std, opt } status; + enum value_type value_type; + int min; + int max; + } *item_desc; +}; + +/* Simple helper macro. */ +#define NELEMS(arr) ((sizeof (arr)) / (sizeof (arr[0]))) + +/* For some tricky stuff. */ +#define NO_PAREN(Item, More...) Item, ## More + +/* We have all categories defined in `categories.def'. Now construct + the description and data structure used for all categories. */ +#define DEFINE_ELEMENT(Item, More...) { Item, ## More }, +#define DEFINE_CATEGORY(category, name, items, postload) \ + static struct cat_item category##_desc[] = \ + { \ + NO_PAREN items \ + }; + +#include "categories.def" +#undef DEFINE_CATEGORY + +static struct category category[] = + { +#define DEFINE_CATEGORY(category, name, items, postload) \ + [category] = { _NL_NUM_##category, name, NELEMS (category##_desc), \ + category##_desc }, +#include "categories.def" +#undef DEFINE_CATEGORY + }; +#define NCATEGORIES NELEMS (category) + +static void usage(const char *name); +static void usage(const char *name) +{ + const char *s; + + s = basename(name); + fprintf(stderr, + "Usage: %s [-ck] [--category-name] [--keyword-name] [--help] NAME\n" + "or: %s [OPTION...] [-a|-m] [--all-locales] [--charmaps] \n", s, s); +} + +static int argp_parse(int argc, char *argv[]); +static int argp_parse(int argc, char *argv[]) +{ + static const struct option long_options[] = + { + {"all-locales", no_argument, NULL, 'a'}, + {"charmaps", no_argument, NULL, 'm'}, + {"category-name", no_argument, NULL, 'c'}, + {"keyword-name", no_argument, NULL, 'k'}, + {"help", no_argument, NULL, 'h'}, + {NULL, 0, NULL, 0 } + }; + int c; + char *progname; + + progname = *argv; + while ((c = getopt_long (argc, argv, "amckh", long_options, NULL)) >= 0) + switch (c) + { + case 'a': + do_all = 1; + break; + case 'c': + show_category_name = 1; + break; + case 'm': + do_charmaps = 1; + break; + case 'k': + show_keyword_name = 1; + break; + case 'h': + show_usage = 1; + break; + case '?': + fprintf (stderr, "Unknown option.\n"); + usage(progname); + return 1; + + default: + fprintf (stderr, "This should never happen!\n"); + return 1; + } + + remaining = optind; + + return 0; +} + +static unsigned const char * find_at(char c); +static unsigned const char * find_at(char c) +{ + const unsigned char *q; + + q = LOCALE_AT_MODIFIERS; + do { + if (q[1] == c) { + return (unsigned const char *)q+2; + } + q += 2 + *q; + } while (*q); + + return NULL; +} + +static void find_locale_string(locale_entry *loc_rec, char *loc) +{ + char at = 0; + unsigned char idx; + uint16_t dotcs, cs; + + idx = loc_rec->idx_name; + if (!idx) { + *loc++ = 'C'; /* jump the first locale (C) */ + *loc = '\0'; + } + else { + dotcs = (uint16_t) loc_rec->dot_cs; + cs = (uint16_t) loc_rec->cs;; + loc = strncpy(loc, GET_LOCALE_NAME(idx), 5); + + if (loc[2] == '_') { + sprintf(loc, "%5.5s%c%s\0", loc, (dotcs != 0) ? '.' : ' ', + (cs == 1) ? ascii : ((cs == 2) ? utf8 : GET_CODESET_NAME(cs))); + } else { + at = loc[2]; + loc[2] = '_'; + sprintf(loc, "%5.5s%c%s@%s\0", loc, (dotcs != 0) ? '.' : ' ', + (cs == 1) ? ascii : ((cs == 2) ? utf8 : GET_CODESET_NAME(cs)), + find_at(at)); + } + } +} + +static void list_locale(void); +static void list_locale() +{ + char loc[40]; + uint16_t n = 0; + locale_entry *locales = (locale_entry *)LOCALES; + + do { + find_locale_string(locales, loc); + printf("%s\n", loc); + ++n; + locales++; + } while (n < __LOCALE_DATA_NUM_LOCALES); +} + +static void list_charmaps(void); +static void list_charmaps() +{ + unsigned const char *cl; + + cl = CODESET_LIST; + do { + printf("%s\n", CODESET_LIST + *cl); + } while (*++cl); + +} + +static void print_item (struct cat_item *item); +static void print_item (struct cat_item *item) +{ + switch (item->value_type) + { + case string: + if (show_keyword_name) + printf ("%s=\"", item->name); + fputs (nl_langinfo (item->item_id) ? : "", stdout); + if (show_keyword_name) + putchar ('"'); + putchar ('\n'); + break; + case stringarray: + { + int cnt; + const char *val; + + if (show_keyword_name) + printf ("%s=\"", item->name); + + for (cnt = 0; cnt < item->max - 1; ++cnt) + { + val = nl_langinfo (item->item_id + cnt); + if (val != NULL) + fputs (val, stdout); + putchar (';'); + } + + val = nl_langinfo (item->item_id + cnt); + if (val != NULL) + fputs (val, stdout); + + if (show_keyword_name) + putchar ('"'); + putchar ('\n'); + } + break; + case stringlist: + { + int first = 1; + const char *val = nl_langinfo (item->item_id) ? : ""; + int cnt; + + if (show_keyword_name) + printf ("%s=", item->name); + + for (cnt = 0; cnt < item->max && *val != '\0'; ++cnt) + { + printf ("%s%s%s%s", first ? "" : ";", + show_keyword_name ? "\"" : "", val, + show_keyword_name ? "\"" : ""); + val = strchr (val, '\0') + 1; + first = 0; + } + putchar ('\n'); + } + break; + case byte: + { + const char *val = nl_langinfo (item->item_id); + + if (show_keyword_name) + printf ("%s=", item->name); + + if (val != NULL) + printf ("%d", *val == '\177' ? -1 : *val); + putchar ('\n'); + } + break; + case bytearray: + { + const char *val = nl_langinfo (item->item_id); + int cnt = val ? strlen (val) : 0; + + if (show_keyword_name) + printf ("%s=", item->name); + + while (cnt > 1) + { + printf ("%d;", *val == '\177' ? -1 : *val); + --cnt; + ++val; + } + + printf ("%d\n", cnt == 0 || *val == '\177' ? -1 : *val); + } + break; + case word: + { + union { unsigned int word; char *string; } val; + val.string = nl_langinfo (item->item_id); + if (show_keyword_name) + printf ("%s=", item->name); + + printf ("%d\n", val.word); + } + break; + case wstring: + case wstringarray: + case wstringlist: + /* We don't print wide character information since the same + information is available in a multibyte string. */ + default: + break; + + } +} + +/* Show the information request for NAME. */ +static void show_info(const char *name); +static void show_info(const char *name) +{ + size_t cat_no, item_no; + const unsigned char *cat_name; + + /* Now all categories in an unspecified order. */ + for (cat_no = 0; cat_no < __LC_ALL; ++cat_no) { + cat_name = GET_CATEGORY_NAME(cat_no); + if (strcmp (name, (const char *)cat_name) == 0) { + if (show_category_name) + printf("%s\n", name); + + for (item_no = 0; item_no < category[cat_no].number; ++item_no) + print_item (&category[cat_no].item_desc[item_no]); + + return; + } + + for (item_no = 0; item_no < category[cat_no].number; ++item_no) + if (strcmp (name, category[cat_no].item_desc[item_no].name) == 0) { + if (show_category_name != 0) + puts (category[cat_no].name); + + print_item (&category[cat_no].item_desc[item_no]); + return; + } + } +} + +static void show_locale_vars(void); +static void show_locale_vars() +{ + size_t cat_no; + int row; /* locale row */ + const char *lcall = getenv ("LC_ALL"); + const char *lang = getenv ("LANG") ? : ""; + unsigned char *cur_loc = __global_locale->cur_locale + 1; + char loc_name[40]; + locale_entry *locales; + + /* LANG has to be the first value. */ + printf ("LANG=%s\n", lang); + + /* Now all categories in an unspecified order. */ + for (cat_no = 0; cat_no < __LC_ALL; ++cat_no) { + row = (((int)(*cur_loc & 0x7f)) << 7) + (cur_loc[1] & 0x7f); +/* assert(row < __LOCALE_DATA_NUM_LOCALES); */ + + locales = GET_LOCALE_ENTRY(row); + find_locale_string(locales, loc_name); + printf("%s=%s\n", GET_CATEGORY_NAME(cat_no), loc_name); + + cur_loc += 2; + } + + /* The last is the LC_ALL value. */ + printf ("LC_ALL=%s\n", lcall ? : ""); +} + +int +main (int argc, char *argv[]) +{ + /* Parse and process arguments. */ + if (argp_parse(argc, argv)) + return 1; + + if (do_all) { + list_locale(); + exit (EXIT_SUCCESS); + } + + if (do_charmaps) { + list_charmaps(); + exit (EXIT_SUCCESS); + } + + if (show_usage) { + usage(*argv); + exit (EXIT_SUCCESS); + } + + /* If no real argument is given we have to print the contents of the + current locale definition variables. These are LANG and the LC_*. */ + if (remaining == argc && show_category_name == 0 && show_keyword_name == 0) { + show_locale_vars (); + exit (EXIT_SUCCESS); + } + + /* Process all given names. */ + while (remaining < argc) + show_info (argv[remaining++]); + + exit (EXIT_SUCCESS); + +} Modified: trunk/uClibc/include/langinfo.h =================================================================== --- trunk/uClibc/include/langinfo.h 2008-05-02 13:26:18 UTC (rev 21922) +++ trunk/uClibc/include/langinfo.h 2008-05-02 13:57:02 UTC (rev 21923) @@ -354,7 +354,6 @@ _NL_CTYPE_EXTRA_MAP_12, _NL_CTYPE_EXTRA_MAP_13, _NL_CTYPE_EXTRA_MAP_14, - _NL_NUM_LC_CTYPE, #else /* 0 */ _NL_CTYPE_OUTDIGIT0_MB = _NL_ITEM (__LC_CTYPE, 0), _NL_CTYPE_OUTDIGIT1_MB, @@ -370,6 +369,7 @@ CODESET = _NL_CTYPE_CODESET_NAME, #define CODESET CODESET #endif /* 0 */ + _NL_NUM_LC_CTYPE, /* LC_MONETARY category: formatting of monetary quantities. These items each correspond to a member of `struct lconv', Modified: trunk/uClibc/utils/Makefile.in =================================================================== --- trunk/uClibc/utils/Makefile.in 2008-05-02 13:26:18 UTC (rev 21922) +++ trunk/uClibc/utils/Makefile.in 2008-05-02 13:57:02 UTC (rev 21923) @@ -25,6 +25,8 @@ CFLAGS-readelf := $(CFLAGS-utils-shared) +CFLAGS-locale := $(CFLAGS-utils) + BUILD_CFLAGS-utils := -include $(top_srcdir)include/elf.h BUILD_CFLAGS-utils-common := $(CFLAGS-utils-common) @@ -51,15 +53,17 @@ endif utils_ICONV_OBJ = +utils_LOCALE_OBJ = ifeq ($(UCLIBC_HAS_LOCALE),y) utils_ICONV_OBJ := $(utils_OUT)/iconv +utils_LOCALE_OBJ := $(utils_OUT)/locale endif utils_OBJ := $(patsubst %,$(utils_OUT)/%,$(utils_OBJ)) hostutils_OBJ := $(patsubst %,%.host,$(utils_OBJ)) -utils: $(utils_OBJ) $(utils_ICONV_OBJ) +utils: $(utils_OBJ) $(utils_ICONV_OBJ) $(utils_LOCALE_OBJ) # NOTE: We build the utils AFTER we have a uClibc-targeted toolchain. @@ -69,6 +73,9 @@ $(utils_OUT)/iconv: $(top_srcdir)libc/misc/wchar/wchar.c | $(libc) $(compile.u) +$(utils_OUT)/locale: $(top_srcdir)extra/locale/programs/locale.c | $(libc) + $(compile.u) + hostutils: $(hostutils_OBJ) $(hostutils_OBJ): $(utils_OUT)/%.host : $(utils_DIR)/%.c @@ -86,9 +93,10 @@ endif ifeq ($(UCLIBC_HAS_LOCALE),y) $(INSTALL) -m 755 $(utils_OUT)/iconv $(PREFIX)$(RUNTIME_PREFIX)usr/bin/iconv + $(INSTALL) -m 755 $(utils_OUT)/locale $(PREFIX)$(RUNTIME_PREFIX)usr/bin/locale endif objclean-y += utils_clean utils_clean: - $(RM) $(utils_OUT)/{ldconfig,ldd,readelf,iconv,*.host} + $(RM) $(utils_OUT)/{ldconfig,ldd,readelf,iconv,locale,*.host} From aldot at uclibc.org Fri May 2 13:31:57 2008 From: aldot at uclibc.org (aldot at uclibc.org) Date: Fri, 2 May 2008 13:31:57 -0700 (PDT) Subject: svn commit: trunk/uClibc/extra/locale/programs Message-ID: <20080502203157.AAC9D3C65A@busybox.net> Author: aldot Date: 2008-05-02 13:31:57 -0700 (Fri, 02 May 2008) New Revision: 21924 Log: - indent Modified: trunk/uClibc/extra/locale/programs/locale.c Changeset: Modified: trunk/uClibc/extra/locale/programs/locale.c =================================================================== --- trunk/uClibc/extra/locale/programs/locale.c 2008-05-02 13:57:02 UTC (rev 21923) +++ trunk/uClibc/extra/locale/programs/locale.c 2008-05-02 20:31:57 UTC (rev 21924) @@ -18,7 +18,7 @@ typedef struct { unsigned char idx_name; - char dot_cs; /* 0 if no codeset specified */ + char dot_cs; /* 0 if no codeset specified */ char cs; unsigned char lc_ctype_row; unsigned char lc_numeric_row; @@ -36,7 +36,7 @@ #include #define LOCALE_NAMES (__locale_mmap->locale_names5) #define LOCALES (__locale_mmap->locales) -#define LOCALE_AT_MODIFIERS (__locale_mmap->locale_at_modifiers) +#define LOCALE_AT_MODIFIERS (__locale_mmap->locale_at_modifiers) #define CATEGORY_NAMES (__locale_mmap->lc_names) #define GET_CODESET_NAME(N) (CODESET_LIST + *(CODESET_LIST + N - 3)) @@ -65,37 +65,34 @@ static int remaining = 0; /* We can map the types of the entries into a few categories. */ -enum value_type -{ - none, - string, - stringarray, - byte, - bytearray, - word, - stringlist, - wordarray, - wstring, - wstringarray, - wstringlist +enum value_type { + none, + string, + stringarray, + byte, + bytearray, + word, + stringlist, + wordarray, + wstring, + wstringarray, + wstringlist }; /* Definition of the data structure which represents a category and its items. */ -struct category -{ - int cat_id; - const char *name; - size_t number; - struct cat_item - { - int item_id; - const char *name; - enum { std, opt } status; - enum value_type value_type; - int min; - int max; - } *item_desc; +struct category { + int cat_id; + const char *name; + size_t number; + struct cat_item { + int item_id; + const char *name; + enum { std, opt } status; + enum value_type value_type; + int min; + int max; + } *item_desc; }; /* Simple helper macro. */ @@ -116,14 +113,14 @@ #include "categories.def" #undef DEFINE_CATEGORY -static struct category category[] = - { +static struct category category[] = { #define DEFINE_CATEGORY(category, name, items, postload) \ [category] = { _NL_NUM_##category, name, NELEMS (category##_desc), \ category##_desc }, #include "categories.def" #undef DEFINE_CATEGORY - }; +}; + #define NCATEGORIES NELEMS (category) static void usage(const char *name); @@ -134,51 +131,50 @@ s = basename(name); fprintf(stderr, "Usage: %s [-ck] [--category-name] [--keyword-name] [--help] NAME\n" - "or: %s [OPTION...] [-a|-m] [--all-locales] [--charmaps] \n", s, s); + "or: %s [OPTION...] [-a|-m] [--all-locales] [--charmaps] \n", s, + s); } static int argp_parse(int argc, char *argv[]); static int argp_parse(int argc, char *argv[]) { - static const struct option long_options[] = - { - {"all-locales", no_argument, NULL, 'a'}, - {"charmaps", no_argument, NULL, 'm'}, + static const struct option long_options[] = { + {"all-locales", no_argument, NULL, 'a'}, + {"charmaps", no_argument, NULL, 'm'}, {"category-name", no_argument, NULL, 'c'}, - {"keyword-name", no_argument, NULL, 'k'}, - {"help", no_argument, NULL, 'h'}, - {NULL, 0, NULL, 0 } + {"keyword-name", no_argument, NULL, 'k'}, + {"help", no_argument, NULL, 'h'}, + {NULL, 0, NULL, 0} }; int c; - char *progname; + char *progname; - progname = *argv; - while ((c = getopt_long (argc, argv, "amckh", long_options, NULL)) >= 0) - switch (c) - { - case 'a': - do_all = 1; - break; - case 'c': - show_category_name = 1; - break; - case 'm': - do_charmaps = 1; - break; - case 'k': - show_keyword_name = 1; - break; - case 'h': - show_usage = 1; - break; - case '?': - fprintf (stderr, "Unknown option.\n"); - usage(progname); - return 1; - - default: - fprintf (stderr, "This should never happen!\n"); - return 1; + progname = *argv; + while ((c = getopt_long(argc, argv, "amckh", long_options, NULL)) >= 0) + switch (c) { + case 'a': + do_all = 1; + break; + case 'c': + show_category_name = 1; + break; + case 'm': + do_charmaps = 1; + break; + case 'k': + show_keyword_name = 1; + break; + case 'h': + show_usage = 1; + break; + case '?': + fprintf(stderr, "Unknown option.\n"); + usage(progname); + return 1; + + default: + fprintf(stderr, "This should never happen!\n"); + return 1; } remaining = optind; @@ -186,15 +182,15 @@ return 0; } -static unsigned const char * find_at(char c); -static unsigned const char * find_at(char c) +static unsigned const char *find_at(char c); +static unsigned const char *find_at(char c) { const unsigned char *q; q = LOCALE_AT_MODIFIERS; do { if (q[1] == c) { - return (unsigned const char *)q+2; + return (unsigned const char *) q + 2; } q += 2 + *q; } while (*q); @@ -202,31 +198,32 @@ return NULL; } -static void find_locale_string(locale_entry *loc_rec, char *loc) +static void find_locale_string(locale_entry * loc_rec, char *loc) { char at = 0; unsigned char idx; uint16_t dotcs, cs; - + idx = loc_rec->idx_name; if (!idx) { - *loc++ = 'C'; /* jump the first locale (C) */ + *loc++ = 'C'; /* jump the first locale (C) */ *loc = '\0'; - } - else { + } else { dotcs = (uint16_t) loc_rec->dot_cs; cs = (uint16_t) loc_rec->cs;; loc = strncpy(loc, GET_LOCALE_NAME(idx), 5); if (loc[2] == '_') { - sprintf(loc, "%5.5s%c%s\0", loc, (dotcs != 0) ? '.' : ' ', - (cs == 1) ? ascii : ((cs == 2) ? utf8 : GET_CODESET_NAME(cs))); + sprintf(loc, "%5.5s%c%s\0", loc, (dotcs != 0) ? '.' : ' ', + (cs == + 1) ? ascii : ((cs == 2) ? utf8 : GET_CODESET_NAME(cs))); } else { at = loc[2]; loc[2] = '_'; - sprintf(loc, "%5.5s%c%s@%s\0", loc, (dotcs != 0) ? '.' : ' ', - (cs == 1) ? ascii : ((cs == 2) ? utf8 : GET_CODESET_NAME(cs)), - find_at(at)); + sprintf(loc, "%5.5s%c%s@%s\0", loc, (dotcs != 0) ? '.' : ' ', + (cs == + 1) ? ascii : ((cs == 2) ? utf8 : GET_CODESET_NAME(cs)), + find_at(at)); } } } @@ -236,7 +233,7 @@ { char loc[40]; uint16_t n = 0; - locale_entry *locales = (locale_entry *)LOCALES; + locale_entry *locales = (locale_entry *) LOCALES; do { find_locale_string(locales, loc); @@ -250,123 +247,123 @@ static void list_charmaps() { unsigned const char *cl; - + cl = CODESET_LIST; do { printf("%s\n", CODESET_LIST + *cl); } while (*++cl); - + } -static void print_item (struct cat_item *item); -static void print_item (struct cat_item *item) +static void print_item(struct cat_item *item); +static void print_item(struct cat_item *item) { - switch (item->value_type) - { + switch (item->value_type) { case string: - if (show_keyword_name) - printf ("%s=\"", item->name); - fputs (nl_langinfo (item->item_id) ? : "", stdout); - if (show_keyword_name) - putchar ('"'); - putchar ('\n'); - break; + if (show_keyword_name) + printf("%s=\"", item->name); + fputs(nl_langinfo(item->item_id) ? : "", stdout); + if (show_keyword_name) + putchar('"'); + putchar('\n'); + break; case stringarray: { int cnt; const char *val; if (show_keyword_name) - printf ("%s=\"", item->name); + printf("%s=\"", item->name); - for (cnt = 0; cnt < item->max - 1; ++cnt) - { - val = nl_langinfo (item->item_id + cnt); + for (cnt = 0; cnt < item->max - 1; ++cnt) { + val = nl_langinfo(item->item_id + cnt); if (val != NULL) - fputs (val, stdout); - putchar (';'); + fputs(val, stdout); + putchar(';'); } - val = nl_langinfo (item->item_id + cnt); + val = nl_langinfo(item->item_id + cnt); if (val != NULL) - fputs (val, stdout); + fputs(val, stdout); if (show_keyword_name) - putchar ('"'); - putchar ('\n'); + putchar('"'); + putchar('\n'); } - break; + break; case stringlist: { int first = 1; - const char *val = nl_langinfo (item->item_id) ? : ""; + const char *val = nl_langinfo(item->item_id) ? : ""; int cnt; if (show_keyword_name) - printf ("%s=", item->name); + printf("%s=", item->name); - for (cnt = 0; cnt < item->max && *val != '\0'; ++cnt) - { - printf ("%s%s%s%s", first ? "" : ";", - show_keyword_name ? "\"" : "", val, - show_keyword_name ? "\"" : ""); - val = strchr (val, '\0') + 1; + for (cnt = 0; cnt < item->max && *val != '\0'; ++cnt) { + printf("%s%s%s%s", first ? "" : ";", + show_keyword_name ? "\"" : "", val, + show_keyword_name ? "\"" : ""); + val = strchr(val, '\0') + 1; first = 0; } - putchar ('\n'); + putchar('\n'); } - break; + break; case byte: { - const char *val = nl_langinfo (item->item_id); + const char *val = nl_langinfo(item->item_id); if (show_keyword_name) - printf ("%s=", item->name); + printf("%s=", item->name); if (val != NULL) - printf ("%d", *val == '\177' ? -1 : *val); - putchar ('\n'); + printf("%d", *val == '\177' ? -1 : *val); + putchar('\n'); } - break; + break; case bytearray: { - const char *val = nl_langinfo (item->item_id); - int cnt = val ? strlen (val) : 0; + const char *val = nl_langinfo(item->item_id); + int cnt = val ? strlen(val) : 0; if (show_keyword_name) - printf ("%s=", item->name); + printf("%s=", item->name); - while (cnt > 1) - { - printf ("%d;", *val == '\177' ? -1 : *val); + while (cnt > 1) { + printf("%d;", *val == '\177' ? -1 : *val); --cnt; ++val; } - printf ("%d\n", cnt == 0 || *val == '\177' ? -1 : *val); + printf("%d\n", cnt == 0 || *val == '\177' ? -1 : *val); } - break; + break; case word: { - union { unsigned int word; char *string; } val; - val.string = nl_langinfo (item->item_id); + union { + unsigned int word; + char *string; + } val; + + val.string = nl_langinfo(item->item_id); if (show_keyword_name) - printf ("%s=", item->name); + printf("%s=", item->name); - printf ("%d\n", val.word); + printf("%d\n", val.word); } - break; + break; case wstring: case wstringarray: case wstringlist: - /* We don't print wide character information since the same - information is available in a multibyte string. */ + /* We don't print wide character information since the same + information is available in a multibyte string. */ default: - break; + break; } } - + /* Show the information request for NAME. */ static void show_info(const char *name); static void show_info(const char *name) @@ -377,22 +374,22 @@ /* Now all categories in an unspecified order. */ for (cat_no = 0; cat_no < __LC_ALL; ++cat_no) { cat_name = GET_CATEGORY_NAME(cat_no); - if (strcmp (name, (const char *)cat_name) == 0) { + if (strcmp(name, (const char *) cat_name) == 0) { if (show_category_name) printf("%s\n", name); - + for (item_no = 0; item_no < category[cat_no].number; ++item_no) - print_item (&category[cat_no].item_desc[item_no]); + print_item(&category[cat_no].item_desc[item_no]); return; } - + for (item_no = 0; item_no < category[cat_no].number; ++item_no) - if (strcmp (name, category[cat_no].item_desc[item_no].name) == 0) { + if (strcmp(name, category[cat_no].item_desc[item_no].name) == 0) { if (show_category_name != 0) - puts (category[cat_no].name); - - print_item (&category[cat_no].item_desc[item_no]); + puts(category[cat_no].name); + + print_item(&category[cat_no].item_desc[item_no]); return; } } @@ -402,65 +399,64 @@ static void show_locale_vars() { size_t cat_no; - int row; /* locale row */ - const char *lcall = getenv ("LC_ALL"); - const char *lang = getenv ("LANG") ? : ""; + int row; /* locale row */ + const char *lcall = getenv("LC_ALL"); + const char *lang = getenv("LANG") ? : ""; unsigned char *cur_loc = __global_locale->cur_locale + 1; char loc_name[40]; locale_entry *locales; /* LANG has to be the first value. */ - printf ("LANG=%s\n", lang); + printf("LANG=%s\n", lang); /* Now all categories in an unspecified order. */ for (cat_no = 0; cat_no < __LC_ALL; ++cat_no) { - row = (((int)(*cur_loc & 0x7f)) << 7) + (cur_loc[1] & 0x7f); + row = (((int) (*cur_loc & 0x7f)) << 7) + (cur_loc[1] & 0x7f); /* assert(row < __LOCALE_DATA_NUM_LOCALES); */ locales = GET_LOCALE_ENTRY(row); find_locale_string(locales, loc_name); printf("%s=%s\n", GET_CATEGORY_NAME(cat_no), loc_name); - + cur_loc += 2; } /* The last is the LC_ALL value. */ - printf ("LC_ALL=%s\n", lcall ? : ""); + printf("LC_ALL=%s\n", lcall ? : ""); } -int -main (int argc, char *argv[]) +int main(int argc, char *argv[]) { - /* Parse and process arguments. */ + /* Parse and process arguments. */ if (argp_parse(argc, argv)) return 1; - + if (do_all) { list_locale(); - exit (EXIT_SUCCESS); - } - + exit(EXIT_SUCCESS); + } + if (do_charmaps) { list_charmaps(); - exit (EXIT_SUCCESS); - } - + exit(EXIT_SUCCESS); + } + if (show_usage) { usage(*argv); - exit (EXIT_SUCCESS); - } + exit(EXIT_SUCCESS); + } - /* If no real argument is given we have to print the contents of the - current locale definition variables. These are LANG and the LC_*. */ - if (remaining == argc && show_category_name == 0 && show_keyword_name == 0) { - show_locale_vars (); - exit (EXIT_SUCCESS); - } + /* If no real argument is given we have to print the contents of the + current locale definition variables. These are LANG and the LC_*. */ + if (remaining == argc && show_category_name == 0 + && show_keyword_name == 0) { + show_locale_vars(); + exit(EXIT_SUCCESS); + } - /* Process all given names. */ - while (remaining < argc) - show_info (argv[remaining++]); + /* Process all given names. */ + while (remaining < argc) + show_info(argv[remaining++]); - exit (EXIT_SUCCESS); - + exit(EXIT_SUCCESS); } From kraj at uclibc.org Fri May 2 22:44:31 2008 From: kraj at uclibc.org (kraj at uclibc.org) Date: Fri, 2 May 2008 22:44:31 -0700 (PDT) Subject: svn commit: trunk/uClibc/libc/sysdeps/linux/arm/bits Message-ID: <20080503054431.476F43C642@busybox.net> Author: kraj Date: 2008-05-02 22:44:30 -0700 (Fri, 02 May 2008) New Revision: 21926 Log: Wire up vmsplice, splice and tee for arm. Modified: trunk/uClibc/libc/sysdeps/linux/arm/bits/fcntl.h Changeset: Modified: trunk/uClibc/libc/sysdeps/linux/arm/bits/fcntl.h =================================================================== --- trunk/uClibc/libc/sysdeps/linux/arm/bits/fcntl.h 2008-05-02 21:46:30 UTC (rev 21925) +++ trunk/uClibc/libc/sysdeps/linux/arm/bits/fcntl.h 2008-05-03 05:44:30 UTC (rev 21926) @@ -1,5 +1,6 @@ /* O_*, F_*, FD_* bit values for Linux. - Copyright (C) 1995-1998, 2000, 2004, 2006 Free Software Foundation, Inc. + Copyright (C) 1995-1998, 2000, 2004, 2006, 2007, 2008 + 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 @@ -49,6 +50,7 @@ # define O_NOFOLLOW 0100000 /* Do not follow links. */ # define O_DIRECT 0200000 /* Direct disk access. */ # define O_NOATIME 01000000 /* Do not set atime. */ +# define O_CLOEXEC 02000000 /* Set close_on_exec. */ #endif /* For now Linux has synchronisity options for data and read operations. @@ -96,9 +98,11 @@ # define F_SETLEASE 1024 /* Set a lease. */ # define F_GETLEASE 1025 /* Enquire what lease is active. */ # define F_NOTIFY 1026 /* Request notfications on a directory. */ +# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with + close-on-exit set. */ #endif -/* For F_[GET|SET]FL. */ +/* For F_[GET|SET]FD. */ #define FD_CLOEXEC 1 /* actually anything with low bit set goes */ /* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */ @@ -212,25 +216,24 @@ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) __THROW; - #if 0 /* Selective file content synch'ing. */ extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, unsigned int __flags); +#endif - /* Splice address range into a pipe. */ -extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count, - unsigned int __flags); +extern ssize_t vmsplice (int __fdout, const struct iovec *__iov, + size_t __count, unsigned int __flags); /* Splice two files together. */ -extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags) - __THROW; +extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout, + __off64_t *__offout, size_t __len, + unsigned int __flags); /* In-kernel implementation of tee for pipe buffers. */ -extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags) - __THROW; -#endif +extern ssize_t tee (int __fdin, int __fdout, size_t __len, + unsigned int __flags); #endif From aldot at uclibc.org Sat May 3 05:49:10 2008 From: aldot at uclibc.org (aldot at uclibc.org) Date: Sat, 3 May 2008 05:49:10 -0700 (PDT) Subject: svn commit: trunk/uClibc/libc/sysdeps/linux: alpha/bits arm/bits bfin/bits cris/bits etc... Message-ID: <20080503124910.C82B63C708@busybox.net> Author: aldot Date: 2008-05-03 05:49:10 -0700 (Sat, 03 May 2008) New Revision: 21929 Log: - implement splice,vmsplice,tee for all arches - synch F_LINUX_SPECIFIC_BASE related fcntls for all arches Modified: trunk/uClibc/libc/sysdeps/linux/alpha/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/arm/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/bfin/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/cris/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/e1/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/frv/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/h8300/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/hppa/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/i386/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/i960/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/ia64/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/m68k/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/microblaze/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/mips/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/nios/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/nios2/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/powerpc/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/sh/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/sh64/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/sparc/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/v850/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/vax/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/x86_64/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/xtensa/bits/fcntl.h Changeset: Sorry, the patch is too large to include (1821 lines). Please use ViewCVS to see it! http://uclibc.org/cgi-bin/viewcvs.cgi?view=rev&root=svn&rev=21929 From aldot at uclibc.org Sat May 3 06:59:12 2008 From: aldot at uclibc.org (aldot at uclibc.org) Date: Sat, 3 May 2008 06:59:12 -0700 (PDT) Subject: svn commit: trunk/uClibc/libpthread/linuxthreads.old/sysdeps/i386 Message-ID: <20080503135912.60B4D3C721@busybox.net> Author: aldot Date: 2008-05-03 06:59:11 -0700 (Sat, 03 May 2008) New Revision: 21930 Log: - cleanup by manually expanding the helpers. Saves several 100 bytes Modified: trunk/uClibc/libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h Changeset: Modified: trunk/uClibc/libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h =================================================================== --- trunk/uClibc/libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h 2008-05-03 12:49:10 UTC (rev 21929) +++ trunk/uClibc/libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h 2008-05-03 13:59:11 UTC (rev 21930) @@ -26,13 +26,11 @@ #ifndef __ASSEMBLER__ #ifndef PT_EI -# define PT_EI __extern_always_inline +# define PT_EI __extern_always_inline __attribute__((visibility("hidden"))) #endif -/* extern long int testandset (int *spinlock); extern int __compare_and_swap (long int *p, long int oldval, long int newval); -*/ /* Get some notion of the current stack. Need not be exactly the top of the stack, just something somewhere in the current frame. */ @@ -85,8 +83,8 @@ #else /* Generic i386 implementation */ +extern int compare_and_swap_is_available (void); - /* Spinlock implementation; required. */ PT_EI long int testandset (int *spinlock) @@ -123,8 +121,8 @@ return ret; } - -PT_EI int +#if 00 +static __always_inline int get_eflags (void) { int res; @@ -132,25 +130,28 @@ return res; } - -PT_EI void +static __always_inline void set_eflags (int newflags) { __asm__ __volatile__ ("pushl %0; popfl" : : "r" (newflags) : "cc"); } +#endif - PT_EI int compare_and_swap_is_available (void) { - int oldflags = get_eflags (); int changed; + int oldflags; + /* get EFLAGS */ + __asm__ __volatile__ ("pushfl; popl %0" : "=r" (oldflags) : ); /* Flip AC bit in EFLAGS. */ - set_eflags (oldflags ^ 0x40000); + __asm__ __volatile__ ("pushl %0; popfl" : : "r" (oldflags ^ 0x40000) : "cc"); + /* reread EFLAGS */ + __asm__ __volatile__ ("pushfl; popl %0" : "=r" (changed) : ); /* See if bit changed. */ - changed = (get_eflags () ^ oldflags) & 0x40000; + changed = (changed ^ oldflags) & 0x40000; /* Restore EFLAGS. */ - set_eflags (oldflags); + __asm__ __volatile__ ("pushl %0; popfl" : : "r" (oldflags) : "cc"); /* If the AC flag did not change, it's a 386 and it lacks cmpxchg. Otherwise, it's a 486 or above and it has cmpxchg. */ return changed != 0; From aldot at uclibc.org Sat May 3 08:27:11 2008 From: aldot at uclibc.org (aldot at uclibc.org) Date: Sat, 3 May 2008 08:27:11 -0700 (PDT) Subject: svn commit: trunk/uClibc/libc/sysdeps/linux: alpha/bits arm/bits bfin/bits cris/bits etc... Message-ID: <20080503152711.4EF043C635@busybox.net> Author: aldot Date: 2008-05-03 08:27:10 -0700 (Sat, 03 May 2008) New Revision: 21931 Log: - add missing #endif Modified: trunk/uClibc/libc/sysdeps/linux/alpha/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/arm/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/bfin/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/cris/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/e1/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/frv/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/h8300/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/hppa/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/i386/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/i960/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/ia64/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/m68k/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/microblaze/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/mips/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/nios/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/nios2/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/powerpc/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/sh/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/sh64/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/sparc/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/v850/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/vax/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/x86_64/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/xtensa/bits/fcntl.h Changeset: Modified: trunk/uClibc/libc/sysdeps/linux/alpha/bits/fcntl.h =================================================================== --- trunk/uClibc/libc/sysdeps/linux/alpha/bits/fcntl.h 2008-05-03 13:59:11 UTC (rev 21930) +++ trunk/uClibc/libc/sysdeps/linux/alpha/bits/fcntl.h 2008-05-03 15:27:10 UTC (rev 21931) @@ -232,5 +232,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len, unsigned int __flags); +#endif __END_DECLS Modified: trunk/uClibc/libc/sysdeps/linux/arm/bits/fcntl.h =================================================================== --- trunk/uClibc/libc/sysdeps/linux/arm/bits/fcntl.h 2008-05-03 13:59:11 UTC (rev 21930) +++ trunk/uClibc/libc/sysdeps/linux/arm/bits/fcntl.h 2008-05-03 15:27:10 UTC (rev 21931) @@ -239,5 +239,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len, unsigned int __flags); +#endif __END_DECLS Modified: trunk/uClibc/libc/sysdeps/linux/bfin/bits/fcntl.h =================================================================== --- trunk/uClibc/libc/sysdeps/linux/bfin/bits/fcntl.h 2008-05-03 13:59:11 UTC (rev 21930) +++ trunk/uClibc/libc/sysdeps/linux/bfin/bits/fcntl.h 2008-05-03 15:27:10 UTC (rev 21931) @@ -236,5 +236,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len, unsigned int __flags); +#endif __END_DECLS Modified: trunk/uClibc/libc/sysdeps/linux/cris/bits/fcntl.h =================================================================== --- trunk/uClibc/libc/sysdeps/linux/cris/bits/fcntl.h 2008-05-03 13:59:11 UTC (rev 21930) +++ trunk/uClibc/libc/sysdeps/linux/cris/bits/fcntl.h 2008-05-03 15:27:10 UTC (rev 21931) @@ -237,5 +237,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len, unsigned int __flags); +#endif __END_DECLS Modified: trunk/uClibc/libc/sysdeps/linux/e1/bits/fcntl.h =================================================================== --- trunk/uClibc/libc/sysdeps/linux/e1/bits/fcntl.h 2008-05-03 13:59:11 UTC (rev 21930) +++ trunk/uClibc/libc/sysdeps/linux/e1/bits/fcntl.h 2008-05-03 15:27:10 UTC (rev 21931) @@ -233,5 +233,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len, unsigned int __flags); +#endif __END_DECLS Modified: trunk/uClibc/libc/sysdeps/linux/frv/bits/fcntl.h =================================================================== --- trunk/uClibc/libc/sysdeps/linux/frv/bits/fcntl.h 2008-05-03 13:59:11 UTC (rev 21930) +++ trunk/uClibc/libc/sysdeps/linux/frv/bits/fcntl.h 2008-05-03 15:27:10 UTC (rev 21931) @@ -215,5 +215,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len, unsigned int __flags); +#endif __END_DECLS Modified: trunk/uClibc/libc/sysdeps/linux/h8300/bits/fcntl.h =================================================================== --- trunk/uClibc/libc/sysdeps/linux/h8300/bits/fcntl.h 2008-05-03 13:59:11 UTC (rev 21930) +++ trunk/uClibc/libc/sysdeps/linux/h8300/bits/fcntl.h 2008-05-03 15:27:10 UTC (rev 21931) @@ -233,5 +233,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len, unsigned int __flags); +#endif __END_DECLS Modified: trunk/uClibc/libc/sysdeps/linux/hppa/bits/fcntl.h =================================================================== --- trunk/uClibc/libc/sysdeps/linux/hppa/bits/fcntl.h 2008-05-03 13:59:11 UTC (rev 21930) +++ trunk/uClibc/libc/sysdeps/linux/hppa/bits/fcntl.h 2008-05-03 15:27:10 UTC (rev 21931) @@ -227,5 +227,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len, unsigned int __flags); +#endif __END_DECLS Modified: trunk/uClibc/libc/sysdeps/linux/i386/bits/fcntl.h =================================================================== --- trunk/uClibc/libc/sysdeps/linux/i386/bits/fcntl.h 2008-05-03 13:59:11 UTC (rev 21930) +++ trunk/uClibc/libc/sysdeps/linux/i386/bits/fcntl.h 2008-05-03 15:27:10 UTC (rev 21931) @@ -241,6 +241,5 @@ unsigned int __flags); #endif - __END_DECLS Modified: trunk/uClibc/libc/sysdeps/linux/i960/bits/fcntl.h =================================================================== --- trunk/uClibc/libc/sysdeps/linux/i960/bits/fcntl.h 2008-05-03 13:59:11 UTC (rev 21930) +++ trunk/uClibc/libc/sysdeps/linux/i960/bits/fcntl.h 2008-05-03 15:27:10 UTC (rev 21931) @@ -233,5 +233,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len, unsigned int __flags); +#endif __END_DECLS Modified: trunk/uClibc/libc/sysdeps/linux/ia64/bits/fcntl.h =================================================================== --- trunk/uClibc/libc/sysdeps/linux/ia64/bits/fcntl.h 2008-05-03 13:59:11 UTC (rev 21930) +++ trunk/uClibc/libc/sysdeps/linux/ia64/bits/fcntl.h 2008-05-03 15:27:10 UTC (rev 21931) @@ -234,5 +234,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len, unsigned int __flags); +#endif __END_DECLS Modified: trunk/uClibc/libc/sysdeps/linux/m68k/bits/fcntl.h =================================================================== --- trunk/uClibc/libc/sysdeps/linux/m68k/bits/fcntl.h 2008-05-03 13:59:11 UTC (rev 21930) +++ trunk/uClibc/libc/sysdeps/linux/m68k/bits/fcntl.h 2008-05-03 15:27:10 UTC (rev 21931) @@ -236,5 +236,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len, unsigned int __flags); +#endif __END_DECLS Modified: trunk/uClibc/libc/sysdeps/linux/microblaze/bits/fcntl.h =================================================================== --- trunk/uClibc/libc/sysdeps/linux/microblaze/bits/fcntl.h 2008-05-03 13:59:11 UTC (rev 21930) +++ trunk/uClibc/libc/sysdeps/linux/microblaze/bits/fcntl.h 2008-05-03 15:27:10 UTC (rev 21931) @@ -233,5 +233,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len, unsigned int __flags); +#endif __END_DECLS Modified: trunk/uClibc/libc/sysdeps/linux/mips/bits/fcntl.h =================================================================== --- trunk/uClibc/libc/sysdeps/linux/mips/bits/fcntl.h 2008-05-03 13:59:11 UTC (rev 21930) +++ trunk/uClibc/libc/sysdeps/linux/mips/bits/fcntl.h 2008-05-03 15:27:10 UTC (rev 21931) @@ -260,5 +260,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len, unsigned int __flags); +#endif __END_DECLS Modified: trunk/uClibc/libc/sysdeps/linux/nios/bits/fcntl.h =================================================================== --- trunk/uClibc/libc/sysdeps/linux/nios/bits/fcntl.h 2008-05-03 13:59:11 UTC (rev 21930) +++ trunk/uClibc/libc/sysdeps/linux/nios/bits/fcntl.h 2008-05-03 15:27:10 UTC (rev 21931) @@ -236,5 +236,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len, unsigned int __flags); +#endif __END_DECLS Modified: trunk/uClibc/libc/sysdeps/linux/nios2/bits/fcntl.h =================================================================== --- trunk/uClibc/libc/sysdeps/linux/nios2/bits/fcntl.h 2008-05-03 13:59:11 UTC (rev 21930) +++ trunk/uClibc/libc/sysdeps/linux/nios2/bits/fcntl.h 2008-05-03 15:27:10 UTC (rev 21931) @@ -236,5 +236,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len, unsigned int __flags); +#endif __END_DECLS Modified: trunk/uClibc/libc/sysdeps/linux/powerpc/bits/fcntl.h =================================================================== --- trunk/uClibc/libc/sysdeps/linux/powerpc/bits/fcntl.h 2008-05-03 13:59:11 UTC (rev 21930) +++ trunk/uClibc/libc/sysdeps/linux/powerpc/bits/fcntl.h 2008-05-03 15:27:10 UTC (rev 21931) @@ -240,5 +240,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len, unsigned int __flags); +#endif __END_DECLS Modified: trunk/uClibc/libc/sysdeps/linux/sh/bits/fcntl.h =================================================================== --- trunk/uClibc/libc/sysdeps/linux/sh/bits/fcntl.h 2008-05-03 13:59:11 UTC (rev 21930) +++ trunk/uClibc/libc/sysdeps/linux/sh/bits/fcntl.h 2008-05-03 15:27:10 UTC (rev 21931) @@ -240,5 +240,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len, unsigned int __flags); +#endif __END_DECLS Modified: trunk/uClibc/libc/sysdeps/linux/sh64/bits/fcntl.h =================================================================== --- trunk/uClibc/libc/sysdeps/linux/sh64/bits/fcntl.h 2008-05-03 13:59:11 UTC (rev 21930) +++ trunk/uClibc/libc/sysdeps/linux/sh64/bits/fcntl.h 2008-05-03 15:27:10 UTC (rev 21931) @@ -215,5 +215,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len, unsigned int __flags); +#endif __END_DECLS Modified: trunk/uClibc/libc/sysdeps/linux/sparc/bits/fcntl.h =================================================================== --- trunk/uClibc/libc/sysdeps/linux/sparc/bits/fcntl.h 2008-05-03 13:59:11 UTC (rev 21930) +++ trunk/uClibc/libc/sysdeps/linux/sparc/bits/fcntl.h 2008-05-03 15:27:10 UTC (rev 21931) @@ -259,5 +259,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len, unsigned int __flags); +#endif __END_DECLS Modified: trunk/uClibc/libc/sysdeps/linux/v850/bits/fcntl.h =================================================================== --- trunk/uClibc/libc/sysdeps/linux/v850/bits/fcntl.h 2008-05-03 13:59:11 UTC (rev 21930) +++ trunk/uClibc/libc/sysdeps/linux/v850/bits/fcntl.h 2008-05-03 15:27:10 UTC (rev 21931) @@ -233,5 +233,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len, unsigned int __flags); +#endif __END_DECLS Modified: trunk/uClibc/libc/sysdeps/linux/vax/bits/fcntl.h =================================================================== --- trunk/uClibc/libc/sysdeps/linux/vax/bits/fcntl.h 2008-05-03 13:59:11 UTC (rev 21930) +++ trunk/uClibc/libc/sysdeps/linux/vax/bits/fcntl.h 2008-05-03 15:27:10 UTC (rev 21931) @@ -213,5 +213,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len, unsigned int __flags); +#endif __END_DECLS Modified: trunk/uClibc/libc/sysdeps/linux/x86_64/bits/fcntl.h =================================================================== --- trunk/uClibc/libc/sysdeps/linux/x86_64/bits/fcntl.h 2008-05-03 13:59:11 UTC (rev 21930) +++ trunk/uClibc/libc/sysdeps/linux/x86_64/bits/fcntl.h 2008-05-03 15:27:10 UTC (rev 21931) @@ -254,5 +254,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len, unsigned int __flags); +#endif __END_DECLS Modified: trunk/uClibc/libc/sysdeps/linux/xtensa/bits/fcntl.h =================================================================== --- trunk/uClibc/libc/sysdeps/linux/xtensa/bits/fcntl.h 2008-05-03 13:59:11 UTC (rev 21930) +++ trunk/uClibc/libc/sysdeps/linux/xtensa/bits/fcntl.h 2008-05-03 15:27:10 UTC (rev 21931) @@ -237,5 +237,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len, unsigned int __flags); +#endif __END_DECLS From bugs at busybox.net Sun May 4 01:45:09 2008 From: bugs at busybox.net (bugs at busybox.net) Date: Sun, 4 May 2008 01:45:09 -0700 Subject: [uClibc 0003234]: wrong Function signature for build_wcs_upper_buffer in regex_internal.h Message-ID: The following issue has been SUBMITTED. ====================================================================== http://busybox.net/bugs/view.php?id=3234 ====================================================================== Reported By: woglinde Assigned To: uClibc ====================================================================== Project: uClibc Issue ID: 3234 Category: Other Reproducibility: always Severity: major Priority: normal Status: assigned ====================================================================== Date Submitted: 05-04-2008 01:45 PDT Last Modified: 05-04-2008 01:45 PDT ====================================================================== Summary: wrong Function signature for build_wcs_upper_buffer in regex_internal.h Description: Hi, I think this is a bug, which was not noticed or fixed since 2 years. SVN says at this time was a sync with glibc. In the file libc/misc/regex/regex_internal.c the type for the function build_wcs_upper_buffer was changed, but in the header file it was not. So there are compile errors, when the some regexp-options are enabled. Attached is a patch, which I believe fixes this issuse. Bye, Henning ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 05-04-08 01:45 woglinde New Issue 05-04-08 01:45 woglinde Status new => assigned 05-04-08 01:45 woglinde Assigned To => uClibc 05-04-08 01:45 woglinde File Added: build_wcs_upper_buffer.patch ====================================================================== From bugs at busybox.net Tue May 6 12:29:57 2008 From: bugs at busybox.net (bugs at busybox.net) Date: Tue, 6 May 2008 12:29:57 -0700 Subject: [uClibc 0003254]: Build: dlfcn.h removed when it shouldn't be Message-ID: The following issue has been SUBMITTED. ====================================================================== http://busybox.net/bugs/view.php?id=3254 ====================================================================== Reported By: frabar666 Assigned To: uClibc ====================================================================== Project: uClibc Issue ID: 3254 Category: Shared Library Support Reproducibility: always Severity: major Priority: normal Status: assigned ====================================================================== Date Submitted: 05-06-2008 12:29 PDT Last Modified: 05-06-2008 12:29 PDT ====================================================================== Summary: Build: dlfcn.h removed when it shouldn't be Description: Product version: svn-HEAD svn-r20475 added logic to rm during build (in "Makefile.in") and remove its inclusion (in "include/link.h") when "not supporting" shared libraries. However the two conditionals are not the same: the first one tests "!HAVE_SHARED", while the second one tests "HAVE_NO_SHARED". The problem is that "HAVE_NO_SHARED" is not always "!HAVE_SHARED" (AFAIK first one is auto-detected from ARCH, whereas second one is a user config choice if "!HAVE_NO_SHARED"). In this case: - HAVE_NO_SHARED is not defined (ARCH supports shared libs), - HAVE_SHARED is not defined (user doesn't want shared lib support), is rm'd by "Makefile.in", yet is still included by "include/link.h", which obviously doesn't compile. (problem seen when using buildroot with uClibc-snapshot, during compilation of gcc's crtbegin*.o and crtend*.o -- I can provide more info (arch, versions, config, ...) if needed) I'm not sure which one of the two conditions is the right one, but I'd go with "HAVE_NO_SHARED"? That's what the attached patch does, it fixed the problem in my case. ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 05-06-08 12:29 frabar666 New Issue 05-06-08 12:29 frabar666 Status new => assigned 05-06-08 12:29 frabar666 Assigned To => uClibc 05-06-08 12:29 frabar666 File Added: uClibc-dlfcn.patch ====================================================================== From carmelo at uclibc.org Tue May 6 23:50:31 2008 From: carmelo at uclibc.org (carmelo at uclibc.org) Date: Tue, 6 May 2008 23:50:31 -0700 (PDT) Subject: svn commit: trunk/uClibc/libpthread: linuxthreads/sysdeps/sh linuxthreads.old etc... Message-ID: <20080507065031.D844E3C61C@busybox.net> Author: carmelo Date: 2008-05-06 23:50:30 -0700 (Tue, 06 May 2008) New Revision: 21940 Log: Remove gcc warning due to missing prototype for 'testandset' Signed-off-by: Carmelo Amoroso Modified: trunk/uClibc/libpthread/linuxthreads.old/sysdeps/sh/pt-machine.h trunk/uClibc/libpthread/linuxthreads/sysdeps/sh/pt-machine.h Changeset: Modified: trunk/uClibc/libpthread/linuxthreads/sysdeps/sh/pt-machine.h =================================================================== --- trunk/uClibc/libpthread/linuxthreads/sysdeps/sh/pt-machine.h 2008-05-06 19:11:41 UTC (rev 21939) +++ trunk/uClibc/libpthread/linuxthreads/sysdeps/sh/pt-machine.h 2008-05-07 06:50:30 UTC (rev 21940) @@ -29,6 +29,8 @@ # define PT_EI __extern_always_inline #endif +extern long int testandset (int *spinlock); + /* Spinlock implementation; required. */ PT_EI long int testandset (int *spinlock) Modified: trunk/uClibc/libpthread/linuxthreads.old/sysdeps/sh/pt-machine.h =================================================================== --- trunk/uClibc/libpthread/linuxthreads.old/sysdeps/sh/pt-machine.h 2008-05-06 19:11:41 UTC (rev 21939) +++ trunk/uClibc/libpthread/linuxthreads.old/sysdeps/sh/pt-machine.h 2008-05-07 06:50:30 UTC (rev 21940) @@ -29,6 +29,8 @@ # define PT_EI __extern_always_inline #endif +extern long int testandset (int *spinlock); + /* Spinlock implementation; required. */ PT_EI long int testandset (int *spinlock) From carmelo.amoroso at st.com Wed May 7 00:49:35 2008 From: carmelo.amoroso at st.com (Carmelo AMOROSO) Date: Wed, 07 May 2008 09:49:35 +0200 Subject: svn commit: trunk/uClibc: extra/scripts In-Reply-To: <20080427231001.427983C8A9@busybox.net> References: <20080427231001.427983C8A9@busybox.net> Message-ID: <48215F0F.2090209@st.com> Hello, just some comments... vda at uclibc.org wrote: > Author: vda > Date: 2008-04-27 16:10:00 -0700 (Sun, 27 Apr 2008) > New Revision: 21880 > > Log: > build system: improve install_headers. > Now it uses dedicated script instead of inline makefile commands, > which helps readability. > ok, tha's fine for me > It also installs asm[-generic] and linux subdirs from kernel headers > (previously it had to be done separately). > why ? I'd disagree with this choice.... it brakes some more complex build system where kernel-headers are installed in other way (i.e. rpm based build system). are there have been discussion on the list about this change... if yes, please give me the link... likely I've missed during my last holidays some posts. otherwise, I'd like to open a discussion on this. > Lastly, it passes each uclibc header thru unifdef, which strips > #ifdef UCLIBC_INTERNAL conditional from headers. > > Currently it's a no-op (no such #ifders in tree). > The plan is to have libc_hidden_proto(foo) migrated to headers > and guard them by these #ifdefs. > so, the final choice was to use this approach.. just for confirmation. Thanks, Carmelo > > > Added: > trunk/uClibc/extra/scripts/install_headers.sh > trunk/uClibc/extra/scripts/unifdef.c > > Modified: > trunk/uClibc/Makefile.in > > > Changeset: > > Sorry, the patch is too large to include (1144 lines). > Please use ViewCVS to see it! > > http://uclibc.org/cgi-bin/viewcvs.cgi?view=rev&root=svn&rev=21880 > _______________________________________________ > uClibc-cvs mailing list > uClibc-cvs at uclibc.org > http://busybox.net/cgi-bin/mailman/listinfo/uclibc-cvs > > From carmelo at uclibc.org Wed May 7 02:17:43 2008 From: carmelo at uclibc.org (carmelo at uclibc.org) Date: Wed, 7 May 2008 02:17:43 -0700 (PDT) Subject: svn commit: trunk/uClibc Message-ID: <20080507091743.5A5D73C683@busybox.net> Author: carmelo Date: 2008-05-07 02:17:42 -0700 (Wed, 07 May 2008) New Revision: 21941 Log: Add unifdef host tool to clean target Modified: trunk/uClibc/Makefile.in Changeset: Modified: trunk/uClibc/Makefile.in =================================================================== --- trunk/uClibc/Makefile.in 2008-05-07 06:50:30 UTC (rev 21940) +++ trunk/uClibc/Makefile.in 2008-05-07 09:17:42 UTC (rev 21941) @@ -353,6 +353,7 @@ done; \ fi @$(RM) include/linux include/asm* + $(RM) $(top_builddir)extra/scripts/unifdef distclean: clean -find . \( -name core -o -name \*.orig -o -name \*~ \) -exec $(RM) {} \; From vda.linux at googlemail.com Wed May 7 02:36:01 2008 From: vda.linux at googlemail.com (Denys Vlasenko) Date: Wed, 7 May 2008 11:36:01 +0200 Subject: svn commit: trunk/uClibc: extra/scripts In-Reply-To: <48215F0F.2090209@st.com> References: <20080427231001.427983C8A9@busybox.net> <48215F0F.2090209@st.com> Message-ID: <200805071136.01702.vda.linux@googlemail.com> On Wednesday 07 May 2008 09:49, Carmelo AMOROSO wrote: > Hello, just some comments... > > It also installs asm[-generic] and linux subdirs from kernel headers > > (previously it had to be done separately). > > why ? I'd disagree with this choice.... it brakes some more complex > build system > where kernel-headers are installed in other way (i.e. rpm based build > system). I found it usefult. Before this, I had to copy kernel headers to installed uclibc' include dir by hand. Every time. Not funny. If one builds his libc against a set of kernel headers X he's better not use built libc and its headers with different set of kernel headers Y! Sure, kernel is supposed to provide stable API, but this inevitably breaks in some more obscure corners. Having said that, I understand that this constitutes a change from previous behavior. I propose introducing "make install_kernel_headers" for those who needs it. Is this acceptable for you? > > Lastly, it passes each uclibc header thru unifdef, which strips > > #ifdef UCLIBC_INTERNAL conditional from headers. > > > > Currently it's a no-op (no such #ifders in tree). > > The plan is to have libc_hidden_proto(foo) migrated to headers > > and guard them by these #ifdefs. > > so, the final choice was to use this approach.. just for confirmation. Yes. This will also trivially extendable to remove other extraneous/internal stuff, for example: ./nl_types.h:#ifdef __UCLIBC_MJN3_ONLY__ ./time.h:#ifdef __UCLIBC_MJN3_ONLY__ ./time.h:#ifdef __UCLIBC_MJN3_ONLY__ ./time.h:#ifdef __UCLIBC_MJN3_ONLY__ -- vda From carmelo.amoroso at st.com Wed May 7 02:47:47 2008 From: carmelo.amoroso at st.com (Carmelo AMOROSO) Date: Wed, 07 May 2008 11:47:47 +0200 Subject: svn commit: trunk/uClibc: extra/scripts In-Reply-To: <200805071136.01702.vda.linux@googlemail.com> References: <20080427231001.427983C8A9@busybox.net> <48215F0F.2090209@st.com> <200805071136.01702.vda.linux@googlemail.com> Message-ID: <48217AC3.8010507@st.com> Denys Vlasenko wrote: > On Wednesday 07 May 2008 09:49, Carmelo AMOROSO wrote: > >> Hello, just some comments... >> > > >>> It also installs asm[-generic] and linux subdirs from kernel headers >>> (previously it had to be done separately). >>> >> why ? I'd disagree with this choice.... it brakes some more complex >> build system >> where kernel-headers are installed in other way (i.e. rpm based build >> system). >> > > I found it usefult. Before this, I had to copy kernel headers > to installed uclibc' include dir by hand. Every time. Not funny. > > If one builds his libc against a set of kernel headers X he's better > not use built libc and its headers with different set of kernel headers Y! > Sure, kernel is supposed to provide stable API, but this inevitably > breaks in some more obscure corners. > > Having said that, I understand that this constitutes a change > from previous behavior. > > I propose introducing "make install_kernel_headers" > for those who needs it. > > Is this acceptable for you? > > Hi Denis, thanks for your explanation... yes this sounds good me. So who need to install only libc headers, will call make install_headers... who needs both will call make install_kernel_headers too. I think it's more flexible. Thanks, Carmelo >>> Lastly, it passes each uclibc header thru unifdef, which strips >>> #ifdef UCLIBC_INTERNAL conditional from headers. >>> >>> Currently it's a no-op (no such #ifders in tree). >>> The plan is to have libc_hidden_proto(foo) migrated to headers >>> and guard them by these #ifdefs. >>> >> so, the final choice was to use this approach.. just for confirmation. >> > > Yes. > > This will also trivially extendable to remove other extraneous/internal > stuff, for example: > > ./nl_types.h:#ifdef __UCLIBC_MJN3_ONLY__ > ./time.h:#ifdef __UCLIBC_MJN3_ONLY__ > ./time.h:#ifdef __UCLIBC_MJN3_ONLY__ > ./time.h:#ifdef __UCLIBC_MJN3_ONLY__ > > -- > vda > > From vda at uclibc.org Wed May 7 06:03:32 2008 From: vda at uclibc.org (vda at uclibc.org) Date: Wed, 7 May 2008 06:03:32 -0700 (PDT) Subject: svn commit: trunk/uClibc: extra/scripts Message-ID: <20080507130332.BB43F3C803@busybox.net> Author: vda Date: 2008-05-07 06:03:32 -0700 (Wed, 07 May 2008) New Revision: 21944 Log: Split kernel headers installation from "make install_headers". It is "make install_kernel_headers" now. Added: trunk/uClibc/extra/scripts/install_kernel_headers.sh Modified: trunk/uClibc/Makefile.in trunk/uClibc/extra/scripts/install_headers.sh Changeset: Modified: trunk/uClibc/Makefile.in =================================================================== --- trunk/uClibc/Makefile.in 2008-05-07 12:18:48 UTC (rev 21943) +++ trunk/uClibc/Makefile.in 2008-05-07 13:03:32 UTC (rev 21944) @@ -118,6 +118,11 @@ $(top_builddir)extra/scripts/unifdef: $(top_srcdir)extra/scripts/unifdef.c $(hcompile.u) +# Installs kernel header files (linux/*, asm/*, asm-generic/*). +install_kernel_headers: headers + top_builddir=$(top_builddir) \ + $(top_srcdir)extra/scripts/install_kernel_headers.sh include $(PREFIX)$(DEVEL_PREFIX)include + # Installs header files. install_headers: headers $(top_builddir)extra/scripts/unifdef $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)include Modified: trunk/uClibc/extra/scripts/install_headers.sh =================================================================== --- trunk/uClibc/extra/scripts/install_headers.sh 2008-05-07 12:18:48 UTC (rev 21943) +++ trunk/uClibc/extra/scripts/install_headers.sh 2008-05-07 13:03:32 UTC (rev 21944) @@ -51,45 +51,6 @@ ) -# Just copy (no sanitization) some kernel headers. -eval `grep ^KERNEL_HEADERS "$top_builddir/.config"` -if ! test "$KERNEL_HEADERS" \ -|| ! test -d "$KERNEL_HEADERS/asm" \ -|| ! test -d "$KERNEL_HEADERS/asm-generic" \ -|| ! test -d "$KERNEL_HEADERS/linux" \ -; then - echo "Error: '$KERNEL_HEADERS' is not a directory containing kernel headers." - echo "Check KERNEL_HEADERS= in your .config file." - exit 1 -fi -# Do the copying only if src and dst dirs are not the same. -# Be thorough: do not settle just for textual compare, -# and guard against "pwd" being handled as shell builtin. -# Double quoting looks weird, but it works (even bbox ash too). -if test "`(cd "$KERNEL_HEADERS"; env pwd)`" != "`(cd "$2"; env pwd)`"; then - # NB: source or target files and directories may be symlinks, - # and for all we know, good reasons. - # We must work correctly in these cases. This includes "do not replace - # target symlink with real directory" rule. So, no rm -rf here please. - mkdir -p "$2/asm" 2>/dev/null - mkdir -p "$2/asm-generic" 2>/dev/null - mkdir -p "$2/linux" 2>/dev/null - # Exists, but is not a dir? That's bad, bail out - die_if_not_dir "$2/asm" "$2/asm-generic" "$2/linux" - # cp -HL creates regular destination files even if sources are symlinks. - # This is intended. - # (NB: you need busybox 1.11.x for this. earlier ones are slightly buggy) - cp -RHL "$KERNEL_HEADERS/asm"/* "$2/asm" || exit 1 - cp -RHL "$KERNEL_HEADERS/asm-generic"/* "$2/asm-generic" || exit 1 - cp -RHL "$KERNEL_HEADERS/linux"/* "$2/linux" || exit 1 - if ! test -f "$2/linux/version.h"; then - echo "Warning: '$KERNEL_HEADERS/linux/version.h' is not found" - echo "in kernel headers directory specified in .config." - echo "Some programs won't like that. Consider fixing it by hand." - fi -fi - - # Fix mode/owner bits cd "$2" || exit 1 chmod -R u=rwX,go=rX . >/dev/null 2>&1 Added: trunk/uClibc/extra/scripts/install_kernel_headers.sh =================================================================== --- trunk/uClibc/extra/scripts/install_kernel_headers.sh (rev 0) +++ trunk/uClibc/extra/scripts/install_kernel_headers.sh 2008-05-07 13:03:32 UTC (rev 21944) @@ -0,0 +1,70 @@ +#!/bin/sh +# Parameters: +# $1 = source dir +# $2 = dst dir +# $top_builddir = well you guessed it + +die_if_not_dir() +{ + for dir in "$@"; do + test -d "$dir" && continue + echo "Error: '$dir' is not a directory" + exit 1 + done +} + + +# Ensure that created dirs/files have 755/644 perms +umask 022 + + +# Sanity tests +die_if_not_dir "$1" +mkdir -p "$2" 2>/dev/null +die_if_not_dir "$2" +die_if_not_dir "$top_builddir" + + +# Just copy (no sanitization) some kernel headers. +eval `grep ^KERNEL_HEADERS "$top_builddir/.config"` +if ! test "$KERNEL_HEADERS" \ +|| ! test -d "$KERNEL_HEADERS/asm" \ +|| ! test -d "$KERNEL_HEADERS/asm-generic" \ +|| ! test -d "$KERNEL_HEADERS/linux" \ +; then + echo "Error: '$KERNEL_HEADERS' is not a directory containing kernel headers." + echo "Check KERNEL_HEADERS= in your .config file." + exit 1 +fi +# Do the copying only if src and dst dirs are not the same. +# Be thorough: do not settle just for textual compare, +# and guard against "pwd" being handled as shell builtin. +# Double quoting looks weird, but it works (even bbox ash too). +if test "`(cd "$KERNEL_HEADERS"; env pwd)`" != "`(cd "$2"; env pwd)`"; then + # NB: source or target files and directories may be symlinks, + # and for all we know, good reasons. + # We must work correctly in these cases. This includes "do not replace + # target symlink with real directory" rule. So, no rm -rf here please. + mkdir -p "$2/asm" 2>/dev/null + mkdir -p "$2/asm-generic" 2>/dev/null + mkdir -p "$2/linux" 2>/dev/null + # Exists, but is not a dir? That's bad, bail out + die_if_not_dir "$2/asm" "$2/asm-generic" "$2/linux" + # cp -HL creates regular destination files even if sources are symlinks. + # This is intended. + # (NB: you need busybox 1.11.x for this. earlier ones are slightly buggy) + cp -RHL "$KERNEL_HEADERS/asm"/* "$2/asm" || exit 1 + cp -RHL "$KERNEL_HEADERS/asm-generic"/* "$2/asm-generic" || exit 1 + cp -RHL "$KERNEL_HEADERS/linux"/* "$2/linux" || exit 1 + if ! test -f "$2/linux/version.h"; then + echo "Warning: '$KERNEL_HEADERS/linux/version.h' is not found" + echo "in kernel headers directory specified in .config." + echo "Some programs won't like that. Consider fixing it by hand." + fi +fi + + +# Fix mode/owner bits +cd "$2" || exit 1 +chmod -R u=rwX,go=rX . >/dev/null 2>&1 +chown -R `id | sed 's/^uid=\([0-9]*\).*gid=\([0-9]*\).*$/\1:\2/'` . >/dev/null 2>&1 Property changes on: trunk/uClibc/extra/scripts/install_kernel_headers.sh ___________________________________________________________________ Name: svn:executable + * From carmelo.amoroso at st.com Wed May 7 08:30:09 2008 From: carmelo.amoroso at st.com (Carmelo AMOROSO) Date: Wed, 07 May 2008 17:30:09 +0200 Subject: svn commit: trunk/uClibc: extra/scripts In-Reply-To: <4821C75B.6060308@mvista.com> References: <20080427231001.427983C8A9@busybox.net> <48215F0F.2090209@st.com> <200805071136.01702.vda.linux@googlemail.com> <4821C75B.6060308@mvista.com> Message-ID: <4821CB01.20504@st.com> Khem Raj wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Denys Vlasenko wrote: > >> On Wednesday 07 May 2008 09:49, Carmelo AMOROSO wrote: >> >>> Hello, just some comments... >>> >>>> It also installs asm[-generic] and linux subdirs from kernel headers >>>> (previously it had to be done separately). >>>> >>> why ? I'd disagree with this choice.... it brakes some more complex >>> build system >>> where kernel-headers are installed in other way (i.e. rpm based build >>> system). >>> >> I found it usefult. Before this, I had to copy kernel headers >> to installed uclibc' include dir by hand. Every time. Not funny. >> > > btw. what we need are sanitized kernel headers ( which we get by > doing make headers_install from linux kernel srcs).Copying might > work but not the right way I guess with newer kernels. > > Yes, exactly.... we (@ST) use sanitized kernel headers to build the uclibc-nptl for sh4 without any problems (kernel is 2.6.23.xx) since a long time. >> If one builds his libc against a set of kernel headers X he's better >> not use built libc and its headers with different set of kernel headers Y! >> Sure, kernel is supposed to provide stable API, but this inevitably >> breaks in some more obscure corners. >> >> Having said that, I understand that this constitutes a change >> from previous behavior. >> >> I propose introducing "make install_kernel_headers" >> for those who needs it. >> >> Is this acceptable for you? >> > > This sounds ok. > > > - -- > Khem Raj > MontaVista Software Inc. > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.7 (MingW32) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iD8DBQFIIcdbUjbQJxVzeZQRAlDiAKCEl/XRl5JOv5SL4E+a2D1zeuGm0gCfR/Hu > irI+Rniz0U/hKiesPgj8Nf0= > =qdN1 > -----END PGP SIGNATURE----- > _______________________________________________ > uClibc mailing list > uClibc at uclibc.org > http://busybox.net/cgi-bin/mailman/listinfo/uclibc > > From vda at uclibc.org Thu May 8 06:52:22 2008 From: vda at uclibc.org (vda at uclibc.org) Date: Thu, 8 May 2008 06:52:22 -0700 (PDT) Subject: svn commit: trunk/uClibc/libc/stdlib Message-ID: <20080508135222.A43823C668@busybox.net> Author: vda Date: 2008-05-08 06:52:22 -0700 (Thu, 08 May 2008) New Revision: 21950 Log: realpath: do not set bogus errno when readlink fails. Modified: trunk/uClibc/libc/stdlib/realpath.c Changeset: Modified: trunk/uClibc/libc/stdlib/realpath.c =================================================================== --- trunk/uClibc/libc/stdlib/realpath.c 2008-05-08 13:25:20 UTC (rev 21949) +++ trunk/uClibc/libc/stdlib/realpath.c 2008-05-08 13:52:22 UTC (rev 21950) @@ -133,29 +133,33 @@ path_len = strlen(path); /* See if last (so far) pathname component is a symlink. */ *new_path = '\0'; - link_len = readlink(got_path, copy_path, PATH_MAX - 1); - if (link_len < 0) { - /* EINVAL means the file exists but isn't a symlink. */ - if (errno != EINVAL) { - return NULL; + { + int sv_errno = errno; + link_len = readlink(got_path, copy_path, PATH_MAX - 1); + if (link_len < 0) { + /* EINVAL means the file exists but isn't a symlink. */ + if (errno != EINVAL) { + return NULL; + } + } else { + /* Safe sex check. */ + if (path_len + link_len >= PATH_MAX - 2) { + __set_errno(ENAMETOOLONG); + return NULL; + } + /* Note: readlink doesn't add the null byte. */ + /* copy_path[link_len] = '\0'; - we don't need it too */ + if (*copy_path == '/') + /* Start over for an absolute symlink. */ + new_path = got_path; + else + /* Otherwise back up over this component. */ + while (*(--new_path) != '/'); + /* Prepend symlink contents to path. */ + memmove(copy_path + (PATH_MAX-1) - link_len - path_len, copy_path, link_len); + path = copy_path + (PATH_MAX-1) - link_len - path_len; } - } else { - /* Safe sex check. */ - if (path_len + link_len >= PATH_MAX - 2) { - __set_errno(ENAMETOOLONG); - return NULL; - } - /* Note: readlink doesn't add the null byte. */ - /* copy_path[link_len] = '\0'; - we don't need it too */ - if (*copy_path == '/') - /* Start over for an absolute symlink. */ - new_path = got_path; - else - /* Otherwise back up over this component. */ - while (*(--new_path) != '/'); - /* Prepend symlink contents to path. */ - memmove(copy_path + (PATH_MAX-1) - link_len - path_len, copy_path, link_len); - path = copy_path + (PATH_MAX-1) - link_len - path_len; + __set_errno(sv_errno); } #endif /* S_IFLNK */ *new_path++ = '/'; From vda at uclibc.org Thu May 8 06:54:50 2008 From: vda at uclibc.org (vda at uclibc.org) Date: Thu, 8 May 2008 06:54:50 -0700 (PDT) Subject: svn commit: trunk/uClibc/test/stdlib Message-ID: <20080508135450.7286B3C668@busybox.net> Author: vda Date: 2008-05-08 06:54:50 -0700 (Thu, 08 May 2008) New Revision: 21951 Log: test-canon: stop checking realpath buffer in case realpath returns NULL (the buffer contents is undefined); also check errno more thoroughly (bugs were seen slipping through) Modified: trunk/uClibc/test/stdlib/test-canon.c Changeset: Modified: trunk/uClibc/test/stdlib/test-canon.c =================================================================== --- trunk/uClibc/test/stdlib/test-canon.c 2008-05-08 13:52:22 UTC (rev 21950) +++ trunk/uClibc/test/stdlib/test-canon.c 2008-05-08 13:54:50 UTC (rev 21951) @@ -52,8 +52,12 @@ }; struct { - const char * in, * out, * resolved; - int error; + const char * in; + const char * retval; /* what realpath should return */ + const char * retbuf; /* what realpath should store in buf */ + /* if both of the above are NULL, we won't check for result, + * it's undefined */ + int error; /* expected errno value */ } tests[] = { /* 0 */ {"/", "/"}, @@ -72,17 +76,9 @@ {"foobar", 0, "./foobar", ENOENT}, {".", "."}, {"./foobar", 0, "./foobar", ENOENT}, -#ifdef __UCLIBC__ - /* we differ from glibc here, but POSIX allows it as it says that if we did - * not successfuly complete, the value of resolved_path is undefined */ - {"SYMLINK_LOOP", 0, "", ELOOP}, + {"SYMLINK_LOOP", 0, 0, ELOOP}, /* 15 */ - {"./SYMLINK_LOOP", 0, "", ELOOP}, -#else - {"SYMLINK_LOOP", 0, "./SYMLINK_LOOP", ELOOP}, - /* 15 */ - {"./SYMLINK_LOOP", 0, "./SYMLINK_LOOP", ELOOP}, -#endif + {"./SYMLINK_LOOP", 0, 0, ELOOP}, {"SYMLINK_1", "."}, {"SYMLINK_1/foobar", 0, "./foobar", ENOENT}, {"SYMLINK_2", "/etc"}, @@ -180,27 +176,29 @@ for (i = 0; i < (int) (sizeof (tests) / sizeof (tests[0])); ++i) { buf[0] = '\0'; + errno = 0; result = realpath (tests[i].in, buf); - if (!check_path (result, tests[i].out)) + if (!check_path (result, tests[i].retval)) { printf ("%s: flunked test %d (expected `%s', got `%s')\n", - argv[0], i, tests[i].out ? tests[i].out : "NULL", + argv[0], i, tests[i].retval ? tests[i].retval : "NULL", result ? result : "NULL"); ++errors; continue; } - if (!check_path (buf, tests[i].out ? tests[i].out : tests[i].resolved)) + if ((tests[i].retval || tests[i].retbuf) + && !check_path (buf, tests[i].retval ? tests[i].retval : tests[i].retbuf)) { printf ("%s: flunked test %d (expected resolved `%s', got `%s')\n", - argv[0], i, tests[i].out ? tests[i].out : tests[i].resolved, + argv[0], i, tests[i].retval ? tests[i].retval : tests[i].retbuf, buf); ++errors; continue; } - if (!tests[i].out && errno != tests[i].error) + if (errno != tests[i].error) { printf ("%s: flunked test %d (expected errno %d, got %d)\n", argv[0], i, tests[i].error, errno); From vda at uclibc.org Fri May 9 11:15:16 2008 From: vda at uclibc.org (vda at uclibc.org) Date: Fri, 9 May 2008 11:15:16 -0700 (PDT) Subject: svn commit: trunk/uClibc/extra/scripts Message-ID: <20080509181516.DCFCFF8005@busybox.net> Author: vda Date: 2008-05-09 11:15:16 -0700 (Fri, 09 May 2008) New Revision: 21962 Log: fix "make install_kernel_headers" to not create asm-generic for 2.4 kernels. Modified: trunk/uClibc/extra/scripts/install_kernel_headers.sh Changeset: Modified: trunk/uClibc/extra/scripts/install_kernel_headers.sh =================================================================== --- trunk/uClibc/extra/scripts/install_kernel_headers.sh 2008-05-09 18:07:15 UTC (rev 21961) +++ trunk/uClibc/extra/scripts/install_kernel_headers.sh 2008-05-09 18:15:16 UTC (rev 21962) @@ -45,17 +45,21 @@ # and for all we know, good reasons. # We must work correctly in these cases. This includes "do not replace # target symlink with real directory" rule. So, no rm -rf here please. - mkdir -p "$2/asm" 2>/dev/null - mkdir -p "$2/asm-generic" 2>/dev/null - mkdir -p "$2/linux" 2>/dev/null + mkdir -p "$2/asm" 2>/dev/null + mkdir -p "$2/linux" 2>/dev/null # Exists, but is not a dir? That's bad, bail out - die_if_not_dir "$2/asm" "$2/asm-generic" "$2/linux" + die_if_not_dir "$2/asm" "$2/linux" # cp -HL creates regular destination files even if sources are symlinks. # This is intended. # (NB: you need busybox 1.11.x for this. earlier ones are slightly buggy) - cp -RHL "$KERNEL_HEADERS/asm"/* "$2/asm" || exit 1 - cp -RHL "$KERNEL_HEADERS/asm-generic"/* "$2/asm-generic" || exit 1 - cp -RHL "$KERNEL_HEADERS/linux"/* "$2/linux" || exit 1 + cp -RHL "$KERNEL_HEADERS/asm"/* "$2/asm" || exit 1 + cp -RHL "$KERNEL_HEADERS/linux"/* "$2/linux" || exit 1 + # Linux 2.4 doesn't have it + if test -d "$KERNEL_HEADERS/asm-generic"; then + mkdir -p "$2/asm-generic" 2>/dev/null + die_if_not_dir "$2/asm-generic" + cp -RHL "$KERNEL_HEADERS/asm-generic"/* "$2/asm-generic" || exit 1 + fi if ! test -f "$2/linux/version.h"; then echo "Warning: '$KERNEL_HEADERS/linux/version.h' is not found" echo "in kernel headers directory specified in .config." From carmelo at uclibc.org Tue May 13 07:32:39 2008 From: carmelo at uclibc.org (carmelo at uclibc.org) Date: Tue, 13 May 2008 07:32:39 -0700 (PDT) Subject: svn commit: trunk/uClibc/test/stdlib Message-ID: <20080513143239.CD48E3C697@busybox.net> Author: carmelo Date: 2008-05-13 07:32:39 -0700 (Tue, 13 May 2008) New Revision: 21978 Log: Do not check retbuf if realpath returns NULL Modified: trunk/uClibc/test/stdlib/test-canon.c Changeset: Modified: trunk/uClibc/test/stdlib/test-canon.c =================================================================== --- trunk/uClibc/test/stdlib/test-canon.c 2008-05-13 02:43:27 UTC (rev 21977) +++ trunk/uClibc/test/stdlib/test-canon.c 2008-05-13 14:32:39 UTC (rev 21978) @@ -188,8 +188,7 @@ continue; } - if ((tests[i].retval || tests[i].retbuf) - && !check_path (buf, tests[i].retval ? tests[i].retval : tests[i].retbuf)) + if (result && !check_path (buf, tests[i].retval ? tests[i].retval : tests[i].retbuf)) { printf ("%s: flunked test %d (expected resolved `%s', got `%s')\n", argv[0], i, tests[i].retval ? tests[i].retval : tests[i].retbuf, From bugs at busybox.net Wed May 14 14:02:55 2008 From: bugs at busybox.net (bugs at busybox.net) Date: Wed, 14 May 2008 14:02:55 -0700 Subject: [uClibc 0003314]: uClibc incorrectly defining SYS_cacheflush for ARM Message-ID: The following issue has been SUBMITTED. ====================================================================== http://busybox.net/bugs/view.php?id=3314 ====================================================================== Reported By: timtim Assigned To: uClibc ====================================================================== Project: uClibc Issue ID: 3314 Category: Architecture Specific Reproducibility: always Severity: major Priority: normal Status: assigned ====================================================================== Date Submitted: 05-14-2008 14:02 PDT Last Modified: 05-14-2008 14:02 PDT ====================================================================== Summary: uClibc incorrectly defining SYS_cacheflush for ARM Description: This issue was originally reported at the OpenEmbedded bug tracker: http://bugs.openembedded.net/show_bug.cgi?id=4242 asm/cachectl.h is not provided for ARM, packages such as strace will try and use this because of uclibc defining SYS_cacheflush. The OE user has reported this in svn version, and I have this in 0.9.29 with the patches in OE head revision added. ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 05-14-08 14:02 timtim New Issue 05-14-08 14:02 timtim Status new => assigned 05-14-08 14:02 timtim Assigned To => uClibc ====================================================================== From vapier at gentoo.org Wed May 14 17:13:37 2008 From: vapier at gentoo.org (Mike Frysinger) Date: Wed, 14 May 2008 20:13:37 -0400 Subject: svn commit: branches/uClibc-nptl/libc/misc/dirent In-Reply-To: <20071205172509.21874128569@busybox.net> References: <20071205172509.21874128569@busybox.net> Message-ID: <200805142013.38095.vapier@gentoo.org> On Wednesday 05 December 2007, carmelo at uclibc.org wrote: > Author: carmelo > Date: 2007-12-05 09:25:08 -0800 (Wed, 05 Dec 2007) > New Revision: 20626 > > Log: > Fix opendir problem when statically linked due to a missing > initialization of the mutex field within DIR struct. > When linked dynamically instead, __pthread_mutex_init will > initialize the mutex itself. Without this fix, any call to > readdir will stuck forever trying to acquire the mutex. sorry, but i dont follow. we call __pthread_mutex_init() on the dd_lock member of the dirent structure which should initialize the mutex just fine. you cant assume that zeroing the structure is the same as initializing the mutex. that is why we have these initializer functions in the first place. are you suggesting that the __pthread_mutex_init() function is not doing its job ? -mike -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 827 bytes Desc: This is a digitally signed message part. Url : http://busybox.net/lists/uclibc-cvs/attachments/20080514/badeb2fe/attachment.pgp From vapier at uclibc.org Wed May 14 19:03:14 2008 From: vapier at uclibc.org (vapier at uclibc.org) Date: Wed, 14 May 2008 19:03:14 -0700 (PDT) Subject: svn commit: trunk/uClibc/libpthread/linuxthreads.old Message-ID: <20080515020314.BED833C7AE@busybox.net> Author: vapier Date: 2008-05-14 19:03:13 -0700 (Wed, 14 May 2008) New Revision: 21980 Log: make sure we store the function pointers to the real push/pop functions rather than the public weak ones so that the libc->libpthread forwarding code is able to work properly this should fix the case where libpthread.so is not linked directly, but rather via another library: app -> links to libfoo.so -> links to libpthread.so and any function (like readdir_r) that does: __UCLIBC_MUTEX_LOCK() __UCLIBC_MUTEX_UNLOCK() Modified: trunk/uClibc/libpthread/linuxthreads.old/pthread.c Changeset: Modified: trunk/uClibc/libpthread/linuxthreads.old/pthread.c =================================================================== --- trunk/uClibc/libpthread/linuxthreads.old/pthread.c 2008-05-14 11:51:04 UTC (rev 21979) +++ trunk/uClibc/libpthread/linuxthreads.old/pthread.c 2008-05-15 02:03:13 UTC (rev 21980) @@ -371,8 +371,8 @@ .ptr__pthread_cleanup_push = _pthread_cleanup_push, .ptr__pthread_cleanup_pop = _pthread_cleanup_pop */ - .ptr__pthread_cleanup_push_defer = _pthread_cleanup_push_defer, - .ptr__pthread_cleanup_pop_restore = _pthread_cleanup_pop_restore, + .ptr__pthread_cleanup_push_defer = __pthread_cleanup_push_defer, + .ptr__pthread_cleanup_pop_restore = __pthread_cleanup_pop_restore, }; #ifdef SHARED # define ptr_pthread_functions &__pthread_functions From carmelo.amoroso at st.com Thu May 15 00:42:21 2008 From: carmelo.amoroso at st.com (Carmelo AMOROSO) Date: Thu, 15 May 2008 09:42:21 +0200 Subject: svn commit: branches/uClibc-nptl/libc/misc/dirent In-Reply-To: <200805142013.38095.vapier@gentoo.org> References: <20071205172509.21874128569@busybox.net> <200805142013.38095.vapier@gentoo.org> Message-ID: <482BE95D.1060400@st.com> Mike Frysinger wrote: > On Wednesday 05 December 2007, carmelo at uclibc.org wrote: > >> Author: carmelo >> Date: 2007-12-05 09:25:08 -0800 (Wed, 05 Dec 2007) >> New Revision: 20626 >> >> Log: >> Fix opendir problem when statically linked due to a missing >> initialization of the mutex field within DIR struct. >> When linked dynamically instead, __pthread_mutex_init will >> initialize the mutex itself. Without this fix, any call to >> readdir will stuck forever trying to acquire the mutex. >> > > sorry, but i dont follow. we call __pthread_mutex_init() on the dd_lock > member of the dirent structure which should initialize the mutex just fine. > you cant assume that zeroing the structure is the same as initializing the > mutex. that is why we have these initializer functions in the first place. > are you suggesting that the __pthread_mutex_init() function is not doing its > job ? > -mike > Hi Mike, yes exactly... but only if statically linked. I suspect that in this case the __pthread_mutex_init is a nop... likely due to weak aliasing... however, glibc does exactly the same call to memset and it uses #ifndef NOT_IN_libc __libc_lock_init (dirp->lock); #endif instead of __pthread_mutex_init(&(ptr->dd_lock), NULL); > ------------------------------------------------------------------------ > > _______________________________________________ > uClibc-cvs mailing list > uClibc-cvs at uclibc.org > http://busybox.net/cgi-bin/mailman/listinfo/uclibc-cvs From carmelo at uclibc.org Thu May 15 02:15:34 2008 From: carmelo at uclibc.org (carmelo at uclibc.org) Date: Thu, 15 May 2008 02:15:34 -0700 (PDT) Subject: svn commit: branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux Message-ID: <20080515091534.7D3023C7EC@busybox.net> Author: carmelo Date: 2008-05-15 02:15:33 -0700 (Thu, 15 May 2008) New Revision: 21981 Log: Remove symlink too during make clean Modified: branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.in Changeset: Modified: branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.in =================================================================== --- branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.in 2008-05-15 02:03:13 UTC (rev 21980) +++ branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.in 2008-05-15 09:15:33 UTC (rev 21981) @@ -192,4 +192,4 @@ $(RM) $(PTHREAD_LINUX_OUT)/unwindbuf.{c,h,s} nptl_linux_objclean: - $(RM) $(PTHREAD_LINUX_OUT)/*.{o,os,oS} + $(RM) $(PTHREAD_LINUX_OUT)/*.{o,os,oS} $(PTHREAD_LINUX_DIR)/pt-sleep.c From vapier at gentoo.org Thu May 15 02:32:37 2008 From: vapier at gentoo.org (Mike Frysinger) Date: Thu, 15 May 2008 05:32:37 -0400 Subject: svn commit: branches/uClibc-nptl/libc/misc/dirent In-Reply-To: <482BE95D.1060400@st.com> References: <20071205172509.21874128569@busybox.net> <200805142013.38095.vapier@gentoo.org> <482BE95D.1060400@st.com> Message-ID: <200805150532.38099.vapier@gentoo.org> On Thursday 15 May 2008, Carmelo AMOROSO wrote: > Mike Frysinger wrote: > > On Wednesday 05 December 2007, carmelo at uclibc.org wrote: > >> Author: carmelo > >> Date: 2007-12-05 09:25:08 -0800 (Wed, 05 Dec 2007) > >> New Revision: 20626 > >> > >> Log: > >> Fix opendir problem when statically linked due to a missing > >> initialization of the mutex field within DIR struct. > >> When linked dynamically instead, __pthread_mutex_init will > >> initialize the mutex itself. Without this fix, any call to > >> readdir will stuck forever trying to acquire the mutex. > > > > sorry, but i dont follow. we call __pthread_mutex_init() on the dd_lock > > member of the dirent structure which should initialize the mutex just > > fine. you cant assume that zeroing the structure is the same as > > initializing the mutex. that is why we have these initializer functions > > in the first place. are you suggesting that the __pthread_mutex_init() > > function is not doing its job ? > > yes exactly... but only if statically linked. I suspect that in this > case the __pthread_mutex_init is a nop... > likely due to weak aliasing... however, glibc does exactly the same call > to memset > and it uses > > #ifndef NOT_IN_libc > __libc_lock_init (dirp->lock); > #endif > > instead of __pthread_mutex_init(&(ptr->dd_lock), NULL); can you provide a test case ? i'd like to fix the real problem ... adding a memset() just ignores the larger issue with every function that does something similar. -mike -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 827 bytes Desc: This is a digitally signed message part. Url : http://busybox.net/lists/uclibc-cvs/attachments/20080515/cf24713b/attachment.pgp From carmelo.amoroso at st.com Thu May 15 03:13:34 2008 From: carmelo.amoroso at st.com (Carmelo AMOROSO) Date: Thu, 15 May 2008 12:13:34 +0200 Subject: svn commit: branches/uClibc-nptl/libc/misc/dirent In-Reply-To: <200805150532.38099.vapier@gentoo.org> References: <20071205172509.21874128569@busybox.net> <200805142013.38095.vapier@gentoo.org> <482BE95D.1060400@st.com> <200805150532.38099.vapier@gentoo.org> Message-ID: <482C0CCE.7090207@st.com> Mike Frysinger wrote: > On Thursday 15 May 2008, Carmelo AMOROSO wrote: > >> Mike Frysinger wrote: >> >>> On Wednesday 05 December 2007, carmelo at uclibc.org wrote: >>> >>>> Author: carmelo >>>> Date: 2007-12-05 09:25:08 -0800 (Wed, 05 Dec 2007) >>>> New Revision: 20626 >>>> >>>> Log: >>>> Fix opendir problem when statically linked due to a missing >>>> initialization of the mutex field within DIR struct. >>>> When linked dynamically instead, __pthread_mutex_init will >>>> initialize the mutex itself. Without this fix, any call to >>>> readdir will stuck forever trying to acquire the mutex. >>>> >>> sorry, but i dont follow. we call __pthread_mutex_init() on the dd_lock >>> member of the dirent structure which should initialize the mutex just >>> fine. you cant assume that zeroing the structure is the same as >>> initializing the mutex. that is why we have these initializer functions >>> in the first place. are you suggesting that the __pthread_mutex_init() >>> function is not doing its job ? >>> >> yes exactly... but only if statically linked. I suspect that in this >> case the __pthread_mutex_init is a nop... >> likely due to weak aliasing... however, glibc does exactly the same call >> to memset >> and it uses >> >> #ifndef NOT_IN_libc >> __libc_lock_init (dirp->lock); >> #endif >> >> instead of __pthread_mutex_init(&(ptr->dd_lock), NULL); >> > > can you provide a test case ? i'd like to fix the real problem ... adding a > memset() just ignores the larger issue with every function that does > something similar. > -mike > Hi, below there is the test used by an our customer that reported the error. You can simplify it as you like. Anyway, regarding this issue, I was thinking in the past to review the use of pthread dor locking within the libc and use instead something like glibc (libc_lock)... any comments about this ? Carmelo sh4-linux-uclibc-gcc -g -o test test.c -lpthread -static ============================ source code ============= /* test.c for opendir and readdir */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define MAX_FILE_LENGTH 1024 void printdir(char *dir); void readFile(const char *fileName); void *jvmCommunication(void *ptr); #define DIRTOOPEN "/var/java/appdb/" int main(void) { printf("test start\n"); // printdir(DIRTOOPEN); printf("before readfile\n"); readFile("/var/tvst.inf"); printf("after readfile.\n"); fflush(stdout); printdir(DIRTOOPEN); pthread_t t; pthread_create(&t, NULL, jvmCommunication, NULL); printf("after pthread_create.\n"); // printdir(DIRTOOPEN); return 0; } void printdir(char *dir) { DIR *pDir = NULL; struct dirent *ptEntry = NULL; printf("before opendir.(%s)\n",dir); fflush(stdout); if (NULL == (pDir = opendir(dir))) // open failed { printf("cann't open %s.\n", dir); return; } printf("after opendir.and before readdir.\n"); fflush(stdout); printf("it will be hang in here ..\n"); while ((ptEntry = readdir(pDir)) != NULL) { printf("DIR:"); printf("%s\n", ptEntry->d_name); } printf("after readdir.and before closedir.\n"); fflush(stdout); if (pDir != NULL) { closedir(pDir); } printf("after closedir.\n"); fflush(stdout); return; } void readFile(const char *flName) { FILE * flHandl = NULL; unsigned char ptChrUtf[MAX_FILE_LENGTH]; short ptChrUnicode[MAX_FILE_LENGTH]; memset(ptChrUtf, 0, MAX_FILE_LENGTH); memset(ptChrUnicode, 0, MAX_FILE_LENGTH * sizeof(short)); flHandl = fopen(flName, "rb"); printf("after open\n"); if(flHandl == NULL) //???????????? { return; } fread(ptChrUtf, sizeof(char), MAX_FILE_LENGTH, flHandl); printf("fread = %s\n", ptChrUtf); #if 1 printf("if remove fclose() in here , there will be no hang \n"); fclose(flHandl); //if removed it. there will be no hang #endif printf("after fclose!\n"); return; } void *jvmCommunication(void *ptr) { while(1) { sleep(1); printf("running ..!\n"); } } From vapier at gentoo.org Thu May 15 07:02:58 2008 From: vapier at gentoo.org (Mike Frysinger) Date: Thu, 15 May 2008 10:02:58 -0400 Subject: svn commit: branches/uClibc-nptl/libc/misc/dirent In-Reply-To: <482C0CCE.7090207@st.com> References: <20071205172509.21874128569@busybox.net> <200805150532.38099.vapier@gentoo.org> <482C0CCE.7090207@st.com> Message-ID: <200805151002.59196.vapier@gentoo.org> On Thursday 15 May 2008, Carmelo AMOROSO wrote: > Mike Frysinger wrote: > > On Thursday 15 May 2008, Carmelo AMOROSO wrote: > >> Mike Frysinger wrote: > >>> On Wednesday 05 December 2007, carmelo at uclibc.org wrote: > >>>> Author: carmelo > >>>> Date: 2007-12-05 09:25:08 -0800 (Wed, 05 Dec 2007) > >>>> New Revision: 20626 > >>>> > >>>> Log: > >>>> Fix opendir problem when statically linked due to a missing > >>>> initialization of the mutex field within DIR struct. > >>>> When linked dynamically instead, __pthread_mutex_init will > >>>> initialize the mutex itself. Without this fix, any call to > >>>> readdir will stuck forever trying to acquire the mutex. > >>> > >>> sorry, but i dont follow. we call __pthread_mutex_init() on the > >>> dd_lock member of the dirent structure which should initialize the > >>> mutex just fine. you cant assume that zeroing the structure is the same > >>> as initializing the mutex. that is why we have these initializer > >>> functions in the first place. are you suggesting that the > >>> __pthread_mutex_init() function is not doing its job ? > >> > >> yes exactly... but only if statically linked. I suspect that in this > >> case the __pthread_mutex_init is a nop... > >> likely due to weak aliasing... however, glibc does exactly the same call > >> to memset > >> and it uses > >> > >> #ifndef NOT_IN_libc > >> __libc_lock_init (dirp->lock); > >> #endif > >> > >> instead of __pthread_mutex_init(&(ptr->dd_lock), NULL); > > > > can you provide a test case ? i'd like to fix the real problem ... > > adding a memset() just ignores the larger issue with every function that > > does something similar. > > below there is the test used by an our customer that reported the error. > You can simplify it as you like. unfortunately, it isnt hanging for me. but i'm testing Blackfin here. if i checkout uClibc trunk at the rev just before your commit and build it for sh4, that should be able to reproduce the issue, right ? (i have sh4 hardware i can test on). > Anyway, regarding this issue, I was thinking in the past to review the > use of pthread dor locking > within the libc and use instead something like glibc (libc_lock)... any > comments about this ? i'm not terribly familiar with how glibc does internal locking, but i dont see how it'd be any different from the locking we already have with uClibc_mutex.h. could you elaborate ? -mike -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 827 bytes Desc: This is a digitally signed message part. Url : http://busybox.net/lists/uclibc-cvs/attachments/20080515/f974daa3/attachment-0001.pgp From carmelo.amoroso at st.com Thu May 15 07:48:36 2008 From: carmelo.amoroso at st.com (Carmelo AMOROSO) Date: Thu, 15 May 2008 16:48:36 +0200 Subject: svn commit: branches/uClibc-nptl/libc/misc/dirent In-Reply-To: <200805151002.59196.vapier@gentoo.org> References: <20071205172509.21874128569@busybox.net> <200805150532.38099.vapier@gentoo.org> <482C0CCE.7090207@st.com> <200805151002.59196.vapier@gentoo.org> Message-ID: <482C4D44.2030008@st.com> Mike Frysinger wrote: > On Thursday 15 May 2008, Carmelo AMOROSO wrote: > >> Mike Frysinger wrote: >> >>> On Thursday 15 May 2008, Carmelo AMOROSO wrote: >>> >>>> Mike Frysinger wrote: >>>> >>>>> On Wednesday 05 December 2007, carmelo at uclibc.org wrote: >>>>> >>>>>> Author: carmelo >>>>>> Date: 2007-12-05 09:25:08 -0800 (Wed, 05 Dec 2007) >>>>>> New Revision: 20626 >>>>>> >>>>>> Log: >>>>>> Fix opendir problem when statically linked due to a missing >>>>>> initialization of the mutex field within DIR struct. >>>>>> When linked dynamically instead, __pthread_mutex_init will >>>>>> initialize the mutex itself. Without this fix, any call to >>>>>> readdir will stuck forever trying to acquire the mutex. >>>>>> >>>>> sorry, but i dont follow. we call __pthread_mutex_init() on the >>>>> dd_lock member of the dirent structure which should initialize the >>>>> mutex just fine. you cant assume that zeroing the structure is the same >>>>> as initializing the mutex. that is why we have these initializer >>>>> functions in the first place. are you suggesting that the >>>>> __pthread_mutex_init() function is not doing its job ? >>>>> >>>> yes exactly... but only if statically linked. I suspect that in this >>>> case the __pthread_mutex_init is a nop... >>>> likely due to weak aliasing... however, glibc does exactly the same call >>>> to memset >>>> and it uses >>>> >>>> #ifndef NOT_IN_libc >>>> __libc_lock_init (dirp->lock); >>>> #endif >>>> >>>> instead of __pthread_mutex_init(&(ptr->dd_lock), NULL); >>>> >>> can you provide a test case ? i'd like to fix the real problem ... >>> adding a memset() just ignores the larger issue with every function that >>> does something similar. >>> >> below there is the test used by an our customer that report