un.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /****************************************************************************
  2. * include/sys/un.h
  3. *
  4. * Licensed to the Apache Software Foundation (ASF) under one or more
  5. * contributor license agreements. See the NOTICE file distributed with
  6. * this work for additional information regarding copyright ownership. The
  7. * ASF licenses this file to you under the Apache License, Version 2.0 (the
  8. * "License"); you may not use this file except in compliance with the
  9. * License. You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  15. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  16. * License for the specific language governing permissions and limitations
  17. * under the License.
  18. *
  19. ****************************************************************************/
  20. #ifndef __INCLUDE_SYS_UN_H
  21. #define __INCLUDE_SYS_UN_H
  22. /****************************************************************************
  23. * Included Files
  24. ****************************************************************************/
  25. #include <sys/socket.h>
  26. /****************************************************************************
  27. * Pre-processor Definitions
  28. ****************************************************************************/
  29. /* The size of sun_path is not specified. Different implementations us
  30. * different sizes. BSD4.3 uses a size of 108; BSD4.4 uses a size of 104.
  31. * Most implementation use a size that ranges from 92 to 108. Applications
  32. * should not assume a particular length for sun_path.
  33. *
  34. * _POSIX_PATH_MAX would be a good choice too.
  35. */
  36. #define UNIX_PATH_MAX 108
  37. /****************************************************************************
  38. * Public Type Definitions
  39. ****************************************************************************/
  40. /* A UNIX domain socket address is represented in the following structure.
  41. * This structure must be cast compatible with struct sockaddr.
  42. */
  43. struct sockaddr_un
  44. {
  45. sa_family_t sun_family; /* AF_UNIX */
  46. char sun_path[UNIX_PATH_MAX]; /* pathname */
  47. };
  48. /* There are three types of addresses:
  49. *
  50. * 1. pathname: sun_path holds a null terminated string. The allocated
  51. * size may be variable: sizeof(sa_family_t) + strlen(pathname) + 1
  52. * 2. unnamed: A unix socket that is not bound to any name. This case
  53. * there is no path. The allocated size may be sizeof(sa_family_t)
  54. * 3. abstract. The abstract path is distinguished because the pathname
  55. * consists of only the NUL terminator. The allocated size is then
  56. * sizeof(s_family_t) + 1.
  57. */
  58. /****************************************************************************
  59. * Public Function Prototypes
  60. ****************************************************************************/
  61. #endif /* __INCLUDE_SYS_UN_H */