shm.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* Copyright (C) 1995-2026 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, see
  13. <https://www.gnu.org/licenses/>. */
  14. #ifndef _SYS_SHM_H
  15. # error "Never include <bits/shm.h> directly; use <sys/shm.h> instead."
  16. #endif
  17. #include <bits/types.h>
  18. /* Flags for `shmat'. */
  19. #define SHM_RDONLY 010000 /* attach read-only else read-write */
  20. #define SHM_RND 020000 /* round attach address to SHMLBA */
  21. #define SHM_REMAP 040000 /* take-over region on attach */
  22. /* Commands for `shmctl'. */
  23. #define SHM_LOCK 11 /* lock segment (root only) */
  24. #define SHM_UNLOCK 12 /* unlock segment (root only) */
  25. __BEGIN_DECLS
  26. /* Segment low boundary address multiple. */
  27. #define SHMLBA (__getpagesize ())
  28. extern int __getpagesize (void) __THROW __attribute__ ((__const__));
  29. /* Type to count number of attaches. */
  30. typedef unsigned short int shmatt_t;
  31. /* Data structure describing a shared memory segment. */
  32. struct shmid_ds
  33. {
  34. struct ipc_perm shm_perm; /* operation permission struct */
  35. size_t shm_segsz; /* size of segment in bytes */
  36. __time_t shm_atime; /* time of last shmat() */
  37. __time_t shm_dtime; /* time of last shmdt() */
  38. __time_t shm_ctime; /* time of last change by shmctl() */
  39. __pid_t shm_cpid; /* pid of creator */
  40. __pid_t shm_lpid; /* pid of last shmop */
  41. shmatt_t shm_nattch; /* number of current attaches */
  42. };
  43. __END_DECLS