ipcmaxlen.h 522 B

123456789101112131415161718192021222324252627
  1. /*
  2. Platform-independant detection of IPC path max length
  3. Copyright (c) 2012 Godefroid Chapelle
  4. Distributed under the terms of the New BSD License. The full license is in
  5. the file LICENSE.BSD, distributed as part of this software.
  6. */
  7. #pragma once
  8. #if defined(HAVE_SYS_UN_H)
  9. #if defined _MSC_VER
  10. #include <afunix.h>
  11. #else
  12. #include <sys/un.h>
  13. #endif
  14. int get_ipc_path_max_len(void) {
  15. struct sockaddr_un *dummy;
  16. return sizeof(dummy->sun_path) - 1;
  17. }
  18. #else
  19. int get_ipc_path_max_len(void) {
  20. return 0;
  21. }
  22. #endif