]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Sun, 2 Apr 2000 08:05:36 +0000 (08:05 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sun, 2 Apr 2000 08:05:36 +0000 (08:05 +0000)
* posix/unistd.h (socklen_t): Define if it has not yet happened.
(gethostname): Change type of second parameter to socklen_t.
* include/unistd.h (__gethostname): Change type of second
parameter to socklen_t.
* sysdeps/generic/gethostname.c (__gethostname): Likewise.
* sysdeps/mach/hurd/gethostname.c (__gethostname): Likewise.
* sysdeps/unix/sysv/gethostname.c (__gethostname): Likewise.
* sysdeps/unix/sysv/sysv4/solaris2/gethostname.c (__gethostname):
Likewise.
* sysdeps/unix/sysv/linux/gethostname.c: Removed.
* sysdeps/generic/bits/socket.h: Use __socklen_t to define socklen_t.
Allow definition elsewhere.
* sysdeps/unix/sysv/aix/bits/socket.h: Likewise.
* sysdeps/unix/sysv/linux/bits/socket.h: Likewise.
* sysdeps/unix/sysv/linux/mips/bits/socket.h: Likewise.
* sysdeps/generic/bits/types.h: Define __socklen_t.
* sysdeps/unix/sysv/aix/bits/types.h: Likewise.
* sysdeps/unix/sysv/hpux/bits/types.h: Likewise.
* sysdeps/unix/sysv/linux/alpha/bits/types.h: Likewise.
* sysdeps/unix/sysv/linux/bits/types.h: Likewise.
* sysdeps/unix/sysv/linux/mips/bits/types.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/bits/types.h: Likewise.
* sysdeps/unix/sysv/sysv4/solaris2/bits/types.h: Likewise.

22 files changed:
ChangeLog
bits/socket.h
bits/types.h
include/unistd.h
posix/unistd.h
sysdeps/generic/bits/socket.h
sysdeps/generic/bits/types.h
sysdeps/generic/gethostname.c
sysdeps/mach/hurd/gethostname.c
sysdeps/unix/sysv/aix/bits/socket.h
sysdeps/unix/sysv/aix/bits/types.h
sysdeps/unix/sysv/gethostname.c
sysdeps/unix/sysv/hpux/bits/types.h
sysdeps/unix/sysv/linux/alpha/bits/types.h
sysdeps/unix/sysv/linux/bits/socket.h
sysdeps/unix/sysv/linux/bits/types.h
sysdeps/unix/sysv/linux/gethostname.c [deleted file]
sysdeps/unix/sysv/linux/mips/bits/socket.h
sysdeps/unix/sysv/linux/mips/bits/types.h
sysdeps/unix/sysv/linux/sparc/bits/types.h
sysdeps/unix/sysv/sysv4/gethostname.c
sysdeps/unix/sysv/sysv4/solaris2/bits/types.h

index 927300200523c2222a573c08b05df2e6554f4fde..592d70df46743df1a91a1657c62f41b035d0430b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,29 @@
 2000-04-01  Ulrich Drepper  <drepper@redhat.com>
 
+       * posix/unistd.h (socklen_t): Define if it has not yet happened.
+       (gethostname): Change type of second parameter to socklen_t.
+       * include/unistd.h (__gethostname): Change type of second
+       parameter to socklen_t.
+       * sysdeps/generic/gethostname.c (__gethostname): Likewise.
+       * sysdeps/mach/hurd/gethostname.c (__gethostname): Likewise.
+       * sysdeps/unix/sysv/gethostname.c (__gethostname): Likewise.
+       * sysdeps/unix/sysv/sysv4/solaris2/gethostname.c (__gethostname):
+       Likewise.
+       * sysdeps/unix/sysv/linux/gethostname.c: Removed.
+       * sysdeps/generic/bits/socket.h: Use __socklen_t to define socklen_t.
+       Allow definition elsewhere.
+       * sysdeps/unix/sysv/aix/bits/socket.h: Likewise.
+       * sysdeps/unix/sysv/linux/bits/socket.h: Likewise.
+       * sysdeps/unix/sysv/linux/mips/bits/socket.h: Likewise.
+       * sysdeps/generic/bits/types.h: Define __socklen_t.
+       * sysdeps/unix/sysv/aix/bits/types.h: Likewise.
+       * sysdeps/unix/sysv/hpux/bits/types.h: Likewise.
+       * sysdeps/unix/sysv/linux/alpha/bits/types.h: Likewise.
+       * sysdeps/unix/sysv/linux/bits/types.h: Likewise.
+       * sysdeps/unix/sysv/linux/mips/bits/types.h: Likewise.
+       * sysdeps/unix/sysv/linux/sparc/bits/types.h: Likewise.
+       * sysdeps/unix/sysv/sysv4/solaris2/bits/types.h: Likewise.
+
        * inet/arpa/inet.h (inet_addr): Change return type to in_addr_t.
        (inet_lnaof): Likewise.
        (inet_netof): Likewise.
index 7828d01bb3386f098bb79092c12b4f99c19a041d..4f29d83d780abc208f5ee765b0d76d20e6628ffa 100644 (file)
 #include <stddef.h>
 
 /* Type for length arguments in socket calls.  */
-typedef unsigned int socklen_t;
+#ifndef __socklen_t_defined
+typedef __socklen_t socklen_t;
+# define __socklen_t_defined
+#endif
 
 
 /* Types of sockets.  */
index fd9818e15d5b9650ba4dee4ba6da6f6bd8a15ea9..a7b736dffccd98e0db6dffa919c1e0bc62ed56b9 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,94,95,96,97,98,99 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,94,95,96,97,98,99, 2000 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
@@ -139,4 +139,7 @@ typedef unsigned int __t_uscalar_t;
 /* Duplicates info from stdint.h but this is used in unistd.h.  */
 typedef long int __intptr_t;
 
+/* Duplicate info from sys/socket.h.  */
+typedef unsigned int __socklen_t;
+
 #endif /* bits/types.h */
index 68dd2254ec3f8e23c9343ab68a117d3e3f8a422c..f9f55cf456612050aa3d5f45ba581c58487691e6 100644 (file)
@@ -70,7 +70,7 @@ extern int __link (__const char *__from, __const char *__to);
 extern int __symlink (__const char *__from, __const char *__to);
 extern int __readlink (__const char *__path, char *__buf, size_t __len);
 extern int __unlink (__const char *__name);
-extern int __gethostname (char *__name, size_t __len);
+extern int __gethostname (char *__name, socklen_t __len);
 extern int __profil (unsigned short int *__sample_buffer, size_t __size,
                     size_t __offset, unsigned int __scale);
 extern int __getdtablesize (void);
index e482d1b2569a958e2968a213e72410f77eec8d66..1bae2749817be763d8011bf98ab57b595e79f3f5 100644 (file)
@@ -242,6 +242,13 @@ typedef __intptr_t intptr_t;
 # endif
 #endif
 
+#if defined __USE_BSD || defined __USE_XOPEN
+# ifndef __socklen_t_defined
+typedef __socklen_t socklen_t;
+#  define __socklen_t_defined
+# endif
+#endif
+
 /* Values for the second argument to access.
    These may be OR'd together.  */
 #define        R_OK    4               /* Test for read permission.  */
@@ -735,7 +742,7 @@ extern int setlogin (__const char *__name) __THROW;
 /* Put the name of the current host in no more than LEN bytes of NAME.
    The result is null-terminated if LEN is large enough for the full
    name and the terminator.  */
-extern int gethostname (char *__name, size_t __len) __THROW;
+extern int gethostname (char *__name, socklen_t __len) __THROW;
 
 /* Set the name of the current host to NAME, which is LEN bytes long.
    This call is restricted to the super-user.  */
index 7828d01bb3386f098bb79092c12b4f99c19a041d..4f29d83d780abc208f5ee765b0d76d20e6628ffa 100644 (file)
 #include <stddef.h>
 
 /* Type for length arguments in socket calls.  */
-typedef unsigned int socklen_t;
+#ifndef __socklen_t_defined
+typedef __socklen_t socklen_t;
+# define __socklen_t_defined
+#endif
 
 
 /* Types of sockets.  */
index fd9818e15d5b9650ba4dee4ba6da6f6bd8a15ea9..a7b736dffccd98e0db6dffa919c1e0bc62ed56b9 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,94,95,96,97,98,99 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,94,95,96,97,98,99, 2000 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
@@ -139,4 +139,7 @@ typedef unsigned int __t_uscalar_t;
 /* Duplicates info from stdint.h but this is used in unistd.h.  */
 typedef long int __intptr_t;
 
+/* Duplicate info from sys/socket.h.  */
+typedef unsigned int __socklen_t;
+
 #endif /* bits/types.h */
index ad09b008277a42b8e2c8d52ed67c79118566a815..6c3e1167ab329a70a2381beeaceb5d2553a3c4aa 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995, 1996, 1997, 2000 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
@@ -25,7 +25,7 @@
 int
 __gethostname (name, len)
      char *name;
-     size_t len;
+     socklen_t len;
 {
   __set_errno (ENOSYS);
   return -1;
index 2f63befa0c965ff20899a6bdffb30af51a945349..b74945ba792cb4bf179bae9415f96d02fc1eed23 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1997, 2000 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
@@ -25,7 +25,7 @@
 int
 __gethostname (name, len)
      char *name;
-     size_t len;
+     socklen_t len;
 {
   /* The host name is just the contents of the file /etc/hostname.  */
   ssize_t n = _hurd_get_host_config ("/etc/hostname", name, len);
index e89735453ae4188b01c15d15d32e0dfca291d9b7..eb5b766e240d16ff7ff61dee2b06366426409aba 100644 (file)
 #include <sys/types.h>
 
 /* Type for length arguments in socket calls.  */
-typedef unsigned int socklen_t;
+#ifndef __socklen_t_defined
+typedef __socklen_t socklen_t;
+# define __socklen_t_defined
+#endif
 
 /* Types of sockets.  */
 enum __socket_type
index c41b34c1efd25b5f07ef522db6adaa53cde1b920..830dcea7b0ab36ecb2d3d30662349b4d134d63ae 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,94,95,96,97,98,99 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,94,95,96,97,98,99, 2000 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
@@ -145,4 +145,7 @@ typedef unsigned int __t_uscalar_t;
 /* Duplicates info from stdint.h but this is used in unistd.h.  */
 typedef int __intptr_t;
 
+/* Duplicate info from sys/socket.h.  */
+typedef unsigned int __socklen_t;
+
 #endif /* bits/types.h */
index 95a9641971f2e3721751383af741664a5ac515e7..706564957d476ab83cf29a6e945323d0664fbf4a 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1995, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1995, 1997, 2000 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,6 +17,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <errno.h>
+#include <string.h>
 #include <unistd.h>
 #include <sys/utsname.h>
 
 int
 __gethostname (name, len)
      char *name;
-     size_t len;
+     socklen_t len;
 {
   struct utsname buf;
+  size_t node_len;
+
   if (uname (&buf))
     return -1;
-  strncpy (name, buf.nodename, len);
+
+  node_len = strlen (buf.nodename) + 1;
+  if (node_len > len)
+    {
+      __set_errno (ENAMETOOLONG);
+      return -1;
+    }
+
+  memcpy (name, buf.nodename, node_len);
   return 0;
 }
 
index 86595e87a893b4eadf57db60b4cb4ae1cecdd97d..e95892eda3365dc0be859569a952e39e9933dbab 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1994-1998, 2000 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
@@ -103,7 +103,7 @@ typedef struct
        from the global namespace.  */
 #ifdef __USE_XOPEN
     __fd_mask fds_bits[__FD_SETSIZE / __NFDBITS];
-# define __FDS_BITS(set) ((set)->fds_bits) 
+# define __FDS_BITS(set) ((set)->fds_bits)
 #else
     __fd_mask __fds_bits[__FD_SETSIZE / __NFDBITS];
 # define __FDS_BITS(set) ((set)->__fds_bits)
@@ -144,4 +144,7 @@ typedef unsigned int __t_uscalar_t;
 /* Duplicates info from stdint.h but this is used in unistd.h.  */
 typedef int __intptr_t;
 
+/* Duplicate info from sys/socket.h.  */
+typedef unsigned int __socklen_t;
+
 #endif /* bits/types.h */
index 8a79621cc603f637423f19c994a9848614ff7908..722db9e2309fb041ccedff301ad018d80f462668 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,94,95,96,97,98,99 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,94,95,96,97,98,99, 2000 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
@@ -123,6 +123,9 @@ typedef unsigned long int __t_uscalar_t;
 /* Duplicates info from stdint.h but this is used in unistd.h.  */
 typedef long int __intptr_t;
 
+/* Duplicate info from sys/socket.h.  */
+typedef unsigned int __socklen_t;
+
 
 /* Now add the thread types.  */
 #ifdef __USE_UNIX98
index c861387998d661ad0a1e05f6aabe61f8bea81064..9dd8a809180620cdce2672b425faeadd85b853cd 100644 (file)
@@ -1,5 +1,5 @@
 /* System-specific socket constants and types.  Linux version.
-   Copyright (C) 1991,92,94,95,96,97,98,99 Free Software Foundation, Inc.
+   Copyright (C) 1991, 1992, 1994-1999, 2000 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
 #include <sys/types.h>
 
 /* Type for length arguments in socket calls.  */
-typedef unsigned int socklen_t;
+#ifndef __socklen_t_defined
+typedef __socklen_t socklen_t;
+# define __socklen_t_defined
+#endif
 
 /* Types of sockets.  */
 enum __socket_type
index 45286ea81f5741b4588a31177c6285afa325f9da..f9bf8394da636ec02754fb5625b947c2338634c7 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,94,95,96,97,98,99 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,94,95,96,97,98,99, 2000 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
@@ -149,6 +149,9 @@ typedef unsigned long int __t_uscalar_t;
 /* Duplicates info from stdint.h but this is used in unistd.h.  */
 typedef int __intptr_t;
 
+/* Duplicate info from sys/socket.h.  */
+typedef unsigned int __socklen_t;
+
 
 /* Now add the thread types.  */
 #ifdef __USE_UNIX98
diff --git a/sysdeps/unix/sysv/linux/gethostname.c b/sysdeps/unix/sysv/linux/gethostname.c
deleted file mode 100644 (file)
index 94a4601..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Copyright (C) 1992, 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
-   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 <string.h>
-#include <unistd.h>
-#include <sys/utsname.h>
-
-/* Put the name of the current host in no more than LEN bytes of NAME.
-   The result is null-terminated if LEN is large enough for the full
-   name and the terminator.  */
-int
-__gethostname (name, len)
-     char *name;
-     size_t len;
-{
-  struct utsname buf;
-  size_t node_len;
-
-  if (name == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  if (uname (&buf))
-    return -1;
-
-  node_len = strlen (buf.nodename) + 1;
-  if (node_len > len)
-    {
-      __set_errno (ENAMETOOLONG);
-      return -1;
-    }
-
-  memcpy (name, buf.nodename, node_len);
-  return 0;
-}
-
-weak_alias (__gethostname, gethostname)
index 747b11905d4e84ca969ae28381ed943f8c85e01f..1462331ff7492e7ad9a374deabe8bd05f46c45c4 100644 (file)
 #include <sys/types.h>
 
 /* Type for length arguments in socket calls.  */
-typedef unsigned int socklen_t;
+#ifndef __socklen_t_defined
+typedef __socklen_t socklen_t;
+# define __socklen_t_defined
+#endif
 
 /* Types of sockets.  */
 enum __socket_type
index 48a9bf07e1c43f8642386824116f66f4bbdeac17..6bb07e7b13569da013b3636379b0e8727945228d 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,94,95,96,97,98,99 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,94,95,96,97,98,99, 2000 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
@@ -149,6 +149,9 @@ typedef unsigned long int __t_uscalar_t;
 /* Duplicates info from stdint.h but this is used in unistd.h.  */
 typedef int __intptr_t;
 
+/* Duplicate info from sys/socket.h.  */
+typedef unsigned int __socklen_t;
+
 
 /* Now add the thread types.  */
 #ifdef __USE_UNIX98
index de085600dd2c9e01fa44157b3eac2ebb7cfd3c91..8d76cd7e83266ee5d75ab1d779e8cb842eea6630 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,94,95,96,97,98,99 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,94,95,96,97,98,99, 2000 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
@@ -173,6 +173,9 @@ typedef long int __intptr_t;
 typedef int      __intptr_t;
 #endif
 
+/* Duplicate info from sys/socket.h.  */
+typedef unsigned int __socklen_t;
+
 
 /* Now add the thread types.  */
 #ifdef __USE_UNIX98
index 558d16e6f88cfcf02419cc0dbd17b78486477fa9..3f967e15d43c9e038599ddfe4b917f04714bbf61 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994, 1995, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1994, 1995, 1997, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Brendan Kehoe (brendan@zen.org).
 
 #include <sys/types.h>
 #include <sys/systeminfo.h>
 
-extern int __sysinfo __P ((int command, char *buf, long count));
+extern int __sysinfo (int command, char *buf, long int count);
 
 int
 __gethostname (name, namelen)
      char *name;
-     size_t namelen;
+     socklen_t namelen;
 {
   return __sysinfo (SI_HOSTNAME, name, namelen);
 }
index 1e7b50e7800def70a3a7ee2399862f7444d689c4..65ad002f7977f0bc993b79a16fe07eb0e36fffad 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,94,95,96,97,98,99 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,94,95,96,97,98,99, 2000 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
@@ -134,4 +134,7 @@ typedef unsigned int __t_uscalar_t;
 /* Duplicates info from stdint.h but this is used in unistd.h.  */
 typedef long int __intptr_t;
 
+/* Duplicate info from sys/socket.h.  */
+typedef unsigned int __socklen_t;
+
 #endif /* bits/types.h */