w32def.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. // w32def.h :
  2. //
  3. #if !defined(AGD_W32DEF_H__F554E2DF_9B41_4A77_A414_F4A4FE09F0D4__INCLUDED_)
  4. #define AGD_W32DEF_H__F554E2DF_9B41_4A77_A414_F4A4FE09F0D4__INCLUDED_
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif // __cplusplus
  8. /////////////////////////////////////////////////////////////////////////////
  9. // w32def.h - Declarations:
  10. #define PATH_MAX _MAX_PATH
  11. #define LOCK_SH 1 /* Shared lock. */
  12. #define LOCK_EX 2 /* Exclusive lock. */
  13. #define LOCK_UN 8 /* Unlock. */
  14. #define IPC_CREAT 01000 /* Create key if key does not exist. */
  15. #define IPC_EXCL 02000 /* Fail if key exists. */
  16. #define IPC_NOWAIT 04000 /* Return error on wait. */
  17. #define IPC_RMID 0 /* Remove identifier. */
  18. #define IPC_SET 1 /* Set `ipc_perm' options. */
  19. #define IPC_STAT 2 /* Get `ipc_perm' options. */
  20. #define IPC_INFO 3
  21. #define SEM_STAT 18
  22. #define SEM_INFO 19
  23. #define SEM_UNDO 0x1000
  24. #define SHM_RDONLY 010000 /* read-only access */
  25. #define SHM_RND 020000 /* round attach address to SHMLBA boundary */
  26. #define SHM_REMAP 040000 /* take-over region on attach */
  27. #define SHM_EXEC 0100000 /* execution access */
  28. #define SHM_LOCK 11
  29. #define SHM_UNLOCK 12
  30. #define SHM_STAT 13
  31. #define SHM_INFO 14
  32. #define GETPID 11 /* get sempid */
  33. #define GETVAL 12 /* get semval */
  34. #define GETALL 13 /* get all semval's */
  35. #define GETNCNT 14 /* get semncnt */
  36. #define GETZCNT 15 /* get semzcnt */
  37. #define SETVAL 16 /* set semval */
  38. #define SETALL 17 /* set all semval's */
  39. typedef int key_t;
  40. typedef int uid_t;
  41. typedef int gid_t;
  42. typedef unsigned long shmatt_t;
  43. typedef unsigned short pid_t;
  44. struct timespec
  45. {
  46. time_t tv_sec; /* Seconds */
  47. long tv_nsec; /* Nanoseconds [0 .. 999999999] */
  48. };
  49. int flock(int fd, int operation);
  50. key_t ftok (const char *__pathname, int __proj_id);
  51. struct ipc_perm
  52. {
  53. key_t __key; /* Key. */
  54. uid_t uid; /* Owner's user ID. */
  55. gid_t gid; /* Owner's group ID. */
  56. uid_t cuid; /* Creator's user ID. */
  57. gid_t cgid; /* Creator's group ID. */
  58. unsigned short int mode; /* Read/write permission. */
  59. unsigned short int __pad1;
  60. unsigned short int __seq; /* Sequence number. */
  61. unsigned short int __pad2;
  62. unsigned long int __unused1;
  63. unsigned long int __unused2;
  64. };
  65. struct seminfo
  66. {
  67. int semmap;
  68. int semmni;
  69. int semmns;
  70. int semmnu;
  71. int semmsl;
  72. int semopm;
  73. int semume;
  74. int semusz;
  75. int semvmx;
  76. int semaem;
  77. };
  78. struct sembuf
  79. {
  80. unsigned short int sem_num; /* semaphore number */
  81. short int sem_op; /* semaphore operation */
  82. short int sem_flg; /* operation flag */
  83. };
  84. struct semid_ds
  85. {
  86. struct ipc_perm sem_perm; /* operation permission struct */
  87. time_t sem_otime; /* last semop() time */
  88. unsigned long int __unused1;
  89. time_t sem_ctime; /* last time changed by semctl() */
  90. unsigned long int __unused2;
  91. unsigned long int sem_nsems; /* number of semaphores in set */
  92. unsigned long int __unused3;
  93. unsigned long int __unused4;
  94. };
  95. int semctl (int __semid, int __semnum, int __cmd, ...);
  96. int semget (key_t __key, int __nsems, int __semflg);
  97. int semop (int __semid, struct sembuf *__sops, size_t __nsops);
  98. int semtimedop(int semid, struct sembuf *sops, size_t nsops, const struct timespec *timeout);
  99. struct shmid_ds
  100. {
  101. struct ipc_perm shm_perm; /* operation perms */
  102. size_t shm_segsz; /* size of segment (bytes) */
  103. time_t shm_atime; /* last attach time */
  104. time_t shm_dtime; /* last detach time */
  105. time_t shm_ctime; /* last change time */
  106. pid_t shm_cpid; /* pid of creator */
  107. pid_t shm_lpid; /* pid of last operator */
  108. shmatt_t shm_nattch; /* no. of current attaches */
  109. /* the following are private */
  110. unsigned short shm_npages; /* size of segment (pages) */
  111. unsigned long *shm_pages; /* array of ptrs to frames -> SHMMAX */
  112. struct vm_area_struct *attaches; /* descriptors for attaches */
  113. };
  114. struct shminfo
  115. {
  116. unsigned long shmmax; /* Maximum segment size */
  117. unsigned long shmmin; /* Minimum segment size; always 1 */
  118. unsigned long shmmni; /* Maximum number of segments */
  119. unsigned long shmseg; /* Maximum number of segments that a process can attach; unused within kernel */
  120. unsigned long shmall; /* Maximum number of pages of shared memory, system-wide */
  121. };
  122. struct shm_info
  123. {
  124. int used_ids; /* # of currently existing segments */
  125. unsigned long shm_tot; /* Total number of shared memory pages */
  126. unsigned long shm_rss; /* # of resident shared memory pages */
  127. unsigned long shm_swp; /* # of swapped shared memory pages */
  128. unsigned long swap_attempts; /* Unused since Linux 2.4 */
  129. unsigned long swap_successes; /* Unused since Linux 2.4 */
  130. };
  131. int shmctl (int __shmid, int __cmd, struct shmid_ds *__buf);
  132. int shmget (key_t __key, size_t __size, int __shmflg);
  133. void *shmat (int __shmid, const void *__shmaddr, int __shmflg);
  134. int shmdt (const void *__shmaddr);
  135. /////////////////////////////////////////////////////////////////////////////
  136. #ifdef __cplusplus
  137. }
  138. #endif // __cplusplus
  139. #endif // !defined(AGD_W32DEF_H__F554E2DF_9B41_4A77_A414_F4A4FE09F0D4__INCLUDED_)