ulimit.c revision 3f54fd611f536639ec30dd53c48e5ec1897cc7d9
/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1982-2012 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* David Korn <dgk@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* ulimit [-HSacdfmnstuv] [limit]
*
* David Korn
* AT&T Labs
*
*/
#include <ast.h>
#include <sfio.h>
#include <error.h>
#include "defs.h"
#include "builtins.h"
#include "name.h"
#include "ulimit.h"
#ifndef SH_DICT
# define SH_DICT "libshell"
#endif
#ifdef _no_ulimit
{
return(0);
}
#else
{
{
}
return(1);
}
#define HARD 2
#define SOFT 4
{
register char *limit;
register int mode=0, n;
register unsigned long hit = 0;
#ifdef _lib_getrlimit
#endif /* _lib_getrlimit */
char* conf;
rlim_t i;
char tmp[32];
{
case 'H':
continue;
case 'S':
continue;
case 'a':
hit = ~0;
break;
default:
if(n < 0)
else
break;
case ':':
break;
case '?':
break;
}
/* default to -f */
if(hit==0)
for(n=0; shtab_limits[n].option; n++)
{
hit |= (1L<<n);
break;
}
/* only one option at a time for setting */
if(mode==0)
{
if(!(hit&1))
continue;
if(limit)
{
sh_subfork();
i = INFINITY;
else
{
char *last;
/* an explicit suffix unit overrides the default */
i *= unit;
{
i *= unit;
}
}
if(nosupport)
else
{
#ifdef _lib_getrlimit
#else
if((i=vlimit(n,i)) < 0)
#endif /* _lib_getrlimit */
}
}
else
{
if(!nosupport)
{
#ifdef _lib_getrlimit
#else
# ifdef _lib_ulimit
n--;
# endif /* _lib_ulimit */
i = -1;
if((i=vlimit(n,i)) < 0)
#endif /* _lib_getrlimit */
}
if(label)
{
else
}
if(nosupport)
{
conf = (char*)e_nosupport;
}
else if(i!=INFINITY)
{
i += (unit-1);
}
else
}
}
return(0);
}
#endif /* _no_ulimit */