Apparently with the new pts code stalled entries are printed, when they are
not with the BSD ptys.
Submitted by: Michal Mertl <mime at traveller dot cz>
3 columns were wasted at the left, except these columns were used to
make the header line up. Now there is no space on the same line for
the "Proc:" part of the header. Try putting this on the line above
although it clutters that line (there is already similar clutter for
the "Interrupts" header). Leave 1 column between these fields. With
the above and a previous change there is enough of space for this.
Use 5 columns instead of 3 for the number of users since 3 is not quite
enough and there was space to spare. This also fixes an off-by-2 error
in a previous fix forthe column count in the comment on STATROW.
Move all the pager fields 1 to the right so that the "count" and "pages"
descriptors more clearly apply to the pager fields and not the memory
fields. There was space to space.
Waste some of the spare space at the right of the pager fields to expand
all the pager field widths to their old values (but now with a column
between the fields). There are fields more in need of expansion but most
of them are not in places near spare space.
made it unnecessary. (Rev.1.6 had to reduce the field width to 4, and
changed 100.0 and preposterous larger values down to 99.9 since 100.0
wouldn't have fitted. Rev.1.35 handles precentages > 99.9 well enough by
changing the format to %.0f when the string given by the initial format
is too wide.)
Even with this change, during short testing I've never seen a percentage
of 100 being displayed by systat -v, although top(1) displays percentages
of 100 user or 100 idle for similar loads.
Always use snprintf()'s return value, since discarding it is a style
bug at best and using it here gives slightly simpler code and better
error checking. Use snprintf() in putlongdouble() the same as in
putfloat(). (1.25 changed most sprintf()'s to snprintf()'s to fix
non-bugs without changing the logic to use the result of snprintf();
1.27 restored one of the sprintf()s by cloning a stale version of
putfloat().)
Don't print a too-long field in the unlikely case that the fallback
to M units in putint() leaves the field still too long. (The fallback
to printing stars was lost in rev.1.58 when the fallback to M units
was added.)
cannot run into other fields or field descriptors. If the value is
too large to fit in the field width, then the output format is adjusted
so that the value (usually) fits, but with fields running together
externally this adjustment usually didn't help. Mostly it doesn't
matter to lose 1 digit of precision, but switching the output format
is bad if it happens often or gives bogus units. The loss of width
is most serious for fields near "Csw" (which are also the ones which
must often ran together) since these have a high variance and large
values relative to the possible field widths so the switch occurs more
often now, and for the memory size fields where the switch gives the
bogus units kKB or MKB.
Now only the fields for r, p, d, s and w can run into each other.
These fields have width 3, and 3 cannot be reduced to 2 without losing
all precision when the value is between 100 and 999.
Trim "pdwake" to "pdwak" at think time now that it doesn't get clobbered
at runtime. The manpage doesn't need to be changed for this because
it documents the clobbered descriptor, unlike for 4 other too-long
descriptors which only get clobbered if there are lots of interrupt
sources.
Trim "% busy" to "%busy" since most other descriptors for percentages
are spelled without the space and this change makes changing the widths
of the %busy fields unnecessary.
around PUTRATE() because PUTRATE() only looked like a function -- it was
multiple statements. Use "do {...} while(0)" as usual in PUTRATE() so
that it is a single statement that can be used like a function.
large. In most cases it is still 1 too large, so fields tend to run
together, but in the following cases it was more than 1 too large, and
the starting column was too small too, so the field started inside the
previous field or descriptor and clobbered that:
- "wire": the number for this overwrote 2 characters of the number for
"Flt". Reduce the field width by 3 (2 to avoid the overwrite and 1
so that the fields don't run together). This was already done for
the preceding number for "cow".
- "inact": the number for this overwrote 1 character of the descriptor
"Idle". Reducing the field width by 2 is enough.
- "cache:" the number for this overwrote 3 characters of the scale
"...| |". The field width should be reduced by 4 to keep things
from running together, but that is a lot and not so necessary here
since the final "|" in the scale serves as a delimiter. Only reduce
it by 3.
- "free": the number for this overwrote 2 characters of the bar graph.
The character position under the final "|" in the scale is apparently
not used, so reducing the field width by 3 is enough.
When "zfod" is in the main vmstat display:
- use the normal field width of 9 (not 5) for it since there is no shortage
of space. Fix style bugs (excessive {}) in the statement that
conditionally writes it.
Write all reduced field widths for vmstat fields as "9 - <reduction>" as
a hint that we don't want to reduce them.
number in more cases by stealing 2 characters from the count field to
give more space in the descriptor field, but it did the column adjustments
for this strangely using an off-by-2 error in the base column and
compensating off-by-2 errors in 6 offsets from the base column (4 new
errors and 2 from not changing the offsets that actually changed).
Print the "Interrupts" header directly at its offset from the base column
instead of spacing it half using the offset and half by printing a space
character.
current tab, however the code it replaced wanted to round to the
next TAB. Consequently things like this:
( echo 1 ; echo 2 ) | column
cause column to loop indefinitely. This patch is slightly different
from the one Gary submitted, but is closer to the original code.
Submitted by: Gary Cody <gary@lyranthe.org>
MFC after: 1 week
events. The specifics of submitting the records is contained within
login_audit.c.
Document the auditing behavior in the man page.
Obtained from: TrustedBSD Project, Apple Computer, Inc.
Approved by: rwatson (mentor)
Correct insecure temporary file usage in ee. [06:02]
Correct a race condition when setting file permissions, sanitize file
names by default, and fix a buffer overflow when handling files
larger than 4GB in cpio. [06:03]
Fix an error in the handling of IP fragments in ipfw which can cause
a kernel panic. [06:04]
Security: FreeBSD-SA-06:01.texindex
Security: FreeBSD-SA-06:02.ee
Security: FreeBSD-SA-06:03.cpio
Security: FreeBSD-SA-06:04.ipfw
$ su
% kill -STOP $$
where su is executing (t)csh. csh's job handling is a little more
special than that of (a)sh, bash and even zsh and blows up a little
more spectacularly. This modification restores the original mucking
about with the tty pgrp, but is careful to only do it when su (or
su's child) is the foreground process.
While I'm here, fix a STDERR_FILENO spelling as suggested by bde.
su isn't the foreground process. Hopefully this won't break PAM,
but I couldn't find any useful information about ache's theory
that it will.
Specifically, this change fixes the following:
# sh
# echo $$
# su - root -c id &
# echo $$
The PID output changes as su seems to be kill -STOP'ing itself
and catching the parent shell in the process. This is especially
bad if you add a ``su - user -c command &'' to an rc script!
Sponsored by: Sophos/Activestate
Not objected to by: des
type which is a String type that has no -s limitations applied to it.
Change most Strings in the code to Names and add a few extra syscalls,
namely munmap, read, rename and symlink. This was enough to facilitate
following file descriptor allocations in the code more easily and
getting a hint at what's being read/written from/to files. More
syscalls should really be added.
While here, fix an off-by-one bug in the buffer truncation code and
add a fflush so that truss's output reflects the syscall that the
program is stuck in.
Sponsored by: Sophos/Activestate
MFC after: 2 weeks
but don't expect a proper ASCII string to exist right here right now, don't
use strcmp(3) which checks for a NUL. As we're still building the argument
up, the next character might be garbage. It would probably be just as safe to
temporarily write a NUL there, but if we've reached the end of argument memory
that might not be the best idea, I think. It's unclear.
Doing it this way seems to meet the most with the original intent.
PR: 85696
Prodded by: stefanf
with upper and lower case letters from the English alphabet. Change
the number of possible file names mktemp will return from 26**6
to (10+26+26)**6 instead. This keeps things consistent with mkstemp(3)
with FAST_IPSEC rather than the KAME IPSEC stack.
Note that the output of "netstat -s -p ipsec" differs depending on which
stack is compiled into the kernel since they each keep different stats.
This delta also adds the "esp", "ah", and "ipcomp" protocol stats, which
are also available when the kernel is compiled with the FAST_IPSEC stack
(e.g. "netstat -s -p esp").
Submitted by: Matt Titus <titus at nttmcl dot com>
MFC after: 3 days
holiday is now celebrated on December 1st. From the PR:
December 1 was adopted as National Day in 1990, being the day of
celebration of the Great Assembly of Alba Iulia which voted for the
union of Transylvania with Romania and which symbolise the union of all
Romanians within a single state and the achievement of the unity of
Romanian national state. [1]
[1] LAW Number 10 from July 31st, 1990
Regarding the proclamation of the National Day of Romania
http://www.1decembrie.ro/en/index.php?option=com_content&task=view&id=1&Itemid=4
PR: docs/90673
Submitted by: Ion-Mihai "IOnut" Tetcu
Originally pointed out by: Cornel Ilie <cornel dot c punkt ilie at gmail punkt com>
means:
o Remove Elf64_Quarter,
o Redefine Elf64_Half to be 16-bit,
o Redefine Elf64_Word to be 32-bit,
o Add Elf64_Xword and Elf64_Sxword for 64-bit entities,
o Use Elf_Size in MI code to abstract the difference between
Elf32_Word and Elf64_Word.
o Add Elf_Ssize as the signed counterpart of Elf_Size.
MFC after: 2 weeks
case. It seems entries are in reverse order when read from the kernel
memory but in the right order when read from a file (i.e. ALQ). Handle
both cases.
MFC after: 1 day
option is undocumented because it does nothing. It does nothing
because bsdtar never needs it. It is accepted because gnutar does
sometimes need it and many scripts use it.
Reported by: Pawel Jakub Dawidek
time_t and times will look incorrect on machines with 64bit time_t.
PR: 88788
Submitted by: Keith White <Keith.White -at- site.uottawa.ca>
MFC after: 1 week
service name instead of channel number with -c command option. Supported
service names are: DUN (Dial-Up Networking), FAX (Fax) and SP (Serial Port).
MFC after: 1 week
This includes fixes and cleanups listed below:
- If a process dissappears while we are signalling it, don't count it as a
match/error.
- Better handling of errors and messages.
- Downgrade failure to kill(2) (other than ESRCH) from fatal error to a
warning; otherwise processing aborts and possibly matching killees would
remain unsignalled. This makes pkill match the Solaris behavior.
- Exit with 2 on usage errors as documented.
Obtained from: NetBSD
Glanced at by: maintainer (gad) [a bit different version of this patch]
% pgrep <something> [to verify which processes match]
% pkill <something>
To speed such operation up, add -I option which works like rm(1)'s -i
option (unfortunately -i is already used in pkill(1)), ie. pkill will
ask for confirmation before killing each matching process.
After adding -j, -F, -i, -S, -o and -L options and other improvements,
I think I can add myself to the copyright header.
Glanced at by: maintainer (gad)
kernel memory and not using sysctl. Previously, libmemstat was used
only for the live kernel via sysctl paths.
This results in netstat output becoming both more consistent between
core dumps and the live kernel, and also more information in the core
dump case than previously (i.e., mbuf cache information).
Statistics relating to sfbufs still rely on a kvm descriptor as they
are not currently exposed via libmemstat. netstat -m operating on a
core is still unable to print certain sfbuf stats available on the live
kernel.
MFC after: 1 week
when list the archive contents, then try to extract selected files
(file selection always works against unedited pathnames). With this change,
-t always shows the pathnames as they appear in the archive.
Thanks to: Robert Watson
this by accessing the cdev_priv element of the cdev structure. Looking
forward we need a better way to handle this, as this structure shouldn't
be frobbed by userspace.
Submitted by: Doug Steinwand
PR: bin/88203
MFC after: 1 week
Discussed with: phk
field holding the threadid. This is more useful for libthr than
libpthread, but still quite useful in libpthread as it can be used to
process interlaced records from multiple threads over the course of a
system call.
Detect old ktr_buffer values using the heuristic "if it's negative,
then it must not be a valid threadid". This may leave something to be
desired.
MFC after: 1 month
Reviewed by: davidxu
This causes attempts to update a non-existent file to report
an actual error instead of triggering an assertion failure.
PR: bin/87911
Thanks to: roemer.ulrich
MFC after: 3 days
Note: This does not entirely fix bin/87911. I need to decide on
the "correct" response when someone tries to update a non-existent
archive file.
command is handled as a shell function. This avoids the following
peculiar behaviour when /usr/bin is on a case-insensitive filesystem:
# READ foo
(... long pause, depending upon the amount of swap space available ...)
sh: Resource temporarily unavailable.
Reported by: I can't remember; someone on IRC.
MFC after: 1 week
looked for in the system make file directory or in the specified
-m paths instead of always looking in the other -I and .PATH
specified paths. (Commit log shamelessly stolen from NetBSD.)
Reviewed by: yar
appear to be never called:
(1) If a function is never called according to its call count but it
must have been called because its child time is nonzero, then print
it in the flat profile. Previously, if its call count was zero
then we only printed it in the flat profile if its self time was
nonzero.
(2) If a function has a zero call count but has a nonzero self or child
time, then print its total self time in the self time per call
column as a percentage of the total (self + child) time. It is
not possible to print the times per call in this case because the
call count is zero. Previously, this was handled by leaving both
per-call columns blank. The self time is printed in another column
but there was no way to recover the total time.
(1) partially fixes the case of the "never called" function main() and
prepares for (2) to apply to main() and other functions. Profiling
of main() was lost in the conversion from a.out to ELF, so main()'s
call count has always been zero for many years; then in the common
case where main() is a tiny function, it gets no profiling ticks, so
main() was completely lost in the flat profile.
(2) improves mainly cases like kernel threads. Most kernel threads
appear to be never called because they are always started before
userland can run to turn on profiling. As for main(), the fact that
they are called is not very interesting and their callers are
uninteresting, but their relative self time is interesting since they
are long-running.
Almost always printing percentages in the per-call columns would be
more useful than almost always printing 0.0ms. 0.1ms is now a long
time, so only very large functions take that long per call. The accuracy
per call can approach 1-10 nsec provided programs are run for about
100000 times as long as is necessary to get this accuracy with high
resolution kernel profiling.
you want to see, e.g., sendmail arguments mail(1) will use.
-H is not an independent flag, it's a modifier. Also explicitly
say that -H will cause mail(1) to exit as soon as it prints the headers.
MFC after: 5 days
Add a flags argument to wait_for_lock so that O_NONBLOCK can be
passed to open if a user doesn't want the open to sleep until the
lock becomes available.
Submitted by: Amir Shalem (partially modified)
for mutual exclusion:
A brief description of the problem:
1) Proc A picks up non-blocking lock on file X
2) Proc B attempts to pickup lock, fails then waits
3) Proc C attempts to pickup lock, fails then waits
4) Proc A releases lock
5) Proc B acquires lock, release it to pickup a non-blocking version
6) Proc C acquires lock, release it to pickup a non-blocking version
7) Both process B and C race each other to pickup lock again
This occurs mainly because the processes do not keep the lock after they have
been waiting on it. They drop it, attempt to re-acquire it. (They use the wait
to notify when the lock has become available then race to pick it up). This
results in additional CPU utilization during the race, and can also result
in processes picking locks up out of order.
This change attempts to correct this problem by eliminating the test/acquire
race and having the operating system handle it.
Reported by: kris
Tested by: kris
MFC after: 1 week
Split commands into two groups: one with optional count and one with
required argument. Changed synopsis line accordingly.
Added some hopefully-helpful comments based on experiments, knowing
that not all hardware works the same.
PR: docs/84101
Approved by: keramida
MFC after: 3 days
replacement and has additional features which make it superior.
Discussed on: -arch
Reviewed by: thompsa
X-MFC-after: never (RELENG_6 as transition period)
-- Made the synopses more precise.
-- Added argument to flag in option description.
-- Moved -b default and limits to option description (to un-hide).
-- Noted several behaviors that were not mentioned.
-- A few more trivial changes.
PR: docs/46787
Approved by: keramida
MFC after: 3 days
a -B option which causes bpf peers to be printed. This option can be
used in conjunction with -I if information about specific interfaces
is desired. This is similar to what NetBSD added to their version of
netstat.
$ netstat -B
Pid Netif Flags Recv Drop Match Sblen Hblen Command
1137 lo0 p--s-- 0 0 0 0 0 tcpdump
205 sis0 -ifs-l 37331 0 1 0 0 dhclient
$
$ netstat -I lo0 -B
Pid Netif Flags Recv Drop Match Sblen Hblen Command
1174 lo0 p--s-- 0 0 0 0 0 tcpdump
$
-Add bpf.c which stores all the code for retrieving and parsing bpf
related statistics.
-Modify main.c to add support for the -B option and hook it into the
program logic.
-Add bpf.c to the build.
-Document this new functionality in the man page and bump the revision
date.
-Add prototype for bpf_stats function.
if none was specified on the command line. This is not permitted by
POSIX, and no longer needed now that we have the -a option.
PR: 85099
Submitted by: Toby Peterson (Apple Computer)
integer to an unsigned long. This lifts variables like the maximum
number of pages available for shared memory from 2^31 to 2^32 on 32
bit architectures, and from 2^31 to 2^64 on 64 bit architectures.
It should be noted that this changes breaks ABI on 64 bit architectures
because the size of the shmmax, shmmin, shmmni, shmseg and shmall members
of the shminfo structure has changed.
Silence on: current@
constructing and applying binary patches; in particular, they perform
well (in the sense of constructing small patches) for executable code.
Both portsnap (coming to the base system Real Soon Now) and FreeBSD
Update (coming to the base system a bit later) use bspatch.
This is the same code as the bsdiff-4.2 which has been in the ports
tree (misc/bsdiff) for the past year, with the following exceptions:
1. The license is now the traditional 2-clause BSD;
2. Instead of forking and execing bzip2, the code now uses libbz2; and
3. Some minor changes have been made to fit this code into the base
system (adding $FreeBSD$ tags, putting bsdiff and bspatch into separate
directories, etc.)
This code is rather ugly and has lots of style bugs (mostly because I
wrote it before I had ever heard of style(9)). Some day I'll come
back and clean it up.
Discussed on: freebsd-arch
MFC before: 5.5-RELEASE
Tested by: Several million users (earlier version).
set up before it is called, so move the progname initialization before
the first possible call to bsdtar_warnc().
Thanks to: Stanislav Sedov
PR: bin/83366
MFC after: 7 days
cdev structure, returns the device name associated with it through
the __si_namebuf member. This un-breaks the processing of devices.
This is a RELENG_6 candidate.
Reviewed by: phk
- Remove some extra blank lines.
- Remove comments that don't contribute to understanding.
- Remove additional blank lines in output added to maximize compatibility
with older vmstat output, but that is actually somewhat gratuitous.
Submitted by: bde
MFC with: other vmstat libmemstat(3) changes
statistics from -z are now a bit different due to changes in the
way statistics are now measured. Reproduce with some amount of
accuracy the slightly obscure layouts adopted by the two kernel
sysctls. In the future, we might want to normalize them.
GC dosysctl(), which is now no longer used.
MFC after: 1 week
avg/median/stddev bars onto separate lines for readability if the
ranges overlapped. In 2005, ministat was extended to support more than
2 datasets, but the -s code was not updated. It will coredump if run
with -s and >2 sets.
PR: 82909
Submitted by: Dan Nelson <dnelson@allantgroup.com>
commands for this target are appended to the .END target instead
of beeing executed now. They are executed when the graph is finished.
There was a bug with executing the .END target which came in when
doing conversion to LST_FOREACH() which caused make to dump core.
PR: bin/83698
Submitted by: Max Okumoto <okumoto@ucsd.edu>
MFC after: 3 days
with a number of positive benefits:
- Start using UMA(9) statistics for mbufs and clusters, which avoids
using the mbuf allocator statistics which suffer from races under
load on SMP. This should eliminate "negative" mbuf counts in
netstat -mb.
- We are now able to track cached (free) mbufs and clusters and count
it towards memory allocated by the network stack.
- We are now also able to track memory allocated to mbuf tags since
libmemstat(3) can also query malloc(9). We don't print this except
as part of the total (for now - #if 0).
- We are now able to track mbuf/cluster/packet allocation failures,
although they are not currently printed (#if 0).
- Don't print out sfbuf statistics when running on a kernel core, as
currently that code is able only to query sysctl for statistics.
MFC after: 1 week
1) An unquoted space is always a separator, even when not "in_arg".
2) When a new destination buffer must be allocated during variable
substitution, only copy data from the active buffer to the new
one when we *are* "in_arg".
These were noticed when testing variable-substitution of variables
which have null values, and are not inside quoted strings...
MFC plans: after a few days, and re@ approval...
was a separator character immediately before it. This wasn't likely to
happen in #-lines, but we might as well get it right. Also fix it so
that "" and "" will create a zero-length argument.
Approved by: re (blanket `env')
start with a '/', they are more supported (by POSIX and SUSv3) than
filenames which have an '=' in them.
Noticed by: tjr
Approved by: re (blanket `env')
apart a string, and supports some text substitutions. This can be
used to provide all the flexibility (and more!) that was lost by recent
changes to how the kernel parses #!-lines in shell scripts.
The '-P' option provides a way to specify an alternate set of directories
to use when searching for the 'utility' program to run. This way you can
be sure what directories are used for that search, without changing the
value of PATH that the user has set. Note that on FreeBSD 6.0, this
option is worthless unless the '-S' option is also used.
Approved by: re (blanket `env')
without checking it for an equals-sign. If it starts with a slash, then
it cannot be a request to set the value of a valid environment variable.
Approved by: re (blanket `env')
it does not happen until all single-letter options are processed. This will
be important for the -S option, which will be coming soon.
Approved by: re (blanket `env')
malloc(9) statistics from kernel memory or a kernel coredump, to catch
up with recent changes to adopt per-CPU malloc(9) statistics. The new
routines walk the per-CPU statistics pools and coalesce them for
presentation to the user.
the string. Until now this caused no harm, because the buffer code used
to tack two NULs onto buffers. With the new, soon to come, parsing code
this isn't the case anymore in all cases, so fix this.