7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #pragma ident "%Z%%M% %I% %E% SMI"
28
29 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
30 /* All Rights Reserved */
31
32
33 #include <stdio.h>
34 #include <string.h>
35 #include <strings.h>
36 #include <stdlib.h>
37 #include <unistd.h>
38 #include <sys/types.h>
39 #include <limits.h>
40 #include <dirent.h>
41 #include <fcntl.h>
42 #include <sys/time.h>
43 #include <sys/procset.h>
44 #include <sys/priocntl.h>
45 #include <sys/task.h>
46 #include <procfs.h>
47 #include <project.h>
48 #include <errno.h>
55
56 /*
57 * Utility functions for priocntl command.
58 */
59
60 static char *procdir = "/proc";
61
62 /*PRINTFLIKE1*/
63 void
64 fatalerr(format, a1, a2, a3, a4, a5)
65 char *format;
66 int a1, a2, a3, a4, a5;
67 {
68 (void) fprintf(stderr, format, a1, a2, a3, a4, a5);
69 exit(1);
70 }
71
72
73 /*
74 * Structure defining idtypes known to the priocntl command
75 * along with the corresponding names and a liberal guess
76 * of the max number of procs sharing any given ID of that type.
77 * The idtype values themselves are defined in <sys/procset.h>.
78 */
79 static struct idtypes {
80 idtype_t idtype;
81 char *idtypnm;
82 } idtypes [] = {
83 { P_PID, "pid" },
84 { P_PPID, "ppid" },
85 { P_PGID, "pgid" },
86 { P_SID, "sid" },
87 { P_CID, "class" },
88 { P_UID, "uid" },
89 { P_GID, "gid" },
90 { P_PROJID, "projid" },
91 { P_TASKID, "taskid" },
92 { P_ZONEID, "zoneid" },
93 { P_CTID, "ctid" },
94 { P_ALL, "all" }
95 };
96
|
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
29
30
31 #include <stdio.h>
32 #include <string.h>
33 #include <strings.h>
34 #include <stdlib.h>
35 #include <unistd.h>
36 #include <sys/types.h>
37 #include <limits.h>
38 #include <dirent.h>
39 #include <fcntl.h>
40 #include <sys/time.h>
41 #include <sys/procset.h>
42 #include <sys/priocntl.h>
43 #include <sys/task.h>
44 #include <procfs.h>
45 #include <project.h>
46 #include <errno.h>
53
54 /*
55 * Utility functions for priocntl command.
56 */
57
58 static char *procdir = "/proc";
59
60 /*PRINTFLIKE1*/
61 void
62 fatalerr(format, a1, a2, a3, a4, a5)
63 char *format;
64 int a1, a2, a3, a4, a5;
65 {
66 (void) fprintf(stderr, format, a1, a2, a3, a4, a5);
67 exit(1);
68 }
69
70
71 /*
72 * Structure defining idtypes known to the priocntl command
73 * along with the corresponding names
74 * The idtype values themselves are defined in <sys/procset.h>.
75 */
76 static struct idtypes {
77 idtype_t idtype;
78 char *idtypnm;
79 } idtypes [] = {
80 { P_PID, "pid" },
81 { P_PPID, "ppid" },
82 { P_PGID, "pgid" },
83 { P_SID, "sid" },
84 { P_CID, "class" },
85 { P_UID, "uid" },
86 { P_GID, "gid" },
87 { P_PROJID, "projid" },
88 { P_TASKID, "taskid" },
89 { P_ZONEID, "zoneid" },
90 { P_CTID, "ctid" },
91 { P_ALL, "all" }
92 };
93
|