14 int wifexited (int status)
16 return WIFEXITED (status);
19 int wexitstatus (int status)
21 return WEXITSTATUS (status);
24 int wifsignaled (int status)
26 return WIFSIGNALED (status);
29 int wtermsig (int status)
31 return WTERMSIG (status);
34 int wifstopped (int status)
36 return WIFSTOPPED (status);
39 int wstopsig (int status)
41 return WSTOPSIG (status);
44 int helper_Mono_Posix_Stat(const char *filename, int dereference,
63 ret = stat(filename, &buf);
65 ret = lstat(filename, &buf);
72 *nlinks = buf.st_nlink;
77 *blksize = buf.st_blksize;
78 *blocks = buf.st_blocks;
79 *atime = buf.st_atime;
80 *mtime = buf.st_mtime;
81 *ctime = buf.st_ctime;
85 char *helper_Mono_Posix_GetUserName(int uid) {
86 struct passwd *p = getpwuid(uid);
87 if (p == NULL) return NULL;
88 return strdup (p->pw_name);
90 char *helper_Mono_Posix_GetGroupName(int gid) {
91 struct group *p = getgrgid(gid);
92 if (p == NULL) return NULL;
93 return strdup (p->gr_name);
96 char *helper_Mono_Posix_readdir(void *dir) {
97 struct dirent* e = readdir((DIR*) dir);
98 if (e == NULL) return NULL;
99 return strdup (e->d_name);
103 int helper_Mono_Posix_getpwnamuid (int mode, char *in_name, int in_uid,
113 struct passwd pw, *pwp;
118 ret = getpwnam_r (in_name, &pw, buf, 4096, &pwp);
120 ret = getpwuid_r (in_uid, &pw, buf, 4096, &pwp);
122 if (ret == 0 && pwp == NULL) {
123 // Don't know why this happens, but it does.
124 // ret == 0, errno == 0, but no record was found.
129 *account = NULL; // prevent marshalling unset pointers
139 *account = pwp->pw_name;
140 *password = pwp->pw_passwd;
143 *name = pwp->pw_gecos;
145 *shell = pwp->pw_shell;
149 #endif /* def HAVE_GETPWNAM_R */