]> git.eshelyaron.com Git - emacs.git/commitdiff
(Fnetwork_interface_list, Fnetwork_interface_info):
authorKim F. Storm <storm@cua.dk>
Wed, 17 Sep 2003 21:32:35 +0000 (21:32 +0000)
committerKim F. Storm <storm@cua.dk>
Wed, 17 Sep 2003 21:32:35 +0000 (21:32 +0000)
Require HAVE_NET_IF_H and HAVE_SYS_IOCTL_H to include these fns.
(Fnetwork_interface_info): Check that ifreq struct has required
fields before accessing them; this requires that those fields are
defined as macros, which may be too restrictive on some platforms,
but it is better than failing on other platforms.
(syms_of_process): Only defsubr above fns when included.

src/ChangeLog
src/process.c

index 9a2807a9f1b0cf0fbc1caed95bbb7c3fce6ba3fa..7438e98c6a154212b7b0306a08474f0ba21937b2 100644 (file)
@@ -1,3 +1,13 @@
+2003-09-17  Kim F. Storm  <storm@cua.dk>
+
+       * process.c (Fnetwork_interface_list, Fnetwork_interface_info):
+       Require HAVE_NET_IF_H and HAVE_SYS_IOCTL_H to include these fns.
+       (Fnetwork_interface_info): Check that ifreq struct has required
+       fields before accessing them; this requires that those fields are
+       defined as macros, which may be too restrictive on some platforms,
+       but it is better than failing on other platforms.
+       (syms_of_process): Only defsubr above fns when included.
+
 2003-09-17  Dave Love  <fx@gnu.org>
 
        * unexalpha.c: Don't include varargs.h.
index 23ef1e9059ec7864eec43622363b0752a5f3655d..531c60cac492bb615482704ccf4a1ab7950b1160 100644 (file)
@@ -3336,7 +3336,7 @@ usage: (make-network-process &rest ARGS)  */)
 #endif /* HAVE_SOCKETS */
 
 \f
-#ifdef HAVE_SOCKETS
+#if defined(HAVE_SOCKETS) && defined(HAVE_NET_IF_H) && defined(HAVE_SYS_IOCTL_H)
 
 #ifdef SIOCGIFCONF
 DEFUN ("network-interface-list", Fnetwork_interface_list, Snetwork_interface_list, 0, 0, 0,
@@ -3397,7 +3397,7 @@ format; see the description of ADDRESS in 'make-network-process'.  */)
 
   return res;
 }
-#endif
+#endif /* SIOCGIFCONF */
 
 #if defined(SIOCGIFADDR) || defined(SIOCGIFHWADDR) || defined(SIOCGIFFLAGS)
 
@@ -3483,7 +3483,7 @@ FLAGS is the current flags of the interface.  */)
     return Qnil;
 
   elt = Qnil;
-#ifdef SIOCGIFFLAGS
+#if defined(SIOCGIFFLAGS) && defined(ifr_flags)
   if (ioctl (s, SIOCGIFFLAGS, &rq) == 0)
     {
       int flags = rq.ifr_flags;
@@ -3511,10 +3511,10 @@ FLAGS is the current flags of the interface.  */)
   res = Fcons (elt, res);
 
   elt = Qnil;
-#ifdef SIOCGIFHWADDR
+#if defined(SIOCGIFHWADDR) && defined(ifr_hwaddr)
   if (ioctl (s, SIOCGIFHWADDR, &rq) == 0)
     {
-      Lisp_Object hwaddr = Fmake_vector (6, Qnil);
+      Lisp_Object hwaddr = Fmake_vector (make_number (6), Qnil);
       register struct Lisp_Vector *p = XVECTOR (hwaddr);
       int n;
 
@@ -3527,7 +3527,7 @@ FLAGS is the current flags of the interface.  */)
   res = Fcons (elt, res);
 
   elt = Qnil;
-#ifdef SIOCGIFNETMASK
+#if defined(SIOCGIFNETMASK) && defined(ifr_netmask)
   if (ioctl (s, SIOCGIFNETMASK, &rq) == 0)
     {
       any++;
@@ -3537,7 +3537,7 @@ FLAGS is the current flags of the interface.  */)
   res = Fcons (elt, res);
 
   elt = Qnil;
-#ifdef SIOCGIFBRDADDR
+#if defined(SIOCGIFBRDADDR) && defined(ifr_broadaddr)
   if (ioctl (s, SIOCGIFBRDADDR, &rq) == 0)
     {
       any++;
@@ -3547,7 +3547,7 @@ FLAGS is the current flags of the interface.  */)
   res = Fcons (elt, res);
 
   elt = Qnil;
-#ifdef SIOCGIFADDR
+#if defined(SIOCGIFADDR) && defined(ifr_addr)
   if (ioctl (s, SIOCGIFADDR, &rq) == 0)
     {
       any++;
@@ -6656,13 +6656,15 @@ The value takes effect when `start-process' is called.  */);
   defsubr (&Sset_network_process_option);
   defsubr (&Smake_network_process);
   defsubr (&Sformat_network_address);
+#endif /* HAVE_SOCKETS */
+#if defined(HAVE_SOCKETS) && defined(HAVE_NET_IF_H) && defined(HAVE_SYS_IOCTL_H)
 #ifdef SIOCGIFCONF
   defsubr (&Snetwork_interface_list);
 #endif
 #if defined(SIOCGIFADDR) || defined(SIOCGIFHWADDR) || defined(SIOCGIFFLAGS)
   defsubr (&Snetwork_interface_info);
 #endif
-#endif /* HAVE_SOCKETS */
+#endif /* HAVE_SOCKETS ... */
 #ifdef DATAGRAM_SOCKETS
   defsubr (&Sprocess_datagram_address);
   defsubr (&Sset_process_datagram_address);