11 int wifexited (int status)
13 return WIFEXITED (status);
16 int wexitstatus (int status)
18 return WEXITSTATUS (status);
21 int wifsignaled (int status)
23 return WIFSIGNALED (status);
26 int wtermsig (int status)
28 return WTERMSIG (status);
31 int wifstopped (int status)
33 return WIFSTOPPED (status);
36 int wstopsig (int status)
38 return WSTOPSIG (status);
41 int helper_Mono_Posix_Stat(char *filename, int dereference,
60 ret = stat(filename, &buf);
62 ret = lstat(filename, &buf);
69 *nlinks = buf.st_nlink;
74 *blksize = buf.st_blksize;
75 *blocks = buf.st_blocks;
76 *atime = buf.st_atime;
77 *mtime = buf.st_mtime;
78 *ctime = buf.st_ctime;
82 char *helper_Mono_Posix_GetUserName(int uid) {
83 struct passwd *p = getpwuid(uid);
84 if (p == NULL) return NULL;
85 return strdup (p->pw_name);
87 char *helper_Mono_Posix_GetGroupName(int gid) {
88 struct group *p = getgrgid(gid);
89 if (p == NULL) return NULL;
90 return strdup (p->gr_name);
93 char *helper_Mono_Posix_readdir(DIR *dir) {
94 struct dirent* e = readdir(dir);
95 if (e == NULL) return NULL;
96 return strdup (e->d_name);
99 int helper_Mono_Posix_getpwnamuid (int mode, char *in_name, int in_uid,
109 struct passwd pw, *pwp;
114 ret = getpwnam_r (in_name, &pw, buf, 4096, &pwp);
116 ret = getpwuid_r (in_uid, &pw, buf, 4096, &pwp);
118 if (ret == 0 && pwp == NULL) {
119 // Don't know why this happens, but it does.
120 // ret == 0, errno == 0, but no record was found.
125 *account = NULL; // prevent marshalling unset pointers
135 *account = pwp->pw_name;
136 *password = pwp->pw_passwd;
139 *name = pwp->pw_gecos;
141 *shell = pwp->pw_shell;