Commit Graph

2142 Commits

Author SHA1 Message Date
Suleiman Souhlal
3118731323 Remove WARNS?= 6 from Makefile, since it is already in src/bin/Makefile.inc
Requested by:	ru
Approved by:	grehan (mentor)
2005-01-26 06:48:17 +00:00
Suleiman Souhlal
3ac2b17742 - The first argument of getmode() is a void *
- Add WARNS?= 6

Approved by:	stefanf, grehan (mentor)
Obtained from:	DragonFlyBSD
2005-01-25 14:31:19 +00:00
Ruslan Ermilov
462fbe1ec0 De-kerberize the manpage. 2005-01-21 09:31:38 +00:00
Ruslan Ermilov
a866e17077 Added the EXIT STATUS section where appropriate. 2005-01-17 07:44:44 +00:00
Ruslan Ermilov
6fca4c7c3f Add the new standard EXIT STATUS section where appropriate.
Sort standard sections in the (documented) preferred order.
2005-01-16 16:41:59 +00:00
Philippe Charnier
34af7a1a38 no need to have break; after return; 2005-01-16 11:10:21 +00:00
Ruslan Ermilov
6a5796e734 Eliminate macro calls inside literal displays. 2005-01-15 12:28:01 +00:00
Ruslan Ermilov
5f05dfac32 Removed harmful empty lines that crept in during the copyright
header update.
2005-01-13 08:46:19 +00:00
Brian Somers
0e32d64e56 Don't decend into directories when -d is set and the directory itself doesn't
match.

PR:		28095
Submitted by:	bill at twwells dot com
MFC after:	7 days
2005-01-12 03:25:55 +00:00
Joerg Wunsch
1c7adc9b77 The total sum of blocks for the -l and -s option is printed always,
regardless whether the output is to a terminal or not.  As this is
consistent with the SUSPv2 specification (even though we do not
otherwise fully implement SUSPv2's ls(1) options), document this as it
is now, rather than trying to change the behaviour itself.

PR:		docs/76072
Submitted by:	Sebastian Rey <Sebastian.rey@gmx.net>
MFC after:	1 week
2005-01-11 08:51:21 +00:00
Warner Losh
9ddb49cbe4 /*- or .\"- or #- to begin license clauses. 2005-01-10 08:39:26 +00:00
Warner Losh
130d846d9b Remove the clause 3, per berkeley and mail from rwatson representing
that nai was OK with all third clause removals.
2005-01-10 08:21:45 +00:00
Ruslan Ermilov
6fa13ec06f Scheduled mdoc(7) sweep. 2005-01-09 19:54:23 +00:00
Ceri Davies
6b4bbd8a2c Correct typo. 2005-01-04 12:44:25 +00:00
Robert Watson
85c5243c1d Remove single line containing the word "KLD" ommitted in ps.1:1.80.
Pointed out by:	ru (some time ago)
2004-12-22 09:04:47 +00:00
Ruslan Ermilov
a216173556 NOCRYPT -> NO_CRYPT 2004-12-21 10:16:04 +00:00
Ruslan Ermilov
83c7ade90a NOSHARED -> NO_SHARED 2004-12-21 09:59:45 +00:00
Maxim Konovalov
af5eb6fcc5 o Add a missed "." .
Reviewed by:	ru
MFC after:	3 weeks
2004-12-02 13:13:27 +00:00
Maxim Konovalov
0c77b3c9c1 o Terminate an endless loop sh -T goes into in dowait() around waitproc().
XXX from Tor: "The shell can also go into a similar loop if the child was
killed by signal 127, since the shell would believe the child to have
only stopped (WIFSTOPPED() macro returns nonzero value).  Disallowing
signals 127 and 128 will fix that problem."  See kern/19402 for details.

PR:				bin/66242
Submitted by:			tegge
Analysis and testcase by:	demon
MFC after:			3 weeks
2004-12-02 13:12:43 +00:00
Robert Watson
ac06cb0ad3 Point at the mac(4) man page when describing the -Z option.
Remove reference to /dev/lomac, which is no longer used by mac_lomac(4).

MFC after:	3 days
2004-11-29 12:00:24 +00:00
Ruslan Ermilov
0fba60818b Do not emit a spurious warning when "directory" argument
to "rmdir -p" is absolute, with one or more leading slash.
2004-11-20 00:41:08 +00:00
Ruslan Ermilov
d4af5f3250 Fixed "rmdir -p" that got broken by rev. 1.15.
(This also fixes "rmdir -v /nonexistent".)
2004-11-20 00:12:08 +00:00
Christian S.J. Peron
d8654c644a Use statfs instead of getmntinfo(). This will make the procfs checks
play nicer in prisons. It also simplifies things.

Reviewed by:	rwatson
Bumped into by:	Jilles Tjoelker
2004-11-19 16:11:54 +00:00
Christian S.J. Peron
a951d1f83b Currently if the user specifies -e and procfs is not mounted on /proc,
printing of the process environment will fail silently.

-define a function which will check to see if procfs is mounted on /proc
-Implement this test if the user specified -e
-If procfs is not mounted on /proc and -e was specified, print a warning.
 informing the user that procfs(5) is required.

Reviewed by:	wes, rwatson
2004-11-14 19:30:02 +00:00
Ruslan Ermilov
832b0b55ac Removed bitrot. 2004-11-13 17:12:22 +00:00
Yaroslav Tykhiy
5512dc5460 Fix off-by-one errors and potential buffer overruns
WRT handling file and link names that reach the allowed
maximum for old tar and ustar archive formats.

PR:		bin/40466
Submitted by:	Cyrille Lefevre <email in the PR> (portions)
Reviewed by:	freebsd-arch (silence)
MFC after:	1 month
2004-11-13 10:56:35 +00:00
Jordan K. Hubbard
de3abdfaf4 UNIX conformance: If -r -f on non-existent directory, don't emit error. 2004-11-13 04:07:01 +00:00
Andrey A. Chernov
b56bffc41b Back out recent TTYDEF_LFLAG_ECHO invention.
This change is NOP, because TTYDEF_LFLAG = TTYDEF_LFLAG_ECHO now,
but to minimize diffs with other BSDs.
2004-11-06 13:56:18 +00:00
Ruslan Ermilov
dee651eb15 Introduce the PRECIOUSPROG knob in bsd.prog.mk, similar
to PRECIOUSLIB from bsd.lib.mk.  The side effect of this
is making installing the world under jail(8) possible by
using another knob, NOFSCHG.

Reviewed by:	oliver
2004-11-03 18:01:21 +00:00
Poul-Henning Kamp
9372ddf0d1 stty sane should set the echo bits.
PR:	73423
Submitted by:	Michiel Boland <michiel@boland.org>
Overlooked by:	phk
2004-11-02 18:10:01 +00:00
Alfred Perlstein
43d6677ba1 When listing the special $ variables, ($!, $#, etc) list them as $!
instead of just !, this allows one to more easily locate/understand
the section of the manpage in question.

Additional wording correction by: keramida
Reviewed by: keramida
2004-11-01 19:05:04 +00:00
Xin LI
164d3f0bdc Correct a typo and make the documentation more mdoc(7) complaint.
Pointed out by:	dd
Approved by:	murray (mentor)
2004-11-01 16:52:34 +00:00
Xin LI
24c0f7385b Add -I, an option that asks for confirmation once if recursively
removing directories or if more than 3 files are listed in the
command line.

This feature is intended to provide a safe net but not being too
annoying like having "rm -i" for every deleting operations, and
is generally good for both newbies and power users, preventing
them from being so easily run into ``rm -rf /'', ``rm -rf *''
and so forth.

Originally implemented by Matthew Dillon for DragonFly, plus
some improvements done by various DragonFly contributors.

Approved by:	murray (mentor; the original dillon's version)
Discussed with:	des
Obtained from:	DragonFly's bin/rm/
		rm.c rev. 1.4 - 1.8
		rm.1 rev. 1.3 - 1.4
MFC After:	1 month
2004-10-28 08:25:30 +00:00
Dag-Erling Smørgrav
3f91ab9262 The previous commit added code to rm(1) to warn about and remove any
occurrences of "/" in the argument list.  This corresponds to Enhancement
Request Number 5 in the Austin Group TC2 Aardvark's XCU Defects Report
(<URL:http://www.opengroup.org/austin/aardvark/finaltext/xcubug.txt>).
Further discussion is available in the Austin Group mailing list archives
(<URL:http://www.opengroup.org/austin/mailarchives/>, "Defect in XCU rm")
and for Austin Group members, in the Austin Group Interpretations archive
(<URL:http://www.opengroup.org/austin/interps/>, AI-019)

This commit makes that check conditional on !POSIXLY_CORRECT, since it
is not strictly correct according to the current version of the standard
(but is expected to be correct according to the next version, and has
already been adopted by Solaris).
2004-10-04 19:24:28 +00:00
Dag-Erling Smørgrav
3a667dafcc Markup fixes.
Pointed out by:	ru
2004-10-04 19:03:44 +00:00
Dag-Erling Smørgrav
68ef5f71b0 Find out how flame-proof my underwear really is. 2004-10-04 11:26:01 +00:00
Dag-Erling Smørgrav
c335b1ecdb Whitespace cleanup. 2004-10-04 11:14:12 +00:00
Stefan Farfeleder
363d31466e chflags compiles with WARNS?=6. 2004-10-03 15:03:15 +00:00
Stefan Farfeleder
26663dcbd5 Garbage collect a variable whose value was never read. 2004-10-03 14:55:36 +00:00
Dag-Erling Smørgrav
bd7667733f Attempting to unset an undefined variable or function should not be
considered an error according to the Open Group Base Specification.

PR:		standards/45738
Submitted by:	Matthias Andree <matthias.andree@web.de>
MFC after:	3 days
2004-09-27 18:43:18 +00:00
David Schultz
7f5685bb49 Don't read the byte at *argv[strlen(*argv) + 1].
PR:		71743
2004-09-24 06:57:26 +00:00
Giorgos Keramidas
fc6db5e37c Group equivalent flags together and delete the `aliases' section.
PR:		docs/70856
Submitted by:	Rostislav Krasny <rosti_bsd@yahoo.com>
2004-09-21 10:13:34 +00:00
Robert Watson
e3edab4a91 Add a "fillchar" command line argument to dd(1) that permits the user
to specify an alternative padding character when using a conversion
mode, or when using noerror with sync and an input error occurs.  This
facilities reading old and error-prone media by allowing the user to
more effectively mark error blocks in the output stream.
2004-08-15 19:10:05 +00:00
Yaroslav Tykhiy
d3e240cb45 Change the behaviour of `-v' so that, e.g., stepping a month back
on March 31 won't take you to March 2 or 3 (now the result will
be the last day of February.)

In general, now stepping by months from the last days of the current
month A will take you to the very last day of the target month B if
B is shorter than A.

The previous version would just step to March 31 and rely on mktime(3)
to correct the date.  Despite its simplicity, such way was counter-intuitive
to users and caused pain to shell script writers.

Noticed by:	Igor Timkin <ivt at gamma dot ru>
Approved by:	brian
MFC after:	2 weeks
2004-08-09 13:43:39 +00:00
Colin Percival
d37df47d31 Join the 21st century: Cryptography is no longer an optional component
of releases.  The -DNOCRYPT build option still exists for anyone who
really wants to build non-cryptographic binaries, but the "crypto"
release distribution is now part of "base", and anyone installing from a
release will get cryptographic binaries.

Approved by:	re (scottl), markm
Discussed on:	freebsd-current, in late April 2004
2004-08-06 07:27:08 +00:00
Gordon Tetlow
5036802031 Now that we have gcc 3.4, we can flip ia64 to using a dynamically linked
/bin and /sbin.

Reviewed by:	marcel (via pluto1)
2004-08-06 00:07:26 +00:00
Pawel Jakub Dawidek
1e1d03d7fc Allow for capital letters as size suffixes.
Inspired by:	le
Approved by:	green (maintainer)
2004-07-31 15:13:08 +00:00
Christian S.J. Peron
239c9e601a Currently if a mount point is not accessible by the calling user,
invalid information will be printed if the -t flag is specified.

$ df -t ufs
Filesystem  1K-blocks     Used    Avail Capacity  Mounted on
/dev/ad0s1a    495726   139944   316124    31%    /
/dev/ad0s1e    253678     6438   226946     3%    /tmp
/dev/ad0s1f  56206340 13594248 38115586    26%    /usr
/dev/ad0s1d    694126    19812   618784     3%    /var
/dev/ad0s1d    694126    19812   618784     3%    /var
$

Note that the mount point which is not accessible shows
up as the previous file system that was printed. The reason
for this is that df -t will call statfs(2) on the pathname
supplied by getfsstat(2).

This is done to refresh the file system statistics in the
event that a previous file system had a long delay in
providing its stats.

This change affects the df utility in the following ways:
o Teach df has to deal with statfs(2) failing. If statfs(2)
  fails, fall back on the possibly stale stats provided by
  the initial call to getfsstat(2).
o Print a warning that the fs stats could possibly be stale
o Modify the man page and document this new behavior
  as a bug.

Approved by:	bmilekic (mentor)
PR:		68165
2004-07-20 18:24:47 +00:00
Tim J. Robbins
2c61418d05 Use warn() instead of perror(). 2004-07-20 05:52:00 +00:00
Alfred Perlstein
8a0f7000e6 Give the most awesome example of how to parse the output of date
back into epoch time.  Everytime I'm asked to do this by someone I
have to spend about ten minutes recreating the same command line.
So record it under examples.
2004-07-17 00:26:31 +00:00
Tim J. Robbins
5292d2aec0 Remove BUGS section that talked about missing multibyte character support.
We have support now that the regular expression routines do.
2004-07-12 10:46:55 +00:00
Mark Peek
e62468e489 KANJI and DSPMBYTE are now "on" by default in the tcsh 6.13.00 distribution. 2004-07-11 02:23:38 +00:00
Tim J. Robbins
128dc4a2e3 Document missing multibyte character handling in utilities specified
by POSIX.
2004-07-03 02:03:44 +00:00
Tim J. Robbins
ee70653ec9 Clarify: test compares strings by binary value, not "ASCII value". 2004-07-03 01:49:17 +00:00
Ruslan Ermilov
1171aedcdf Deal with double whitespace. 2004-07-03 00:06:28 +00:00
Ruslan Ermilov
eccea571a7 Mechanically kill hard sentence breaks. 2004-07-02 21:04:19 +00:00
Ruslan Ermilov
d37ea99837 Removed trailing whitespace. 2004-07-02 19:07:33 +00:00
Garance A Drosehn
70548f642a Change the "rtprio" format so it prints an informative string for
the PRI_ITHD case (instead of just printing the digit '1').

Submitted by:	Cyrille Lefevre
2004-06-27 23:59:38 +00:00
Garance A Drosehn
f2fbfae6b0 Improve checking for `ps -t <dev>', and give better error messages when
an invalid <dev> is specified.  Aside:  It turns out that the S_ISCHR()
check is true for almost every device that we have (not just tty's).
2004-06-27 22:56:58 +00:00
David E. O'Brien
c33c2570d3 Don't continue if the '-C' option (a-la GNUtar; commited in options.c
rev 1.18, but not documented in the man page) caused a failed chdir.
Otherwise, one can easily overwrite files.

Submitted by:	Robert Nagy <robert@openbsd.org>
Obtained from:	OpenBSD
2004-06-25 05:27:59 +00:00
Garance A Drosehn
bd6233fd5d Fix a bug I introduced by some last-minute changes in -r 1.102. I ended
up checking the wrong variable for NULL.

Submitted by:	bde
2004-06-24 03:15:18 +00:00
Garance A Drosehn
23b8efad7a Rework the logic for `-t <tty>', such that it accepts "ttyp0" and "console",
in addition to "/dev/ttyp0" or "p0"  and  "/dev/console" or "co".
2004-06-24 01:57:59 +00:00
Garance A Drosehn
bdf8ab4692 Change "struct varent" to use the standard queue(8) macros, instead of
using it's own version of the same basic algorithm.

Submitted by:	part by Cyrille Lefevre, part of it done by me
2004-06-23 23:48:09 +00:00
Garance A Drosehn
dd693acf27 Add a check for defunct processes in saveuser(), so the output for "args"
(aka "command") will display "<defunct>", as does the output from "comm"
for those processes.  Also do better checking for malloc() failures.

Submitted by:	Cyrille Lefevre
2004-06-23 21:17:25 +00:00
Garance A Drosehn
4e8a8d9f85 Avoid padding the value of "ucomm" when it is the last column in the line.
Submitted by:	Cyrille Lefevre
2004-06-23 12:18:36 +00:00
Garance A Drosehn
820434b27f Make sure the value of "upr" (scheduling priority on return from system call)
is scaled in the same way that "pri" (scheduling priority) is scaled.

Submitted by:	Cyrille Lefevre
2004-06-23 11:56:57 +00:00
Garance A Drosehn
31172f6e1b Include the `-c' option in the usage() message.
Submitted by:	Cyrille Lefevre
2004-06-23 11:40:56 +00:00
Garance A Drosehn
b4b243242b In the sorting routine, sort by thread-id if two processes have the same PID.
Submitted by:	Cyrille Lefevre
2004-06-23 11:28:17 +00:00
David Malone
f137c9c100 Fix some style bugs I introduced pointed out by bde. Also add a blank
line after the empty variable declarations.

Reviewed by:	md5
2004-06-23 08:26:31 +00:00
David Malone
60e52383e7 Use nanoseconds and then lexicographic ordering when the seconds of
the [acm]time are the same. I was going to use Scott's patch, but I
couldn't get the style quite right, so I used a patch of my own.

Submitted by:		Scott Mitchell <scott+freebsd at fishballoon.org>
MFC after:		3 weeks
2004-06-22 16:02:29 +00:00
Garance A Drosehn
29d2bd4314 Get rid of a cast to '(void) ' on the return of a call to strcpy. 2004-06-22 02:18:29 +00:00
Garance A Drosehn
bdbc9a5cb9 Oops. Undo that last 'const' change. It expects similar changes to some
other files that I am not ready to commit yet...
2004-06-22 02:15:58 +00:00
Garance A Drosehn
db6e0b8b03 Add 'const' to a few places.
PR:		bin/65803
Submitted by:	Cyrille Lefevre
2004-06-22 02:06:42 +00:00
Garance A Drosehn
e4b70e6697 When displaying the "COMMAND" field for system-processes and/or kernel
threads, put the command name in square brackets instead of parenthesis.
This matches NetBSD, and also seems to be what linux does.  The sentence
which is added to the man page is taken straight from NetBSD.

PR:		bin/65803
Submitted by:	Cyrille Lefevre
Obtained from:	NetBSD
2004-06-22 01:59:54 +00:00
Garance A Drosehn
16ac318df7 Have `ps' return the cputimes for zombies, with the assumption that
kvm_getprocs() will provide useful information if it can, or *it*
will provide a zero value if it can not find something appropriate.

Submitted by:	bde
2004-06-21 16:53:11 +00:00
Garance A Drosehn
15b87b531e Add the `-O emul' format option, which prints the name of the system-call
emulation environment the process is in.  "emul" as a keyword is picked
up from OpenBSD.

PR:		bin/65803
Submitted by:	Cyrille Lefevre
2004-06-20 23:40:54 +00:00
Garance A Drosehn
ce1affa2ac From SUSv3:
Any [standard output] field need not be meaningful in all
    implementations. In such a case a hyphen ('-') should be
    output in place of the field value

So have the `-O label' option print out the string "  -" if the
process has no label.

Approved by:	Silence from rwatson and green (when asked in March...)
2004-06-20 22:31:37 +00:00
Garance A Drosehn
76adc1fd42 Add new output-format keywords of LWP and NLWP, which show the thread-id
and number-of-threads tied to a process.  Result can be seen by typing,
e.g.:   ps -HO lwp,nlwp
These new options are not documented yet.  More options will be coming,
and I will update the man page after I get farther along.

PR:		bin/65803  (though adjusted to fit our present source)
Submitted by:	Cyrille Lefevre
2004-06-20 22:22:49 +00:00
Garance A Drosehn
4bac4483db Have the main() routine calculate %CPU and (if needed) memory information
when copying per-process info before starting to sort the list.  This way,
sort-by-CPU or sort-by-memory will only calculate values once-per-process,
instead of twice-per-comparison.  Also take advantage of this to simplify
the pscomp() routine.
2004-06-20 21:25:10 +00:00
Maxim Konovalov
96819f939c Typo: s/SunOP/SunOS/g. 2004-06-16 12:57:31 +00:00
David E. O'Brien
503d530bde style.Makefile(5) 2004-06-13 19:22:53 +00:00
David Schultz
70bad4f75b If we are asked to print the total number of blocks, do so even if we
have no entries to print (either due to an empty directory or an
error).  This makes the -l and -s options more consistent, like
Solaris and (Debian) Linux.  To make this happen, tweak two
optimizations on the second call to display():

- Don't skip display() altogether, even if list == NULL.
- Don't skip the call to the printfn in display() if we
  need to print the total.

PR:	45723
2004-06-08 09:30:10 +00:00
David Schultz
48a91b69b8 Remove from the printfns the assumption that dp->list != NULL. Even
if there are no entries, these functions may be called to print the
total number of blocks (0) for consistency's sake.
2004-06-08 09:27:42 +00:00
Yaroslav Tykhiy
37ad0f498f Remove a duplicated description of the test for the null string.
MFC after:	3 days
2004-06-07 12:47:31 +00:00
Yaroslav Tykhiy
593cc6f338 Describe how test(1) will evaluate its expressions for a symlink.
Inspired by:	SUSv3
MFC after:	1 week
2004-06-07 12:42:38 +00:00
Tim J. Robbins
7807cb2439 Plug file descriptor leak in implementation of -n option. 2004-06-05 02:32:21 +00:00
David Schultz
841fe8e83f Convert fsbtoblk() from a macro to a function. The redundant
instances of 64-bit arithmetic were costing 775 bytes, and the
inlining offered no benefit.  Moreover, ambiguity as to the argument
types led to the introduction of a bug (see rev 1.56).

Also, remove some casts that are now clearly redundant.

Inspired by:	67467
2004-06-04 09:30:51 +00:00
Lukas Ertl
7fcc4669d8 Plug small memory leak.
PR:             bin/67392
Submitted by:   Matthew Emmerton <matt@gsicomp.on.ca>
MFC in:         1 week
2004-06-03 15:04:00 +00:00
Garance A Drosehn
ecbb06f865 Try to change the isdigitch() macro to something that Bruce won't roll
his eyes at quite so much...  (actually someone else pointed this out
to me a long time ago, but apparently I never fixed it)
2004-06-01 23:27:11 +00:00
Garance A Drosehn
c23b00b7ca A few more style-fixes from Bruce. The only non-cosmetic change
is to drop a call to setuid() which has not been needed for years.

Noticed by:	bde
2004-06-01 22:19:16 +00:00
Garance A Drosehn
a9626fb3b4 Since I'm not ready to add the non-standard ADD_PS_LISTRESET feature,
remove the #ifdef for it for now.  I might add the feature for real at
some later date, there isn't much reason for the #ifdef for now.
2004-06-01 19:00:42 +00:00
Garance A Drosehn
251130839b Make a few style-istic improvements to the previous commits.
Noticed by:	bde
2004-06-01 18:12:04 +00:00
Garance A Drosehn
de1702f459 Fix so `ps' catches and complains about null-values specified for a
process id, instead of using pid==0.  Ie, `ps -p 12,' and `ps -p ,12'
are now errors (instead of being treated like `ps -p 0 -p 12').

Noticed by:	Cyrille Lefevre on freebsd-arch
2004-06-01 03:01:51 +00:00
Garance A Drosehn
bf46a3bf10 Additional tiny adjustment to kludge-option processing so `ps t p0'
is treated like `ps -t p0', instead of changing it to `ps -T p0'.
Note that `ps t' is still changed to `ps -T', since that is one of
the main reasons for this kludge processing...

Noticed by:	Jilles Tjoelker on freebsd-arch
2004-06-01 02:31:44 +00:00
Garance A Drosehn
c675340a5c Rewrite the kludge-option processing to improve how it handles a few
more special situations.  This is the code which process `ps blah',
when "blah" does not include a leading '-'.

This change also removes a long-undocumented BACKWARD_COMPATIBILITY
compile-time option, where:
     ps -options arg1 arg2
(with no '-' on "arg1" and "arg2") was treated as:
    ps -options -N arg1 -M arg2

This also changes `ps' to check for any additional arguments after
processing all the '-'-options, and attempt to use those arguments as
a pid or pidlist.  If an extra argument is not a valid pidlist, then
`ps' will print an error and exit.  This seems a more generally useful
extension of the kludge-option processing than the -N/-M behavior, and
has fewer confusing side-effects.

Reviewed by:	freebsd-arch
2004-06-01 02:03:21 +00:00
Pawel Jakub Dawidek
478aa80510 Use humanize_number(3).
Reminded by:	jhb
2004-05-25 14:53:47 +00:00
Garance A Drosehn
585bf55792 Add pgrep(1) and pkill(1) to the cross-reference section of ps(1). 2004-05-25 14:05:25 +00:00
Pawel Jakub Dawidek
7d3940bb67 Use humanize_number(3) to format sizes into a human readable form. 2004-05-24 22:22:29 +00:00
Stefan Farfeleder
e0cd241f8b Include <stdio.h> for a sprintf() prototype.
Approved by:	das (mentor)
2004-05-24 10:11:31 +00:00
Garance A Drosehn
259fcfacc4 Add the 'sid' info to the output of `ps -j', to make up for the 'sess'
(session-pointer) info which was dropped from `ps' earlier in 5.x.

PR:		bin/59423
Submitted by:	Jilles Tjoelker
2004-05-23 21:35:35 +00:00
Garance A Drosehn
2631c7774f Fix the kludge-old-options processing so `ps tpt' will be treated the
same as `ps -tpt', instead of being changed into `ps -tpT'.

PR:		bin/52489
Submitted by:	Jilles Tjoelker
MFC after:	1 week
2004-05-23 21:21:07 +00:00
Garance A Drosehn
7bd421650b Change `ps' to use the KERN_PROC_RGID and KERN_PROC_SESSION options
(if trying to match only one real-group or one session-id), now that
those options are implemented in src/sys/kern/kern_proc.c (v1.203).

PR:		bin/65803  (a very tiny piece of the PR)
Submitted by:	Cyrille Lefevre
2004-05-22 23:13:58 +00:00
Ruslan Ermilov
287d1861eb Assorted markup fixes. 2004-05-16 21:35:05 +00:00
Ruslan Ermilov
2d3640781e Punctuation. 2004-05-16 21:34:49 +00:00
Ruslan Ermilov
093be00a00 Fixed spelling of the document date. 2004-05-16 21:34:31 +00:00
Ruslan Ermilov
2360f509c5 Bump document date for the latest functional change.
Minor markup tweaks.
2004-05-16 21:34:15 +00:00
Ruslan Ermilov
b0cb98e238 DESCRIPTION was not updated for the new SYNOPSIS. 2004-05-16 21:33:48 +00:00
Ruslan Ermilov
6a50100135 Added -v to usage(). 2004-05-16 20:41:11 +00:00
Olivier Houchard
c1b2de5af0 Use WARNS?=3 for these in the arm case for now, due to toolchain issues. 2004-05-14 13:31:21 +00:00
Tim J. Robbins
6449b88bf1 Only add the widths together for printable characters in prn_normal();
unprintable characters have a "width" of -1.
2004-05-03 11:48:55 +00:00
Tim J. Robbins
107409f46e Treat filenames as multibyte character strings (according to the current
LC_CTYPE setting) when determining which characters are printable.
This is an often-requested feature.

Use wcwidth() to determine the number of column positions a character
takes up, although there are still a few places left where we assume
1 byte = 1 column position, e.g. line-wrapping when handling the -m option.

The error handling here is somewhat more complicated than usual: we do
our best to show what we can of a filename in the presence of conversion
errors, instead of simply aborting.
2004-05-02 11:25:37 +00:00
David Schultz
87a99f5ff2 Various quibbles:
- Print a diagnostic if kdumpenv() fails.  This can occur due to MAC
  restrictions or lack of memory.  Catch all kenv(2) failures as well.
- Just of the heck of it, DTRT if the kernel environment size changes
  at the wrong time.  The old code could fail silently or fail to
  null-terminate a buffer if you got exceptionally unlucky.
- Sort and GC the #includes.
2004-04-28 01:27:36 +00:00
David E. O'Brien
c6f13844f6 Fix some style issues in rev 1.58.
Use 64-bit integer math vs. mixed FP & integer.
Add -g to the usage().
2004-04-22 17:05:08 +00:00
David E. O'Brien
7fed1986d0 Add 'g' to SYNOPSIS. 2004-04-22 16:33:54 +00:00
David E. O'Brien
cca108e6a2 Fix printing of the "Mounted on" values for 'df -i'.
Fix spacing before "Mounted on" column in general.

Submitted by:	bde
2004-04-22 16:26:05 +00:00
David E. O'Brien
076419d207 Add -c option simular to du(1).
PR:		19635
Submitted by:	cyrille.lefevre@laposte.net
2004-04-18 20:56:31 +00:00
Brian Feldman
4ad8968a7f Document the "return" built-in better: it will exit . (sources) and
the top-level shell instance, too.
2004-04-14 15:58:50 +00:00
Nate Lawson
3066c4a4bd Style fixes and add gen to CLEANFILES.
Submitted by:	bde
2004-04-09 07:13:27 +00:00
Brian Feldman
640c4d40fb Give date(1) a much better SYNOPSIS section which is useful as more than
decoration.  Further improvements are welcome, but at least this
is a separate of the various modes of operation date has, as well as
sectioning off the two deprecated options for settimeofday(tz) that
don't even apply to actual operation of date as such, anyway.
2004-04-06 22:03:38 +00:00
Mark Murray
6195fb4102 Remove clause 3 from the UCB licenses.
OK'ed by:	imp, core
2004-04-06 20:06:54 +00:00
Garance A Drosehn
b193355dc4 Drop the include of <stdint.h>, since r1.84 removed references of intmax_t. 2004-04-04 17:43:48 +00:00
Garance A Drosehn
9bf69950e1 Add back the `-e' option, which was mistakenly dropped when cleaning
up the PS_ARGS string in revision 1.69 (and which was apparently not
missed by anyone...).
2004-04-04 17:15:44 +00:00
Garance A Drosehn
d822163f3b Give a name of 'l' (list) to the union in struct listinfo. This is
because some compilers (such as gcc 2.95.4) do not support having an
unnamed union for a field in a struct.
2004-04-04 04:41:51 +00:00
Bosko Milekic
263377339c Stop iterating over ACLs if we've already determined we
will print them (i.e., number of successful calls to acl_get_entry()
exceeds 3).  This makes O(1) what was O(num_TYPE_ACCESS_ACLs).

This is a slightly modified version of submitter's patch.

PR: bin/65042
Submitted by: Christian S.J. Peron <maneo@bsdpro.com>
2004-04-03 16:55:56 +00:00
Garance A Drosehn
396e20d19f Add spaces after flag names on .Fl macros.
Noticed by:	ru
MFC after:	4 days
2004-04-01 13:28:36 +00:00
Garance A Drosehn
8ed0d42fe4 Describe the sorting options in better and more complete detail.
Also improve the description of `-L' a little.

MFC after:	4 days
2004-03-31 23:51:12 +00:00
Garance A Drosehn
0b42be7cb7 Switch to using strtoul() for parsing a potential UID or GID, which gets
this to correctly handle UID's and GID's larger than 2147483647.

Noticed by:	bde
MFC after:	1 week
2004-03-30 04:20:33 +00:00
Garance A Drosehn
f35e071573 Bruce would really like the prototype for fmt() to be split across lines
this way (although I still think it "looks weird"...).

Requested by:	bde
MFC after:	1 week
2004-03-30 02:02:40 +00:00
Garance A Drosehn
ba50b0e03a Minor style fixes, mostly adding indent-protection on some comment-blocks.
Noticed by:	bde
MFC after:	1 week
2004-03-30 01:59:22 +00:00
Garance A Drosehn
5bd7b1f3c0 Replace pscomp() with a cleaner version, mostly written by bde (*).
This corrects a problem of lost-precision for `-r' (sort-by-CPU).  Also,
for sort-by-CPU and sort-by-memory, any processes which have the same
value CPU or MEMORY are now sorted by TTY and then (if needed) by pid.

(* - I just added the NODEV checks, after doing some testing of my own)

Submitted by:	bde
MFC after:	1 week
2004-03-30 01:45:23 +00:00
Garance A Drosehn
c46bb4b3ff Oops. Remove some ';'s in #defines added by a previous update.
Noticed by:	bde
2004-03-29 03:03:28 +00:00
Garance A Drosehn
c7910c3ae3 Have this source explicitly include <sys/proc.h>, since it references
values such as P_CONTROLT and PS_INMEM.  But this still won't define
PID_MAX for us, since that is hidden inside of '#ifdef _KERNEL'.

Noticed by:	bde
2004-03-29 01:27:13 +00:00
Garance A Drosehn
87e47750f2 Since "kp" is a pointer, I should be comparing against NULL not 0.
Noticed by:	bde
2004-03-29 01:18:13 +00:00
Garance A Drosehn
352b652398 Various style improvements, mostly in comments and indentation.
Suggested by:	bde (well, for most of them)
2004-03-29 01:15:27 +00:00
Garance A Drosehn
ca62e195dd In the routines I've been working on, sort the variable declartions
so that non-pointers are listed after pointer-type variables.

Noticed by:	bde
2004-03-29 00:25:09 +00:00
Garance A Drosehn
1d2324f442 Split two 'fmt' strings so they're easier to read on 80-char windows. 2004-03-29 00:16:19 +00:00
Garance A Drosehn
de800cd4f8 Sort the declarations of global variables. 2004-03-29 00:12:03 +00:00
Garance A Drosehn
4857f240e1 Sort the routine prototypes. 2004-03-28 23:44:29 +00:00
Garance A Drosehn
5dfd7724a3 If <x> is a process id that does not exist, then just print the header
(if any) and exit, thus matching the behavior on -stable and other OS's.
My earlier attempt to fix this (v1.65) only seemed to work because of a
lucky random value in nentries (which was not being initialized back
when I tested that earlier patch).
2004-03-28 03:00:56 +00:00
Garance A Drosehn
3998d22271 Fix `-o rtprio' so it prints the correct value.
PR:		bin/59417
Submitted by:	Jan Willem Knopper
This fix by:	bde (in the audit-trail of the PR)
2004-03-28 02:13:31 +00:00
Garance A Drosehn
e3c4e1dd77 If a non-existent user is given as part of `-U userlist', treat it as
a fatal error instead of a minor warning.  It is possible that a few
users are used to the previous behavior, but I'm claiming it was a bug.
2004-03-27 22:14:42 +00:00
Garance A Drosehn
29d58b106b Explicitly wrap two long-ish linesi of code, to make them easier to read. 2004-03-27 21:59:54 +00:00
Garance A Drosehn
b34f38ae9e Change the #if-ish logic which is used to add the -f' option when ps'
is compiled with LAZY_PS, so that there is only one PS_ARGS string to
modify when changing the option-list.  Also get `-f' to show up in the
usage() statement when compiled with LAZY_PS.
2004-03-27 21:56:49 +00:00
Garance A Drosehn
4a355d176d Move the 'f' case so it shows up in the right place, alphabetically. 2004-03-27 21:40:04 +00:00
Garance A Drosehn
3dc91da529 Update the date on the man page, since this the previous change added
a few new options.
2004-03-27 18:26:40 +00:00
Garance A Drosehn
a4c8a745a8 Support more POSIX/SUSv3 options:
- Change `-p' to allow a list of process IDs, and `-t' to allow a list
  of terminal names, instead of only a single value for each.
- Add the `-A' option of SUSv3, which is exactly the same as `-ax'.
- Add the `-G gidlist' (group id).
- Allow any of these "selector options" to be specified multiple times,
  and have `ps' keep adding to a given list -- instead of replacing the
  previously-specified values.
- Fix interactions between selector-options, so that: "If any are
  specified, ... ps shall select the processes represented by the
  inclusive OR of all the selection-criteria options." (from SUSv3)
- Add a `-X' option, which is the reverse of the `-x' option.

- various minor improvements in parsing and error handling.

This does not get us to match POSIX/SUSv3, but it gets us closer.  The
`-g pgidlist', `-R ruserlist' and `-s sidlist' options mentioned in
freebsd-standards are still under debate, so they skipped for now.
It should be true that this introduces no user-visible incompatible
changes, except to support "new stuff" that was not supported before.
2004-03-27 18:22:17 +00:00
Ruslan Ermilov
f9a480abb1 Avoid the manpage layering violation and low-level implementation
details of libkvm, and just tell what the getbootfile(3) function
will return, by using the text from netstat(1) and dmesg(8).
2004-03-26 08:54:27 +00:00
Ruslan Ermilov
cd31922f27 - Remove references to /dev/kmem -- ps(1) utilizes the
sysctl(3) interface in kvm(3).
- Document the correct default when no -N is specified.
- Remove stale reference to /var/db/kvm_kernel.db.
- Remove stale reference to /var/run/dev.db.
2004-03-26 08:29:38 +00:00
David E. O'Brien
2edbecc6db Remove WFORMAT, style.Makefile(5). 2004-03-22 03:17:36 +00:00
Pawel Jakub Dawidek
3184e92100 When symbolic link is pointed onto a mount point, it can't be moved
to a different file system.
Patch in PR was incorrect.

PR:		bin/64430
Submitted by:	Samuel Tardieu
MFC after:	3 days
2004-03-21 13:38:37 +00:00
Tim J. Robbins
b59ca66070 Document incorrect handling of multibyte characters. 2004-03-21 11:24:06 +00:00
Tim J. Robbins
f791df19bd Document incorrect handling of multibyte characters in filenames. 2004-03-21 11:16:24 +00:00
Tim J. Robbins
744e4bba0e Reduce redundancy in the description of the -u option. 2004-03-21 11:04:59 +00:00
Tim J. Robbins
f74d4353ce Document incorrect handling of multibyte characters when -t and -v options
are used.
2004-03-21 11:02:40 +00:00
Dag-Erling Smørgrav
1afaec9ae4 Add a -v (verbose) option. 2004-03-21 04:56:06 +00:00
Ruslan Ermilov
4995f06772 Install /bin/sh safely. This allows a shell script to be used
to strip binaries by specifying it in the STRIPBIN environment
variable honoured by install(1).

MFC after:	3 days
2004-03-18 10:55:47 +00:00
Garance A Drosehn
2e6c6ac4d7 Fix 'ps -p proclist' and 'ps -u userlist' so the command returns non-zero
if no processes were matched.  Also sorts the list of 'int's in main, as
long as I had to add another one...

Noticed by:	Nate Lawson
MFC after:	10 days
2004-03-18 01:28:23 +00:00
Garance A Drosehn
4e8b6a6fb0 Improvements to 'ps -p <x>'. If <x> is a process id that does not exist, then
just print the header (if any) and exit, thus matching the behavior on -stable
and other OS's.

Also adds support for <x> being a comma-separated list of processes, and does
a much better checking for invalid-values of <x>, such as 'ps -p someword'.

Reviewed by:	mentioned on freebsd-current
MFC after:	10 days
2004-03-17 22:46:58 +00:00
Colin Percival
3ed29c96cf Fix memory leak
PR:		bin/64321
Submitted by:	Rodney Ruddock <rodney@interopsystems.com>
MFOpenBSD:	rev 1.17
MFC after:	3 days
2004-03-16 08:33:33 +00:00
Juli Mallett
c83afe7be9 static and const. 2004-03-15 04:10:29 +00:00
Lukas Ertl
ae21f5ad2c And a bandaid so that the output of "available space" is correct when
using -m and -g switches and "available space" is negative (i.e. when
the file system is already using the root-reserved minimum free space).

Obtained from:   Stefan Farfeleder <stefan@fafoe.narf.at>
PR:              bin/62536
Submitted by:    Peter van Dijk <peter@dataloss.nl>
Approved by:     grog (mentor), bde
2004-03-09 10:02:44 +00:00
Andrey A. Chernov
c65eeb736e Remove a.out at the end of 'make test' 2004-03-08 18:09:33 +00:00
Bruce Evans
d493ed0f97 Fixed some style bugs (mainly unsorting and tab lossage in previous commit). 2004-03-06 08:21:32 +00:00
Andrey A. Chernov
c6f22660ff Add a.out to CLEANFILES 2004-03-06 06:54:58 +00:00
Andrey A. Chernov
adde319c62 Change locale name from non-existent ASCII to en_US.US-ASCII 2004-03-06 06:10:16 +00:00
Poul-Henning Kamp
6a3d33ac5e Teach dd(1) about parity bits. 2004-03-05 19:35:51 +00:00
Poul-Henning Kamp
3d36fd4271 Add a test-target and reference vectors for the character converions. 2004-03-05 19:30:13 +00:00
Mark Murray
16fc3635f7 Make NULL a (void*)0 whereever possible, and fix the warnings(-Werror)
that this provokes. "Wherever possible" means "In the kernel OR NOT
C++" (implying C).

There are places where (void *) pointers are not valid, such as for
function pointers, but in the special case of (void *)0, agreement
settles on it being OK.

Most of the fixes were NULL where an integer zero was needed; many
of the fixes were NULL where ascii <nul> ('\0') was needed, and a
few were just "other".

Tested on: i386 sparc64
2004-03-05 08:10:19 +00:00
Mike Makonnen
662713f2a8 Rev. 1.32 moved a comment to the wrong line. The hack refered to
in the comment applies to a decision that needs to be made in relation
to the year 2000.

In fact, that statement probably should be changed to be
more generic (getting the year from the current time perhaps). Otherwise,
starting in 2069 two digit year conversions in date(1) will start assuming
1900 instead of 2000. hehe.
2004-03-04 15:46:14 +00:00
Colin Percival
310924af3d Fixes to output of ls -lh for certain file sizes:
1. Sizes in the range 1000 -- 1023 units require four characters width
   for the integer; increase the field width to accomodate this.
2. Sizes in the range 9.95 -- 10 units were being displayed as "10.0"
   units; adjust the logic to fix this, and now that we've got an extra
   character of field width, print fractional units if the size is less
   than 99.95 units.
3. Don't display sub-byte precision.

This should mean that the following sizes are displayed:
    0B .. 1023B
  1.0U ..  9.9U
 10.0U .. 99.9U
  100U .. 1023U
for values of U in "KMGTPE".

PR:		bin/63547
Pointy hat to:	cperciva
Approved by:	rwatson (mentor)
2004-03-01 19:25:27 +00:00
Johan Karlsson
c8edef9f48 style.Makefile:
Use WARNS?= instead of WARNS=
2004-02-23 20:05:14 +00:00
Daniel Eischen
d75c1d8381 Allow the -H option to show threads when selecting by uid, tty,
and pid.
2004-02-22 17:59:31 +00:00
Ceri Davies
3004d1ed4d Only call chflags() on directories once.
Approved by:	ru
MFC after:	1 week
2004-02-18 18:45:11 +00:00
Nate Lawson
aa0b7126ba style(9): wrap at 80 columns. 2004-02-12 05:05:56 +00:00
Nate Lawson
97054a769f Handle proper formatting and a buffer overrun when running an old sh on
a system that has sys_nsig > NSIG (i.e. when libc is upgraded.)

Submitted by:	Matt Dillon
Reviewed by:	bde
2004-02-12 05:03:37 +00:00
Juli Mallett
7cb9663b27 MFp4 @46705:
Support "uprocp" exactly like "paddr" with the former having been
documented in the manual but not implemented.

PR:		42484
2004-02-08 23:57:19 +00:00
Ian Dowse
0bd9f15133 Use int rather than size_t storage for printf field widths to avoid
many casts.

Reviewed by:	bde
2004-02-08 23:42:09 +00:00
Ruslan Ermilov
47d7e8a96f Fixed style of DPADD and LDADD assignments as per style.Makefile(5). 2004-02-05 22:44:25 +00:00
Martin Cracauer
e637898ea8 Commit fix sent by Tor Egge <Tor.Egge@cvsup.no.freebsd.org>
Only use return value from system call if system call succeeded.

Tested with `make world` and some of my own scripts.

This should be MFCed soon.  While /bin/sh is hard to test the fix is
obviously correct and can be assumed not to break something else
(famous last words...).
2004-02-05 22:34:05 +00:00
Nate Lawson
205bc8633e Use sys_nsig instead of the static NSIG. DragonflyBSD kill.c:1.3
Obtained from:	DragonflyBSD
2004-01-28 19:04:14 +00:00
Nate Lawson
1b13752a03 Use sys_nsig instead of NSIG for the length of the signal arrays. This
is important if we add new signals later.  From DragonflyBSD:
jobs.c:1.4, trap.c:1.3.

Obtained from:	DragonflyBSD
2004-01-28 19:01:10 +00:00
Martin Cracauer
6c6fd020de The PR diff I committed recently had one bug noticed by
Joe Marcus Clarke <marcus@FreeBSD.ORG>, subshells could lose a
non-zero exit status.

This commit is Joe's proposed patch.  Thanks!

I verified that the problem Joe found is fixed and I ran a full world
with this patch.

I don't plan to ever commit language patches to /bin/sh again.  It is
a minefield too big to navigate without a full-time committment, which
I am not willing to do on our /bin/sh.

Under normal circumstances I would recommend using NetBSD's sh which
has a lot of language fixes (like the ones what these patches were
about) but unfortunately they had implemented broken signal behaviour
for shellscript containing interactive programs.  Similar issues apply
to pdksh which is OpenBSD's sh.

From my perspective bash2 is the only really working bourne sh out
there and that one is GPLed.  Oh well.
2004-01-28 18:22:19 +00:00
Colin Percival
d3b68bf14c Fix alignment of size field in ls -lh -- the width was being computed
from log[10](largest file size), but when outputting in human-friendly
format the width is always at most 4. (eg. "123K", " 12K", "1.2K".)

PR: bin/59320
Approved by: rwatson (mentor)
2004-01-22 04:33:00 +00:00
Colin Percival
bcf85d6737 Bring ps.1 up to date with changes in the past seven years:
* Remove mention of '>', 'A', and 'S' states
* Mention 'W' state.
* List 'J' state in the correct location.
* Sync with flags in sys/proc.h

Approved by: rwatson (mentor)
MFC after: 7 days
2004-01-21 16:25:36 +00:00
Dag-Erling Smørgrav
7e1c72660f Replace home-grown dup2() implementation with actual dup2() calls. This
should slightly reduce the number of system calls in critical portions of
the shell, and select a more efficient path through the fdalloc code.

Reviewed by:	bde
2004-01-21 12:50:01 +00:00
Ruslan Ermilov
d0123622bb Removed duplicate y.tab.h from SRCS and CLEANFILES. 2004-01-20 13:13:40 +00:00
Ruslan Ermilov
d10a8d6cb4 - Build things in pure dictionary order (see sort(1)).
- Unify the conditional assignments section so that architectural
  exclusions come first, then options and !options, sorted by the
  option name, also in directory order, then architecture specific
  sections, sorted by the architecture name, with i386 being a
  traditional exception.

Prodded by:	bde
2004-01-16 15:23:19 +00:00
David E. O'Brien
ab579b9e93 Note the Linux required format. 2004-01-06 19:01:34 +00:00
Jun Kuriyama
b800f53d91 o Fix a style bug and poor wording in comment.
o When fts_read() cannot stat the file, it can't be unlinked.  At
  that case, don't display error message when -f flag is used.

Obtained from:	bde
PR:		kern/16815, bin/35842
Reported by:	kuriyama, Aleksandr A. Babaylov <.@babolo.ru>
2004-01-01 10:26:43 +00:00
Maxim Konovalov
8aa55d8126 o Spell 'diretories' correctly.
PR:		misc/60730
Submitted by:	Eugene Grosbein
MFC after:	3 days
2003-12-30 15:39:33 +00:00
Martin Cracauer
bd80d26f3b PR 28852
sh -e behaviour was incorrect when && and || statements where used in
"if" clauses.

This is the patch submitted by MORI Kouji <mori@tri.asanuma.co.jp>.

It fixes the issue at hand, but sh fixes like this are super-hard to
verify that they don't break anything else.  I ran some of my old test
cases and a few big GNU configure scripts that detected mistakes
before, with the previous sh, patched sh and bash.  No differences in
behaviour found.  MFC recommended after longer than usual time.

Compiles on i386 and sledge.
2003-12-28 02:05:12 +00:00
Ruslan Ermilov
887cb17fac Print unambiguous paths with -R -v. 2003-12-16 15:17:30 +00:00
Maxime Henrion
ec912781bb The uuidgen(1) program is WARNS=6 clean, so flag it as such.
Tested on:	i386, sparc64
2003-12-07 21:34:56 +00:00
David E. O'Brien
d5f9f41c7b Do something sensible if both -h and -k are given.
Approved by:	re(scottl)
2003-12-01 19:10:29 +00:00
Marcel Moolenaar
bd8477d623 Force a staticly linked /bin and /sbin for ia64. The necessary changes
to gcc have not been made for ia64, which means that executables still
have /usr/libexec/ld-elf.so.1 as the dynamic linker. This simply does
not work if /usr is a seperate filesystem not mounted when the kernel
tries to execute init(8).

Note that this is a temporary fix until a new gcc has been imported
that does have the required changes.

Approved: re@
2003-11-19 16:59:00 +00:00
Gordon Tetlow
7e83e0de77 Change the default for binaries in /bin and /sbin from statically to
dynamically linked. This has been a long time coming with the move of
critical libraries from /usr/lib to /lib. If you don't feel comfortable
with dynamically linked binaries in your root partition, now is the
time to define NO_DYNAMICROOT in your make.conf.

Approved by:	re
2003-11-16 04:57:28 +00:00
Alan Cox
b9e25f436b Don't mmap(2) and munmap(2) zero-length files.
Submitted by:	Wiktor Niesiobedzki <bsd@w.evip.pl>
2003-11-13 05:26:55 +00:00
Kris Kennaway
ea64ad7727 Fix format strings (intmax_t is %jd, not %qd)
Reviewed by:	tjr
2003-11-12 21:47:42 +00:00
Kirk McKusick
fde81c7d8e Update the statfs structure with 64-bit fields to allow
accurate reporting of multi-terabyte filesystem sizes.

You should build and boot a new kernel BEFORE doing a `make world'
as the new kernel will know about binaries using the old statfs
structure, but an old kernel will not know about the new system
calls that support the new statfs structure. Running an old kernel
after a `make world' will cause programs such as `df' that do a
statfs system call to fail with a bad system call.

Reviewed by:	Bruce Evans <bde@zeta.org.au>
Reviewed by:	Tim Robbins <tjr@freebsd.org>
Reviewed by:	Julian Elischer <julian@elischer.org>
Reviewed by:	the hoards of <arch@freebsd.org>
Sponsored by:   DARPA & NAI Labs.
2003-11-12 08:01:40 +00:00
Guido van Rooij
f3761deee3 When the P flag is set (i.e. Overwrite regular files before deleting them),
do only unlink the file if we could indeed overwrite the file.
Old behaviour: rm -P /tmp/foo (foo mode 0444) would NOT overwrite foo,
but still delete it (with a warning: rm: foo: Permission denied)
New behaviour: Just the EPERM warning, but no deletion

Reviewed by:	bde
2003-11-10 09:40:18 +00:00
Bruce Evans
8f1f433834 1. Fixed leakage of a file descriptor for every non-fatal failure in
rm_overwrite() (for rm -P).

2. Print the file name in the error message for (fatal) malloc() failures
   in rm_overwrite().  I first thought that malloc() failures should be
   non-fatal since they don't prevent proceeding the the next file, but
   making them non-fatal would normally give too much output for rm -Pr
   on a large tree in the unlikely event that even one occurs, since the
   malloc()ed amounts are usually the same.  Just print the file name since
   the malloc()ed amounts are not always the same and it doesn't hurt to
   know where rm was when it quit.

Submitted by:	guido ((1) and original version of (2))
2003-11-08 09:55:16 +00:00
Ruslan Ermilov
3565c6a8e3 Style. 2003-11-02 06:47:39 +00:00
Anton Berezin
ad6a34de1d Remove the code for parsing octal modes, since setmode(3) already
handles them.

Reviewed by:	audit
MFC after:	2 weeks
2003-10-31 13:20:09 +00:00
Tim J. Robbins
c5bc87095b Handle realloc() failure correctly. 2003-10-16 07:07:20 +00:00
Mark Murray
0f66784721 Turn malloc+snprintf into asnprintf.
Submitted by:	David Hill <hill at phobia dot em ess>
2003-10-14 20:42:13 +00:00
Diomidis Spinellis
91b7d6dc58 - Check and report write(2) errors.
- Issue a single writev(2) call instead of multiple write(2)s.
  This change improves the inefficiencies introduced when echo
  went on an stdio diet.

The following figures are for echoing 1000 arguments.
original stdio-based echo:
        0.01 real         0.01 user         0.00 sys
before:
        0.05 real         0.00 user         0.04 sys
after:
        0.01 real         0.00 user         0.00 sys
2003-10-11 20:34:43 +00:00
Diomidis Spinellis
4566e7a433 Check for write errors; report and exit with error value. 2003-10-04 07:16:40 +00:00
David E. O'Brien
be2c4e5415 Be a little bit more correct WRT counting numbers vs. integer numbers. 2003-09-13 20:46:58 +00:00
Jens Schweikhardt
9e4656f7e8 Do not assume there is only a space between #define and the macro name
when grepping for JOBS. The recent style cleanup replaced the space with
a tab and broke job control detection. Little edits, disastrous consequences.

Submitted by:	Peter Edwards <pmedwards@eircom.net>
X-MFC when:	    in about 5 weeks with the other sh arithmetic fixes.
2003-09-13 06:59:22 +00:00
Tim J. Robbins
bc458f6637 Add the -m, -w and -x options to ls's usage message.
PR:		51493
Submitted by:	Walter Belgers
MFC after:	1 month
2003-09-09 12:02:52 +00:00
Ruslan Ermilov
fe08efe680 mdoc(7): Use the new feature of the .In macro. 2003-09-08 19:57:22 +00:00
Ruslan Ermilov
7b0ac2826b Don't escape names in MLINKS: this won't work with bsd.man.mk,v 1.53. 2003-09-07 12:52:17 +00:00
Jens Schweikhardt
4fe15b85a6 Fix testing of arith_assign() value for $((a=15)).
Submitted by:	Enache Adrian <enache@rdslink.ro>
2003-09-07 10:14:56 +00:00
Tim J. Robbins
94508dc9c8 #include <string.h> for prototypes for strcpy() and strlen().
Submitted by:	Stefan Farfeleder
2003-09-06 16:33:55 +00:00
Jens Schweikhardt
de7112e1ba Style cleanup, mostly
Requested by:	bde
2003-09-04 18:28:42 +00:00
Jens Schweikhardt
bc411549ba Implement missing shell arithmetic operators in $(()) expansion
and variable recognition.

PR:		standards/52972
Submitted by:	Wartan Hachaturow <wart@tepkom.ru>
Reviewed by:	tjr (improved on original patch)
Tested by:	buildworld on CURRENT.
MFC after:	6 weeks
2003-08-30 12:31:44 +00:00
Gordon Tetlow
442afd046f Stage 4 of dynamically linked root support. Add a big knob,
WITH_DYNAMICROOT, which will toggle the generation of dynamically-linked
binaries for installation in /bin and /sbin. It is currently off,
meaning that /bin and /sbin are still statically linked by default.

If something goes wrong (which I hope doesn't), this is what /rescue is
all about. Please do not try to use WITH_DYNAMICROOT and NO_RESCUE to
save space or some other equally silly reason. If you do and end up
having problems, you have been warned.
2003-08-17 08:37:47 +00:00
Hartmut Brandt
de244df7c9 Implement the nwchan keyword that has been in the man page, but was
not implemented. This is just handy if you want to ddb the address
some process is waiting on.
2003-08-13 07:35:07 +00:00
Jens Schweikhardt
a3c75939e8 Note in STANDARDS that -gno are not (yet?) POSIX conformant.
Spotted by:	harti
MFC after:	3 days
2003-08-08 17:04:17 +00:00
Robert Watson
ea03990629 Add additional documentation to setfacl(1) regarding the behavior of
tools such as chmod(1) and ls(1) when it comes to acting on objects
that have POSIX.1e extended ACLs.  Specifically, discuss the
substitution of the mask entry for the group entry in the mode
representation of the ACL.  Differently worded from the submission,
and could probably use further refinement.

PR:		55319
Submitted by:	Grzegorz Czaplinski <G.Czaplinski@prioris.mini.pw.edu.pl>
2003-08-07 14:52:17 +00:00
Robert Watson
95e367261e -v no longer a valid argument to setfacl(1) -- remove from usage().
PR:		55318
Submitted by:	Grzegorz Czaplinski <G.Czaplinski@prioris.mini.pw.edu.pl>
2003-08-07 14:43:43 +00:00
Christian Brueffer
a54b88d830 Clarify that the 'state' information consists of characters, not
only letters (e.g. IWs+)

PR:		55221
Submitted by:	Rich Morin <rdm@cfcl.com>
MFC after:	3 days
2003-08-05 10:31:28 +00:00
Andrey A. Chernov
508f10f7c1 Remove collate_range_cmp() stabilization, it conflicts with ranges 2003-08-03 04:28:10 +00:00
Mark Murray
ebb9f0efa8 Don't check for the existance of src/crypto/ for building items that
may contain crypto. The days of ITAR paranoia are over, and the simple
macro tests that remain are sufficient.
2003-07-24 18:30:25 +00:00
Ruslan Ermilov
8fe29a4f17 This code isn't WARNS=6 clean in the standard (crypto) case
due to bugs in OpenSSL headers.  I was testing in the wrong
environmement: standalone build without crypto/ sources.
2003-07-20 12:26:24 +00:00
Ruslan Ermilov
ff572a5e73 Make this code WARNS=6 clean again (after GCC 3.1.1 import).
Submitted by:	Marius Strobl <marius@alchemy.franken.de>
2003-07-20 10:24:09 +00:00
Robert Watson
4615eb20c3 When reporting an error internalizing an ACL string, print out the
ACL that generated the error, rather than the function, which is
more user-friendly.

Obtained from:	TrustedBSD Project
Product of:	France
2003-07-18 16:00:26 +00:00
Alexander Kabaev
08cbb1d115 Temporarily turn off -Werror for these components. 2003-07-11 05:24:32 +00:00
Christian Brueffer
d18ff742dc -l prints all permissions, not just owner and group
PR:		54294
Submitted by:	Per Hedeland <per@hedeland.org>
MFC after:	3 days
2003-07-10 20:53:56 +00:00
Gregory Neil Shapiro
dce6e6518b Remove MAINTAINER= lines from individual Makefiles in favor of the
MAINTAINER file (which already had entries for sendmail).
2003-07-07 03:54:04 +00:00
Diomidis Spinellis
2ba1b30bf5 Changes following CScout analysis:
- Removed dead declarations
- Made objects that should have been declared as static, static.

The changes use STATIC instead of static, following the existing
convention in the rest of the code.

Approved by:	schweikh (mentor)
MFC after:	2 weeks
2003-07-05 15:18:44 +00:00
Alexander Kabaev
be0d01f895 Rename a local variable in order to avoid collision with standard 'log'
function.
2003-06-30 17:05:40 +00:00
John-Mark Gurney
529a7167bd pass -1 to setfile in cp.c
Submitted by:	Jun Kuriyama
2003-06-30 06:16:06 +00:00
Gordon Tetlow
6d1b4a4730 Tweak a couple of utilities so they compile cleanly for /rescue. Mostly
path fixes.

Submitted by:	Tim Kientzle <kientzle@acm.org>
2003-06-29 18:46:18 +00:00
Ruslan Ermilov
ce17762f4a Unbreak NOCRYPT buildworld.
Reviewed by:	markm
2003-06-29 10:03:35 +00:00
John-Mark Gurney
a6b05ab6ea support saving both user/group and permissions on symlinks (from PR)
also fix a slight bogon that assumed an fd of 0 was not valid.  Changed
it to be -1.

PR:		bin/25017
Submitted by:	Martin Kammerhofer
2003-06-22 07:02:17 +00:00
Mark Murray
eac4bdcca4 Get this area compiling with the highest WARNS= that it works with.
Obsolete WFORMAT= junk also removed where possible.

OK'ed by:	obrien
Tested on:	sparc64, alpha, i386
2003-06-13 07:04:02 +00:00
Scott Long
48b8c0de5a Add the -H option to ps(1) to display all kernel visible threads in each
process.  The default behavior of showing only the process is retained as
the default.
2003-06-12 16:53:55 +00:00
Philippe Charnier
c6e6912512 add section name to .Xr 2003-06-08 09:48:39 +00:00
Mark Murray
8027fe397a Fix for the NO_OPENSSL case.
Reported by:	Marius Strobl <marius@alchemy.franken.de>
2003-06-08 08:24:07 +00:00
Ruslan Ermilov
7d2191c827 Clarify what -p option does.
Prodded by:	marcel

While here, spell the "set-{user,group}-ID bit" correctly.
2003-06-07 06:35:36 +00:00
Jun Kuriyama
3a624f5e23 Use
cat ${.ALLSRC} > ${.TARGET}
rather than
	ln -sf ${.ALLSRC} ${.TARGET}
not to depends on absolute-path of symbolic links.

Commented by:  marcel, obrien, bde
2003-06-06 13:46:55 +00:00
John Hay
ae75fcbdb0 Make ed compile in the NOCRYPT case.
Reviewed by:	markm
2003-06-03 17:03:48 +00:00
Bruce Evans
1da10b118b Catch up with revs 1.49-1.50 of df.c: don't mention -t in the BUGS section
since it has been fixed.
2003-06-03 12:00:35 +00:00
Bruce Evans
0e7d023f34 Fixed exit code in previous commit. "var++" to set a flag to nonzero
is a style bug at best.  When the variable isn't a flag, it potentially
overflows after a large number of settings.  Here the number of settings
is limited by ARG_MAX, but the variable is the exit code so it became
bogus after the second setting and effectively overflowed to 0 after
approx. 128 settings.

Fixed some style bugs involving comments in and near previous commit.

Clarification of previous commit message: df -t didn't give undefined
behaviour, and the behaviour used to conform perfectly with the man
page, since the buggy behaviour is documented in the BUGS section.  -t
just worked when no files or file systems were specified, and was just
ignored if a file or file system was specified.
2003-06-03 11:54:42 +00:00
Jordan K. Hubbard
c22acefba5 From the df man page:
-t Only print out statistics for filesystems of the specified types.

Make the behavior of df(1) conform to its man page (behavior is otherwise
undefined).

Submitted by:	Rob Braun <bbraun@apple.com>
Obtained from:	Apple
2003-06-02 22:33:12 +00:00
Mark Murray
eb338d3666 Modernise. Use libcrypto for DES instead of libcipher. 2003-06-02 19:06:28 +00:00
Bill Fenner
99907703d9 Instead of eating trailing newlines after inserting them into the
output buffer, don't insert them at all.  This prevents a buffer
*underrun* when the substitution consists completely of newlines
(e.g. `echo`) and the byte before the source buffer to which p
points is a '\n', in which case more characters would be removed
from the output buffer than were inserted.

This fixes certain port builds on sparc64.

Approved by:	re (scottl)
Reviewed by:	des, tjr
2003-05-31 06:27:57 +00:00
Ruslan Ermilov
c75a6a726b Erase whitspace at EOL.
Approved by:	re (blanket)
2003-05-22 13:10:32 +00:00
Dag-Erling Smørgrav
7691f66abf Retire the useless NOSECURE knob.
Approved by:	re (scottl)
2003-05-19 15:52:01 +00:00