summaryrefslogtreecommitdiff
path: root/usr/src/cmd/ps/ps.c
diff options
context:
space:
mode:
authorRobert Mustacchi <rm@joyent.com>2018-09-11 21:21:18 +0000
committerRobert Mustacchi <rm@joyent.com>2018-09-11 21:32:22 +0000
commita1c95bbb7c9625aab345559b448cd77dad78b4b3 (patch)
treeef63dc1c09fee5444552280179b6660c7b8fee80 /usr/src/cmd/ps/ps.c
parent6816448c8b777064c5a9cf6729bcfa0efeb29e4f (diff)
downloadillumos-joyent-a1c95bbb7c9625aab345559b448cd77dad78b4b3.tar.gz
backout OS-7200 would like thread name API (triggers OS-7240)
Reviewed by: John Levon <john.levon@joyent.com> Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src/cmd/ps/ps.c')
-rw-r--r--usr/src/cmd/ps/ps.c49
1 files changed, 12 insertions, 37 deletions
diff --git a/usr/src/cmd/ps/ps.c b/usr/src/cmd/ps/ps.c
index 45ffc3a6cf..2773444803 100644
--- a/usr/src/cmd/ps/ps.c
+++ b/usr/src/cmd/ps/ps.c
@@ -27,11 +27,11 @@
*/
/*
- * Copyright (c) 2018, Joyent, Inc.
+ * Copyright 2015 Joyent, Inc.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
+/* All Rights Reserved */
/*
* ps -- print things about processes.
@@ -108,7 +108,6 @@ enum fname { /* enumeration of field names */
F_SID, /* session id */
F_PSR, /* bound processor */
F_LWP, /* lwp-id */
- F_LWPNAME, /* lwp name */
F_NLWP, /* number of lwps */
F_OPRI, /* old priority (obsolete) */
F_PRI, /* new priority */
@@ -178,7 +177,6 @@ static struct def_field fname[] = {
{ "sid", "SID", 5, 5 },
{ "psr", "PSR", 3, 2 },
{ "lwp", "LWP", 6, 2 },
- { "lwpname", "LWPNAME", 32, 8 },
{ "nlwp", "NLWP", 4, 2 },
{ "opri", "PRI", 3, 2 },
{ "pri", "PRI", 3, 2 },
@@ -213,8 +211,8 @@ static struct def_field fname[] = {
{ "zone", "ZONE", 8, 8 },
{ "zoneid", "ZONEID", 5, 5 },
{ "ctid", "CTID", 5, 5 },
- { "lgrp", "LGRP", 4, 2 },
- { "dmodel", "DMODEL", 6, 6 },
+ { "lgrp", "LGRP", 4, 2 },
+ { "dmodel", "DMODEL", 6, 6 },
};
#define NFIELDS (sizeof (fname) / sizeof (fname[0]))
@@ -813,7 +811,6 @@ stdmain(int argc, char **argv)
(void) printf("%-*s",
f->width, f->header);
break;
- case F_LWPNAME:
case F_FNAME:
case F_COMM:
case F_ARGS:
@@ -1189,8 +1186,7 @@ parse_format(char *arg)
}
for (df = &fname[0]; df < &fname[NFIELDS]; df++)
if (strcmp(name, df->fname) == 0) {
- if (strcmp(name, "lwp") == 0 ||
- strcmp(name, "lwpname") == 0)
+ if (strcmp(name, "lwp") == 0)
Lflg++;
break;
}
@@ -1766,27 +1762,6 @@ print_field(psinfo_t *psinfo, struct field *f, const char *ttyp)
case F_LWP:
(void) printf("%*d", width, (int)psinfo->pr_lwp.pr_lwpid);
break;
- case F_LWPNAME: {
- char lwpname[THREAD_NAME_MAX] = "";
- char *path = NULL;
- int fd;
-
- if (asprintf(&path, "/proc/%d/lwp/%d/lwpname",
- (int)psinfo->pr_pid, (int)psinfo->pr_lwp.pr_lwpid) != -1 &&
- (fd = open(path, O_RDONLY)) != -1) {
- (void) read(fd, lwpname, sizeof (lwpname));
- lwpname[THREAD_NAME_MAX - 1] = '\0';
- (void) close(fd);
- }
-
- free(path);
-
- if (f->next != NULL)
- (void) printf("%-*s", width, lwpname);
- else
- (void) printf("%s", lwpname);
- break;
- }
case F_NLWP:
(void) printf("%*d", width, psinfo->pr_nlwp + psinfo->pr_nzomb);
break;
@@ -2400,7 +2375,7 @@ przom(psinfo_t *psinfo)
}
if (fflg) {
int width = fname[F_STIME].width;
- (void) printf(" %*.*s", width, width, "-"); /* STIME */
+ (void) printf(" %*.*s", width, width, "-"); /* STIME */
}
(void) printf(" %-8.14s", "?"); /* TTY */
@@ -2480,9 +2455,9 @@ delta_secs(const timestruc_t *start)
/*
* Returns the following:
*
- * 0 No error
- * EINVAL Invalid number
- * ERANGE Value exceeds (min, max) range
+ * 0 No error
+ * EINVAL Invalid number
+ * ERANGE Value exceeds (min, max) range
*/
static int
str2id(const char *p, pid_t *val, long min, long max)
@@ -2517,9 +2492,9 @@ str2id(const char *p, pid_t *val, long min, long max)
/*
* Returns the following:
*
- * 0 No error
- * EINVAL Invalid number
- * ERANGE Value exceeds (min, max) range
+ * 0 No error
+ * EINVAL Invalid number
+ * ERANGE Value exceeds (min, max) range
*/
static int
str2uid(const char *p, uid_t *val, unsigned long min, unsigned long max)