1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <unistd.h>
#include <pwd.h>
#include <grp.h>
#include <errno.h>
#include <dirent.h>
#include <string.h>
int wifexited (int status)
{
return WIFEXITED (status);
}
int wexitstatus (int status)
{
return WEXITSTATUS (status);
}
int wifsignaled (int status)
{
return WIFSIGNALED (status);
}
int wtermsig (int status)
{
return WTERMSIG (status);
}
int wifstopped (int status)
{
return WIFSTOPPED (status);
}
int wstopsig (int status)
{
return WSTOPSIG (status);
}
int helper_Mono_Posix_Stat(char *filename, int dereference,
int *device,
int *inode,
int *mode,
int *nlinks,
int *uid,
int *gid,
int *rdev,
long *size,
long *blksize,
long *blocks,
long *atime,
long *mtime,
long *ctime
) {
int ret;
struct stat buf;
if (!dereference)
ret = stat(filename, &buf);
else
ret = lstat(filename, &buf);
if (ret) return ret;
*device = buf.st_dev;
*inode = buf.st_ino;
*mode = buf.st_mode;
*nlinks = buf.st_nlink;
*uid = buf.st_uid;
*gid = buf.st_gid;
*rdev = buf.st_rdev;
*size = buf.st_size;
*blksize = buf.st_blksize;
*blocks = buf.st_blocks;
*atime = buf.st_atime;
*mtime = buf.st_mtime;
*ctime = buf.st_ctime;
return 0;
}
char *helper_Mono_Posix_GetUserName(int uid) {
struct passwd *p = getpwuid(uid);
if (p == NULL) return NULL;
return strdup (p->pw_name);
}
char *helper_Mono_Posix_GetGroupName(int gid) {
struct group *p = getgrgid(gid);
if (p == NULL) return NULL;
return strdup (p->gr_name);
}
char *helper_Mono_Posix_readdir(DIR *dir) {
struct dirent* e = readdir(dir);
if (e == NULL) return NULL;
return strdup (e->d_name);
}
|