The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/servers/inet/mq.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2 inet/mq.c
    3 
    4 Created:        Jan 3, 1992 by Philip Homburg
    5 
    6 Copyright 1995 Philip Homburg
    7 */
    8 
    9 #include "inet.h"
   10 #include "mq.h"
   11 #include "generic/assert.h"
   12 
   13 THIS_FILE
   14 
   15 #define MQ_SIZE         128
   16 
   17 PRIVATE mq_t mq_list[MQ_SIZE];
   18 PRIVATE mq_t *mq_freelist;
   19 
   20 void mq_init()
   21 {
   22         int i;
   23 
   24         mq_freelist= NULL;
   25         for (i= 0; i<MQ_SIZE; i++)
   26         {
   27                 mq_list[i].mq_next= mq_freelist;
   28                 mq_freelist= &mq_list[i];
   29                 mq_list[i].mq_allocated= 0;
   30         }
   31 }
   32 
   33 mq_t *mq_get()
   34 {
   35         mq_t *mq;
   36 
   37         mq= mq_freelist;
   38         assert(mq != NULL);
   39 
   40         mq_freelist= mq->mq_next;
   41         mq->mq_next= NULL;
   42         assert(mq->mq_allocated == 0);
   43         mq->mq_allocated= 1;
   44         return mq;
   45 }
   46 
   47 void mq_free(mq)
   48 mq_t *mq;
   49 {
   50         mq->mq_next= mq_freelist;
   51         mq_freelist= mq;
   52         assert(mq->mq_allocated == 1);
   53         mq->mq_allocated= 0;
   54 }
   55 
   56 /*
   57  * $PchId: mq.c,v 1.7 1998/10/23 20:10:47 philip Exp $
   58  */

Cache object: 6d70c49a70b45c2059788c07360e6817


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.