Skip to content

Commit 5265cde

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

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/unix/linux_like/android/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2364,6 +2364,13 @@ f! {
23642364
) -> ::c_int {
23652365
syscall(SYS_accept4, fd, addr, len, flg) as ::c_int
23662366
}
2367+
2368+
// bionic started exposing memfd_create in Android 11 (API level 30).
2369+
// Once the CI is updated to work with Android 11, the implementation
2370+
// can be removed.
2371+
pub fn memfd_create(name: *const ::c_char, flags: ::c_uint) -> ::c_int {
2372+
syscall(SYS_memfd_create, name, flags) as ::c_int
2373+
}
23672374
}
23682375

23692376
extern "C" {

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)