2000-04-26 02:36:54 +00:00
|
|
|
%{
|
|
|
|
/*
|
|
|
|
* Copyright is disclaimed as to the contents of this file.
|
|
|
|
*
|
|
|
|
* $FreeBSD$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
#include "getconf.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Override gperf's built-in external scope.
|
|
|
|
*/
|
2003-08-22 17:32:07 +00:00
|
|
|
static const struct map *in_word_set(const char *str);
|
2000-04-26 02:36:54 +00:00
|
|
|
|
|
|
|
%}
|
2003-08-22 17:32:07 +00:00
|
|
|
struct map { const char *name; int key; int valid; };
|
2000-04-26 02:36:54 +00:00
|
|
|
%%
|
2017-01-28 16:31:23 +00:00
|
|
|
ACL_EXTENDED, _PC_ACL_EXTENDED
|
|
|
|
ACL_NFS4, _PC_ACL_NFS4
|
|
|
|
ACL_PATH_MAX, _PC_ACL_PATH_MAX
|
|
|
|
CAP_PRESENT, _PC_CAP_PRESENT
|
2000-04-26 02:36:54 +00:00
|
|
|
FILESIZEBITS, _PC_FILESIZEBITS
|
2017-01-28 16:31:23 +00:00
|
|
|
INF_PRESENT, _PC_INF_PRESENT
|
2000-04-26 02:36:54 +00:00
|
|
|
LINK_MAX, _PC_LINK_MAX
|
2017-01-28 16:31:23 +00:00
|
|
|
MAC_PRESENT, _PC_MAC_PRESENT
|
2000-04-26 02:36:54 +00:00
|
|
|
MAX_CANON, _PC_MAX_CANON
|
|
|
|
MAX_INPUT, _PC_MAX_INPUT
|
2017-01-28 16:31:23 +00:00
|
|
|
MIN_HOLE_SIZE, _PC_MIN_HOLE_SIZE
|
2000-04-26 02:36:54 +00:00
|
|
|
NAME_MAX, _PC_NAME_MAX
|
|
|
|
PATH_MAX, _PC_PATH_MAX
|
|
|
|
PIPE_BUF, _PC_PIPE_BUF
|
2002-09-19 03:39:03 +00:00
|
|
|
POSIX_ALLOC_SIZE_MIN, _PC_ALLOC_SIZE_MIN
|
|
|
|
POSIX_REC_INCR_XFER_SIZE, _PC_REC_INCR_XFER_SIZE
|
|
|
|
POSIX_REC_MAX_XFER_SIZE, _PC_REC_MAX_XFER_SIZE
|
|
|
|
POSIX_REC_MIN_XFER_SIZE, _PC_REC_MIN_XFER_SIZE
|
|
|
|
POSIX_REC_XFER_ALIGN, _PC_REC_XFER_ALIGN
|
2002-10-27 04:10:34 +00:00
|
|
|
SYMLINK_MAX, _PC_SYMLINK_MAX
|
|
|
|
TRUSTEDBSD_ACL_EXTENDED, _PC_ACL_EXTENDED
|
2017-01-28 16:31:23 +00:00
|
|
|
TRUSTEDBSD_ACL_NFS4, _PC_ACL_NFS4
|
2002-10-27 04:10:34 +00:00
|
|
|
TRUSTEDBSD_ACL_PATH_MAX, _PC_ACL_PATH_MAX
|
|
|
|
TRUSTEDBSD_CAP_PRESENT, _PC_CAP_PRESENT
|
|
|
|
TRUSTEDBSD_INF_PRESENT, _PC_INF_PRESENT
|
|
|
|
TRUSTEDBSD_MAC_PRESENT, _PC_MAC_PRESENT
|
2000-04-26 02:36:54 +00:00
|
|
|
_POSIX_CHOWN_RESTRICTED, _PC_CHOWN_RESTRICTED
|
|
|
|
_POSIX_NO_TRUNC, _PC_NO_TRUNC
|
2017-01-28 16:31:23 +00:00
|
|
|
_POSIX_VDISABLE, _PC_VDISABLE
|
|
|
|
_POSIX_ASYNC_IO, _PC_ASYNC_IO
|
2000-04-26 02:36:54 +00:00
|
|
|
_POSIX_PRIO_IO, _PC_PRIO_IO
|
|
|
|
_POSIX_SYNC_IO, _PC_SYNC_IO
|
|
|
|
%%
|
|
|
|
int
|
2002-09-19 03:39:03 +00:00
|
|
|
find_pathconf(const char *name, int *key)
|
2000-04-26 02:36:54 +00:00
|
|
|
{
|
|
|
|
const struct map *rv;
|
|
|
|
|
2003-08-22 17:32:07 +00:00
|
|
|
rv = in_word_set(name);
|
2002-09-19 03:39:03 +00:00
|
|
|
if (rv != NULL) {
|
|
|
|
if (rv->valid) {
|
|
|
|
*key = rv->key;
|
|
|
|
return 1;
|
|
|
|
}
|
2000-04-26 02:36:54 +00:00
|
|
|
return -1;
|
2002-09-19 03:39:03 +00:00
|
|
|
}
|
|
|
|
return 0;
|
2000-04-26 02:36:54 +00:00
|
|
|
}
|
2017-09-15 22:55:15 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
foreach_pathconf(void (*func)(const char *, int, const char *),
|
|
|
|
const char *path)
|
|
|
|
{
|
|
|
|
const struct map *mp;
|
|
|
|
|
|
|
|
for (mp = wordlist; mp->name != NULL; mp++) {
|
|
|
|
if (mp->valid)
|
|
|
|
func(mp->name, mp->key, path);
|
|
|
|
}
|
|
|
|
}
|