Replace deprecated getdtablesize() with sysconf(_SC_OPEN_MAX) for android aarch64
This commit is contained in:
@@ -69,7 +69,6 @@ impl Process {
|
|||||||
K: BytesContainer + Eq + Hash, V: BytesContainer
|
K: BytesContainer + Eq + Hash, V: BytesContainer
|
||||||
{
|
{
|
||||||
use libc::funcs::posix88::unistd::{fork, dup2, close, chdir, execvp};
|
use libc::funcs::posix88::unistd::{fork, dup2, close, chdir, execvp};
|
||||||
use libc::funcs::bsd44::getdtablesize;
|
|
||||||
|
|
||||||
mod rustrt {
|
mod rustrt {
|
||||||
extern {
|
extern {
|
||||||
@@ -82,6 +81,15 @@ impl Process {
|
|||||||
assert_eq!(ret, 0);
|
assert_eq!(ret, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(all(target_os = "android", target_arch = "aarch64"))]
|
||||||
|
unsafe fn getdtablesize() -> c_int {
|
||||||
|
libc::sysconf(libc::consts::os::sysconf::_SC_OPEN_MAX) as c_int
|
||||||
|
}
|
||||||
|
#[cfg(not(all(target_os = "android", target_arch = "aarch64")))]
|
||||||
|
unsafe fn getdtablesize() -> c_int {
|
||||||
|
libc::funcs::bsd44::getdtablesize()
|
||||||
|
}
|
||||||
|
|
||||||
let dirp = cfg.cwd().map(|c| c.as_ptr()).unwrap_or(ptr::null());
|
let dirp = cfg.cwd().map(|c| c.as_ptr()).unwrap_or(ptr::null());
|
||||||
|
|
||||||
// temporary until unboxed closures land
|
// temporary until unboxed closures land
|
||||||
|
|||||||
@@ -141,7 +141,6 @@ impl Process {
|
|||||||
-> io::Result<Process>
|
-> io::Result<Process>
|
||||||
{
|
{
|
||||||
use libc::funcs::posix88::unistd::{fork, dup2, close, chdir, execvp};
|
use libc::funcs::posix88::unistd::{fork, dup2, close, chdir, execvp};
|
||||||
use libc::funcs::bsd44::getdtablesize;
|
|
||||||
|
|
||||||
mod rustrt {
|
mod rustrt {
|
||||||
extern {
|
extern {
|
||||||
@@ -154,6 +153,16 @@ impl Process {
|
|||||||
assert_eq!(ret, 0);
|
assert_eq!(ret, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(all(target_os = "android", target_arch = "aarch64"))]
|
||||||
|
unsafe fn getdtablesize() -> c_int {
|
||||||
|
libc::sysconf(libc::consts::os::sysconf::_SC_OPEN_MAX) as c_int
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(all(target_os = "android", target_arch = "aarch64")))]
|
||||||
|
unsafe fn getdtablesize() -> c_int {
|
||||||
|
libc::funcs::bsd44::getdtablesize()
|
||||||
|
}
|
||||||
|
|
||||||
let dirp = cfg.cwd.as_ref().map(|c| c.as_ptr()).unwrap_or(ptr::null());
|
let dirp = cfg.cwd.as_ref().map(|c| c.as_ptr()).unwrap_or(ptr::null());
|
||||||
|
|
||||||
with_envp(cfg.env.as_ref(), |envp: *const c_void| {
|
with_envp(cfg.env.as_ref(), |envp: *const c_void| {
|
||||||
|
|||||||
Reference in New Issue
Block a user