shm-directory.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* Header for directory for shm/sem files.
  2. Copyright (C) 2014-2026 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <https://www.gnu.org/licenses/>. */
  15. #ifndef _SHM_DIRECTORY_H
  16. #include <limits.h>
  17. #include <paths.h>
  18. #include <stdbool.h>
  19. /* The directory that contains shared POSIX objects. */
  20. #define SHMDIR _PATH_DEV "shm/"
  21. struct shmdir_name
  22. {
  23. /* The combined prefix/name. The sizeof includes the terminating
  24. NUL byte. */
  25. char name[sizeof (SHMDIR) + NAME_MAX];
  26. };
  27. /* Sets RESULT->name to the constructed name and returns 0 on success,
  28. or -1 on failure. Includes the "sem." prefix in the name if
  29. SEM_PREFIX is true. */
  30. int __shm_get_name (struct shmdir_name *result, const char *name,
  31. bool sem_prefix);
  32. libc_hidden_proto (__shm_get_name)
  33. #endif /* shm-directory.h */