1*433d6423SLionel Sambuc /* POSIX pathconf (Sec. 5.7.1) Author: Andy Tanenbaum */ 2*433d6423SLionel Sambuc 3*433d6423SLionel Sambuc #include <sys/cdefs.h> 4*433d6423SLionel Sambuc #include "namespace.h" 5*433d6423SLionel Sambuc #include <lib.h> 6*433d6423SLionel Sambuc 7*433d6423SLionel Sambuc #include <fcntl.h> 8*433d6423SLionel Sambuc #include <errno.h> 9*433d6423SLionel Sambuc #include <unistd.h> 10*433d6423SLionel Sambuc pathconf(path,name)11*433d6423SLionel Sambuclong pathconf(path, name) 12*433d6423SLionel Sambuc const char *path; /* name of file being interrogated */ 13*433d6423SLionel Sambuc int name; /* property being inspected */ 14*433d6423SLionel Sambuc { 15*433d6423SLionel Sambuc /* POSIX allows some of the values in <limits.h> to be increased at 16*433d6423SLionel Sambuc * run time. The pathconf and fpathconf functions allow these values 17*433d6423SLionel Sambuc * to be checked at run time. MINIX does not use this facility. 18*433d6423SLionel Sambuc * The run-time limits are those given in <limits.h>. 19*433d6423SLionel Sambuc */ 20*433d6423SLionel Sambuc 21*433d6423SLionel Sambuc int fd; 22*433d6423SLionel Sambuc long val; 23*433d6423SLionel Sambuc 24*433d6423SLionel Sambuc if ( (fd = open(path, O_RDONLY)) < 0) return(-1L); 25*433d6423SLionel Sambuc val = fpathconf(fd, name); 26*433d6423SLionel Sambuc close(fd); 27*433d6423SLionel Sambuc return(val); 28*433d6423SLionel Sambuc } 29