access bash from C program?
Bill McGonigle
bill at bfccomputing.com
Mon Jun 2 12:30:44 EDT 2008
On Jun 2, 2008, at 12:11, Labitt, Bruce wrote:
> a=getrlimit; //save current setting
> ulimit // do what I want
> setrlimit=a // restore setting
I think only sub-processes are going to be affected by your ulimit
call, so I'm not sure the [get,set]rlimit are even necessary - once
you exit your user won't be further affected. But if you think your
sub-processes might abuse the new ulimit, defensive programming may
be called for.
If you have to call out with system() because that's your only
interface into something, some processes will arrange to re-call
themselves after tweaking something, and test for that. e.g.:
check for resource
resource OK?
no:
code = system(set resource; call self)
exit(code)
yes:
do important thing here
Ideally, all those types of checks can be done at program start, for
the sake of state sanity.
-Bill
-----
Bill McGonigle, Owner Work: 603.448.4440
BFC Computing, LLC Home: 603.448.1668
bill at bfccomputing.com Cell: 603.252.2606
http://www.bfccomputing.com/ Page: 603.442.1833
Blog: http://blog.bfccomputing.com/
VCard: http://bfccomputing.com/vcard/bill.vcf
More information about the gnhlug-discuss
mailing list