13 int wifexited (int status)
15 return WIFEXITED (status);
18 int wexitstatus (int status)
20 return WEXITSTATUS (status);
23 int wifsignaled (int status)
25 return WIFSIGNALED (status);
28 int wtermsig (int status)
30 return WTERMSIG (status);
33 int wifstopped (int status)
35 return WIFSTOPPED (status);
38 int wstopsig (int status)
40 return WSTOPSIG (status);
43 int helper_Mono_Posix_Stat(const char *filename, int dereference,
62 ret = stat(filename, &buf);
64 ret = lstat(filename, &buf);
71 *nlinks = buf.st_nlink;
76 *blksize = buf.st_blksize;
77 *blocks = buf.st_blocks;
78 *atime = buf.st_atime;
79 *mtime = buf.st_mtime;
80 *ctime = buf.st_ctime;
84 const char *helper_Mono_Posix_GetUserName(int uid) {
85 struct passwd *p = getpwuid(uid);
86 if (p == NULL) return NULL;
87 return strdup (p->pw_name);
89 const char *helper_Mono_Posix_GetGroupName(int gid) {
90 struct group *p = getgrgid(gid);
91 if (p == NULL) return NULL;
92 return strdup (p->gr_name);
95 const char *helper_Mono_Posix_readdir(void *dir) {
96 struct dirent* e = readdir((DIR*) dir);
97 if (e == NULL) return NULL;
98 return strdup (e->d_name);
101 int helper_Mono_Posix_getpwnamuid (int mode, char *in_name, int in_uid,
111 struct passwd pw, *pwp;
116 ret = getpwnam_r (in_name, &pw, buf, 4096, &pwp);
118 ret = getpwuid_r (in_uid, &pw, buf, 4096, &pwp);
120 if (ret == 0 && pwp == NULL) {
121 // Don't know why this happens, but it does.
122 // ret == 0, errno == 0, but no record was found.
127 *account = NULL; // prevent marshalling unset pointers
137 *account = pwp->pw_name;
138 *password = pwp->pw_passwd;
141 *name = pwp->pw_gecos;
143 *shell = pwp->pw_shell;