Skip to content

Commit 8b1adff

Browse files
author
Johannes Wellhöfer
committed
Add memfd_create to linux and android
1 parent b035574 commit 8b1adff

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/unix/linux_like/android/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2823,6 +2823,14 @@ extern "C" {
28232823
pub fn regfree(preg: *mut ::regex_t);
28242824

28252825
pub fn android_set_abort_message(msg: *const ::c_char);
2826+
2827+
// bionic started exposing memfd_create in Android 11 (API level 30)
2828+
// once the CI is updated to work with Android 11, the implementation
2829+
// can be removed.
2830+
pub fn memfd_create(name: *const ::c_char, flags: ::c_uint) -> ::c_int {
2831+
syscall( SYS_memfd_create, name, flags) as ::c_int
2832+
}
2833+
28262834
}
28272835

28282836
cfg_if! {

src/unix/linux_like/linux/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3594,6 +3594,8 @@ extern "C" {
35943594
outbytesleft: *mut ::size_t,
35953595
) -> ::size_t;
35963596
pub fn iconv_close(cd: iconv_t) -> ::c_int;
3597+
3598+
pub fn memfd_create(name: *const ::c_char, flags: ::c_uint) -> ::c_int;
35973599
}
35983600

35993601
cfg_if! {

0 commit comments

Comments
 (0)