1 /* 2 * UNIX An implementation of the AF_UNIX network domain for the 3 * LINUX operating system. UNIX is implemented using the 4 * BSD Socket interface as the means of communication with 5 * the user level. 6 * 7 * This file descibes some things of the UNIX protocol family 8 * module. It is mainly used for the "proc" sub-module now, 9 * but it may be useful for cleaning up the UNIX module as a 10 * whole later. 11 * 12 * Version: @(#)unix.h 1.0.3 05/25/93 13 * 14 * Authors: Orest Zborowski, <obz@Kodak.COM> 15 * Ross Biro, <bir7@leland.Stanford.Edu> 16 * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> 17 * 18 * This program is free software; you can redistribute it and/or 19 * modify it under the terms of the GNU General Public License 20 * as published by the Free Software Foundation; either version 21 * 2 of the License, or (at your option) any later version. 22 */ 23 24 25 #define AF_UNIX_MAJOR 17 /* UNIX VFS major number */ 26 27 28 #ifdef _LINUX_UN_H 29 30 31 struct unix_proto_data { 32 int refcnt; /* cnt of reference 0=free */ 33 struct socket *socket; /* socket we're bound to */ 34 int protocol; 35 struct sockaddr_un sockaddr_un; 36 short sockaddr_len; /* >0 if name bound */ 37 char *buf; 38 int bp_head, bp_tail; 39 struct inode *inode; 40 struct unix_proto_data *peerupd; 41 }; 42 43 extern struct unix_proto_data unix_datas[NSOCKETS]; 44 45 46 #define last_unix_data (unix_datas + NSOCKETS - 1) 47 48 49 #define UN_DATA(SOCK) ((struct unix_proto_data *)(SOCK)->data) 50 #define UN_PATH_OFFSET ((unsigned long)((struct sockaddr_un *)0) \ 51 ->sun_path) 52 53 /* 54 * Buffer size must be power of 2. buffer mgmt inspired by pipe code. 55 * note that buffer contents can wraparound, and we can write one byte less 56 * than full size to discern full vs empty. 57 */ 58 #define BUF_SIZE PAGE_SIZE 59 #define UN_BUF_AVAIL(UPD) (((UPD)->bp_head - (UPD)->bp_tail) & \ 60 (BUF_SIZE-1)) 61 #define UN_BUF_SPACE(UPD) ((BUF_SIZE-1) - UN_BUF_AVAIL(UPD)) 62 63 #endif /* _LINUX_UN_H */ 64 65 66 extern void unix_proto_init(struct ddi_proto *pro);