Print this page
4146 getconf(1) does not support XATTR_ENABLED, XATTR_EXISTS, SATTR_ENABLED, SATTR_EXISTS keys
Reviewed by: Cedric Blancher <cedric.blancher@gmail.com>
Reviewed by: Irek Szczesniak <iszczesniak@gmail.com>


 204 
 205         _PC_LINK_MAX,           "LINK_MAX",             PATHCONF,  NOFLAGS,
 206         _PC_MAX_CANON,          "MAX_CANON",            PATHCONF,  NOFLAGS,
 207         _PC_MAX_INPUT,          "MAX_INPUT",            PATHCONF,  NOFLAGS,
 208         _PC_NAME_MAX,           "NAME_MAX",             PATHCONF,  NOFLAGS,
 209         _PC_PATH_MAX,           "PATH_MAX",             PATHCONF,  NOFLAGS,
 210         _PC_PIPE_BUF,           "PIPE_BUF",             PATHCONF,  NOFLAGS,
 211         _PC_CHOWN_RESTRICTED,   "_POSIX_CHOWN_RESTRICTED", PATHCONF,  NOFLAGS,
 212         _PC_NO_TRUNC,           "_POSIX_NO_TRUNC",      PATHCONF,  NOFLAGS,
 213         _PC_VDISABLE,           "_POSIX_VDISABLE",      PATHCONF,  NOFLAGS,
 214 
 215         /* UNIX 98 additions */
 216 
 217         _PC_ASYNC_IO,           "_POSIX_ASYNC_IO",      PATHCONF,  NOFLAGS,
 218         _PC_PRIO_IO,            "_POSIX_PRIO_IO",       PATHCONF,  NOFLAGS,
 219         _PC_SYNC_IO,            "_POSIX_SYNC_IO",       PATHCONF,  NOFLAGS,
 220 
 221         /* Large File Summit name (UNIX 98) */
 222 
 223         _PC_FILESIZEBITS,       "FILESIZEBITS",         PATHCONF,  NOFLAGS,


 224 
 225         /* UNIX 03 Additions */
 226 
 227         /* Advisory Information (ADV) */
 228         _PC_ALLOC_SIZE_MIN,     "POSIX_ALLOC_SIZE_MIN", PATHCONF,  NOFLAGS,
 229         _PC_REC_INCR_XFER_SIZE, "POSIX_REC_INCR_XFER_SIZE", PATHCONF,  NOFLAGS,
 230         _PC_REC_MAX_XFER_SIZE,  "POSIX_REC_MAX_XFER_SIZE",  PATHCONF,  NOFLAGS,
 231         _PC_REC_MIN_XFER_SIZE,  "POSIX_REC_MIN_XFER_SIZE",  PATHCONF,  NOFLAGS,
 232         _PC_REC_XFER_ALIGN,     "POSIX_REC_XFER_ALIGN", PATHCONF,  NOFLAGS,
 233 
 234         _PC_2_SYMLINKS,         "POSIX2_SYMLINKS",      PATHCONF,  NOFLAGS,
 235         _PC_SYMLINK_MAX,        "SYMLINK_MAX",          PATHCONF,  NOFLAGS,
 236 





 237         /* UNIX 08 additions */
 238 
 239         _PC_TIMESTAMP_RESOLUTION, "_POSIX_TIMESTAMP_RESOLUTION",
 240             PATHCONF,   NOFLAGS,
 241 
 242         /* confstr() variables */
 243 
 244         /* POSIX.2-1992 description of getconf utility */
 245         _CS_PATH,               "PATH",                 CONFSTR,   NOFLAGS,
 246 
 247         /* POSIX.2-1992 table B-18 */
 248         _CS_PATH,               "CS_PATH",              CONFSTR,   NOFLAGS,
 249         _CS_PATH,               "_CS_PATH",             CONFSTR,   NOFLAGS,
 250 
 251         /* command names for large file configuration information */
 252         /* large file compilation environment configuration */
 253 
 254         _CS_LFS_CFLAGS,         "LFS_CFLAGS",           CONFSTR,   NOFLAGS,
 255         _CS_LFS_LDFLAGS,        "LFS_LDFLAGS",          CONFSTR,   NOFLAGS,
 256         _CS_LFS_LIBS,           "LFS_LIBS",             CONFSTR,   NOFLAGS,


 809                 if (scp->flag & UNDEFINED ||
 810                     (value = sysconf((int)scp->value)) == -1) {
 811                         if (errno == EINVAL) {
 812                                 (void) fprintf(stderr,
 813                                     gettext(INVAL_ARG), name);
 814                                 return (1);
 815                         } else {
 816                                 /* DO NOT TRANSLATE */
 817                                 (void) printf("undefined\n");
 818                                 return (0);
 819                         }
 820                 } else
 821                         (void) printf("%ld\n", value);
 822                 break;
 823 
 824         case CONFSTR:
 825                 if (argc > 2)
 826                         return (usage());
 827                 errno = 0;
 828                 len = confstr((int)scp->value, NULL, (size_t)0);
 829                 if (len == 0)
 830                         if (errno == EINVAL) {
 831                                 (void) fprintf(stderr, gettext(INVAL_ARG),
 832                                     name);
 833                                 return (1);
 834                         } else {
 835                                 /* DO NOT TRANSLATE */
 836                                 (void) printf("undefined\n");
 837                                 return (0);
 838                         }

 839                 /*
 840                  * allocate space to store result of constr() into
 841                  */
 842                 if ((buffer = malloc(len)) == NULL) {
 843                         (void) fprintf(stderr,
 844                             gettext("insufficient memory available"));
 845                         return (1);
 846                 }
 847 
 848                 assert(confstr((int)scp->value, buffer, len) != 0);
 849 
 850                 (void) printf("%s\n", buffer);
 851                 free(buffer);
 852                 break;
 853 
 854         case PATHCONF:
 855                 if (argc != 3)
 856                         return (usage());
 857                 errno = 0;
 858                 if ((value = pathconf(file, (int)scp->value)) == -1) {




 204 
 205         _PC_LINK_MAX,           "LINK_MAX",             PATHCONF,  NOFLAGS,
 206         _PC_MAX_CANON,          "MAX_CANON",            PATHCONF,  NOFLAGS,
 207         _PC_MAX_INPUT,          "MAX_INPUT",            PATHCONF,  NOFLAGS,
 208         _PC_NAME_MAX,           "NAME_MAX",             PATHCONF,  NOFLAGS,
 209         _PC_PATH_MAX,           "PATH_MAX",             PATHCONF,  NOFLAGS,
 210         _PC_PIPE_BUF,           "PIPE_BUF",             PATHCONF,  NOFLAGS,
 211         _PC_CHOWN_RESTRICTED,   "_POSIX_CHOWN_RESTRICTED", PATHCONF,  NOFLAGS,
 212         _PC_NO_TRUNC,           "_POSIX_NO_TRUNC",      PATHCONF,  NOFLAGS,
 213         _PC_VDISABLE,           "_POSIX_VDISABLE",      PATHCONF,  NOFLAGS,
 214 
 215         /* UNIX 98 additions */
 216 
 217         _PC_ASYNC_IO,           "_POSIX_ASYNC_IO",      PATHCONF,  NOFLAGS,
 218         _PC_PRIO_IO,            "_POSIX_PRIO_IO",       PATHCONF,  NOFLAGS,
 219         _PC_SYNC_IO,            "_POSIX_SYNC_IO",       PATHCONF,  NOFLAGS,
 220 
 221         /* Large File Summit name (UNIX 98) */
 222 
 223         _PC_FILESIZEBITS,       "FILESIZEBITS",         PATHCONF,  NOFLAGS,
 224         _PC_XATTR_ENABLED,      "XATTR_ENABLED",        PATHCONF,  NOFLAGS,
 225         _PC_XATTR_EXISTS,       "XATTR_EXISTS",         PATHCONF,  NOFLAGS,
 226 
 227         /* UNIX 03 Additions */
 228 
 229         /* Advisory Information (ADV) */
 230         _PC_ALLOC_SIZE_MIN,     "POSIX_ALLOC_SIZE_MIN", PATHCONF,  NOFLAGS,
 231         _PC_REC_INCR_XFER_SIZE, "POSIX_REC_INCR_XFER_SIZE", PATHCONF,  NOFLAGS,
 232         _PC_REC_MAX_XFER_SIZE,  "POSIX_REC_MAX_XFER_SIZE",  PATHCONF,  NOFLAGS,
 233         _PC_REC_MIN_XFER_SIZE,  "POSIX_REC_MIN_XFER_SIZE",  PATHCONF,  NOFLAGS,
 234         _PC_REC_XFER_ALIGN,     "POSIX_REC_XFER_ALIGN", PATHCONF,  NOFLAGS,
 235 
 236         _PC_2_SYMLINKS,         "POSIX2_SYMLINKS",      PATHCONF,  NOFLAGS,
 237         _PC_SYMLINK_MAX,        "SYMLINK_MAX",          PATHCONF,  NOFLAGS,
 238 
 239         _PC_ACL_ENABLED,        "ACL_ENABLED",          PATHCONF,  NOFLAGS,
 240         _PC_MIN_HOLE_SIZE,      "MIN_HOLE_SIZE",        PATHCONF,  NOFLAGS,
 241         _PC_SATTR_ENABLED,      "SATTR_ENABLED",        PATHCONF,  NOFLAGS,
 242         _PC_SATTR_EXISTS,       "SATTR_EXISTS",         PATHCONF,  NOFLAGS,
 243 
 244         /* UNIX 08 additions */
 245 
 246         _PC_TIMESTAMP_RESOLUTION, "_POSIX_TIMESTAMP_RESOLUTION",
 247             PATHCONF,   NOFLAGS,
 248 
 249         /* confstr() variables */
 250 
 251         /* POSIX.2-1992 description of getconf utility */
 252         _CS_PATH,               "PATH",                 CONFSTR,   NOFLAGS,
 253 
 254         /* POSIX.2-1992 table B-18 */
 255         _CS_PATH,               "CS_PATH",              CONFSTR,   NOFLAGS,
 256         _CS_PATH,               "_CS_PATH",             CONFSTR,   NOFLAGS,
 257 
 258         /* command names for large file configuration information */
 259         /* large file compilation environment configuration */
 260 
 261         _CS_LFS_CFLAGS,         "LFS_CFLAGS",           CONFSTR,   NOFLAGS,
 262         _CS_LFS_LDFLAGS,        "LFS_LDFLAGS",          CONFSTR,   NOFLAGS,
 263         _CS_LFS_LIBS,           "LFS_LIBS",             CONFSTR,   NOFLAGS,


 816                 if (scp->flag & UNDEFINED ||
 817                     (value = sysconf((int)scp->value)) == -1) {
 818                         if (errno == EINVAL) {
 819                                 (void) fprintf(stderr,
 820                                     gettext(INVAL_ARG), name);
 821                                 return (1);
 822                         } else {
 823                                 /* DO NOT TRANSLATE */
 824                                 (void) printf("undefined\n");
 825                                 return (0);
 826                         }
 827                 } else
 828                         (void) printf("%ld\n", value);
 829                 break;
 830 
 831         case CONFSTR:
 832                 if (argc > 2)
 833                         return (usage());
 834                 errno = 0;
 835                 len = confstr((int)scp->value, NULL, (size_t)0);
 836                 if (len == 0) {
 837                         if (errno == EINVAL) {
 838                                 (void) fprintf(stderr, gettext(INVAL_ARG),
 839                                     name);
 840                                 return (1);
 841                         } else {
 842                                 /* DO NOT TRANSLATE */
 843                                 (void) printf("undefined\n");
 844                                 return (0);
 845                         }
 846                 }
 847                 /*
 848                  * allocate space to store result of constr() into
 849                  */
 850                 if ((buffer = malloc(len)) == NULL) {
 851                         (void) fprintf(stderr,
 852                             gettext("insufficient memory available"));
 853                         return (1);
 854                 }
 855 
 856                 assert(confstr((int)scp->value, buffer, len) != 0);
 857 
 858                 (void) printf("%s\n", buffer);
 859                 free(buffer);
 860                 break;
 861 
 862         case PATHCONF:
 863                 if (argc != 3)
 864                         return (usage());
 865                 errno = 0;
 866                 if ((value = pathconf(file, (int)scp->value)) == -1) {