Update.
authorUlrich Drepper <drepper@redhat.com>
Mon, 3 Aug 1998 16:47:01 +0000 (16:47 +0000)
committerUlrich Drepper <drepper@redhat.com>
Mon, 3 Aug 1998 16:47:01 +0000 (16:47 +0000)
1998-08-03 16:36  Ulrich Drepper  <drepper@cygnus.com>

* catgets/catgets.c: Use mmap/munmap only is _POSIX_MAPPED_FILES
is defined.
* catgets/open_catalog.c: Likewise.
* iconv/iconv_prog.c: Likewise.
* intl/loadmsgcat.c: Likewise.
* locale/findlocale.c: Likewise.
* locale/loadlocale.c: Likewise.
* locale/programs/localedef.c: Likewise.
* malloc/malloc.c: Likewise.

* elf/elf.h: Fix typo.

* math/Makefile: Use $(LN_S) instead of ln.

* sysdeps/generic/getpgid.c: Fix return type.

1998-08-01 02:49 -0400  Zack Weinberg  <zack@rabi.phys.columbia.edu>

* sysdeps/posix/tempname.c (__stdio_gen_tempname): Rename to
__gen_tempname and simplify the interface.  Strip out the
code to do path search and create FILE objects.  This function
now takes a mktemp() style template and returns either a name
or a file descriptor.
(__path_search): New function; searches for directories for
temp files.
* sysdeps/generic/tempname.c: Stub out __gen_tempname and
__path_search, not __stdio_gen_tempname.

* libio/stdio.h: Prototype __gen_tempname and __path_search,
not __stdio_gen_tempname.
* stdio/stdio.h: Likewise.

* stdio-common/tempnam.c: Use __path_search and __gen_tempname.
* stdio-common/tmpfile.c: Likewise.
* stdio-common/tmpfile64.c: Likewise.
* stdio-common/tmpnam.c: Likewise.
* stdio-common/tmpnam_r.c: Likewise.

* misc/mkstemp.c: New file.  Use __gen_tempname.
* misc/mktemp.c: Likewise.

* sysdeps/posix/mkstemp.c: Removed.
* sysdeps/posix/mktemp.c: Removed.
* sysdeps/generic/mkstemp.c: Removed.
* sysdeps/generic/mktemp.c: Removed.

1998-08-02  Thorsten Kukuk  <kukuk@vt.uni-paderborn.de>

* configure.in: Check, if door add-on is installed.
* config.make.in: Add have_doors.
* sunrpc/Makefile: Add HAVE_DOOR define.
* sunrpc/key_call.c: Add keyserv/door interface.

* sunrpc/svc_unix.c: Call setsockopt only if SO_PASSCRED is defined.
* sunrpc/clnt_unix.c: Likewise.

1998-08-02  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

* inet/netinet/in.h (IN_CLASSC): Correct mask.
Reported by Ian Staniforth <I.Staniforth@sheffield.ac.uk> [fixes
PR libc/727].

1998-08-03 10:23  Ulrich Drepper  <drepper@cygnus.com>

* misc/Makefile: Fix installation problem with --disable-shared.
* posix/Makefile: Likewise.

1998-08-02  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

* posix/regex.c (re_search_2): Optimize searching for anchored
pattern if '^' cannot match at embedded newlines.
(regerror): Renamed from __regerror, which it should only be
called if _LIBC.

1998-07-31  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

* sunrpc/svc_unix.c (__msgread): Check setsockopt return value.

1998-07-31  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

* sysdeps/generic/glob.c: Remove obsolete cast.

1998-07-31  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

* Rules (tests): Fix last change.

44 files changed:
ChangeLog
Rules
catgets/catgets.c
catgets/open_catalog.c
config.make.in
configure
configure.in
elf/elf.h
iconv/iconv_prog.c
include/bits/cmathcalls.h [new file with mode: 0644]
include/complex.h [new file with mode: 0644]
include/execinfo.h [new file with mode: 0644]
include/fenv.h [new file with mode: 0644]
inet/netinet/in.h
intl/loadmsgcat.c
libio/stdio.h
linuxthreads/ChangeLog
linuxthreads/Makefile
locale/findlocale.c
locale/loadlocale.c
locale/programs/localedef.c
malloc/malloc.c
math/Makefile
misc/Makefile
misc/mkstemp.c [moved from sysdeps/generic/mkstemp.c with 73% similarity]
misc/mktemp.c [moved from sysdeps/generic/mktemp.c with 77% similarity]
posix/Makefile
posix/regex.c
stdio-common/tempnam.c
stdio-common/tmpfile.c
stdio-common/tmpfile64.c
stdio-common/tmpnam.c
stdio-common/tmpnam_r.c
stdio/stdio.h
sunrpc/Makefile
sunrpc/clnt_unix.c
sunrpc/key_call.c
sunrpc/svc_unix.c
sysdeps/generic/getpgid.c
sysdeps/generic/glob.c
sysdeps/generic/tempname.c
sysdeps/posix/mkstemp.c [deleted file]
sysdeps/posix/mktemp.c [deleted file]
sysdeps/posix/tempname.c

index e918d29cac82ade9bf1ffd9efec9c1dc66c66207..095145f991398f1e585edacb1dbf8112d2b9cd9e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,91 @@
+1998-08-03 16:36  Ulrich Drepper  <drepper@cygnus.com>
+
+       * catgets/catgets.c: Use mmap/munmap only is _POSIX_MAPPED_FILES
+       is defined.
+       * catgets/open_catalog.c: Likewise.
+       * iconv/iconv_prog.c: Likewise.
+       * intl/loadmsgcat.c: Likewise.
+       * locale/findlocale.c: Likewise.
+       * locale/loadlocale.c: Likewise.
+       * locale/programs/localedef.c: Likewise.
+       * malloc/malloc.c: Likewise.
+
+       * elf/elf.h: Fix typo.
+
+       * math/Makefile: Use $(LN_S) instead of ln.
+
+       * sysdeps/generic/getpgid.c: Fix return type.
+
+1998-08-01 02:49 -0400  Zack Weinberg  <zack@rabi.phys.columbia.edu>
+
+       * sysdeps/posix/tempname.c (__stdio_gen_tempname): Rename to
+       __gen_tempname and simplify the interface.  Strip out the
+       code to do path search and create FILE objects.  This function
+       now takes a mktemp() style template and returns either a name
+       or a file descriptor.
+       (__path_search): New function; searches for directories for
+       temp files.
+       * sysdeps/generic/tempname.c: Stub out __gen_tempname and
+       __path_search, not __stdio_gen_tempname.
+
+       * libio/stdio.h: Prototype __gen_tempname and __path_search,
+       not __stdio_gen_tempname.
+       * stdio/stdio.h: Likewise.
+
+       * stdio-common/tempnam.c: Use __path_search and __gen_tempname.
+       * stdio-common/tmpfile.c: Likewise.
+       * stdio-common/tmpfile64.c: Likewise.
+       * stdio-common/tmpnam.c: Likewise.
+       * stdio-common/tmpnam_r.c: Likewise.
+
+       * misc/mkstemp.c: New file.  Use __gen_tempname.
+       * misc/mktemp.c: Likewise.
+
+       * sysdeps/posix/mkstemp.c: Removed.
+       * sysdeps/posix/mktemp.c: Removed.
+       * sysdeps/generic/mkstemp.c: Removed.
+       * sysdeps/generic/mktemp.c: Removed.
+
+1998-08-02  Thorsten Kukuk  <kukuk@vt.uni-paderborn.de>
+
+       * configure.in: Check, if door add-on is installed.
+       * config.make.in: Add have_doors.
+       * sunrpc/Makefile: Add HAVE_DOOR define.
+       * sunrpc/key_call.c: Add keyserv/door interface.
+
+       * sunrpc/svc_unix.c: Call setsockopt only if SO_PASSCRED is defined.
+       * sunrpc/clnt_unix.c: Likewise.
+
+1998-08-02  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
+
+       * inet/netinet/in.h (IN_CLASSC): Correct mask.
+       Reported by Ian Staniforth <I.Staniforth@sheffield.ac.uk> [fixes
+       PR libc/727].
+
+1998-08-03 10:23  Ulrich Drepper  <drepper@cygnus.com>
+
+       * misc/Makefile: Fix installation problem with --disable-shared.
+       * posix/Makefile: Likewise.
+
+1998-08-02  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+       * posix/regex.c (re_search_2): Optimize searching for anchored
+       pattern if '^' cannot match at embedded newlines.
+       (regerror): Renamed from __regerror, which it should only be
+       called if _LIBC.
+
+1998-07-31  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+       * sunrpc/svc_unix.c (__msgread): Check setsockopt return value.
+
+1998-07-31  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+       * sysdeps/generic/glob.c: Remove obsolete cast.
+
+1998-07-31  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+       * Rules (tests): Fix last change.
+
 1998-07-31 17:59  Ulrich Drepper  <drepper@cygnus.com>
 
        * sysdeps/unix/sysv/linux/Makefile [subdir==misc] (sysdep_routines):
diff --git a/Rules b/Rules
index 2353cc34a0df5bc86c2ffe122c53ff530dee9714..a3005a069e23b455d8f980573e5cd84779eed022 100644 (file)
--- a/Rules
+++ b/Rules
@@ -89,12 +89,14 @@ else
 others: $(addprefix $(objpfx),$(extra-objs))
 endif
 ifeq ($(cross-compiling),yes)
-tests: $(addprefix $(objpfx),$(tests) $(tests-static) $(test-srcs))
+tests: $(addprefix $(objpfx),$(tests) $(test-srcs))
+ifeq ($(build-static),yes)
+tests: $(addprefix $(objpfx),$(tests-static))
+endif
 else
-ifneq (($build-static),yes)
 tests: $(tests:%=$(objpfx)%.out)
-else
-tests: $(tests:%=$(objpfx)%.out) $(tests-static:%=$(objpfx)%.sout)
+ifeq ($(build-static),yes)
+tests: $(tests-static:%=$(objpfx)%.sout)
 endif
 endif
 
index ebfb2c54ccd27bb38666dfe520466b2beed27031..b5de2fbb50f64c51e135365878cef629f0dcc662 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>.
 
@@ -166,15 +166,18 @@ catclose (nl_catd catalog_desc)
 
   catalog = (__nl_catd) catalog_desc;
 
+#ifdef _POSIX_MAPPED_FILES
   if (catalog->status == mmapped)
     __munmap ((void *) catalog->file_ptr, catalog->file_size);
-  else if (catalog->status == malloced)
-    free ((void *) catalog->file_ptr);
-  else if (catalog->status != closed && catalog->status != nonexisting)
-    {
-      __set_errno (EBADF);
-      return -1;
-    }
+  else
+#endif /* _POSIX_MAPPED_FILES */
+    if (catalog->status == malloced)
+      free ((void *) catalog->file_ptr);
+    else if (catalog->status != closed && catalog->status != nonexisting)
+      {
+       __set_errno (EBADF);
+       return -1;
+      }
 
   if (catalog->nlspath)
     free ((void *) catalog->nlspath);
index deaa8718dd453f9b3f96e0b12a5c80d6144e3d84..e4b61d779af7fe45229d7840414050a4e84ddc19 100644 (file)
@@ -24,7 +24,9 @@
 #include <string.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include <sys/mman.h>
+#ifdef _POSIX_MAPPED_FILES
+# include <sys/mman.h>
+#endif
 #include <sys/stat.h>
 
 #include "catgetsinfo.h"
@@ -194,19 +196,20 @@ __open_catalog (__nl_catd catalog)
       goto unlock_return;
     }
 
-#ifndef MAP_COPY
+  catalog->file_size = st.st_size;
+#ifdef _POSIX_MAPPED_FILES
+# ifndef MAP_COPY
     /* Linux seems to lack read-only copy-on-write.  */
-# define MAP_COPY MAP_PRIVATE
-#endif
-#ifndef MAP_FILE
+#  define MAP_COPY MAP_PRIVATE
+# endif
+# ifndef MAP_FILE
     /* Some systems do not have this flag; it is superfluous.  */
-# define MAP_FILE 0
-#endif
-#ifndef MAP_INHERIT
+#  define MAP_FILE 0
+# endif
+# ifndef MAP_INHERIT
     /* Some systems might lack this; they lose.  */
-# define MAP_INHERIT 0
-#endif
-  catalog->file_size = st.st_size;
+#  define MAP_INHERIT 0
+# endif
   catalog->file_ptr =
     (struct catalog_obj *) __mmap (NULL, st.st_size, PROT_READ,
                                   MAP_FILE|MAP_COPY|MAP_INHERIT, fd, 0);
@@ -214,6 +217,7 @@ __open_catalog (__nl_catd catalog)
     /* Tell the world we managed to mmap the file.  */
     catalog->status = mmapped;
   else
+#endif /* _POSIX_MAPPED_FILES */
     {
       /* mmap failed perhaps because the system call is not
         implemented.  Try to load the file.  */
@@ -258,9 +262,11 @@ __open_catalog (__nl_catd catalog)
     invalid_file:
       /* Invalid file.  Free the resources and mark catalog as not
         usable.  */
+#ifdef _POSIX_MAPPED_FILES
       if (catalog->status == mmapped)
        __munmap ((void *) catalog->file_ptr, catalog->file_size);
       else
+#endif /* _POSIX_MAPPED_FILES */
        free (catalog->file_ptr);
       catalog->status = nonexisting;
       goto unlock_return;
index 9f8ea0a9094071266c381ed3e8a5429e18caac85..6b4dc7ae9b7b29c9c317ef7a438d87159a6b7468 100644 (file)
@@ -40,6 +40,7 @@ old-glibc-headers = @old_glibc_headers@
 versioning = @VERSIONING@
 no-whole-archive = @no_whole_archive@
 exceptions = @exceptions@
+have_doors = @linux_doors@
 
 have-bash2 = @libc_cv_have_bash2@
 have-ksh = @libc_cv_have_ksh@
index 1b50582d81d352fa6c288cf6e04ebe5a9716d959..fc1f09aea61c88b3e920c9df80111684921afae7 100755 (executable)
--- a/configure
+++ b/configure
@@ -2879,6 +2879,12 @@ echo "$ac_t""$pic_default" 1>&6
 
 
 
+case "$add_ons" in
+  *door*) linux_doors=yes ;;
+  *) linux_doors=no ;;
+esac
+
+
 if test "`(cd $srcdir; pwd)`" = "`pwd`"; then
   config_makefile=
 else
@@ -3083,6 +3089,7 @@ s%@bounded@%$bounded%g
 s%@static_nss@%$static_nss%g
 s%@nopic_initfini@%$nopic_initfini%g
 s%@DEFINES@%$DEFINES%g
+s%@linux_doors@%$linux_doors%g
 s%@VERSION@%$VERSION%g
 s%@RELEASE@%$RELEASE%g
 
index 2f7f92551660b616ebba8a6c6c3bc585301af5dd..036491805a70ff7f4283f7742b8ba8efbe02f31f 100644 (file)
@@ -1168,6 +1168,12 @@ AC_SUBST(nopic_initfini)
 
 AC_SUBST(DEFINES)
 
+case "$add_ons" in
+  *door*) linux_doors=yes ;;
+  *) linux_doors=no ;;
+esac
+AC_SUBST(linux_doors)
+
 if test "`(cd $srcdir; pwd)`" = "`pwd`"; then
   config_makefile=
 else
index 4974c08edd334290fe97b968f643597915d66977..6418927160d5f5e98527c0f6ae19f57f0050da3e 100644 (file)
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -1170,7 +1170,7 @@ typedef struct
 #define DT_MIPS_AUX_DYNAMIC  0x70000031 /* Address of aux .dynamic.  */
 #define DT_MIPS_NUM         0x32
 
-/* Legal values for DT_MIPS_FLAG Elf32_Dyn entry.  */
+/* Legal values for DT_MIPS_FLAGS Elf32_Dyn entry.  */
 
 #define RHF_NONE                  0            /* No flags */
 #define RHF_QUICKSTART            (1 << 0)     /* Use quickstart */
index 82ff5cf80254630afa7de9cff18ece957c3c59b6..f12a69020eae5cb006002ffaf421289d9e3b3749 100644 (file)
@@ -30,7 +30,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <sys/mman.h>
+#ifdef _POSIX_MAPPED_FILES
+# include <sys/mman.h>
+#endif
 #include <gconv_int.h>
 
 /* Get libc version number.  */
@@ -176,6 +178,7 @@ main (int argc, char *argv[])
            continue;
          }
 
+#ifdef _POSIX_MAPPED_FILES
        /* We have possibilities for reading the input file.  First try
           to mmap() it since this will provide the fastest solution.  */
        if (fstat (fd, &st) == 0
@@ -206,6 +209,7 @@ main (int argc, char *argv[])
            munmap ((void *) addr, st.st_size);
          }
        else
+#endif /* _POSIX_MAPPED_FILES */
          {
            /* Read the file in pieces.  */
            if (process_fd (cd, fd, output) != 0)
diff --git a/include/bits/cmathcalls.h b/include/bits/cmathcalls.h
new file mode 100644 (file)
index 0000000..dd02960
--- /dev/null
@@ -0,0 +1 @@
+#include <math/bits/cmathcalls.h>
diff --git a/include/complex.h b/include/complex.h
new file mode 100644 (file)
index 0000000..acf8cf1
--- /dev/null
@@ -0,0 +1 @@
+#include <math/complex.h>
diff --git a/include/execinfo.h b/include/execinfo.h
new file mode 100644 (file)
index 0000000..d5c5216
--- /dev/null
@@ -0,0 +1 @@
+#include <debug/execinfo.h>
diff --git a/include/fenv.h b/include/fenv.h
new file mode 100644 (file)
index 0000000..b2da084
--- /dev/null
@@ -0,0 +1 @@
+#include <math/fenv.h>
index ddc09753e234a70019164e138d93b04db950b1be..418c6f96f706c0bb481c86d472ec8c4e048791be 100644 (file)
@@ -118,7 +118,7 @@ struct in_addr
 #define        IN_CLASSB_HOST          (0xffffffff & ~IN_CLASSB_NET)
 #define        IN_CLASSB_MAX           65536
 
-#define        IN_CLASSC(a)            ((((uint32_t) (a)) & 0xc0000000) == 0xc0000000)
+#define        IN_CLASSC(a)            ((((uint32_t) (a)) & 0xe0000000) == 0xc0000000)
 #define        IN_CLASSC_NET           0xffffff00
 #define        IN_CLASSC_NSHIFT        8
 #define        IN_CLASSC_HOST          (0xffffffff & ~IN_CLASSC_NET)
index f6214e14285af0da303ad887ce7cc409379cbd4b..480e6bc3843ad84ee16720824dd9a447b13a4566 100644 (file)
 # include <unistd.h>
 #endif
 
-#if (defined HAVE_MMAP && defined HAVE_MUNMAP) || defined _LIBC
+#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
+    || (defined _LIBC && defined _POSIX_MAPPED_FILES)
 # include <sys/mman.h>
+# undef HAVE_MMAP
+# define HAVE_MMAP     1
+#else
+# undef HAVE_MMAP
 #endif
 
 #include "gettext.h"
@@ -72,10 +77,7 @@ _nl_load_domain (domain_file)
   size_t size;
   struct stat st;
   struct mo_file_header *data = (struct mo_file_header *) -1;
-#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
-    || defined _LIBC
   int use_mmap = 0;
-#endif
   struct loaded_domain *domain;
 
   domain_file->decided = 1;
@@ -103,8 +105,7 @@ _nl_load_domain (domain_file)
       return;
     }
 
-#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
-    || defined _LIBC
+#ifdef HAVE_MMAP
   /* Now we are ready to load the file.  If mmap() is available we try
      this first.  If not available or it failed we try to load it.  */
   data = (struct mo_file_header *) mmap (NULL, size, PROT_READ,
@@ -153,8 +154,7 @@ _nl_load_domain (domain_file)
   if (data->magic != _MAGIC && data->magic != _MAGIC_SWAPPED)
     {
       /* The magic number is wrong: not a message catalog file.  */
-#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
-    || defined _LIBC
+#ifdef HAVE_MMAP
       if (use_mmap)
        munmap ((caddr_t) data, size);
       else
@@ -188,9 +188,8 @@ _nl_load_domain (domain_file)
        ((char *) data + W (domain->must_swap, data->hash_tab_offset));
       break;
     default:
-      /* This is an illegal revision.  */
-#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
-    || defined _LIBC
+      /* This is an invalid revision.  */
+#ifdef HAVE_MMAP
       if (use_mmap)
        munmap ((caddr_t) data, size);
       else
@@ -213,9 +212,11 @@ internal_function
 _nl_unload_domain (domain)
      struct loaded_domain *domain;
 {
+#ifdef _POSIX_MAPPED_FILES
   if (domain->use_mmap)
     munmap ((caddr_t) domain->data, domain->mmap_size);
   else
+#endif /* _POSIX_MAPPED_FILES */
     free ((void *) domain->data);
 
   free (domain);
index a3ae40b5367c9587a384505ee317a98a9419c254..7b5e4f857f22922a5419e9c1ef32a902259c5f29 100644 (file)
@@ -72,15 +72,12 @@ typedef _G_fpos64_t fpos_t;
 typedef _G_fpos64_t fpos64_t;
 #endif
 
-/* Generate a unique file name (and possibly open it with mode "w+b").  */
-extern char *__stdio_gen_tempname __P ((char *__buf, size_t __bufsize,
-                                       __const char *__dir,
-                                       __const char *__pfx,
-                                       int __dir_search,
-                                       size_t *__lenptr,
-                                       FILE **__streamptr,
-                                       int __large_file));
+/* Generate a unique file name (and possibly open it).  */
+extern int __path_search __P ((char *__tmpl, size_t __tmpl_len,
+                              __const char *__dir,
+                              __const char *__pfx));
 
+extern int __gen_tempname __P ((char *__tmpl, int __openit, int __large_file));
 
 /* Print out MESSAGE on the error output and abort.  */
 extern void __libc_fatal __P ((__const char *__message))
index c3f7dc3dc87ba3977f8d6f419e1b1fe725cc96f5..47d8417a18658b9a605ef4336d2daef0f74aceda 100644 (file)
@@ -1,3 +1,8 @@
+1998-08-02  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+       * Makefile (linuxthreads-version): Extract correct number from
+       Banner.
+
 1998-07-29  Xavier Leroy  <Xavier.Leroy@inria.fr>
 
        * Banner: Bump version number to 0.8
index b7444e7e4e6085386dafc4decb87ec087cb7fa4b..742be864453e7d507900d4f92b413e1a0453a91e 100644 (file)
@@ -21,7 +21,8 @@
 #
 subdir := linuxthreads
 
-linuxthreads-version=0.7
+linuxthreads-version := $(shell sed -n 's/^.*$(subdir)-\([0-9.]*\).*$$/\1/p' \
+                                   Banner)
 
 headers := pthread.h semaphore.h bits/semaphore.h
 distribute := internals.h queue.h restart.h spinlock.h
index e2fdd06f6daa1511593858591ef8ca5a2b9e7561..af2b36439eb28e94422ab0077ee52b5e80385224 100644 (file)
@@ -21,7 +21,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <sys/mman.h>
+#ifdef _POSIX_MAPPED_FILES
+# include <sys/mman.h>
+#endif
 
 #include "localeinfo.h"
 
@@ -211,6 +213,7 @@ _nl_remove_locale (int locale, struct locale_data *data)
       /* Free the name.  */
       free ((char *) data->name);
 
+#ifdef _POSIX_MAPPED_FILES
       /* Really delete the data.  First delete the real data.  */
       if (data->mmaped)
        {
@@ -223,6 +226,7 @@ _nl_remove_locale (int locale, struct locale_data *data)
            }
        }
       else
+#endif /* _POSIX_MAPPED_FILES */
        /* The memory was malloced.  */
        free ((void *) data->filedata);
 
index d856063d529558c773442ce2b91ea496cdbffc38..8649abb241cbccfd52358672e398ca2565076905 100644 (file)
@@ -23,7 +23,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <sys/mman.h>
+#ifdef _POSIX_MAPPED_FILES
+# include <sys/mman.h>
+#endif
 #include <sys/stat.h>
 
 #include "localeinfo.h"
@@ -113,24 +115,32 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
 
   /* Map in the file's data.  */
   save_err = errno;
-#ifndef MAP_COPY
+#ifdef _POSIX_MAPPED_FILES
+# ifndef MAP_COPY
   /* Linux seems to lack read-only copy-on-write.  */
-#define MAP_COPY MAP_PRIVATE
-#endif
-#ifndef        MAP_FILE
+#  define MAP_COPY MAP_PRIVATE
+# endif
+# ifndef MAP_FILE
   /* Some systems do not have this flag; it is superfluous.  */
-#define        MAP_FILE 0
-#endif
-#ifndef MAP_INHERIT
+#  define MAP_FILE 0
+# endif
+# ifndef MAP_INHERIT
   /* Some systems might lack this; they lose.  */
-#define MAP_INHERIT 0
-#endif
+#  define MAP_INHERIT 0
+# endif
   filedata = (void *) __mmap ((caddr_t) 0, st.st_size, PROT_READ,
                              MAP_FILE|MAP_COPY|MAP_INHERIT, fd, 0);
-  if ((void *) filedata == MAP_FAILED)
+  if ((void *) filedata != MAP_FAILED)
+    {
+      if (st.st_size < sizeof (*filedata))
+       /* This cannot be a locale data file since it's too small.  */
+       goto puntfd;
+    }
+  else
     {
       if (errno == ENOSYS)
        {
+#endif /* _POSIX_MAPPED_FILES */
          /* No mmap; allocate a buffer and read from the file.  */
          mmaped = 0;
          filedata = malloc (st.st_size);
@@ -156,13 +166,12 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
          else
            goto puntfd;
          __set_errno (save_err);
+#ifdef _POSIX_MAPPED_FILES
        }
       else
        goto puntfd;
     }
-  else if (st.st_size < sizeof (*filedata))
-    /* This cannot be a locale data file since it's too small.  */
-    goto puntfd;
+#endif /* _POSIX_MAPPED_FILES */
 
   if (filedata->magic == LIMAGIC (category))
     /* Good data file in our byte order.  */
@@ -175,7 +184,12 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
        /* Bad data file in either byte order.  */
        {
        puntmap:
-         __munmap ((caddr_t) filedata, st.st_size);
+#ifdef _POSIX_MAPPED_FILES
+         if (mmaped)
+           __munmap ((caddr_t) filedata, st.st_size);
+         else
+#endif /* _POSIX_MAPPED_FILES */
+           free (filedata);
        puntfd:
          __close (fd);
          return;
@@ -228,9 +242,11 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
 void
 _nl_unload_locale (struct locale_data *locale)
 {
+#ifdef _POSIX_MAPPED_FILES
   if (locale->mmaped)
     __munmap ((caddr_t) locale->filedata, locale->filesize);
   else
+#endif
     free ((void *) locale->filedata);
 
   free (locale);
index 6d32a3fbfa3e7888ef825239edf95eebf70d46fa..94d62553782666541d441354ef6d424bb582c5dd 100644 (file)
@@ -30,7 +30,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <sys/mman.h>
+#ifdef _POSIX2_LOCALEDEF
+# include <sys/mman.h>
+#endif
 #include <sys/stat.h>
 
 #include "error.h"
@@ -276,10 +278,12 @@ cannot `stat' locale file `%s'"),
                       fname);
 
              localedef->len[cat] = st.st_size;
+#ifdef _POSIX_MAPPED_FILES
              localedef->categories[cat].generic
                = mmap (NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
 
              if (localedef->categories[cat].generic == MAP_FAILED)
+#endif /* _POSIX_MAPPED_FILES */
                {
                  size_t left = st.st_size;
                  void *read_ptr;
index 9c99c67d6795c7b753f5a9f340ea239cb10c176b..3d932db5e3fe82c746d828842e9c629c14114689 100644 (file)
@@ -493,6 +493,10 @@ do {                                                                          \
 #endif
 
 
+#ifndef LACKS_UNISTD_H
+#  include <unistd.h>
+#endif
+
 /*
   Define HAVE_MMAP to optionally make malloc() use mmap() to
   allocate very large blocks.  These will be returned to the
@@ -500,7 +504,9 @@ do {                                                                          \
 */
 
 #ifndef HAVE_MMAP
-#define HAVE_MMAP 1
+# ifdef _POSIX_MAPPED_FILES
+#  define HAVE_MMAP 1
+# endif
 #endif
 
 /*
@@ -541,10 +547,6 @@ do {                                                                          \
   bsd/gnu getpagesize.h
 */
 
-#ifndef LACKS_UNISTD_H
-#  include <unistd.h>
-#endif
-
 #ifndef malloc_getpagesize
 #  ifdef _SC_PAGESIZE         /* some SVR4 systems omit an underscore */
 #    ifndef _SC_PAGE_SIZE
index 4bd958008440baa014ef78af78f0491317899b42..6930b206a7af8704302d67c8ea223196e6d24583 100644 (file)
@@ -140,7 +140,7 @@ override CFLAGS += -Wno-uninitialized -Wno-write-strings
 # It's not a library to make sure it is linked in instead of s_lib_version.o.
 $(objpfx)libieee.a: $(objpfx)ieee-math.o
        rm -f $@
-       ln $< $@
+       $(LN_S) $< $@
 
 ifeq ($(build-shared),yes)
 $(addprefix $(objpfx),$(tests)): $(objpfx)libm.so$(libm.so-version)
index 7a233f54868908c73ce0b222fbd9a23ac656c63a..d7982d2b797878aeb469cbd088bcab170801f7e9 100644 (file)
@@ -57,6 +57,9 @@ routines := brk sbrk sstk ioctl \
            hsearch hsearch_r tsearch lsearch \
            err error ustat \
            getsysstats dirname regexp
+
+include ../Makeconfig
+
 aux := init-misc
 ifeq ($(build-static),yes)
 install-lib := libbsd-compat.a libg.a
similarity index 73%
rename from sysdeps/generic/mkstemp.c
rename to misc/mkstemp.c
index c84e8eb4c2e8feafc5b9fecb15b5b55e3f71e2fe..3fa033bd6b574aaa4bd738a13342dacf8918039a 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1998 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
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <stdlib.h>
-#include <string.h>
 #include <errno.h>
+#include <stdio.h>
+#include <unistd.h>
 
 /* Generate a unique temporary file name from TEMPLATE.
    The last six characters of TEMPLATE must be "XXXXXX";
    they are replaced with a string that makes the filename unique.
-   Returns a file descriptor open on the file for reading and writing.  */
+   Then open the file and return a fd. */
 int
 mkstemp (template)
      char *template;
 {
-  if (strcmp (&template[strlen (template) - 6], "XXXXXX"))
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
+  return __gen_tempname (template, 1, 0);
 }
-
-stub_warning (mkstemp)
-#include <stub-tag.h>
similarity index 77%
rename from sysdeps/generic/mktemp.c
rename to misc/mktemp.c
index 7d53f01c049dc095330c291123788ac4d1f620b2..b2abc5d5e048a5c3fd4df17ab73d99c0d5a265a8 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1998 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,9 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <stdlib.h>
-#include <string.h>
 #include <errno.h>
+#include <stdio.h>
+#include <unistd.h>
 
 /* Generate a unique temporary file name from TEMPLATE.
    The last six characters of TEMPLATE must be "XXXXXX";
@@ -27,15 +27,9 @@ char *
 mktemp (template)
      char *template;
 {
-  if (strcmp (&template[strlen (template) - 6], "XXXXXX"))
-    {
-      __set_errno (EINVAL);
-      return template;
-    }
+  if (__gen_tempname (template, 0, 0) < 0)
+    /* We return the null string if we can't find a unique file name.  */
+    template[0] = '\0';
 
-  __set_errno (ENOSYS);
-  return NULL;
+  return template;
 }
-
-stub_warning (mktemp)
-#include <stub-tag.h>
index daf4960d86c9e8e29f906624e65cb316b4eaab5c..201cb781b79165fbee8bb6e41586515a5cd8d27a 100644 (file)
@@ -52,6 +52,8 @@ routines :=                                                                 \
        getaddrinfo gai_strerror wordexp                                      \
        pread pwrite pread64 pwrite64
 
+include ../Makeconfig
+
 aux            := init-posix environ
 tests          := tstgetopt testfnm runtests wordexp-test runptests
 test-srcs      := globtest
index 62c41c11bbc2ed2daf58e8d84d74681bf5809bbe..484e13d799f8e5560ab692b1444c8cd41968b77f 100644 (file)
@@ -3525,7 +3525,11 @@ re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop)
 
   /* If the search isn't to be a backwards one, don't waste time in a
      search for a pattern that must be anchored.  */
-  if (bufp->used > 0 && (re_opcode_t) bufp->buffer[0] == begbuf && range > 0)
+  if (bufp->used > 0 && range > 0
+      && ((re_opcode_t) bufp->buffer[0] == begbuf
+         /* `begline' is like `begbuf' if it cannot match at newlines.  */
+         || ((re_opcode_t) bufp->buffer[0] == begline
+             && !bufp->newline_anchor)))
     {
       if (startpos > 0)
        return -1;
@@ -5737,7 +5741,7 @@ weak_alias (__regexec, regexec)
    from either regcomp or regexec.   We don't use PREG here.  */
 
 size_t
-__regerror (errcode, preg, errbuf, errbuf_size)
+regerror (errcode, preg, errbuf, errbuf_size)
     int errcode;
     const regex_t *preg;
     char *errbuf;
index 987fbbbabe9105dbc455a3a460ddc31fdc9c956b..8683643c76ff4943439429c833f4c03e65619fe7 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1993, 1996, 1997, 1998 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
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <errno.h>
-#include <stddef.h>
 #include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
 
-
 /* Generate a unique temporary filename using up to five characters of PFX
    if it is not NULL.  The directory to put this file in is searched for
    as follows: First the environment variable "TMPDIR" is checked.
@@ -34,17 +30,12 @@ char *
 tempnam (const char *dir, const char *pfx)
 {
   char buf[FILENAME_MAX];
-  size_t len;
-  char *s;
-  char *t = __stdio_gen_tempname (buf, sizeof (buf), dir, pfx, 1,
-                                 &len, (FILE **) NULL, 0);
 
-  if (t == NULL)
+  if (__path_search (buf, FILENAME_MAX, dir, pfx))
     return NULL;
 
-  s = (char *) malloc (len);
-  if (s == NULL)
+  if (__gen_tempname (buf, 0, 0))
     return NULL;
 
-  return (char *) memcpy (s, t, len);
+  return strdup (buf);
 }
index c3afd3f78b6c5e14a62a2e8d23b67bc9aeb91fda..488b43b1f7452a6a5947083d17ca80d11f4721db 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1993, 1996, 1997, 1998 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
@@ -18,6 +18,9 @@
 
 #include <stdio.h>
 
+#ifdef _USE_IN_LIBIO
+# define fdopen _IO_new_fdopen
+#endif
 
 /* This returns a new stream opened on a temporary file (generated
    by tmpnam) The file is opened with mode "w+b" (binary read/write).
@@ -27,17 +30,20 @@ FILE *
 tmpfile ()
 {
   char buf[FILENAME_MAX];
-  char *filename;
+  int fd;
   FILE *f;
 
-  filename = __stdio_gen_tempname (buf, sizeof (buf), (char *) NULL, "tmpf", 0,
-                                  (size_t *) NULL, &f, 0);
-  if (filename == NULL)
+  if (__path_search (buf, FILENAME_MAX, NULL, "tmpf"))
+    return NULL;
+  if ((fd = __gen_tempname (buf, 1, 0)) < 0)
     return NULL;
 
   /* Note that this relies on the Unix semantics that
      a file is not really removed until it is closed.  */
-  (void) remove (filename);
+  (void) remove (buf);
+
+  if ((f = fdopen (fd, "w+b")) == NULL)
+    close (fd);
 
   return f;
 }
index 5a6e3238fc786a75a79be595550f84679017ebfa..5854f1451d55b89d6f55cd7148d1241cf3aa9354 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1993, 1996, 1997, 1998 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
@@ -19,6 +19,9 @@
 #include <errno.h>
 #include <stdio.h>
 
+#ifdef _USE_IN_LIBIO
+# define fdopen _IO_new_fdopen
+#endif
 
 /* This returns a new stream opened on a temporary file (generated
    by tmpnam) The file is opened with mode "w+b" (binary read/write).
 FILE *
 tmpfile64 ()
 {
-#ifdef _G_OPEN64
   char buf[FILENAME_MAX];
-  char *filename;
+  int fd;
   FILE *f;
 
-  filename = __stdio_gen_tempname (buf, sizeof (buf), (char *) NULL, "tmpf", 0,
-                                  (size_t *) NULL, &f, 1);
-  if (filename == NULL)
+  if (__path_search (buf, FILENAME_MAX, NULL, "tmpf"))
+    return NULL;
+  if ((fd = __gen_tempname (buf, 1, 1)) < 0)
     return NULL;
 
   /* Note that this relies on the Unix semantics that
      a file is not really removed until it is closed.  */
-  (void) remove (filename);
+  (void) remove (buf);
+
+  if ((f = fdopen (fd, "w+b")) == NULL)
+    close (fd);
 
   return f;
-#else
-  __set_errno (ENOSYS);
-  return NULL;
-#endif
 }
index 3389ff57b49bf4ed518bca373454b2e30c856f62..e5c6bf166d81ae1c955a671e291e6fd9c6f58848 100644 (file)
@@ -19,7 +19,6 @@
 #include <stdio.h>
 #include <string.h>
 
-
 /* Generate a unique filename in P_tmpdir.
 
    This function is *not* thread safe!  */
@@ -30,20 +29,21 @@ tmpnam (char *s)
      where S != NULL.  */
   static char buf[L_tmpnam];
   char tmpbuf[L_tmpnam];
-  char *result;
 
   /* In the following call we use the buffer pointed to by S if
      non-NULL although we don't know the size.  But we limit the size
-     to FILENAME_MAX characters in any case.  */
-  result = __stdio_gen_tempname (s ?: tmpbuf, L_tmpnam, (const char *) NULL,
-                                (const char *) NULL, 0,
-                                (size_t *) NULL, (FILE **) NULL, 0);
+     to L_tmpnam characters in any case.  */
+  if (__path_search (s ? : tmpbuf, L_tmpnam, NULL, NULL))
+    return NULL;
+
+  if (__gen_tempname (s ? : tmpbuf, 0, 0))
+    return NULL;
 
-  if (result != NULL && s == NULL)
+  if (s == NULL)
     {
-      memcpy (buf, result, L_tmpnam);
-      result = buf;
+      memcpy (buf, tmpbuf, L_tmpnam);
+      return buf;
     }
-
-  return result;
+  else
+    return s;
 }
index 5e67cc68456ba3ada3116fd7354f6b25d567c0ab..07c4650cc0304f0be0170151ce44b6ce52eaf300 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1993, 1996, 1997, 1998 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
@@ -17,8 +17,6 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <stdio.h>
-#include <string.h>
-
 
 /* Generate a unique filename in P_tmpdir.  If S is NULL return NULL.
    This makes this function thread safe.  */
@@ -28,10 +26,10 @@ tmpnam_r (char *s)
   if (s == NULL)
     return NULL;
 
-  /* In the following call we use the buffer pointed to by S if
-     non-NULL although we don't know the size.  But we limit the size
-     to L_tmpnam characters in any case.  */
-  return __stdio_gen_tempname (s, L_tmpnam, (const char *) NULL,
-                              (const char *) NULL, 0,
-                              (size_t *) NULL, (FILE **) NULL, 0);
+  if (__path_search (s, L_tmpnam, NULL, NULL))
+    return NULL;
+  if (__gen_tempname (s, 0, 0))
+    return NULL;
+
+  return s;
 }
index 7594f138406f49c22be7869fb7d0b516a2111c94..2214302b68abe8ccab738c23e4187faf7f232a3a 100644 (file)
@@ -155,14 +155,13 @@ extern int __stdio_open __P ((__const char *__file, __io_mode __m,
                              __ptr_t *__cookieptr));
 /* Put out an error message for when stdio needs to die.  */
 extern void __stdio_errmsg __P ((__const char *__msg, size_t __len));
-/* Generate a unique file name (and possibly open it with mode "w+b").  */
-extern char *__stdio_gen_tempname __P ((char *__buf, size_t __bufsize,
-                                       __const char *__dir,
-                                       __const char *__pfx,
-                                       int __dir_search,
-                                       size_t *__lenptr,
-                                       FILE **__streamptr,
-                                       int __large_file));
+
+/* Generate a unique file name (and possibly open it).  */
+extern int __path_search __P ((char *__tmpl, size_t __tmpl_len,
+                              __const char *__dir,
+                              __const char *__pfx));
+
+extern int __gen_tempname __P ((char *__tmpl, int __openit, int __large_file));
 
 
 /* Print out MESSAGE on the error output and abort.  */
index 2dac9937f37d266a664e5d3d08448eb678237570..c96fe4fa6424bb93a6f3ecffac2c9256c76ccfa1 100644 (file)
@@ -109,6 +109,10 @@ CFLAGS-xnfs_prot.c = -Wno-unused
 CFLAGS-xrquota.c = -Wno-unused
 CFLAGS-xkey_prot.c = -Wno-unused
 
+ifeq (yes,$(have_doors))
+CPPFLAGS-key_call.c += -DHAVE_DOORS=1
+endif
+
 include ../Rules
 
 $(objpfx)rpcgen: $(addprefix $(objpfx),$(rpcgen-objs)) \
index 64b9ca9731ebbf0dca4c01ca9cc807e751730f35..ad12d5fa8911fe264b13c14e1773276faadc0760 100644 (file)
@@ -458,7 +458,10 @@ __msgread (int sock, void *buf, size_t cnt)
   msg.msg_controllen = sizeof(struct cmessage);
   msg.msg_flags = 0;
 
-  setsockopt (sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof (on));
+#ifdef SO_PASSCRED
+  if (setsockopt (sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof (on)))
+    return -1;
+#endif
 
   return recvmsg (sock, &msg, 0);
 }
index 0219eaf5ad0ad777fffe91f75ab28c1f17e1d194..0aa49cc78a6ce6863bafd1d46b52d2b4f9da6b26 100644 (file)
@@ -32,8 +32,8 @@
 
 /*
  * The original source is from the RPCSRC 4.0 package from Sun Microsystems.
- * The Interface to keyserver protocoll 2 was added by
- * Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
+ * The Interface to keyserver protocoll 2, RPC over AF_UNIX und Linux/doors
+ * was added by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
  */
 
 #include <stdio.h>
 #include <rpc/key_prot.h>
 #include <bits/libc-lock.h>
 
+#ifdef HAVE_DOORS
+# include "door/door.h"
+#endif
+
 #define KEY_TIMEOUT    5       /* per-try timeout in seconds */
 #define KEY_NRETRY     12      /* number of retries */
 
@@ -479,13 +483,82 @@ key_call_socket (u_long proc, xdrproc_t xdr_arg, char *arg,
   return result;
 }
 
-/* returns  0 on failure, 1 on success */
+#ifdef HAVE_DOORS
+/* returns 0 on failure, 1 on success */
+static int
+internal_function
+key_call_door (u_long proc, xdrproc_t xdr_arg, char *arg,
+              xdrproc_t xdr_rslt, char *rslt)
+{
+  XDR xdrs;
+  int fd;
+  door_arg_t args;
+  char *data_ptr;
+  u_long data_len = 0;
+  char res[255];
+
+  if ((fd = open("/var/run/keyservdoor", O_RDONLY)) < 0)
+    return 0;
+  res[0] = 0;
+
+  data_len = xdr_sizeof (xdr_arg, arg);
+  data_ptr = calloc (1, data_len + 2 * sizeof (u_long));
+  if (data_ptr == NULL)
+    return 0;
+
+  xdrmem_create (&xdrs, &data_ptr[2 * sizeof (u_long)], data_len, XDR_ENCODE);
+  if (!xdr_arg (&xdrs, arg))
+    {
+      xdr_destroy (&xdrs);
+      free (data_ptr);
+      return 0;
+    }
+  xdr_destroy (&xdrs);
+
+  memcpy (data_ptr, &proc, sizeof (u_long));
+  memcpy (&data_ptr[sizeof (proc)], &data_len, sizeof (u_long));
+
+  args.data_ptr = data_ptr;
+  args.data_size = data_len + 2 * sizeof (u_long);
+  args.desc_ptr = NULL;
+  args.desc_num = 0;
+  args.rbuf = res;
+  args.rsize = sizeof (res);
+
+  if (__door_call (fd, &args) < 0)
+    return 0;
+
+  free (data_ptr);
+  close (fd);
+
+  memcpy (&data_len, args.data_ptr, sizeof (u_long));
+  if (data_len != 0)
+    return 0;
+
+  memcpy (&data_len, &args.data_ptr[sizeof (u_long)], sizeof (u_long));
+  xdrmem_create (&xdrs, &args.data_ptr[2 * sizeof (u_long)],
+                 data_len, XDR_DECODE);
+  if (!xdr_rslt (&xdrs, rslt))
+    {
+      xdr_destroy (&xdrs);
+      return 0;
+    }
+  xdr_destroy (&xdrs);
+
+  return 1;
+}
+#endif
+
+/* returns 0 on failure, 1 on success */
 static int
 internal_function
 key_call (u_long proc, xdrproc_t xdr_arg, char *arg,
          xdrproc_t xdr_rslt, char *rslt)
 {
   static int use_keyenvoy = 0;
+#ifdef HAVE_DOORS
+  static int use_doors = 1;
+#endif
 
   if (proc == KEY_ENCRYPT_PK && __key_encryptsession_pk_LOCAL)
     {
@@ -509,6 +582,14 @@ key_call (u_long proc, xdrproc_t xdr_arg, char *arg,
       return 1;
     }
 
+#ifdef HAVE_DOORS
+  if (use_doors)
+    {
+      if (key_call_door (proc, xdr_arg, arg, xdr_rslt, rslt))
+       return 1;
+      use_doors = 0;
+    }
+#endif
   if (!use_keyenvoy)
     {
       if (key_call_socket (proc, xdr_arg, arg, xdr_rslt, rslt))
index a8ed53463ec4992e1d7a63f95d07530229f5aafb..c42d30ed83c0f6410210206ae2bbd779b6da4c16 100644 (file)
@@ -307,7 +307,10 @@ __msgread (int sock, void *buf, size_t cnt)
   msg.msg_controllen = sizeof (struct cmessage);
   msg.msg_flags = 0;
 
-  setsockopt (sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof (on));
+#ifdef SO_PASSCRED
+  if (setsockopt (sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof (on)))
+    return -1;
+#endif
 
   return recvmsg (sock, &msg, 0);
 }
index 7423e118f072bf1b0785841e304f78abf04b7811..7ae21515b938ed00f7ddd703d91ad535c89e8be9 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995, 1996, 1997, 1998 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,7 +20,7 @@
 #include <sys/types.h>
 
 /* Get the process group ID of process PID.  */
-int
+pid_t
 __getpgid (pid)
      pid_t pid;
 {
index bd92d683249846fdb2407dc4e091f2b408b0e195..5fc094ebe70bdb5b1dd78b06dad53181ca923622 100644 (file)
@@ -511,7 +511,7 @@ glob (pattern, flags, errfunc, pglob)
         case is nothing but a notation for a directory.  */
       if ((flags & (GLOB_TILDE|GLOB_TILDE_CHECK)) && pattern[0] == '~')
        {
-         dirname = (char *) pattern;
+         dirname = pattern;
          dirlen = strlen (pattern);
 
          /* Set FILENAME to NULL as a special flag.  This is ugly but
index f5d1ed03454686bba522a60710bd446d6b7eeef4..c17d86967df7996ec0f148a1e073b3ce2d2c7ed7 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 95, 96, 97 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 95, 96, 97, 98 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
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <errno.h>
+#define __need_size_t
+#include <stddef.h>
 #include <stdio.h>
+#include <errno.h>
 
-/* Generate a (hopefully) unique temporary filename
-   in DIR (if applicable), using prefix PFX.
-   If DIR_SEARCH is nonzero, perform directory searching
-   malarkey as per the SVID for tempnam.
-   Return the generated filename or NULL if one could not
-   be generated, putting the length of the string in *LENPTR.  */
-char *
-__stdio_gen_tempname (buf, bufsize, dir, pfx, dir_search, lenptr, streamptr,
-                     large_file)
-     char *buf;
-     size_t bufsize;
+/* Perform the "SVID path search malarkey" on DIR and PFX.  Write a
+   template suitable for use in __gen_tempname into TMPL, bounded
+   by TMPL_LEN. */
+int
+__path_search (tmpl, tmpl_len, dir, pfx)
+     char *tmpl;
+     size_t tmpl_len;
      const char *dir;
      const char *pfx;
-     int dir_search;
-     size_t *lenptr;
-     FILE **streamptr;
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (__path_search)
+
+/* Generate a (hopefully) unique temporary filename
+   in DIR (if applicable), using template TMPL.
+   If OPENIT is 1, open the file and return a fd.  If LARGEFILE is 1,
+   use open64() to do that. */
+     int
+       __gen_tempname (tmpl, openit, largefile)
+     char *tmpl;
+     int openit;
      int large_file;
 {
-  *lenptr = 0;
   __set_errno (ENOSYS);
-  return NULL;
+  return -1;
 }
 
-stub_warning (__stdio_gen_tempname)
+stub_warning (__gen_tempname)
 #include <stub-tag.h>
diff --git a/sysdeps/posix/mkstemp.c b/sysdeps/posix/mkstemp.c
deleted file mode 100644 (file)
index d380935..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/* Copyright (C) 1991, 1992, 1996, 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/time.h>
-
-/* Generate a unique temporary file name from TEMPLATE.
-   The last six characters of TEMPLATE must be "XXXXXX";
-   they are replaced with a string that makes the filename unique.
-   Returns a file descriptor open on the file for reading and writing.  */
-int
-mkstemp (template)
-     char *template;
-{
-  static const char letters[62]
-    = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
-  static uint64_t value;
-  struct timeval tv;
-  char *XXXXXX;
-  size_t len;
-  int count;
-
-  len = strlen (template);
-  if (len < 6 || strcmp (&template[len - 6], "XXXXXX"))
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  /* This is where the Xs start.  */
-  XXXXXX = &template[len - 6];
-
-  /* Get some more or less random data.  */
-  __gettimeofday (&tv, NULL);
-  value += ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec ^ __getpid ();
-
-  for (count = 0; count < TMP_MAX; ++count)
-    {
-      uint64_t v = value;
-      int fd;
-
-      /* Fill in the random bits.  */
-      XXXXXX[0] = letters[v % 62];
-      v /= 62;
-      XXXXXX[1] = letters[v % 62];
-      v /= 62;
-      XXXXXX[2] = letters[v % 62];
-      v /= 62;
-      XXXXXX[3] = letters[v % 62];
-      v /= 62;
-      XXXXXX[4] = letters[v % 62];
-      v /= 62;
-      XXXXXX[5] = letters[v % 62];
-
-      fd = __open (template, O_RDWR|O_CREAT|O_EXCL, 0600);
-      if (fd >= 0)
-       /* The file does not exist.  */
-       return fd;
-
-      /* This is a random value.  It is only necessary that the next
-        TMP_MAX values generated by adding 7777 to VALUE are different
-        with (module 2^32).  */
-      value += 7777;
-    }
-
-  /* We return the null string if we can't find a unique file name.  */
-  template[0] = '\0';
-  return -1;
-}
diff --git a/sysdeps/posix/mktemp.c b/sysdeps/posix/mktemp.c
deleted file mode 100644 (file)
index e9a576c..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/* Copyright (C) 1991, 1992, 1993, 1996, 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include <errno.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/types.h>
-
-/* Generate a unique temporary file name from TEMPLATE.
-   The last six characters of TEMPLATE must be "XXXXXX";
-   they are replaced with a string that makes the filename unique.  */
-char *
-mktemp (template)
-     char *template;
-{
-  static const char letters[]
-    = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
-  static uint64_t value;
-  struct timeval tv;
-  char *XXXXXX;
-  size_t len;
-  int count;
-
-  len = strlen (template);
-  if (len < 6 || strcmp (&template[len - 6], "XXXXXX"))
-    {
-      __set_errno (EINVAL);
-      return NULL;
-    }
-
-  /* This is where the Xs start.  */
-  XXXXXX = &template[len - 6];
-
-  /* Get some more or less random data.  */
-  __gettimeofday (&tv, NULL);
-  value += ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec ^ __getpid ();
-
-  for (count = 0; count < TMP_MAX; ++count)
-    {
-      struct stat ignored;
-      uint64_t v = value;
-
-      /* Fill in the random bits.  */
-      XXXXXX[0] = letters[v % 62];
-      v /= 62;
-      XXXXXX[1] = letters[v % 62];
-      v /= 62;
-      XXXXXX[2] = letters[v % 62];
-      v /= 62;
-      XXXXXX[3] = letters[v % 62];
-      v /= 62;
-      XXXXXX[4] = letters[v % 62];
-      v /= 62;
-      XXXXXX[5] = letters[v % 62];
-
-      if (stat (template, &ignored) < 0 && errno == ENOENT)
-       /* The file does not exist.  So return this name.  */
-       return template;
-
-      /* This is a random value.  It is only necessary that the next
-        TMP_MAX values generated by adding 7777 to VALUE are different
-        with (module 2^32).  */
-      value += 7777;
-    }
-
-  /* We return the null string if we can't find a unique file name.  */
-  template[0] = '\0';
-  return template;
-}
index 82e024313276f91b1320855f5a530c4049f4141c..6dd893e613e71879feb18012305baad73c450d12 100644 (file)
 #include <unistd.h>
 #include <sys/time.h>
 
-#ifdef USE_IN_LIBIO
-# include "libioP.h"
-# include <libio.h>
-#endif
-
 /* Return nonzero if DIR is an existent directory.  */
 static int
-diraccess (const char *dir)
+direxists (const char *dir)
 {
   struct stat buf;
   return __stat (dir, &buf) == 0 && S_ISDIR (buf.st_mode);
 }
 
-/* Return nonzero if FILE exists.  */
-static int
-exists (const char *file)
+/* Path search algorithm, for tmpnam, tmpfile, etc.  If DIR is
+   non-null and exists, uses it; otherwise uses the first of $TMPDIR,
+   P_tmpdir, /tmp that exists.  Copies into TMPL a template suitable
+   for use with mk[s]temp.  Will fail (-1) if DIR is non-null and
+   doesn't exist, none of the searched dirs exists, or there's not
+   enough space in TMPL. */
+int
+__path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx)
 {
-  /* We can stat the file even if we can't read its data.  */
-  struct stat st;
-  int save = errno;
-  if (__stat (file, &st) == 0)
-    return 1;
+  const char *d;
+  size_t dlen, plen;
+
+  if (!pfx || !pfx[0])
+    {
+      pfx = "file";
+      plen = 4;
+    }
   else
     {
-      /* We report that the file exists if stat failed for a reason other
-        than nonexistence.  In this case, it may or may not exist, and we
-        don't know; but reporting that it does exist will never cause any
-        trouble, while reporting that it doesn't exist when it does would
-        violate the interface of __stdio_gen_tempname.  */
-      int exists = errno != ENOENT;
-      __set_errno (save);
-      return exists;
+      plen = strlen (pfx);
+      if (plen > 5)
+       plen = 5;
     }
-}
 
-
-/* These are the characters used in temporary filenames.  */
-static const char letters[] =
-  "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
-
-/* Generate a temporary filename and return it (in a static buffer).  If
-   STREAMPTR is not NULL, open a stream "w+b" on the file and set
-   *STREAMPTR to it.  If DIR_SEARCH is nonzero, DIR and PFX are used as
-   described for tempnam.  If not, a temporary filename in P_tmpdir with no
-   special prefix is generated.  If LENPTR is not NULL, *LENPTR is set the
-   to length (including the terminating '\0') of the resultant filename,
-   which is returned.  This goes through a cyclic pattern of all possible
-   filenames consisting of five decimal digits of the current pid and three
-   of the characters in `letters'.  Data for tempnam and tmpnam is kept
-   separate, but when tempnam is using P_tmpdir and no prefix (i.e, it is
-   identical to tmpnam), the same data is used.  Each potential filename is
-   tested for an already-existing file of the same name, and no name of an
-   existing file will be returned.  When the cycle reaches its end
-   (12345ZZZ), NULL is returned.  */
-char *
-__stdio_gen_tempname (char *buf, size_t bufsize, const char *dir,
-                     const char *pfx, int dir_search, size_t *lenptr,
-                     FILE **streamptr, int large_file)
-{
-  int saverrno = errno;
-  static const char tmpdir[] = P_tmpdir;
-  size_t plen, dlen, len;
-  char *XXXXXX;
-  static uint64_t value;
-  struct timeval tv;
-  int count;
-
-  if (dir_search)
+  d = __secure_getenv ("TMPDIR");
+  if (d != NULL && direxists (d))
+    dir = d;
+  else if (dir != NULL && direxists (dir))
+    /* nothing */ ;
+  else if (direxists (P_tmpdir))
+    dir = P_tmpdir;
+  else if (direxists ("/tmp"))
+    dir = "/tmp";
+  else
     {
-      register const char *d = __secure_getenv ("TMPDIR");
-      if (d != NULL && !diraccess (d))
-       d = NULL;
-      if (d == NULL && dir != NULL && diraccess (dir))
-       d = dir;
-      if (d == NULL && diraccess (tmpdir))
-       d = tmpdir;
-      if (d == NULL && diraccess ("/tmp"))
-       d = "/tmp";
-      if (d == NULL)
-       {
-         __set_errno (ENOENT);
-         return NULL;
-       }
-      dir = d;
+      __set_errno (ENOENT);
+      return -1;
     }
-  else
-    dir = tmpdir;
 
   dlen = strlen (dir);
-
- /* Remove trailing slashes from the directory name.  */
   while (dlen > 1 && dir[dlen - 1] == '/')
-    --dlen;
+    dlen--;                    /* remove trailing slashes */
 
-  if (pfx != NULL && *pfx != '\0')
+  /* check we have room for "${dir}/${pfx}XXXXXX\0" */
+  if (tmpl_len < dlen + 1 + plen + 6 + 1)
     {
-      plen = strlen (pfx);
-      if (plen > 5)
-       plen = 5;
+      __set_errno (EINVAL);
+      return -1;
     }
-  else
-    plen = 0;
 
-  len = __snprintf (buf, bufsize, "%.*s/%.*sXXXXXX",
-             (int) dlen, dir, (int) plen, pfx);
+  sprintf (tmpl, "%*s/%*sXXXXXX", dlen, dir, plen, pfx);
+  return 0;
+}
+
+/* These are the characters used in temporary filenames.  */
+static const char letters[] =
+"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+
+/* Generate a temporary file name based on TMPL.  TMPL must match the
+   rules for mk[s]temp (i.e. end in "XXXXXX").  The name constructed
+   does not exist at the time of the call to __gen_tempname.  TMPL is
+   overwritten with the result.  If OPENIT is nonzero, creates the
+   file and returns a read-write fd; the file is mode 0600 modulo
+   umask.  If LARGEFILE is nonzero, uses open64() instead of open().
+
+   We use a clever algorithm to get hard-to-predict names. */
+int
+__gen_tempname (char *tmpl, int openit, int largefile)
+{
+  int len;
+  char *XXXXXX;
+  static uint64_t value;
+  struct timeval tv;
+  int count, fd;
+  int save_errno = errno;
 
-  if (len < dlen + plen + 7)
-  {
+  len = strlen (tmpl);
+  if (len < 6 || strcmp (&tmpl[len - 6], "XXXXXX"))
+    {
       __set_errno (EINVAL);
-      return NULL;
-  }
+      return -1;
+    }
 
-  XXXXXX = &buf[dlen + plen + 1];
+  /* This is where the Xs start.  */
+  XXXXXX = &tmpl[len - 6];
 
   /* Get some more or less random data.  */
   __gettimeofday (&tv, NULL);
@@ -163,116 +143,45 @@ __stdio_gen_tempname (char *buf, size_t bufsize, const char *dir,
       v /= 62;
       XXXXXX[5] = letters[v % 62];
 
-      if (streamptr != NULL)
+      if (openit)
        {
-         /* Try to create the file atomically.  */
-#ifdef _G_OPEN64
-         int fd = (large_file
-                   ? __open (buf, O_RDWR|O_CREAT|O_EXCL, 0666)
-                   : _G_OPEN64 (buf, O_RDWR|O_CREAT|O_EXCL, 0666));
+         /* XXX Do we want to fail on largefile if 64 bit fileops
+            are not implemented, or just fall back to the old stuff? */
+#ifndef __stub_open64
+         fd = (largefile
+               ? __open (tmpl, O_RDWR | O_CREAT | O_EXCL, 0666)
+               : __open64 (tmpl, O_RDWR | O_CREAT | O_EXCL, 0666));
 #else
-         int fd = __open (buf, O_RDWR|O_CREAT|O_EXCL, 0666);
+         fd = __open (tmpl, O_RDWR | O_CREAT | O_EXCL, 0666);
 #endif
          if (fd >= 0)
            {
-             /* We got a new file that did not previously exist.
-                Create a stream for it.  */
-#ifdef USE_IN_LIBIO
-             int save;
-             struct locked_FILE
-               {
-                 struct _IO_FILE_plus fp;
-#ifdef _IO_MTSAFE_IO
-                 _IO_lock_t lock;
-#endif
-               } *new_f;
-             struct _IO_FILE_plus *fp;
-
-             new_f = (struct locked_FILE *)
-               malloc (sizeof (struct locked_FILE));
-             if (new_f == NULL)
-               {
-                 /* We lost trying to create a stream (out of memory?).
-                    Nothing to do but remove the file, close the descriptor,
-                    and return failure.  */
-                 save = errno;
-               lose:
-                 (void) remove (buf);
-                 (void) __close (fd);
-                 __set_errno (save);
-                 return NULL;
-               }
-             fp = &new_f->fp;
-#ifdef _IO_MTSAFE_IO
-             fp->file._lock = &new_f->lock;
-#endif
-             _IO_init (&fp->file, 0);
-             _IO_JUMPS (&fp->file) = &_IO_file_jumps;
-             _IO_file_init (&fp->file);
-# if !_IO_UNIFIED_JUMPTABLES
-             fp->vtable = NULL;
-# endif
-             if (_IO_file_attach (&fp->file, fd) == NULL)
-               {
-                 save = errno;
-                 free (fp);
-                 goto lose;
-               }
-             fp->file._flags &= ~_IO_DELETE_DONT_CLOSE;
-
-             *streamptr = (FILE *) fp;
-#else
-             *streamptr = __newstream ();
-             if (*streamptr == NULL)
+             __set_errno (save_errno);
+             return fd;
+           }
+         else if (errno != EEXIST)
+           /* Any other error will apply also to other names we might
+              try, and there are 2^32 or so of them, so give up now. */
+           return -1;
+       }
+      else
+       {
+         struct stat st;
+         if (__stat (tmpl, &st) < 0)
+           {
+             if (errno == ENOENT)
                {
-                 /* We lost trying to create a stream (out of memory?).
-                    Nothing to do but remove the file, close the descriptor,
-                    and return failure.  */
-                 const int save = errno;
-                 (void) remove (buf);
-                 (void) __close (fd);
-                 __set_errno (save);
-                 return NULL;
+                 __set_errno (save_errno);
+                 return 0;
                }
-             (*streamptr)->__cookie = (__ptr_t) (long int) fd;
-             (*streamptr)->__mode.__write = 1;
-             (*streamptr)->__mode.__read = 1;
-             (*streamptr)->__mode.__binary = 1;
-#endif
+             else
+               /* Give up now. */
+               return -1;
            }
-#if defined EMFILE || defined ENFILE || defined EINTR
-         else if (0
-# ifdef EMFILE
-                  || errno == EMFILE
-# endif
-# ifdef ENFILE
-                  || errno == ENFILE
-# endif
-# ifdef EINTR
-                  || errno == EINTR
-# endif
-                  )
-           /* We cannot open anymore files since all descriptors are
-              used or because we got a signal.  */
-           return NULL;
-#endif
-         else
-           continue;
        }
-      else if (exists (buf))
-       continue;
-
-      /* If the file already existed we have continued the loop above,
-        so we only get here when we have a winning name to return.  */
-
-      __set_errno (saverrno);
-
-      if (lenptr != NULL)
-       *lenptr = len + 1;
-      return buf;
     }
 
   /* We got out of the loop because we ran out of combinations to try.  */
-  __set_errno (EEXIST);                /* ? */
-  return NULL;
+  __set_errno (EEXIST);
+  return -1;
 }