Commit Graph

1878 Commits

Author SHA1 Message Date
dwmalone
7b9c2a75cb 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
gad
4c97ab9a6b Get rid of a cast to '(void) ' on the return of a call to strcpy. 2004-06-22 02:18:29 +00:00
gad
1612cc764a 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
gad
100cf50efc Add 'const' to a few places.
PR:		bin/65803
Submitted by:	Cyrille Lefevre
2004-06-22 02:06:42 +00:00
gad
f96454693f 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
gad
57fc96777e 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
gad
d1fec75493 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
gad
28655618da 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
gad
0714a435ad 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
gad
ac7ee58267 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
0593a5cf63 Typo: s/SunOP/SunOS/g. 2004-06-16 12:57:31 +00:00
obrien
fd072ddeb0 style.Makefile(5) 2004-06-13 19:22:53 +00:00
das
7a9a1abd40 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
das
e79220be15 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
yar
b6777db5c3 Remove a duplicated description of the test for the null string.
MFC after:	3 days
2004-06-07 12:47:31 +00:00
yar
567ef40f7c 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
tjr
910a337577 Plug file descriptor leak in implementation of -n option. 2004-06-05 02:32:21 +00:00
das
a1578f8ca1 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
le
2d21611274 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
gad
77ecbca56f 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
gad
60e8e40dcb 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
gad
cada0251dc 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
gad
a100c13940 Make a few style-istic improvements to the previous commits.
Noticed by:	bde
2004-06-01 18:12:04 +00:00
gad
e731d42790 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
gad
5fd6ebe556 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
gad
021eb8fec4 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
pjd
cf0d941cbc Use humanize_number(3).
Reminded by:	jhb
2004-05-25 14:53:47 +00:00
gad
3ae386f0f4 Add pgrep(1) and pkill(1) to the cross-reference section of ps(1). 2004-05-25 14:05:25 +00:00
pjd
00ba733985 Use humanize_number(3) to format sizes into a human readable form. 2004-05-24 22:22:29 +00:00
stefanf
5b88d9b80f Include <stdio.h> for a sprintf() prototype.
Approved by:	das (mentor)
2004-05-24 10:11:31 +00:00
gad
b306a280d2 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
gad
0474dcf34b 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
gad
02b7ff88ea 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
ru
7c9db78ce6 Assorted markup fixes. 2004-05-16 21:35:05 +00:00
ru
ae79646ad9 Punctuation. 2004-05-16 21:34:49 +00:00
ru
ee95a80180 Fixed spelling of the document date. 2004-05-16 21:34:31 +00:00
ru
338f050222 Bump document date for the latest functional change.
Minor markup tweaks.
2004-05-16 21:34:15 +00:00
ru
414a4ac92c DESCRIPTION was not updated for the new SYNOPSIS. 2004-05-16 21:33:48 +00:00
ru
ef7ae94c87 Added -v to usage(). 2004-05-16 20:41:11 +00:00
cognet
548b0bdf38 Use WARNS?=3 for these in the arm case for now, due to toolchain issues. 2004-05-14 13:31:21 +00:00
tjr
29e5113dea 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
tjr
94b5610007 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
das
7a3d9994db 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
obrien
5a20695040 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
obrien
e8080c6d24 Add 'g' to SYNOPSIS. 2004-04-22 16:33:54 +00:00
obrien
a29d7229cd 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
obrien
4462face4e Add -c option simular to du(1).
PR:		19635
Submitted by:	cyrille.lefevre@laposte.net
2004-04-18 20:56:31 +00:00
green
3f49d29659 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
njl
be3c824822 Style fixes and add gen to CLEANFILES.
Submitted by:	bde
2004-04-09 07:13:27 +00:00
green
65e2cfe074 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