Skip to content

Commit

Permalink
feature user for emscripten (#2496)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChanTsune authored Sep 15, 2024
1 parent 062211b commit 08ad7d6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/features.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Feature tests for OS functionality
pub use self::os::*;

#[cfg(linux_android)]
#[cfg(any(linux_android, target_os = "emscripten"))]
mod os {
use crate::sys::utsname::uname;
use crate::Result;
Expand Down
15 changes: 13 additions & 2 deletions src/unistd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1986,7 +1986,8 @@ pub fn setgroups(groups: &[Gid]) -> Result<()> {
target_os = "aix",
solarish,
apple_targets,
target_os = "redox"
target_os = "redox",
target_os = "emscripten",
)))]
pub fn getgrouplist(user: &CStr, group: Gid) -> Result<Vec<Gid>> {
let ngroups_max = match sysconf(SysconfVar::NGROUPS_MAX) {
Expand Down Expand Up @@ -2070,7 +2071,8 @@ pub fn getgrouplist(user: &CStr, group: Gid) -> Result<Vec<Gid>> {
#[cfg(not(any(
apple_targets,
target_os = "redox",
target_os = "haiku"
target_os = "haiku",
target_os = "emscripten",
)))]
pub fn initgroups(user: &CStr, group: Gid) -> Result<()> {
cfg_if! {
Expand Down Expand Up @@ -3492,6 +3494,7 @@ pub struct User {
target_os = "fuchsia",
target_os = "haiku",
target_os = "hurd",
target_os = "emscripten",
)))]
pub class: CString,
/// Last password change
Expand All @@ -3502,6 +3505,7 @@ pub struct User {
target_os = "fuchsia",
target_os = "haiku",
target_os = "hurd",
target_os = "emscripten",
)))]
pub change: libc::time_t,
/// Expiration time of account
Expand All @@ -3512,6 +3516,7 @@ pub struct User {
target_os = "fuchsia",
target_os = "haiku",
target_os = "hurd",
target_os = "emscripten",
)))]
pub expire: libc::time_t,
}
Expand Down Expand Up @@ -3565,6 +3570,7 @@ impl From<&libc::passwd> for User {
target_os = "fuchsia",
target_os = "haiku",
target_os = "hurd",
target_os = "emscripten",
)))]
class: CString::new(CStr::from_ptr(pw.pw_class).to_bytes())
.unwrap(),
Expand All @@ -3575,6 +3581,7 @@ impl From<&libc::passwd> for User {
target_os = "fuchsia",
target_os = "haiku",
target_os = "hurd",
target_os = "emscripten",
)))]
change: pw.pw_change,
#[cfg(not(any(
Expand All @@ -3584,6 +3591,7 @@ impl From<&libc::passwd> for User {
target_os = "fuchsia",
target_os = "haiku",
target_os = "hurd",
target_os = "emscripten",
)))]
expire: pw.pw_expire,
}
Expand Down Expand Up @@ -3625,6 +3633,7 @@ impl From<User> for libc::passwd {
target_os = "fuchsia",
target_os = "haiku",
target_os = "hurd",
target_os = "emscripten",
)))]
pw_class: u.class.into_raw(),
#[cfg(not(any(
Expand All @@ -3634,6 +3643,7 @@ impl From<User> for libc::passwd {
target_os = "fuchsia",
target_os = "haiku",
target_os = "hurd",
target_os = "emscripten",
)))]
pw_change: u.change,
#[cfg(not(any(
Expand All @@ -3643,6 +3653,7 @@ impl From<User> for libc::passwd {
target_os = "fuchsia",
target_os = "haiku",
target_os = "hurd",
target_os = "emscripten",
)))]
pw_expire: u.expire,
#[cfg(solarish)]
Expand Down

0 comments on commit 08ad7d6

Please sign in to comment.