aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c81
1 files changed, 45 insertions, 36 deletions
diff --git a/src/process.c b/src/process.c
index cf9d5e265e1..91bc090e76e 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1958,6 +1958,9 @@ create_pty (Lisp_Object process)
1958/* Convert an internal struct sockaddr to a lisp object (vector or string). 1958/* Convert an internal struct sockaddr to a lisp object (vector or string).
1959 The address family of sa is not included in the result. */ 1959 The address family of sa is not included in the result. */
1960 1960
1961#ifndef WINDOWSNT
1962static
1963#endif
1961Lisp_Object 1964Lisp_Object
1962conv_sockaddr_to_lisp (struct sockaddr *sa, int len) 1965conv_sockaddr_to_lisp (struct sockaddr *sa, int len)
1963{ 1966{
@@ -3504,43 +3507,10 @@ usage: (make-network-process &rest ARGS) */)
3504} 3507}
3505 3508
3506 3509
3507DEFUN ("network-interface-list", Fnetwork_interface_list, Snetwork_interface_list, 0, 0, 0, 3510#ifdef HAVE_NET_IF_H
3508 doc: /* Return an alist of all network interfaces and their network address.
3509Each element is a cons, the car of which is a string containing the
3510interface name, and the cdr is the network address in internal
3511format; see the description of ADDRESS in `make-network-process'.
3512
3513If the information is not available, return nil. */)
3514 (void)
3515{
3516#if (defined (HAVE_NET_IF_H) && defined (SIOCGIFCONF)) || defined (WINDOWSNT)
3517 return network_interface_list ();
3518#else
3519 return Qnil;
3520#endif
3521}
3522
3523DEFUN ("network-interface-info", Fnetwork_interface_info, Snetwork_interface_info, 1, 1, 0,
3524 doc: /* Return information about network interface named IFNAME.
3525The return value is a list (ADDR BCAST NETMASK HWADDR FLAGS),
3526where ADDR is the layer 3 address, BCAST is the layer 3 broadcast address,
3527NETMASK is the layer 3 network mask, HWADDR is the layer 2 address, and
3528FLAGS is the current flags of the interface.
3529
3530Data that is unavailable is returned as nil. */)
3531 (Lisp_Object ifname)
3532{
3533#if (defined (HAVE_NET_IF_H) && (defined (SIOCGIFADDR) || defined (SIOCGIFHWADDR) || defined (SIOCGIFFLAGS))) || defined (WINDOWSNT)
3534 return network_interface_info (ifname);
3535#else
3536 return Qnil;
3537#endif
3538}
3539
3540#if defined (HAVE_NET_IF_H)
3541 3511
3542#ifdef SIOCGIFCONF 3512#ifdef SIOCGIFCONF
3543Lisp_Object 3513static Lisp_Object
3544network_interface_list (void) 3514network_interface_list (void)
3545{ 3515{
3546 struct ifconf ifconf; 3516 struct ifconf ifconf;
@@ -3683,7 +3653,7 @@ static const struct ifflag_def ifflag_table[] = {
3683 { 0, 0 } 3653 { 0, 0 }
3684}; 3654};
3685 3655
3686Lisp_Object 3656static Lisp_Object
3687network_interface_info (Lisp_Object ifname) 3657network_interface_info (Lisp_Object ifname)
3688{ 3658{
3689 struct ifreq rq; 3659 struct ifreq rq;
@@ -3829,6 +3799,45 @@ network_interface_info (Lisp_Object ifname)
3829#endif /* !SIOCGIFADDR && !SIOCGIFHWADDR && !SIOCGIFFLAGS */ 3799#endif /* !SIOCGIFADDR && !SIOCGIFHWADDR && !SIOCGIFFLAGS */
3830#endif /* defined (HAVE_NET_IF_H) */ 3800#endif /* defined (HAVE_NET_IF_H) */
3831 3801
3802DEFUN ("network-interface-list", Fnetwork_interface_list,
3803 Snetwork_interface_list, 0, 0, 0,
3804 doc: /* Return an alist of all network interfaces and their network address.
3805Each element is a cons, the car of which is a string containing the
3806interface name, and the cdr is the network address in internal
3807format; see the description of ADDRESS in `make-network-process'.
3808
3809If the information is not available, return nil. */)
3810 (void)
3811{
3812#if (defined HAVE_NET_IF_H && defined SIOCGIFCONF) || defined WINDOWSNT
3813 return network_interface_list ();
3814#else
3815 return Qnil;
3816#endif
3817}
3818
3819DEFUN ("network-interface-info", Fnetwork_interface_info,
3820 Snetwork_interface_info, 1, 1, 0,
3821 doc: /* Return information about network interface named IFNAME.
3822The return value is a list (ADDR BCAST NETMASK HWADDR FLAGS),
3823where ADDR is the layer 3 address, BCAST is the layer 3 broadcast address,
3824NETMASK is the layer 3 network mask, HWADDR is the layer 2 address, and
3825FLAGS is the current flags of the interface.
3826
3827Data that is unavailable is returned as nil. */)
3828 (Lisp_Object ifname)
3829{
3830#if ((defined HAVE_NET_IF_H \
3831 && (defined SIOCGIFADDR || defined SIOCGIFHWADDR \
3832 || defined SIOCGIFFLAGS)) \
3833 || defined WINDOWSNT)
3834 return network_interface_info (ifname);
3835#else
3836 return Qnil;
3837#endif
3838}
3839
3840
3832/* Turn off input and output for process PROC. */ 3841/* Turn off input and output for process PROC. */
3833 3842
3834static void 3843static void