Print this page
8158 Want named threads API
9857 proc manpages should have LIBRARY section

@@ -19,10 +19,11 @@
  * CDDL HEADER END
  */
 
 /*
  * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2018 Joyent, Inc.
  * Copyright (c) 2015, Syneto S.R.L. All rights reserved.
  * Copyright 2016 Toomas Soome <tsoome@me.com>
  * Copyright 2016 RackTop Systems.
  */
 

@@ -3847,10 +3848,12 @@
  */
 /* ARGSUSED */
 static void *
 sulogin_thread(void *unused)
 {
+        (void) pthread_setname_np(pthread_self(), "sulogin");
+
         MUTEX_LOCK(&dgraph_lock);
 
         assert(sulogin_thread_running);
 
         do {

@@ -3874,10 +3877,12 @@
         scf_value_t *val;
         const char *msg;
         char *buf;
         int r;
 
+        (void) pthread_setname_np(pthread_self(), "single_user");
+
         MUTEX_LOCK(&single_user_thread_lock);
         single_user_thread_count++;
 
         if (!booting_to_single_user)
                 kill_user_procs();

@@ -5777,10 +5782,12 @@
 graph_event_thread(void *unused)
 {
         scf_handle_t *h;
         int err;
 
+        (void) pthread_setname_np(pthread_self(), "graph_event");
+
         h = libscf_handle_create_bound_loop();
 
         /*CONSTCOND*/
         while (1) {
                 graph_protocol_event_t *e;

@@ -6136,10 +6143,12 @@
 graph_thread(void *arg)
 {
         scf_handle_t *h;
         int err;
 
+        (void) pthread_setname_np(pthread_self(), "graph");
+
         h = libscf_handle_create_bound_loop();
 
         if (st->st_initial)
                 set_initial_milestone(h);
 

@@ -6792,10 +6801,12 @@
         scf_instance_t *inst;
         char *fmri = startd_alloc(max_scf_fmri_size);
         char *pg_name = startd_alloc(max_scf_value_size);
         int r;
 
+        (void) pthread_setname_np(pthread_self(), "repository_event");
+
         h = libscf_handle_create_bound_loop();
 
         pg = safe_scf_pg_create(h);
         inst = safe_scf_instance_create(h);