Skip to content

Commit

Permalink
adding aligned_alloc support for the following:
Browse files Browse the repository at this point in the history
- linux glibc/musl.
- all supported BSD implements it.
- apple.
- solarish.

close rust-lang#3689
  • Loading branch information
devnexen committed May 12, 2024
1 parent 7646277 commit 5505653
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions libc-test/semver/apple.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1836,6 +1836,7 @@ aio_return
aio_suspend
aio_write
aiocb
aligned_alloc
arc4random
arc4random_buf
arc4random_uniform
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/dragonfly.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1246,6 +1246,7 @@ aio_suspend
aio_waitcomplete
aio_write
aiocb
aligned_alloc
arc4random
arc4random_buf
arc4random_uniform
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/freebsd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1703,6 +1703,7 @@ aio_suspend
aio_waitcomplete
aio_write
aiocb
aligned_alloc
arc4random
arc4random_buf
arc4random_uniform
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/linux-gnu.txt
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,7 @@ aio_return
aio_suspend
aio_write
aiocb
aligned_alloc
backtrace
clock_adjtime
copy_file_range
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/linux-musl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ aio_return
aio_suspend
aio_write
aiocb
aligned_alloc
clock_adjtime
copy_file_range
ctermid
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/netbsd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1202,6 +1202,7 @@ aio_return
aio_suspend
aio_write
aiocb
aligned_alloc
arc4random
arc4random_buf
arc4random_uniform
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/openbsd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,7 @@ __errno
abs
accept4
acct
aligned_alloc
arc4random
arc4random_buf
arc4random_uniform
Expand Down
1 change: 1 addition & 0 deletions src/unix/bsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,7 @@ extern "C" {
timeptr: *const ::tm,
locale: ::locale_t,
) -> ::size_t;
pub fn aligned_alloc(alignment: ::size_t, size: ::size_t) -> *mut ::c_void;
}

cfg_if! {
Expand Down
3 changes: 3 additions & 0 deletions src/unix/linux_like/linux/gnu/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1537,6 +1537,9 @@ extern "C" {

// Added in `glibc` 2.34
pub fn close_range(first: ::c_uint, last: ::c_uint, flags: ::c_int) -> ::c_int;

// Added in `glibc` 2.16
pub fn aligned_alloc(alignment: ::size_t, size: ::size_t) -> *mut ::c_void;
}

cfg_if! {
Expand Down
1 change: 1 addition & 0 deletions src/unix/linux_like/linux/musl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,7 @@ extern "C" {

pub fn dirname(path: *mut ::c_char) -> *mut ::c_char;
pub fn basename(path: *mut ::c_char) -> *mut ::c_char;
pub fn aligned_alloc(alignment: ::size_t, size: ::size_t) -> *mut ::c_void;
}

// Alias <foo> to <foo>64 to mimic glibc's LFS64 support
Expand Down
1 change: 1 addition & 0 deletions src/unix/solarish/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3212,6 +3212,7 @@ extern "C" {
pub fn __major(version: ::c_int, devnum: ::dev_t) -> ::major_t;
pub fn __minor(version: ::c_int, devnum: ::dev_t) -> ::minor_t;
pub fn __makedev(version: ::c_int, majdev: ::major_t, mindev: ::minor_t) -> ::dev_t;
pub fn aligned_alloc(alignment: ::size_t, size: ::size_t) -> *mut ::c_void;
}

#[link(name = "sendfile")]
Expand Down

0 comments on commit 5505653

Please sign in to comment.