res.c (7c478bd95313f5f23a4c958a745db2134aa03244) res.c (074e084f68dd0b08686612bec695a0cfe249da6d)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance 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/*
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21/*
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
22 * Copyright 2008 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#include <stdlib.h>
30#include <stdio.h>
31#include <libintl.h>

--- 248 unchanged lines hidden (view full) ---

280 }
281 }
282 if (ok == 0) {
283 id = name2id(p, type);
284 if (id > 0)
285 resset(buf, id, state);
286 else if (id == 0)
287 die(gettext("unknown %s resource: %s\n"),
23 * Use is subject to license terms.
24 */
25
26#pragma ident "%Z%%M% %I% %E% SMI"
27
28#include <stdlib.h>
29#include <stdio.h>
30#include <libintl.h>

--- 248 unchanged lines hidden (view full) ---

279 }
280 }
281 if (ok == 0) {
282 id = name2id(p, type);
283 if (id > 0)
284 resset(buf, id, state);
285 else if (id == 0)
286 die(gettext("unknown %s resource: %s\n"),
288 type == AC_PROC ? "process" : "task", p);
287 ac_type_name(type), p);
289 }
290 p = strtok(NULL, ", ");
291 }
292 free(copy);
293}
294
295/*
296 * this function converts a buffer into a string of resource names.

--- 42 unchanged lines hidden (view full) ---

339 * that are not a part of any groups
340 */
341 for (cur = buf; cur->ar_id != AC_NONE; cur++) {
342 if (cur->ar_state == state) {
343 if (strlen(str) != 0)
344 (void) strcat(str, ",");
345 if (id2name(cur->ar_id, type) == NULL)
346 die(gettext("unknown %s resource id (%d)\n"),
288 }
289 p = strtok(NULL, ", ");
290 }
291 free(copy);
292}
293
294/*
295 * this function converts a buffer into a string of resource names.

--- 42 unchanged lines hidden (view full) ---

338 * that are not a part of any groups
339 */
340 for (cur = buf; cur->ar_id != AC_NONE; cur++) {
341 if (cur->ar_state == state) {
342 if (strlen(str) != 0)
343 (void) strcat(str, ",");
344 if (id2name(cur->ar_id, type) == NULL)
345 die(gettext("unknown %s resource id (%d)\n"),
347 type == AC_PROC ? "process" : "task",
348 cur->ar_id);
346 ac_type_name(type), cur->ar_id);
349 (void) strcat(str, id2name(cur->ar_id, type));
350 }
351 }
352 if (strlen(str) == 0)
353 (void) strcpy(str, AC_STR_NONE);
354 free(buf);
355 return (str);
356}
347 (void) strcat(str, id2name(cur->ar_id, type));
348 }
349 }
350 if (strlen(str) == 0)
351 (void) strcpy(str, AC_STR_NONE);
352 free(buf);
353 return (str);
354}