hrev46604 adds 5 changesets to branch 'master' old head: 1f0ebbcc55f1e188299c8e452aba9d27054bf52f new head: 5558efa4ce4055b69dc416b8a9a480a229b2f3da overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=5558efa+%5E1f0ebbc ---------------------------------------------------------------------------- 8ea4216: Add sysexits.h from FreeBSD r259958 I'd need this for getconf. 5a39a9f: Add getconf(1) from FreeBSD r259958 This one lacks -a but is simpler to port than the (e)glibc one, and should be way enough for usage patterns like counting CPUs, cf. https://gist.github.com/jj1bdx/5746298 TODO: Handle message files? TODO: Install manpage? d86dbc8: Mention getconf in FreeBSD sections in the credits. c229671: Add getconf to the image 5558efa: Provide cmd:getconf in haiku package [ François Revol <revol@xxxxxxx> ] ---------------------------------------------------------------------------- 21 files changed, 1172 insertions(+), 2 deletions(-) build/jam/images/HaikuImage | 3 +- headers/compatibility/bsd/sysexits.h | 116 +++++++++++++++++ src/apps/aboutsystem/AboutSystem.cpp | 2 +- src/bin/Jamfile | 1 + src/bin/getconf/Jamfile | 37 ++++++ src/bin/getconf/Makefile | 37 ++++++ src/bin/getconf/confstr.gperf | 70 ++++++++++ src/bin/getconf/fake-gperf.awk | 66 ++++++++++ src/bin/getconf/getconf.1 | 207 ++++++++++++++++++++++++++++++ src/bin/getconf/getconf.c | 190 +++++++++++++++++++++++++++ src/bin/getconf/getconf.h | 43 +++++++ src/bin/getconf/limits.gperf | 118 +++++++++++++++++ src/bin/getconf/pathconf.gperf | 62 +++++++++ src/bin/getconf/progenv.gperf | 67 ++++++++++ src/bin/getconf/sysconf.gperf | 149 +++++++++++++++++++++ src/data/package_infos/arm/haiku | 1 + src/data/package_infos/m68k/haiku | 1 + src/data/package_infos/ppc/haiku | 1 + src/data/package_infos/x86/haiku | 1 + src/data/package_infos/x86_64/haiku | 1 + src/data/package_infos/x86_gcc2/haiku | 1 + ############################################################################ Commit: 8ea42167a2760e20dfab961cd58ae5021dcaf3fd URL: http://cgit.haiku-os.org/haiku/commit/?id=8ea4216 Author: François Revol <revol@xxxxxxx> Date: Fri Dec 27 18:16:15 2013 UTC Add sysexits.h from FreeBSD r259958 I'd need this for getconf. ---------------------------------------------------------------------------- diff --git a/headers/compatibility/bsd/sysexits.h b/headers/compatibility/bsd/sysexits.h new file mode 100644 index 0000000..e52bb5b --- /dev/null +++ b/headers/compatibility/bsd/sysexits.h @@ -0,0 +1,116 @@ +/* + * Copyright (c) 1987, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)sysexits.h 8.1 (Berkeley) 6/2/93 + * + * $FreeBSD$ + */ + +#ifndef _SYSEXITS_H_ +#define _SYSEXITS_H_ + +/* + * SYSEXITS.H -- Exit status codes for system programs. + * + * This include file attempts to categorize possible error + * exit statuses for system programs, notably delivermail + * and the Berkeley network. + * + * Error numbers begin at EX__BASE to reduce the possibility of + * clashing with other exit statuses that random programs may + * already return. The meaning of the codes is approximately + * as follows: + * + * EX_USAGE -- The command was used incorrectly, e.g., with + * the wrong number of arguments, a bad flag, a bad + * syntax in a parameter, or whatever. + * EX_DATAERR -- The input data was incorrect in some way. + * This should only be used for user's data & not + * system files. + * EX_NOINPUT -- An input file (not a system file) did not + * exist or was not readable. This could also include + * errors like "No message" to a mailer (if it cared + * to catch it). + * EX_NOUSER -- The user specified did not exist. This might + * be used for mail addresses or remote logins. + * EX_NOHOST -- The host specified did not exist. This is used + * in mail addresses or network requests. + * EX_UNAVAILABLE -- A service is unavailable. This can occur + * if a support program or file does not exist. This + * can also be used as a catchall message when something + * you wanted to do doesn't work, but you don't know + * why. + * EX_SOFTWARE -- An internal software error has been detected. + * This should be limited to non-operating system related + * errors as possible. + * EX_OSERR -- An operating system error has been detected. + * This is intended to be used for such things as "cannot + * fork", "cannot create pipe", or the like. It includes + * things like getuid returning a user that does not + * exist in the passwd file. + * EX_OSFILE -- Some system file (e.g., /etc/passwd, /etc/utmp, + * etc.) does not exist, cannot be opened, or has some + * sort of error (e.g., syntax error). + * EX_CANTCREAT -- A (user specified) output file cannot be + * created. + * EX_IOERR -- An error occurred while doing I/O on some file. + * EX_TEMPFAIL -- temporary failure, indicating something that + * is not really an error. In sendmail, this means + * that a mailer (e.g.) could not create a connection, + * and the request should be reattempted later. + * EX_PROTOCOL -- the remote system returned something that + * was "not possible" during a protocol exchange. + * EX_NOPERM -- You did not have sufficient permission to + * perform the operation. This is not intended for + * file system problems, which should use NOINPUT or + * CANTCREAT, but rather for higher level permissions. + */ + +#define EX_OK 0 /* successful termination */ + +#define EX__BASE 64 /* base value for error messages */ + +#define EX_USAGE 64 /* command line usage error */ +#define EX_DATAERR 65 /* data format error */ +#define EX_NOINPUT 66 /* cannot open input */ +#define EX_NOUSER 67 /* addressee unknown */ +#define EX_NOHOST 68 /* host name unknown */ +#define EX_UNAVAILABLE 69 /* service unavailable */ +#define EX_SOFTWARE 70 /* internal software error */ +#define EX_OSERR 71 /* system error (e.g., can't fork) */ +#define EX_OSFILE 72 /* critical OS file missing */ +#define EX_CANTCREAT 73 /* can't create (user) output file */ +#define EX_IOERR 74 /* input/output error */ +#define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */ +#define EX_PROTOCOL 76 /* remote error in protocol */ +#define EX_NOPERM 77 /* permission denied */ +#define EX_CONFIG 78 /* configuration error */ + +#define EX__MAX 78 /* maximum listed value */ + +#endif /* !_SYSEXITS_H_ */ ############################################################################ Commit: 5a39a9feac1ed9903c099825122f0628f7944fca URL: http://cgit.haiku-os.org/haiku/commit/?id=5a39a9f Author: François Revol <revol@xxxxxxx> Date: Fri Dec 27 18:42:26 2013 UTC Add getconf(1) from FreeBSD r259958 This one lacks -a but is simpler to port than the (e)glibc one, and should be way enough for usage patterns like counting CPUs, cf. https://gist.github.com/jj1bdx/5746298 TODO: Handle message files? TODO: Install manpage? ---------------------------------------------------------------------------- diff --git a/src/bin/Jamfile b/src/bin/Jamfile index 69357ca..5a8595f 100644 --- a/src/bin/Jamfile +++ b/src/bin/Jamfile @@ -265,6 +265,7 @@ SubInclude HAIKU_TOP src bin findutils ; SubInclude HAIKU_TOP src bin fwcontrol ; SubInclude HAIKU_TOP src bin gawk ; SubInclude HAIKU_TOP src bin gdb ; +SubInclude HAIKU_TOP src bin getconf ; SubInclude HAIKU_TOP src bin hid_decode ; SubInclude HAIKU_TOP src bin ideinfo ; SubInclude HAIKU_TOP src bin keymap ; diff --git a/src/bin/getconf/Jamfile b/src/bin/getconf/Jamfile new file mode 100644 index 0000000..128dbf6 --- /dev/null +++ b/src/bin/getconf/Jamfile @@ -0,0 +1,37 @@ +SubDir HAIKU_TOP src bin getconf ; + +UseHeaders [ FDirName $(HAIKU_TOP) headers compatibility bsd ] : true ; + +rule GetConfKeysGen +{ + SEARCH on $(2) = $(SEARCH_SOURCE) ; + SEARCH on $(3) = $(SEARCH_SOURCE) ; + + Depends $(1) : $(2) $(3) ; + MakeLocateArch $(<) ; + GetConfKeysGen1 $(1) : $(2) $(3) ; + LocalClean clean : $(<) ; +} + +actions GetConfKeysGen1 +{ + LC_ALL=C gawk -f $(2[2]) $(2[1]) > $(1) +} + +GetConfKeysGen [ FGristFiles confstr.c ] : confstr.gperf : fake-gperf.awk ; +GetConfKeysGen [ FGristFiles limits.c ] : limits.gperf : fake-gperf.awk ; +GetConfKeysGen [ FGristFiles pathconf.c ] : pathconf.gperf : fake-gperf.awk ; +GetConfKeysGen [ FGristFiles progenv.c ] : progenv.gperf : fake-gperf.awk ; +GetConfKeysGen [ FGristFiles sysconf.c ] : sysconf.gperf : fake-gperf.awk ; + +BinCommand getconf : + getconf.c + confstr.c + limits.c + pathconf.c + progenv.c + sysconf.c + : libbsd.so + ; + + diff --git a/src/bin/getconf/Makefile b/src/bin/getconf/Makefile new file mode 100644 index 0000000..eaaf628 --- /dev/null +++ b/src/bin/getconf/Makefile @@ -0,0 +1,37 @@ +# $FreeBSD$ + +PROG= getconf + +SRCS= confstr.c getconf.c limits.c pathconf.c progenv.c sysconf.c +CFLAGS+= -I${.CURDIR} +CLEANFILES+= confstr.c limits.c pathconf.c progenv.c sysconf.c \ + confstr.names limits.names pathconf.names sysconf.names \ + conflicting.names unique.names + +.SUFFIXES: .gperf .names +.PHONY: conflicts + +all: conflicts + +.gperf.c: + LC_ALL=C awk -f ${.CURDIR}/fake-gperf.awk ${.IMPSRC} >${.TARGET} + +.gperf.names: + LC_ALL=C awk '/^[_A-Z]/ { print; }' ${.IMPSRC} | \ + sed -e 's/,$$//' >${.TARGET} + +conflicts: conflicting.names unique.names + @if test `wc -l <conflicting.names` != `wc -l <unique.names`; then \ + echo "Name conflicts found!" >&2; \ + exit 1; \ + fi + +# pathconf.names is not included here because pathconf names are +# syntactically distinct from the other kinds. +conflicting.names: confstr.names limits.names sysconf.names + cat ${.ALLSRC} >${.TARGET} + +unique.names: conflicting.names + LC_ALL=C sort -u ${.ALLSRC} >${.TARGET} + +.include <bsd.prog.mk> diff --git a/src/bin/getconf/confstr.gperf b/src/bin/getconf/confstr.gperf new file mode 100644 index 0000000..c629987 --- /dev/null +++ b/src/bin/getconf/confstr.gperf @@ -0,0 +1,70 @@ +%{ +/* + * 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); + +/* + * The Standard seems a bit ambiguous over whether the POSIX_V6_* + * are specified with or without a leading underscore, so we just + * use both. + */ +%} +struct map { const char *name; int key; int valid; }; +%% +PATH, _CS_PATH +POSIX_V6_ILP32_OFF32_CFLAGS, _CS_POSIX_V6_ILP32_OFF32_CFLAGS +POSIX_V6_ILP32_OFF32_LDFLAGS, _CS_POSIX_V6_ILP32_OFF32_LDFLAGS +POSIX_V6_ILP32_OFF32_LIBS, _CS_POSIX_V6_ILP32_OFF32_LIBS +POSIX_V6_ILP32_OFFBIG_CFLAGS, _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS +POSIX_V6_ILP32_OFFBIG_LDFLAGS, _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS +POSIX_V6_ILP32_OFFBIG_LIBS, _CS_POSIX_V6_ILP32_OFFBIG_LIBS +POSIX_V6_LP64_OFF64_CFLAGS, _CS_POSIX_V6_LP64_OFF64_CFLAGS +POSIX_V6_LP64_OFF64_LDFLAGS, _CS_POSIX_V6_LP64_OFF64_LDFLAGS +POSIX_V6_LP64_OFF64_LIBS, _CS_POSIX_V6_LP64_OFF64_LIBS +POSIX_V6_LPBIG_OFFBIG_CFLAGS, _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS +POSIX_V6_LPBIG_OFFBIG_LDFLAGS, _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS +POSIX_V6_LPBIG_OFFBIG_LIBS, _CS_POSIX_V6_LPBIG_OFFBIG_LIBS +POSIX_V6_WIDTH_RESTRICTED_ENVS, _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS +_POSIX_V6_ILP32_OFF32_CFLAGS, _CS_POSIX_V6_ILP32_OFF32_CFLAGS +_POSIX_V6_ILP32_OFF32_LDFLAGS, _CS_POSIX_V6_ILP32_OFF32_LDFLAGS +_POSIX_V6_ILP32_OFF32_LIBS, _CS_POSIX_V6_ILP32_OFF32_LIBS +_POSIX_V6_ILP32_OFFBIG_CFLAGS, _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS +_POSIX_V6_ILP32_OFFBIG_LDFLAGS, _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS +_POSIX_V6_ILP32_OFFBIG_LIBS, _CS_POSIX_V6_ILP32_OFFBIG_LIBS +_POSIX_V6_LP64_OFF64_CFLAGS, _CS_POSIX_V6_LP64_OFF64_CFLAGS +_POSIX_V6_LP64_OFF64_LDFLAGS, _CS_POSIX_V6_LP64_OFF64_LDFLAGS +_POSIX_V6_LP64_OFF64_LIBS, _CS_POSIX_V6_LP64_OFF64_LIBS +_POSIX_V6_LPBIG_OFFBIG_CFLAGS, _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS +_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS +_POSIX_V6_LPBIG_OFFBIG_LIBS, _CS_POSIX_V6_LPBIG_OFFBIG_LIBS +_POSIX_V6_WIDTH_RESTRICTED_ENVS, _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS +%% +int +find_confstr(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; +} diff --git a/src/bin/getconf/fake-gperf.awk b/src/bin/getconf/fake-gperf.awk new file mode 100644 index 0000000..96fcd3c --- /dev/null +++ b/src/bin/getconf/fake-gperf.awk @@ -0,0 +1,66 @@ +#!/usr/bin/awk -f +# $FreeBSD$ +BEGIN { + state = 0; + struct_seen = ""; +} +/^%{$/ && state == 0 { + state = 1; + next; +} +/^%}$/ && state == 1 { + state = 0; + next; +} +state == 1 { print; next; } +/^struct/ && state == 0 { + print; + struct_seen = $2; + next; +} +/^%%$/ && state == 0 { + state = 2; + if (struct_seen !~ /^$/) { + print "static const struct", struct_seen, "wordlist[] = {"; + } else { + print "static const struct map {"; + print "\tconst char *name;"; + print "\tint key;"; + print "\tint valid;"; + print "} wordlist[] = {"; + struct_seen = "map"; + } + next; +} +/^%%$/ && state == 2 { + state = 3; + print "\t{ NULL, 0, 0 }"; + print "};"; + print "#define\tNWORDS\t(sizeof(wordlist)/sizeof(wordlist[0]) - 1)"; + print "static const struct map *"; + print "in_word_set(const char *word)"; + print "{"; + print "\tconst struct", struct_seen, "*mp;"; + print ""; + print "\tfor (mp = wordlist; mp < &wordlist[NWORDS]; mp++) {"; + print "\t\tif (strcmp(word, mp->name) == 0)"; + print "\t\t\treturn (mp);"; + print "\t}"; + print "\treturn (NULL);"; + print "}"; + print ""; + next; +} +state == 2 && NF == 2 { + name = substr($1, 1, length($1) - 1); + printf "#ifdef %s\n", $2; + printf "\t{ \"%s\", %s, 1 },\n", name, $2; + print "#else"; + printf "\t{ \"%s\", 0, 0 },\n", name, $2; + print "#endif" + next; +} +state == 3 { print; next; } +{ + # eat anything not matched. +} diff --git a/src/bin/getconf/getconf.1 b/src/bin/getconf/getconf.1 new file mode 100644 index 0000000..c3baed9 --- /dev/null +++ b/src/bin/getconf/getconf.1 @@ -0,0 +1,207 @@ +.\" +.\" Copyright 2000 Massachusetts Institute of Technology +.\" +.\" Permission to use, copy, modify, and distribute this software and +.\" its documentation for any purpose and without fee is hereby +.\" granted, provided that both the above copyright notice and this +.\" permission notice appear in all copies, that both the above +.\" copyright notice and this permission notice appear in all +.\" supporting documentation, and that the name of M.I.T. not be used +.\" in advertising or publicity pertaining to distribution of the +.\" software without specific, written prior permission. M.I.T. makes +.\" no representations about the suitability of this software for any +.\" purpose. It is provided "as is" without express or implied +.\" warranty. +.\" +.\" THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS +.\" ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, +.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT +.\" SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +.\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +.\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd September 18, 2002 +.Dt GETCONF 1 +.Os +.Sh NAME +.Nm getconf +.Nd retrieve standard configuration variables +.Sh SYNOPSIS +.Nm +.Op Fl v Ar environment +.Ar path_var +.Ar file +.Nm +.Op Fl v Ar environment +.Ar system_var +.Sh DESCRIPTION +The +.Nm +utility prints the value of a +.Tn POSIX +or +.Tn X/Open +path or system configuration variable to the standard output. +If the specified variable is undefined, the string +.Dq Li undefined +is output. +.Pp +The first form of the command, with two mandatory +arguments, retrieves file- and file system-specific +configuration variables using +.Xr pathconf 2 . +The second form, with a single argument, retrieves system +configuration variables using +.Xr confstr 3 +and +.Xr sysconf 3 , +depending on the type of variable. +As an extension, the second form can also be used to query static limits from +.In limits.h . +.Pp +All +.Xr sysconf 3 +and +.Xr pathconf 2 +variables use the same name as the manifest constants defined in +the relevant standard C-language bindings, including any leading +underscore or prefix. +That is to say, +.Ar system_var +might be +.Dv ARG_MAX +or +.Dv _POSIX_VERSION , +as opposed to the +.Xr sysconf 3 +names +.Dv _SC_ARG_MAX +or +.Dv _SC_POSIX_VERSION . +Variables retrieved from +.Xr confstr 3 +have the leading +.Ql _CS_ +stripped off; thus, +.Dv _CS_PATH +is queried by a +.Ar system_var +of +.Dq Li PATH . +.Ss Programming Environments +The +.Fl v Ar environment +option specifies a +.St -p1003.1-2001 +programming environment under which the values are to be queried. +This option currently does nothing, but may in the future be used +to select between 32-bit and 64-bit execution environments on platforms +which support both. +Specifying an environment which is not supported on the current execution +platform gives undefined results. +.Pp +The standard programming environments are as follows: +.Bl -tag -width ".Li POSIX_V6_LPBIG_OFFBIG" -offset indent +.It Li POSIX_V6_ILP32_OFF32 +Exactly 32-bit integer, long, pointer, and file offset. +.Sy Supported platforms : +None. +.It Li POSIX_V6_ILP32_OFFBIG +Exactly 32-bit integer, long, and pointer; at least 64-bit file offset. +.Sy Supported platforms : +.Tn IA32 , +.Tn PowerPC . +.It Li POSIX_V6_LP64_OFF64 +Exactly 32-bit integer; exactly 64-bit long, pointer, and file offset. +.Sy Supported platforms : +.Tn Alpha , +.Tn SPARC64 . +.It Li POSIX_V6_LPBIG_OFFBIG +At least 32-bit integer; at least 64-bit long, pointer, and file offset. +.Sy Supported platforms : +None. +.El +.Pp +The command: +.Pp +.Dl "getconf POSIX_V6_WIDTH_RESTRICTED_ENVS" +.Pp +returns a newline-separated list of environments in which the width +of certain fundamental types is no greater than the width of the native +C type +.Vt long . +At present, all programming environments supported by +.Fx +have this property. +Several of the +.Xr confstr 3 +variables provide information on the necessary compiler and linker flags +to use the standard programming environments described above. +.Sh EXIT STATUS +.Ex -std +.Sh EXAMPLES +The command: +.Pp +.Dl "getconf PATH" +.Pp +will display the system default setting for the +.Ev PATH +environment variable. +.Pp +The command: +.Pp +.Dl "getconf NAME_MAX /tmp" +.Pp +will display the maximum length of a filename in the +.Pa /tmp +directory. +.Pp +The command: +.Pp +.Dl "getconf -v POSIX_V6_LPBIG_OFFBIG LONG_MAX" +.Pp +will display the maximum value of the C type +.Vt long +in the +.Li POSIX_V6_LPBIG_OFFBIG +programming environment, +if the system supports that environment. +.Sh DIAGNOSTICS +Use of a +.Ar system_var +or +.Ar path_var +which is completely unrecognized is considered an error, +causing a diagnostic message to be written to standard error. +One +which is known but merely undefined does not result in an error +indication. +The +.Nm +utility recognizes all of the variables defined for +.St -p1003.1-2001 , +including those which are not currently implemented. +.Sh SEE ALSO +.Xr pathconf 2 , +.Xr confstr 3 , +.Xr sysconf 3 +.Sh STANDARDS +The +.Nm +utility is expected to be compliant with +.St -p1003.1-2001 . +.Sh HISTORY +The +.Nm +utility first appeared in +.Fx 5.0 . +.Sh AUTHORS +.An Garrett A. Wollman Aq wollman@xxxxxxxxxxx diff --git a/src/bin/getconf/getconf.c b/src/bin/getconf/getconf.c new file mode 100644 index 0000000..5f88db6 --- /dev/null +++ b/src/bin/getconf/getconf.c @@ -0,0 +1,190 @@ +/* + * Copyright 2000 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that both the above copyright notice and this + * permission notice appear in all copies, that both the above + * copyright notice and this permission notice appear in all + * supporting documentation, and that the name of M.I.T. not be used + * in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. M.I.T. makes + * no representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS + * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT + * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +#include <sys/types.h> + +#include <err.h> +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <sysexits.h> +#include <unistd.h> + +#include "getconf.h" + +static void do_confstr(const char *name, int key); +static void do_sysconf(const char *name, int key); +static void do_pathconf(const char *name, int key, const char *path); + +static void +usage(void) +{ + fprintf(stderr, +"usage: getconf [-v prog_env] system_var\n" +" getconf [-v prog_env] path_var pathname\n"); + exit(EX_USAGE); +} + +int +main(int argc, char **argv) +{ + int c, key, valid; + const char *name, *vflag, *alt_path; + intmax_t limitval; + + vflag = NULL; + while ((c = getopt(argc, argv, "v:")) != -1) { + switch (c) { + case 'v': + vflag = optarg; + break; + + default: + usage(); + } + } + + if ((name = argv[optind]) == NULL) + usage(); + + if (vflag != NULL) { + if ((valid = find_progenv(vflag, &alt_path)) == 0) + errx(EX_USAGE, "invalid programming environment %s", + vflag); + if (valid > 0 && alt_path != NULL) { + if (argv[optind + 1] == NULL) + execl(alt_path, "getconf", argv[optind], + (char *)NULL); + else + execl(alt_path, "getconf", argv[optind], + argv[optind + 1], (char *)NULL); + + err(EX_OSERR, "execl: %s", alt_path); + } + if (valid < 0) + errx(EX_UNAVAILABLE, "environment %s is not available", + vflag); + } + + if (argv[optind + 1] == NULL) { /* confstr or sysconf */ + if ((valid = find_limit(name, &limitval)) != 0) { + if (valid > 0) + printf("%" PRIdMAX "\n", limitval); + else + printf("undefined\n"); + + return 0; + } + if ((valid = find_confstr(name, &key)) != 0) { + if (valid > 0) + do_confstr(name, key); + else + printf("undefined\n"); + } else { + valid = find_sysconf(name, &key); + if (valid > 0) { + do_sysconf(name, key); + } else if (valid < 0) { + printf("undefined\n"); + } else + errx(EX_USAGE, + "no such configuration parameter `%s'", + name); + } + } else { + valid = find_pathconf(name, &key); + if (valid != 0) { + if (valid > 0) + do_pathconf(name, key, argv[optind + 1]); + else + printf("undefined\n"); + } else + errx(EX_USAGE, + "no such path configuration parameter `%s'", + name); + } + return 0; +} + +static void +do_confstr(const char *name, int key) +{ + size_t len; + int savederr; + + savederr = errno; + errno = 0; + len = confstr(key, 0, 0); + if (len == 0) { + if (errno) + err(EX_OSERR, "confstr: %s", name); + else + printf("undefined\n"); + } else { + char buf[len + 1]; + + confstr(key, buf, len); + printf("%s\n", buf); + } + errno = savederr; +} + +static void +do_sysconf(const char *name, int key) +{ + long value; + + errno = 0; + value = sysconf(key); + if (value == -1 && errno != 0) + err(EX_OSERR, "sysconf: %s", name); + else if (value == -1) + printf("undefined\n"); + else + printf("%ld\n", value); +} + +static void +do_pathconf(const char *name, int key, const char *path) +{ + long value; + + errno = 0; + value = pathconf(path, key); + if (value == -1 && errno != 0) + err(EX_OSERR, "pathconf: %s", name); + else if (value == -1) + printf("undefined\n"); + else + printf("%ld\n", value); +} + diff --git a/src/bin/getconf/getconf.h b/src/bin/getconf/getconf.h new file mode 100644 index 0000000..266a0ff --- /dev/null +++ b/src/bin/getconf/getconf.h @@ -0,0 +1,43 @@ +/* + * Copyright 2000 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that both the above copyright notice and this + * permission notice appear in all copies, that both the above + * copyright notice and this permission notice appear in all + * supporting documentation, and that the name of M.I.T. not be used + * in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. M.I.T. makes + * no representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS + * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT + * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifdef STABLE +typedef long long intmax_t; +#define PRIdMAX "lld" +#else +#include <inttypes.h> +#endif + +int find_confstr(const char *name, int *key); +int find_limit(const char *name, intmax_t *value); +int find_pathconf(const char *name, int *key); +int find_progenv(const char *name, const char **alt_path); +int find_sysconf(const char *name, int *key); diff --git a/src/bin/getconf/limits.gperf b/src/bin/getconf/limits.gperf new file mode 100644 index 0000000..68e0d65 --- /dev/null +++ b/src/bin/getconf/limits.gperf @@ -0,0 +1,118 @@ +%{ +/* + * Copyright is disclaimed as to the contents of this file. + * + * $FreeBSD$ + */ + +#include <sys/types.h> + +#include <string.h> +#include <limits.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; intmax_t value; int valid; }; +%% +_POSIX_CLOCKRES_MIN, _POSIX_CLOCKRES_MIN +_POSIX_AIO_LISTIO_MAX, _POSIX_AIO_LISTIO_MAX +_POSIX_AIO_MAX, _POSIX_AIO_MAX +_POSIX_ARG_MAX, _POSIX_ARG_MAX +_POSIX_CHILD_MAX, _POSIX_CHILD_MAX +_POSIX_DELAYTIMER_MAX, _POSIX_DELAYTIMER_MAX +_POSIX_HOST_NAME_MAX, _POSIX_HOST_NAME_MAX +_POSIX_LINK_MAX, _POSIX_LINK_MAX +_POSIX_LOGIN_NAME_MAX, _POSIX_LOGIN_NAME_MAX +_POSIX_MAX_CANON, _POSIX_MAX_CANON +_POSIX_MAX_INPUT, _POSIX_MAX_INPUT +_POSIX_MQ_OPEN_MAX, _POSIX_MQ_OPEN_MAX +_POSIX_MQ_PRIO_MAX, _POSIX_MQ_PRIO_MAX +_POSIX_NAME_MAX, _POSIX_NAME_MAX +_POSIX_NGROUPS_MAX, _POSIX_NGROUPS_MAX +_POSIX_OPEN_MAX, _POSIX_OPEN_MAX +_POSIX_PATH_MAX, _POSIX_PATH_MAX +_POSIX_PIPE_BUF, __POSIX_PIPE_BUF +_POSIX_RE_DUP_MAX, _POSIX_RE_DUP_MAX +_POSIX_RTSIG_MAX, _POSIX_RTSIG_MAX +_POSIX_SEM_NSEMS_MAX, _POSIX_SEM_NSEMS_MAX +_POSIX_SEM_VALUE_MAX, _POSIX_SEM_VALUE_MAX +_POSIX_SIGQUEUE_MAX, _POSIX_SIGQUEUE_MAX +_POSIX_SSIZE_MAX, _POSIX_SSIZE_MAX +_POSIX_STREAM_MAX, _POSIX_STREAM_MAX +_POSIX_SS_REPL_MAX, _POSIX_SS_REPL_MAX +_POSIX_SYMLINK_MAX, _POSIX_SYMLINK_MAX +_POSIX_SYMLOOP_MAX, _POSIX_SYMLOOP_MAX +_POSIX_THREAD_DESTRUCTOR_ITERATIONS, _POSIX_THREAD_DESTRUCTOR_ITERATIONS +_POSIX_THREAD_KEYS_MAX, _POSIX_THREAD_KEYS_MAX +_POSIX_THREAD_THREADS_MAX, _POSIX_THREAD_THREADS_MAX +_POSIX_TIMER_MAX, _POSIX_TIMER_MAX +_POSIX_TRACE_EVENT_NAME_MAX, _POSIX_TRACE_EVENT_NAME_MAX +_POSIX_TRACE_NAME_MAX, _POSIX_TRACE_NAME_MAX +_POSIX_TRACE_SYS_MAX, _POSIX_TRACE_SYS_MAX +_POSIX_TRACE_USER_EVENT_MAX, _POSIX_TRACE_USER_EVENT_MAX +_POSIX_TTY_NAME_MAX, _POSIX_TTY_NAME_MAX +_POSIX_TZNAME_MAX, _POSIX_TZNAME_MAX +_POSIX2_BC_BASE_MAX, _POSIX2_BC_BASE_MAX +_POSIX2_BC_DIM_MAX, _POSIX2_BC_DIM_MAX +_POSIX2_BC_SCALE_MAX, _POSIX2_BC_SCALE_MAX +_POSIX2_BC_STRING_MAX, _POSIX2_BC_STRING_MAX +_POSIX2_CHARCLASS_NAME_MAX, _POSIX2_CHARCLASS_NAME_MAX +_POSIX2_COLL_WEIGHTS_MAX, _POSIX2_COLL_WEIGHTS_MAX +_POSIX2_EXPR_NEXT_MAX, _POSIX2_EXPR_NEST_MAX +_POSIX2_LINE_MAX, _POSIX2_LINE_MAX +_POSIX2_RE_DUP_MAX, _POSIX2_RE_DUP_MAX +_XOPEN_IOV_MAX, _XOPEN_IOV_MAX +_XOPEN_NAME_MAX, _XOPEN_NAME_MAX +_XOPEN_PATH_MAX, _XOPEN_PATH_MAX +CHAR_BIT, CHAR_BIT +CHAR_MAX, CHAR_MAX +CHAR_MIN, CHAR_MIN +INT_MAX, INT_MAX +INT_MIN, INT_MIN +LLONG_MIN, LLONG_MIN +LLONG_MAX, LLONG_MAX +LONG_BIT, LONG_BIT +LONG_MAX, LONG_MAX +LONG_MIN, LONG_MIN +MB_LEN_MAX, MB_LEN_MAX +SCHAR_MAX, SCHAR_MAX +SCHAR_MIN, SCHAR_MIN +SHRT_MAX, SHRT_MAX +SHRT_MIN, SHRT_MIN +SSIZE_MAX, SSIZE_MAX +UCHAR_MAX, UCHAR_MAX +UINT_MAX, UINT_MAX +ULLONG_MAX, ULLONG_MAX +ULONG_MAX, ULONG_MAX +USHRT_MAX, USHRT_MAX +WORD_BIT, WORD_BIT +CHARCLASS_NAME_MAX, CHARCLASS_NAME_MAX +NL_ARGMAX, NL_ARGMAX +ML_LANGMAX, NL_LANGMAX +NL_MSGMAX, NL_MSGMAX +NL_NMAX, NL_NMAX +NL_SETMAX, NL_SETMAX +NL_TEXTMAX, NL_TEXTMAX +NZERO, NZERO +%% +int +find_limit(const char *name, intmax_t *value) +{ + const struct map *rv; + + rv = in_word_set(name); + if (rv != NULL) { + if (rv->valid) { + *value = rv->value; + return 1; + } + return -1; + } + return 0; +} diff --git a/src/bin/getconf/pathconf.gperf b/src/bin/getconf/pathconf.gperf new file mode 100644 index 0000000..e8b8365 --- /dev/null +++ b/src/bin/getconf/pathconf.gperf @@ -0,0 +1,62 @@ +%{ +/* + * 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; }; +%% +FILESIZEBITS, _PC_FILESIZEBITS +LINK_MAX, _PC_LINK_MAX +MAX_CANON, _PC_MAX_CANON +MAX_INPUT, _PC_MAX_INPUT +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_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; +} diff --git a/src/bin/getconf/progenv.gperf b/src/bin/getconf/progenv.gperf new file mode 100644 index 0000000..40ce16a --- /dev/null +++ b/src/bin/getconf/progenv.gperf @@ -0,0 +1,67 @@ +%{ +/* + * 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); + +/* + * The Standard seems a bit ambiguous over whether the POSIX_V6_* + * are specified with or without a leading underscore, so we just + * use both. + */ +/* + * The alt_path member gives the path containing another `getconf' + * executable which was compiled using the specified programming + * environment. If it is NULL, the current executable is good enough. + * If we ever support multiple environments, this table will need to + * be updated. (We cheat here and define the supported environments + * statically.) + */ +#if defined(__alpha__) || defined(__sparc64__) || defined(__amd64__) +#define have_LP64_OFF64 NULL +#endif + +#if defined(__i386__) || defined(__powerpc__) +#define have_ILP32_OFFBIG NULL +#endif + +%} +struct map { const char *name; const char *alt_path; int valid; }; +%% +POSIX_V6_ILP32_OFF32, notdef +POSIX_V6_ILP32_OFFBIG, have_ILP32_OFFBIG +POSIX_V6_LP64_OFF64, have_LP64_OFF64 +POSIX_V6_LPBIG_OFFBIG, notdef +_POSIX_V6_ILP32_OFF32, notdef +_POSIX_V6_ILP32_OFFBIG, have_ILP32_OFFBIG +_POSIX_V6_LP64_OFF64, have_LP64_OFF64 +_POSIX_V6_LPBIG_OFFBIG, notdef +%% +int +find_progenv(const char *name, const char **alt_path) +{ + const struct map *rv; + + rv = in_word_set(name); + if (rv != NULL) { + if (rv->valid) { + *alt_path = rv->alt_path; + return 1; + } + return -1; + } + return 0; +} diff --git a/src/bin/getconf/sysconf.gperf b/src/bin/getconf/sysconf.gperf new file mode 100644 index 0000000..ae88464 --- /dev/null +++ b/src/bin/getconf/sysconf.gperf @@ -0,0 +1,149 @@ +%{ +/* + * 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; }; +%% +AIO_LISTIO_MAX, _SC_AIO_LISTIO_MAX +AIO_MAX, _SC_AIO_MAX +AIO_PRIO_DELTA_MAX, _SC_AIO_PRIO_DELTA_MAX +ARG_MAX, _SC_ARG_MAX +ATEXIT_MAX, _SC_ATEXIT_MAX +BC_BASE_MAX, _SC_BC_BASE_MAX +BC_DIM_MAX, _SC_BC_DIM_MAX +BC_SCALE_MAX, _SC_BC_SCALE_MAX +BC_STRING_MAX, _SC_BC_STRING_MAX +CHILD_MAX, _SC_CHILD_MAX +CLK_TCK, _SC_CLK_TCK +COLL_WEIGHTS_MAX, _SC_COLL_WEIGHTS_MAX +DELAYTIMER_MAX, _SC_DELAYTIMER_MAX +EXPR_NEST_MAX, _SC_EXPR_NEST_MAX +GETGR_R_SIZE_MAX, _SC_GETGR_R_SIZE_MAX +GETPW_R_SIZE_MAX, _SC_GETPW_R_SIZE_MAX +HOST_NAME_MAX, _SC_HOST_NAME_MAX +IOV_MAX, _SC_IOV_MAX +LINE_MAX, _SC_LINE_MAX +LOGIN_NAME_MAX, _SC_LOGIN_NAME_MAX +MQ_OPEN_MAX, _SC_MQ_OPEN_MAX +MQ_PRIO_MAX, _SC_MQ_PRIO_MAX +NGROUPS_MAX, _SC_NGROUPS_MAX +NPROCESSORS_CONF, _SC_NPROCESSORS_CONF +NPROCESSORS_ONLN, _SC_NPROCESSORS_ONLN +OPEN_MAX, _SC_OPEN_MAX +PAGESIZE, _SC_PAGESIZE +PAGE_SIZE, _SC_PAGESIZE +PASS_MAX, _SC_PASS_MAX +PTHREAD_DESTRUCTOR_ITERATIONS, _SC_THREAD_DESTRUCTOR_ITERATIONS +PTHREAD_KEYS_MAX, _SC_THREAD_KEYS_MAX +PTHREAD_STACK_MIN, _SC_THREAD_STACK_MIN +PTHREAD_THREADS_MAX, _SC_THREAD_THREADS_MAX +RE_DUP_MAX, _SC_RE_DUP_MAX +RTSIG_MAX, _SC_RTSIG_MAX +SEM_NSEMS_MAX, _SC_SEM_NSEMS_MAX +SEM_VALUE_MAX, _SC_SEM_VALUE_MAX +SIGQUEUE_MAX, _SC_SIGQUEUE_MAX +STREAM_MAX, _SC_STREAM_MAX +SYMLOOP_MAX, _SC_SYMLOOP_MAX +TIMER_MAX, _SC_TIMER_MAX +TTY_NAME_MAX, _SC_TTY_NAME_MAX +TZNAME_MAX, _SC_TZNAME_MAX +_POSIX2_CHAR_TERM, _SC_2_CHAR_TERM +_POSIX2_C_BIND, _SC_2_C_BIND +_POSIX2_C_DEV, _SC_2_C_DEV +_POSIX2_C_VERSION, _SC_2_C_VERSION +_POSIX2_FORT_DEV, _SC_2_FORT_DEV +_POSIX2_FORT_RUN, _SC_2_FORT_RUN +_POSIX2_LOCALEDEF, _SC_2_LOCALEDEF +_POSIX2_SW_DEV, _SC_2_SW_DEV +_POSIX2_UPE, _SC_2_UPE +_POSIX2_VERSION, _SC_2_VERSION +_POSIX_ASYNCHRONOUS_IO, _SC_ASYNCHRONOUS_IO +_POSIX_BARRIERS, _SC_BARRIERS +_POSIX_CLOCK_SELECTION, _SC_CLOCK_SELECTION +_POSIX_CPUTIME, _SC_CPUTIME +_POSIX_FILE_LOCKING, _SC_FILE_LOCKING +_POSIX_FSYNC, _SC_FSYNC +_POSIX_IPV6, _SC_IPV6 +_POSIX_JOB_CONTROL, _SC_JOB_CONTROL +_POSIX_MAPPED_FILES, _SC_MAPPED_FILES +_POSIX_MEMLOCK, _SC_MEMLOCK +_POSIX_MEMLOCK_RANGE, _SC_MEMLOCK_RANGE +_POSIX_MEMORY_PROTECTION, _SC_MEMORY_PROTECTION +_POSIX_MESSAGE_PASSING, _SC_MESSAGE_PASSING +_POSIX_MONOTONIC_CLOCK, _SC_MONOTONIC_CLOCK +_POSIX_PRIORITIZED_IO, _SC_PRIORITIZED_IO +_POSIX_PRIORITY_SCHEDULING, _SC_PRIORITY_SCHEDULING +_POSIX_READER_WRITER_LOCKS, _SC_READER_WRITER_LOCKS +_POSIX_REALTIME_SIGNALS, _SC_REALTIME_SIGNALS +_POSIX_REGEXP, _SC_REGEXP +_POSIX_SAVED_IDS, _SC_SAVED_IDS +_POSIX_SEMAPHORES, _SC_SEMAPHORES +_POSIX_SHARED_MEMORY_OBJECTS, _SC_SHARED_MEMORY_OBJECTS +_POSIX_SHELL, _SC_SHELL +_POSIX_SPAWN, _SC_SPAWN +_POSIX_SPIN_LOCKS, _SC_SPIN_LOCKS +_POSIX_SPORADIC_SERVER, _SC_SPORADIC_SERVER +_POSIX_SYNCHRONIZED_IO, _SC_SYNCHRONIZED_IO +_POSIX_THREADS, _SC_THREADS +_POSIX_THREAD_ATTR_STACKADDR, _SC_THREAD_ATTR_STACKADDR +_POSIX_THREAD_ATTR_STACKSIZE, _SC_THREAD_ATTR_STACKSIZE +_POSIX_THREAD_CPUTIME, _SC_THREAD_CPUTIME +_POSIX_THREAD_PRIORITY_SCHEDULING, _SC_THREAD_PRIORITY_SCHEDULING +_POSIX_THREAD_PRIO_INHERIT, _SC_THREAD_PRIO_INHERIT +_POSIX_THREAD_PRIO_PROTECT, _SC_THREAD_PRIO_PROTECT +_POSIX_THREAD_PROCESS_SHARED, _SC_THREAD_PROCESS_SHARED +_POSIX_THREAD_SAFE_FUNCTIONS, _SC_THREAD_SAFE_FUNCTIONS +_POSIX_THREAD_SPORADIC_SERVER, _SC_THREAD_SPORADIC_SERVER +_POSIX_TIMEOUTS, _SC_TIMEOUTS +_POSIX_TRACE, _SC_TRACE +_POSIX_TRACE_EVENT_FILTER, _SC_TRACE_EVENT_FILTER +_POSIX_TRACE_INHERIT, _SC_TRACE_INHERIT +_POSIX_TRACE_LOG, _SC_TRACE_LOG +_POSIX_TIMERS, _SC_TIMERS +_POSIX_TYPED_MEMORY_OBJECTS, _SC_TYPED_MEMORY_OBJECTS +_POSIX_VERSION, _SC_VERSION +_POSIX_V6_ILP32_OFF32, _SC_V6_ILP32_OFF32 +_POSIX_V6_ILP32_OFFBIG, _SC_V6_ILP32_OFFBIG +_POSIX_V6_LP64_OFF64, _SC_V6_LP64_OFF64 +_POSIX_V6_LP64_OFFBIG, _SC_V6_LP64_OFFBIG +_XOPEN_CRYPT, _SC_XOPEN_CRYPT +_XOPEN_ENH_I18N, _SC_XOPEN_ENH_I18N +_XOPEN_LEGACY, _SC_XOPEN_LEGACY +_XOPEN_REALTIME, _SC_XOPEN_REALTIME +_XOPEN_REALTIME_THREADS, _SC_XOPEN_REALTIME_THREADS +_XOPEN_SHM, _SC_XOPEN_SHM +_XOPEN_UNIX, _SC_XOPEN_UNIX +_XOPEN_VERSION, _SC_XOPEN_VERSION +_XOPEN_XCU_VERSION, _SC_XCU_VERSION +%% +int +find_sysconf(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; +} ############################################################################ Commit: d86dbc8a89dca0156b483e6643f3652055e6f01e URL: http://cgit.haiku-os.org/haiku/commit/?id=d86dbc8 Author: François Revol <revol@xxxxxxx> Date: Fri Dec 27 18:47:41 2013 UTC Mention getconf in FreeBSD sections in the credits. ---------------------------------------------------------------------------- diff --git a/src/apps/aboutsystem/AboutSystem.cpp b/src/apps/aboutsystem/AboutSystem.cpp index e3224b3..1ae1d44 100644 --- a/src/apps/aboutsystem/AboutSystem.cpp +++ b/src/apps/aboutsystem/AboutSystem.cpp @@ -1345,7 +1345,7 @@ AboutView::_CreateCreditsView() AddCopyrightEntry("The FreeBSD Project", B_TRANSLATE("Contains software from the FreeBSD Project, " "released under the BSD license:\n" - "cal, ftpd, ping, telnet, " + "cal, ftpd, getconf, ping, telnet, " "telnetd, traceroute\n" COPYRIGHT_STRING "1994-2008 The FreeBSD Project. " "All rights reserved."), ############################################################################ Commit: c229671d8e28fbe5c81de0a10f83b22bf93a4261 URL: http://cgit.haiku-os.org/haiku/commit/?id=c229671 Author: François Revol <revol@xxxxxxx> Date: Fri Dec 27 18:49:17 2013 UTC Add getconf to the image ---------------------------------------------------------------------------- diff --git a/build/jam/images/HaikuImage b/build/jam/images/HaikuImage index 4b7de4a..66a93c4 100644 --- a/build/jam/images/HaikuImage +++ b/build/jam/images/HaikuImage @@ -14,7 +14,8 @@ SYSTEM_BIN = [ FFilterByBuildFeatures echo eject env error expand expr factor false fdinfo ffm filepanel find finddir findpaths FirstBootPrompt fmt fold fortune frcode fstrim ftp ftpd funzip fwcontrol@x86 - gawk gdb@x86 getarch getlimits groupadd groupdel groupmod groups gzip gzexe + gawk gdb@x86 getarch getconf getlimits groupadd groupdel groupmod groups + gzip gzexe hd head hey hostname id ident ifconfig <bin>install installsound iroster isvolume ideinfo@ide idestatus@ide ############################################################################ Revision: hrev46604 Commit: 5558efa4ce4055b69dc416b8a9a480a229b2f3da URL: http://cgit.haiku-os.org/haiku/commit/?id=5558efa Author: François Revol <revol@xxxxxxx> Date: Fri Dec 27 18:57:45 2013 UTC Provide cmd:getconf in haiku package ---------------------------------------------------------------------------- diff --git a/src/data/package_infos/arm/haiku b/src/data/package_infos/arm/haiku index ab79efc..32a9762 100644 --- a/src/data/package_infos/arm/haiku +++ b/src/data/package_infos/arm/haiku @@ -64,6 +64,7 @@ provides { cmd:funzip cmd:gawk cmd:gdb + cmd:getconf cmd:getlimits cmd:groups cmd:gunzip diff --git a/src/data/package_infos/m68k/haiku b/src/data/package_infos/m68k/haiku index 9a431ab..4899f0a 100644 --- a/src/data/package_infos/m68k/haiku +++ b/src/data/package_infos/m68k/haiku @@ -64,6 +64,7 @@ provides { cmd:funzip cmd:gawk cmd:gdb + cmd:getconf cmd:getlimits cmd:groups cmd:gunzip diff --git a/src/data/package_infos/ppc/haiku b/src/data/package_infos/ppc/haiku index e4b4ed1..43c797d 100644 --- a/src/data/package_infos/ppc/haiku +++ b/src/data/package_infos/ppc/haiku @@ -64,6 +64,7 @@ provides { cmd:funzip cmd:gawk cmd:gdb + cmd:getconf cmd:getlimits cmd:groups cmd:gunzip diff --git a/src/data/package_infos/x86/haiku b/src/data/package_infos/x86/haiku index ed7c838..b7f5f90 100644 --- a/src/data/package_infos/x86/haiku +++ b/src/data/package_infos/x86/haiku @@ -64,6 +64,7 @@ provides { cmd:funzip cmd:gawk cmd:gdb + cmd:getconf cmd:getlimits cmd:groups cmd:gunzip diff --git a/src/data/package_infos/x86_64/haiku b/src/data/package_infos/x86_64/haiku index 87a73ba..9c89833 100644 --- a/src/data/package_infos/x86_64/haiku +++ b/src/data/package_infos/x86_64/haiku @@ -63,6 +63,7 @@ provides { cmd:funzip cmd:gawk cmd:gdb + cmd:getconf cmd:getlimits cmd:groups cmd:gunzip diff --git a/src/data/package_infos/x86_gcc2/haiku b/src/data/package_infos/x86_gcc2/haiku index 553eccb..17b1824 100644 --- a/src/data/package_infos/x86_gcc2/haiku +++ b/src/data/package_infos/x86_gcc2/haiku @@ -64,6 +64,7 @@ provides { cmd:funzip cmd:gawk cmd:gdb + cmd:getconf cmd:getlimits cmd:groups cmd:gunzip