+1
Cargo.toml
+1
Cargo.toml
+5
-1
src/header/libgen/mod.rs
+5
-1
src/header/libgen/mod.rs
···
1
-
//! libgen implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/libgen.h.html
1
+
//! `libgen.h` implementation.
2
+
//!
3
+
//! See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/libgen.h.html>.
2
4
3
5
#![deny(unsafe_op_in_unsafe_fn)]
4
6
···
6
8
7
9
use crate::header::string::strlen;
8
10
11
+
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/basename.html>.
9
12
#[unsafe(no_mangle)]
10
13
pub unsafe extern "C" fn basename(str: *mut c_char) -> *mut c_char {
11
14
if str.is_null() || unsafe { strlen(str) == 0 } {
···
28
31
}
29
32
}
30
33
34
+
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/dirname.html>.
31
35
#[unsafe(no_mangle)]
32
36
pub unsafe extern "C" fn dirname(str: *mut c_char) -> *mut c_char {
33
37
if str.is_null() || unsafe { strlen(str) == 0 } {
+12
-3
src/header/sys_resource/mod.rs
+12
-3
src/header/sys_resource/mod.rs
···
1
-
//! sys/resource.h implementation for Redox, following
2
-
//! http://pubs.opengroup.org/onlinepubs/7908799/xsh/sysresource.h.html
1
+
//! `sys/resource.h` implementation.
2
+
//!
3
+
//! See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/sys_resource.h.html>.
3
4
4
5
use crate::{
5
6
error::ResultExt,
6
7
header::sys_time::timeval,
7
8
out::Out,
8
-
platform::{Pal, Sys, types::*},
9
+
platform::{
10
+
Pal, Sys,
11
+
types::{c_int, c_long, id_t},
12
+
},
9
13
};
10
14
11
15
// Exported in bits file
···
67
71
pub const PRIO_PGRP: c_int = 1;
68
72
pub const PRIO_USER: c_int = 2;
69
73
74
+
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/getpriority.html>.
70
75
#[unsafe(no_mangle)]
71
76
pub unsafe extern "C" fn getpriority(which: c_int, who: id_t) -> c_int {
72
77
let r = Sys::getpriority(which, who).or_minus_one_errno();
···
76
81
20 - r
77
82
}
78
83
84
+
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/setpriority.html>.
79
85
#[unsafe(no_mangle)]
80
86
pub unsafe extern "C" fn setpriority(which: c_int, who: id_t, nice: c_int) -> c_int {
81
87
Sys::setpriority(which, who, nice)
···
83
89
.or_minus_one_errno()
84
90
}
85
91
92
+
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/getrlimit.html>.
86
93
#[unsafe(no_mangle)]
87
94
pub unsafe extern "C" fn getrlimit(resource: c_int, rlp: *mut rlimit) -> c_int {
88
95
let rlp = Out::nonnull(rlp);
···
92
99
.or_minus_one_errno()
93
100
}
94
101
102
+
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/setrlimit.html>.
95
103
#[unsafe(no_mangle)]
96
104
pub unsafe extern "C" fn setrlimit(resource: c_int, rlp: *const rlimit) -> c_int {
97
105
Sys::setrlimit(resource, rlp)
···
99
107
.or_minus_one_errno()
100
108
}
101
109
110
+
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/getrusage.html>.
102
111
#[unsafe(no_mangle)]
103
112
pub unsafe extern "C" fn getrusage(who: c_int, r_usage: *mut rusage) -> c_int {
104
113
Sys::getrusage(who, Out::nonnull(r_usage))
+1
include/sys/types_internal.h
+1
include/sys/types_internal.h
+1
src/platform/types.rs
+1
src/platform/types.rs
+2
-2
tests/dirent/posix_getdents.c
+2
-2
tests/dirent/posix_getdents.c
···
14
14
char buffer[BUFFER_SIZE];
15
15
long nread;
16
16
long bpos;
17
-
struct dirent *d;
17
+
struct posix_dent *d;
18
18
19
19
for (;;) {
20
20
nread = posix_getdents(fd, buffer, BUFFER_SIZE, 0);
···
26
26
}
27
27
28
28
for (bpos = 0; bpos < nread;) {
29
-
d = (struct dirent *) (buffer + bpos);
29
+
d = (struct posix_dent *) (buffer + bpos);
30
30
printf(" ino = %-10lu name = %s\n", (unsigned long)d->d_ino, d->d_name);
31
31
bpos += d->d_reclen;
32
32
}
+7
-2
src/header/assert/mod.rs
+7
-2
src/header/assert/mod.rs
···
1
-
//! assert implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/assert.h.html
1
+
//! `assert.h` implementation.
2
+
//!
3
+
//! See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/assert.h.html>.
2
4
3
5
// TODO: set this for entire crate when possible
4
6
#![deny(unsafe_op_in_unsafe_fn)]
5
7
6
-
use crate::{c_str::CStr, platform::types::*};
8
+
use crate::{
9
+
c_str::CStr,
10
+
platform::types::{c_char, c_int},
11
+
};
7
12
8
13
#[unsafe(no_mangle)]
9
14
pub unsafe extern "C" fn __assert_fail(
+13
-2
src/header/fcntl/mod.rs
+13
-2
src/header/fcntl/mod.rs
···
1
-
//! fcntl implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/fcntl.h.html
1
+
//! `fcntl.h` implementation.
2
+
//!
3
+
//! See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/fcntl.h.html>.
2
4
3
5
#![deny(unsafe_op_in_unsafe_fn)]
4
6
5
7
use crate::{
6
8
c_str::CStr,
7
9
error::ResultExt,
8
-
platform::{Pal, Sys, types::*},
10
+
platform::{
11
+
Pal, Sys,
12
+
types::{c_char, c_int, c_short, c_ulonglong, mode_t, off_t, pid_t},
13
+
},
9
14
};
10
15
11
16
pub use self::sys::*;
···
36
41
pub const F_TLOCK: c_int = 2;
37
42
pub const F_TEST: c_int = 3;
38
43
44
+
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/creat.html>.
39
45
#[unsafe(no_mangle)]
40
46
pub unsafe extern "C" fn creat(path: *const c_char, mode: mode_t) -> c_int {
41
47
unsafe { open(path, O_WRONLY | O_CREAT | O_TRUNC, mode) }
42
48
}
49
+
50
+
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/fcntl.h.html>.
43
51
#[repr(C)]
44
52
#[derive(Clone, Copy, Default)]
45
53
pub struct flock {
···
49
57
pub l_len: off_t,
50
58
pub l_pid: pid_t,
51
59
}
60
+
61
+
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fcntl.html>.
52
62
#[unsafe(no_mangle)]
53
63
pub unsafe extern "C" fn fcntl(fildes: c_int, cmd: c_int, mut __valist: ...) -> c_int {
54
64
// c_ulonglong
···
62
72
Sys::fcntl(fildes, cmd, arg).or_minus_one_errno()
63
73
}
64
74
75
+
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/open.html>.
65
76
#[unsafe(no_mangle)]
66
77
pub unsafe extern "C" fn open(path: *const c_char, oflag: c_int, mut __valist: ...) -> c_int {
67
78
let mode = if oflag & O_CREAT == O_CREAT
+2
src/out.rs
+2
src/out.rs
···
205
205
pub unsafe trait CastSlice<U> {}
206
206
unsafe impl CastSlice<i8> for u8 {}
207
207
unsafe impl CastSlice<u8> for i8 {}
208
+
unsafe impl CastSlice<u8> for u8 {}
209
+
unsafe impl CastSlice<i8> for i8 {}
208
210
209
211
impl<T: ?Sized> fmt::Pointer for Out<'_, T> {
210
212
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+35
-35
flake.lock
+35
-35
flake.lock
···
1
1
{
2
2
"nodes": {
3
-
"crane": {
3
+
"dlmalloc": {
4
+
"flake": false,
4
5
"locked": {
5
-
"lastModified": 1759893430,
6
-
"narHash": "sha256-yAy4otLYm9iZ+NtQwTMEbqHwswSFUbhn7x826RR6djw=",
7
-
"owner": "ipetkov",
8
-
"repo": "crane",
9
-
"rev": "1979a2524cb8c801520bd94c38bb3d5692419d93",
10
-
"type": "github"
6
+
"lastModified": 1742946635,
7
+
"narHash": "sha256-yD3T9/5Ttv22SXBsEsVSW9Ww7KZ/uZNtauyacP5Od0c=",
8
+
"ref": "refs/heads/main",
9
+
"rev": "e4ba8493497c72e15f2b9d428e1dea17e26bf188",
10
+
"revCount": 132,
11
+
"type": "git",
12
+
"url": "https://gitlab.redox-os.org/redox-os/dlmalloc-rs.git"
11
13
},
12
14
"original": {
13
-
"owner": "ipetkov",
14
-
"repo": "crane",
15
-
"type": "github"
15
+
"type": "git",
16
+
"url": "https://gitlab.redox-os.org/redox-os/dlmalloc-rs.git"
16
17
}
17
18
},
18
19
"fenix": {
···
23
24
"rust-analyzer-src": "rust-analyzer-src"
24
25
},
25
26
"locked": {
26
-
"lastModified": 1760164678,
27
-
"narHash": "sha256-yxcfwZCysR6zPaFv7is3/FWd1h0h6kXME0vueSwTBhU=",
27
+
"lastModified": 1760337631,
28
+
"narHash": "sha256-3nvEN2lEpWtM1x7nfuiwpYHLNDgEUiWeBbyvy4vtVw8=",
28
29
"owner": "nix-community",
29
30
"repo": "fenix",
30
-
"rev": "2579f163559b902959cc420a6d3bfbd98c46a323",
31
+
"rev": "fee7cf67cbd80a74460563388ac358b394014238",
31
32
"type": "github"
32
33
},
33
34
"original": {
···
85
86
"type": "github"
86
87
}
87
88
},
89
+
"openlibm": {
90
+
"flake": false,
91
+
"locked": {
92
+
"lastModified": 1757301398,
93
+
"narHash": "sha256-jQoqfKE6CeXg/Gjy8O7wtlDQzxORRUqU56AoquCG7Y0=",
94
+
"ref": "refs/heads/master",
95
+
"rev": "f5ed774593458e116e69731a3ffa59e2a6408d4e",
96
+
"revCount": 593,
97
+
"type": "git",
98
+
"url": "https://gitlab.redox-os.org/redox-os/openlibm.git"
99
+
},
100
+
"original": {
101
+
"type": "git",
102
+
"url": "https://gitlab.redox-os.org/redox-os/openlibm.git"
103
+
}
104
+
},
88
105
"root": {
89
106
"inputs": {
90
-
"crane": "crane",
107
+
"dlmalloc": "dlmalloc",
91
108
"fenix": "fenix",
92
109
"flake-parts": "flake-parts",
93
110
"nixpkgs": "nixpkgs",
94
-
"src": "src"
111
+
"openlibm": "openlibm"
95
112
}
96
113
},
97
114
"rust-analyzer-src": {
98
115
"flake": false,
99
116
"locked": {
100
-
"lastModified": 1760090851,
101
-
"narHash": "sha256-XGkBjf4Dzg6tXd0KGgKzeW4oVX/iLzLhD3rQ1cATpqM=",
117
+
"lastModified": 1760260966,
118
+
"narHash": "sha256-pOVvZz/aa+laeaUKyE6PtBevdo4rywMwjhWdSZE/O1c=",
102
119
"owner": "rust-lang",
103
120
"repo": "rust-analyzer",
104
-
"rev": "b93180b4f2cb3c81ac7f17f46e3dfcb30ecc7843",
121
+
"rev": "c5181dbbe33af6f21b9d83e02fdb6fda298a3b65",
105
122
"type": "github"
106
123
},
107
124
"original": {
···
110
127
"repo": "rust-analyzer",
111
128
"type": "github"
112
129
}
113
-
},
114
-
"src": {
115
-
"flake": false,
116
-
"locked": {
117
-
"dirtyRev": "6b876cbb804222723fecf81b60e0fa25ca677bf9-dirty",
118
-
"dirtyShortRev": "6b876cbb-dirty",
119
-
"lastModified": 1760200962,
120
-
"narHash": "sha256-pIC0DTMgB3eQIteVqJ65cHyqhvLyl336qqtKBKhh71w=",
121
-
"submodules": true,
122
-
"type": "git",
123
-
"url": "file:.?submodules=1"
124
-
},
125
-
"original": {
126
-
"submodules": true,
127
-
"type": "git",
128
-
"url": "file:.?submodules=1"
129
-
}
130
130
}
131
131
},
132
132
"root": "root",
+1
-1
src/header/_aio/mod.rs
+1
-1
src/header/_aio/mod.rs
+17
src/header/signal/mod.rs
+17
src/header/signal/mod.rs
···
37
37
pub const SI_QUEUE: c_int = -1;
38
38
pub const SI_USER: c_int = 0;
39
39
40
+
pub const SIGEV_SIGNAL: c_int = 0;
41
+
pub const SIGEV_NONE: c_int = 1;
42
+
pub const SIGEV_THREAD: c_int = 2;
43
+
40
44
#[repr(C)]
41
45
#[derive(Clone, Debug)]
42
46
/// cbindgen:ignore
···
55
59
pub ss_size: size_t,
56
60
}
57
61
62
+
#[repr(C)]
63
+
#[derive(Clone)]
64
+
pub struct sigevent {
65
+
pub sigev_value: sigval,
66
+
pub sigev_signo: c_int,
67
+
pub sigev_notify: c_int,
68
+
pub sigev_notify_function: Option<extern "C" fn(sigval)>,
69
+
pub sigev_notify_attributes: *mut pthread_attr_t,
70
+
}
71
+
58
72
// FIXME: This struct is wrong on Linux
59
73
#[repr(C)]
60
74
#[derive(Clone, Copy)]
···
525
539
string.as_bytes().len(),
526
540
);
527
541
}
542
+
543
+
#[unsafe(no_mangle)]
544
+
pub unsafe extern "C" fn cbindgen_stupid_struct_sigevent_for_timer(a: sigevent) {}
+4
-1
src/header/time/cbindgen.toml
+4
-1
src/header/time/cbindgen.toml
···
1
-
sys_includes = ["sys/types.h", "stdint.h", "stddef.h", "features.h"]
1
+
sys_includes = ["sys/types.h", "signal.h", "stdint.h", "stddef.h", "features.h"]
2
2
include_guard = "_RELIBC_TIME_H"
3
3
language = "C"
4
4
style = "Tag"
···
7
7
8
8
[enum]
9
9
prefix_with_name = true
10
+
11
+
[export.rename]
12
+
"sigevent" = "struct sigevent"