Print this page
8158 Want named threads API
9857 proc manpages should have LIBRARY section
*** 19,29 ****
* CDDL HEADER END
*/
/*
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
! * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
/*
* restarter.c - service manipulation
*
--- 19,29 ----
* CDDL HEADER END
*/
/*
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
! * Copyright 2018 Joyent, Inc.
*/
/*
* restarter.c - service manipulation
*
*** 992,1001 ****
--- 992,1003 ----
restarter_post_fsminimal_thread(void *unused)
{
scf_handle_t *h;
int r;
+ (void) pthread_setname_np(pthread_self(), "restarter_post_fsmin");
+
h = libscf_handle_create_bound_loop();
for (;;) {
r = libscf_create_self(h);
if (r == 0)
*** 1769,1778 ****
--- 1771,1782 ----
restarter_instance_qentry_t *event;
restarter_inst_t *rip;
char *fmri = (char *)arg;
struct timespec to;
+ (void) pthread_setname_np(pthread_self(), "restarter_process_events");
+
assert(fmri != NULL);
h = libscf_handle_create_bound_loop();
/* grab the queue lock */
*** 1937,1948 ****
free(fmri);
return (NULL);
}
static int
! is_admin_event(restarter_event_type_t t) {
!
switch (t) {
case RESTARTER_EVENT_TYPE_ADMIN_MAINT_ON:
case RESTARTER_EVENT_TYPE_ADMIN_MAINT_ON_IMMEDIATE:
case RESTARTER_EVENT_TYPE_ADMIN_MAINT_OFF:
case RESTARTER_EVENT_TYPE_ADMIN_REFRESH:
--- 1941,1952 ----
free(fmri);
return (NULL);
}
static int
! is_admin_event(restarter_event_type_t t)
! {
switch (t) {
case RESTARTER_EVENT_TYPE_ADMIN_MAINT_ON:
case RESTARTER_EVENT_TYPE_ADMIN_MAINT_ON_IMMEDIATE:
case RESTARTER_EVENT_TYPE_ADMIN_MAINT_OFF:
case RESTARTER_EVENT_TYPE_ADMIN_REFRESH:
*** 1983,1992 ****
--- 1987,1998 ----
static void *
restarter_event_thread(void *unused)
{
scf_handle_t *h;
+ (void) pthread_setname_np(pthread_self(), "restarter_event");
+
/*
* This is a new thread, and thus, gets its own handle
* to the repository.
*/
h = libscf_handle_create_bound_loop();
*** 2194,2203 ****
--- 2200,2211 ----
restarter_contracts_event_thread(void *unused)
{
int fd, err;
scf_handle_t *local_handle;
+ (void) pthread_setname_np(pthread_self(), "restarter_contracts_event");
+
/*
* Await graph load completion. That is, stop here, until we've scanned
* the repository for contract - instance associations.
*/
MUTEX_LOCK(&st->st_load_lock);
*** 2543,2552 ****
--- 2551,2562 ----
* this thread. As timeouts are specified in seconds, we'll do
* the necessary processing every second, as long as the queue
* is not empty.
*/
+ (void) pthread_setname_np(pthread_self(), "restarter_timeouts_event");
+
/*CONSTCOND*/
while (1) {
/*
* As long as the timeout list isn't empty, process it
* every second.