aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorKim F. Storm2003-09-17 21:32:35 +0000
committerKim F. Storm2003-09-17 21:32:35 +0000
commitb8c7fd71a2bbb70165447069cddc21d19927c591 (patch)
treea1b8ed0216f66990520b1e01c3f3da251cf6074c /src/process.c
parent8a7bc7b8036666697b8598760a41e4b40751b5cd (diff)
downloademacs-b8c7fd71a2bbb70165447069cddc21d19927c591.tar.gz
emacs-b8c7fd71a2bbb70165447069cddc21d19927c591.zip
(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.
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/process.c b/src/process.c
index 23ef1e9059e..531c60cac49 100644
--- a/src/process.c
+++ b/src/process.c
@@ -3336,7 +3336,7 @@ usage: (make-network-process &rest ARGS) */)
3336#endif /* HAVE_SOCKETS */ 3336#endif /* HAVE_SOCKETS */
3337 3337
3338 3338
3339#ifdef HAVE_SOCKETS 3339#if defined(HAVE_SOCKETS) && defined(HAVE_NET_IF_H) && defined(HAVE_SYS_IOCTL_H)
3340 3340
3341#ifdef SIOCGIFCONF 3341#ifdef SIOCGIFCONF
3342DEFUN ("network-interface-list", Fnetwork_interface_list, Snetwork_interface_list, 0, 0, 0, 3342DEFUN ("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'. */)
3397 3397
3398 return res; 3398 return res;
3399} 3399}
3400#endif 3400#endif /* SIOCGIFCONF */
3401 3401
3402#if defined(SIOCGIFADDR) || defined(SIOCGIFHWADDR) || defined(SIOCGIFFLAGS) 3402#if defined(SIOCGIFADDR) || defined(SIOCGIFHWADDR) || defined(SIOCGIFFLAGS)
3403 3403
@@ -3483,7 +3483,7 @@ FLAGS is the current flags of the interface. */)
3483 return Qnil; 3483 return Qnil;
3484 3484
3485 elt = Qnil; 3485 elt = Qnil;
3486#ifdef SIOCGIFFLAGS 3486#if defined(SIOCGIFFLAGS) && defined(ifr_flags)
3487 if (ioctl (s, SIOCGIFFLAGS, &rq) == 0) 3487 if (ioctl (s, SIOCGIFFLAGS, &rq) == 0)
3488 { 3488 {
3489 int flags = rq.ifr_flags; 3489 int flags = rq.ifr_flags;
@@ -3511,10 +3511,10 @@ FLAGS is the current flags of the interface. */)
3511 res = Fcons (elt, res); 3511 res = Fcons (elt, res);
3512 3512
3513 elt = Qnil; 3513 elt = Qnil;
3514#ifdef SIOCGIFHWADDR 3514#if defined(SIOCGIFHWADDR) && defined(ifr_hwaddr)
3515 if (ioctl (s, SIOCGIFHWADDR, &rq) == 0) 3515 if (ioctl (s, SIOCGIFHWADDR, &rq) == 0)
3516 { 3516 {
3517 Lisp_Object hwaddr = Fmake_vector (6, Qnil); 3517 Lisp_Object hwaddr = Fmake_vector (make_number (6), Qnil);
3518 register struct Lisp_Vector *p = XVECTOR (hwaddr); 3518 register struct Lisp_Vector *p = XVECTOR (hwaddr);
3519 int n; 3519 int n;
3520 3520
@@ -3527,7 +3527,7 @@ FLAGS is the current flags of the interface. */)
3527 res = Fcons (elt, res); 3527 res = Fcons (elt, res);
3528 3528
3529 elt = Qnil; 3529 elt = Qnil;
3530#ifdef SIOCGIFNETMASK 3530#if defined(SIOCGIFNETMASK) && defined(ifr_netmask)
3531 if (ioctl (s, SIOCGIFNETMASK, &rq) == 0) 3531 if (ioctl (s, SIOCGIFNETMASK, &rq) == 0)
3532 { 3532 {
3533 any++; 3533 any++;
@@ -3537,7 +3537,7 @@ FLAGS is the current flags of the interface. */)
3537 res = Fcons (elt, res); 3537 res = Fcons (elt, res);
3538 3538
3539 elt = Qnil; 3539 elt = Qnil;
3540#ifdef SIOCGIFBRDADDR 3540#if defined(SIOCGIFBRDADDR) && defined(ifr_broadaddr)
3541 if (ioctl (s, SIOCGIFBRDADDR, &rq) == 0) 3541 if (ioctl (s, SIOCGIFBRDADDR, &rq) == 0)
3542 { 3542 {
3543 any++; 3543 any++;
@@ -3547,7 +3547,7 @@ FLAGS is the current flags of the interface. */)
3547 res = Fcons (elt, res); 3547 res = Fcons (elt, res);
3548 3548
3549 elt = Qnil; 3549 elt = Qnil;
3550#ifdef SIOCGIFADDR 3550#if defined(SIOCGIFADDR) && defined(ifr_addr)
3551 if (ioctl (s, SIOCGIFADDR, &rq) == 0) 3551 if (ioctl (s, SIOCGIFADDR, &rq) == 0)
3552 { 3552 {
3553 any++; 3553 any++;
@@ -6656,13 +6656,15 @@ The value takes effect when `start-process' is called. */);
6656 defsubr (&Sset_network_process_option); 6656 defsubr (&Sset_network_process_option);
6657 defsubr (&Smake_network_process); 6657 defsubr (&Smake_network_process);
6658 defsubr (&Sformat_network_address); 6658 defsubr (&Sformat_network_address);
6659#endif /* HAVE_SOCKETS */
6660#if defined(HAVE_SOCKETS) && defined(HAVE_NET_IF_H) && defined(HAVE_SYS_IOCTL_H)
6659#ifdef SIOCGIFCONF 6661#ifdef SIOCGIFCONF
6660 defsubr (&Snetwork_interface_list); 6662 defsubr (&Snetwork_interface_list);
6661#endif 6663#endif
6662#if defined(SIOCGIFADDR) || defined(SIOCGIFHWADDR) || defined(SIOCGIFFLAGS) 6664#if defined(SIOCGIFADDR) || defined(SIOCGIFHWADDR) || defined(SIOCGIFFLAGS)
6663 defsubr (&Snetwork_interface_info); 6665 defsubr (&Snetwork_interface_info);
6664#endif 6666#endif
6665#endif /* HAVE_SOCKETS */ 6667#endif /* HAVE_SOCKETS ... */
6666#ifdef DATAGRAM_SOCKETS 6668#ifdef DATAGRAM_SOCKETS
6667 defsubr (&Sprocess_datagram_address); 6669 defsubr (&Sprocess_datagram_address);
6668 defsubr (&Sset_process_datagram_address); 6670 defsubr (&Sset_process_datagram_address);