Skip to content

Commit

Permalink
Consolidate all Ioctl constants and functions by architecture.
Browse files Browse the repository at this point in the history
  • Loading branch information
lancethepants committed Jan 17, 2022
1 parent df679e8 commit 3384294
Show file tree
Hide file tree
Showing 36 changed files with 329 additions and 935 deletions.
110 changes: 102 additions & 8 deletions src/unix/linux_like/linux/arch/generic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,108 @@ cfg_if! {
pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS;
pub const SCM_TIMESTAMPING: ::c_int = SO_TIMESTAMPING;

pub const TIOCMGET: ::Ioctl = 0x5415;
pub const TIOCMBIS: ::Ioctl = 0x5416;
pub const TIOCMBIC: ::Ioctl = 0x5417;
pub const TIOCMSET: ::Ioctl = 0x5418;
pub const TCGETS2: ::Ioctl = 0x802c542a;
pub const TCSETS2: ::Ioctl = 0x402c542b;
pub const TCSETSW2: ::Ioctl = 0x402c542c;
pub const TCSETSF2: ::Ioctl = 0x402c542d;
// Ioctl Constants

cfg_if! {
if #[cfg(not(any(target_arch = "mips",
target_arch = "mips64",
target_arch = "powerpc",
target_arch = "powerpc64",
target_arch = "sparc",
target_arch = "sparc64")))] {

pub const TCGETS: ::Ioctl = 0x5401;
pub const TCSETS: ::Ioctl = 0x5402;
pub const TCSETSW: ::Ioctl = 0x5403;
pub const TCSETSF: ::Ioctl = 0x5404;
pub const TCGETA: ::Ioctl = 0x5405;
pub const TCSETA: ::Ioctl = 0x5406;
pub const TCSETAW: ::Ioctl = 0x5407;
pub const TCSETAF: ::Ioctl = 0x5408;
pub const TCSBRK: ::Ioctl = 0x5409;
pub const TCXONC: ::Ioctl = 0x540A;
pub const TCFLSH: ::Ioctl = 0x540B;
pub const TIOCEXCL: ::Ioctl = 0x540C;
pub const TIOCNXCL: ::Ioctl = 0x540D;
pub const TIOCSCTTY: ::Ioctl = 0x540E;
pub const TIOCGPGRP: ::Ioctl = 0x540F;
pub const TIOCSPGRP: ::Ioctl = 0x5410;
pub const TIOCOUTQ: ::Ioctl = 0x5411;
pub const TIOCSTI: ::Ioctl = 0x5412;
pub const TIOCGWINSZ: ::Ioctl = 0x5413;
pub const TIOCSWINSZ: ::Ioctl = 0x5414;
pub const TIOCMGET: ::Ioctl = 0x5415;
pub const TIOCMBIS: ::Ioctl = 0x5416;
pub const TIOCMBIC: ::Ioctl = 0x5417;
pub const TIOCMSET: ::Ioctl = 0x5418;
pub const TIOCGSOFTCAR: ::Ioctl = 0x5419;
pub const TIOCSSOFTCAR: ::Ioctl = 0x541A;
pub const FIONREAD: ::Ioctl = 0x541B;
pub const TIOCINQ: ::Ioctl = FIONREAD;
pub const TIOCLINUX: ::Ioctl = 0x541C;
pub const TIOCCONS: ::Ioctl = 0x541D;
pub const TIOCGSERIAL: ::Ioctl = 0x541E;
pub const TIOCSSERIAL: ::Ioctl = 0x541F;
pub const TIOCPKT: ::Ioctl = 0x5420;
pub const FIONBIO: ::Ioctl = 0x5421;
pub const TIOCNOTTY: ::Ioctl = 0x5422;
pub const TIOCSETD: ::Ioctl = 0x5423;
pub const TIOCGETD: ::Ioctl = 0x5424;
pub const TCSBRKP: ::Ioctl = 0x5425;
pub const TIOCSBRK: ::Ioctl = 0x5427;
pub const TIOCCBRK: ::Ioctl = 0x5428;
pub const TIOCGSID: ::Ioctl = 0x5429;
pub const TCGETS2: ::Ioctl = 0x802c542a;
pub const TCSETS2: ::Ioctl = 0x402c542b;
pub const TCSETSW2: ::Ioctl = 0x402c542c;
pub const TCSETSF2: ::Ioctl = 0x402c542d;
pub const TIOCGRS485: ::Ioctl = 0x542E;
pub const TIOCSRS485: ::Ioctl = 0x542F;
pub const TIOCGPTN: ::Ioctl = 0x80045430;
pub const TIOCSPTLCK: ::Ioctl = 0x40045431;
pub const TIOCGDEV: ::Ioctl = 0x80045432;
pub const TCGETX: ::Ioctl = 0x5432;
pub const TCSETX: ::Ioctl = 0x5433;
pub const TCSETXF: ::Ioctl = 0x5434;
pub const TCSETXW: ::Ioctl = 0x5435;
pub const TIOCSIG: ::Ioctl = 0x40045436;
pub const TIOCVHANGUP: ::Ioctl = 0x5437;
pub const TIOCGPKT: ::Ioctl = 0x80045438;
pub const TIOCGPTLCK: ::Ioctl = 0x80045439;
pub const TIOCGEXCL: ::Ioctl = 0x80045440;
pub const TIOCGPTPEER: ::Ioctl = 0x5441;
// pub const TIOCGISO7816: ::Ioctl = 0x80285442;
// pub const TIOCSISO7816: ::Ioctl = 0xc0285443;
pub const FIONCLEX: ::Ioctl = 0x5450;
pub const FIOCLEX: ::Ioctl = 0x5451;
pub const FIOASYNC: ::Ioctl = 0x5452;
pub const TIOCSERCONFIG: ::Ioctl = 0x5453;
pub const TIOCSERGWILD: ::Ioctl = 0x5454;
pub const TIOCSERSWILD: ::Ioctl = 0x5455;
pub const TIOCGLCKTRMIOS: ::Ioctl = 0x5456;
pub const TIOCSLCKTRMIOS: ::Ioctl = 0x5457;
pub const TIOCSERGSTRUCT: ::Ioctl = 0x5458;
pub const TIOCSERGETLSR: ::Ioctl = 0x5459;
pub const TIOCSERGETMULTI: ::Ioctl = 0x545A;
pub const TIOCSERSETMULTI: ::Ioctl = 0x545B;
pub const TIOCMIWAIT: ::Ioctl = 0x545C;
pub const TIOCGICOUNT: ::Ioctl = 0x545D;
}
}

cfg_if! {
if #[cfg(any(target_arch = "arm",
target_arch = "s390x"))] {
pub const FIOQSIZE: ::Ioctl = 0x545E;
} else if #[cfg(not(any(target_arch = "mips",
target_arch = "mips64",
target_arch = "powerpc",
target_arch = "powerpc64",
target_arch = "sparc",
target_arch = "sparc64")))] {
pub const FIOQSIZE: ::Ioctl = 0x5460;
}
}

pub const TIOCM_LE: ::c_int = 0x001;
pub const TIOCM_DTR: ::c_int = 0x002;
Expand Down
76 changes: 76 additions & 0 deletions src/unix/linux_like/linux/arch/mips/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,90 @@ pub const SO_TIMESTAMPING: ::c_int = 37;
pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS;
pub const SCM_TIMESTAMPING: ::c_int = SO_TIMESTAMPING;

// Ioctl Constants

pub const TCGETS: ::Ioctl = 0x540d;
pub const TCSETS: ::Ioctl = 0x540e;
pub const TCSETSW: ::Ioctl = 0x540f;
pub const TCSETSF: ::Ioctl = 0x5410;
pub const TCGETA: ::Ioctl = 0x5401;
pub const TCSETA: ::Ioctl = 0x5402;
pub const TCSETAW: ::Ioctl = 0x5403;
pub const TCSETAF: ::Ioctl = 0x5404;
pub const TCSBRK: ::Ioctl = 0x5405;
pub const TCXONC: ::Ioctl = 0x5406;
pub const TCFLSH: ::Ioctl = 0x5407;
pub const TIOCEXCL: ::Ioctl = 0x740d;
pub const TIOCNXCL: ::Ioctl = 0x740e;
pub const TIOCSCTTY: ::Ioctl = 0x5480;
pub const TIOCGPGRP: ::Ioctl = 0x40047477;
pub const TIOCSPGRP: ::Ioctl = 0x80047476;
pub const TIOCOUTQ: ::Ioctl = 0x7472;
pub const TIOCSTI: ::Ioctl = 0x5472;
pub const TIOCGWINSZ: ::Ioctl = 0x40087468;
pub const TIOCSWINSZ: ::Ioctl = 0x80087467;
pub const TIOCMGET: ::Ioctl = 0x741d;
pub const TIOCMBIS: ::Ioctl = 0x741b;
pub const TIOCMBIC: ::Ioctl = 0x741c;
pub const TIOCMSET: ::Ioctl = 0x741a;
pub const TIOCGSOFTCAR: ::Ioctl = 0x5481;
pub const TIOCSSOFTCAR: ::Ioctl = 0x5482;
pub const FIONREAD: ::Ioctl = 0x467f;
pub const TIOCINQ: ::Ioctl = FIONREAD;
pub const TIOCLINUX: ::Ioctl = 0x5483;
pub const TIOCCONS: ::Ioctl = 0x80047478;
pub const TIOCGSERIAL: ::Ioctl = 0x5484;
pub const TIOCSSERIAL: ::Ioctl = 0x5485;
pub const TIOCPKT: ::Ioctl = 0x5470;
pub const FIONBIO: ::Ioctl = 0x667e;
pub const TIOCNOTTY: ::Ioctl = 0x5471;
pub const TIOCSETD: ::Ioctl = 0x7401;
pub const TIOCGETD: ::Ioctl = 0x7400;
pub const TCSBRKP: ::Ioctl = 0x5486;
pub const TIOCSBRK: ::Ioctl = 0x5427;
pub const TIOCCBRK: ::Ioctl = 0x5428;
pub const TIOCGSID: ::Ioctl = 0x7416;
pub const TCGETS2: ::Ioctl = 0x4030542a;
pub const TCSETS2: ::Ioctl = 0x8030542b;
pub const TCSETSW2: ::Ioctl = 0x8030542c;
pub const TCSETSF2: ::Ioctl = 0x8030542d;
pub const TIOCGPTN: ::Ioctl = 0x40045430;
pub const TIOCSPTLCK: ::Ioctl = 0x80045431;
pub const TIOCGDEV: ::Ioctl = 0x40045432;
pub const TIOCSIG: ::Ioctl = 0x80045436;
pub const TIOCVHANGUP: ::Ioctl = 0x5437;
pub const TIOCGPKT: ::Ioctl = 0x40045438;
pub const TIOCGPTLCK: ::Ioctl = 0x40045439;
pub const TIOCGEXCL: ::Ioctl = 0x40045440;
pub const TIOCGPTPEER: ::Ioctl = 0x20005441;
//pub const TIOCGISO7816: ::Ioctl = 0x40285442;
//pub const TIOCSISO7816: ::Ioctl = 0xc0285443;
pub const FIONCLEX: ::Ioctl = 0x6602;
pub const FIOCLEX: ::Ioctl = 0x6601;
pub const FIOASYNC: ::Ioctl = 0x667d;
pub const TIOCSERCONFIG: ::Ioctl = 0x5488;
pub const TIOCSERGWILD: ::Ioctl = 0x5489;
pub const TIOCSERSWILD: ::Ioctl = 0x548a;
pub const TIOCGLCKTRMIOS: ::Ioctl = 0x548b;
pub const TIOCSLCKTRMIOS: ::Ioctl = 0x548c;
pub const TIOCSERGSTRUCT: ::Ioctl = 0x548d;
pub const TIOCSERGETLSR: ::Ioctl = 0x548e;
pub const TIOCSERGETMULTI: ::Ioctl = 0x548f;
pub const TIOCSERSETMULTI: ::Ioctl = 0x5490;
pub const TIOCMIWAIT: ::Ioctl = 0x5491;
pub const TIOCGICOUNT: ::Ioctl = 0x5492;
pub const FIOQSIZE: ::Ioctl = 0x667f;
pub const TIOCSLTC: ::Ioctl = 0x7475;
pub const TIOCGETP: ::Ioctl = 0x7408;
pub const TIOCSETP: ::Ioctl = 0x7409;
pub const TIOCSETN: ::Ioctl = 0x740a;

cfg_if! {
if #[cfg(target_env = "musl")] {
pub const TIOCGRS485: ::Ioctl = 0x4020542e;
pub const TIOCSRS485: ::Ioctl = 0xc020542f;
}
}

pub const TIOCM_LE: ::c_int = 0x001;
pub const TIOCM_DTR: ::c_int = 0x002;
Expand Down
77 changes: 77 additions & 0 deletions src/unix/linux_like/linux/arch/powerpc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,87 @@ pub const SO_BINDTOIFINDEX: ::c_int = 62;
pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS;
pub const SCM_TIMESTAMPING: ::c_int = SO_TIMESTAMPING;

// Ioctl Constants

cfg_if! {
if #[cfg(target_env = "musl")] {
pub const TCGETS: ::Ioctl = 0x402c7413;
pub const TCSETS: ::Ioctl = 0x802c7414;
pub const TCSETSW: ::Ioctl = 0x802c7415;
pub const TCSETSF: ::Ioctl = 0x802c7416;
} else {
pub const TCGETS: ::Ioctl = 0x403c7413;
pub const TCSETS: ::Ioctl = 0x803c7414;
pub const TCSETSW: ::Ioctl = 0x803c7415;
pub const TCSETSF: ::Ioctl = 0x803c7416;
}
}

pub const TCGETA: ::Ioctl = 0x40147417;
pub const TCSETA: ::Ioctl = 0x80147418;
pub const TCSETAW: ::Ioctl = 0x80147419;
pub const TCSETAF: ::Ioctl = 0x8014741C;
pub const TCSBRK: ::Ioctl = 0x2000741D;
pub const TCXONC: ::Ioctl = 0x2000741E;
pub const TCFLSH: ::Ioctl = 0x2000741F;
pub const TIOCEXCL: ::Ioctl = 0x540C;
pub const TIOCNXCL: ::Ioctl = 0x540D;
pub const TIOCSCTTY: ::Ioctl = 0x540E;
pub const TIOCGPGRP: ::Ioctl = 0x40047477;
pub const TIOCSPGRP: ::Ioctl = 0x80047476;
pub const TIOCOUTQ: ::Ioctl = 0x40047473;
pub const TIOCSTI: ::Ioctl = 0x5412;
pub const TIOCGWINSZ: ::Ioctl = 0x40087468;
pub const TIOCSWINSZ: ::Ioctl = 0x80087467;
pub const TIOCMGET: ::Ioctl = 0x5415;
pub const TIOCMBIS: ::Ioctl = 0x5416;
pub const TIOCMBIC: ::Ioctl = 0x5417;
pub const TIOCMSET: ::Ioctl = 0x5418;
pub const TIOCGSOFTCAR: ::Ioctl = 0x5419;
pub const TIOCSSOFTCAR: ::Ioctl = 0x541A;
pub const FIONREAD: ::Ioctl = 0x4004667F;
pub const TIOCINQ: ::Ioctl = FIONREAD;
pub const TIOCLINUX: ::Ioctl = 0x541C;
pub const TIOCCONS: ::Ioctl = 0x541D;
pub const TIOCGSERIAL: ::Ioctl = 0x541E;
pub const TIOCSSERIAL: ::Ioctl = 0x541F;
pub const TIOCPKT: ::Ioctl = 0x5420;
pub const FIONBIO: ::Ioctl = 0x8004667e;
pub const TIOCNOTTY: ::Ioctl = 0x5422;
pub const TIOCSETD: ::Ioctl = 0x5423;
pub const TIOCGETD: ::Ioctl = 0x5424;
pub const TCSBRKP: ::Ioctl = 0x5425;
pub const TIOCSBRK: ::Ioctl = 0x5427;
pub const TIOCCBRK: ::Ioctl = 0x5428;
pub const TIOCGSID: ::Ioctl = 0x5429;
pub const TIOCGRS485: ::Ioctl = 0x542e;
pub const TIOCSRS485: ::Ioctl = 0x542f;
pub const TIOCGPTN: ::Ioctl = 0x40045430;
pub const TIOCSPTLCK: ::Ioctl = 0x80045431;
pub const TIOCGDEV: ::Ioctl = 0x40045432;
pub const TIOCSIG: ::Ioctl = 0x80045436;
pub const TIOCVHANGUP: ::Ioctl = 0x5437;
pub const TIOCGPKT: ::Ioctl = 0x40045438;
pub const TIOCGPTLCK: ::Ioctl = 0x40045439;
pub const TIOCGEXCL: ::Ioctl = 0x40045440;
pub const TIOCGPTPEER: ::Ioctl = 0x20005441;
//pub const TIOCGISO7816: ::Ioctl = 0x40285442;
//pub const TIOCSISO7816: ::Ioctl = 0xc0285443;
pub const FIONCLEX: ::Ioctl = 0x20006602;
pub const FIOCLEX: ::Ioctl = 0x20006601;
pub const FIOASYNC: ::Ioctl = 0x8004667d;
pub const TIOCSERCONFIG: ::Ioctl = 0x5453;
pub const TIOCSERGWILD: ::Ioctl = 0x5454;
pub const TIOCSERSWILD: ::Ioctl = 0x5455;
pub const TIOCGLCKTRMIOS: ::Ioctl = 0x5456;
pub const TIOCSLCKTRMIOS: ::Ioctl = 0x5457;
pub const TIOCSERGSTRUCT: ::Ioctl = 0x5458;
pub const TIOCSERGETLSR: ::Ioctl = 0x5459;
pub const TIOCSERGETMULTI: ::Ioctl = 0x545A;
pub const TIOCSERSETMULTI: ::Ioctl = 0x545B;
pub const TIOCMIWAIT: ::Ioctl = 0x545C;
pub const TIOCGICOUNT: ::Ioctl = 0x545D;
//pub const FIOQSIZE: ::Ioctl = 0x40086680;

pub const TIOCM_LE: ::c_int = 0x001;
pub const TIOCM_DTR: ::c_int = 0x002;
Expand Down
70 changes: 70 additions & 0 deletions src/unix/linux_like/linux/arch/sparc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,84 @@ pub const SO_TIMESTAMPING: ::c_int = 0x0023;
pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS;
pub const SCM_TIMESTAMPING: ::c_int = SO_TIMESTAMPING;

// Ioctl Constants

pub const TCGETS: ::Ioctl = 0x40245408;
pub const TCSETS: ::Ioctl = 0x80245409;
pub const TCSETSW: ::Ioctl = 0x8024540a;
pub const TCSETSF: ::Ioctl = 0x8024540b;
pub const TCGETA: ::Ioctl = 0x40125401;
pub const TCSETA: ::Ioctl = 0x80125402;
pub const TCSETAW: ::Ioctl = 0x80125403;
pub const TCSETAF: ::Ioctl = 0x80125404;
pub const TCSBRK: ::Ioctl = 0x20005405;
pub const TCXONC: ::Ioctl = 0x20005406;
pub const TCFLSH: ::Ioctl = 0x20005407;
pub const TIOCEXCL: ::Ioctl = 0x2000740d;
pub const TIOCNXCL: ::Ioctl = 0x2000740e;
pub const TIOCSCTTY: ::Ioctl = 0x20007484;
pub const TIOCGPGRP: ::Ioctl = 0x40047483;
pub const TIOCSPGRP: ::Ioctl = 0x80047482;
pub const TIOCOUTQ: ::Ioctl = 0x40047473;
pub const TIOCSTI: ::Ioctl = 0x80017472;
pub const TIOCGWINSZ: ::Ioctl = 0x40087468;
pub const TIOCSWINSZ: ::Ioctl = 0x80087467;
pub const TIOCMGET: ::Ioctl = 0x4004746a;
pub const TIOCMBIS: ::Ioctl = 0x8004746c;
pub const TIOCMBIC: ::Ioctl = 0x8004746b;
pub const TIOCMSET: ::Ioctl = 0x8004746d;
pub const TIOCGSOFTCAR: ::Ioctl = 0x40047464;
pub const TIOCSSOFTCAR: ::Ioctl = 0x80047465;
pub const FIONREAD: ::Ioctl = 0x4004667f;
pub const TIOCINQ: ::Ioctl = FIONREAD;
pub const TIOCLINUX: ::Ioctl = 0x541C;
pub const TIOCCONS: ::Ioctl = 0x20007424;
pub const TIOCGSERIAL: ::Ioctl = 0x541E;
pub const TIOCSSERIAL: ::Ioctl = 0x541F;
pub const TIOCPKT: ::Ioctl = 0x80047470;
pub const FIONBIO: ::Ioctl = 0x8004667e;
pub const TIOCNOTTY: ::Ioctl = 0x20007471;
pub const TIOCSETD: ::Ioctl = 0x80047401;
pub const TIOCGETD: ::Ioctl = 0x40047400;
pub const TCSBRKP: ::Ioctl = 0x5425;
pub const TIOCSBRK: ::Ioctl = 0x2000747b;
pub const TIOCCBRK: ::Ioctl = 0x2000747a;
pub const TIOCGSID: ::Ioctl = 0x40047485;
pub const TCGETS2: ::Ioctl = 0x402c540c;
pub const TCSETS2: ::Ioctl = 0x802c540d;
pub const TCSETSW2: ::Ioctl = 0x802c540e;
pub const TCSETSF2: ::Ioctl = 0x802c540f;
pub const TIOCGPTN: ::Ioctl = 0x40047486;
pub const TIOCSPTLCK: ::Ioctl = 0x80047487;
pub const TIOCGDEV: ::Ioctl = 0x40045432;
pub const TIOCSIG: ::Ioctl = 0x80047488;
pub const TIOCVHANGUP: ::Ioctl = 0x20005437;
pub const TIOCGPKT: ::Ioctl = 0x40045438;
pub const TIOCGPTLCK: ::Ioctl = 0x40045439;
pub const TIOCGEXCL: ::Ioctl = 0x40045440;
pub const TIOCGPTPEER: ::Ioctl = 0x20007489;
pub const FIONCLEX: ::Ioctl = 0x20006602;
pub const FIOCLEX: ::Ioctl = 0x20006601;
pub const FIOASYNC: ::Ioctl = 0x4004667d;
pub const TIOCSERCONFIG: ::Ioctl = 0x5453;
pub const TIOCSERGWILD: ::Ioctl = 0x5454;
pub const TIOCSERSWILD: ::Ioctl = 0x5455;
pub const TIOCGLCKTRMIOS: ::Ioctl = 0x5456;
pub const TIOCSLCKTRMIOS: ::Ioctl = 0x5457;
pub const TIOCSERGSTRUCT: ::Ioctl = 0x5458;
pub const TIOCSERGETLSR: ::Ioctl = 0x5459;
pub const TIOCSERGETMULTI: ::Ioctl = 0x545A;
pub const TIOCSERSETMULTI: ::Ioctl = 0x545B;
pub const TIOCMIWAIT: ::Ioctl = 0x545C;
pub const TIOCGICOUNT: ::Ioctl = 0x545D;
pub const TIOCSTART: ::Ioctl = 0x2000746e;
pub const TIOCSTOP: ::Ioctl = 0x2000746f;

//pub const FIOQSIZE: ::Ioctl = ;
//pub const TIOCGISO7816: ::Ioctl = 0x40285443;
//pub const TIOCSISO7816: ::Ioctl = 0xc0285444;
//pub const TIOCGRS485: ::Ioctl = 0x40205441;
//pub const TIOCSRS485: ::Ioctl = 0xc0205442;

pub const TIOCM_LE: ::c_int = 0x001;
pub const TIOCM_DTR: ::c_int = 0x002;
Expand Down
Loading

0 comments on commit 3384294

Please sign in to comment.