/[hurd]/hurd/pflocal/connq.c
ViewVC logotype

Diff of /hurd/pflocal/connq.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.14 by marcus, Tue Feb 20 19:35:52 2001 UTC revision 1.15 by roland, Sat Dec 22 21:00:37 2001 UTC
# Line 1  Line 1 
1  /* Listen queue functions  /* Listen queue functions
2    
3     Copyright (C) 1995, 1996 Free Software Foundation, Inc.     Copyright (C) 1995,96,2001 Free Software Foundation, Inc.
4    
5     Written by Miles Bader <miles@gnu.ai.mit.edu>     Written by Miles Bader <miles@gnu.org>
6    
7     This program is free software; you can redistribute it and/or     This program is free software; you can redistribute it and/or
8     modify it under the terms of the GNU General Public License as     modify it under the terms of the GNU General Public License as
# Line 132  connq_destroy (struct connq *cq) Line 132  connq_destroy (struct connq *cq)
132     to allow the requesting thread to continue.  If NOBLOCK is true,     to allow the requesting thread to continue.  If NOBLOCK is true,
133     EWOULDBLOCK is returned when there are no immediate connections     EWOULDBLOCK is returned when there are no immediate connections
134     available. */     available. */
135  error_t  error_t
136  connq_listen (struct connq *cq, int noblock,  connq_listen (struct connq *cq, int noblock,
137                struct connq_request **req, struct sock **sock)                struct connq_request **req, struct sock **sock)
138  {  {
# Line 140  connq_listen (struct connq *cq, int nobl Line 140  connq_listen (struct connq *cq, int nobl
140    
141    if (noblock && cq->head == cq->tail)    if (noblock && cq->head == cq->tail)
142      {      {
143        mutex_unlock (&cq->lock);          mutex_unlock (&cq->lock);
144        return EWOULDBLOCK;        return EWOULDBLOCK;
145      }      }
146    
# Line 150  connq_listen (struct connq *cq, int nobl Line 150  connq_listen (struct connq *cq, int nobl
150      if (hurd_condition_wait (&cq->listeners, &cq->lock))      if (hurd_condition_wait (&cq->listeners, &cq->lock))
151        {        {
152          cq->num_listeners--;          cq->num_listeners--;
153          mutex_unlock (&cq->lock);                  mutex_unlock (&cq->lock);
154          return EINTR;          return EINTR;
155        }        }
156    
# Line 167  connq_listen (struct connq *cq, int nobl Line 167  connq_listen (struct connq *cq, int nobl
167    
168    mutex_unlock (&cq->lock);    mutex_unlock (&cq->lock);
169    
170    return 0;        return 0;
171  }  }
172    
173  /* Return the error code ERR to the thread that made the listen request REQ,  /* Return the error code ERR to the thread that made the listen request REQ,
# Line 229  connq_connect (struct connq *cq, int nob Line 229  connq_connect (struct connq *cq, int nob
229    return err;    return err;
230  }  }
231    
232    #if 0
233  /* `Compresses' CQ, by removing any NULL entries.  CQ should be locked.  */  /* `Compresses' CQ, by removing any NULL entries.  CQ should be locked.  */
234  static void  static void
235  connq_compress (struct connq *cq)  connq_compress (struct connq *cq)
# Line 249  connq_compress (struct connq *cq) Line 250  connq_compress (struct connq *cq)
250    /* Move back tail to only include what we kept in the queue.  */    /* Move back tail to only include what we kept in the queue.  */
251    cq->tail = comp_tail;    cq->tail = comp_tail;
252  }  }
253    #endif
254    
255  /* Set CQ's queue length to LENGTH.  Any sockets already waiting for a  /* Set CQ's queue length to LENGTH.  Any sockets already waiting for a
256     connections that are past the new length will fail with ECONNREFUSED.  */     connections that are past the new length will fail with ECONNREFUSED.  */
257  error_t  error_t
258  connq_set_length (struct connq *cq, int length)  connq_set_length (struct connq *cq, int length)
259  {  {
260    mutex_lock (&cq->lock);    mutex_lock (&cq->lock);

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26