summaryrefslogtreecommitdiff
path: root/usr/src/cmd/nscd
diff options
context:
space:
mode:
authorJohn Levon <john.levon@joyent.com>2018-10-15 14:57:13 +0000
committerJohn Levon <john.levon@joyent.com>2018-10-15 14:57:13 +0000
commitf5733417953d12d5f4b44353b59c3b14f13696c2 (patch)
tree3e8c4bc1ee61164386f7dfc70c4b8b760731d843 /usr/src/cmd/nscd
parent8bd1e5ed2443eb501ddfba4147e769b6d0074ef3 (diff)
parentf35f236324c07bf560ad6481307ea93b1261d636 (diff)
downloadillumos-joyent-gcc-update.tar.gz
Merge remote-tracking branch 'ctf/OS-7275' into gcc-updategcc-update
Diffstat (limited to 'usr/src/cmd/nscd')
-rw-r--r--usr/src/cmd/nscd/cache.c11
-rw-r--r--usr/src/cmd/nscd/nscd_frontend.c13
-rw-r--r--usr/src/cmd/nscd/nscd_getentctx.c9
-rw-r--r--usr/src/cmd/nscd/nscd_selfcred.c7
-rw-r--r--usr/src/cmd/nscd/nscd_smfmonitor.c4
5 files changed, 36 insertions, 8 deletions
diff --git a/usr/src/cmd/nscd/cache.c b/usr/src/cmd/nscd/cache.c
index 2ffb95c30d..288c6e767e 100644
--- a/usr/src/cmd/nscd/cache.c
+++ b/usr/src/cmd/nscd/cache.c
@@ -22,6 +22,7 @@
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012 Milan Jurik. All rights reserved.
* Copyright (c) 2016 by Delphix. All rights reserved.
+ * Copyright 2018 Joyent, Inc.
*/
/*
@@ -1817,8 +1818,10 @@ init_cache_ctx(int i) {
static void
revalidate(nsc_ctx_t *ctx)
{
+ (void) thr_setname(thr_self(), "revalidate");
+
for (;;) {
- int i, slp, interval, count;
+ int i, slp, interval, count;
(void) rw_rdlock(&ctx->cfg_rwlp);
slp = ctx->cfg.pos_ttl;
@@ -1961,6 +1964,8 @@ static void
do_update(nsc_lookup_args_t *in) {
nss_pheader_t *phdr = (nss_pheader_t *)in->buffer;
+ (void) thr_setname(thr_self(), "do_update");
+
/* update the length of the data buffer */
phdr->data_len = phdr->pbufsiz - phdr->data_off;
@@ -2017,7 +2022,7 @@ nsc_invalidate(nsc_ctx_t *ctx, char *dbname, nsc_ctx_t **ctxs)
static void
ctx_invalidate(nsc_ctx_t *ctx)
{
- int i;
+ int i;
nsc_entry_t *entry;
char *me = "ctx_invalidate";
@@ -2190,6 +2195,8 @@ reaper(nsc_ctx_t *ctx)
ulong_t nsc_entries;
char *me = "reaper";
+ (void) thr_setname(thr_self(), me);
+
for (;;) {
(void) mutex_lock(&ctx->stats_mutex);
nsc_entries = ctx->stats.entries;
diff --git a/usr/src/cmd/nscd/nscd_frontend.c b/usr/src/cmd/nscd/nscd_frontend.c
index 7ed5e71bca..134da3f280 100644
--- a/usr/src/cmd/nscd/nscd_frontend.c
+++ b/usr/src/cmd/nscd/nscd_frontend.c
@@ -22,6 +22,7 @@
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
* Copyright 2012 Milan Jurik. All rights reserved.
+ * Copyright 2018 Joyent, Inc.
*/
#include <stdlib.h>
@@ -89,6 +90,8 @@ server_tsd_bind(void *arg)
{
static void *value = 0;
+ (void) thr_setname(thr_self(), "server_tsd_bind");
+
/* disable cancellation to avoid hangs if server threads disappear */
(void) pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
(void) thr_setspecific(server_key, value);
@@ -132,7 +135,8 @@ server_destroy(void *arg)
* get clearance
*/
int
-_nscd_get_clearance(sema_t *sema) {
+_nscd_get_clearance(sema_t *sema)
+{
if (sema_trywait(&common_sema) == 0) {
(void) thr_setspecific(lookup_state_key, NULL);
return (0);
@@ -151,7 +155,8 @@ _nscd_get_clearance(sema_t *sema) {
* release clearance
*/
int
-_nscd_release_clearance(sema_t *sema) {
+_nscd_release_clearance(sema_t *sema)
+{
int which;
(void) thr_getspecific(lookup_state_key, (void**)&which);
@@ -197,7 +202,7 @@ _nscd_restart_if_cfgfile_changed()
static timestruc_t last_nsswitch_modified = { 0 };
static timestruc_t last_resolv_modified = { -1, 0 };
static mutex_t restarting_lock = DEFAULTMUTEX;
- static int restarting = 0;
+ static int restarting = 0;
int restart = 0;
time_t now = time(NULL);
char *me = "_nscd_restart_if_cfgfile_changed";
@@ -1477,6 +1482,8 @@ rts_mon(void)
struct ifa_msghdr *ifam = &mbuf.ifam;
char *me = "rts_mon";
+ (void) thr_setname(thr_self(), me);
+
rt_sock = socket(PF_ROUTE, SOCK_RAW, 0);
if (rt_sock < 0) {
_NSCD_LOG(NSCD_LOG_FRONT_END, NSCD_LOG_LEVEL_ERROR)
diff --git a/usr/src/cmd/nscd/nscd_getentctx.c b/usr/src/cmd/nscd/nscd_getentctx.c
index 2fed9a5c82..f4e6b89fbc 100644
--- a/usr/src/cmd/nscd/nscd_getentctx.c
+++ b/usr/src/cmd/nscd/nscd_getentctx.c
@@ -21,6 +21,8 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright 2018 Joyent, Inc.
*/
#include <sys/ccompile.h>
@@ -658,6 +660,8 @@ reclaim_getent_ctx(void *arg)
nss_getent_t nssctx = { 0 };
char *me = "reclaim_getent_ctx";
+ (void) thr_setname(thr_self(), me);
+
/*CONSTCOND*/
while (1) {
@@ -744,7 +748,8 @@ reclaim_getent_ctx(void *arg)
}
static nscd_rc_t
-_nscd_init_getent_ctx_monitor() {
+_nscd_init_getent_ctx_monitor()
+{
int errnum;
char *me = "_nscd_init_getent_ctx_monitor";
@@ -763,7 +768,7 @@ _nscd_init_getent_ctx_monitor() {
* start a thread to reclaim unused getent contexts
*/
if (thr_create(NULL, NULL, reclaim_getent_ctx,
- NULL, THR_DETACHED, NULL) != 0) {
+ NULL, THR_DETACHED, NULL) != 0) {
errnum = errno;
_NSCD_LOG(NSCD_LOG_GETENT_CTX, NSCD_LOG_LEVEL_ERROR)
(me, "thr_create: %s\n", strerror(errnum));
diff --git a/usr/src/cmd/nscd/nscd_selfcred.c b/usr/src/cmd/nscd/nscd_selfcred.c
index df4d2a2c5b..b6cdba8c7a 100644
--- a/usr/src/cmd/nscd/nscd_selfcred.c
+++ b/usr/src/cmd/nscd/nscd_selfcred.c
@@ -22,6 +22,7 @@
/*
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012 Milan Jurik. All rights reserved.
+ * Copyright 2018 Joyent Inc.
*/
#include <stdio.h>
@@ -425,6 +426,8 @@ forker_monitor(
char *fmri;
char *me = "forker_monitor";
+ (void) thr_setname(thr_self(), me);
+
/* wait until forker exits */
fpid = forker_pid;
(void) selfcred_pulse(forking_door);
@@ -1416,7 +1419,7 @@ check_uid(char *pid_name)
static uid_t uid = 0;
static uid_t euid = 0;
int pfd; /* file descriptor for /proc/<pid>/psinfo */
- psinfo_t info; /* process information from /proc */
+ psinfo_t info; /* process information from /proc */
if (uid == 0) {
pid = getpid();
@@ -1466,6 +1469,8 @@ check_user_process(void *arg)
int found;
char *me = "check_user_process";
+ (void) thr_setname(thr_self(), me);
+
for (;;) {
(void) sleep(60);
diff --git a/usr/src/cmd/nscd/nscd_smfmonitor.c b/usr/src/cmd/nscd/nscd_smfmonitor.c
index bd2ff958ba..c5d5731ecd 100644
--- a/usr/src/cmd/nscd/nscd_smfmonitor.c
+++ b/usr/src/cmd/nscd/nscd_smfmonitor.c
@@ -21,6 +21,8 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright 2018 Joyent, Inc.
*/
#include <stdlib.h>
@@ -107,6 +109,8 @@ set_smf_state(void *arg)
int i;
int st;
+ (void) thr_setname(thr_self(), "set_smf_state");
+
/*
* the forker nscd needs not monitor the state
* of the client services