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 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 227c478bd9Sstevel@tonic-gate /* 237c478bd9Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 287c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate /* 317c478bd9Sstevel@tonic-gate * University Copyright- Copyright (c) 1982, 1986, 1988 327c478bd9Sstevel@tonic-gate * The Regents of the University of California 337c478bd9Sstevel@tonic-gate * All Rights Reserved 347c478bd9Sstevel@tonic-gate * 357c478bd9Sstevel@tonic-gate * University Acknowledgment- Portions of this document are derived from 367c478bd9Sstevel@tonic-gate * software developed by the University of California, Berkeley, and its 377c478bd9Sstevel@tonic-gate * contributors. 387c478bd9Sstevel@tonic-gate */ 397c478bd9Sstevel@tonic-gate 407c478bd9Sstevel@tonic-gate #ifndef _SYS_SOCKETVAR_H 417c478bd9Sstevel@tonic-gate #define _SYS_SOCKETVAR_H 427c478bd9Sstevel@tonic-gate 437c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate #include <sys/types.h> 467c478bd9Sstevel@tonic-gate #include <sys/stream.h> 477c478bd9Sstevel@tonic-gate #include <sys/t_lock.h> 487c478bd9Sstevel@tonic-gate #include <sys/cred.h> 497c478bd9Sstevel@tonic-gate #include <sys/vnode.h> 507c478bd9Sstevel@tonic-gate #include <sys/file.h> 517c478bd9Sstevel@tonic-gate #include <sys/param.h> 527c478bd9Sstevel@tonic-gate #include <sys/zone.h> 537c478bd9Sstevel@tonic-gate 547c478bd9Sstevel@tonic-gate #ifdef __cplusplus 557c478bd9Sstevel@tonic-gate extern "C" { 567c478bd9Sstevel@tonic-gate #endif 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gate 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gate /* 617c478bd9Sstevel@tonic-gate * Internal representation used for addresses. 627c478bd9Sstevel@tonic-gate */ 637c478bd9Sstevel@tonic-gate struct soaddr { 647c478bd9Sstevel@tonic-gate struct sockaddr *soa_sa; /* Actual address */ 657c478bd9Sstevel@tonic-gate t_uscalar_t soa_len; /* Length in bytes for kmem_free */ 667c478bd9Sstevel@tonic-gate t_uscalar_t soa_maxlen; /* Allocated length */ 677c478bd9Sstevel@tonic-gate }; 687c478bd9Sstevel@tonic-gate /* Maximum size address for transports that have ADDR_size == 1 */ 697c478bd9Sstevel@tonic-gate #define SOA_DEFSIZE 128 707c478bd9Sstevel@tonic-gate 717c478bd9Sstevel@tonic-gate /* 727c478bd9Sstevel@tonic-gate * Internal representation of the address used to represent addresses 737c478bd9Sstevel@tonic-gate * in the loopback transport for AF_UNIX. While the sockaddr_un is used 747c478bd9Sstevel@tonic-gate * as the sockfs layer address for AF_UNIX the pathnames contained in 757c478bd9Sstevel@tonic-gate * these addresses are not unique (due to relative pathnames) thus can not 767c478bd9Sstevel@tonic-gate * be used in the transport. 777c478bd9Sstevel@tonic-gate * 787c478bd9Sstevel@tonic-gate * The transport level address consists of a magic number (used to separate the 797c478bd9Sstevel@tonic-gate * name space for specific and implicit binds). For a specific bind 807c478bd9Sstevel@tonic-gate * this is followed by a "vnode *" which ensures that all specific binds 817c478bd9Sstevel@tonic-gate * have a unique transport level address. For implicit binds the latter 827c478bd9Sstevel@tonic-gate * part of the address is a byte string (of the same length as a pointer) 837c478bd9Sstevel@tonic-gate * that is assigned by the loopback transport. 847c478bd9Sstevel@tonic-gate * 857c478bd9Sstevel@tonic-gate * The uniqueness assumes that the loopback transport has a separate namespace 867c478bd9Sstevel@tonic-gate * for sockets in order to avoid name conflicts with e.g. TLI use of the 877c478bd9Sstevel@tonic-gate * same transport. 887c478bd9Sstevel@tonic-gate */ 897c478bd9Sstevel@tonic-gate struct so_ux_addr { 907c478bd9Sstevel@tonic-gate void *soua_vp; /* vnode pointer or assigned by tl */ 917c478bd9Sstevel@tonic-gate uint_t soua_magic; /* See below */ 927c478bd9Sstevel@tonic-gate }; 937c478bd9Sstevel@tonic-gate 947c478bd9Sstevel@tonic-gate #define SOU_MAGIC_EXPLICIT 0x75787670 /* "uxvp" */ 957c478bd9Sstevel@tonic-gate #define SOU_MAGIC_IMPLICIT 0x616e6f6e /* "anon" */ 967c478bd9Sstevel@tonic-gate 977c478bd9Sstevel@tonic-gate struct sockaddr_ux { 987c478bd9Sstevel@tonic-gate sa_family_t sou_family; /* AF_UNIX */ 997c478bd9Sstevel@tonic-gate struct so_ux_addr sou_addr; 1007c478bd9Sstevel@tonic-gate }; 1017c478bd9Sstevel@tonic-gate 1027c478bd9Sstevel@tonic-gate typedef struct sonodeops sonodeops_t; 103*ff550d0eSmasputra typedef struct sonode sonode_t; 1047c478bd9Sstevel@tonic-gate 1057c478bd9Sstevel@tonic-gate /* 1067c478bd9Sstevel@tonic-gate * The sonode represents a socket. A sonode never exist in the file system 1077c478bd9Sstevel@tonic-gate * name space and can not be opened using open() - only the socket, socketpair 1087c478bd9Sstevel@tonic-gate * and accept calls create sonodes. 1097c478bd9Sstevel@tonic-gate * 1107c478bd9Sstevel@tonic-gate * When an AF_UNIX socket is bound to a pathname the sockfs 1117c478bd9Sstevel@tonic-gate * creates a VSOCK vnode in the underlying file system. However, the vnodeops 1127c478bd9Sstevel@tonic-gate * etc in this VNODE remain those of the underlying file system. 1137c478bd9Sstevel@tonic-gate * Sockfs uses the v_stream pointer in the underlying file system VSOCK node 1147c478bd9Sstevel@tonic-gate * to find the sonode bound to the pathname. The bound pathname vnode 1157c478bd9Sstevel@tonic-gate * is accessed through so_ux_vp. 1167c478bd9Sstevel@tonic-gate * 1177c478bd9Sstevel@tonic-gate * A socket always corresponds to a VCHR stream representing the transport 1187c478bd9Sstevel@tonic-gate * provider (e.g. /dev/tcp). This information is retrieved from the kernel 1197c478bd9Sstevel@tonic-gate * socket configuration table and entered into so_accessvp. sockfs uses 1207c478bd9Sstevel@tonic-gate * this to perform VOP_ACCESS checks before allowing an open of the transport 1217c478bd9Sstevel@tonic-gate * provider. 1227c478bd9Sstevel@tonic-gate * 1237c478bd9Sstevel@tonic-gate * The locking of sockfs uses the so_lock mutex plus the SOLOCKED 1247c478bd9Sstevel@tonic-gate * and SOREADLOCKED flags in so_flag. The mutex protects all the state 1257c478bd9Sstevel@tonic-gate * in the sonode. The SOLOCKED flag is used to single-thread operations from 1267c478bd9Sstevel@tonic-gate * sockfs users to prevent e.g. multiple bind() calls to operate on the 1277c478bd9Sstevel@tonic-gate * same sonode concurrently. The SOREADLOCKED flag is used to ensure that 1287c478bd9Sstevel@tonic-gate * only one thread sleeps in kstrgetmsg for a given sonode. This is needed 1297c478bd9Sstevel@tonic-gate * to ensure atomic operation for things like MSG_WAITALL. 1307c478bd9Sstevel@tonic-gate * 1317c478bd9Sstevel@tonic-gate * Note that so_lock is sometimes held across calls that might go to sleep 1327c478bd9Sstevel@tonic-gate * (kmem_alloc and soallocproto*). This implies that no other lock in 1337c478bd9Sstevel@tonic-gate * the system should be held when calling into sockfs; from the system call 1347c478bd9Sstevel@tonic-gate * side or from strrput. If locks are held while calling into sockfs 1357c478bd9Sstevel@tonic-gate * the system might hang when running low on memory. 1367c478bd9Sstevel@tonic-gate */ 1377c478bd9Sstevel@tonic-gate struct sonode { 1387c478bd9Sstevel@tonic-gate struct vnode *so_vnode; /* vnode associated with this sonode */ 1397c478bd9Sstevel@tonic-gate 1407c478bd9Sstevel@tonic-gate sonodeops_t *so_ops; /* operations vector for this sonode */ 1417c478bd9Sstevel@tonic-gate 1427c478bd9Sstevel@tonic-gate /* 1437c478bd9Sstevel@tonic-gate * These fields are initialized once. 1447c478bd9Sstevel@tonic-gate */ 1457c478bd9Sstevel@tonic-gate dev_t so_dev; /* device the sonode represents */ 1467c478bd9Sstevel@tonic-gate struct vnode *so_accessvp; /* vnode for the /dev entry */ 1477c478bd9Sstevel@tonic-gate 1487c478bd9Sstevel@tonic-gate /* The locks themselves */ 1497c478bd9Sstevel@tonic-gate kmutex_t so_lock; /* protects sonode fields */ 1507c478bd9Sstevel@tonic-gate kmutex_t so_plumb_lock; /* serializes plumbs, and the related */ 1517c478bd9Sstevel@tonic-gate /* fields so_version and so_pushcnt */ 1527c478bd9Sstevel@tonic-gate kcondvar_t so_state_cv; /* synchronize state changes */ 1537c478bd9Sstevel@tonic-gate kcondvar_t so_ack_cv; /* wait for TPI acks */ 1547c478bd9Sstevel@tonic-gate kcondvar_t so_connind_cv; /* wait for T_CONN_IND */ 1557c478bd9Sstevel@tonic-gate kcondvar_t so_want_cv; /* wait due to SOLOCKED */ 1567c478bd9Sstevel@tonic-gate 1577c478bd9Sstevel@tonic-gate /* These fields are protected by so_lock */ 1587c478bd9Sstevel@tonic-gate uint_t so_state; /* internal state flags SS_*, below */ 1597c478bd9Sstevel@tonic-gate uint_t so_mode; /* characteristics on socket. SM_* */ 1607c478bd9Sstevel@tonic-gate 1617c478bd9Sstevel@tonic-gate mblk_t *so_ack_mp; /* TPI ack received from below */ 1627c478bd9Sstevel@tonic-gate mblk_t *so_conn_ind_head; /* b_next list of T_CONN_IND */ 1637c478bd9Sstevel@tonic-gate mblk_t *so_conn_ind_tail; 1647c478bd9Sstevel@tonic-gate mblk_t *so_unbind_mp; /* Preallocated T_UNBIND_REQ message */ 1657c478bd9Sstevel@tonic-gate 1667c478bd9Sstevel@tonic-gate ushort_t so_flag; /* flags, see below */ 1677c478bd9Sstevel@tonic-gate dev_t so_fsid; /* file system identifier */ 1687c478bd9Sstevel@tonic-gate time_t so_atime; /* time of last access */ 1697c478bd9Sstevel@tonic-gate time_t so_mtime; /* time of last modification */ 1707c478bd9Sstevel@tonic-gate time_t so_ctime; /* time of last attributes change */ 1717c478bd9Sstevel@tonic-gate int so_count; /* count of opened references */ 1727c478bd9Sstevel@tonic-gate 1737c478bd9Sstevel@tonic-gate /* Needed to recreate the same socket for accept */ 1747c478bd9Sstevel@tonic-gate short so_family; 1757c478bd9Sstevel@tonic-gate short so_type; 1767c478bd9Sstevel@tonic-gate short so_protocol; 1777c478bd9Sstevel@tonic-gate short so_version; /* From so_socket call */ 1787c478bd9Sstevel@tonic-gate short so_pushcnt; /* Number of modules above "sockmod" */ 1797c478bd9Sstevel@tonic-gate 1807c478bd9Sstevel@tonic-gate /* Options */ 1817c478bd9Sstevel@tonic-gate short so_options; /* From socket call, see socket.h */ 1827c478bd9Sstevel@tonic-gate struct linger so_linger; /* SO_LINGER value */ 1837c478bd9Sstevel@tonic-gate int so_sndbuf; /* SO_SNDBUF value */ 1847c478bd9Sstevel@tonic-gate int so_rcvbuf; /* SO_RCVBUF value */ 1857c478bd9Sstevel@tonic-gate int so_sndlowat; /* send low water mark */ 1867c478bd9Sstevel@tonic-gate int so_rcvlowat; /* receive low water mark */ 1877c478bd9Sstevel@tonic-gate #ifdef notyet 1887c478bd9Sstevel@tonic-gate int so_sndtimeo; /* Not yet implemented */ 1897c478bd9Sstevel@tonic-gate int so_rcvtimeo; /* Not yet implemented */ 1907c478bd9Sstevel@tonic-gate #endif /* notyet */ 1917c478bd9Sstevel@tonic-gate ushort_t so_error; /* error affecting connection */ 1927c478bd9Sstevel@tonic-gate ushort_t so_delayed_error; /* From T_uderror_ind */ 1937c478bd9Sstevel@tonic-gate int so_backlog; /* Listen backlog */ 1947c478bd9Sstevel@tonic-gate 1957c478bd9Sstevel@tonic-gate /* 1967c478bd9Sstevel@tonic-gate * The counts (so_oobcnt and so_oobsigcnt) track the number of 1977c478bd9Sstevel@tonic-gate * urgent indicates that are (logically) queued on the stream head 1987c478bd9Sstevel@tonic-gate * read queue. The urgent data is queued on the stream head 1997c478bd9Sstevel@tonic-gate * as follows. 2007c478bd9Sstevel@tonic-gate * 2017c478bd9Sstevel@tonic-gate * In the normal case the SIGURG is not generated until 2027c478bd9Sstevel@tonic-gate * the T_EXDATA_IND arrives at the stream head. However, transports 2037c478bd9Sstevel@tonic-gate * that have an early indication that urgent data is pending 2047c478bd9Sstevel@tonic-gate * (e.g. TCP receiving a "new" urgent pointer value) can send up 2057c478bd9Sstevel@tonic-gate * an M_PCPROTO/SIGURG message to generate the signal early. 2067c478bd9Sstevel@tonic-gate * 2077c478bd9Sstevel@tonic-gate * The mark is indicated by either: 2087c478bd9Sstevel@tonic-gate * - a T_EXDATA_IND (with no M_DATA b_cont) with MSGMARK set. 2097c478bd9Sstevel@tonic-gate * When this message is consumed by sorecvmsg the socket layer 2107c478bd9Sstevel@tonic-gate * sets SS_RCVATMARK until data has been consumed past the mark. 2117c478bd9Sstevel@tonic-gate * - a message with MSGMARKNEXT set (indicating that the 2127c478bd9Sstevel@tonic-gate * first byte of the next message constitutes the mark). When 2137c478bd9Sstevel@tonic-gate * the last byte of the MSGMARKNEXT message is consumed in 2147c478bd9Sstevel@tonic-gate * the stream head the stream head sets STRATMARK. This flag 2157c478bd9Sstevel@tonic-gate * is cleared when at least one byte is read. (Note that 2167c478bd9Sstevel@tonic-gate * the MSGMARKNEXT messages can be of zero length when there 2177c478bd9Sstevel@tonic-gate * is no previous data to which the marknext can be attached.) 2187c478bd9Sstevel@tonic-gate * 2197c478bd9Sstevel@tonic-gate * While the T_EXDATA_IND method is the common case which is used 2207c478bd9Sstevel@tonic-gate * with all TPI transports, the MSGMARKNEXT method is needed to 2217c478bd9Sstevel@tonic-gate * indicate the mark when e.g. the TCP urgent byte has not been 2227c478bd9Sstevel@tonic-gate * received yet but the TCP urgent pointer has made TCP generate 2237c478bd9Sstevel@tonic-gate * the M_PCSIG/SIGURG. 2247c478bd9Sstevel@tonic-gate * 2257c478bd9Sstevel@tonic-gate * The signal (the M_PCSIG carrying the SIGURG) and the mark 2267c478bd9Sstevel@tonic-gate * indication can not be delivered as a single message, since 2277c478bd9Sstevel@tonic-gate * the signal should be delivered as high priority and any mark 2287c478bd9Sstevel@tonic-gate * indication must flow with the data. This implies that immediately 2297c478bd9Sstevel@tonic-gate * when the SIGURG has been delivered if the stream head queue is 2307c478bd9Sstevel@tonic-gate * empty it is impossible to determine if this will be the position 2317c478bd9Sstevel@tonic-gate * of the mark. This race condition is resolved by using MSGNOTMARKNEXT 2327c478bd9Sstevel@tonic-gate * messages and the STRNOTATMARK flag in the stream head. The 2337c478bd9Sstevel@tonic-gate * SIOCATMARK code calls the stream head to wait for either a 2347c478bd9Sstevel@tonic-gate * non-empty queue or one of the STR*ATMARK flags being set. 2357c478bd9Sstevel@tonic-gate * This implies that any transport that is sending M_PCSIG(SIGURG) 2367c478bd9Sstevel@tonic-gate * should send the appropriate MSGNOTMARKNEXT message (which can be 2377c478bd9Sstevel@tonic-gate * zero length) after sending an M_PCSIG to prevent SIOCATMARK 2387c478bd9Sstevel@tonic-gate * from sleeping unnecessarily. 2397c478bd9Sstevel@tonic-gate */ 2407c478bd9Sstevel@tonic-gate mblk_t *so_oobmsg; /* outofline oob data */ 2417c478bd9Sstevel@tonic-gate uint_t so_oobsigcnt; /* Number of SIGURG generated */ 2427c478bd9Sstevel@tonic-gate uint_t so_oobcnt; /* Number of T_EXDATA_IND queued */ 2437c478bd9Sstevel@tonic-gate pid_t so_pgrp; /* pgrp for signals */ 2447c478bd9Sstevel@tonic-gate 2457c478bd9Sstevel@tonic-gate /* From T_info_ack */ 2467c478bd9Sstevel@tonic-gate t_uscalar_t so_tsdu_size; 2477c478bd9Sstevel@tonic-gate t_uscalar_t so_etsdu_size; 2487c478bd9Sstevel@tonic-gate t_scalar_t so_addr_size; 2497c478bd9Sstevel@tonic-gate t_uscalar_t so_opt_size; 2507c478bd9Sstevel@tonic-gate t_uscalar_t so_tidu_size; 2517c478bd9Sstevel@tonic-gate t_scalar_t so_serv_type; 2527c478bd9Sstevel@tonic-gate 2537c478bd9Sstevel@tonic-gate /* From T_capability_ack */ 2547c478bd9Sstevel@tonic-gate t_uscalar_t so_acceptor_id; 2557c478bd9Sstevel@tonic-gate 2567c478bd9Sstevel@tonic-gate /* Internal provider information */ 2577c478bd9Sstevel@tonic-gate struct tpi_provinfo *so_provinfo; 2587c478bd9Sstevel@tonic-gate 2597c478bd9Sstevel@tonic-gate /* 2607c478bd9Sstevel@tonic-gate * The local and remote addresses have multiple purposes 2617c478bd9Sstevel@tonic-gate * but one of the key reasons for their existence and careful 2627c478bd9Sstevel@tonic-gate * tracking in sockfs is to support getsockname and getpeername 2637c478bd9Sstevel@tonic-gate * when the transport does not handle the TI_GET*NAME ioctls 2647c478bd9Sstevel@tonic-gate * and caching when it does (signalled by valid bits in so_state). 2657c478bd9Sstevel@tonic-gate * When all transports support the new TPI (with T_ADDR_REQ) 2667c478bd9Sstevel@tonic-gate * we can revisit this code. 2677c478bd9Sstevel@tonic-gate * The other usage of so_faddr is to keep the "connected to" 2687c478bd9Sstevel@tonic-gate * address for datagram sockets. 2697c478bd9Sstevel@tonic-gate * Finally, for AF_UNIX both local and remote addresses are used 2707c478bd9Sstevel@tonic-gate * to record the sockaddr_un since we use a separate namespace 2717c478bd9Sstevel@tonic-gate * in the loopback transport. 2727c478bd9Sstevel@tonic-gate */ 2737c478bd9Sstevel@tonic-gate struct soaddr so_laddr; /* Local address */ 2747c478bd9Sstevel@tonic-gate struct soaddr so_faddr; /* Peer address */ 2757c478bd9Sstevel@tonic-gate #define so_laddr_sa so_laddr.soa_sa 2767c478bd9Sstevel@tonic-gate #define so_faddr_sa so_faddr.soa_sa 2777c478bd9Sstevel@tonic-gate #define so_laddr_len so_laddr.soa_len 2787c478bd9Sstevel@tonic-gate #define so_faddr_len so_faddr.soa_len 2797c478bd9Sstevel@tonic-gate #define so_laddr_maxlen so_laddr.soa_maxlen 2807c478bd9Sstevel@tonic-gate #define so_faddr_maxlen so_faddr.soa_maxlen 2817c478bd9Sstevel@tonic-gate mblk_t *so_eaddr_mp; /* for so_delayed_error */ 2827c478bd9Sstevel@tonic-gate 2837c478bd9Sstevel@tonic-gate /* 2847c478bd9Sstevel@tonic-gate * For AF_UNIX sockets: 2857c478bd9Sstevel@tonic-gate * so_ux_laddr/faddr records the internal addresses used with the 2867c478bd9Sstevel@tonic-gate * transport. 2877c478bd9Sstevel@tonic-gate * so_ux_vp and v_stream->sd_vnode form the cross- 2887c478bd9Sstevel@tonic-gate * linkage between the underlying fs vnode corresponding to 2897c478bd9Sstevel@tonic-gate * the bound sockaddr_un and the socket node. 2907c478bd9Sstevel@tonic-gate */ 2917c478bd9Sstevel@tonic-gate struct so_ux_addr so_ux_laddr; /* laddr bound with the transport */ 2927c478bd9Sstevel@tonic-gate struct so_ux_addr so_ux_faddr; /* temporary peer address */ 2937c478bd9Sstevel@tonic-gate struct vnode *so_ux_bound_vp; /* bound AF_UNIX file system vnode */ 2947c478bd9Sstevel@tonic-gate struct sonode *so_next; /* next sonode on socklist */ 2957c478bd9Sstevel@tonic-gate struct sonode *so_prev; /* previous sonode on socklist */ 2967c478bd9Sstevel@tonic-gate mblk_t *so_discon_ind_mp; /* T_DISCON_IND received from below */ 2977c478bd9Sstevel@tonic-gate 2987c478bd9Sstevel@tonic-gate /* put here for delayed processing */ 2997c478bd9Sstevel@tonic-gate void *so_priv; /* sonode private data */ 3007c478bd9Sstevel@tonic-gate cred_t *so_peercred; /* connected socket peer cred */ 3017c478bd9Sstevel@tonic-gate pid_t so_cpid; /* connected socket peer cached pid */ 3027c478bd9Sstevel@tonic-gate zoneid_t so_zoneid; /* opener's zoneid */ 3037c478bd9Sstevel@tonic-gate 3047c478bd9Sstevel@tonic-gate kmem_cache_t *so_cache; /* object cache of this "sonode". */ 3057c478bd9Sstevel@tonic-gate void *so_obj; /* object to free */ 3067c478bd9Sstevel@tonic-gate 3077c478bd9Sstevel@tonic-gate /* 3087c478bd9Sstevel@tonic-gate * For NL7C sockets: 3097c478bd9Sstevel@tonic-gate * 3107c478bd9Sstevel@tonic-gate * so_nl7c_flags the NL7C state of URL processing. 3117c478bd9Sstevel@tonic-gate * 3127c478bd9Sstevel@tonic-gate * so_nl7c_rcv_mp mblk_t chain of already received data to be 3137c478bd9Sstevel@tonic-gate * passed up to the app after NL7C gives up on 3147c478bd9Sstevel@tonic-gate * a socket. 3157c478bd9Sstevel@tonic-gate * 3167c478bd9Sstevel@tonic-gate * so_nl7c_rcv_rval returned rval for last mblk_t from above. 3177c478bd9Sstevel@tonic-gate * 3187c478bd9Sstevel@tonic-gate * so_nl7c_uri the URI currently being processed. 3197c478bd9Sstevel@tonic-gate * 3207c478bd9Sstevel@tonic-gate * so_nl7c_rtime URI request gethrestime_sec(). 3217c478bd9Sstevel@tonic-gate */ 3227c478bd9Sstevel@tonic-gate uint64_t so_nl7c_flags; 3237c478bd9Sstevel@tonic-gate mblk_t *so_nl7c_rcv_mp; 3247c478bd9Sstevel@tonic-gate int64_t so_nl7c_rcv_rval; 3257c478bd9Sstevel@tonic-gate void *so_nl7c_uri; 3267c478bd9Sstevel@tonic-gate time_t so_nl7c_rtime; 3277c478bd9Sstevel@tonic-gate }; 3287c478bd9Sstevel@tonic-gate 3297c478bd9Sstevel@tonic-gate /* flags */ 3307c478bd9Sstevel@tonic-gate #define SOMOD 0x0001 /* update socket modification time */ 3317c478bd9Sstevel@tonic-gate #define SOACC 0x0002 /* update socket access time */ 3327c478bd9Sstevel@tonic-gate 3337c478bd9Sstevel@tonic-gate #define SOLOCKED 0x0010 /* use to serialize open/closes */ 3347c478bd9Sstevel@tonic-gate #define SOREADLOCKED 0x0020 /* serialize kstrgetmsg calls */ 3357c478bd9Sstevel@tonic-gate #define SOWANT 0x0040 /* some process waiting on lock */ 3367c478bd9Sstevel@tonic-gate #define SOCLONE 0x0080 /* child of clone driver */ 3377c478bd9Sstevel@tonic-gate #define SOASYNC_UNBIND 0x0100 /* wait for ACK of async unbind */ 3387c478bd9Sstevel@tonic-gate 3397c478bd9Sstevel@tonic-gate /* 3407c478bd9Sstevel@tonic-gate * Socket state bits. 3417c478bd9Sstevel@tonic-gate */ 3427c478bd9Sstevel@tonic-gate #define SS_ISCONNECTED 0x00000001 /* socket connected to a peer */ 3437c478bd9Sstevel@tonic-gate #define SS_ISCONNECTING 0x00000002 /* in process, connecting to peer */ 3447c478bd9Sstevel@tonic-gate #define SS_ISDISCONNECTING 0x00000004 /* in process of disconnecting */ 3457c478bd9Sstevel@tonic-gate #define SS_CANTSENDMORE 0x00000008 /* can't send more data to peer */ 3467c478bd9Sstevel@tonic-gate 3477c478bd9Sstevel@tonic-gate #define SS_CANTRCVMORE 0x00000010 /* can't receive more data */ 3487c478bd9Sstevel@tonic-gate #define SS_ISBOUND 0x00000020 /* socket is bound */ 3497c478bd9Sstevel@tonic-gate #define SS_NDELAY 0x00000040 /* FNDELAY non-blocking */ 3507c478bd9Sstevel@tonic-gate #define SS_NONBLOCK 0x00000080 /* O_NONBLOCK non-blocking */ 3517c478bd9Sstevel@tonic-gate 3527c478bd9Sstevel@tonic-gate #define SS_ASYNC 0x00000100 /* async i/o notify */ 3537c478bd9Sstevel@tonic-gate #define SS_ACCEPTCONN 0x00000200 /* listen done */ 3547c478bd9Sstevel@tonic-gate #define SS_HASCONNIND 0x00000400 /* T_CONN_IND for poll */ 3557c478bd9Sstevel@tonic-gate #define SS_SAVEDEOR 0x00000800 /* Saved MSG_EOR rcv side state */ 3567c478bd9Sstevel@tonic-gate 3577c478bd9Sstevel@tonic-gate #define SS_RCVATMARK 0x00001000 /* at mark on input */ 3587c478bd9Sstevel@tonic-gate #define SS_OOBPEND 0x00002000 /* OOB pending or present - poll */ 3597c478bd9Sstevel@tonic-gate #define SS_HAVEOOBDATA 0x00004000 /* OOB data present */ 3607c478bd9Sstevel@tonic-gate #define SS_HADOOBDATA 0x00008000 /* OOB data consumed */ 3617c478bd9Sstevel@tonic-gate 3627c478bd9Sstevel@tonic-gate #define SS_FADDR_NOXLATE 0x00020000 /* No xlation of faddr for AF_UNIX */ 3637c478bd9Sstevel@tonic-gate 3647c478bd9Sstevel@tonic-gate #define SS_HASDATA 0x00040000 /* NCAfs: data available */ 3657c478bd9Sstevel@tonic-gate #define SS_DONEREAD 0x00080000 /* NCAfs: all data read */ 3667c478bd9Sstevel@tonic-gate #define SS_MOREDATA 0x00100000 /* NCAfs: NCA has more data */ 3677c478bd9Sstevel@tonic-gate 368*ff550d0eSmasputra #define SS_DIRECT 0x00200000 /* transport is directly below */ 3697c478bd9Sstevel@tonic-gate 3707c478bd9Sstevel@tonic-gate #define SS_LADDR_VALID 0x01000000 /* so_laddr valid for user */ 3717c478bd9Sstevel@tonic-gate #define SS_FADDR_VALID 0x02000000 /* so_faddr valid for user */ 3727c478bd9Sstevel@tonic-gate 3737c478bd9Sstevel@tonic-gate /* Set of states when the socket can't be rebound */ 3747c478bd9Sstevel@tonic-gate #define SS_CANTREBIND (SS_ISCONNECTED|SS_ISCONNECTING|SS_ISDISCONNECTING|\ 3757c478bd9Sstevel@tonic-gate SS_CANTSENDMORE|SS_CANTRCVMORE|SS_ACCEPTCONN) 3767c478bd9Sstevel@tonic-gate 3777c478bd9Sstevel@tonic-gate /* 3787c478bd9Sstevel@tonic-gate * Characteristics of sockets. Not changed after the socket is created. 3797c478bd9Sstevel@tonic-gate */ 3807c478bd9Sstevel@tonic-gate #define SM_PRIV 0x001 /* privileged for broadcast, raw... */ 3817c478bd9Sstevel@tonic-gate #define SM_ATOMIC 0x002 /* atomic data transmission */ 3827c478bd9Sstevel@tonic-gate #define SM_ADDR 0x004 /* addresses given with messages */ 3837c478bd9Sstevel@tonic-gate #define SM_CONNREQUIRED 0x008 /* connection required by protocol */ 3847c478bd9Sstevel@tonic-gate 3857c478bd9Sstevel@tonic-gate #define SM_FDPASSING 0x010 /* passes file descriptors */ 3867c478bd9Sstevel@tonic-gate #define SM_EXDATA 0x020 /* Can handle T_EXDATA_REQ */ 3877c478bd9Sstevel@tonic-gate #define SM_OPTDATA 0x040 /* Can handle T_OPTDATA_REQ */ 3887c478bd9Sstevel@tonic-gate #define SM_BYTESTREAM 0x080 /* Byte stream - can use M_DATA */ 3897c478bd9Sstevel@tonic-gate 3907c478bd9Sstevel@tonic-gate #define SM_ACCEPTOR_ID 0x100 /* so_acceptor_id is valid */ 3917c478bd9Sstevel@tonic-gate 3927c478bd9Sstevel@tonic-gate /* 3937c478bd9Sstevel@tonic-gate * Socket versions. Used by the socket library when calling _so_socket(). 3947c478bd9Sstevel@tonic-gate */ 3957c478bd9Sstevel@tonic-gate #define SOV_STREAM 0 /* Not a socket - just a stream */ 3967c478bd9Sstevel@tonic-gate #define SOV_DEFAULT 1 /* Select based on so_default_version */ 3977c478bd9Sstevel@tonic-gate #define SOV_SOCKSTREAM 2 /* Socket plus streams operations */ 3987c478bd9Sstevel@tonic-gate #define SOV_SOCKBSD 3 /* Socket with no streams operations */ 3997c478bd9Sstevel@tonic-gate #define SOV_XPG4_2 4 /* Xnet socket */ 4007c478bd9Sstevel@tonic-gate 4017c478bd9Sstevel@tonic-gate #if defined(_KERNEL) || defined(_KMEMUSER) 4027c478bd9Sstevel@tonic-gate /* 4037c478bd9Sstevel@tonic-gate * Used for mapping family/type/protocol to vnode. 4047c478bd9Sstevel@tonic-gate * Defined here so that crash can use it. 4057c478bd9Sstevel@tonic-gate */ 4067c478bd9Sstevel@tonic-gate struct sockparams { 4077c478bd9Sstevel@tonic-gate int sp_domain; 4087c478bd9Sstevel@tonic-gate int sp_type; 4097c478bd9Sstevel@tonic-gate int sp_protocol; 4107c478bd9Sstevel@tonic-gate char *sp_devpath; 4117c478bd9Sstevel@tonic-gate int sp_devpathlen; /* Is 0 if sp_devpath is a static string */ 4127c478bd9Sstevel@tonic-gate vnode_t *sp_vnode; 4137c478bd9Sstevel@tonic-gate struct sockparams *sp_next; 4147c478bd9Sstevel@tonic-gate }; 4157c478bd9Sstevel@tonic-gate 4167c478bd9Sstevel@tonic-gate extern struct sockparams *sphead; 4177c478bd9Sstevel@tonic-gate 4187c478bd9Sstevel@tonic-gate /* 4197c478bd9Sstevel@tonic-gate * Used to traverse the list of AF_UNIX sockets to construct the kstat 4207c478bd9Sstevel@tonic-gate * for netstat(1m). 4217c478bd9Sstevel@tonic-gate */ 4227c478bd9Sstevel@tonic-gate struct socklist { 4237c478bd9Sstevel@tonic-gate kmutex_t sl_lock; 4247c478bd9Sstevel@tonic-gate struct sonode *sl_list; 4257c478bd9Sstevel@tonic-gate }; 4267c478bd9Sstevel@tonic-gate 4277c478bd9Sstevel@tonic-gate extern struct socklist socklist; 4287c478bd9Sstevel@tonic-gate /* 4297c478bd9Sstevel@tonic-gate * ss_full_waits is the number of times the reader thread 4307c478bd9Sstevel@tonic-gate * waits when the queue is full and ss_empty_waits is the number 4317c478bd9Sstevel@tonic-gate * of times the consumer thread waits when the queue is empty. 4327c478bd9Sstevel@tonic-gate * No locks for these as they are just indicators of whether 4337c478bd9Sstevel@tonic-gate * disk or network or both is slow or fast. 4347c478bd9Sstevel@tonic-gate */ 4357c478bd9Sstevel@tonic-gate struct sendfile_stats { 4367c478bd9Sstevel@tonic-gate uint32_t ss_file_cached; 4377c478bd9Sstevel@tonic-gate uint32_t ss_file_not_cached; 4387c478bd9Sstevel@tonic-gate uint32_t ss_full_waits; 4397c478bd9Sstevel@tonic-gate uint32_t ss_empty_waits; 4407c478bd9Sstevel@tonic-gate uint32_t ss_file_segmap; 4417c478bd9Sstevel@tonic-gate }; 4427c478bd9Sstevel@tonic-gate 4437c478bd9Sstevel@tonic-gate /* 4447c478bd9Sstevel@tonic-gate * A single sendfile request is represented by snf_req. 4457c478bd9Sstevel@tonic-gate */ 4467c478bd9Sstevel@tonic-gate typedef struct snf_req { 4477c478bd9Sstevel@tonic-gate struct snf_req *sr_next; 4487c478bd9Sstevel@tonic-gate mblk_t *sr_mp_head; 4497c478bd9Sstevel@tonic-gate mblk_t *sr_mp_tail; 4507c478bd9Sstevel@tonic-gate kmutex_t sr_lock; 4517c478bd9Sstevel@tonic-gate kcondvar_t sr_cv; 4527c478bd9Sstevel@tonic-gate uint_t sr_qlen; 4537c478bd9Sstevel@tonic-gate int sr_hiwat; 4547c478bd9Sstevel@tonic-gate int sr_lowat; 4557c478bd9Sstevel@tonic-gate int sr_operation; 4567c478bd9Sstevel@tonic-gate struct vnode *sr_vp; 4577c478bd9Sstevel@tonic-gate file_t *sr_fp; 4587c478bd9Sstevel@tonic-gate ssize_t sr_maxpsz; 4597c478bd9Sstevel@tonic-gate u_offset_t sr_file_off; 4607c478bd9Sstevel@tonic-gate u_offset_t sr_file_size; 4617c478bd9Sstevel@tonic-gate #define SR_READ_DONE 0x80000000 4627c478bd9Sstevel@tonic-gate int sr_read_error; 4637c478bd9Sstevel@tonic-gate int sr_write_error; 4647c478bd9Sstevel@tonic-gate } snf_req_t; 4657c478bd9Sstevel@tonic-gate 4667c478bd9Sstevel@tonic-gate /* A queue of sendfile requests */ 4677c478bd9Sstevel@tonic-gate struct sendfile_queue { 4687c478bd9Sstevel@tonic-gate snf_req_t *snfq_req_head; 4697c478bd9Sstevel@tonic-gate snf_req_t *snfq_req_tail; 4707c478bd9Sstevel@tonic-gate kmutex_t snfq_lock; 4717c478bd9Sstevel@tonic-gate kcondvar_t snfq_cv; 4727c478bd9Sstevel@tonic-gate int snfq_svc_threads; /* # of service threads */ 4737c478bd9Sstevel@tonic-gate int snfq_idle_cnt; /* # of idling threads */ 4747c478bd9Sstevel@tonic-gate int snfq_max_threads; 4757c478bd9Sstevel@tonic-gate int snfq_req_cnt; /* Number of requests */ 4767c478bd9Sstevel@tonic-gate }; 4777c478bd9Sstevel@tonic-gate 4787c478bd9Sstevel@tonic-gate #define READ_OP 1 4797c478bd9Sstevel@tonic-gate #define SNFQ_TIMEOUT (60 * 5 * hz) /* 5 minutes */ 4807c478bd9Sstevel@tonic-gate 4817c478bd9Sstevel@tonic-gate /* Socket network operations switch */ 4827c478bd9Sstevel@tonic-gate struct sonodeops { 4837c478bd9Sstevel@tonic-gate int (*sop_accept)(struct sonode *, int, struct sonode **); 4847c478bd9Sstevel@tonic-gate int (*sop_bind)(struct sonode *, struct sockaddr *, socklen_t, 4857c478bd9Sstevel@tonic-gate int); 4867c478bd9Sstevel@tonic-gate int (*sop_listen)(struct sonode *, int); 4877c478bd9Sstevel@tonic-gate int (*sop_connect)(struct sonode *, const struct sockaddr *, 4887c478bd9Sstevel@tonic-gate socklen_t, int, int); 4897c478bd9Sstevel@tonic-gate int (*sop_recvmsg)(struct sonode *, struct msghdr *, 4907c478bd9Sstevel@tonic-gate struct uio *); 4917c478bd9Sstevel@tonic-gate int (*sop_sendmsg)(struct sonode *, struct msghdr *, 4927c478bd9Sstevel@tonic-gate struct uio *); 4937c478bd9Sstevel@tonic-gate int (*sop_getpeername)(struct sonode *); 4947c478bd9Sstevel@tonic-gate int (*sop_getsockname)(struct sonode *); 4957c478bd9Sstevel@tonic-gate int (*sop_shutdown)(struct sonode *, int); 4967c478bd9Sstevel@tonic-gate int (*sop_getsockopt)(struct sonode *, int, int, void *, 4977c478bd9Sstevel@tonic-gate socklen_t *, int); 4987c478bd9Sstevel@tonic-gate int (*sop_setsockopt)(struct sonode *, int, int, const void *, 4997c478bd9Sstevel@tonic-gate socklen_t); 5007c478bd9Sstevel@tonic-gate }; 5017c478bd9Sstevel@tonic-gate 5027c478bd9Sstevel@tonic-gate #define SOP_ACCEPT(so, fflag, nsop) \ 5037c478bd9Sstevel@tonic-gate ((so)->so_ops->sop_accept((so), (fflag), (nsop))) 5047c478bd9Sstevel@tonic-gate #define SOP_BIND(so, name, namelen, flags) \ 5057c478bd9Sstevel@tonic-gate ((so)->so_ops->sop_bind((so), (name), (namelen), (flags))) 5067c478bd9Sstevel@tonic-gate #define SOP_LISTEN(so, backlog) \ 5077c478bd9Sstevel@tonic-gate ((so)->so_ops->sop_listen((so), (backlog))) 5087c478bd9Sstevel@tonic-gate #define SOP_CONNECT(so, name, namelen, fflag, flags) \ 5097c478bd9Sstevel@tonic-gate ((so)->so_ops->sop_connect((so), (name), (namelen), (fflag), (flags))) 5107c478bd9Sstevel@tonic-gate #define SOP_RECVMSG(so, msg, uiop) \ 5117c478bd9Sstevel@tonic-gate ((so)->so_ops->sop_recvmsg((so), (msg), (uiop))) 5127c478bd9Sstevel@tonic-gate #define SOP_SENDMSG(so, msg, uiop) \ 5137c478bd9Sstevel@tonic-gate ((so)->so_ops->sop_sendmsg((so), (msg), (uiop))) 5147c478bd9Sstevel@tonic-gate #define SOP_GETPEERNAME(so) \ 5157c478bd9Sstevel@tonic-gate ((so)->so_ops->sop_getpeername((so))) 5167c478bd9Sstevel@tonic-gate #define SOP_GETSOCKNAME(so) \ 5177c478bd9Sstevel@tonic-gate ((so)->so_ops->sop_getsockname((so))) 5187c478bd9Sstevel@tonic-gate #define SOP_SHUTDOWN(so, how) \ 5197c478bd9Sstevel@tonic-gate ((so)->so_ops->sop_shutdown((so), (how))) 5207c478bd9Sstevel@tonic-gate #define SOP_GETSOCKOPT(so, level, optionname, optval, optlenp, flags) \ 5217c478bd9Sstevel@tonic-gate ((so)->so_ops->sop_getsockopt((so), (level), (optionname), \ 5227c478bd9Sstevel@tonic-gate (optval), (optlenp), (flags))) 5237c478bd9Sstevel@tonic-gate #define SOP_SETSOCKOPT(so, level, optionname, optval, optlen) \ 5247c478bd9Sstevel@tonic-gate ((so)->so_ops->sop_setsockopt((so), (level), (optionname), \ 5257c478bd9Sstevel@tonic-gate (optval), (optlen))) 5267c478bd9Sstevel@tonic-gate 5277c478bd9Sstevel@tonic-gate #endif /* defined(_KERNEL) || defined(_KMEMUSER) */ 5287c478bd9Sstevel@tonic-gate 5297c478bd9Sstevel@tonic-gate #ifdef _KERNEL 5307c478bd9Sstevel@tonic-gate 5317c478bd9Sstevel@tonic-gate #define ISALIGNED_cmsghdr(addr) \ 5327c478bd9Sstevel@tonic-gate (((uintptr_t)(addr) & (_CMSG_HDR_ALIGNMENT - 1)) == 0) 5337c478bd9Sstevel@tonic-gate 5347c478bd9Sstevel@tonic-gate #define ROUNDUP_cmsglen(len) \ 5357c478bd9Sstevel@tonic-gate (((len) + _CMSG_HDR_ALIGNMENT - 1) & ~(_CMSG_HDR_ALIGNMENT - 1)) 5367c478bd9Sstevel@tonic-gate 5377c478bd9Sstevel@tonic-gate /* 5387c478bd9Sstevel@tonic-gate * Used in parsing msg_control 5397c478bd9Sstevel@tonic-gate */ 5407c478bd9Sstevel@tonic-gate #define CMSG_NEXT(cmsg) \ 5417c478bd9Sstevel@tonic-gate (struct cmsghdr *)((uintptr_t)(cmsg) + \ 5427c478bd9Sstevel@tonic-gate ROUNDUP_cmsglen((cmsg)->cmsg_len)) 5437c478bd9Sstevel@tonic-gate 5447c478bd9Sstevel@tonic-gate /* 5457c478bd9Sstevel@tonic-gate * Maximum size of any argument that is copied in (addresses, options, 5467c478bd9Sstevel@tonic-gate * access rights). MUST be at least MAXPATHLEN + 3. 5477c478bd9Sstevel@tonic-gate * BSD and SunOS 4.X limited this to MLEN or MCLBYTES. 5487c478bd9Sstevel@tonic-gate */ 5497c478bd9Sstevel@tonic-gate #define SO_MAXARGSIZE 8192 5507c478bd9Sstevel@tonic-gate 5517c478bd9Sstevel@tonic-gate /* 5527c478bd9Sstevel@tonic-gate * Convert between vnode and sonode 5537c478bd9Sstevel@tonic-gate */ 5547c478bd9Sstevel@tonic-gate #define VTOSO(vp) ((struct sonode *)((vp)->v_data)) 5557c478bd9Sstevel@tonic-gate #define SOTOV(sp) ((sp)->so_vnode) 5567c478bd9Sstevel@tonic-gate 5577c478bd9Sstevel@tonic-gate /* 5587c478bd9Sstevel@tonic-gate * Internal flags for sobind() 5597c478bd9Sstevel@tonic-gate */ 5607c478bd9Sstevel@tonic-gate #define _SOBIND_REBIND 0x01 /* Bind to existing local address */ 5617c478bd9Sstevel@tonic-gate #define _SOBIND_UNSPEC 0x02 /* Bind to unspecified address */ 5627c478bd9Sstevel@tonic-gate #define _SOBIND_LOCK_HELD 0x04 /* so_excl_lock held by caller */ 5637c478bd9Sstevel@tonic-gate #define _SOBIND_NOXLATE 0x08 /* No addr translation for AF_UNIX */ 5647c478bd9Sstevel@tonic-gate #define _SOBIND_XPG4_2 0x10 /* xpg4.2 semantics */ 5657c478bd9Sstevel@tonic-gate #define _SOBIND_SOCKBSD 0x20 /* BSD semantics */ 5667c478bd9Sstevel@tonic-gate #define _SOBIND_LISTEN 0x40 /* Make into SS_ACCEPTCONN */ 5677c478bd9Sstevel@tonic-gate #define _SOBIND_SOCKETPAIR 0x80 /* Internal flag for so_socketpair() */ 5687c478bd9Sstevel@tonic-gate /* to enable listen with backlog = 1 */ 5697c478bd9Sstevel@tonic-gate 5707c478bd9Sstevel@tonic-gate /* 5717c478bd9Sstevel@tonic-gate * Internal flags for sounbind() 5727c478bd9Sstevel@tonic-gate */ 5737c478bd9Sstevel@tonic-gate #define _SOUNBIND_REBIND 0x01 /* Don't clear fields - will rebind */ 5747c478bd9Sstevel@tonic-gate 5757c478bd9Sstevel@tonic-gate /* 5767c478bd9Sstevel@tonic-gate * Internal flags for soconnect() 5777c478bd9Sstevel@tonic-gate */ 5787c478bd9Sstevel@tonic-gate #define _SOCONNECT_NOXLATE 0x01 /* No addr translation for AF_UNIX */ 5797c478bd9Sstevel@tonic-gate #define _SOCONNECT_DID_BIND 0x02 /* Unbind when connect fails */ 5807c478bd9Sstevel@tonic-gate #define _SOCONNECT_XPG4_2 0x04 /* xpg4.2 semantics */ 5817c478bd9Sstevel@tonic-gate 5827c478bd9Sstevel@tonic-gate /* 5837c478bd9Sstevel@tonic-gate * Internal flags for sodisconnect() 5847c478bd9Sstevel@tonic-gate */ 5857c478bd9Sstevel@tonic-gate #define _SODISCONNECT_LOCK_HELD 0x01 /* so_excl_lock held by caller */ 5867c478bd9Sstevel@tonic-gate 5877c478bd9Sstevel@tonic-gate /* 5887c478bd9Sstevel@tonic-gate * Internal flags for sotpi_getsockopt(). 5897c478bd9Sstevel@tonic-gate */ 5907c478bd9Sstevel@tonic-gate #define _SOGETSOCKOPT_XPG4_2 0x01 /* xpg4.2 semantics */ 5917c478bd9Sstevel@tonic-gate 5927c478bd9Sstevel@tonic-gate /* 5937c478bd9Sstevel@tonic-gate * Internal flags for soallocproto*() 5947c478bd9Sstevel@tonic-gate */ 5957c478bd9Sstevel@tonic-gate #define _ALLOC_NOSLEEP 0 /* Don't sleep for memory */ 5967c478bd9Sstevel@tonic-gate #define _ALLOC_INTR 1 /* Sleep until interrupt */ 5977c478bd9Sstevel@tonic-gate #define _ALLOC_SLEEP 2 /* Sleep forever */ 5987c478bd9Sstevel@tonic-gate 5997c478bd9Sstevel@tonic-gate /* 6007c478bd9Sstevel@tonic-gate * Internal structure for handling AF_UNIX file descriptor passing 6017c478bd9Sstevel@tonic-gate */ 6027c478bd9Sstevel@tonic-gate struct fdbuf { 6037c478bd9Sstevel@tonic-gate int fd_size; /* In bytes, for kmem_free */ 6047c478bd9Sstevel@tonic-gate int fd_numfd; /* Number of elements below */ 6057c478bd9Sstevel@tonic-gate char *fd_ebuf; /* Extra buffer to free */ 6067c478bd9Sstevel@tonic-gate int fd_ebuflen; 6077c478bd9Sstevel@tonic-gate frtn_t fd_frtn; 6087c478bd9Sstevel@tonic-gate struct file *fd_fds[1]; /* One or more */ 6097c478bd9Sstevel@tonic-gate }; 6107c478bd9Sstevel@tonic-gate #define FDBUF_HDRSIZE (sizeof (struct fdbuf) - sizeof (struct file *)) 6117c478bd9Sstevel@tonic-gate 6127c478bd9Sstevel@tonic-gate /* 6137c478bd9Sstevel@tonic-gate * Variable that can be patched to set what version of socket socket() 6147c478bd9Sstevel@tonic-gate * will create. 6157c478bd9Sstevel@tonic-gate */ 6167c478bd9Sstevel@tonic-gate extern int so_default_version; 6177c478bd9Sstevel@tonic-gate 6187c478bd9Sstevel@tonic-gate #ifdef DEBUG 6197c478bd9Sstevel@tonic-gate /* Turn on extra testing capabilities */ 6207c478bd9Sstevel@tonic-gate #define SOCK_TEST 6217c478bd9Sstevel@tonic-gate #endif /* DEBUG */ 6227c478bd9Sstevel@tonic-gate 6237c478bd9Sstevel@tonic-gate #ifdef DEBUG 6247c478bd9Sstevel@tonic-gate char *pr_state(uint_t, uint_t); 6257c478bd9Sstevel@tonic-gate char *pr_addr(int, struct sockaddr *, t_uscalar_t); 6267c478bd9Sstevel@tonic-gate int so_verify_oobstate(struct sonode *); 6277c478bd9Sstevel@tonic-gate #endif /* DEBUG */ 6287c478bd9Sstevel@tonic-gate 6297c478bd9Sstevel@tonic-gate /* 6307c478bd9Sstevel@tonic-gate * DEBUG macros 6317c478bd9Sstevel@tonic-gate */ 6327c478bd9Sstevel@tonic-gate #if defined(DEBUG) && !defined(__lint) 6337c478bd9Sstevel@tonic-gate #define SOCK_DEBUG 6347c478bd9Sstevel@tonic-gate 6357c478bd9Sstevel@tonic-gate extern int sockdebug; 6367c478bd9Sstevel@tonic-gate extern int sockprinterr; 6377c478bd9Sstevel@tonic-gate 6387c478bd9Sstevel@tonic-gate #define eprint(args) printf args 6397c478bd9Sstevel@tonic-gate #define eprintso(so, args) \ 6407c478bd9Sstevel@tonic-gate { if (sockprinterr && ((so)->so_options & SO_DEBUG)) printf args; } 6417c478bd9Sstevel@tonic-gate #define eprintline(error) \ 6427c478bd9Sstevel@tonic-gate { \ 6437c478bd9Sstevel@tonic-gate if (error != EINTR && (sockprinterr || sockdebug > 0)) \ 6447c478bd9Sstevel@tonic-gate printf("socket error %d: line %d file %s\n", \ 6457c478bd9Sstevel@tonic-gate (error), __LINE__, __FILE__); \ 6467c478bd9Sstevel@tonic-gate } 6477c478bd9Sstevel@tonic-gate 6487c478bd9Sstevel@tonic-gate #define eprintsoline(so, error) \ 6497c478bd9Sstevel@tonic-gate { if (sockprinterr && ((so)->so_options & SO_DEBUG)) \ 6507c478bd9Sstevel@tonic-gate printf("socket(%p) error %d: line %d file %s\n", \ 6517c478bd9Sstevel@tonic-gate (so), (error), __LINE__, __FILE__); \ 6527c478bd9Sstevel@tonic-gate } 6537c478bd9Sstevel@tonic-gate #define dprint(level, args) { if (sockdebug > (level)) printf args; } 6547c478bd9Sstevel@tonic-gate #define dprintso(so, level, args) \ 6557c478bd9Sstevel@tonic-gate { if (sockdebug > (level) && ((so)->so_options & SO_DEBUG)) printf args; } 6567c478bd9Sstevel@tonic-gate 6577c478bd9Sstevel@tonic-gate #else /* define(DEBUG) && !defined(__lint) */ 6587c478bd9Sstevel@tonic-gate 6597c478bd9Sstevel@tonic-gate #define eprint(args) {} 6607c478bd9Sstevel@tonic-gate #define eprintso(so, args) {} 6617c478bd9Sstevel@tonic-gate #define eprintline(error) {} 6627c478bd9Sstevel@tonic-gate #define eprintsoline(so, error) {} 6637c478bd9Sstevel@tonic-gate #define dprint(level, args) {} 6647c478bd9Sstevel@tonic-gate #define dprintso(so, level, args) {} 6657c478bd9Sstevel@tonic-gate #ifdef DEBUG 6667c478bd9Sstevel@tonic-gate #undef DEBUG 6677c478bd9Sstevel@tonic-gate #endif 6687c478bd9Sstevel@tonic-gate 6697c478bd9Sstevel@tonic-gate #endif /* defined(DEBUG) && !defined(__lint) */ 6707c478bd9Sstevel@tonic-gate 6717c478bd9Sstevel@tonic-gate extern struct vfsops sock_vfsops; 6727c478bd9Sstevel@tonic-gate extern struct vnodeops *socktpi_vnodeops; 6737c478bd9Sstevel@tonic-gate extern const struct fs_operation_def socktpi_vnodeops_template[]; 6747c478bd9Sstevel@tonic-gate 6757c478bd9Sstevel@tonic-gate extern sonodeops_t sotpi_sonodeops; 6767c478bd9Sstevel@tonic-gate 6777c478bd9Sstevel@tonic-gate extern dev_t sockdev; 6787c478bd9Sstevel@tonic-gate 6797c478bd9Sstevel@tonic-gate /* NCAfs symbols */ 6807c478bd9Sstevel@tonic-gate 6817c478bd9Sstevel@tonic-gate extern int socknca_read(struct vnode *, struct uio *, int, struct cred *, 6827c478bd9Sstevel@tonic-gate struct caller_context *); 6837c478bd9Sstevel@tonic-gate extern int socknca_write(struct vnode *, struct uio *, int, struct cred *, 6847c478bd9Sstevel@tonic-gate struct caller_context *); 6857c478bd9Sstevel@tonic-gate extern int socknca_ioctl(struct vnode *, int, intptr_t, int, 6867c478bd9Sstevel@tonic-gate struct cred *, int *); 6877c478bd9Sstevel@tonic-gate extern int nca_poll(struct vnode *, short, int, short *, 6887c478bd9Sstevel@tonic-gate struct pollhead **); 6897c478bd9Sstevel@tonic-gate extern int socknca_close(struct vnode *, int, int, offset_t, 6907c478bd9Sstevel@tonic-gate struct cred *); 6917c478bd9Sstevel@tonic-gate extern void socknca_inactive(struct vnode *, struct cred *); 6927c478bd9Sstevel@tonic-gate 6937c478bd9Sstevel@tonic-gate extern const struct fs_operation_def socknca_vnodeops_template[]; 6947c478bd9Sstevel@tonic-gate extern struct vnodeops *socknca_vnodeops; 6957c478bd9Sstevel@tonic-gate 6967c478bd9Sstevel@tonic-gate extern void sonca_init(void); 6977c478bd9Sstevel@tonic-gate extern struct sonode *sonca_create(vnode_t *, int, int, int, int, 6987c478bd9Sstevel@tonic-gate struct sonode *, int *); 6997c478bd9Sstevel@tonic-gate 7007c478bd9Sstevel@tonic-gate /* 7017c478bd9Sstevel@tonic-gate * sockfs functions 7027c478bd9Sstevel@tonic-gate */ 7037c478bd9Sstevel@tonic-gate extern int sock_getmsg(vnode_t *, struct strbuf *, struct strbuf *, 7047c478bd9Sstevel@tonic-gate uchar_t *, int *, int, rval_t *); 7057c478bd9Sstevel@tonic-gate extern int sock_putmsg(vnode_t *, struct strbuf *, struct strbuf *, 7067c478bd9Sstevel@tonic-gate uchar_t, int, int); 7077c478bd9Sstevel@tonic-gate struct sonode *sotpi_create(vnode_t *, int, int, int, int, struct sonode *, 7087c478bd9Sstevel@tonic-gate int *); 7097c478bd9Sstevel@tonic-gate extern int socktpi_open(struct vnode **, int, struct cred *); 7107c478bd9Sstevel@tonic-gate extern int so_sock2stream(struct sonode *); 7117c478bd9Sstevel@tonic-gate extern void so_stream2sock(struct sonode *); 7127c478bd9Sstevel@tonic-gate extern int sockinit(int, char *); 7137c478bd9Sstevel@tonic-gate extern struct vnode 7147c478bd9Sstevel@tonic-gate *makesockvp(struct vnode *, int, int, int); 7157c478bd9Sstevel@tonic-gate extern void sockfree(struct sonode *); 7167c478bd9Sstevel@tonic-gate extern void so_update_attrs(struct sonode *, int); 7177c478bd9Sstevel@tonic-gate extern int soconfig(int, int, int, char *, int); 7187c478bd9Sstevel@tonic-gate extern struct vnode 7197c478bd9Sstevel@tonic-gate *solookup(int, int, int, char *, int *); 7207c478bd9Sstevel@tonic-gate extern void so_lock_single(struct sonode *); 7217c478bd9Sstevel@tonic-gate extern void so_unlock_single(struct sonode *, int); 7227c478bd9Sstevel@tonic-gate extern int so_lock_read(struct sonode *, int); 7237c478bd9Sstevel@tonic-gate extern int so_lock_read_intr(struct sonode *, int); 7247c478bd9Sstevel@tonic-gate extern void so_unlock_read(struct sonode *); 7257c478bd9Sstevel@tonic-gate extern void *sogetoff(mblk_t *, t_uscalar_t, t_uscalar_t, uint_t); 7267c478bd9Sstevel@tonic-gate extern void so_getopt_srcaddr(void *, t_uscalar_t, 7277c478bd9Sstevel@tonic-gate void **, t_uscalar_t *); 7287c478bd9Sstevel@tonic-gate extern int so_getopt_unix_close(void *, t_uscalar_t); 7297c478bd9Sstevel@tonic-gate extern int so_addr_verify(struct sonode *, const struct sockaddr *, 7307c478bd9Sstevel@tonic-gate socklen_t); 7317c478bd9Sstevel@tonic-gate extern int so_ux_addr_xlate(struct sonode *, struct sockaddr *, 7327c478bd9Sstevel@tonic-gate socklen_t, int, void **, socklen_t *); 7337c478bd9Sstevel@tonic-gate extern void fdbuf_free(struct fdbuf *); 7347c478bd9Sstevel@tonic-gate extern mblk_t *fdbuf_allocmsg(int, struct fdbuf *); 7357c478bd9Sstevel@tonic-gate extern int fdbuf_create(void *, int, struct fdbuf **); 7367c478bd9Sstevel@tonic-gate extern void so_closefds(void *, t_uscalar_t, int, int); 7377c478bd9Sstevel@tonic-gate extern int so_getfdopt(void *, t_uscalar_t, int, void **, int *); 7387c478bd9Sstevel@tonic-gate t_uscalar_t so_optlen(void *, t_uscalar_t, int); 7397c478bd9Sstevel@tonic-gate extern void so_cmsg2opt(void *, t_uscalar_t, int, mblk_t *); 7407c478bd9Sstevel@tonic-gate extern t_uscalar_t 7417c478bd9Sstevel@tonic-gate so_cmsglen(mblk_t *, void *, t_uscalar_t, int); 7427c478bd9Sstevel@tonic-gate extern int so_opt2cmsg(mblk_t *, void *, t_uscalar_t, int, 7437c478bd9Sstevel@tonic-gate void *, t_uscalar_t); 7447c478bd9Sstevel@tonic-gate extern void soisconnecting(struct sonode *); 7457c478bd9Sstevel@tonic-gate extern void soisconnected(struct sonode *); 7467c478bd9Sstevel@tonic-gate extern void soisdisconnected(struct sonode *, int); 7477c478bd9Sstevel@tonic-gate extern void socantsendmore(struct sonode *); 7487c478bd9Sstevel@tonic-gate extern void socantrcvmore(struct sonode *); 7497c478bd9Sstevel@tonic-gate extern void soseterror(struct sonode *, int); 7507c478bd9Sstevel@tonic-gate extern int sogeterr(struct sonode *); 7517c478bd9Sstevel@tonic-gate extern int sogetrderr(vnode_t *, int, int *); 7527c478bd9Sstevel@tonic-gate extern int sogetwrerr(vnode_t *, int, int *); 7537c478bd9Sstevel@tonic-gate extern void so_unix_close(struct sonode *); 7547c478bd9Sstevel@tonic-gate extern mblk_t *soallocproto(size_t, int); 7557c478bd9Sstevel@tonic-gate extern mblk_t *soallocproto1(const void *, ssize_t, ssize_t, int); 7567c478bd9Sstevel@tonic-gate extern void soappendmsg(mblk_t *, const void *, ssize_t); 7577c478bd9Sstevel@tonic-gate extern mblk_t *soallocproto2(const void *, ssize_t, const void *, ssize_t, 7587c478bd9Sstevel@tonic-gate ssize_t, int); 7597c478bd9Sstevel@tonic-gate extern mblk_t *soallocproto3(const void *, ssize_t, const void *, ssize_t, 7607c478bd9Sstevel@tonic-gate const void *, ssize_t, ssize_t, int); 7617c478bd9Sstevel@tonic-gate extern int sowaitprim(struct sonode *, t_scalar_t, t_scalar_t, 7627c478bd9Sstevel@tonic-gate t_uscalar_t, mblk_t **, clock_t); 7637c478bd9Sstevel@tonic-gate extern int sowaitokack(struct sonode *, t_scalar_t); 7647c478bd9Sstevel@tonic-gate extern int sowaitack(struct sonode *, mblk_t **, clock_t); 7657c478bd9Sstevel@tonic-gate extern void soqueueack(struct sonode *, mblk_t *); 7667c478bd9Sstevel@tonic-gate extern int sowaitconnind(struct sonode *, int, mblk_t **); 7677c478bd9Sstevel@tonic-gate extern void soqueueconnind(struct sonode *, mblk_t *); 7687c478bd9Sstevel@tonic-gate extern int soflushconnind(struct sonode *, t_scalar_t); 7697c478bd9Sstevel@tonic-gate extern void so_drain_discon_ind(struct sonode *); 7707c478bd9Sstevel@tonic-gate extern void so_flush_discon_ind(struct sonode *); 7717c478bd9Sstevel@tonic-gate extern int sowaitconnected(struct sonode *, int, int); 7727c478bd9Sstevel@tonic-gate 773*ff550d0eSmasputra extern int sostream_direct(struct sonode *, struct uio *, 774*ff550d0eSmasputra mblk_t *, cred_t *); 7757c478bd9Sstevel@tonic-gate extern int sosend_dgram(struct sonode *, struct sockaddr *, 7767c478bd9Sstevel@tonic-gate socklen_t, struct uio *, int); 7777c478bd9Sstevel@tonic-gate extern int sosend_svc(struct sonode *, struct uio *, t_scalar_t, int, int); 7787c478bd9Sstevel@tonic-gate extern void so_installhooks(struct sonode *); 7797c478bd9Sstevel@tonic-gate extern int so_strinit(struct sonode *, struct sonode *); 7807c478bd9Sstevel@tonic-gate extern int sotpi_recvmsg(struct sonode *, struct nmsghdr *, 7817c478bd9Sstevel@tonic-gate struct uio *); 7827c478bd9Sstevel@tonic-gate extern int sotpi_getpeername(struct sonode *); 7837c478bd9Sstevel@tonic-gate extern int sotpi_getsockopt(struct sonode *, int, int, void *, 7847c478bd9Sstevel@tonic-gate socklen_t *, int); 7857c478bd9Sstevel@tonic-gate extern int sotpi_setsockopt(struct sonode *, int, int, const void *, 7867c478bd9Sstevel@tonic-gate socklen_t); 7877c478bd9Sstevel@tonic-gate extern int socktpi_ioctl(struct vnode *, int, intptr_t, int, 7887c478bd9Sstevel@tonic-gate struct cred *, int *); 7897c478bd9Sstevel@tonic-gate extern int sodisconnect(struct sonode *, t_scalar_t, int); 7907c478bd9Sstevel@tonic-gate extern ssize_t soreadfile(file_t *, uchar_t *, u_offset_t, int *, size_t); 7917c478bd9Sstevel@tonic-gate extern int so_set_asyncsigs(vnode_t *, pid_t, int, int, cred_t *); 7927c478bd9Sstevel@tonic-gate extern int so_set_events(struct sonode *, vnode_t *, cred_t *); 7937c478bd9Sstevel@tonic-gate extern int so_flip_async(struct sonode *, vnode_t *, int, cred_t *); 7947c478bd9Sstevel@tonic-gate extern int so_set_siggrp(struct sonode *, vnode_t *, pid_t, int, cred_t *); 7957c478bd9Sstevel@tonic-gate extern void *sock_kstat_init(zoneid_t); 7967c478bd9Sstevel@tonic-gate extern void sock_kstat_fini(zoneid_t, void *); 7977c478bd9Sstevel@tonic-gate 7987c478bd9Sstevel@tonic-gate /* 7997c478bd9Sstevel@tonic-gate * Function wrappers (mostly arround the sonode switch) for 8007c478bd9Sstevel@tonic-gate * backward compatibility. 8017c478bd9Sstevel@tonic-gate */ 8027c478bd9Sstevel@tonic-gate extern int soaccept(struct sonode *, int, struct sonode **); 8037c478bd9Sstevel@tonic-gate extern int sobind(struct sonode *, struct sockaddr *, socklen_t, 8047c478bd9Sstevel@tonic-gate int, int); 8057c478bd9Sstevel@tonic-gate extern int solisten(struct sonode *, int); 8067c478bd9Sstevel@tonic-gate extern int soconnect(struct sonode *, const struct sockaddr *, socklen_t, 8077c478bd9Sstevel@tonic-gate int, int); 8087c478bd9Sstevel@tonic-gate extern int sorecvmsg(struct sonode *, struct nmsghdr *, struct uio *); 8097c478bd9Sstevel@tonic-gate extern int sosendmsg(struct sonode *, struct nmsghdr *, struct uio *); 8107c478bd9Sstevel@tonic-gate extern int sogetpeername(struct sonode *); 8117c478bd9Sstevel@tonic-gate extern int sogetsockname(struct sonode *); 8127c478bd9Sstevel@tonic-gate extern int soshutdown(struct sonode *, int); 8137c478bd9Sstevel@tonic-gate extern int sogetsockopt(struct sonode *, int, int, void *, socklen_t *, 8147c478bd9Sstevel@tonic-gate int); 8157c478bd9Sstevel@tonic-gate extern int sosetsockopt(struct sonode *, int, int, const void *, 8167c478bd9Sstevel@tonic-gate t_uscalar_t); 8177c478bd9Sstevel@tonic-gate 8187c478bd9Sstevel@tonic-gate extern struct sonode *socreate(vnode_t *, int, int, int, int, 8197c478bd9Sstevel@tonic-gate struct sonode *, int *); 8207c478bd9Sstevel@tonic-gate 8217c478bd9Sstevel@tonic-gate extern int so_copyin(const void *, void *, size_t, int); 8227c478bd9Sstevel@tonic-gate extern int so_copyout(const void *, void *, size_t, int); 8237c478bd9Sstevel@tonic-gate 8247c478bd9Sstevel@tonic-gate extern int socktpi_access(struct vnode *, int, int, struct cred *); 8257c478bd9Sstevel@tonic-gate extern int socktpi_fid(struct vnode *, struct fid *); 8267c478bd9Sstevel@tonic-gate extern int socktpi_fsync(struct vnode *, int, struct cred *); 8277c478bd9Sstevel@tonic-gate extern int socktpi_getattr(struct vnode *, struct vattr *, int, 8287c478bd9Sstevel@tonic-gate struct cred *); 8297c478bd9Sstevel@tonic-gate extern int socktpi_seek(struct vnode *, offset_t, offset_t *); 8307c478bd9Sstevel@tonic-gate extern int socktpi_setattr(struct vnode *, struct vattr *, int, 8317c478bd9Sstevel@tonic-gate struct cred *, caller_context_t *); 8327c478bd9Sstevel@tonic-gate extern int socktpi_setfl(vnode_t *, int, int, cred_t *); 8337c478bd9Sstevel@tonic-gate 8347c478bd9Sstevel@tonic-gate /* SCTP sockfs */ 8357c478bd9Sstevel@tonic-gate extern struct sonode *sosctp_create(vnode_t *, int, int, int, int, 8367c478bd9Sstevel@tonic-gate struct sonode *, int *); 8377c478bd9Sstevel@tonic-gate extern int sosctp_init(void); 8387c478bd9Sstevel@tonic-gate 8397c478bd9Sstevel@tonic-gate #endif 8407c478bd9Sstevel@tonic-gate 8417c478bd9Sstevel@tonic-gate /* 8427c478bd9Sstevel@tonic-gate * Internal structure for obtaining sonode information from the socklist. 8437c478bd9Sstevel@tonic-gate * These types match those corresponding in the sonode structure. 8447c478bd9Sstevel@tonic-gate * This is not a published interface, and may change at any time. 8457c478bd9Sstevel@tonic-gate */ 8467c478bd9Sstevel@tonic-gate struct sockinfo { 8477c478bd9Sstevel@tonic-gate uint_t si_size; /* real length of this struct */ 8487c478bd9Sstevel@tonic-gate short si_family; 8497c478bd9Sstevel@tonic-gate short si_type; 8507c478bd9Sstevel@tonic-gate ushort_t si_flag; 8517c478bd9Sstevel@tonic-gate uint_t si_state; 8527c478bd9Sstevel@tonic-gate uint_t si_ux_laddr_sou_magic; 8537c478bd9Sstevel@tonic-gate uint_t si_ux_faddr_sou_magic; 8547c478bd9Sstevel@tonic-gate t_scalar_t si_serv_type; 8557c478bd9Sstevel@tonic-gate t_uscalar_t si_laddr_soa_len; 8567c478bd9Sstevel@tonic-gate t_uscalar_t si_faddr_soa_len; 8577c478bd9Sstevel@tonic-gate uint16_t si_laddr_family; 8587c478bd9Sstevel@tonic-gate uint16_t si_faddr_family; 8597c478bd9Sstevel@tonic-gate char si_laddr_sun_path[MAXPATHLEN + 1]; /* NULL terminated */ 8607c478bd9Sstevel@tonic-gate char si_faddr_sun_path[MAXPATHLEN + 1]; 8617c478bd9Sstevel@tonic-gate zoneid_t si_szoneid; 8627c478bd9Sstevel@tonic-gate }; 8637c478bd9Sstevel@tonic-gate 8647c478bd9Sstevel@tonic-gate 8657c478bd9Sstevel@tonic-gate #ifdef __cplusplus 8667c478bd9Sstevel@tonic-gate } 8677c478bd9Sstevel@tonic-gate #endif 8687c478bd9Sstevel@tonic-gate 8697c478bd9Sstevel@tonic-gate #endif /* _SYS_SOCKETVAR_H */ 870