forked from rust-lang/libc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmod.rs
197 lines (176 loc) · 4.59 KB
/
mod.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
pub type blkcnt_t = u64;
pub type blksize_t = i16;
pub type c_char = i8;
pub type c_long = isize;
pub type c_ulong = usize;
pub type cc_t = u8;
pub type clock_t = i64;
pub type dev_t = i32;
pub type fsblkcnt_t = u64;
pub type locale_t = *mut i8;
pub type mode_t = u32;
pub type nfds_t = u32;
pub type off_t = i64;
pub type pthread_condattr_t = u64;
pub type pthread_key_t = i32;
pub type pthread_mutexattr_t = u8;
pub type pthread_rwlockattr_t = i32;
pub type pthread_t = i32;
pub type rlim_t = i64;
pub type sa_family_t = u16;
pub type socklen_t = u32;
pub type speed_t = usize;
pub type suseconds_t = i32;
pub type tcflag_t = u32;
pub type time_t = i64;
pub type wchar_t = i32;
use c_void;
use timespec;
s! {
pub struct dq_entry_t {
flink: *mut dq_entry_t,
blink: *mut dq_entry_t,
}
pub struct dq_queue_t {
head: *mut dq_entry_t,
tail: *mut dq_entry_t,
}
pub struct stat {
st_dev: dev_t,
st_ino: u64,
st_mode: mode_t,
st_nlink: u64,
st_uid: u32,
st_gid: u32,
st_rdev: dev_t,
st_size: off_t,
st_atim: timespec,
st_mtim: timespec,
st_ctim: timespec,
st_blksize: blksize_t,
st_blocks: i64,
}
pub struct sockaddr {
pub sa_family: sa_family_t,
pub sa_data: [u8; 14],
}
pub struct passwd {
pw_name: *const c_char,
pw_uid: u32,
pw_gid: u32,
pw_gecos: *const c_char,
pw_dir: *const c_char,
pw_shell: *const c_char,
}
pub struct sem_t {
semcount: i16,
flags: u8,
waitlist: dq_queue_t,
holder: [usize; 5],
}
pub struct pthread_attr_t { __val: [u8; 0x40] }
pub struct pthread_mutex_t { __val: [u8; 0x40] }
pub struct pthread_cond_t {
sem: sem_t,
clockid: i32,
}
pub struct Dl_info {
dli_fname: *const c_char,
dli_fbase: *mut c_void,
dli_sname: *const c_char,
dli_saddr: *mut c_void,
}
pub struct lconv {
pub decimal_point: *const c_char,
pub thousands_sep: *const c_char,
pub grouping: *const c_char,
pub int_curr_symbol: *const c_char,
pub currency_symbol: *const c_char,
pub mon_decimal_point: *const c_char,
pub mon_thousands_sep: *const c_char,
pub mon_grouping: *const c_char,
pub positive_sign: *const c_char,
pub negative_sign: *const c_char,
pub int_frac_digits: i8,
pub frac_digits: i8,
pub p_cs_precedes: i8,
pub p_sep_by_space: i8,
pub n_cs_precedes: i8,
pub n_sep_by_space: i8,
pub p_sign_posn: i8,
pub n_sign_posn: i8,
pub int_n_cs_precedes: i8,
pub int_n_sep_by_space: i8,
pub int_n_sign_posn: i8,
pub int_p_cs_precedes: i8,
pub int_p_sep_by_space: i8,
pub int_p_sign_posn: i8,
}
pub struct tm {
pub tm_sec: i32,
pub tm_min: i32,
pub tm_hour: i32,
pub tm_mday: i32,
pub tm_mon: i32,
pub tm_year: i32,
pub tm_wday: i32,
pub tm_yday: i32,
pub tm_isdst: i32,
pub tm_gmtoff: isize,
pub tm_zone: *const i8,
}
pub struct addrinfo {
pub ai_flags: i32,
pub ai_family: i32,
pub ai_socktype: i32,
pub ai_protocol: i32,
pub ai_addrlen: socklen_t,
pub ai_addr: *mut sockaddr,
pub ai_canonname: *mut c_char,
pub ai_next: *mut addrinfo,
}
pub struct pthread_rwlock_t {
lock: pthread_mutex_t,
cv: pthread_cond_t,
num_readers: u32,
num_writers: u32,
write_in_progress: u8,
}
pub struct statvfs {
pub f_bsize: usize,
pub f_frsize: usize,
pub f_blocks: fsblkcnt_t,
pub f_bfree: fsblkcnt_t,
pub f_bavail: fsblkcnt_t,
pub f_files: fsblkcnt_t,
pub f_ffree: fsblkcnt_t,
pub f_favail: fsblkcnt_t,
pub f_fsid: usize,
pub f_flag: usize,
pub f_namemax: usize,
}
pub struct dirent {
pub d_type: u8,
pub d_name: [u8; 33],
}
pub struct fd_set {
pub __val: [u32; 8],
}
pub struct sigset_t {
pub __val: [u32; 2],
}
pub struct sigaction {
pub sa_handler: usize,
pub sa_mask: sigset_t,
pub sa_flags: i32,
pub sa_user: usize,
}
pub struct termios {
pub c_iflag: tcflag_t,
pub c_oflag: tcflag_t,
pub c_cflag: tcflag_t,
pub c_lflag: tcflag_t,
pub c_cc: [cc_t; 12],
pub c_speed: speed_t,
}
}