map.c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /* This file was automatically generated by make-map from ../../mcs/class/lib/Mono.Posix.dll */
  2. #define _GNU_SOURCE
  3. #include <sys/types.h>
  4. #include <sys/stat.h>
  5. #include <sys/wait.h>
  6. #include <unistd.h>
  7. #include <fcntl.h>
  8. #include <signal.h>
  9. #include "map.h"
  10. int map_Mono_Posix_OpenFlags (int x)
  11. {
  12. int r = 0;
  13. if ((x & Mono_Posix_OpenFlags_O_RDONLY) != 0)
  14. r |= O_RDONLY;
  15. if ((x & Mono_Posix_OpenFlags_O_WRONLY) != 0)
  16. r |= O_WRONLY;
  17. if ((x & Mono_Posix_OpenFlags_O_RDWR) != 0)
  18. r |= O_RDWR;
  19. if ((x & Mono_Posix_OpenFlags_O_CREAT) != 0)
  20. r |= O_CREAT;
  21. if ((x & Mono_Posix_OpenFlags_O_EXCL) != 0)
  22. r |= O_EXCL;
  23. if ((x & Mono_Posix_OpenFlags_O_NOCTTY) != 0)
  24. r |= O_NOCTTY;
  25. if ((x & Mono_Posix_OpenFlags_O_TRUNC) != 0)
  26. r |= O_TRUNC;
  27. if ((x & Mono_Posix_OpenFlags_O_APPEND) != 0)
  28. r |= O_APPEND;
  29. if ((x & Mono_Posix_OpenFlags_O_NONBLOCK) != 0)
  30. r |= O_NONBLOCK;
  31. #ifdef O_SYNC
  32. if ((x & Mono_Posix_OpenFlags_O_SYNC) != 0)
  33. r |= O_SYNC;
  34. #endif
  35. return r;
  36. }
  37. int map_Mono_Posix_FileMode (int x)
  38. {
  39. int r = 0;
  40. if ((x & Mono_Posix_FileMode_S_ISUID) != 0)
  41. r |= S_ISUID;
  42. if ((x & Mono_Posix_FileMode_S_ISGID) != 0)
  43. r |= S_ISGID;
  44. if ((x & Mono_Posix_FileMode_S_ISVTX) != 0)
  45. r |= S_ISVTX;
  46. if ((x & Mono_Posix_FileMode_S_IRUSR) != 0)
  47. r |= S_IRUSR;
  48. if ((x & Mono_Posix_FileMode_S_IWUSR) != 0)
  49. r |= S_IWUSR;
  50. if ((x & Mono_Posix_FileMode_S_IXUSR) != 0)
  51. r |= S_IXUSR;
  52. if ((x & Mono_Posix_FileMode_S_IRGRP) != 0)
  53. r |= S_IRGRP;
  54. if ((x & Mono_Posix_FileMode_S_IWGRP) != 0)
  55. r |= S_IWGRP;
  56. if ((x & Mono_Posix_FileMode_S_IXGRP) != 0)
  57. r |= S_IXGRP;
  58. if ((x & Mono_Posix_FileMode_S_IROTH) != 0)
  59. r |= S_IROTH;
  60. if ((x & Mono_Posix_FileMode_S_IWOTH) != 0)
  61. r |= S_IWOTH;
  62. if ((x & Mono_Posix_FileMode_S_IXOTH) != 0)
  63. r |= S_IXOTH;
  64. return r;
  65. }
  66. int map_Mono_Posix_WaitOptions (int x)
  67. {
  68. int r = 0;
  69. if ((x & Mono_Posix_WaitOptions_WNOHANG) != 0)
  70. r |= WNOHANG;
  71. if ((x & Mono_Posix_WaitOptions_WUNTRACED) != 0)
  72. r |= WUNTRACED;
  73. return r;
  74. }
  75. int map_Mono_Posix_AccessMode (int x)
  76. {
  77. int r = 0;
  78. if ((x & Mono_Posix_AccessMode_R_OK) != 0)
  79. r |= R_OK;
  80. if ((x & Mono_Posix_AccessMode_W_OK) != 0)
  81. r |= W_OK;
  82. if ((x & Mono_Posix_AccessMode_X_OK) != 0)
  83. r |= X_OK;
  84. if ((x & Mono_Posix_AccessMode_F_OK) != 0)
  85. r |= F_OK;
  86. return r;
  87. }
  88. int map_Mono_Posix_Signals (int x)
  89. {
  90. if (x == Mono_Posix_Signals_SIGHUP)
  91. return SIGHUP;
  92. if (x == Mono_Posix_Signals_SIGINT)
  93. return SIGINT;
  94. if (x == Mono_Posix_Signals_SIGQUIT)
  95. return SIGQUIT;
  96. if (x == Mono_Posix_Signals_SIGILL)
  97. return SIGILL;
  98. if (x == Mono_Posix_Signals_SIGTRAP)
  99. return SIGTRAP;
  100. if (x == Mono_Posix_Signals_SIGABRT)
  101. return SIGABRT;
  102. if (x == Mono_Posix_Signals_SIGBUS)
  103. return SIGBUS;
  104. if (x == Mono_Posix_Signals_SIGFPE)
  105. return SIGFPE;
  106. if (x == Mono_Posix_Signals_SIGKILL)
  107. return SIGKILL;
  108. if (x == Mono_Posix_Signals_SIGUSR1)
  109. return SIGUSR1;
  110. if (x == Mono_Posix_Signals_SIGSEGV)
  111. return SIGSEGV;
  112. if (x == Mono_Posix_Signals_SIGUSR2)
  113. return SIGUSR2;
  114. if (x == Mono_Posix_Signals_SIGPIPE)
  115. return SIGPIPE;
  116. if (x == Mono_Posix_Signals_SIGALRM)
  117. return SIGALRM;
  118. if (x == Mono_Posix_Signals_SIGTERM)
  119. return SIGTERM;
  120. if (x == Mono_Posix_Signals_SIGCHLD)
  121. return SIGCHLD;
  122. if (x == Mono_Posix_Signals_SIGCONT)
  123. return SIGCONT;
  124. if (x == Mono_Posix_Signals_SIGSTOP)
  125. return SIGSTOP;
  126. if (x == Mono_Posix_Signals_SIGTSTP)
  127. return SIGTSTP;
  128. if (x == Mono_Posix_Signals_SIGTTIN)
  129. return SIGTTIN;
  130. if (x == Mono_Posix_Signals_SIGTTOU)
  131. return SIGTTOU;
  132. if (x == Mono_Posix_Signals_SIGURG)
  133. return SIGURG;
  134. if (x == Mono_Posix_Signals_SIGXCPU)
  135. return SIGXCPU;
  136. if (x == Mono_Posix_Signals_SIGXFSZ)
  137. return SIGXFSZ;
  138. if (x == Mono_Posix_Signals_SIGVTALRM)
  139. return SIGVTALRM;
  140. if (x == Mono_Posix_Signals_SIGPROF)
  141. return SIGPROF;
  142. if (x == Mono_Posix_Signals_SIGWINCH)
  143. return SIGWINCH;
  144. if (x == Mono_Posix_Signals_SIGIO)
  145. return SIGIO;
  146. if (x == Mono_Posix_Signals_SIGSYS)
  147. return SIGSYS;
  148. return -1;
  149. }