about summary refs log tree commit diff
path: root/inet
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-12-14 15:06:39 +0000
committerUlrich Drepper <drepper@redhat.com>2005-12-14 15:06:39 +0000
commit9d13fb2413921c713f83efe331e8e4d219c62c6b (patch)
tree2d44d7ac45ab2d147eb8361bbff880c365aa8ad5 /inet
parentb6ab06cef4670e02756bcdd4d2c33a49369a4346 (diff)
downloadglibc-9d13fb2413921c713f83efe331e8e4d219c62c6b.tar.gz
glibc-9d13fb2413921c713f83efe331e8e4d219c62c6b.tar.xz
glibc-9d13fb2413921c713f83efe331e8e4d219c62c6b.zip
Moved to csu/errno-loc.c.
Diffstat (limited to 'inet')
-rw-r--r--inet/getipv4sourcefilter.c32
-rw-r--r--inet/getsourcefilter.c33
-rw-r--r--inet/herrno-loc.c34
-rw-r--r--inet/htonl.c36
-rw-r--r--inet/htons.c36
-rw-r--r--inet/if_index.c65
-rw-r--r--inet/ifaddrs.c46
-rw-r--r--inet/ifreq.c80
-rw-r--r--inet/setipv4sourcefilter.c33
-rw-r--r--inet/setsourcefilter.c33
10 files changed, 428 insertions, 0 deletions
diff --git a/inet/getipv4sourcefilter.c b/inet/getipv4sourcefilter.c
new file mode 100644
index 0000000000..e95697778a
--- /dev/null
+++ b/inet/getipv4sourcefilter.c
@@ -0,0 +1,32 @@
+/* Get source filter.  Stub version.
+   Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <netinet/in.h>
+
+
+int
+getipv4sourcefilter (int s, struct in_addr interface, struct in_addr group,
+		     uint32_t *fmode, uint32_t *numsrc, struct in_addr *slist)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (getipv4sourcefilter)
diff --git a/inet/getsourcefilter.c b/inet/getsourcefilter.c
new file mode 100644
index 0000000000..373550beb3
--- /dev/null
+++ b/inet/getsourcefilter.c
@@ -0,0 +1,33 @@
+/* Get source filter.  Stub version.
+   Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <netinet/in.h>
+
+
+int
+getsourcefilter (int s, uint32_t interface, const struct sockaddr *group,
+		 socklen_t grouplen, uint32_t *fmode, uint32_t *numsrc,
+		 struct sockaddr_storage *slist)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (getsourcefilter)
diff --git a/inet/herrno-loc.c b/inet/herrno-loc.c
new file mode 100644
index 0000000000..fd6deeb330
--- /dev/null
+++ b/inet/herrno-loc.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1996, 97, 98, 2002 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <netdb.h>
+#include <tls.h>
+
+#if ! USE___THREAD
+# undef h_errno
+extern int h_errno;
+#endif
+
+/* When threaded, h_errno may be a per-thread variable.  */
+int *
+weak_const_function
+__h_errno_location (void)
+{
+  return &h_errno;
+}
+libc_hidden_def (__h_errno_location)
diff --git a/inet/htonl.c b/inet/htonl.c
new file mode 100644
index 0000000000..dfee1b0545
--- /dev/null
+++ b/inet/htonl.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1993,97,2002 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <netinet/in.h>
+
+#undef	htonl
+#undef	ntohl
+
+uint32_t
+htonl (x)
+     uint32_t x;
+{
+#if BYTE_ORDER == BIG_ENDIAN
+  return x;
+#elif BYTE_ORDER == LITTLE_ENDIAN
+  return __bswap_32 (x);
+#else
+# error "What kind of system is this?"
+#endif
+}
+weak_alias (htonl, ntohl)
diff --git a/inet/htons.c b/inet/htons.c
new file mode 100644
index 0000000000..95c94de8a3
--- /dev/null
+++ b/inet/htons.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1993,97,2002 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <netinet/in.h>
+
+#undef	htons
+#undef	ntohs
+
+uint16_t
+htons (x)
+     uint16_t x;
+{
+#if BYTE_ORDER == BIG_ENDIAN
+  return x;
+#elif BYTE_ORDER == LITTLE_ENDIAN
+  return __bswap_16 (x);
+#else
+# error "What kind of system is this?"
+#endif
+}
+weak_alias (htons, ntohs)
diff --git a/inet/if_index.c b/inet/if_index.c
new file mode 100644
index 0000000000..f217f37642
--- /dev/null
+++ b/inet/if_index.c
@@ -0,0 +1,65 @@
+/* Copyright (C) 1997,98,99,2000,02 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <net/if.h>
+#include <errno.h>
+#include <stddef.h>
+
+unsigned int
+if_nametoindex (const char *ifname)
+{
+  __set_errno (ENOSYS);
+  return 0;
+}
+libc_hidden_def (if_nametoindex)
+stub_warning (if_nametoindex)
+
+char *
+if_indextoname (unsigned int ifindex, char *ifname)
+{
+  __set_errno (ENOSYS);
+  return NULL;
+}
+libc_hidden_def (if_indextoname)
+stub_warning (if_indextoname)
+
+void
+if_freenameindex (struct if_nameindex *ifn)
+{
+}
+stub_warning (if_freenameindex)
+
+struct if_nameindex *
+if_nameindex (void)
+{
+  __set_errno (ENOSYS);
+  return NULL;
+}
+stub_warning (if_nameindex)
+#include <stub-tag.h>
+
+#if 0
+void
+internal_function
+__protocol_available (int *have_inet, int *have_inet6)
+{
+  /* By default we assume that IPv4 is available, IPv6 not.  */
+  *have_inet = 1;
+  *have_inet6 = 0;
+}
+#endif
diff --git a/inet/ifaddrs.c b/inet/ifaddrs.c
new file mode 100644
index 0000000000..330aae3b39
--- /dev/null
+++ b/inet/ifaddrs.c
@@ -0,0 +1,46 @@
+/* getifaddrs -- get names and addresses of all network interfaces
+   Copyright (C) 2002, 2003 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <ifaddrs.h>
+#include <errno.h>
+#include <stdlib.h>
+
+/* Create a linked list of `struct ifaddrs' structures, one for each
+   network interface on the host machine.  If successful, store the
+   list in *IFAP and return 0.  On errors, return -1 and set `errno'.  */
+int
+getifaddrs (struct ifaddrs **ifap)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+libc_hidden_def (getifaddrs)
+stub_warning (getifaddrs)
+
+void
+freeifaddrs (struct ifaddrs *ifa)
+{
+  if (ifa == NULL)
+    return;			/* a la free, why not? */
+
+  /* Can't be called properly if getifaddrs never succeeded.  */
+  abort ();
+}
+libc_hidden_def (freeifaddrs)
+stub_warning (freeifaddrs)
diff --git a/inet/ifreq.c b/inet/ifreq.c
new file mode 100644
index 0000000000..55e833bdb3
--- /dev/null
+++ b/inet/ifreq.c
@@ -0,0 +1,80 @@
+/* Copyright (C) 1999, 2002, 2003, 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Andreas Jaeger <aj@suse.de>.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include "ifreq.h"
+
+
+void
+__ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd)
+{
+  int fd = sockfd;
+  struct ifconf ifc;
+  int rq_len;
+  int nifs;
+# define RQ_IFS	4
+
+  if (fd < 0)
+    fd = __opensock ();
+  if (fd < 0)
+    {
+      *num_ifs = 0;
+      *ifreqs = NULL;
+      return;
+    }
+
+  ifc.ifc_buf = NULL;
+  rq_len = RQ_IFS * sizeof (struct ifreq) / 2; /* Doubled in the loop.  */
+  do
+    {
+      ifc.ifc_len = rq_len *= 2;
+      void *newp = realloc (ifc.ifc_buf, ifc.ifc_len);
+      if (newp == NULL || __ioctl (fd, SIOCGIFCONF, &ifc) < 0)
+	{
+	  free (ifc.ifc_buf);
+
+	  if (fd != sockfd)
+	    __close (fd);
+	  *num_ifs = 0;
+	  *ifreqs = NULL;
+	  return;
+	}
+      ifc.ifc_buf = newp;
+    }
+  while (rq_len < sizeof (struct ifreq) + ifc.ifc_len);
+
+  if (fd != sockfd)
+    __close (fd);
+
+#ifdef _HAVE_SA_LEN
+  struct ifreq *ifr = *ifreqs;
+  nifs = 0;
+  while ((char *) ifr < ifc.ifc_buf + ifc.ifc_len)
+    {
+      ++nifs;
+      ifr = __if_nextreq (ifr);
+      if (ifr == NULL)
+	break;
+    }
+#else
+  nifs = ifc.ifc_len / sizeof (struct ifreq);
+#endif
+
+  *num_ifs = nifs;
+  *ifreqs = realloc (ifc.ifc_buf, nifs * sizeof (struct ifreq));
+}
diff --git a/inet/setipv4sourcefilter.c b/inet/setipv4sourcefilter.c
new file mode 100644
index 0000000000..db2b8433bb
--- /dev/null
+++ b/inet/setipv4sourcefilter.c
@@ -0,0 +1,33 @@
+/* Set source filter.  Stub version.
+   Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <netinet/in.h>
+
+
+int
+setipv4sourcefilter (int s, struct in_addr interface, struct in_addr group,
+		     uint32_t fmode, uint32_t numsrc,
+		     const struct in_addr *slist)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (setipv4sourcefilter)
diff --git a/inet/setsourcefilter.c b/inet/setsourcefilter.c
new file mode 100644
index 0000000000..870f5e2c38
--- /dev/null
+++ b/inet/setsourcefilter.c
@@ -0,0 +1,33 @@
+/* Set source filter.  Stub version.
+   Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <netinet/in.h>
+
+
+int
+setsourcefilter (int s, uint32_t interface, const struct sockaddr *group,
+		 socklen_t grouplen, uint32_t fmode, uint32_t numsrc,
+		 const struct sockaddr_storage *slist)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (setsourcefilter)