2011-02-17 18:11:09 +01:00
|
|
|
/* POSIX pathconf (Sec. 5.7.1) Author: Andy Tanenbaum */
|
|
|
|
|
|
|
|
#include <sys/cdefs.h>
|
|
|
|
#include "namespace.h"
|
|
|
|
#include <lib.h>
|
|
|
|
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
#ifdef __weak_alias
|
|
|
|
__weak_alias(pathconf, _pathconf)
|
|
|
|
#endif
|
|
|
|
|
2012-03-25 20:25:53 +02:00
|
|
|
long pathconf(path, name)
|
2012-03-25 20:38:37 +02:00
|
|
|
const char *path; /* name of file being interrogated */
|
2011-02-17 18:11:09 +01:00
|
|
|
int name; /* property being inspected */
|
|
|
|
{
|
|
|
|
/* POSIX allows some of the values in <limits.h> to be increased at
|
|
|
|
* run time. The pathconf and fpathconf functions allow these values
|
|
|
|
* to be checked at run time. MINIX does not use this facility.
|
|
|
|
* The run-time limits are those given in <limits.h>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
int fd;
|
|
|
|
long val;
|
|
|
|
|
|
|
|
if ( (fd = open(path, O_RDONLY)) < 0) return(-1L);
|
|
|
|
val = fpathconf(fd, name);
|
|
|
|
close(fd);
|
|
|
|
return(val);
|
|
|
|
}
|