/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ulimit builtin
*/
#include <sys/resource.h>
#include <stdlib.h>
#include "defs.h"
/*
* order is important in this table! it is indexed by resource ID.
*/
static struct rlimtab {
char *name;
char *scale;
} rlimtab[] = {
/* RLIMIT_CPU */ "time", "seconds", 1,
/* RLIMIT_FSIZE */ "file", "blocks", 512,
/* RLIMIT_DATA */ "data", "kbytes", 1024,
/* RLIMIT_STACK */ "stack", "kbytes", 1024,
/* RLIMIT_CORE */ "coredump", "blocks", 512,
/* RLIMIT_NOFILE */ "nofiles", "descriptors", 1,
/* RLIMIT_VMEM */ "memory", "kbytes", 1024,
};
void
{
char *savoptarg;
char *args;
}
optind = 1;
_sp = 1;
opterr = 0;
hard = 0;
soft = 0;
cnt = 0;
switch (c) {
case 'S':
soft++;
continue;
case 'H':
hard++;
continue;
case 'a':
}
cnt = RLIM_NLIMITS;
continue;
case 'c':
res = RLIMIT_CORE;
break;
case 'd':
res = RLIMIT_DATA;
break;
case 'f':
res = RLIMIT_FSIZE;
break;
case 'n':
res = RLIMIT_NOFILE;
break;
case 's':
res = RLIMIT_STACK;
break;
case 't':
res = RLIMIT_CPU;
break;
case 'v':
res = RLIMIT_VMEM;
break;
case '?':
goto err;
}
cnt++;
}
if (cnt == 0) {
cnt++;
}
/*
* if out of arguments, then print the specified resources
*/
soft++;
}
continue;
}
continue;
}
if (cnt > 1) {
prc_buff('(');
prc_buff(')');
prc_buff(' ');
}
if (soft) {
} else {
}
}
prc_buff(':');
}
if (hard) {
} else {
}
}
prc_buff('\n');
}
goto err;
}
goto err;
}
} else {
do {
goto err;
}
/* Check for overflow! */
} else {
goto err;
}
} while (*++args);
/* Check for overflow! */
} else {
goto err;
}
}
goto err;
}
hard++;
soft++;
}
if (hard) {
}
if (soft) {
}
}
err:
}