Skip to main content

syscalls_rust/types/
linux.rs

1#![allow(non_camel_case_types)]
2#![cfg(target_os = "linux")]
3
4use std::ffi::{c_char, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort};
5
6
7pub type umode_t = c_ushort;
8pub type nlink_t = u32;
9pub type off_t = c_long;
10
11pub type uid_t = c_uint;
12pub type gid_t = c_uint;
13
14pub type uintptr_t = c_ulong;
15pub type intptr_t = c_long;
16
17pub type size_t = c_ulong;
18pub type pid_t = c_int;
19
20pub type ssize_t = c_long;
21
22pub type u_char = c_uchar;
23pub type u_short = c_ushort;
24pub type u_int = c_uint;
25pub type u_long = c_ulong;
26pub type sa_family_t = c_ushort;
27pub type mode_t = c_ushort;
28
29
30#[repr(C)]
31#[derive(Debug)]
32pub struct sockaddr {
33	pub sa_family: sa_family_t,	/* address family, AF_xxx	*/
34	sa_data_min: [c_char; 14],		/* Minimum 14 bytes of protocol address	*/
35}
36
37
38#[repr(C)]
39#[derive(Debug)]
40pub struct Stat {
41	pub st_dev: c_uint,
42	pub st_ino: c_uint,
43	pub st_mode: c_uint,
44	pub st_nlink: c_uint,
45	pub st_uid: c_uint,
46	pub st_gid: c_uint,
47	pub st_rdev: c_uint,
48	pub st_size: c_long,
49	pub st_atime: c_ulong,
50	pub st_mtime: c_ulong,
51	pub st_ctime: c_ulong,
52	pub st_blksize: c_uint,
53	pub st_blocks: c_uint,
54	pub st_flags: c_uint,
55	pub st_gen: c_uint,
56}
57
58#[repr(C)]
59#[derive(Debug)]
60pub struct Pollfd {
61	pub fd: c_int,
62	pub events: c_short,
63	pub revents: c_short,
64}