aboutsummaryrefslogtreecommitdiff
path: root/bin
Commit message (Collapse)AuthorAgeFilesLines
* rm, find -delete: fix removing symlinks with uchg/uappnd set.Jilles Tjoelker2009-05-301-3/+3
| | | | | | | | | | | | | | | Formerly, this tried to clear the flags on the symlink's target instead of the symlink itself. As before, this only happens for root or for the unlink(1) variant of rm. PR: bin/111226 (part of) Submitted by: Martin Kammerhofer Approved by: ed (mentor) MFC after: 3 weeks Notes: svn path=/head/; revision=193087
* Preserve file flags on symlinks in cp -Rp.Jilles Tjoelker2009-05-301-1/+1
| | | | | | | | | | | | This reported ENOSYS before. PR: bin/111226 (part of) Submitted by: Martin Kammerhofer Approved by: ed (mentor) MFC after: 3 weeks Notes: svn path=/head/; revision=193086
* Fix various cases with 3 or 4 parameters in test(1) to be POSIX compliant.Jilles Tjoelker2009-05-262-9/+99
| | | | | | | | | | | | | | | | | | | | | More precisely, this gives precedence to an interpretation not using the '(', ')', '-a' and '-o' in their special meaning, if possible. For example, it is now safe to write [ "$a" = "$b" ] and assume it compares the two strings. The man page already says that test(1) works this way, so does not need to be changed. Interpretation of input with more parameters tries a bit harder to find a valid parse in some cases. Add various additional test cases to TEST.sh. PR: standards/133369 Approved by: ed (mentor) Notes: svn path=/head/; revision=192862
* Fix elapsed (etime) field for swapped out processes in ps:Jilles Tjoelker2009-05-241-0/+4
| | | | | | | | | | | | show '-' instead of time since the Epoch. PR: bin/123069 Submitted by: Vladimir Kozbin Approved by: ed (mentor) MFC after: 3 weeks Notes: svn path=/head/; revision=192688
* Fix chflags -h in various cases: do not use link target's flags as original.Jilles Tjoelker2009-05-241-1/+1
| | | | | | | | | | | | Patch slightly changed to align more with chmod.c. PR: bin/131999 Submitted by: bde Approved by: ed (mentor) MFC after: 3 weeks Notes: svn path=/head/; revision=192687
* Make 'struct acl' larger, as required to support NFSv4 ACLs. ProvideEdward Tomasz Napierala2009-05-221-1/+1
| | | | | | | | | compatibility interfaces in both kernel and libc. Reviewed by: rwatson Notes: svn path=/head/; revision=192586
* Remove redundant whitespaceBrian Somers2009-05-181-3/+2
| | | | Notes: svn path=/head/; revision=192280
* When finding processes, ignore ourself and our ancestors. It is almostBrian Somers2009-05-172-5/+40
| | | | | | | | | | | | always surprising when you kill a 'sh -c ...' ancestor or when you kill yourself when using -f. Add a -a switch for backwards compatibility. MFC after: 3 weeks Notes: svn path=/head/; revision=192242
* Add a -d option to ps to display descendant info with the output.Brian Somers2009-05-174-15/+167
| | | | | | | | | This is similar to linux's -H (or -f) switch. MFC after: 3 weeks Notes: svn path=/head/; revision=192239
* Implement ^T support for rm: now it will report the next file itWarner Losh2009-04-291-0/+29
| | | | | | | | | removes when you hit ^T. This is similar to what's done for cp. The signal handler and type definitions for "info" were borrowed directly from cp. Notes: svn path=/head/; revision=191670
* Parse 'cmd1 && ! cmd2 | cmd3' correctly, the bang should apply to the entireStefan Farfeleder2009-04-131-0/+1
| | | | | | | | | | pipeline cmd2 | cmd3 and not just cmd2. PR: 130298 Submitted by: Jilles Tjoelker Notes: svn path=/head/; revision=191009
* Add reference to strmode(3).Edward Tomasz Napierala2009-04-131-0/+1
| | | | Notes: svn path=/head/; revision=191003
* Don't let trailing empty lines overwrite the result of the last command with 0.Stefan Farfeleder2009-04-041-1/+2
| | | | | | | | | | This affects the built-ins eval, fc, and trap and also the string passed to sh with the -c option. Submitted by: Jilles Tjoelker Notes: svn path=/head/; revision=190698
* Fix the behaviour of the read built-in when IFS is unset.Stefan Farfeleder2009-03-221-1/+1
| | | | | | | Obtained from: NetBSD Notes: svn path=/head/; revision=190298
* Improve the IFS handling of the read built-in.Stefan Farfeleder2009-03-221-10/+68
| | | | | | | | Obtained from: NetBSD Submitted by: Jilles Tjoelker Notes: svn path=/head/; revision=190295
* - Apply the r190270 changes to printing of single aliases too.Stefan Farfeleder2009-03-221-23/+48
| | | | | | | - Sort the aliases before printing them. Notes: svn path=/head/; revision=190284
* Make the output of the alias built-in POSIX-compliant: Drop the leading 'alias'Stefan Farfeleder2009-03-221-1/+6
| | | | | | | and suppress printing the trailing space which is added for internal purposes. Notes: svn path=/head/; revision=190270
* cat(1) compiles fine at WARNS level 6.Dag-Erling Smørgrav2009-03-161-0/+1
| | | | Notes: svn path=/head/; revision=189875
* Don't disable CR-to-NL translation when waiting for data to arrive.Ed Schouten2009-03-081-0/+1
| | | | | | | | | | | | | | | | | | | A difference between the old and the new TTY layer is that the new implementation does not perform any post-processing before returning data back to userspace when calling read(). sh(1)'s read turns the TTY into a raw mode before calling select(). This means that the first character will not receive any ICRNL processing. Inherit this flag from the original terminal attributes. Even though this issue is not present on RELENG_*, I'm MFCing it to make sh(1) in jails behave better. PR: bin/129566 MFC after: 2 weeks Notes: svn path=/head/; revision=189542
* [1] When showing threads, the thread name just appears if the commAttilio Rao2009-02-263-11/+37
| | | | | | | | | | | | | | | | | | | | | | label is choosen as last printout (ucomm suffers of this such bug too). That bug is caused by the fact that the fixed size of printout doesn't leave enough space for them to be printed out. Implement ucomm and comm commands with a dynamic size lenght for buffers. [2] On AMD64 architecture pointers don't have enough chars space to be shown (8 chars while they need 16). Fix them by providing a variadic space so that it fits well on both 64 and 32 bits architectures. [3] Check a return value of malloc() that wasn't checked before. PR: bin/128841, bin/128842 Reviewed by: jhb, emaste Sponsored by: Sandvine Incorporated Notes: svn path=/head/; revision=189078
* Before this fix, pax would stop the restore sequence forTim Kientzle2009-02-011-36/+4
| | | | | | | | | | | | | | | | symlinks after setting the owner. As a result, mode and timestamp were not restored. This patch corrects the problem by simply removing the short-circuit for symlinks and using lchown()/lchmod()/lutimes() always for restoring metadata. PR: bin/91316 Submitted by: Jaakko Heinonen Reviewed by: Joerg Sonnenberger MFC after: 14 days Notes: svn path=/head/; revision=187976
* Bump .Dd for r187609Giorgos Keramidas2009-01-301-1/+1
| | | | Notes: svn path=/head/; revision=187922
* Make the Monty Python quote more google friendly instead ofTom Rhodes2009-01-261-3/+2
| | | | | | | | | hacking it apart. Discussed with: Christoph Mallon <christoph.mallon@gmx.de> Notes: svn path=/head/; revision=187734
* Note the implication of setting the 'w' permission on directories,Tom Rhodes2009-01-231-2/+7
| | | | | | | | | | | while here, expand the 'naughty bits' comment in BUGS. PR: 84265 and 84268 Reviewed by: keramida Obtained from: hints from ceri, keramida Notes: svn path=/head/; revision=187627
* Add an example of using bs=2048 to duplicate data CD-ROMs.Giorgos Keramidas2009-01-231-0/+5
| | | | | | | | | | | | | | This should be a bit useful for users who look at the manpage and then try to copy data CD-ROM disks using dd. A lot of us know that bs=2048 is required, but it still manages to cause a bit of grief to those who haven't heard about it. PR: bin/130857 Submitted by: Tri Brotoharsono < mail at tribrotoharsono.net > MFC after: 3 days Notes: svn path=/head/; revision=187609
* o Fix a typo. Bump .Dd for the previous delta.Maxim Konovalov2009-01-131-2/+2
| | | | Notes: svn path=/head/; revision=187159
* Clean up a bit of confusing language and improve .Nd.Tom Rhodes2009-01-131-4/+9
| | | | | | | | PR: 47818 Reviewed by: keramida Notes: svn path=/head/; revision=187148
* fix typoLuigi Rizzo2009-01-131-1/+1
| | | | | | | Submitted by: Colin Percival Notes: svn path=/head/; revision=187145
* Document how kernel environment can be statically compiled in,Luigi Rizzo2009-01-131-0/+20
| | | | | | | | | and reference a few related manpages. MFC after: 3 days Notes: svn path=/head/; revision=187142
* - rename the RETURN VALUES section to EXIT STATUSDaniel Gerzo2009-01-071-1/+1
| | | | | | | | | | - not bumping a date as this is not a real content change Approved by: ru MFC after: 3 days Notes: svn path=/head/; revision=186849
* Report error messages of the builtins 'type' and 'command -V' to stderr insteadStefan Farfeleder2008-11-281-12/+11
| | | | | | | | | of stdout. Noticed by: Zajcev Evgeny Notes: svn path=/head/; revision=185401
* Fix $? at the first command of a function. The previous exit status was savedStefan Farfeleder2008-11-231-0/+1
| | | | | | | twice and thus lost. Notes: svn path=/head/; revision=185231
* Implement -T option as found in Linux df(1). When given, file system typePawel Jakub Dawidek2008-11-232-7/+19
| | | | | | | | | | will be included in output. Reviewed and tested by: keramida MFC after: 2 weeks Notes: svn path=/head/; revision=185200
* Fix whitespace.Ed Maste2008-11-131-3/+2
| | | | Notes: svn path=/head/; revision=184925
* When running a "chio return" operation using a physical source unitJoerg Wunsch2008-10-301-4/+6
| | | | | | | | | | | | | | | rather than a voltag name, do not set the CESR_VOLTAGS flags in the CHIOGSTATUS command requesting the current status. As voltags are an optional feature that must be handled as "reserved" by media changers not implementing the feature, always setting CESR_VOLTAGS resulted in the command being aborted with an `Invalid field in CDB', and consequently the "chio return" failed, for media changers that do not support voltags. MFC after: 1 week Notes: svn path=/head/; revision=184484
* Teach cat(1) and cp(1) to use a larger buffer if enough memory is presentIvan Voras2008-10-302-4/+50
| | | | | | | | | | | | | | | | | | | | | | | | in the system. A simple heuristics is used to detect what is "enough" memory: if number of physmem pages is greater than 32k (equalling 128 MB on machines with 4 kB pages). Typical immediate result of these changes is reduction in context switches and the goal is to increase efficiency by using large buffers: before: /usr/bin/time -hlp cat file1 > file2 ... 163 voluntary context switches 11194 involuntary context switches after: /usr/bin/time -hlp ./cat file1 > file2 ... 417 voluntary context switches 272 involuntary context switches Reviewed by: hackers@ (no objections to earlier version of cat patch) Approved by: gnn (mentor) MFC after: 4 months Notes: svn path=/head/; revision=184471
* Remove superfluous va_end which was left there in rev 1.38.Roman Divacky2008-10-281-2/+0
| | | | | | | Approved by: kib (mentor) Notes: svn path=/head/; revision=184418
* Add fallback when mmap fails on regular files. Some filesystems,Diomidis Spinellis2008-10-271-30/+28
| | | | | | | | | | like smbnetfs, do not support mmap. Reported by: Harti Brandt MFC after: 1 month Notes: svn path=/head/; revision=184342
* Improve the `pkill -t' handling, which I changed in my previous commit.Ed Schouten2008-09-302-11/+14
| | | | | | | | | | | | In my previous commit I disabled pkill(1)'s automatic prepending of the "tty" string when `pkill -t' was being used. Re-enable it and stat() both possible device names when called. Requested by: jhb, rwatson (MFC) MFC after: 1 month Notes: svn path=/head/; revision=183502
* Don't automatically prepend the "tty" prefix to `pkill -t' arguments.Ed Schouten2008-09-282-9/+5
| | | | | | | | | | | | | Because we now enforce UNIX98-style PTY's, we now use a lot of TTY's that don't have the traditional /dev/ttyXX naming scheme. pkill(1)'s -t flag automatically prepended the word "tty" to each TTY that was passed on the command line. This meant that `pkill -t pts/0' was actually converted to /dev/ttypts/0. Disable this broken behaviour for now. Reported by: erwin Notes: svn path=/head/; revision=183438
* Remove redundant close(2).Edward Tomasz Napierala2008-09-091-1/+0
| | | | | | | | Submitted by: kensmith Approved by: rwatson (mentor) Notes: svn path=/head/; revision=182889
* Fix double free in setfacl(1). Description from the author:Edward Tomasz Napierala2008-09-061-4/+6
| | | | | | | | | | | | | | | | | Initially, 'acl' (an 'acl_t *') is allocated, and its ACCESS_ACL and DEFAULT_ACL fields are passed to the 'libc' ACL routines for subsequent allocation. If the '-m' option (merge existing ACL with a new one) is specified, then 'set_acl_mask()' will be called and passed one of the two ACLs. This function, in turn, replaces this given ACL structure by another, freshly allocated. However, the pointer in the 'acl' variable in the caller is not updated. The caller then proceeds to free the ACL, incurring in a double free condition. Submitted by: Pedro Martelletto <pedro at ambientworks.net> Approved by: rwatson (mentor) Notes: svn path=/head/; revision=182813
* pkill(1) first appeared in /usr/bin, but later it was moved to /binYaroslav Tykhiy2008-08-314-0/+1062
| | | | | | | | | | for the convenience of rc.d. Now it has happily lived there for quite a while. So move the pkill(1) source files from usr.bin to bin, too. Approved by: gad Notes: svn path=/head/; revision=182543
* Document the ulimit -p option in the sh(1) manual page.Ed Schouten2008-08-301-1/+3
| | | | | | | | | | When I imported the MPSAFE TTY code, I added the -p flag to sh(1)'s ulimit, but I forgot to document it in the appropriate manual page. Requested by: stefanf Notes: svn path=/head/; revision=182489
* Fix a bug in r177497 which caused the getopts state to be reset when 'set'Stefan Farfeleder2008-08-271-1/+1
| | | | | | | | | was used to set a shell option (and not to change the positional parameters). Submitted by: Martin Kammerhofer Notes: svn path=/head/; revision=182300
* Make stty(1) use tab0 and tab3 to handle tab completion.Ed Schouten2008-08-233-8/+23
| | | | | | | | | | | | | After the MPSAFE TTY import, we have support for the TAB0 and TAB3 flags to handle tab expansion, while we only used to support OXTABS. Switch stty(1) to use tab0 and tab3 to print whether tab expansion is turned on or off. Implement the oxtabs and tabs switches by setting the appropriate TABx value. Even though POSIX only lists this as being XSI, we'd better follow it. Notes: svn path=/head/; revision=182052
* Integrate the new MPSAFE TTY layer to the FreeBSD operating system.Ed Schouten2008-08-201-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The last half year I've been working on a replacement TTY layer for the FreeBSD kernel. The new TTY layer was designed to improve the following: - Improved driver model: The old TTY layer has a driver model that is not abstract enough to make it friendly to use. A good example is the output path, where the device drivers directly access the output buffers. This means that an in-kernel PPP implementation must always convert network buffers into TTY buffers. If a PPP implementation would be built on top of the new TTY layer (still needs a hooks layer, though), it would allow the PPP implementation to directly hand the data to the TTY driver. - Improved hotplugging: With the old TTY layer, it isn't entirely safe to destroy TTY's from the system. This implementation has a two-step destructing design, where the driver first abandons the TTY. After all threads have left the TTY, the TTY layer calls a routine in the driver, which can be used to free resources (unit numbers, etc). The pts(4) driver also implements this feature, which means posix_openpt() will now return PTY's that are created on the fly. - Improved performance: One of the major improvements is the per-TTY mutex, which is expected to improve scalability when compared to the old Giant locking. Another change is the unbuffered copying to userspace, which is both used on TTY device nodes and PTY masters. Upgrading should be quite straightforward. Unlike previous versions, existing kernel configuration files do not need to be changed, except when they reference device drivers that are listed in UPDATING. Obtained from: //depot/projects/mpsafetty/... Approved by: philip (ex-mentor) Discussed: on the lists, at BSDCan, at the DevSummit Sponsored by: Snow B.V., the Netherlands dcons(4) fixed by: kan Notes: svn path=/head/; revision=181905
* Fix ACL preservation, apparently broken in 1.47.Edward Tomasz Napierala2008-08-071-1/+3
| | | | | | | | Approved by: rwatson MFC after: 3 weeks Notes: svn path=/head/; revision=181361
* Mark functions as __dead2 in order to help the LLVM static checkerColin Percival2008-08-043-3/+3
| | | | | | | | | | understand which code paths aren't possible. This commit eliminates 117 false positive bug reports of the form "allocate memory; error out if pointer is NULL; use pointer". Notes: svn path=/head/; revision=181269
* Pass the correct flags to expandarg() for NFROMFD and NTOFD. This fixes aStefan Farfeleder2008-07-301-1/+1
| | | | | | | | | | segmentation fault when the argument expands to an empty string. Reported by: simon MFC after: 3 weeks Notes: svn path=/head/; revision=181017