summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bind/lib/isc/task.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/bind/lib/isc/task.c')
-rw-r--r--usr.sbin/bind/lib/isc/task.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/usr.sbin/bind/lib/isc/task.c b/usr.sbin/bind/lib/isc/task.c
index 44da80c6771..3c3c095fd9e 100644
--- a/usr.sbin/bind/lib/isc/task.c
+++ b/usr.sbin/bind/lib/isc/task.c
@@ -1,6 +1,5 @@
/*
- * Copyright (C) 2004-2015, 2017 Internet Systems Consortium, Inc. ("ISC")
- * Copyright (C) 1998-2003 Internet Software Consortium.
+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -707,6 +706,7 @@ isc__task_purgerange(isc_task_t *task0, void *sender, isc_eventtype_t first,
for (event = HEAD(events); event != NULL; event = next_event) {
next_event = NEXT(event, ev_link);
+ ISC_LIST_UNLINK(events, event, ev_link);
isc_event_free(&event);
}
@@ -886,8 +886,7 @@ isc__task_setname(isc_task_t *task0, const char *name, void *tag) {
REQUIRE(VALID_TASK(task));
LOCK(&task->lock);
- memset(task->name, 0, sizeof(task->name));
- strncpy(task->name, name, sizeof(task->name) - 1);
+ strlcpy(task->name, name, sizeof(task->name));
task->tag = tag;
UNLOCK(&task->lock);
}
@@ -1438,6 +1437,10 @@ isc__taskmgr_create(isc_mem_t *mctx, unsigned int workers,
if (isc_thread_create(run, manager,
&manager->threads[manager->workers]) ==
ISC_R_SUCCESS) {
+ char name[16]; /* thread name limit on Linux */
+ snprintf(name, sizeof(name), "isc-worker%04u", i);
+ isc_thread_setname(manager->threads[manager->workers],
+ name);
manager->workers++;
started++;
}
@@ -1960,7 +1963,7 @@ isc_taskmgr_renderjson(isc_taskmgr_t *mgr0, json_object *tasks) {
CHECKMEM(taskobj);
json_object_array_add(array, taskobj);
- sprintf(buf, "%p", task);
+ snprintf(buf, sizeof(buf), "%p", task);
obj = json_object_new_string(buf);
CHECKMEM(obj);
json_object_object_add(taskobj, "id", obj);