Advanced UNIX Programming (Jason Arnold's Library) by Marc J. Rochkind

Advanced UNIX Programming (Jason Arnold's Library) by Marc J. Rochkind

Author:Marc J. Rochkind
Language: eng
Format: epub
Publisher: Addison-Wesley
Published: 2004-08-20T04:00:00+00:00


FreeBSD and Darwin don’t implement the whole thing, as you can see from the code.17

17. Actually, these calls originated with 4.2BSD, but the BSD-derived systems haven’t picked up some of the more recent POSIX extensions.

Here’s what I got on our four test systems, starting with Solaris:

Linux:

FreeBSD:

Darwin:

There’s a much older system call that’s less functional and has problems with its return value:

ulimit—get and set process limits

The cmd argument is one of:

The sizes set or gotten are in units of 512 bytes. Because the sizes can get big, the returned value might be negative, and even –1 is possible. So, the way to check for an error is to set errno to zero before the call. If it returns –1, it’s an error only if errno changed.

There are some more peculiarities with ulimit, but there’s no point going into them. It’s basically a mess, and you should use getrlimit and setrlimit instead.

The getrusage system call gets information about resource usage by a process or by its terminated and waited-for children:

getrusage—get resource usage



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.