diff options
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 81 |
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 | ||
| 1962 | static | ||
| 1963 | #endif | ||
| 1961 | Lisp_Object | 1964 | Lisp_Object |
| 1962 | conv_sockaddr_to_lisp (struct sockaddr *sa, int len) | 1965 | conv_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 | ||
| 3507 | DEFUN ("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. | ||
| 3509 | Each element is a cons, the car of which is a string containing the | ||
| 3510 | interface name, and the cdr is the network address in internal | ||
| 3511 | format; see the description of ADDRESS in `make-network-process'. | ||
| 3512 | |||
| 3513 | If 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 | |||
| 3523 | DEFUN ("network-interface-info", Fnetwork_interface_info, Snetwork_interface_info, 1, 1, 0, | ||
| 3524 | doc: /* Return information about network interface named IFNAME. | ||
| 3525 | The return value is a list (ADDR BCAST NETMASK HWADDR FLAGS), | ||
| 3526 | where ADDR is the layer 3 address, BCAST is the layer 3 broadcast address, | ||
| 3527 | NETMASK is the layer 3 network mask, HWADDR is the layer 2 address, and | ||
| 3528 | FLAGS is the current flags of the interface. | ||
| 3529 | |||
| 3530 | Data 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 |
| 3543 | Lisp_Object | 3513 | static Lisp_Object |
| 3544 | network_interface_list (void) | 3514 | network_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 | ||
| 3686 | Lisp_Object | 3656 | static Lisp_Object |
| 3687 | network_interface_info (Lisp_Object ifname) | 3657 | network_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 | ||
| 3802 | DEFUN ("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. | ||
| 3805 | Each element is a cons, the car of which is a string containing the | ||
| 3806 | interface name, and the cdr is the network address in internal | ||
| 3807 | format; see the description of ADDRESS in `make-network-process'. | ||
| 3808 | |||
| 3809 | If 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 | |||
| 3819 | DEFUN ("network-interface-info", Fnetwork_interface_info, | ||
| 3820 | Snetwork_interface_info, 1, 1, 0, | ||
| 3821 | doc: /* Return information about network interface named IFNAME. | ||
| 3822 | The return value is a list (ADDR BCAST NETMASK HWADDR FLAGS), | ||
| 3823 | where ADDR is the layer 3 address, BCAST is the layer 3 broadcast address, | ||
| 3824 | NETMASK is the layer 3 network mask, HWADDR is the layer 2 address, and | ||
| 3825 | FLAGS is the current flags of the interface. | ||
| 3826 | |||
| 3827 | Data 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 | ||
| 3834 | static void | 3843 | static void |