syscalls_rust/
types.rs

1#![allow(non_camel_case_types)]
2
3use std::ffi::{c_char, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort};
4
5// pub type s128 = __s128;
6// pub type u128 = __u128;
7
8// pub type __kernel_dev_t = u32;
9
10// pub type fd_set = __kernel_fd_set;
11// pub type dev_t = __kernel_dev_t;
12// pub type ino_t = __kernel_ulong_t;
13// pub type mode_t = __kernel_mode_t;
14pub type umode_t = c_ushort;
15pub type nlink_t = u32;
16pub type off_t = c_long;
17// pub type daddr_t = __kernel_daddr_t;
18// pub type key_t = __kernel_key_t;
19// pub type suseconds_t = __kernel_suseconds_t;
20// pub type timer_t = __kernel_timer_t;
21// pub type clockid_t = __kernel_clockid_t;
22// pub type mqd_t = __kernel_mqd_t;
23
24pub type uid_t = c_uint;
25pub type gid_t = c_uint;
26// pub type uid16_t = __kernel_uid16_t;
27// pub type gid16_t = __kernel_gid16_t;
28
29pub type uintptr_t = c_ulong;
30pub type intptr_t = c_long;
31
32pub type size_t = c_ulong;
33pub type pid_t = c_int;
34
35pub type ssize_t = c_long;
36
37pub type u_char = c_uchar;
38pub type u_short = c_ushort;
39pub type u_int = c_uint;
40pub type u_long = c_ulong;
41pub type sa_family_t = c_ushort;
42
43
44#[repr(C)]
45#[derive(Debug)]
46pub struct sockaddr {
47	pub sa_family: sa_family_t,	/* address family, AF_xxx	*/
48	sa_data_min: [c_char; 14],		/* Minimum 14 bytes of protocol address	*/
49}
50
51
52#[repr(C)]
53#[derive(Debug)]
54pub struct Stat {
55	pub st_dev: c_uint,
56	pub st_ino: c_uint,
57	pub st_mode: c_uint,
58	pub st_nlink: c_uint,
59	pub st_uid: c_uint,
60	pub st_gid: c_uint,
61	pub st_rdev: c_uint,
62	pub st_size: c_long,
63	pub st_atime: c_ulong,
64	pub st_mtime: c_ulong,
65	pub st_ctime: c_ulong,
66	pub st_blksize: c_uint,
67	pub st_blocks: c_uint,
68	pub st_flags: c_uint,
69	pub st_gen: c_uint,
70}
71
72#[repr(C)]
73#[derive(Debug)]
74pub struct Pollfd {
75	pub fd: c_int,
76	pub events: c_short,
77	pub revents: c_short,
78}