diff options
-rw-r--r-- | include/queue.h | 6 | ||||
-rw-r--r-- | src/queue.c | 5 | ||||
-rw-r--r-- | src/sync-ftfw.c | 2 | ||||
-rw-r--r-- | src/sync-mode.c | 2 |
4 files changed, 11 insertions, 4 deletions
diff --git a/include/queue.h b/include/queue.h index 9213b3d..89b00a8 100644 --- a/include/queue.h +++ b/include/queue.h @@ -29,17 +29,21 @@ void queue_object_free(struct queue_object *obj); struct evfd; +#define QUEUE_NAMELEN 16 + struct queue { unsigned int max_elems; unsigned int num_elems; uint32_t flags; struct list_head head; struct evfd *evfd; + char name[QUEUE_NAMELEN]; }; #define QUEUE_F_EVFD (1U << 0) -struct queue *queue_create(int max_objects, unsigned int flags); +struct queue *queue_create(const char *name, + int max_objects, unsigned int flags); void queue_destroy(struct queue *b); unsigned int queue_len(const struct queue *b); int queue_add(struct queue *b, struct queue_node *n); diff --git a/src/queue.c b/src/queue.c index 7b36dc6..e5dc307 100644 --- a/src/queue.c +++ b/src/queue.c @@ -23,7 +23,8 @@ #include <stdlib.h> #include <string.h> -struct queue *queue_create(int max_objects, unsigned int flags) +struct queue * +queue_create(const char *name, int max_objects, unsigned int flags) { struct queue *b; @@ -42,6 +43,8 @@ struct queue *queue_create(int max_objects, unsigned int flags) return NULL; } } + strncpy(b->name, name, QUEUE_NAMELEN); + b->name[QUEUE_NAMELEN-1]='\0'; return b; } diff --git a/src/sync-ftfw.c b/src/sync-ftfw.c index e7c9af2..bf9f4f7 100644 --- a/src/sync-ftfw.c +++ b/src/sync-ftfw.c @@ -143,7 +143,7 @@ static void do_alive_alarm(struct alarm_block *a, void *data) static int ftfw_init(void) { - rs_queue = queue_create(CONFIG(resend_queue_size), 0); + rs_queue = queue_create("rsqueue", CONFIG(resend_queue_size), 0); if (rs_queue == NULL) { dlog(LOG_ERR, "cannot create rs queue"); return -1; diff --git a/src/sync-mode.c b/src/sync-mode.c index dca6eee..308c08b 100644 --- a/src/sync-mode.c +++ b/src/sync-mode.c @@ -289,7 +289,7 @@ static int init_sync(void) if (register_fd(nlif_fd(STATE_SYNC(interface)), STATE(fds)) == -1) return -1; - STATE_SYNC(tx_queue) = queue_create(INT_MAX, QUEUE_F_EVFD); + STATE_SYNC(tx_queue) = queue_create("txqueue", INT_MAX, QUEUE_F_EVFD); if (STATE_SYNC(tx_queue) == NULL) { dlog(LOG_ERR, "cannot create tx queue"); return -1; |