xref: /illumos-gate/usr/src/uts/common/sys/un.h (revision b4203d75)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5406d6273SPalle Lyckegaard  * Common Development and Distribution License (the "License").
6406d6273SPalle Lyckegaard  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
226bc9cbccSDan McDonald  * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
237c478bd9Sstevel@tonic-gate  */
247c478bd9Sstevel@tonic-gate 
257c478bd9Sstevel@tonic-gate /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/
26*b4203d75SMarcel Telka /*	  All Rights Reserved	*/
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate /*
297c478bd9Sstevel@tonic-gate  * University Copyright- Copyright (c) 1982, 1986, 1988
307c478bd9Sstevel@tonic-gate  * The Regents of the University of California
317c478bd9Sstevel@tonic-gate  * All Rights Reserved
327c478bd9Sstevel@tonic-gate  *
337c478bd9Sstevel@tonic-gate  * University Acknowledgment- Portions of this document are derived from
347c478bd9Sstevel@tonic-gate  * software developed by the University of California, Berkeley, and its
357c478bd9Sstevel@tonic-gate  * contributors.
367c478bd9Sstevel@tonic-gate  */
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate #ifndef	_SYS_UN_H
397c478bd9Sstevel@tonic-gate #define	_SYS_UN_H
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
427c478bd9Sstevel@tonic-gate extern "C" {
437c478bd9Sstevel@tonic-gate #endif
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate #ifndef _SA_FAMILY_T
467c478bd9Sstevel@tonic-gate #define	_SA_FAMILY_T
477c478bd9Sstevel@tonic-gate typedef	unsigned short sa_family_t;
487c478bd9Sstevel@tonic-gate #endif
497c478bd9Sstevel@tonic-gate 
507c478bd9Sstevel@tonic-gate /*
517c478bd9Sstevel@tonic-gate  * Definitions for UNIX IPC domain.
527c478bd9Sstevel@tonic-gate  */
537c478bd9Sstevel@tonic-gate struct	sockaddr_un {
547c478bd9Sstevel@tonic-gate 	sa_family_t	sun_family;		/* AF_UNIX */
557c478bd9Sstevel@tonic-gate 	char		sun_path[108];		/* path name (gag) */
567c478bd9Sstevel@tonic-gate };
577c478bd9Sstevel@tonic-gate 
5875f72756SDan McDonald #if (!defined(_XOPEN_SOURCE) && !defined(_POSIX_C_SOURCE)) || \
5975f72756SDan McDonald     defined(__EXTENSIONS__)
60406d6273SPalle Lyckegaard /*
61406d6273SPalle Lyckegaard  * NOTE: If we ever go to BSD-style sun_len + sun_family, this macro needs to
62406d6273SPalle Lyckegaard  * change.
63406d6273SPalle Lyckegaard  *
6475f72756SDan McDonald  * Also, include a strlen() prototype, and we have to protect it w.r.t.
6575f72756SDan McDonald  * UNIX{98,03}.  And because there's strlen, we need size_t as well.
66406d6273SPalle Lyckegaard  */
6775f72756SDan McDonald #if !defined(_SIZE_T) || __cplusplus >= 199711L
6875f72756SDan McDonald #define	_SIZE_T
6975f72756SDan McDonald #if defined(_LP64) || defined(_I32LPx)
706bc9cbccSDan McDonald typedef	unsigned long	size_t;		/* size of something in bytes */
7175f72756SDan McDonald #else
726bc9cbccSDan McDonald typedef	unsigned int	size_t;		/* (historical version) */
7375f72756SDan McDonald #endif
7475f72756SDan McDonald #endif	/* _SIZE_T */
7575f72756SDan McDonald 
76406d6273SPalle Lyckegaard extern size_t strlen(const char *);
7775f72756SDan McDonald 
78406d6273SPalle Lyckegaard #define	SUN_LEN(su)	(sizeof (sa_family_t) + strlen((su)->sun_path))
79406d6273SPalle Lyckegaard 
8075f72756SDan McDonald #endif	/* (!defined(_XOPEN_SOURCE) && !defined(_POSIX_C_SOURCE)) || ... */
8175f72756SDan McDonald 
827c478bd9Sstevel@tonic-gate #ifdef _KERNEL
837c478bd9Sstevel@tonic-gate int	unp_discard();
847c478bd9Sstevel@tonic-gate #endif
857c478bd9Sstevel@tonic-gate 
867c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
877c478bd9Sstevel@tonic-gate }
887c478bd9Sstevel@tonic-gate #endif
897c478bd9Sstevel@tonic-gate 
907c478bd9Sstevel@tonic-gate #endif /* _SYS_UN_H */
91