freebsd-skq/usr.bin/getconf/pathconf.gperf
ngie 09d7101411 Add non-TRUSTEDBSD prefixed knobs for the _PC_ACL* and {CAP,INF,MAC}_PRESENT knobs
It's not necessarily intuitive that the variables to query contain TRUSTEDBSD
in the prefix. Add non-TRUSTEDBSD prefixed knobs for querying things like
"_PC_ACL_NFS4".

MFC after:	1 week
Relnotes:	yes
Reviewed by:	wollman
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D7618
2016-08-25 17:07:43 +00:00

71 lines
1.6 KiB
Plaintext

%{
/*
* 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.
*/
static const struct map *in_word_set(const char *str);
%}
struct map { const char *name; int key; int valid; };
%%
ACL_EXTENDED, _PC_ACL_EXTENDED
ACL_NFS4, _PC_ACL_NFS4
ACL_PATH_MAX, _PC_ACL_PATH_MAX
CAP_PRESENT, _PC_CAP_PRESENT
FILESIZEBITS, _PC_FILESIZEBITS
INF_PRESENT, _PC_INF_PRESENT
LINK_MAX, _PC_LINK_MAX
MAC_PRESENT, _PC_MAC_PRESENT
MAX_CANON, _PC_MAX_CANON
MAX_INPUT, _PC_MAX_INPUT
MIN_HOLE_SIZE, _PC_MIN_HOLE_SIZE
NAME_MAX, _PC_NAME_MAX
PATH_MAX, _PC_PATH_MAX
PIPE_BUF, _PC_PIPE_BUF
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
SYMLINK_MAX, _PC_SYMLINK_MAX
TRUSTEDBSD_ACL_EXTENDED, _PC_ACL_EXTENDED
TRUSTEDBSD_ACL_NFS4, _PC_ACL_NFS4
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
_POSIX_CHOWN_RESTRICTED, _PC_CHOWN_RESTRICTED
_POSIX_NO_TRUNC, _PC_NO_TRUNC
_POSIX_VDISABLE, _PC_VDISABLE
_POSIX_ASYNC_IO, _PC_ASYNC_IO
_POSIX_PRIO_IO, _PC_PRIO_IO
_POSIX_SYNC_IO, _PC_SYNC_IO
%%
int
find_pathconf(const char *name, int *key)
{
const struct map *rv;
rv = in_word_set(name);
if (rv != NULL) {
if (rv->valid) {
*key = rv->key;
return 1;
}
return -1;
}
return 0;
}