apple: add missing SIOC ioctl constants#5263
Conversation
| pub const SIOCSHIWAT: c_ulong = 0x80047300; | ||
| pub const SIOCGHIWAT: c_ulong = 0x40047301; | ||
| pub const SIOCSLOWAT: c_ulong = 0x80047302; | ||
| pub const SIOCGLOWAT: c_ulong = 0x40047303; | ||
| pub const SIOCATMARK: c_ulong = 0x40047307; | ||
| pub const SIOCSPGRP: c_ulong = 0x80047308; | ||
| pub const SIOCGPGRP: c_ulong = 0x40047309; | ||
| pub const SIOCSIFADDR: c_ulong = 0x8020690c; | ||
| pub const SIOCSIFDSTADDR: c_ulong = 0x8020690e; | ||
| pub const SIOCSIFFLAGS: c_ulong = 0x80206910; | ||
| pub const SIOCGIFFLAGS: c_ulong = 0xc0206911; | ||
| pub const SIOCSIFBRDADDR: c_ulong = 0x80206913; | ||
| pub const SIOCSIFNETMASK: c_ulong = 0x80206916; | ||
| pub const SIOCGIFMETRIC: c_ulong = 0xc0206917; | ||
| pub const SIOCSIFMETRIC: c_ulong = 0x80206918; | ||
| pub const SIOCDIFADDR: c_ulong = 0x80206919; | ||
| pub const SIOCAIFADDR: c_ulong = 0x8040691a; | ||
| pub const SIOCGIFDSTADDR: c_ulong = 0xc0206922; | ||
| pub const SIOCGIFBRDADDR: c_ulong = 0xc0206923; | ||
| pub const SIOCGIFCONF: c_ulong = 0xc00c6924; | ||
| pub const SIOCGIFNETMASK: c_ulong = 0xc0206925; | ||
| pub const SIOCAUTOADDR: c_ulong = 0xc0206926; | ||
| pub const SIOCAUTONETMASK: c_ulong = 0x80206927; | ||
| pub const SIOCARPIPLL: c_ulong = 0xc0206928; | ||
| pub const SIOCADDMULTI: c_ulong = 0x80206931; | ||
| pub const SIOCDELMULTI: c_ulong = 0x80206932; | ||
| pub const SIOCGIFMTU: c_ulong = 0xc0206933; | ||
| pub const SIOCSIFMTU: c_ulong = 0x80206934; | ||
| pub const SIOCGIFPHYS: c_ulong = 0xc0206935; | ||
| pub const SIOCSIFPHYS: c_ulong = 0x80206936; | ||
| pub const SIOCSIFMEDIA: c_ulong = 0xc0206937; | ||
| pub const SIOCGIFMEDIA: c_ulong = 0xc02c6938; | ||
| pub const SIOCSIFGENERIC: c_ulong = 0x80206939; | ||
| pub const SIOCGIFGENERIC: c_ulong = 0xc020693a; | ||
| pub const SIOCRSLVMULTI: c_ulong = 0xc010693b; | ||
| pub const SIOCSIFLLADDR: c_ulong = 0x8020693c; | ||
| pub const SIOCGIFSTATUS: c_ulong = 0xc331693d; | ||
| pub const SIOCSIFPHYADDR: c_ulong = 0x8040693e; | ||
| pub const SIOCGIFPSRCADDR: c_ulong = 0xc020693f; | ||
| pub const SIOCGIFPDSTADDR: c_ulong = 0xc0206940; | ||
| pub const SIOCDIFPHYADDR: c_ulong = 0x80206941; | ||
| pub const SIOCGIFDEVMTU: c_ulong = 0xc0206944; | ||
| pub const SIOCSIFALTMTU: c_ulong = 0x80206945; | ||
| pub const SIOCGIFALTMTU: c_ulong = 0xc0206948; | ||
| pub const SIOCSIFBOND: c_ulong = 0x80206946; | ||
| pub const SIOCGIFBOND: c_ulong = 0xc0206947; | ||
| pub const SIOCGIFXMEDIA: c_ulong = 0xc02c6948; | ||
| pub const SIOCSIFCAP: c_ulong = 0x8020695a; | ||
| pub const SIOCGIFCAP: c_ulong = 0xc020695b; | ||
| pub const SIOCSIFMANAGEMENT: c_ulong = 0xc020695c; | ||
| pub const SIOCIFCREATE: c_ulong = 0xc0206978; | ||
| pub const SIOCIFDESTROY: c_ulong = 0x80206979; | ||
| pub const SIOCIFCREATE2: c_ulong = 0xc020697a; | ||
| pub const SIOCSDRVSPEC: c_ulong = 0x8028697b; | ||
| pub const SIOCGDRVSPEC: c_ulong = 0xc028697b; | ||
| pub const SIOCSIFVLAN: c_ulong = 0x8020697e; | ||
| pub const SIOCGIFVLAN: c_ulong = 0xc020697f; | ||
| pub const SIOCSETVLAN: c_ulong = SIOCSIFVLAN; | ||
| pub const SIOCGETVLAN: c_ulong = SIOCGIFVLAN; | ||
| pub const SIOCIFGCLONERS: c_ulong = 0xc0106981; | ||
| pub const SIOCGIFASYNCMAP: c_ulong = 0xc020697c; | ||
| pub const SIOCSIFASYNCMAP: c_ulong = 0x8020697d; | ||
| pub const SIOCGIFMAC: c_ulong = 0xc0206982; | ||
| pub const SIOCSIFMAC: c_ulong = 0x80206983; | ||
| pub const SIOCSIFKPI: c_ulong = 0x80206986; | ||
| pub const SIOCGIFKPI: c_ulong = 0xc0206987; | ||
| pub const SIOCGIFWAKEFLAGS: c_ulong = 0xc0206988; | ||
| pub const SIOCGIFFUNCTIONALTYPE: c_ulong = 0xc02069ad; | ||
| pub const SIOCSIF6LOWPAN: c_ulong = 0x802069c4; | ||
| pub const SIOCGIF6LOWPAN: c_ulong = 0xc02069c5; | ||
| pub const SIOCGIFDIRECTLINK: c_ulong = 0xc02069de; |
There was a problem hiding this comment.
We're trying to nudge anything completely new to the more organized new module. Would you be able to put this in a new file under src/new/apple/xnu/sys?
There was a problem hiding this comment.
(Maybe it'd be helpful that there's CI gate or something else to enforce it 🤔)
There was a problem hiding this comment.
Done, moved to src/new/apple/xnu/sys/sockio.rs.
|
Reminder, once the PR becomes ready for a review, use |
|
@rustbot ready |
| pub const SIOCSHIWAT: c_ulong = 0x80047300; | ||
| pub const SIOCGHIWAT: c_ulong = 0x40047301; | ||
| pub const SIOCSLOWAT: c_ulong = 0x80047302; | ||
| pub const SIOCGLOWAT: c_ulong = 0x40047303; | ||
| pub const SIOCATMARK: c_ulong = 0x40047307; | ||
| pub const SIOCSPGRP: c_ulong = 0x80047308; | ||
| pub const SIOCGPGRP: c_ulong = 0x40047309; | ||
| pub const SIOCSIFADDR: c_ulong = 0x8020690c; | ||
| pub const SIOCSIFDSTADDR: c_ulong = 0x8020690e; | ||
| pub const SIOCSIFFLAGS: c_ulong = 0x80206910; | ||
| pub const SIOCGIFFLAGS: c_ulong = 0xc0206911; | ||
| pub const SIOCSIFBRDADDR: c_ulong = 0x80206913; | ||
| pub const SIOCSIFNETMASK: c_ulong = 0x80206916; | ||
| pub const SIOCGIFMETRIC: c_ulong = 0xc0206917; | ||
| pub const SIOCSIFMETRIC: c_ulong = 0x80206918; | ||
| pub const SIOCDIFADDR: c_ulong = 0x80206919; | ||
| pub const SIOCAIFADDR: c_ulong = 0x8040691a; | ||
| pub const SIOCGIFDSTADDR: c_ulong = 0xc0206922; | ||
| pub const SIOCGIFBRDADDR: c_ulong = 0xc0206923; | ||
| pub const SIOCGIFCONF: c_ulong = 0xc00c6924; | ||
| pub const SIOCGIFNETMASK: c_ulong = 0xc0206925; | ||
| pub const SIOCAUTOADDR: c_ulong = 0xc0206926; | ||
| pub const SIOCAUTONETMASK: c_ulong = 0x80206927; | ||
| pub const SIOCARPIPLL: c_ulong = 0xc0206928; | ||
| pub const SIOCADDMULTI: c_ulong = 0x80206931; | ||
| pub const SIOCDELMULTI: c_ulong = 0x80206932; | ||
| pub const SIOCGIFMTU: c_ulong = 0xc0206933; | ||
| pub const SIOCSIFMTU: c_ulong = 0x80206934; | ||
| pub const SIOCGIFPHYS: c_ulong = 0xc0206935; | ||
| pub const SIOCSIFPHYS: c_ulong = 0x80206936; | ||
| pub const SIOCSIFMEDIA: c_ulong = 0xc0206937; | ||
| pub const SIOCGIFMEDIA: c_ulong = 0xc02c6938; | ||
| pub const SIOCSIFGENERIC: c_ulong = 0x80206939; | ||
| pub const SIOCGIFGENERIC: c_ulong = 0xc020693a; | ||
| pub const SIOCRSLVMULTI: c_ulong = 0xc010693b; | ||
| pub const SIOCSIFLLADDR: c_ulong = 0x8020693c; | ||
| pub const SIOCGIFSTATUS: c_ulong = 0xc331693d; | ||
| pub const SIOCSIFPHYADDR: c_ulong = 0x8040693e; | ||
| pub const SIOCGIFPSRCADDR: c_ulong = 0xc020693f; | ||
| pub const SIOCGIFPDSTADDR: c_ulong = 0xc0206940; | ||
| pub const SIOCDIFPHYADDR: c_ulong = 0x80206941; | ||
| pub const SIOCGIFDEVMTU: c_ulong = 0xc0206944; | ||
| pub const SIOCSIFALTMTU: c_ulong = 0x80206945; | ||
| pub const SIOCGIFALTMTU: c_ulong = 0xc0206948; | ||
| pub const SIOCSIFBOND: c_ulong = 0x80206946; | ||
| pub const SIOCGIFBOND: c_ulong = 0xc0206947; | ||
| pub const SIOCGIFXMEDIA: c_ulong = 0xc02c6948; | ||
| pub const SIOCSIFCAP: c_ulong = 0x8020695a; | ||
| pub const SIOCGIFCAP: c_ulong = 0xc020695b; | ||
| pub const SIOCSIFMANAGEMENT: c_ulong = 0xc020695c; | ||
| pub const SIOCIFCREATE: c_ulong = 0xc0206978; | ||
| pub const SIOCIFDESTROY: c_ulong = 0x80206979; | ||
| pub const SIOCIFCREATE2: c_ulong = 0xc020697a; | ||
| pub const SIOCSDRVSPEC: c_ulong = 0x8028697b; | ||
| pub const SIOCGDRVSPEC: c_ulong = 0xc028697b; | ||
| pub const SIOCSIFVLAN: c_ulong = 0x8020697e; | ||
| pub const SIOCGIFVLAN: c_ulong = 0xc020697f; | ||
| pub const SIOCSETVLAN: c_ulong = SIOCSIFVLAN; | ||
| pub const SIOCGETVLAN: c_ulong = SIOCGIFVLAN; | ||
| pub const SIOCIFGCLONERS: c_ulong = 0xc0106981; | ||
| pub const SIOCGIFASYNCMAP: c_ulong = 0xc020697c; | ||
| pub const SIOCSIFASYNCMAP: c_ulong = 0x8020697d; | ||
| pub const SIOCGIFMAC: c_ulong = 0xc0206982; | ||
| pub const SIOCSIFMAC: c_ulong = 0x80206983; | ||
| pub const SIOCSIFKPI: c_ulong = 0x80206986; | ||
| pub const SIOCGIFKPI: c_ulong = 0xc0206987; | ||
| pub const SIOCGIFWAKEFLAGS: c_ulong = 0xc0206988; | ||
| pub const SIOCGIFFUNCTIONALTYPE: c_ulong = 0xc02069ad; | ||
| pub const SIOCSIF6LOWPAN: c_ulong = 0x802069c4; | ||
| pub const SIOCGIF6LOWPAN: c_ulong = 0xc02069c5; | ||
| pub const SIOCGIFDIRECTLINK: c_ulong = 0xc02069de; |
There was a problem hiding this comment.
Sorry but just realized these are ioctl constants, we should avoid hardcoding them since they differ across platforms. I added the _IO* functions just now to https://github.com/rust-lang/libc/blob/f24764dc460a26c90b2d967fcffb7b341f8393f3/src/new/apple/xnu/sys/ioccom.rs, would you be able to use those?
Please squash when done then I think this should be all set.
There was a problem hiding this comment.
Rebased on main and switched to the _IO* functions. For the structs that aren't in libc yet (ifaliasreq, ifmediareq, ...) I went with raw _IOC and the size, same as TIOCPTYGNAME in ttycom.rs. Squashed into a single commit.
Add the socket and network interface ioctls from <sys/sockio.h> that were not yet exposed (SIOCGIFADDR is already defined at the BSD level). Link: https://github.com/apple-oss-distributions/xnu/blob/f6217f891ac0bb64f3d375211650a4c1ff8ca1ea/bsd/sys/sockio.h
459d0a9 to
d186129
Compare
|
@rustbot ready |
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
Add the socket and network interface ioctls from <sys/sockio.h> that were not yet exposed (SIOCGIFADDR is already defined at the BSD level). Link: https://github.com/apple-oss-distributions/xnu/blob/f6217f891ac0bb64f3d375211650a4c1ff8ca1ea/bsd/sys/sockio.h (backport <rust-lang#5263>) (cherry picked from commit 8ed7e2d)
Add the socket and network interface ioctls from <sys/sockio.h> that were not yet exposed (SIOCGIFADDR is already defined at the BSD level). Link: https://github.com/apple-oss-distributions/xnu/blob/f6217f891ac0bb64f3d375211650a4c1ff8ca1ea/bsd/sys/sockio.h (backport <rust-lang#5263>) (cherry picked from commit 8ed7e2d)
Add the socket and network interface ioctls from <sys/sockio.h> that were not yet exposed (SIOCGIFADDR is already defined at the BSD level). Link: https://github.com/apple-oss-distributions/xnu/blob/f6217f891ac0bb64f3d375211650a4c1ff8ca1ea/bsd/sys/sockio.h (backport <rust-lang#5263>) (cherry picked from commit 8ed7e2d)
Description
Add the socket and network interface ioctl constants from
<sys/sockio.h>for Apple targets: everything public in the header exceptSIOCGIFADDR, which is already defined at the BSD level.SIOCSETVLANandSIOCGETVLANare aliases, as in the header.sys/sockio.his added to the libc-test headers so ctest checks the values.Closes #3626
Sources
https://github.com/apple-oss-distributions/xnu/blob/f6217f891ac0bb64f3d375211650a4c1ff8ca1ea/bsd/sys/sockio.h
Checklist
libc-test/semverhave been updated*LASTor*MAXareincluded (see #3131)
cd libc-test && cargo test --target aarch64-apple-darwin)@rustbot label +stable-nominated