/* hook into the front of the list */
#define DLIST_ADD(list, p) \
+{ \
if (!(list)) { \
(list) = (p); \
(p)->next = (p)->prev = NULL; \
(p)->next = (list); \
(p)->prev = NULL; \
(list) = (p); \
- }
+ }\
+}
/* remove an element from a list */
#define DLIST_REMOVE(list, p) \
+{ \
if ((p) == (list)) { \
(list) = (p)->next; \
if (list) (list)->prev = NULL; \
} else { \
(p)->prev->next = (p)->next; \
if ((p)->next) (p)->next->prev = (p)->prev; \
- }
+ } \
+}
/* promote an element to the top of the list */
#define DLIST_PROMOTE(list, p) \
pipes_struct *p;
static int next_pipe;
+ DEBUG(4,("Open pipe requested %s (pipes_open=%d)\n",
+ pipe_name, pipes_open));
+
/* not repeating pipe numbers makes it easier to track things in
log files and prevents client bugs where pipe numbers are reused
over connection restarts */
next_pipe = (i+1) % MAX_OPEN_PIPES;
+ for (p = Pipes; p; p = p->next)
+ {
+ DEBUG(5,("open pipes: name %s pnum=%x\n", p->name, p->pnum));
+ }
+
p = (pipes_struct *)malloc(sizeof(*p));
if (!p) return NULL;
+ ZERO_STRUCTP(p);
DLIST_ADD(Pipes, p);
bitmap_set(bmap, i);
pipes_open++;
- ZERO_STRUCTP(p);
p->pnum = i;
p->open = True;
chain_p = p;
- return p;
+ /* OVERWRITE p as a temp variable, to display all open pipes */
+ for (p = Pipes; p; p = p->next)
+ {
+ DEBUG(5,("open pipes: name %s pnum=%x\n", p->name, p->pnum));
+ }
+
+ return chain_p;
}
{
pipes_struct *p;
- for (p=Pipes;p;p=p->next) {
- if (p->pnum == pnum) {
+ DEBUG(4,("search for pipe pnum=%x\n", pnum));
+
+ for (p=Pipes;p;p=p->next)
+ {
+ DEBUG(5,("pipe name %s pnum=%x (pipes_open=%d)\n",
+ p->name, p->pnum, pipes_open));
+ }
+
+ for (p=Pipes;p;p=p->next)
+ {
+ if (p->pnum == pnum)
+ {
chain_p = p;
return p;
}