forked from rust-lang/libc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Define the essential types that from NuttX Signed-off-by: Huang Qi <[email protected]>
- Loading branch information
Showing
2 changed files
with
206 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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, | ||
} | ||
} |