Skip to content

Commit 9858987

Browse files
author
Jorge Aparicio
committed
[WIP] sparc64-linux support
1 parent e49e9bb commit 9858987

File tree

5 files changed

+703
-9
lines changed

5 files changed

+703
-9
lines changed

src/unix/notbsd/linux/mod.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,12 @@ s! {
8787

8888
pub struct pthread_mutexattr_t {
8989
#[cfg(any(target_arch = "x86_64", target_arch = "powerpc64",
90-
target_arch = "mips64", target_arch = "s390x"))]
90+
target_arch = "mips64", target_arch = "s390x",
91+
target_arch = "sparc64"))]
9192
__align: [::c_int; 0],
9293
#[cfg(not(any(target_arch = "x86_64", target_arch = "powerpc64",
93-
target_arch = "mips64", target_arch = "s390x")))]
94+
target_arch = "mips64", target_arch = "s390x",
95+
target_arch = "sparc64")))]
9496
__align: [::c_long; 0],
9597
size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T],
9698
}
@@ -248,6 +250,7 @@ pub const ABMON_10: ::nl_item = 0x20017;
248250
pub const ABMON_11: ::nl_item = 0x20018;
249251
pub const ABMON_12: ::nl_item = 0x20019;
250252

253+
#[cfg(not(target_arch = "sparc64"))]
251254
pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
252255

253256
pub const MON_1: ::nl_item = 0x2001A;
@@ -500,11 +503,17 @@ pub const EPOLLONESHOT: ::c_int = 0x40000000;
500503
pub const QFMT_VFS_OLD: ::c_int = 1;
501504
pub const QFMT_VFS_V0: ::c_int = 2;
502505

506+
#[cfg(not(target_arch = "sparc64"))]
503507
pub const SFD_CLOEXEC: ::c_int = 0x080000;
508+
#[cfg(target_arch = "sparc64")]
509+
pub const SFD_CLOEXEC: ::c_int = 0x400000;
504510

505511
pub const EFD_SEMAPHORE: ::c_int = 0x1;
506512

513+
#[cfg(not(target_arch = "sparc64"))]
507514
pub const NCCS: usize = 32;
515+
#[cfg(target_arch = "sparc64")]
516+
pub const NCCS: usize = 17;
508517

509518
pub const LOG_NFACILITIES: ::c_int = 24;
510519

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ pub type c_long = i64;
44
pub type c_ulong = u64;
55
pub type clock_t = i64;
66
pub type time_t = i64;
7+
#[cfg(not(target_arch = "sparc64"))]
78
pub type suseconds_t = i64;
9+
#[cfg(target_arch = "sparc64")]
10+
pub type suseconds_t = i32;
811
pub type ino_t = u64;
912
pub type off_t = i64;
1013
pub type blkcnt_t = i64;
@@ -56,6 +59,9 @@ cfg_if! {
5659
} else if #[cfg(any(target_arch = "powerpc64"))] {
5760
mod powerpc64;
5861
pub use self::powerpc64::*;
62+
} else if #[cfg(any(target_arch = "sparc64"))] {
63+
mod sparc64;
64+
pub use self::sparc64::*;
5965
} else if #[cfg(any(target_arch = "x86_64"))] {
6066
mod x86_64;
6167
pub use self::x86_64::*;
Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
//! SPARC64-specific definitions for 64-bit linux-like values
2+
3+
pub type c_char = i8;
4+
pub type wchar_t = i32;
5+
pub type nlink_t = u32;
6+
pub type blksize_t = i64;
7+
8+
s! {
9+
pub struct stat {
10+
pub st_dev: ::dev_t,
11+
__pad0: u64,
12+
pub st_ino: ::ino_t,
13+
pub st_mode: ::mode_t,
14+
pub st_nlink: ::nlink_t,
15+
pub st_uid: ::uid_t,
16+
pub st_gid: ::gid_t,
17+
pub st_rdev: ::dev_t,
18+
__pad1: u64,
19+
pub st_size: ::off_t,
20+
pub st_blksize: ::blksize_t,
21+
pub st_blocks: ::blkcnt_t,
22+
pub st_atime: ::time_t,
23+
pub st_atime_nsec: ::c_long,
24+
pub st_mtime: ::time_t,
25+
pub st_mtime_nsec: ::c_long,
26+
pub st_ctime: ::time_t,
27+
pub st_ctime_nsec: ::c_long,
28+
__unused: [::c_long; 2],
29+
}
30+
31+
pub struct stat64 {
32+
pub st_dev: ::dev_t,
33+
__pad0: u64,
34+
pub st_ino: ::ino64_t,
35+
pub st_mode: ::mode_t,
36+
pub st_nlink: ::nlink_t,
37+
pub st_uid: ::uid_t,
38+
pub st_gid: ::gid_t,
39+
pub st_rdev: ::dev_t,
40+
__pad2: ::c_int,
41+
pub st_size: ::off64_t,
42+
pub st_blksize: ::blksize_t,
43+
pub st_blocks: ::blkcnt64_t,
44+
pub st_atime: ::time_t,
45+
pub st_atime_nsec: ::c_long,
46+
pub st_mtime: ::time_t,
47+
pub st_mtime_nsec: ::c_long,
48+
pub st_ctime: ::time_t,
49+
pub st_ctime_nsec: ::c_long,
50+
__reserved: [::c_long; 2],
51+
}
52+
53+
pub struct pthread_attr_t {
54+
__size: [u64; 7]
55+
}
56+
57+
pub struct ipc_perm {
58+
pub __key: ::key_t,
59+
pub uid: ::uid_t,
60+
pub gid: ::gid_t,
61+
pub cuid: ::uid_t,
62+
pub cgid: ::gid_t,
63+
pub mode: ::mode_t,
64+
__pad0: u16,
65+
pub __seq: ::c_ushort,
66+
__unused1: ::c_ulonglong,
67+
__unused2: ::c_ulonglong,
68+
}
69+
70+
pub struct shmid_ds {
71+
pub shm_perm: ::ipc_perm,
72+
pub shm_atime: ::time_t,
73+
pub shm_dtime: ::time_t,
74+
pub shm_ctime: ::time_t,
75+
pub shm_segsz: ::size_t,
76+
pub shm_cpid: ::pid_t,
77+
pub shm_lpid: ::pid_t,
78+
pub shm_nattch: ::shmatt_t,
79+
__reserved1: ::c_ulong,
80+
__reserved2: ::c_ulong
81+
}
82+
}
83+
84+
pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
85+
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
86+
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
87+
88+
pub const O_DIRECTORY: ::c_int = 0o200000;
89+
pub const O_NOFOLLOW: ::c_int = 0o400000;
90+
pub const O_DIRECT: ::c_int = 0x100000;
91+
92+
pub const MAP_LOCKED: ::c_int = 0x0100;
93+
pub const MAP_NORESERVE: ::c_int = 0x00040;
94+
95+
pub const EDEADLOCK: ::c_int = 108;
96+
97+
pub const SO_PEERCRED: ::c_int = 0x40;
98+
pub const SO_RCVLOWAT: ::c_int = 0x800;
99+
pub const SO_SNDLOWAT: ::c_int = 0x1000;
100+
pub const SO_RCVTIMEO: ::c_int = 0x2000;
101+
pub const SO_SNDTIMEO: ::c_int = 0x4000;
102+
103+
pub const FIOCLEX: ::c_ulong = 0x20006601;
104+
pub const FIONBIO: ::c_ulong = 0x8004667e;
105+
106+
pub const SYS_gettid: ::c_long = 143;
107+
pub const SYS_perf_event_open: ::c_long = 327;
108+
109+
pub const MCL_CURRENT: ::c_int = 0x2000;
110+
pub const MCL_FUTURE: ::c_int = 0x4000;
111+
112+
pub const SIGSTKSZ: ::size_t = 16384;
113+
pub const CBAUD: ::tcflag_t = 0x0000100f;
114+
pub const TAB1: ::c_int = 0x800;
115+
pub const TAB2: ::c_int = 0x1000;
116+
pub const TAB3: ::c_int = 0x1800;
117+
pub const CR1: ::c_int = 0x200;
118+
pub const CR2: ::c_int = 0x400;
119+
pub const CR3: ::c_int = 0x600;
120+
pub const FF1: ::c_int = 0x8000;
121+
pub const BS1: ::c_int = 0x2000;
122+
pub const VT1: ::c_int = 0x4000;
123+
pub const VWERASE: usize = 0xe;
124+
pub const VREPRINT: usize = 0xc;
125+
pub const VSUSP: usize = 0xa;
126+
pub const VSTART: usize = 0x8;
127+
pub const VSTOP: usize = 0x9;
128+
pub const VDISCARD: usize = 0xd;
129+
pub const VTIME: usize = 0x5;
130+
pub const IXON: ::tcflag_t = 0x400;
131+
pub const IXOFF: ::tcflag_t = 0x1000;
132+
pub const ONLCR: ::tcflag_t = 0x4;
133+
pub const CSIZE: ::tcflag_t = 0x30;
134+
pub const CS6: ::tcflag_t = 0x10;
135+
pub const CS7: ::tcflag_t = 0x20;
136+
pub const CS8: ::tcflag_t = 0x30;
137+
pub const CSTOPB: ::tcflag_t = 0x40;
138+
pub const CREAD: ::tcflag_t = 0x80;
139+
pub const PARENB: ::tcflag_t = 0x100;
140+
pub const PARODD: ::tcflag_t = 0x200;
141+
pub const HUPCL: ::tcflag_t = 0x400;
142+
pub const CLOCAL: ::tcflag_t = 0x800;
143+
pub const ECHOKE: ::tcflag_t = 0x800;
144+
pub const ECHOE: ::tcflag_t = 0x10;
145+
pub const ECHOK: ::tcflag_t = 0x20;
146+
pub const ECHONL: ::tcflag_t = 0x40;
147+
pub const ECHOPRT: ::tcflag_t = 0x400;
148+
pub const ECHOCTL: ::tcflag_t = 0x200;
149+
pub const ISIG: ::tcflag_t = 0x1;
150+
pub const ICANON: ::tcflag_t = 0x2;
151+
pub const PENDIN: ::tcflag_t = 0x4000;
152+
pub const NOFLSH: ::tcflag_t = 0x80;
153+
154+
pub const VEOL: usize = 5;
155+
pub const VEOL2: usize = 6;
156+
pub const VMIN: usize = 4;
157+
pub const IEXTEN: ::tcflag_t = 0x8000;
158+
pub const TOSTOP: ::tcflag_t = 0x100;
159+
pub const FLUSHO: ::tcflag_t = 0x2000;
160+
pub const EXTPROC: ::tcflag_t = 0x10000;
161+
pub const TCGETS: ::c_ulong = 0x40245408;
162+
pub const TCSETS: ::c_ulong = 0x80245409;
163+
pub const TCSETSW: ::c_ulong = 0x8024540a;
164+
pub const TCSETSF: ::c_ulong = 0x8024540b;
165+
pub const TCGETA: ::c_ulong = 0x40125401;
166+
pub const TCSETA: ::c_ulong = 0x80125402;
167+
pub const TCSETAW: ::c_ulong = 0x80125403;
168+
pub const TCSETAF: ::c_ulong = 0x80125404;
169+
pub const TCSBRK: ::c_ulong = 0x20005405;
170+
pub const TCXONC: ::c_ulong = 0x20005406;
171+
pub const TCFLSH: ::c_ulong = 0x20005407;
172+
pub const TIOCINQ: ::c_ulong = 0x4004667f;
173+
pub const TIOCGPGRP: ::c_ulong = 0x40047483;
174+
pub const TIOCSPGRP: ::c_ulong = 0x80047482;
175+
pub const TIOCOUTQ: ::c_ulong = 0x40047473;
176+
pub const TIOCGWINSZ: ::c_ulong = 0x40087468;
177+
pub const TIOCSWINSZ: ::c_ulong = 0x80087467;
178+
pub const FIONREAD: ::c_ulong = 0x4004667f;

0 commit comments

Comments
 (0)