mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-28 16:22:29 +00:00
Add ioctl(SIOCGIFxxx) support (#197)
- SIOCGIFCONFIG: reads and enumerate all the network interfaces - SIOCGIFADDR: reads network address for a given interface - SIOCGIFFLAGS: reads network flags for a given interface - SIOCGIFNETMASK: reads network netmask for a given interface - SIOCGIFBRDADDR: reads network broadcast address for a given interface - SIOCGIFDSTADDR: reads peer destination address for a given interface (not supported for Windows) This change defines Linux ABI structs for the above interfaces and adds polyfills to ensure they behave consistently on XNU and Windows.
This commit is contained in:
parent
4d8f884e76
commit
fd0eefce17
105 changed files with 1531 additions and 4 deletions
|
@ -53,6 +53,45 @@ struct sockaddr_un_bsd {
|
|||
char sun_path[108];
|
||||
};
|
||||
|
||||
/* -----------------------------------------------------------------------------------
|
||||
* ioctl SIOCGIFCONF & others:
|
||||
*
|
||||
* BSD has a different structure. All the ioctl will adjust to use
|
||||
* the ifreq with the ifreq_bsd
|
||||
*/
|
||||
struct ifreq_bsd {
|
||||
union {
|
||||
char ifrn_name[IFNAMSIZ];
|
||||
} ifr_ifrn;
|
||||
|
||||
union {
|
||||
/* Right now we only list the structures used by the few ioctl that are
|
||||
* supported by Cosmopolitan. Add your own definition here if you need
|
||||
* a particular ioctl that requires polyfill for BSD
|
||||
*/
|
||||
struct sockaddr_bsd ifru_addr;
|
||||
struct sockaddr_bsd ifru_netmask;
|
||||
struct sockaddr_bsd ifru_dstaddr;
|
||||
struct sockaddr_bsd ifru_broadaddr;
|
||||
short ifru_flags;
|
||||
char ifru_pad[16]; /* used as padding */
|
||||
} ifr_ifru;
|
||||
};
|
||||
|
||||
#pragma pack(4)
|
||||
struct ifconf_bsd {
|
||||
uint32_t ifc_len; /* size of buffer */
|
||||
union {
|
||||
char *ifcu_buf;
|
||||
struct ifreq_bsd *ifcu_req;
|
||||
} ifc_ifcu;
|
||||
};
|
||||
#pragma pack()
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
struct SockFd {
|
||||
int family;
|
||||
int type;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue