Skip to content

Commit 12e971e

Browse files
committed
Auto merge of #3487 - arctic-alpaca:main, r=JohnTitor
Add `ifreq`, `ifconf` and related constants to Android Hi, this adds `ifreq`, `ifconf` and all related constants defined in Android to Android. I also added missing symbols to `semver/linux.txt`.
2 parents 05d807f + 8fc4f23 commit 12e971e

File tree

3 files changed

+138
-0
lines changed

3 files changed

+138
-0
lines changed

libc-test/semver/android.txt

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2241,7 +2241,44 @@ SIOCADDMULTI
22412241
SIOCADDRT
22422242
SIOCDARP
22432243
SIOCDELMULTI
2244+
SIOCGIFINDEX
2245+
SIOGIFINDEX
2246+
SIOCSIFPFLAGS
2247+
SIOCGIFPFLAGS
2248+
SIOCDIFADDR
2249+
SIOCSIFHWBROADCAST
2250+
SIOCGIFCOUNT
2251+
SIOCGIFBR
2252+
SIOCSIFBR
2253+
SIOCGIFTXQLEN
2254+
SIOCSIFTXQLEN
2255+
SIOCETHTOOL
2256+
SIOCGMIIPHY
2257+
SIOCGMIIREG
2258+
SIOCSMIIREG
2259+
SIOCWANDEV
2260+
SIOCOUTQNSD
2261+
SIOCGSKNS
2262+
SIOCADDDLCI
2263+
SIOCDELDLCI
2264+
SIOCGIFVLAN
2265+
SIOCSIFVLAN
2266+
SIOCBONDENSLAVE
2267+
SIOCBONDRELEASE
2268+
SIOCBONDSETHWADDR
2269+
SIOCBONDSLAVEINFOQUERY
2270+
SIOCBONDINFOQUERY
2271+
SIOCBONDCHANGEACTIVE
2272+
SIOCBRADDBR
2273+
SIOCBRDELBR
2274+
SIOCBRADDIF
2275+
SIOCBRDELIF
2276+
SIOCSHWTSTAMP
2277+
SIOCGHWTSTAMP
2278+
SIOCDEVPRIVATE
2279+
SIOCPROTOPRIVATE
22442280
SIOCDELRT
2281+
SIOCRTMSG
22452282
SIOCDRARP
22462283
SIOCGARP
22472284
SIOCGIFADDR
@@ -2250,6 +2287,7 @@ SIOCGIFCONF
22502287
SIOCGIFDSTADDR
22512288
SIOCGIFENCAP
22522289
SIOCGIFFLAGS
2290+
SIOCSIFNAME
22532291
SIOCGIFHWADDR
22542292
SIOCGIFMAP
22552293
SIOCGIFMEM
@@ -3223,6 +3261,11 @@ group
32233261
hostent
32243262
id_t
32253263
idtype_t
3264+
ifconf
3265+
ifreq
3266+
__c_anonymous_ifc_ifcu
3267+
__c_anonymous_ifr_ifru
3268+
__c_anonymous_ifru_map
32263269
if_indextoname
32273270
if_nametoindex
32283271
ifaddrs

libc-test/semver/linux.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2475,6 +2475,7 @@ SIOCSIFMAP
24752475
SIOCSIFMEM
24762476
SIOCSIFMETRIC
24772477
SIOCSIFMTU
2478+
SIOCSIFNAME
24782479
SIOCSIFNETMASK
24792480
SIOCSIFPFLAGS
24802481
SIOCSIFSLAVE
@@ -3860,3 +3861,6 @@ wait4
38603861
waitid
38613862
eventfd_read
38623863
eventfd_write
3864+
__c_anonymous_ifru_map
3865+
__c_anonymous_ifr_ifru
3866+
__c_anonymous_ifc_ifcu

src/unix/linux_like/android/mod.rs

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,15 @@ s! {
496496
pub flag: *mut ::c_int,
497497
pub val: ::c_int,
498498
}
499+
500+
pub struct __c_anonymous_ifru_map {
501+
pub mem_start: ::c_ulong,
502+
pub mem_end: ::c_ulong,
503+
pub base_addr: ::c_ushort,
504+
pub irq: ::c_uchar,
505+
pub dma: ::c_uchar,
506+
pub port: ::c_uchar,
507+
}
499508
}
500509

501510
s_no_extra_traits! {
@@ -591,6 +600,50 @@ s_no_extra_traits! {
591600
__serial: ::c_uint,
592601
__value: [[::c_char; 4]; 23],
593602
}
603+
604+
#[cfg(libc_union)]
605+
pub union __c_anonymous_ifr_ifru {
606+
pub ifru_addr: ::sockaddr,
607+
pub ifru_dstaddr: ::sockaddr,
608+
pub ifru_broadaddr: ::sockaddr,
609+
pub ifru_netmask: ::sockaddr,
610+
pub ifru_hwaddr: ::sockaddr,
611+
pub ifru_flags: ::c_short,
612+
pub ifru_ifindex: ::c_int,
613+
pub ifru_metric: ::c_int,
614+
pub ifru_mtu: ::c_int,
615+
pub ifru_map: __c_anonymous_ifru_map,
616+
pub ifru_slave: [::c_char; ::IFNAMSIZ],
617+
pub ifru_newname: [::c_char; ::IFNAMSIZ],
618+
pub ifru_data: *mut ::c_char,
619+
}
620+
621+
pub struct ifreq {
622+
/// interface name, e.g. "en0"
623+
pub ifr_name: [::c_char; ::IFNAMSIZ],
624+
#[cfg(libc_union)]
625+
pub ifr_ifru: __c_anonymous_ifr_ifru,
626+
#[cfg(not(libc_union))]
627+
pub ifr_ifru: ::sockaddr,
628+
}
629+
630+
#[cfg(libc_union)]
631+
pub union __c_anonymous_ifc_ifcu {
632+
pub ifcu_buf: *mut ::c_char,
633+
pub ifcu_req: *mut ::ifreq,
634+
}
635+
636+
/* Structure used in SIOCGIFCONF request. Used to retrieve interface
637+
configuration for machine (useful for programs which must know all
638+
networks accessible). */
639+
pub struct ifconf {
640+
pub ifc_len: ::c_int, /* Size of buffer. */
641+
#[cfg(libc_union)]
642+
pub ifc_ifcu: __c_anonymous_ifc_ifcu,
643+
#[cfg(not(libc_union))]
644+
pub ifc_ifcu: *mut ::ifreq,
645+
}
646+
594647
}
595648

596649
cfg_if! {
@@ -2715,6 +2768,7 @@ pub const NFEA_DONT_REFRESH: ::c_ushort = 2;
27152768

27162769
pub const SIOCADDRT: ::c_ulong = 0x0000890B;
27172770
pub const SIOCDELRT: ::c_ulong = 0x0000890C;
2771+
pub const SIOCRTMSG: ::c_ulong = 0x0000890D;
27182772
pub const SIOCGIFNAME: ::c_ulong = 0x00008910;
27192773
pub const SIOCSIFLINK: ::c_ulong = 0x00008911;
27202774
pub const SIOCGIFCONF: ::c_ulong = 0x00008912;
@@ -2734,6 +2788,7 @@ pub const SIOCGIFMEM: ::c_ulong = 0x0000891F;
27342788
pub const SIOCSIFMEM: ::c_ulong = 0x00008920;
27352789
pub const SIOCGIFMTU: ::c_ulong = 0x00008921;
27362790
pub const SIOCSIFMTU: ::c_ulong = 0x00008922;
2791+
pub const SIOCSIFNAME: ::c_ulong = 0x00008923;
27372792
pub const SIOCSIFHWADDR: ::c_ulong = 0x00008924;
27382793
pub const SIOCGIFENCAP: ::c_ulong = 0x00008925;
27392794
pub const SIOCSIFENCAP: ::c_ulong = 0x00008926;
@@ -2742,6 +2797,24 @@ pub const SIOCGIFSLAVE: ::c_ulong = 0x00008929;
27422797
pub const SIOCSIFSLAVE: ::c_ulong = 0x00008930;
27432798
pub const SIOCADDMULTI: ::c_ulong = 0x00008931;
27442799
pub const SIOCDELMULTI: ::c_ulong = 0x00008932;
2800+
pub const SIOCGIFINDEX: ::c_ulong = 0x00008933;
2801+
pub const SIOGIFINDEX: ::c_ulong = SIOCGIFINDEX;
2802+
pub const SIOCSIFPFLAGS: ::c_ulong = 0x00008934;
2803+
pub const SIOCGIFPFLAGS: ::c_ulong = 0x00008935;
2804+
pub const SIOCDIFADDR: ::c_ulong = 0x00008936;
2805+
pub const SIOCSIFHWBROADCAST: ::c_ulong = 0x00008937;
2806+
pub const SIOCGIFCOUNT: ::c_ulong = 0x00008938;
2807+
pub const SIOCGIFBR: ::c_ulong = 0x00008940;
2808+
pub const SIOCSIFBR: ::c_ulong = 0x00008941;
2809+
pub const SIOCGIFTXQLEN: ::c_ulong = 0x00008942;
2810+
pub const SIOCSIFTXQLEN: ::c_ulong = 0x00008943;
2811+
pub const SIOCETHTOOL: ::c_ulong = 0x00008946;
2812+
pub const SIOCGMIIPHY: ::c_ulong = 0x00008947;
2813+
pub const SIOCGMIIREG: ::c_ulong = 0x00008948;
2814+
pub const SIOCSMIIREG: ::c_ulong = 0x00008949;
2815+
pub const SIOCWANDEV: ::c_ulong = 0x0000894A;
2816+
pub const SIOCOUTQNSD: ::c_ulong = 0x0000894B;
2817+
pub const SIOCGSKNS: ::c_ulong = 0x0000894C;
27452818
pub const SIOCDARP: ::c_ulong = 0x00008953;
27462819
pub const SIOCGARP: ::c_ulong = 0x00008954;
27472820
pub const SIOCSARP: ::c_ulong = 0x00008955;
@@ -2750,6 +2823,24 @@ pub const SIOCGRARP: ::c_ulong = 0x00008961;
27502823
pub const SIOCSRARP: ::c_ulong = 0x00008962;
27512824
pub const SIOCGIFMAP: ::c_ulong = 0x00008970;
27522825
pub const SIOCSIFMAP: ::c_ulong = 0x00008971;
2826+
pub const SIOCADDDLCI: ::c_ulong = 0x00008980;
2827+
pub const SIOCDELDLCI: ::c_ulong = 0x00008981;
2828+
pub const SIOCGIFVLAN: ::c_ulong = 0x00008982;
2829+
pub const SIOCSIFVLAN: ::c_ulong = 0x00008983;
2830+
pub const SIOCBONDENSLAVE: ::c_ulong = 0x00008990;
2831+
pub const SIOCBONDRELEASE: ::c_ulong = 0x00008991;
2832+
pub const SIOCBONDSETHWADDR: ::c_ulong = 0x00008992;
2833+
pub const SIOCBONDSLAVEINFOQUERY: ::c_ulong = 0x00008993;
2834+
pub const SIOCBONDINFOQUERY: ::c_ulong = 0x00008994;
2835+
pub const SIOCBONDCHANGEACTIVE: ::c_ulong = 0x00008995;
2836+
pub const SIOCBRADDBR: ::c_ulong = 0x000089a0;
2837+
pub const SIOCBRDELBR: ::c_ulong = 0x000089a1;
2838+
pub const SIOCBRADDIF: ::c_ulong = 0x000089a2;
2839+
pub const SIOCBRDELIF: ::c_ulong = 0x000089a3;
2840+
pub const SIOCSHWTSTAMP: ::c_ulong = 0x000089b0;
2841+
pub const SIOCGHWTSTAMP: ::c_ulong = 0x000089b1;
2842+
pub const SIOCDEVPRIVATE: ::c_ulong = 0x000089F0;
2843+
pub const SIOCPROTOPRIVATE: ::c_ulong = 0x000089E0;
27532844

27542845
// linux/module.h
27552846
pub const MODULE_INIT_IGNORE_MODVERSIONS: ::c_uint = 0x0001;

0 commit comments

Comments
 (0)