12 int wifexited (int status
)
14 return WIFEXITED (status
);
17 int wexitstatus (int status
)
19 return WEXITSTATUS (status
);
22 int wifsignaled (int status
)
24 return WIFSIGNALED (status
);
27 int wtermsig (int status
)
29 return WTERMSIG (status
);
32 int wifstopped (int status
)
34 return WIFSTOPPED (status
);
37 int wstopsig (int status
)
39 return WSTOPSIG (status
);
42 int helper_Mono_Posix_Stat(char *filename
, int dereference
,
61 ret
= stat(filename
, &buf
);
63 ret
= lstat(filename
, &buf
);
70 *nlinks
= buf
.st_nlink
;
75 *blksize
= buf
.st_blksize
;
76 *blocks
= buf
.st_blocks
;
77 *atime
= buf
.st_atime
;
78 *mtime
= buf
.st_mtime
;
79 *ctime
= buf
.st_ctime
;
83 char *helper_Mono_Posix_GetUserName(int uid
) {
84 struct passwd
*p
= getpwuid(uid
);
85 if (p
== NULL
) return NULL
;
86 return strdup (p
->pw_name
);
88 char *helper_Mono_Posix_GetGroupName(int gid
) {
89 struct group
*p
= getgrgid(gid
);
90 if (p
== NULL
) return NULL
;
91 return strdup (p
->gr_name
);
94 char *helper_Mono_Posix_readdir(DIR *dir
) {
95 struct dirent
* e
= readdir(dir
);
96 if (e
== NULL
) return NULL
;
97 return strdup (e
->d_name
);
100 int helper_Mono_Posix_getpwnamuid (int mode
, char *in_name
, int in_uid
,
110 struct passwd pw
, *pwp
;
115 ret
= getpwnam_r (in_name
, &pw
, buf
, 4096, &pwp
);
117 ret
= getpwuid_r (in_uid
, &pw
, buf
, 4096, &pwp
);
119 if (ret
== 0 && pwp
== NULL
) {
120 // Don't know why this happens, but it does.
121 // ret == 0, errno == 0, but no record was found.
126 *account
= NULL
; // prevent marshalling unset pointers
136 *account
= pwp
->pw_name
;
137 *password
= pwp
->pw_passwd
;
140 *name
= pwp
->pw_gecos
;
142 *shell
= pwp
->pw_shell
;