summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/queue.h1
-rw-r--r--src/queue.c7
2 files changed, 6 insertions, 2 deletions
diff --git a/include/queue.h b/include/queue.h
index d989402..cca9cba 100644
--- a/include/queue.h
+++ b/include/queue.h
@@ -35,6 +35,7 @@ struct queue {
struct list_head list;
unsigned int max_elems;
unsigned int num_elems;
+ uint32_t enospc_err;
uint32_t flags;
struct list_head head;
struct evfd *evfd;
diff --git a/src/queue.c b/src/queue.c
index 465f47c..76425b1 100644
--- a/src/queue.c
+++ b/src/queue.c
@@ -77,10 +77,12 @@ void queue_stats_show(int fd)
size += snprintf(buf+size, sizeof(buf),
"queue %s:\n"
"current elements:\t\t%12u\n"
- "maximum elements:\t\t%12u\n\n",
+ "maximum elements:\t\t%12u\n"
+ "not enough space errors:\t%12u\n\n",
this->name,
this->num_elems,
- this->max_elems);
+ this->max_elems,
+ this->enospc_err);
}
send(fd, buf, size, 0);
}
@@ -123,6 +125,7 @@ int queue_add(struct queue *b, struct queue_node *n)
return 0;
if (b->num_elems >= b->max_elems) {
+ b->enospc_err++;
errno = ENOSPC;
return -1;
}