summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog16
-rw-r--r--bits/confname.h4
-rw-r--r--conform/conformtest.pl112
-rw-r--r--conform/data/unistd.h-data15
-rw-r--r--posix/unistd.h6
-rw-r--r--sysdeps/generic/bits/confname.h4
-rw-r--r--sysdeps/generic/sync.c5
-rw-r--r--sysdeps/generic/usleep.c7
-rw-r--r--sysdeps/mach/hurd/sync.c7
-rw-r--r--sysdeps/mach/usleep.c10
-rw-r--r--sysdeps/unix/bsd/usleep.c6
-rw-r--r--sysdeps/unix/sysv/linux/usleep.c6
12 files changed, 129 insertions, 69 deletions
diff --git a/ChangeLog b/ChangeLog
index dce9f23150..4370b52bd9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,21 @@
 2001-01-25  Ulrich Drepper  <drepper@redhat.com>
 
+	* conform/conformtest.pl: Run Unix tests for XPG6.
+	Implement handling of known namespace violations.
+	Improve printing of results.
+
+	* posix/unistd.h (usleep): Correct return type.
+	* sysdeps/unix/sysv/linux/usleep.c: Correct return type.
+	* sysdeps/unix/bsd/usleep.c: Correct return type.
+	* sysdeps/mach/usleep.c: Correct return type.
+	* sysdeps/generic/usleep.c: Correct return type.
+
+	* posix/unistd.h (sync): Correct return type.
+	* sysdeps/generic/sync.c: Likewise.
+	* sysdeps/mach/hurd/sync.c: Likewise.
+
+	* sysdeps/generic/bits/confname.h (_SC_IOV_MAX): New definition.
+
 	* posix/unistd.h: Make seteuid and setegid available for XPG6.
 
 	* wcsmbs/wchar.h: Get FILE definition for XPG5.
diff --git a/bits/confname.h b/bits/confname.h
index 80a2eda0af..a783fc0cd8 100644
--- a/bits/confname.h
+++ b/bits/confname.h
@@ -1,5 +1,5 @@
 /* `sysconf', `pathconf', and `confstr' NAME values.  Generic version.
-   Copyright (C) 1993, 1995-1998, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1995-1998, 2000, 2001 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
@@ -185,6 +185,8 @@ enum
 #define	_SC_SELECT			_SC_SELECT
     _SC_UIO_MAXIOV,
 #define	_SC_UIO_MAXIOV			_SC_UIO_MAXIOV
+    _SC_IOV_MAX = _SC_UIO_MAXIOV,
+#define _SC_IOV_MAX			_SC_IOV_MAX
     _SC_PII_INTERNET_STREAM,
 #define	_SC_PII_INTERNET_STREAM		_SC_PII_INTERNET_STREAM
     _SC_PII_INTERNET_DGRAM,
diff --git a/conform/conformtest.pl b/conform/conformtest.pl
index e98975bc3f..0f8cbd286f 100644
--- a/conform/conformtest.pl
+++ b/conform/conformtest.pl
@@ -1,26 +1,28 @@
 #! /usr/bin/perl
 
 $CC = "gcc";
-$CFLAGS = "-I. '-D__attribute__(x)=' -D_XOPEN_SOURCE=500";
+$CFLAGS = "-I. '-D__attribute__(x)=' -D_XOPEN_SOURCE=600";
 
 # List of the headers we are testing.
 @headers = ("wordexp.h", "wctype.h", "wchar.h", "varargs.h", "utmpx.h",
-	     "utime.h", "unistd.h", "ulimit.h", "ucontext.h", "time.h",
-	     "termios.h", "tar.h", "sys/wait.h", "sys/utsname.h", "sys/un.h",
-	     "sys/uio.h", "sys/types.h", "sys/times.h", "sys/timeb.h",
-	     "sys/time.h", "sys/statvfs.h", "sys/stat.h", "sys/socket.h",
-	     "sys/shm.h", "sys/sem.h", "sys/resource.h", "sys/msg.h",
-	     "sys/mman.h", "sys/ipc.h", "syslog.h", "stropts.h", "strings.h",
-	     "string.h", "stdlib.h", "stdio.h", "stddef.h", "stdarg.h",
-	     "spawn.h", "signal.h", "setjmp.h", "semaphore.h",
-	     "search.h", "sched.h", "regex.h", "pwd.h", "pthread.h",
-	     "poll.h", "nl_types.h", "netinet/tcp.h", "netinet/in.h",
-	     "net/if.h", "netdb.h", "ndbm.h", "mqueue.h", "monetary.h",
-	     "math.h", "locale.h", "libgen.h", "limits.h", "langinfo.h",
-	     "iso646.h", "inttypes.h", "iconv.h", "grp.h", "glob.h", "ftw.h",
-	     "fnmatch.h", "fmtmsg.h", "float.h", "fcntl.h", "errno.h",
-	     "dlfcn.h", "dirent.h", "ctype.h", "cpio.h", "assert.h",
-	     "arpa/inet.h", "aio.h");
+	    "utime.h", "unistd.h", "ulimit.h", "ucontext.h", "time.h",
+	    "termios.h", "tar.h", "sys/wait.h", "sys/utsname.h", "sys/un.h",
+	    "sys/uio.h", "sys/types.h", "sys/times.h", "sys/timeb.h",
+	    "sys/time.h", "sys/statvfs.h", "sys/stat.h", "sys/socket.h",
+	    "sys/shm.h", "sys/sem.h", "sys/resource.h", "sys/msg.h",
+	    "sys/mman.h", "sys/ipc.h", "syslog.h", "stropts.h", "strings.h",
+	    "string.h", "stdlib.h", "stdio.h", "stddef.h", "stdarg.h",
+	    "spawn.h", "signal.h", "setjmp.h", "semaphore.h",
+	    "search.h", "sched.h", "regex.h", "pwd.h", "pthread.h",
+	    "poll.h", "nl_types.h", "netinet/tcp.h", "netinet/in.h",
+	    "net/if.h", "netdb.h", "ndbm.h", "mqueue.h", "monetary.h",
+	    "math.h", "locale.h", "libgen.h", "limits.h", "langinfo.h",
+	    "iso646.h", "inttypes.h", "iconv.h", "grp.h", "glob.h", "ftw.h",
+	    "fnmatch.h", "fmtmsg.h", "float.h", "fcntl.h", "errno.h",
+	    "dlfcn.h", "dirent.h", "ctype.h", "cpio.h", "assert.h",
+	    "arpa/inet.h", "aio.h");
+
+@headers = ('unistd.h');
 
 # These are the ISO C99 keywords.
 @keywords = ('auto', 'break', 'case', 'char', 'const', 'continue', 'default',
@@ -29,14 +31,23 @@ $CFLAGS = "-I. '-D__attribute__(x)=' -D_XOPEN_SOURCE=500";
 	     'short', 'signed', 'sizeof', 'static', 'struct', 'switch',
 	     'typedef', 'union', 'unsigned', 'void', 'volatile', 'while');
 
+# These are symbols which are known to pollute the namespace.
+@knownproblems = ('unix', 'linux', 'i386');
+
 # Some headers need a bit more attention.
 $mustprepend{'regex.h'} = "#include <sys/types.h>\n";
+$mustprepend{'wordexp.h'} = "#include <stddef.h>\n";
 
-# Make an hash table from this information.
-while ($#keywords) {
+# Make a hash table from this information.
+while ($#keywords >= 0) {
   $iskeyword{pop (@keywords)} = 1;
 }
 
+# Make a hash table from the known problems.
+while ($#knownproblems >= 0) {
+  $isknown{pop (@knownproblems)} = 1;
+}
+
 $tmpdir = "/tmp";
 
 $verbose = 1;
@@ -179,31 +190,29 @@ sub runtest
 
 
 sub newtoken {
-  my($token, $nerrors, @allow) = @_;
+  my($token, @allow) = @_;
   my($idx);
 
-  if ($token =~ /^[0-9_]/ || $iskeyword{$token}) {
-    return $nerrors;
-  }
+  return if ($token =~ /^[0-9_]/ || $iskeyword{$token});
 
   for ($idx = 0; $idx <= $#allow; ++$idx) {
-    if (poorfnmatch ($allow[$idx], $token)) {
-      return $nerrors;
-    }
+    return if (poorfnmatch ($allow[$idx], $token));
   }
 
-  ++$nerrors;
-  if ($nerrors == 1) {
-    printf ("FAIL\n    " . "-" x 72 . "\n");
+  if ($isknown{$token}) {
+    ++$nknown;
+  } else {
+    ++$nerrors;
+    if ($nerrors == 1) {
+      printf ("FAIL\n    " . "-" x 72 . "\n");
+    }
+    printf ("    Namespace violation: \"%s\"\n", $token);
   }
-  printf ("    Namespace violation: \"%s\"\n", $token);
-  return $nerrors;
 }
 
 
 sub checknamespace {
   my($h, $fnamebase, @allow) = @_;
-  my($nerrors) = 0;
 
   ++$total;
 
@@ -212,12 +221,14 @@ sub checknamespace {
   print TESTFILE "#include <$h>\n";
   close (TESTFILE);
 
+  $nerrors = 0;
+  $nknown = 0;
   open (CONTENT, "$CC $CFLAGS -E $fnamebase.c -P -Wp,-dN | sed -e '/^# [1-9]/d' -e '/^[[:space:]]*\$/d' |");
   loop: while (<CONTENT>) {
     next loop if (/^#undef /);
     chop;
     if (/^#define (.*)/) {
-      $nerrors = newtoken ($1, $nerrors, @allow);
+      newtoken ($1, @allow);
     } else {
       # We have to tokenize the line.
       my($str) = $_;
@@ -226,7 +237,7 @@ sub checknamespace {
 
       foreach $token (split(/[^a-zA-Z0-9_]/, $str)) {
 	if ($token ne "") {
-	  $nerrors = newtoken ($token, $nerrors, @allow);
+	  newtoken ($token, @allow);
 	}
       }
     }
@@ -236,6 +247,9 @@ sub checknamespace {
   if ($nerrors != 0) {
     printf ("    " . "-" x 72 . "\n");
     ++$errors;
+  } elsif ($nknown > 0) {
+    printf ("EXPECTED FAILURES\n");
+    ++$known;
   } else {
     printf ("OK\n");
   }
@@ -272,7 +286,7 @@ while ($#headers >= 0) {
     next control if (/^#/);
     next control if (/^[	]*$/);
 
-    if (/^element *({([^}]*)}|([^ ]*)) *({([^}]*)}|([^ ]*)) *([A-Za-z0-9_]*) *(.*)/) {
+    if (/^element *({([^}]*)}|([^{ ]*)) *({([^}]*)}|([^{ ]*)) *([A-Za-z0-9_]*) *(.*)/) {
       my($struct) = "$2$3";
       my($type) = "$5$6";
       my($member) = "$7";
@@ -726,8 +740,30 @@ while ($#headers >= 0) {
 }
 
 printf "-" x 76 . "\n";
-printf ("  Total number of tests  : %4d\n", $total);
-printf ("  Number of failed tests : %4d (%3d%%)\n", $errors, ($errors * 100) / $total);
-printf ("  Number of skipped tests: %4d (%3d%%)\n", $skipped, ($skipped * 100) / $total);
+printf ("  Total number of tests   : %4d\n", $total);
+
+printf ("  Number of known failures: %4d (", $known);
+$percent = ($known * 100) / $total;
+if ($percent < 1.0) {
+  printf (" <1%%)\n");
+} else {
+  printf ("%3d%%)\n", $percent);
+}
+
+printf ("  Number of failed tests  : %4d (", $errors);
+$percent = ($errors * 100) / $total;
+if ($percent < 1.0) {
+  printf (" <1%%)\n");
+} else {
+  printf ("%3d%%)\n", $percent);
+}
+
+printf ("  Number of skipped tests : %4d (", $skipped);
+$percent = ($skipped * 100) / $total;
+if ($percent < 1.0) {
+  printf (" <1%%)\n");
+} else {
+  printf ("%3d%%)\n", $percent);
+}
 
 exit $errors != 0;
diff --git a/conform/data/unistd.h-data b/conform/data/unistd.h-data
index 5bec906ebd..70f598b3e4 100644
--- a/conform/data/unistd.h-data
+++ b/conform/data/unistd.h-data
@@ -5,7 +5,7 @@ constant _XOPEN_XCU_VERSION
 
 constant _POSIX2_C_BIND
 constant _POSIX2_CHAR_TERM
-constant _POSIX2_LOCALDEF
+constant _POSIX2_LOCALEDEF
 constant _POSIX2_UPE
 constant _POSIX2_VERSION
 
@@ -232,8 +232,8 @@ constant _SC_XOPEN_REALTIME_THREADS
 constant _SC_STREAMS
 constant _SC_XBS5_ILP32_OFF32
 constant _SC_XBS5_ILP32_OFFBIG
-constant _SC_XBS5_ILP64_OFF64
-constant _SC_XBS5_ILPIBIG_OFFBIG
+constant _SC_XBS5_LP64_OFF64
+constant _SC_XBS5_LPBIG_OFFBIG
 
 constant F_LOCK
 constant F_ULOCK
@@ -283,7 +283,8 @@ function int close (int)
 function size_t confstr (int, char*, size_t)
 function {char*} crypt (const char*, const char*)
 function {char*} ctermid (char*)
-function {char*} cuserid (char*)
+// cuserid got removed in XPG6
+allow cuserid
 function int dup (int)
 function int dup2 (int, int)
 function void encrypt (char[64], int)
@@ -291,7 +292,7 @@ function int execl (const char*, const char*, ...)
 function int execle (const char*, const char*, ...)
 function int execlp (const char*, const char*, ...)
 function int execv (const char*, char *const[])
-function int execve (const char*, char *const[])
+function int execve (const char*, char *const[], char *const[])
 function int execvp (const char*, char *const[])
 function void _exit (int)
 function int fchown (int, uid_t, gid_t)
@@ -317,7 +318,7 @@ function pid_t getpgid (pid_t)
 function pid_t getpgrp (void)
 function pid_t getpid (void)
 function pid_t getppid (void)
-function pid_t getsid (void)
+function pid_t getsid (pid_t)
 function uid_t getuid (void)
 function {char*} getwd (char*)
 function int isatty (int)
@@ -346,7 +347,7 @@ function int setreuid (uid_t, uid_t)
 function pid_t setsid (void)
 function int setuid (uid_t)
 function {unsigned int} sleep (unsigned int)
-function void swab (const char*, void*, ssize_t)
+function void swab (const void*, void*, ssize_t)
 function int symlink (const char*, const char*)
 function void sync (void)
 function {long int} sysconf (int)
diff --git a/posix/unistd.h b/posix/unistd.h
index 7ae40b2ca5..e72553dc0d 100644
--- a/posix/unistd.h
+++ b/posix/unistd.h
@@ -380,7 +380,7 @@ extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval)
 
 /* Sleep USECONDS microseconds, or until a signal arrives that is not blocked
    or ignored.  */
-extern void usleep (__useconds_t __useconds) __THROW;
+extern int usleep (__useconds_t __useconds) __THROW;
 #endif
 
 
@@ -704,7 +704,7 @@ extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __THROW;
 
 /* Return the login name of the user.  */
 extern char *getlogin (void) __THROW;
-#ifdef __USE_REENTRANT
+#if defined __USE_REENTRANT || defined __USE_UNIX98
 /* Return at most NAME_LEN characters of the login name of the user in NAME.
    If it cannot be determined or some other error occurred, return the error
    code.  Otherwise return 0.  */
@@ -805,7 +805,7 @@ extern int daemon (int __nochdir, int __noclose) __THROW;
 extern long int gethostid (void) __THROW;
 
 /* Make all changes done to all files actually appear on disk.  */
-extern int sync (void) __THROW;
+extern void sync (void) __THROW;
 
 
 /* Return the number of bytes in a page.  This is the system's page size,
diff --git a/sysdeps/generic/bits/confname.h b/sysdeps/generic/bits/confname.h
index 80a2eda0af..a783fc0cd8 100644
--- a/sysdeps/generic/bits/confname.h
+++ b/sysdeps/generic/bits/confname.h
@@ -1,5 +1,5 @@
 /* `sysconf', `pathconf', and `confstr' NAME values.  Generic version.
-   Copyright (C) 1993, 1995-1998, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1995-1998, 2000, 2001 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
@@ -185,6 +185,8 @@ enum
 #define	_SC_SELECT			_SC_SELECT
     _SC_UIO_MAXIOV,
 #define	_SC_UIO_MAXIOV			_SC_UIO_MAXIOV
+    _SC_IOV_MAX = _SC_UIO_MAXIOV,
+#define _SC_IOV_MAX			_SC_IOV_MAX
     _SC_PII_INTERNET_STREAM,
 #define	_SC_PII_INTERNET_STREAM		_SC_PII_INTERNET_STREAM
     _SC_PII_INTERNET_DGRAM,
diff --git a/sysdeps/generic/sync.c b/sysdeps/generic/sync.c
index aa04edf524..1619d1c930 100644
--- a/sysdeps/generic/sync.c
+++ b/sysdeps/generic/sync.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995, 1996, 1997, 2001 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
@@ -20,11 +20,10 @@
 #include <unistd.h>
 
 /* Make all changes done to all files actually appear on disk.  */
-int
+void
 sync ()
 {
   __set_errno (ENOSYS);
-  return -1;
 }
 
 
diff --git a/sysdeps/generic/usleep.c b/sysdeps/generic/usleep.c
index cd2355c868..aefb92dd58 100644
--- a/sysdeps/generic/usleep.c
+++ b/sysdeps/generic/usleep.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1991,1995,1996,1997,1999,2001 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
@@ -16,13 +16,16 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include <errno.h>
 #include <unistd.h>
 
 /* Sleep USECONDS microseconds, or until a previously set timer goes off.  */
-void
+int
 usleep (useconds)
      useconds_t useconds;
 {
+  __set_errno (ENOSYS);
+  return -1;
 }
 
 stub_warning (usleep)
diff --git a/sysdeps/mach/hurd/sync.c b/sysdeps/mach/hurd/sync.c
index 4f61274f7f..5c6d7c460a 100644
--- a/sysdeps/mach/hurd/sync.c
+++ b/sysdeps/mach/hurd/sync.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991,1992,1993,1994,1997,2001 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
@@ -21,12 +21,11 @@
 #include <hurd.h>
 
 /* Make all changes done to all files actually appear on disk.  */
-int
+void
 sync ()
 {
   /* This is not actually synchronous; we don't wait.  */
   error_t err = __USEPORT (CRDIR, __file_syncfs (port, 0, 1));
   if (err)
-    return __hurd_fail (err);
-  return 0;
+    (void) __hurd_fail (err);
 }
diff --git a/sysdeps/mach/usleep.c b/sysdeps/mach/usleep.c
index d09ab12ab2..8ea962c723 100644
--- a/sysdeps/mach/usleep.c
+++ b/sysdeps/mach/usleep.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 93, 94, 97, 98, 99 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 93, 94, 97, 98, 99, 2001 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
@@ -22,7 +22,7 @@
 #include <unistd.h>
 
 /* Sleep USECONDS microseconds, or until a previously set timer goes off.  */
-void
+int
 usleep (useconds_t useconds)
 {
   mach_port_t recv;
@@ -31,10 +31,12 @@ usleep (useconds_t useconds)
   recv = __mach_reply_port ();
 
   if (__gettimeofday (&before, NULL) < 0)
-    return;
+    return -1;
   (void) __mach_msg (NULL, MACH_RCV_MSG|MACH_RCV_TIMEOUT|MACH_RCV_INTERRUPT,
 		     0, 0, recv, (useconds + 999) / 1000, MACH_PORT_NULL);
   __mach_port_destroy (mach_task_self (), recv);
   if (__gettimeofday (&after, NULL) < 0)
-    return;
+    return -1;
+
+  return 0;
 }
diff --git a/sysdeps/unix/bsd/usleep.c b/sysdeps/unix/bsd/usleep.c
index ccd294f000..04bc24c28c 100644
--- a/sysdeps/unix/bsd/usleep.c
+++ b/sysdeps/unix/bsd/usleep.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1996, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1996, 1999, 2001 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
@@ -21,7 +21,7 @@
 #include <sys/time.h>
 
 /* Sleep USECONDS microseconds, or until a previously set timer goes off.  */
-void
+int
 usleep (useconds)
      useconds_t useconds;
 {
@@ -30,6 +30,6 @@ usleep (useconds)
   delay.tv_sec = 0;
   delay.tv_usec = useconds;
 
-  (void) __select (0, (fd_set *) NULL, (fd_set *) NULL, (fd_set *) NULL,
+  return __select (0, (fd_set *) NULL, (fd_set *) NULL, (fd_set *) NULL,
 		   &delay);
 }
diff --git a/sysdeps/unix/sysv/linux/usleep.c b/sysdeps/unix/sysv/linux/usleep.c
index 2f94a6cbcc..f36e21c08f 100644
--- a/sysdeps/unix/sysv/linux/usleep.c
+++ b/sysdeps/unix/sysv/linux/usleep.c
@@ -1,5 +1,5 @@
 /* Implementation of the BSD usleep function using nanosleep.
-   Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1999, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -21,11 +21,11 @@
 #include <time.h>
 #include <unistd.h>
 
-void
+int
 usleep (useconds_t useconds)
 {
   struct timespec ts = { tv_sec: (long int) (useconds / 1000000),
 			 tv_nsec: (long int) (useconds % 1000000) * 1000ul };
 
-  __nanosleep (&ts, NULL);
+  return __nanosleep (&ts, NULL);
 }