xref: /titanic_44/usr/src/uts/common/sys/un.h (revision 6bc9cbcc30b7d3297fd1693d3ec9dfdce31d68c3)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
23  */
24 
25 /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/
26 /*	  All Rights Reserved  	*/
27 
28 /*
29  * University Copyright- Copyright (c) 1982, 1986, 1988
30  * The Regents of the University of California
31  * All Rights Reserved
32  *
33  * University Acknowledgment- Portions of this document are derived from
34  * software developed by the University of California, Berkeley, and its
35  * contributors.
36  */
37 
38 #ifndef	_SYS_UN_H
39 #define	_SYS_UN_H
40 
41 #ifdef	__cplusplus
42 extern "C" {
43 #endif
44 
45 #ifndef _SA_FAMILY_T
46 #define	_SA_FAMILY_T
47 typedef	unsigned short sa_family_t;
48 #endif
49 
50 /*
51  * Definitions for UNIX IPC domain.
52  */
53 struct	sockaddr_un {
54 	sa_family_t	sun_family;		/* AF_UNIX */
55 	char		sun_path[108];		/* path name (gag) */
56 };
57 
58 #if (!defined(_XOPEN_SOURCE) && !defined(_POSIX_C_SOURCE)) || \
59     defined(__EXTENSIONS__)
60 /*
61  * NOTE: If we ever go to BSD-style sun_len + sun_family, this macro needs to
62  * change.
63  *
64  * Also, include a strlen() prototype, and we have to protect it w.r.t.
65  * UNIX{98,03}.  And because there's strlen, we need size_t as well.
66  */
67 #if !defined(_SIZE_T) || __cplusplus >= 199711L
68 #define	_SIZE_T
69 #if defined(_LP64) || defined(_I32LPx)
70 typedef	unsigned long	size_t;		/* size of something in bytes */
71 #else
72 typedef	unsigned int	size_t;		/* (historical version) */
73 #endif
74 #endif	/* _SIZE_T */
75 
76 extern size_t strlen(const char *);
77 
78 #define	SUN_LEN(su)	(sizeof (sa_family_t) + strlen((su)->sun_path))
79 
80 #endif	/* (!defined(_XOPEN_SOURCE) && !defined(_POSIX_C_SOURCE)) || ... */
81 
82 #ifdef _KERNEL
83 int	unp_discard();
84 #endif
85 
86 #ifdef	__cplusplus
87 }
88 #endif
89 
90 #endif /* _SYS_UN_H */
91