summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pstat
Commit message (Collapse)AuthorAgeFilesLines
* - Avoid overflowing the swap size counters in human-readable modestas2009-08-151-2/+3
| | | | | | | | | | by introducing the new CONVERT_BLOCKS macro which operates on sizes already converted to number of blocks. With this macro it is not longer needed to perform needless multiplication by blocksize just to divide on it later in CONVERT macro. Approved by: re (kib) MFC after: 1 week
* - Make pstat(8) WARNS=6 safe.stas2009-06-112-22/+33
| | | | | | | - While here, eliminate the check for len > 0 in ttymode_sysctl as the code is able to handle this case well. Reviewed by: ed (initial version)
* Correct my previous commit to pstat(8).ed2009-06-111-1/+1
| | | | | | | Not only mark the strings inside the array as const, but do the same for the elements of the array itself. Submitted by: Christoph Mallon
* Make most of pstat(8) build with WARNS=6.ed2009-06-111-6/+7
| | | | | There is still an issue with the nlists, which I'm not quite sure how to solve, so I'm leaving WARNS set to 3 right now.
* Serialize write() calls on TTYs.ed2009-02-112-0/+10
| | | | | | | | | | | | | | | | | | | | Just like the old TTY layer, the current MPSAFE TTY layer does not make any attempt to serialize calls of write(). Data is copied into the kernel in 256 (TTY_STACKBUF) byte chunks. If a write() call occurs at the same time, the data may interleave. This is especially likely when the TTY starts blocking, because the output queue reaches the high watermark. I've implemented this by adding a new flag, TTY_BUSY_OUT, which is used to mark a TTY as having a thread stuck in write(). Because I don't want non-blocking processes to be possibly blocked by a sleeping thread, I'm still allowing it to bypass the protection. According to this message, the Linux kernel returns EAGAIN in such cases, but I think that's a little too restrictive: http://kerneltrap.org/index.php?q=mailarchive/linux-kernel/2007/5/2/85418/thread PR: kern/118287
* Don't leave the console TTY constantly open.ed2009-02-052-19/+22
| | | | | | | | | | | | | | | | | When we leave the console TTY constantly open, we never reset the termios attributes. This causes output processing, echoing, etc. not to be reset to the proper values when going into single user mode after the system has booted. It also causes nl-to-crnl-conversion not to take place during shutdown, which causes a `staircase effect'. This patch adds a new TTY flag, TF_OPENED_CONS, which is set when the TTY is opened through /dev/console. Because the flags are only used by the kernel and the pstat(8) utility, I've decided to renumber the TTY flags. This shouldn't be an issue, because the TTY layer is not yet part of a stable release. Reported by: Mark Atkinson <atkin901 yahoo com> Tested by: sepotvin
* Clamp the values of t_column to 5 digits in `pstat -t' and `show all ttys'.ed2008-11-011-1/+1
| | | | | | | | We often run into these very high column numbers when we run curses applications, because they don't print any newlines. This messes up the table output of `pstat -t'. If these numbers get really high, they aren't of any use to the reader anyway. Convert them to `99999' when they run out of bounds.
* Introduce a hooks layer for the MPSAFE TTY layer.ed2008-09-222-0/+3
| | | | | | | | | | | | | | | | | | | | One of the features that prevented us from fixing some of the TTY consumers to work once again, was an interface that allowed consumers to do the following: - `Sniff' incoming data, which is used by the snp(4) driver. - Take direct control of the input and output paths of a TTY, which is used by ng_tty(4), ppp(4), sl(4), etc. There's no practical advantage in committing a hooks layer without having any consumers. In P4 there is a preliminary port of snp(4) and thompsa@ is busy porting ng_tty(4) to this interface. I already want to have it in the tree, because this may stimulate others to work on the remaining modules. Discussed with: thompsa Obtained from: //depot/projects/mpsafetty/...
* Fix a small typo in the pstat(8) manual page.ed2008-08-201-1/+1
| | | | | The second LOW column of the pstat(8) command refers to the low watermark of the output queue.
* Integrate the new MPSAFE TTY layer to the FreeBSD operating system.ed2008-08-202-163/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The last half year I've been working on a replacement TTY layer for the FreeBSD kernel. The new TTY layer was designed to improve the following: - Improved driver model: The old TTY layer has a driver model that is not abstract enough to make it friendly to use. A good example is the output path, where the device drivers directly access the output buffers. This means that an in-kernel PPP implementation must always convert network buffers into TTY buffers. If a PPP implementation would be built on top of the new TTY layer (still needs a hooks layer, though), it would allow the PPP implementation to directly hand the data to the TTY driver. - Improved hotplugging: With the old TTY layer, it isn't entirely safe to destroy TTY's from the system. This implementation has a two-step destructing design, where the driver first abandons the TTY. After all threads have left the TTY, the TTY layer calls a routine in the driver, which can be used to free resources (unit numbers, etc). The pts(4) driver also implements this feature, which means posix_openpt() will now return PTY's that are created on the fly. - Improved performance: One of the major improvements is the per-TTY mutex, which is expected to improve scalability when compared to the old Giant locking. Another change is the unbuffered copying to userspace, which is both used on TTY device nodes and PTY masters. Upgrading should be quite straightforward. Unlike previous versions, existing kernel configuration files do not need to be changed, except when they reference device drivers that are listed in UPDATING. Obtained from: //depot/projects/mpsafetty/... Approved by: philip (ex-mentor) Discussed: on the lists, at BSDCan, at the DevSummit Sponsored by: Snow B.V., the Netherlands dcons(4) fixed by: kan
* Remove OTTYDISC, NETLDISC and NTTYDISC definitions.ed2008-07-161-4/+0
| | | | | | | | | | | | | | | | When I ported most applications away from <sgtty.h>, I noticed none of them were actually using these definitions. I kept them in place, because I didn't want to touch tools like pstat(8) and stty(1). In preparation for the MPSAFE TTY layer, remove these definitions. This doesn't have any impact with respect to binary compatibility (see tty_conf.c). We couldn now add an #error to <sys/ioctl_compat.h> when included outside the kernel. Unfortunately, kdump's mkioctls includes this file unconditionally. Approved by: philip (mentor)
* Fix pstat behaviour when using coredumps. The reference to tp wasremko2008-05-141-1/+1
| | | | | | | | | | incorrect and should have been poining to &tty, tp is a virtual address from the coredump, while we should obtain the address through the tty struct. Approved by: imp (mentor, implicit trivial changes) MFC after: 1 week Submitted by: Ed Schouten (ed at 80836 dot nl)
* Significantly reduce the memory leak as noted in BUGS section forscf2007-07-041-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | setenv(3) by tracking the size of the memory allocated instead of using strlen() on the current value. Convert all calls to POSIX from historic BSD API: - unsetenv returns an int. - putenv takes a char * instead of const char *. - putenv no longer makes a copy of the input string. - errno is set appropriately for POSIX. Exceptions involve bad environ variable and internal initialization code. These both set errno to EFAULT. Several patches to base utilities to handle the POSIX changes from Andrey Chernov's previous commit. A few I re-wrote to use setenv() instead of putenv(). New regression module for tools/regression/environ to test these functions. It also can be used to test the performance. Bump __FreeBSD_version to 700050 due to API change. PR: kern/99826 Approved by: wes Approved by: re (kensmith)
* Back out all POSIXified *env() changes.ache2007-05-011-3/+3
| | | | | | | | | Not because I admit they are technically wrong and not because of bug reports (I receive nothing). But because I surprisingly meets so strong opposition and resistance so lost any desire to continue that. Anyone who interested in POSIX can dig out what changes and how through cvs diffs.
* Preparing for upcoming POSIXed putenv() rewrite:ache2007-04-301-3/+3
| | | | don't allow const as putenv() arg, dup it
* - Recognize -g and -m in pstat(8) too.ru2007-04-032-6/+6
| | | | | | - Document -g and -m support in swapinfo(8). Reviewed by: markm
* Add -m (megabytes) and -g (gigabytes) options. I'm tired of being toldmarkm2007-04-012-4/+20
| | | | | | I can't do this. MFC: 1 month
* Another crashdump fix: nfiles was renamed to openfiles in 5.x.jhb2007-02-141-1/+1
| | | | MFC after: 3 days
* Print (total - used) as the amount of available swap for a swap devicerwatson2005-11-171-1/+1
| | | | | | | | when printing swapinfo output, rather than (total), as that is (strictly speaking) more accurate. Pointed out by: Rob <spamrefuse at yahoo dot com> MFC after: 3 days
* Remove unused variables.stefanf2005-04-091-2/+0
|
* Use a designator for initializing only one member of the nlistkeramida2005-03-212-6/+6
| | | | | | | | structs, making pstat WARNS=3 clean on i386, sparc64 and amd64. Bump WARNS level to 3. Approved by: sam, pjd
* - Add a -h flag to pstat to print swap sizes in "human readable"keramida2005-03-213-24/+50
| | | | | | | | | | | | | | | | | | | format, with humanize_number(3). - Move the common parts of the code that prints the sizes for a single swap device and the total to a single function to avoid repeating the humanize_number() stuff all over the place. - Change the type of CONVERT() from intmax_t to int64_t, since this makes calling humanize_number() easier but cast the values to intmax_t before printing them, to make use of the %jd format that printf() supports. - Document the new -h flag in the manpage and bump its date. Approved by: pjd Useful tips: brooks MFC after: 2 weeks
* Sort sections.ru2005-01-181-4/+4
|
* Don't include sys/user.h merely for its side-effect of recursivelydas2004-11-271-1/+2
| | | | including other headers.
* Corrected the description of the -t output columns to reflect reality.dds2004-11-111-12/+11
| | | | MFC after: 2 weeks
* Per letter dated July 22, 1999 remove 3rd clause of Berkeley derived softwareimp2004-08-072-8/+0
| | | | (with permission of addtional copyright holders where appropriate)
* Eliminated double whitespace.ru2004-07-031-1/+1
|
* Mechanically kill hard sentence breaks.ru2004-07-021-2/+4
|
* Update kvm mode to match kernel changes.phk2004-06-091-3/+3
|
* -N without -M is pointless.ru2004-03-262-12/+10
|
* Update information of how pstat(8) accesses the running system.ru2004-03-261-12/+15
|
* Make NULL a (void*)0 whereever possible, and fix the warnings(-Werror)markm2004-03-051-1/+1
| | | | | | | | | | | | | | | 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
* Remove options processing for dumping swapdevice radix map.phk2003-07-312-5/+1
|
* When dumping swap information, drop the "Type" field which displaysphk2003-07-311-7/+4
| | | | | | | a constant string of little information these days. This removes the need to #include <vm/swap_pager.h> which is due to become a kernel only include file.
* Report NODEV devices as <NFSfile>phk2003-06-051-2/+6
|
* Use __FBSDID over rcsid[]. Protect copyright[] where needed.obrien2003-05-031-4/+4
|
* style.Makefile(5)obrien2003-04-041-2/+2
|
* - Modernize the format of the open file showing mode output:robert2003-01-311-10/+23
| | | | | | | | | | | | | | | | | | . Print the column headers centered (except for the left-aligned TYPE header) using a different header for architectures where sizeof(uintptr_t) is not four. . Consistently do not print a '0x' prefix for hexadecimal values. . Separate columns by a single space character. . Pad the columns presenting an address or offset enough to hold their respective largest value. . Do not restrict the output to unknown file types, inodes and sockets; allow displaying of pipes, fifos, kqueues and crypto file descriptors too. - Shorten an overly long line by removing a cast of printf's return value to void. PR: alpha/45240 Tested on: i386, sparc64, alpha
* Bow to the whining masses and change a union back into void *. Retaindillon2003-01-131-1/+1
| | | | | removal of unnecessary casts and throw in some minor cleanups to see if anyone complains, just for the hell of it.
* Change struct file f_data to un_data, a union of the correct structdillon2003-01-121-1/+1
| | | | | | | | | | pointer types, and remove a huge number of casts from code using it. Change struct xfile xf_data to xun_data (ABI is still compatible). If we need to add a #define for f_data and xf_data we can, but I don't think it will be necessary. There are no operational changes in this commit.
* Make struct swblock kernel only, to make vm/swap_pager.h userland includable.phk2003-01-031-1/+1
| | | | | Move struct swdevt from sys/conf.h to the more appropriate vm/swap_pager.h. Adjust #include use in libkvm and pstat(8) to match.
* Back out rev 1.78; getbsize(3)'s original interface has been restored.mike2002-12-301-8/+6
| | | | Approved by: markm
* Adjust argument passed to getbsize().markm2002-10-231-6/+8
|
* Use struct xfile, not struct file.des2002-07-312-26/+22
|
* The .Nm utilitycharnier2002-07-141-3/+4
|
* If unable to retrive maxfiles / openfiles, fail rather than print garbage.des2002-05-281-33/+21
| | | | | | | | Gratuitously rename a couple of variables. Remove unused macros. Add NAI copyright. Sponsored by: DARPA, NAI Labs
* Remove the code that was disabled in a recent commit; it is of very limiteddes2002-05-282-101/+56
| | | | | | | | | use and has been broken in -CURRENT for a long time. Clean up unneeded entries in the nlist array. Implement kvm-backed ttymode (which we never had before). Incomplete as we do not (yet?) print the correct device, sid or pgid. Sponsored by: DARPA, NAI Labs
* Oops, don't print /dev/ twice.des2002-05-281-1/+1
|
* struct tty -> struct xtty. Reenable some previously disable code, butdes2002-05-281-35/+43
| | | | | | temporarily disable some rarely-used code that needs more work. Sponsored by: DARPA, NAI Labs
* Un-kmemize. Portions of the tty mode code have been temporarily disabled;des2002-05-232-84/+147
| | | | | | everything else, including dead kernel support, works just like before. Sponsored by: DARPA, NAI Labs
OpenPOWER on IntegriCloud