root/net/unix/unix.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   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 #ifdef _LINUX_UN_H
  26 
  27 
  28 struct unix_proto_data {
  29         int             refcnt;         /* cnt of reference 0=free      */
  30         struct socket   *socket;        /* socket we're bound to        */
  31         int             protocol;
  32         struct sockaddr_un      sockaddr_un;
  33         short           sockaddr_len;   /* >0 if name bound             */
  34         char            *buf;
  35         int             bp_head, bp_tail;
  36         struct inode    *inode;
  37         struct unix_proto_data  *peerupd;
  38         struct wait_queue *wait;        /* Lock across page faults (FvK) */
  39         int             lock_flag;
  40 };
  41 
  42 extern struct unix_proto_data unix_datas[NSOCKETS];
  43 
  44 
  45 #define last_unix_data          (unix_datas + NSOCKETS - 1)
  46 
  47 
  48 #define UN_DATA(SOCK)           ((struct unix_proto_data *)(SOCK)->data)
  49 #define UN_PATH_OFFSET          ((unsigned long)((struct sockaddr_un *)0) \
  50                                                         ->sun_path)
  51 
  52 /*
  53  * Buffer size must be power of 2. buffer mgmt inspired by pipe code.
  54  * note that buffer contents can wraparound, and we can write one byte less
  55  * than full size to discern full vs empty.
  56  */
  57 #define BUF_SIZE                PAGE_SIZE
  58 #define UN_BUF_AVAIL(UPD)       (((UPD)->bp_head - (UPD)->bp_tail) & \
  59                                                                 (BUF_SIZE-1))
  60 #define UN_BUF_SPACE(UPD)       ((BUF_SIZE-1) - UN_BUF_AVAIL(UPD))
  61 
  62 #endif  /* _LINUX_UN_H */
  63 
  64 
  65 extern void     unix_proto_init(struct ddi_proto *pro);

/* [previous][next][first][last][top][bottom][index][help] */