test-lock taking a long time?

2012-01-25 Thread Simon Josefsson
Has anyone noticed that test-lock takes a long time to complete on some
systems?  On my laptop it is fast:

jas@latte:~/src/gnutls/gl/tests master$ time ./test-lock
Starting test_lock ... OK
Starting test_rwlock ... OK
Starting test_recursive_lock ... OK
Starting test_once ... OK

real0m1.724s
user0m1.044s
sys 0m4.708s
jas@latte:~/src/gnutls/gl/tests master$ 

However on a otherwise idle machine with 2xE5520's (resulting in 16
virtual CPUs), it takes much longer:

jas@leo:~/gnutls-3.0.12/gl/tests$ time ./test-lock 
Starting test_lock ... OK
Starting test_rwlock ... OK
Starting test_recursive_lock ... OK
Starting test_once ... OK

real1m49.893s
user1m31.874s
sys 16m4.056s
jas@leo:~/gnutls-3.0.12/gl/tests$ 

Is there some scaling in the test that makes it take longer for
multi-cpu machines?  I didn't see any from a quick look.

For comparison, my laptop is running debian squeeze and the multi-CPU
machine is running Ubuntu 11.10 (i.e., libpthread is used on both
machines).

/Simon



Re: test-lock taking a long time?

2012-01-25 Thread Jim Meyering
Simon Josefsson wrote:

> Has anyone noticed that test-lock takes a long time to complete on some
> systems?  On my laptop it is fast:
...
> However on a otherwise idle machine with 2xE5520's (resulting in 16
> virtual CPUs), it takes much longer:
>
> jas@leo:~/gnutls-3.0.12/gl/tests$ time ./test-lock
> Starting test_lock ... OK
> Starting test_rwlock ... OK
> Starting test_recursive_lock ... OK
> Starting test_once ... OK
>
> real  1m49.893s
> user  1m31.874s
> sys   16m4.056s
> jas@leo:~/gnutls-3.0.12/gl/tests$
>
> Is there some scaling in the test that makes it take longer for
> multi-cpu machines?  I didn't see any from a quick look.
>
> For comparison, my laptop is running debian squeeze and the multi-CPU
> machine is running Ubuntu 11.10 (i.e., libpthread is used on both
> machines).

Hi Simon,
Yes, I have seen precisely that problem, and it prompted this change in iwhd:

commit 8aa5b7111e46db425414ae33d5c07cef411e4630
Author: Jim Meyering 
Date:   Mon Mar 21 09:45:01 2011 +0100

tests: skip annoyingly long gnulib lock tests

* bootstrap.conf (avoided_gnulib_modules): Skip the lock tests.
They take too long.

diff --git a/bootstrap.conf b/bootstrap.conf
index c64c7ac..930ebda 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -15,6 +15,12 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see .

+# The lock test takes too long for my taste.
+avoided_gnulib_modules='
+  --avoid=lock-tests
+  --avoid=dummy
+'
+
 # gnulib modules used by this package.
 gnulib_modules='
 announce-gen



Re: test-lock taking a long time?

2012-01-25 Thread Simon Josefsson
Jim Meyering  writes:

> Hi Simon,
> Yes, I have seen precisely that problem, and it prompted this change in iwhd:

Thanks for confirmation, I've installed the same work-around in GnuTLS
now.

/Simon



[PATCH gnulib 1/4] malloca: Avoid warnings on x86_64 mingw64.

2012-01-25 Thread Marc-André Lureau
* lib/malloca.c: Include .
(mmalloca, freea): Use uintptr_t to convert pointers to integers.
* modules/malloca (Depends-on): Add stdint.
* modules/relocatable-prog-wrapper (Depends-on): Likewise.
With review from Bruno Haible  .
---
 ChangeLog|9 +
 lib/malloca.c|6 --
 modules/malloca  |1 +
 modules/relocatable-prog-wrapper |1 +
 4 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a0ce8a1..575fee3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-01-24  Marc-André Lureau  
+
+   malloca: Avoid warnings on x86_64 mingw64.
+   * lib/malloca.c: Include .
+   (mmalloca, freea): Use uintptr_t to convert pointers to integers.
+   * modules/malloca (Depends-on): Add stdint.
+   * modules/relocatable-prog-wrapper (Depends-on): Likewise.
+   With review from Bruno Haible  .
+
 2012-01-24  Bruno Haible  
 
havelib: Modern quoting.
diff --git a/lib/malloca.c b/lib/malloca.c
index c81ffbc..4557a90 100644
--- a/lib/malloca.c
+++ b/lib/malloca.c
@@ -22,6 +22,8 @@
 /* Specification.  */
 #include "malloca.h"
 
+#include 
+
 #include "verify.h"
 
 /* The speed critical point in this file is freea() applied to an alloca()
@@ -85,7 +87,7 @@ mmalloca (size_t n)
   ((int *) p)[-1] = MAGIC_NUMBER;
 
   /* Enter p into the hash table.  */
-  slot = (unsigned long) p % HASH_TABLE_SIZE;
+  slot = (uintptr_t) p % HASH_TABLE_SIZE;
   ((struct header *) (p - HEADER_SIZE))->next = mmalloca_results[slot];
   mmalloca_results[slot] = p;
 
@@ -118,7 +120,7 @@ freea (void *p)
 {
   /* Looks like a mmalloca() result.  To see whether it really is one,
  perform a lookup in the hash table.  */
-  size_t slot = (unsigned long) p % HASH_TABLE_SIZE;
+  size_t slot = (uintptr_t) p % HASH_TABLE_SIZE;
   void **chain = &mmalloca_results[slot];
   for (; *chain != NULL;)
 {
diff --git a/modules/malloca b/modules/malloca
index 57cbe32..bb9e9b4 100644
--- a/modules/malloca
+++ b/modules/malloca
@@ -11,6 +11,7 @@ m4/longlong.m4
 
 Depends-on:
 alloca-opt
+stdint
 verify
 
 configure.ac:
diff --git a/modules/relocatable-prog-wrapper b/modules/relocatable-prog-wrapper
index 8ff11d4..e5dccd5 100644
--- a/modules/relocatable-prog-wrapper
+++ b/modules/relocatable-prog-wrapper
@@ -39,6 +39,7 @@ errno
 pathmax
 ssize_t
 stdbool
+stdint
 stdlib
 unistd
 environ
-- 
1.7.7.5




[PATCH gnulib 0/4] some mingw64 warnings fixes

2012-01-25 Thread Marc-André Lureau
Hi,

Here is a small patch seris to avoid a couple of
warnings on mingw64 x86_64.

The last patch is RFC, I am not satisifed with the
solution, but mingw64 use a #define stat _stat64,
and it's difficult to keep this type if stat() is 
redefined by rpl_stat().

Marc-André Lureau (4):
  malloca: Avoid warnings on x86_64 mingw64.
  accept4, fcntl, w32sock: Avoid warnings on x86_64 mingw64.
  select, poll, isatty: Avoid warnings on x86_64 mingw64.
  RFC stat: x86_64 mingw64 #define stat as _stat64.

 ChangeLog|   40 ++
 lib/accept4.c|2 +-
 lib/canonicalize-lgpl.c  |2 +-
 lib/fcntl.c  |2 +-
 lib/isatty.c |4 ++-
 lib/malloca.c|6 +++-
 lib/poll.c   |3 +-
 lib/readlink.c   |2 +-
 lib/select.c |3 +-
 lib/stat.c   |2 +-
 lib/sys_stat.in.h|3 +-
 lib/tempname.c   |2 +-
 lib/w32sock.h|2 +-
 modules/isatty   |1 +
 modules/malloca  |1 +
 modules/poll |1 +
 modules/relocatable-prog-wrapper |1 +
 modules/select   |1 +
 18 files changed, 65 insertions(+), 13 deletions(-)

-- 
1.7.7.5




[PATCH gnulib 3/4] select, poll, isatty: Avoid warnings on x86_64 mingw64.

2012-01-25 Thread Marc-André Lureau
* lib/select.c (IsConsoleHandle): Use intptr_t to convert handle
pointer to an integer. Fix warnings with MinGW64 x64.
* lib/poll.c (IsConsoleHandle): Likewise.
* lib/isatty.c (IsConsoleHandle): Likewise.
* modules/select (Depends-on): Add stdint.
* modules/poll (Depends-on): Likewise.
* modules/isatty (Depends-on): Likewise.
---
 ChangeLog  |   11 +++
 lib/isatty.c   |4 +++-
 lib/poll.c |3 ++-
 lib/select.c   |3 ++-
 modules/isatty |1 +
 modules/poll   |1 +
 modules/select |1 +
 7 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index eb08519..dc7cdc1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2012-01-25  Marc-André Lureau  
+
+   select, poll, isatty: Avoid warnings on x86_64 mingw64.
+   * lib/select.c (IsConsoleHandle): Use intptr_t to convert handle
+   pointer to an integer. Fix warnings with MinGW64 x64.
+   * lib/poll.c (IsConsoleHandle): Likewise.
+   * lib/isatty.c (IsConsoleHandle): Likewise.
+   * modules/select (Depends-on): Add stdint.
+   * modules/poll (Depends-on): Likewise.
+   * modules/isatty (Depends-on): Likewise.
+
 2012-01-24  Marc-André Lureau  
 
accept4, fcntl, w32sock: Avoid warnings on x86_64 mingw64.
diff --git a/lib/isatty.c b/lib/isatty.c
index fa70001..b0f04ce 100644
--- a/lib/isatty.c
+++ b/lib/isatty.c
@@ -27,6 +27,8 @@
 #define WIN32_LEAN_AND_MEAN
 #include 
 
+#include 
+
 #include "msvc-inval.h"
 
 /* Get _get_osfhandle().  */
@@ -34,7 +36,7 @@
 
 /* Optimized test whether a HANDLE refers to a console.
See .  
*/
-#define IsConsoleHandle(h) (((long) (h) & 3) == 3)
+#define IsConsoleHandle(h) (((intptr_t) (h) & 3) == 3)
 
 #if HAVE_MSVC_INVALID_PARAMETER_HANDLER
 static inline int
diff --git a/lib/poll.c b/lib/poll.c
index 780a6d6..1556813 100644
--- a/lib/poll.c
+++ b/lib/poll.c
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
 # define WINDOWS_NATIVE
@@ -73,7 +74,7 @@
 
 /* Optimized test whether a HANDLE refers to a console.
See .  
*/
-#define IsConsoleHandle(h) (((long) (h) & 3) == 3)
+#define IsConsoleHandle(h) (((intptr_t) (h) & 3) == 3)
 
 static BOOL
 IsSocketHandle (HANDLE h)
diff --git a/lib/select.c b/lib/select.c
index c5522a0..b0eb171 100644
--- a/lib/select.c
+++ b/lib/select.c
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
 /* Native Windows.  */
@@ -80,7 +81,7 @@ typedef DWORD (WINAPI *PNtQueryInformationFile)
 
 /* Optimized test whether a HANDLE refers to a console.
See .  
*/
-#define IsConsoleHandle(h) (((long) (h) & 3) == 3)
+#define IsConsoleHandle(h) (((intptr_t) (h) & 3) == 3)
 
 static BOOL
 IsSocketHandle (HANDLE h)
diff --git a/modules/isatty b/modules/isatty
index e9aa037..e1b0c57a 100644
--- a/modules/isatty
+++ b/modules/isatty
@@ -9,6 +9,7 @@ Depends-on:
 unistd
 msvc-inval  [test $REPLACE_ISATTY = 1]
 msvc-nothrow[test $REPLACE_ISATTY = 1]
+stdint
 
 configure.ac:
 gl_FUNC_ISATTY
diff --git a/modules/poll b/modules/poll
index 8fa88fd..7d5e43b 100644
--- a/modules/poll
+++ b/modules/poll
@@ -14,6 +14,7 @@ sys_select  [test $HAVE_POLL = 0 || test $REPLACE_POLL = 
1]
 sys_time[test $HAVE_POLL = 0 || test $REPLACE_POLL = 1]
 errno   [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1]
 msvc-nothrow[test $HAVE_POLL = 0 || test $REPLACE_POLL = 1]
+stdint
 
 configure.ac:
 gl_FUNC_POLL
diff --git a/modules/select b/modules/select
index 7b25a8b..c40f4a9 100644
--- a/modules/select
+++ b/modules/select
@@ -10,6 +10,7 @@ sys_select
 alloca  [test $REPLACE_SELECT = 1]
 sockets [test $REPLACE_SELECT = 1]
 msvc-nothrow[test $REPLACE_SELECT = 1]
+stdint
 
 configure.ac:
 gl_FUNC_SELECT
-- 
1.7.7.5




[PATCH gnulib 2/4] accept4, fcntl, w32sock: Avoid warnings on x86_64 mingw64.

2012-01-25 Thread Marc-André Lureau
* lib/accept4.c (accept4): _open_osfhandle() expect a
intptr_t.
* lib/fcntl.c (dupfd): Likewise.
* lib/w32sock.h (SOCKET_TO_FD): Likewise.
---
 ChangeLog |8 
 lib/accept4.c |2 +-
 lib/fcntl.c   |2 +-
 lib/w32sock.h |2 +-
 4 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 575fee3..eb08519 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2012-01-24  Marc-André Lureau  
 
+   accept4, fcntl, w32sock: Avoid warnings on x86_64 mingw64.
+   * lib/accept4.c (accept4): _open_osfhandle() expect a
+   intptr_t.
+   * lib/fcntl.c (dupfd): Likewise.
+   * lib/w32sock.h (SOCKET_TO_FD): Likewise.
+
+2012-01-24  Marc-André Lureau  
+
malloca: Avoid warnings on x86_64 mingw64.
* lib/malloca.c: Include .
(mmalloca, freea): Use uintptr_t to convert pointers to integers.
diff --git a/lib/accept4.c b/lib/accept4.c
index 07dadb0..7163711 100644
--- a/lib/accept4.c
+++ b/lib/accept4.c
@@ -91,7 +91,7 @@ accept4 (int sockfd, struct sockaddr *addr, socklen_t 
*addrlen, int flags)
   /* Closing fd before allocating the new fd ensures that the new fd will
  have the minimum possible value.  */
   close (fd);
-  nfd = _open_osfhandle ((long) new_handle,
+  nfd = _open_osfhandle ((intptr_t) new_handle,
  O_NOINHERIT | (flags & (O_TEXT | O_BINARY)));
   if (nfd < 0)
 {
diff --git a/lib/fcntl.c b/lib/fcntl.c
index e989d97..3dfb6b7 100644
--- a/lib/fcntl.c
+++ b/lib/fcntl.c
@@ -94,7 +94,7 @@ dupfd (int oldfd, int newfd, int flags)
   result = -1;
   break;
 }
-  duplicated_fd = _open_osfhandle ((long) new_handle, flags);
+  duplicated_fd = _open_osfhandle ((intptr_t) new_handle, flags);
   if (duplicated_fd < 0)
 {
   CloseHandle (new_handle);
diff --git a/lib/w32sock.h b/lib/w32sock.h
index 846c342..9e38a7b 100644
--- a/lib/w32sock.h
+++ b/lib/w32sock.h
@@ -29,7 +29,7 @@
 #include "msvc-nothrow.h"
 
 #define FD_TO_SOCKET(fd)   ((SOCKET) _get_osfhandle ((fd)))
-#define SOCKET_TO_FD(fh)   (_open_osfhandle ((long) (fh), O_RDWR | O_BINARY))
+#define SOCKET_TO_FD(fh)   (_open_osfhandle ((intptr_t) (fh), O_RDWR | 
O_BINARY))
 
 static inline void
 set_winsock_errno (void)
-- 
1.7.7.5




[PATCH gnulib 4/4] RFC stat: x86_64 mingw64 #define stat as _stat64.

2012-01-25 Thread Marc-André Lureau
* lib/sys_stat.in.h: in order to keep mingw64 stat type, add a
orig_strut_stat typedef.  A bunch of "struct stat" need to be
replaced to use that original type, because stat() is defined by
rpl_stat() instead.
* lib/canonicalize-lgpl.c (__realpath): use orig_struct_stat.
* lib/readlink.c (readlink): Likewise.
* lib/stat.c (rpl_stat): Likewise.
* lib/tempname.c (struct_stat64): Likewise.

WARNING: this solution isn't elegant.. the caller is supposed to
decalre the "struct stat" with "orig_struct_stat".

Also the patch isn't complete, it probably needs to touch other parts
of gnulib code using stat().
---
 ChangeLog   |   12 
 lib/canonicalize-lgpl.c |2 +-
 lib/readlink.c  |2 +-
 lib/stat.c  |2 +-
 lib/sys_stat.in.h   |3 ++-
 lib/tempname.c  |2 +-
 6 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index dc7cdc1..f541345 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2012-01-25  Marc-André Lureau  
 
+   stat: x86_64 mingw64 #define stat as _stat64.
+   * lib/sys_stat.in.h: in order to keep mingw64 stat type, add a
+   orig_strut_stat typedef.  A bunch of "struct stat" need to be
+   replaced to use that original type, because stat() is defined by
+   rpl_stat() instead.
+   * lib/canonicalize-lgpl.c (__realpath): use orig_struct_stat.
+   * lib/readlink.c (readlink): Likewise.
+   * lib/stat.c (rpl_stat): Likewise.
+   * lib/tempname.c (struct_stat64): Likewise.
+
+2012-01-25  Marc-André Lureau  
+
select, poll, isatty: Avoid warnings on x86_64 mingw64.
* lib/select.c (IsConsoleHandle): Use intptr_t to convert handle
pointer to an integer. Fix warnings with MinGW64 x64.
diff --git a/lib/canonicalize-lgpl.c b/lib/canonicalize-lgpl.c
index 2fd79dc..b866cb8 100644
--- a/lib/canonicalize-lgpl.c
+++ b/lib/canonicalize-lgpl.c
@@ -165,7 +165,7 @@ __realpath (const char *name, char *resolved)
 #ifdef _LIBC
   struct stat64 st;
 #else
-  struct stat st;
+  orig_struct_stat st;
 #endif
   int n;
 
diff --git a/lib/readlink.c b/lib/readlink.c
index baac132..b01f4cc 100644
--- a/lib/readlink.c
+++ b/lib/readlink.c
@@ -32,7 +32,7 @@ ssize_t
 readlink (const char *name, char *buf _GL_UNUSED,
   size_t bufsize _GL_UNUSED)
 {
-  struct stat statbuf;
+  orig_struct_stat statbuf;
 
   /* In general we should use lstat() here, not stat().  But on platforms
  without symbolic links, lstat() - if it exists - would be equivalent to
diff --git a/lib/stat.c b/lib/stat.c
index 9ea53c1..10594b0 100644
--- a/lib/stat.c
+++ b/lib/stat.c
@@ -62,7 +62,7 @@ orig_stat (const char *filename, struct stat *buf)
correctly.  */
 
 int
-rpl_stat (char const *name, struct stat *st)
+rpl_stat (char const *name, orig_struct_stat *st)
 {
   int result = orig_stat (name, st);
 #if REPLACE_FUNC_STAT_FILE
diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h
index 005ad2d..df515a3 100644
--- a/lib/sys_stat.in.h
+++ b/lib/sys_stat.in.h
@@ -616,6 +616,7 @@ _GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
 /* We can't use the object-like #define stat rpl_stat, because of
struct stat.  This means that rpl_stat will not be used if the user
does (stat)(a,b).  Oh well.  */
+typedef struct stat orig_struct_stat;
 #  undef stat
 #  ifdef _LARGE_FILES
 /* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
@@ -626,7 +627,7 @@ _GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
 #  else /* !_LARGE_FILES */
 #   define stat(name, st) rpl_stat (name, st)
 #  endif /* !_LARGE_FILES */
-_GL_EXTERN_C int stat (const char *name, struct stat *buf)
+_GL_EXTERN_C int stat (const char *name, orig_struct_stat *buf)
   _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
diff --git a/lib/tempname.c b/lib/tempname.c
index de0474d..f82caa2 100644
--- a/lib/tempname.c
+++ b/lib/tempname.c
@@ -61,7 +61,7 @@
 #if _LIBC
 # define struct_stat64 struct stat64
 #else
-# define struct_stat64 struct stat
+# define struct_stat64 orig_struct_stat
 # define __gen_tempname gen_tempname
 # define __getpid getpid
 # define __gettimeofday gettimeofday
-- 
1.7.7.5




[PATCH] obstack: remove __STDC__ conditionals

2012-01-25 Thread Paul Eggert
At the end of this messiage is a patch I imported from a pending glibc patch.

By the way, can anybody explain the following comment
in m4/include_next.m4?

  dnl gcc does not warn about some things, and on some systems (Solaris and 
Interix)
  dnl __STDC__ evaluates to 0 instead of to 1. The latter is an undesired side
  dnl effect; we are therefore careful to use 'defined __STDC__' or '1' instead
  dnl of plain '__STDC__'.

I don't understand this, as no gnulib code seems
to use 'defined __STDC__' in that way.


obstack: remove __STDC__ conditionals
* lib/obstack.h: Remove __STDC__ conditionals, as suggested by Joseph
S. Myers in .
This leaves lib/localcharset.c, m4/iconv.m4, and a confusing comment in
m4/include_next.m4 as the only gnulib-maintained places that still
refer to __STDC__.
diff --git a/lib/obstack.h b/lib/obstack.h
index 0a1e473..b7d2404 100644
--- a/lib/obstack.h
+++ b/lib/obstack.h
@@ -253,7 +253,7 @@ extern int obstack_exit_failure;

 #define obstack_memory_used(h) _obstack_memory_used (h)
 
-#if defined __GNUC__ && defined __STDC__ && __STDC__
+#if defined __GNUC__
 /* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and
does not implement __extension__.  But that compiler doesn't define
__GNUC_MINOR__.  */
@@ -405,7 +405,7 @@ __extension__   
\
  __o->next_free = __o->object_base = (char *)__obj; \
else (__obstack_free) (__o, __obj); })
 
-#else /* not __GNUC__ or not __STDC__ */
+#else /* not __GNUC__ */

 # define obstack_object_size(h) \
  (unsigned) ((h)->next_free - (h)->object_base)
@@ -503,7 +503,7 @@ __extension__   
\
 = (h)->temp.tempint + (char *) (h)->chunk)  \
: (((__obstack_free) ((h), (h)->temp.tempint + (char *) (h)->chunk), 0), 
0)))

-#endif /* not __GNUC__ or not __STDC__ */
+#endif /* not __GNUC__ */

 #ifdef __cplusplus
 }   /* C++ */



Re: [PATCH 10/11] quote consistently and make tests pass with new quoting from gnulib

2012-01-25 Thread Paul Eggert
Does the following gnulib patch fix things for Bison on OS X?
I'll CC: this to bug-gnulib@gnu.org, to give Bruno Haible
a heads-up about the localcharset problem.

localcharset: port to Mac OS X's C locale
* lib/localcharset.c (get_charset_aliases) [DARWIN7]:
Map "US-ASCII" to "ASCII".  Problem reported by Akim Demaille in
.
diff --git a/lib/localcharset.c b/lib/localcharset.c
index d86002c..68ccf60 100644
--- a/lib/localcharset.c
+++ b/lib/localcharset.c
@@ -262,6 +262,7 @@ get_charset_aliases (void)
"ISO8859-9" "\0" "ISO-8859-9" "\0"
"ISO8859-13" "\0" "ISO-8859-13" "\0"
"ISO8859-15" "\0" "ISO-8859-15" "\0"
+   "US-ASCII" "\0" "ASCII" "\0"
"KOI8-R" "\0" "KOI8-R" "\0"
"KOI8-U" "\0" "KOI8-U" "\0"
"CP866" "\0" "CP866" "\0"



Re: test-lock taking a long time?

2012-01-25 Thread Bruno Haible
Hi Simon,

> Has anyone noticed that test-lock takes a long time to complete on some
> systems?

Yes, on Solaris 11 for example it is particularly slow.

> Is there some scaling in the test that makes it take longer for
> multi-cpu machines?  I didn't see any from a quick look.

No, the test has a fixed number of threads, a fixed number of shared
objects (bank accounts), and a fixed number of modifications per thread.

> On my laptop it is fast:
> 
> jas@latte:~/src/gnutls/gl/tests master$ time ./test-lock
> Starting test_lock ... OK
> Starting test_rwlock ... OK
> Starting test_recursive_lock ... OK
> Starting test_once ... OK
> 
> real  0m1.724s
> user  0m1.044s
> sys   0m4.708s
> jas@latte:~/src/gnutls/gl/tests master$ 
> 
> However on a otherwise idle machine with 2xE5520's (resulting in 16
> virtual CPUs), it takes much longer:
> 
> jas@leo:~/gnutls-3.0.12/gl/tests$ time ./test-lock 
> Starting test_lock ... OK
> Starting test_rwlock ... OK
> Starting test_recursive_lock ... OK
> Starting test_once ... OK
> 
> real  1m49.893s
> user  1m31.874s
> sys   16m4.056s

It can depend on many factors: Which kind of scheduler is used. How much
time it takes to switch a CPU to a different thread. How much the
"affinity" of threads to CPUs is preserved. How good the implementation
of locks in libc is.

I don't know enough about the inner workings of multithreading to analyze
this.

Bruno




Re: [libvirt] [PATCH libvirt 6/6] Cast timeval.tv_sec long to localtime expected type time_t

2012-01-25 Thread Eric Blake
[adding bug-gnulib]

On 01/25/2012 01:13 PM, Marc-André Lureau wrote:
> ---
>  tools/virsh.c |4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/virsh.c b/tools/virsh.c
> index 41c..246e638 100644
> --- a/tools/virsh.c
> +++ b/tools/virsh.c
> @@ -3703,7 +3703,7 @@ vshGenFileName(vshControl *ctl, virDomainPtr dom, const 
> char *mime)
>  /* add mime type here */
>  
>  gettimeofday(&cur_time, NULL);
> -localtime_r(&cur_time.tv_sec, &time_info);
> +localtime_r((time_t *)&cur_time.tv_sec, &time_info);

NAK.  tv_sec should already be time_t.  This is a bug in your system
header definition of 'struct timespec', or in something that gnulib has
done to that struct in the meantime; and we should make gnulib work
around it if we can't get if fixed in mingw.

Can you help us identify why we are getting a type mismatch warning from
the compiler in the first place?

-- 
Eric Blake   ebl...@redhat.com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature


Re: [libvirt] [PATCH libvirt 6/6] Cast timeval.tv_sec long to localtime expected type time_t

2012-01-25 Thread Eric Blake
[dropping libvirt]

On 01/25/2012 06:05 PM, Eric Blake wrote:
> [adding bug-gnulib]
> 
> On 01/25/2012 01:13 PM, Marc-André Lureau wrote:
>> ---
>>  tools/virsh.c |4 ++--
>>  1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/tools/virsh.c b/tools/virsh.c
>> index 41c..246e638 100644
>> --- a/tools/virsh.c
>> +++ b/tools/virsh.c
>> @@ -3703,7 +3703,7 @@ vshGenFileName(vshControl *ctl, virDomainPtr dom, 
>> const char *mime)
>>  /* add mime type here */
>>  
>>  gettimeofday(&cur_time, NULL);
>> -localtime_r(&cur_time.tv_sec, &time_info);
>> +localtime_r((time_t *)&cur_time.tv_sec, &time_info);
> 
> NAK.  tv_sec should already be time_t.  This is a bug in your system
> header definition of 'struct timespec'

correction - the definition of 'struct timeval'

At any rate, I find in the mingw64 headers:

:
#ifndef _TIME_T_DEFINED
#define _TIME_T_DEFINED
#ifdef _USE_32BIT_TIME_T
typedef __time32_t time_t;
#else
typedef __time64_t time_t;
#endif
#endif
...
struct timespec {
  time_t  tv_sec;   /* Seconds */
  longtv_nsec;  /* Nanoseconds */
};

:
#include <_timeval.h>

<_timeval.h>:
struct timeval
{
long tv_sec;
long tv_usec;
};

Oops.  struct timeval is generating a struct timeval with a 32-bit
tv_sec even when time_t is 64-bits.

:(

-- 
Eric Blake   ebl...@redhat.com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature


[PATCH] pipe2: document lack of thread-safety in replacement

2012-01-25 Thread Eric Wong
As the replacement cannot be made thread-safe, we need to
document this to prevent users from having a false sense
of safety.

* doc/glibc-functions/pipe2.texi (pipe2): mention lack of thread-safety

Signed-off-by: Eric Wong 
---
 I took the line off the existing documentation for the
 similar-in-purpose *at() functions.

 doc/glibc-functions/pipe2.texi |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/doc/glibc-functions/pipe2.texi b/doc/glibc-functions/pipe2.texi
index 2fef538..41965bc 100644
--- a/doc/glibc-functions/pipe2.texi
+++ b/doc/glibc-functions/pipe2.texi
@@ -10,6 +10,7 @@ Portability problems fixed by Gnulib:
 This function is missing on many non-glibc platforms:
 MacOS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, 
HP-UX 11,
 IRIX 6.5, OSF/1 5.1, Solaris 11 2011-11, Cygwin 1.7.1, mingw, MSVC 9, Interix 
3.5, BeOS.
+But the replacement function is not safe to be used in libraries and is not 
multithread-safe.
 @end itemize
 
 Portability problems not fixed by Gnulib:
-- 
Eric Wong



Re: [PATCH] obstack: remove __STDC__ conditionals

2012-01-25 Thread Bruno Haible
Paul Eggert wrote:
> By the way, can anybody explain the following comment
> in m4/include_next.m4?
> 
>   dnl gcc does not warn about some things, and on some systems (Solaris and 
> Interix)
>   dnl __STDC__ evaluates to 0 instead of to 1. The latter is an undesired side
>   dnl effect; we are therefore careful to use 'defined __STDC__' or '1' 
> instead
>   dnl of plain '__STDC__'.
> ...
> -#if defined __GNUC__ && defined __STDC__ && __STDC__
> +#if defined __GNUC__
>  /* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and
> does not implement __extension__.  But that compiler doesn't define
> __GNUC_MINOR__.  */

These two comments refer to systems that were in use ca. 1992-1995. At
that time you could use "gcc -traditional", which would not define __STDC__,
and on some systems (esp. early SVR4 systems) __STDC__ was defined to 0
by the 'cc' compiler and then also by gcc (since it had to be compatible
with the header files - fixincludes was not as good in these days at it is
now).

Thanks for the cleanup of this extremely old cruft.

Bruno