summaryrefslogtreecommitdiffstats
path: root/bin
Commit message (Collapse)AuthorAgeFilesLines
...
* Make setfacl(1) behave properly in situations like "setfacl -kd".trasz2012-09-041-0/+15
| | | | MFC after: 1 month
* Fix compact form of "synchronize" permission in setfacl(1) manual page - ittrasz2012-09-031-2/+2
| | | | | | | should be "s", not "S". PR: docs/162380 MFC after: 2 weeks
* Rework all non-contributed files that use `struct timezone'.ed2012-09-013-7/+7
| | | | | | | | | | | | | | This structure is not part of POSIX. According to POSIX, gettimeofday() has the following prototype: int gettimeofday(struct timeval *restrict tp, void *restrict tzp); Also, POSIX states that gettimeofday() shall return 0 (as long as tzp is not used). Remove dead error handling code. Also use NULL for a nul-pointer instead of integer 0. While there, change all pieces of code that only use tv_sec to use time(3), as this provides less overhead.
* Add a -h flag similar to the -h flag for ln to force mv(1) to treat ajhb2012-08-312-6/+36
| | | | | | | | | symbolic link to a directory for the target as a symbolic link instead of a directory. This makes it possible to atomically update a symbolic link using rename(). Reviewed by: gj MFC after: 2 weeks
* Avoid passing uninitialized stack to addelem() if called with an empty arg.emaste2012-08-291-2/+2
| | | | PR: bin/171174
* sh: Fix EINTR race condition in "wait" and "set -T" using sigsuspend().jilles2012-07-293-4/+49
| | | | | | | | | | | | | | | | | When waiting for child processes using "wait" or if "set -T" is in effect, a signal interrupts the wait. Make sure there is no window where the signal handler may be invoked (setting a flag) just before going to sleep. There is a similar race condition in the shell language, but scripts can avoid it by exiting from the trap handler or enforcing synchronization using a fifo. If SIGCHLD is not trapped, a signal handler must be installed for it. Only install this handler for the duration of the wait to avoid triggering unexpected [EINTR] errors elsewhere. Note that for some reason only SIGINT and SIGQUIT interrupt a "wait" command. This remains the case.
* sh: Do not ask for stopped/continued processes if we do not need themjilles2012-07-281-6/+5
| | | | rather than retrying wait3 if they happen.
* sh: Inline waitproc() into its only caller.jilles2012-07-281-22/+9
|
* sh: Track continued jobs (even if not continued by bg or fg).jilles2012-07-281-3/+8
| | | | | | | This uses wait3's WCONTINUED flag. There is no message for this. The change is visible in "jobs" or if the job stops again.
* Use proper error message when fstat(2) fails on stdout.jh2012-07-201-1/+1
| | | | | PR: bin/159746 Submitted by: Alex K.
* style(9).jh2012-07-201-16/+19
|
* stty: Mark usage() __dead2.jilles2012-07-151-1/+1
| | | | This reduces code size a little and should fix a scan-build warning.
* ps: Fix memory leak when showing start/lstart for swapped-out process.jilles2012-07-151-4/+6
| | | | Spotted by: scan-build (uqs)
* sh: Reset pendingsigs before checking pending traps, not after.jilles2012-07-151-1/+1
| | | | | Otherwise, a signal arriving at exactly the right moment might not be processed until another signal arrived.
* sh: Remove unused variable in_dowait.jilles2012-07-152-4/+0
|
* sh: Expand assignment-like words specially for export/readonly/local.jilles2012-07-154-4/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | Examples: export x=~ now expands the tilde local y=$1 is now safe, even if $1 contains IFS characters or metacharacters. For a word to "look like an assignment", it must start with a name followed by an equals sign, none of which may be quoted. The special treatment applies when the first word (potentially after "command") is "export", "readonly" or "local". There may be quoting characters but no expansions. If "local" is overridden with a function there is no special treatment ("export" and "readonly" cannot be overridden with a function). If things like local arr=(1 2 3) are ever allowed in the future, they cannot call a "local" function. This would either be a run-time error or it would call the builtin. This matches Austin Group bug #351, planned for the next issue of POSIX.1. PR: bin/166771
* Merge libedit adjustment from NetBSD.pfg2012-07-111-1/+1
| | | | | | | | | | | | | On recent versions of NetBSD's libedit, el_gets now sets el_len to -1 on error so we can distinguish between a NULL string and an error. This fixes sh from exiting with newer versions of libedit now allowing EINTR to return. Obtained from: NetBSD Reviewed by: jilles MFC after: 3 weeks
* Polish previous revision: if the fts_* routines have lstat()'ed thedelphij2012-06-201-2/+8
| | | | | | | | | directory entry then use the struct stat from that instead of doing it again, and skip the rm_overwrite() call if fts_read() indicated that the entry couldn't be a regular file. Obtained from: OpenBSD MFC after: 1 week
* Fix potential symlink race condition in "rm -P" by adding a checkkevlo2012-06-201-2/+9
| | | | | | | that the file we have opened is the one we expected. Also open in non-blocking mode to avoid a potential hang with FIFOs. Obtained from: NetBSD via OpenBSD
* None of these programs actually use auth.conf.des2012-06-111-6/+0
| | | | MFC after: 1 week
* Work better with how make/bmake works:marcel2012-05-242-9/+9
| | | | | | | | | | | | 1. Avoid a cd back into ${.CURDIR} to run mkbuiltins when we know make will first cd into ${.OBJDIR}. Keep the cwd to what make sets it to. 2. Don't tell mkbuiltins where to write to (= ${.OBJDIR}), but where to get sources from (= ${.CURDIR}). This to compensate for point 1. This fixes a problem with bmake's mk files that optimize ${.OBJDIR} to expand to "." after changing cwd, not taking into account that the target is pretty much undoing that and not getting the full path to the object tree anymore.
* Add 'cow' keyword to show per-process cow count.kib2012-05-232-1/+4
| | | | | Submitted by: Andrey Zonov <andrey zonov org> MFC after: 1 week
* Mention the upper hard limit for -n option. Patch slightly modifiedwblock2012-05-231-3/+6
| | | | | | | | | from PR version. PR: 168255 Submitted by: Andy Kosela Approved by: gjb MFC after: 3 days
* Remove redundant declaration of yyparsekevlo2012-05-221-1/+0
| | | | Reported by: tinderbox
* Add build opton MK_LS_COLORS to control whether ls(1) supports colorsmarcel2012-05-191-1/+4
| | | | | | | (and thus needs to depend on libtermcap). Embedded systems may not want or need colors. Obtained from: Juniper Networks, Inc.
* Add build option MK_ED_CRYPTO to control whether ed(1) is to have themarcel2012-05-191-3/+3
| | | | | | | ability to encrypt/decrypt files. Embedded systems can typically have OpenSSL, but not for ed(1) to use it. Obtained from: Juniper Networks, Inc.
* Remove unused header (libutil.h)marcel2012-05-171-1/+0
|
* sh: Remove an unused header.jilles2012-05-151-1/+0
| | | | The read builtin no longer does things with termios.
* Minor mdoc nits.joel2012-05-133-4/+4
|
* I forgot to bump the manpage date.mdf2012-05-121-1/+1
| | | | | | Reminded by: Garrett Cooper MFC after: 3 days X-MFC-with: r235297
* Add a -v and -N option to kenv(1), so it can be more easily used inmdf2012-05-112-9/+35
| | | | | | | | | | | scripts the way sysctl(8) is. The -N option, like in sysctl(8), displays only the kenv names, not their values. The -v option prints an individual kenv variable name with its value as name="value". This is the inverse of sysctl(8)'s -n flag, since the default behaviour of kenv(1) is already like sysctl(8) -n. Submitted by: Garrett Cooper < yanegomi AT gmail DOT com > MFC after: 1 week
* mdoc: fix column names, indentation, column separation within each row, andjoel2012-04-072-2/+2
| | | | | | | quotation. Also make sure we have the same amount of columns in each row as the number of columns we specify in the head arguments. Reviewed by: brueffer
* sh: Fix build with -DDEBUG=2.jilles2012-04-021-2/+2
| | | | | Reported by: Kristof Provost MFC after: 1 week
* mandoc complains loudly when <TAB>s are misused in columnated lists. Fixjoel2012-03-291-31/+31
| | | | | this syntax violation and while I'm here also convert <TAB> to Ta and adjust quotation marks in order to prevent this problem in the future.
* Remove trailing whitespace per mdoc lint warningeadler2012-03-293-3/+3
| | | | | | | Disussed with: gavin No objection from: doc Approved by: joel MFC after: 3 days
* Remove superfluous paragraph macro.joel2012-03-254-6/+0
|
* rm[0].rm_so must be zero (an explicit check is made for zero in theeadler2012-03-191-1/+1
| | | | | | | outer if condition) Reviewed by: se Approved by: cperciva
* Document P_ORPHAN.kib2012-03-081-1/+2
| | | | MFC after: 3 days
* Bump date to today (since I modified it)eadler2012-03-031-1/+1
| | | | | | PR: bin/165321 Approved by: gjb MFC after: 3 days
* Direct users to swapinfo and pstat from dfeadler2012-03-031-0/+2
| | | | | | | PR: bin/165321 Submitted by: jhs Approved by: bcr MFC after: 3 days
* Whitespace cleanup:gjb2012-02-251-2/+4
| | | | | | | | | o Wrap sentences on to new lines o Cleanup trailing whitespace Found with: textproc/igor MFC after: 1 week X-MFC-With: r232157
* Fix various typos in manual pages.gjb2012-02-251-3/+3
| | | | | | Submitted by: amdmi3 PR: 165431 MFC after: 1 week
* Update to tcsh 6.18.01.mp2012-02-224-1169/+61
|
* sh: Make 'hash' return 1 if at least one utility is not found.jilles2012-02-111-8/+12
| | | | Reported by: lme
* sh: Fix swapped INTON/INTOFF.jilles2012-02-041-2/+2
| | | | | | | A possible consequence of this bug was a memory leak if SIGINT arrived during a 'set' command (listing variables). MFC after: 1 week
* sh: Use vfork in a few common cases.jilles2012-02-045-0/+64
| | | | | | | | | | | | | | | | | This uses vfork() for simple commands and command substitutions containing a single simple command, invoking an external program under certain conditions (no redirections or variable assignments, non-interactive shell, no job control). These restrictions limit the amount of code executed in a vforked child. There is a large speedup (for example 35%) in microbenchmarks. The difference in buildkernel is smaller (for example 0.5%) but still statistically significant. See http://lists.freebsd.org/pipermail/freebsd-hackers/2012-January/037581.html for some numbers. The use of vfork() can be disabled by setting a variable named SH_DISABLE_VFORK.
* Add prototypes, ANSIfy functions definitions to reduce WARNS=6 output.charnier2012-01-255-5/+6
|
* sh: Fix $? in the first command of a 'for'.jilles2012-01-221-1/+4
| | | | | | In the first command of a 'for', $? should be the exit status of the last pipeline (command substitution in the word list or command before 'for'), not always 0.
* sh: Remove "kill" example function, which is superseded by the kill builtinjilles2012-01-211-49/+0
| | | | MFC after: 1 week
* Remove unused variables.ed2012-01-171-96/+30
| | | | | Simply annotate the function parameters with __unused, instead of adding the ve-variables. This makes the code build with GCC 4.7 and -Werror.
OpenPOWER on IntegriCloud