Skip to content

Commit 9f5766f

Browse files
committed
add missing socket constants
1 parent 21101f9 commit 9f5766f

File tree

15 files changed

+38
-50
lines changed

15 files changed

+38
-50
lines changed

libc-test/build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ fn main() {
7878
cfg.header("netinet/in.h");
7979
cfg.header("netinet/ip.h");
8080
cfg.header("netinet/tcp.h");
81+
cfg.header("netinet/udp.h");
8182
cfg.header("resolv.h");
8283
cfg.header("pthread.h");
8384
cfg.header("dlfcn.h");
@@ -150,6 +151,7 @@ fn main() {
150151
cfg.header("malloc/malloc.h");
151152
cfg.header("util.h");
152153
cfg.header("sys/xattr.h");
154+
cfg.header("sys/sys_domain.h");
153155
if target.starts_with("x86") {
154156
cfg.header("crt_externs.h");
155157
}
@@ -200,6 +202,7 @@ fn main() {
200202
cfg.header("sys/personality.h");
201203
cfg.header("sys/swap.h");
202204
cfg.header("pty.h");
205+
cfg.header("linux/netfilter_ipv4.h");
203206
if !uclibc {
204207
cfg.header("sys/sysinfo.h");
205208
}

src/unix/bsd/apple/mod.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,10 @@ pub const AF_PPP: ::c_int = 34;
889889
pub const pseudo_AF_HDRCMPLT: ::c_int = 35;
890890
#[doc(hidden)]
891891
pub const AF_MAX: ::c_int = 40;
892+
pub const AF_SYS_CONTROL: ::c_int = 2;
893+
894+
pub const SYSPROTO_EVENT: ::c_int = 1;
895+
pub const SYSPROTO_CONTROL: ::c_int = 2;
892896

893897
pub const PF_UNSPEC: ::c_int = AF_UNSPEC;
894898
pub const PF_LOCAL: ::c_int = AF_LOCAL;
@@ -946,13 +950,6 @@ pub const SOCK_DGRAM: ::c_int = 2;
946950
pub const SOCK_RAW: ::c_int = 3;
947951
pub const SOCK_RDM: ::c_int = 4;
948952
pub const SOCK_SEQPACKET: ::c_int = 5;
949-
pub const IPPROTO_ICMP: ::c_int = 1;
950-
pub const IPPROTO_ICMPV6: ::c_int = 58;
951-
pub const IPPROTO_TCP: ::c_int = 6;
952-
pub const IPPROTO_IP: ::c_int = 0;
953-
pub const IPPROTO_IPV6: ::c_int = 41;
954-
pub const IP_MULTICAST_TTL: ::c_int = 10;
955-
pub const IP_MULTICAST_LOOP: ::c_int = 11;
956953
pub const IP_TTL: ::c_int = 4;
957954
pub const IP_HDRINCL: ::c_int = 2;
958955
pub const IP_ADD_MEMBERSHIP: ::c_int = 12;
@@ -975,6 +972,7 @@ pub const SO_LINGER: ::c_int = 0x0080;
975972
pub const SO_OOBINLINE: ::c_int = 0x0100;
976973
pub const SO_REUSEPORT: ::c_int = 0x0200;
977974
pub const SO_TIMESTAMP: ::c_int = 0x0400;
975+
pub const SO_TIMESTAMP_MONOTONIC: ::c_int = 0x0800;
978976
pub const SO_DONTTRUNC: ::c_int = 0x2000;
979977
pub const SO_WANTMORE: ::c_int = 0x4000;
980978
pub const SO_WANTOOBFLAG: ::c_int = 0x8000;
@@ -986,11 +984,17 @@ pub const SO_SNDTIMEO: ::c_int = 0x1005;
986984
pub const SO_RCVTIMEO: ::c_int = 0x1006;
987985
pub const SO_ERROR: ::c_int = 0x1007;
988986
pub const SO_TYPE: ::c_int = 0x1008;
987+
pub const SO_LABEL: ::c_int = 0x1010;
988+
pub const SO_PEERLABEL: ::c_int = 0x1011;
989989
pub const SO_NREAD: ::c_int = 0x1020;
990990
pub const SO_NKE: ::c_int = 0x1021;
991991
pub const SO_NOSIGPIPE: ::c_int = 0x1022;
992992
pub const SO_NOADDRERR: ::c_int = 0x1023;
993993
pub const SO_NWRITE: ::c_int = 0x1024;
994+
pub const SO_REUSESHAREUID: ::c_int = 0x1025;
995+
pub const SO_NOTIFYCONFLICT: ::c_int = 0x1026;
996+
pub const SO_RANDOMPORT: ::c_int = 0x1082;
997+
pub const SO_NP_EXTENSIONS: ::c_int = 0x1083;
994998

995999
pub const MSG_OOB: ::c_int = 0x1;
9961000
pub const MSG_PEEK: ::c_int = 0x2;
@@ -1008,7 +1012,6 @@ pub const MSG_HAVEMORE: ::c_int = 0x2000;
10081012
pub const MSG_RCVMORE: ::c_int = 0x4000;
10091013
// pub const MSG_COMPAT: ::c_int = 0x8000;
10101014

1011-
pub const SCM_RIGHTS: ::c_int = 0x01;
10121015
pub const SCM_TIMESTAMP: ::c_int = 0x02;
10131016
pub const SCM_CREDS: ::c_int = 0x03;
10141017

src/unix/bsd/freebsdlike/mod.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,8 @@ pub const MSG_WAITALL: ::c_int = 0x00000040;
591591
pub const MSG_DONTWAIT: ::c_int = 0x00000080;
592592
pub const MSG_EOF: ::c_int = 0x00000100;
593593

594+
pub const SCM_TIMESTAMP: ::c_int = 0x02;
595+
594596
pub const SOCK_STREAM: ::c_int = 1;
595597
pub const SOCK_DGRAM: ::c_int = 2;
596598
pub const SOCK_RAW: ::c_int = 3;
@@ -599,13 +601,6 @@ pub const SOCK_SEQPACKET: ::c_int = 5;
599601
pub const SOCK_CLOEXEC: ::c_int = 0x10000000;
600602
pub const SOCK_NONBLOCK: ::c_int = 0x20000000;
601603
pub const SOCK_MAXADDRLEN: ::c_int = 255;
602-
pub const IPPROTO_ICMP: ::c_int = 1;
603-
pub const IPPROTO_ICMPV6: ::c_int = 58;
604-
pub const IPPROTO_TCP: ::c_int = 6;
605-
pub const IPPROTO_IP: ::c_int = 0;
606-
pub const IPPROTO_IPV6: ::c_int = 41;
607-
pub const IP_MULTICAST_TTL: ::c_int = 10;
608-
pub const IP_MULTICAST_LOOP: ::c_int = 11;
609604
pub const IP_TTL: ::c_int = 4;
610605
pub const IP_HDRINCL: ::c_int = 2;
611606
pub const IP_ADD_MEMBERSHIP: ::c_int = 12;

src/unix/bsd/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,17 @@ pub const SIG_SETMASK: ::c_int = 3;
180180
pub const SIG_BLOCK: ::c_int = 0x1;
181181
pub const SIG_UNBLOCK: ::c_int = 0x2;
182182

183+
pub const IP_MULTICAST_IF: ::c_int = 9;
184+
pub const IP_MULTICAST_TTL: ::c_int = 10;
185+
pub const IP_MULTICAST_LOOP: ::c_int = 11;
186+
183187
pub const IPV6_MULTICAST_LOOP: ::c_int = 11;
184188
pub const IPV6_V6ONLY: ::c_int = 27;
185189

186190
pub const ST_RDONLY: ::c_ulong = 1;
187191

192+
pub const SCM_RIGHTS: ::c_int = 0x01;
193+
188194
pub const NCCS: usize = 20;
189195

190196
pub const O_ACCMODE: ::c_int = 0x3;
@@ -303,6 +309,8 @@ pub const LOG_AUTHPRIV: ::c_int = 10 << 3;
303309
pub const LOG_FTP: ::c_int = 11 << 3;
304310
pub const LOG_PERROR: ::c_int = 0x20;
305311

312+
pub const TCP_MAXSEG: ::c_int = 2;
313+
306314
pub const PIPE_BUF: usize = 512;
307315

308316
f! {

src/unix/bsd/netbsdlike/mod.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -409,13 +409,6 @@ pub const SOCK_DGRAM: ::c_int = 2;
409409
pub const SOCK_RAW: ::c_int = 3;
410410
pub const SOCK_RDM: ::c_int = 4;
411411
pub const SOCK_SEQPACKET: ::c_int = 5;
412-
pub const IPPROTO_ICMP: ::c_int = 1;
413-
pub const IPPROTO_ICMPV6: ::c_int = 58;
414-
pub const IPPROTO_TCP: ::c_int = 6;
415-
pub const IPPROTO_IP: ::c_int = 0;
416-
pub const IPPROTO_IPV6: ::c_int = 41;
417-
pub const IP_MULTICAST_TTL: ::c_int = 10;
418-
pub const IP_MULTICAST_LOOP: ::c_int = 11;
419412
pub const IP_TTL: ::c_int = 4;
420413
pub const IP_HDRINCL: ::c_int = 2;
421414
pub const IP_ADD_MEMBERSHIP: ::c_int = 12;
@@ -455,8 +448,6 @@ pub const MSG_MCAST: ::c_int = 0x200;
455448
pub const MSG_NOSIGNAL: ::c_int = 0x400;
456449
pub const MSG_CMSG_CLOEXEC: ::c_int = 0x800;
457450

458-
pub const SCM_RIGHTS: ::c_int = 0x01;
459-
460451
pub const IFF_LOOPBACK: ::c_int = 0x8;
461452

462453
pub const SHUT_RD: ::c_int = 0;

src/unix/haiku/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -537,11 +537,6 @@ pub const AF_UNIX: ::c_int = 9;
537537
pub const AF_INET: ::c_int = 1;
538538
pub const AF_INET6: ::c_int = 6;
539539
pub const SOCK_RAW: ::c_int = 3;
540-
pub const IPPROTO_ICMP: ::c_int = 1;
541-
pub const IPPROTO_ICMPV6: ::c_int = 58;
542-
pub const IPPROTO_TCP: ::c_int = 6;
543-
pub const IPPROTO_IP: ::c_int = 0;
544-
pub const IPPROTO_IPV6: ::c_int = 41;
545540
pub const IP_MULTICAST_TTL: ::c_int = 10;
546541
pub const IP_MULTICAST_LOOP: ::c_int = 11;
547542
pub const IP_TTL: ::c_int = 4;

src/unix/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,13 @@ pub const PRIO_USER: ::c_int = 2;
217217
pub const PRIO_MIN: ::c_int = -20;
218218
pub const PRIO_MAX: ::c_int = 20;
219219

220+
pub const IPPROTO_ICMP: ::c_int = 1;
221+
pub const IPPROTO_ICMPV6: ::c_int = 58;
222+
pub const IPPROTO_TCP: ::c_int = 6;
223+
pub const IPPROTO_UDP: ::c_int = 17;
224+
pub const IPPROTO_IP: ::c_int = 0;
225+
pub const IPPROTO_IPV6: ::c_int = 41;
226+
220227
cfg_if! {
221228
if #[cfg(dox)] {
222229
// on dox builds don't pull in anything

src/unix/notbsd/android/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,6 @@ pub const SOCK_DGRAM: ::c_int = 2;
464464
pub const SOCK_SEQPACKET: ::c_int = 5;
465465

466466
pub const SOL_SOCKET: ::c_int = 1;
467-
pub const SOL_UDP: ::c_int = 17;
468467
pub const SOL_SCTP: ::c_int = 132;
469468
pub const SOL_IPX: ::c_int = 256;
470469
pub const SOL_AX25: ::c_int = 257;
@@ -500,6 +499,7 @@ pub const SO_BINDTODEVICE: ::c_int = 25;
500499
pub const SO_TIMESTAMP: ::c_int = 29;
501500
pub const SO_ACCEPTCONN: ::c_int = 30;
502501
pub const SO_SNDBUFFORCE: ::c_int = 32;
502+
pub const SO_RCVBUFFORCE: ::c_int = 33;
503503
pub const SO_MARK: ::c_int = 36;
504504
pub const SO_PROTOCOL: ::c_int = 38;
505505
pub const SO_DOMAIN: ::c_int = 39;

src/unix/notbsd/linux/mips/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,6 @@ pub const SO_DETACH_FILTER: ::c_int = 27;
328328
pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER;
329329
pub const SO_PEERNAME: ::c_int = 28;
330330
pub const SO_TIMESTAMP: ::c_int = 29;
331-
pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP;
332331
pub const SO_PEERSEC: ::c_int = 30;
333332
pub const SO_SNDBUFFORCE: ::c_int = 31;
334333
pub const SO_RCVBUFFORCE: ::c_int = 33;

src/unix/notbsd/linux/other/b64/aarch64.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ pub const SO_DETACH_FILTER: ::c_int = 27;
213213
pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER;
214214
pub const SO_PEERNAME: ::c_int = 28;
215215
pub const SO_TIMESTAMP: ::c_int = 29;
216-
pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP;
217216
pub const SO_ACCEPTCONN: ::c_int = 30;
218217
pub const SO_PEERSEC: ::c_int = 31;
219218
pub const SO_PASSSEC: ::c_int = 34;

src/unix/notbsd/linux/other/b64/powerpc64.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ pub const SO_DETACH_FILTER: ::c_int = 27;
211211
pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER;
212212
pub const SO_PEERNAME: ::c_int = 28;
213213
pub const SO_TIMESTAMP: ::c_int = 29;
214-
pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP;
215214
pub const SO_ACCEPTCONN: ::c_int = 30;
216215
pub const SO_PEERSEC: ::c_int = 31;
217216
pub const SO_PASSSEC: ::c_int = 34;

src/unix/notbsd/linux/other/b64/x86_64.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,6 @@ pub const SO_DETACH_FILTER: ::c_int = 27;
314314
pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER;
315315
pub const SO_PEERNAME: ::c_int = 28;
316316
pub const SO_TIMESTAMP: ::c_int = 29;
317-
pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP;
318317
pub const SO_ACCEPTCONN: ::c_int = 30;
319318
pub const SO_PEERSEC: ::c_int = 31;
320319
pub const SO_PASSSEC: ::c_int = 34;

src/unix/notbsd/mod.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@ pub const IFF_DYNAMIC: ::c_int = 0x8000;
437437

438438
pub const SOL_IP: ::c_int = 0;
439439
pub const SOL_TCP: ::c_int = 6;
440+
pub const SOL_UDP: ::c_int = 17;
440441
pub const SOL_IPV6: ::c_int = 41;
441442
pub const SOL_ICMPV6: ::c_int = 58;
442443
pub const SOL_RAW: ::c_int = 255;
@@ -553,12 +554,11 @@ pub const MSG_WAITFORONE: ::c_int = 0x10000;
553554
pub const MSG_FASTOPEN: ::c_int = 0x20000000;
554555
pub const MSG_CMSG_CLOEXEC: ::c_int = 0x40000000;
555556

557+
pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP;
558+
556559
pub const SOCK_RAW: ::c_int = 3;
557-
pub const IPPROTO_ICMP: ::c_int = 1;
558-
pub const IPPROTO_ICMPV6: ::c_int = 58;
559-
pub const IPPROTO_TCP: ::c_int = 6;
560-
pub const IPPROTO_IP: ::c_int = 0;
561-
pub const IPPROTO_IPV6: ::c_int = 41;
560+
pub const SOCK_RDM: ::c_int = 4;
561+
pub const IP_MULTICAST_IF: ::c_int = 32;
562562
pub const IP_MULTICAST_TTL: ::c_int = 33;
563563
pub const IP_MULTICAST_LOOP: ::c_int = 34;
564564
pub const IP_TTL: ::c_int = 2;
@@ -587,6 +587,7 @@ pub const IPV6_MULTICAST_LOOP: ::c_int = 19;
587587
pub const IPV6_V6ONLY: ::c_int = 26;
588588

589589
pub const SO_DEBUG: ::c_int = 1;
590+
pub const SO_ORIGINAL_DST: ::c_int = 80;
590591

591592
pub const SHUT_RD: ::c_int = 0;
592593
pub const SHUT_WR: ::c_int = 1;

src/unix/solaris/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -823,11 +823,6 @@ pub const SOCK_STREAM: ::c_int = 2;
823823
pub const SOCK_RAW: ::c_int = 4;
824824
pub const SOCK_RDM: ::c_int = 5;
825825
pub const SOCK_SEQPACKET: ::c_int = 6;
826-
pub const IPPROTO_ICMP: ::c_int = 1;
827-
pub const IPPROTO_ICMPV6: ::c_int = 58;
828-
pub const IPPROTO_TCP: ::c_int = 6;
829-
pub const IPPROTO_IP: ::c_int = 0;
830-
pub const IPPROTO_IPV6: ::c_int = 41;
831826
pub const IP_MULTICAST_TTL: ::c_int = 17;
832827
pub const IP_MULTICAST_LOOP: ::c_int = 18;
833828
pub const IP_TTL: ::c_int = 4;

src/unix/uclibc/mod.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -725,11 +725,6 @@ pub const MSG_WAITFORONE: ::c_int = 0x10000;
725725
pub const MSG_CMSG_CLOEXEC: ::c_int = 0x40000000;
726726

727727
pub const SOCK_RAW: ::c_int = 3;
728-
pub const IPPROTO_ICMP: ::c_int = 1;
729-
pub const IPPROTO_ICMPV6: ::c_int = 58;
730-
pub const IPPROTO_TCP: ::c_int = 6;
731-
pub const IPPROTO_IP: ::c_int = 0;
732-
pub const IPPROTO_IPV6: ::c_int = 41;
733728
pub const IP_MULTICAST_TTL: ::c_int = 33;
734729
pub const IP_MULTICAST_LOOP: ::c_int = 34;
735730
pub const IP_TTL: ::c_int = 2;
@@ -1779,4 +1774,3 @@ cfg_if! {
17791774
pub use unsupported_target;
17801775
}
17811776
}
1782-

0 commit comments

Comments
 (0)