Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

11. System Limits and Options > Retrieving System Limits (and Options) at Run T...

Retrieving System Limits (and Options) at Run Time

The sysconf() function allows an application to obtain the values of system limits at run time.

#include <unistd.h>

long sysconf(int name);

Note

Returns value of limit specified by name, or -1 if limit is indeterminate or an error occurred

The name argument is one of the _SC_* constants defined in <unistd.h>, some of which are listed in Table 11-1. The value of the limit is returned as the function result.

If a limit can’t be determined, sysconf() returns -1. It may also return -1 if an error occurred. (The only specified error is EINVAL, indicating that name is not valid.) To distinguish the case of an indeterminate limit from an error, we must set errno to 0 before the call; if the call returns -1 and errno is set after the call, then an error occurred.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint