NaCl runtime fixes
[mono.git] / mono / metadata / nacl-stub.c
1
2 #if defined(__native_client__)
3
4 #ifdef HAVE_CONFIG_H
5 #include <config.h>
6 #endif
7 #include <eglib/src/glib.h>
8 #include <errno.h>
9 #include <sys/types.h>
10
11 struct group *getgrnam(const char *name) { return NULL; }
12 struct group *getgrgid(gid_t gid) { errno=EIO; return NULL; }
13 int fsync(int fd) { errno=EINVAL; return -1; }
14 dev_t makedev(guint32 maj, guint32 min) { return (maj)*256+(min); }
15
16 #ifdef USE_NEWLIB
17 int getdtablesize(void) {
18 #ifdef OPEN_MAX
19   return OPEN_MAX;
20 #else
21   return 256;
22 #endif
23 }
24
25 size_t getpagesize(void) {
26 #ifdef PAGE_SIZE
27   return PAGE_SIZE;
28 #else
29   return 4096;
30 #endif
31 }
32
33 #include <semaphore.h>
34
35 int sem_trywait(sem_t *sem) {
36   g_assert_not_reached ();
37   return -1;
38 }
39
40 int sem_timedwait(sem_t *sem, const struct timespec *abs_timeout) {
41   g_assert_not_reached ();
42   return -1;
43 }
44
45 #endif
46
47 #endif