forked from Stichting-MINIX-Research-Foundation/minix
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_pathconf.c
More file actions
28 lines (24 loc) · 738 Bytes
/
Copy path_pathconf.c
File metadata and controls
28 lines (24 loc) · 738 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* POSIX pathconf (Sec. 5.7.1) Author: Andy Tanenbaum */
#include <lib.h>
#define close _close
#define open _open
#define pathconf _pathconf
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
PUBLIC long pathconf(path, name)
_CONST char *path; /* name of file being interrogated */
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);
}