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 describes 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  * Fixes:
  19  *              Dmitry Gorodchanin      -       proc locking
  20  *
  21  *              This program is free software; you can redistribute it and/or
  22  *              modify it under the terms of the GNU General Public License
  23  *              as published by the Free Software Foundation; either version
  24  *              2 of the License, or (at your option) any later version.
  25  */
  26 
  27 
  28 #ifdef _LINUX_UN_H
  29 
  30 
  31 struct unix_proto_data {
  32         int             refcnt;         /* cnt of reference 0=free      */
  33                                         /* -1=not initialised   -bgm    */
  34         struct socket   *socket;        /* socket we're bound to        */
  35         int             protocol;
  36         struct sockaddr_un      sockaddr_un;
  37         short           sockaddr_len;   /* >0 if name bound             */
  38         char            *buf;
  39         int             bp_head, bp_tail;
  40         struct inode    *inode;
  41         struct unix_proto_data  *peerupd;
  42         struct wait_queue *wait;        /* Lock across page faults (FvK) */
  43         int             lock_flag;
  44 };
  45 
  46 extern struct unix_proto_data unix_datas[NSOCKETS];
  47 
  48 
  49 #define last_unix_data          (unix_datas + NSOCKETS - 1)
  50 
  51 
  52 #define UN_DATA(SOCK)           ((struct unix_proto_data *)(SOCK)->data)
  53 #define UN_PATH_OFFSET          ((unsigned long)((struct sockaddr_un *)0) \
  54                                                         ->sun_path)
  55 
  56 /*
  57  * Buffer size must be power of 2. buffer mgmt inspired by pipe code.
  58  * note that buffer contents can wraparound, and we can write one byte less
  59  * than full size to discern full vs empty.
  60  */
  61 #define BUF_SIZE                PAGE_SIZE
  62 #define UN_BUF_AVAIL(UPD)       (((UPD)->bp_head - (UPD)->bp_tail) & \
  63                                                                 (BUF_SIZE-1))
  64 #define UN_BUF_SPACE(UPD)       ((BUF_SIZE-1) - UN_BUF_AVAIL(UPD))
  65 
  66 #endif  /* _LINUX_UN_H */
  67 
  68 
  69 extern void     unix_proto_init(struct net_proto *pro);

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