Skip to main content

relibc/header/stdio/
constants.rs

1use crate::platform::types::{c_int, c_uint, int32_t, off_t};
2
3pub const EOF: c_int = -1;
4pub const BUFSIZ: c_int = 1024;
5
6pub const UNGET: c_int = 8;
7
8pub const FILENAME_MAX: c_int = 4096;
9
10pub const F_PERM: c_int = 1;
11pub const F_NORD: c_int = 4;
12pub const F_NOWR: c_int = 8;
13pub const F_EOF: c_int = 16;
14pub const F_ERR: c_int = 32;
15pub const F_SVB: c_int = 64;
16pub const F_APP: c_int = 128;
17pub const F_BADJ: c_int = 256;
18
19// SEEK_SET, SEEK_CUR and SEEK_END defined in fcntl bits header
20
21pub const _IOFBF: c_int = 0;
22pub const _IOLBF: c_int = 1;
23pub const _IONBF: c_int = 2;
24
25// renameat2
26// (uint instead of int is intentional)
27/// Rename but don't replace the target if it exists.
28pub const RENAME_NOREPLACE: c_uint = 0x01;
29/// Atomically swap two files.
30#[cfg(target_os = "linux")]
31pub const RENAME_EXCHANGE: c_uint = 0x02;
32#[cfg(target_os = "linux")]
33pub const RENAME_WHITEOUT: c_uint = 0x04;
34
35// /dev/tty + nul
36pub const L_ctermid: usize = 9;
37// form of name is /XXXXXX, so 7
38pub const L_tmpnam: c_int = 7;
39// 36^6 (26 letters + 10 digits) is larger than i32::MAX, so just set to that
40// for now
41pub const TMP_MAX: int32_t = 2_147_483_647;
42// XXX: defined manually in cbindgen as well because it can't handle
43//      string constants in any form AFAICT
44/// cbindgen:ignore
45pub const P_tmpdir: &[u8; 5] = b"/tmp\0";
46
47#[allow(non_camel_case_types)]
48pub type fpos_t = off_t;