aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/pstat
Commit message (Collapse)AuthorAgeFilesLines
* swapinfo.8: Mention BLOCKSIZE in the ENVIRONMENT sectionFelix Johnson2022-07-081-1/+21
| | | | | | | | | Copy the ENVIRONMENT section from df(1) to swapinfo(8), except that the --si option is removed for swapinfo. PR: 235225 Reported by: 0mp MFC after: 3 days
* pstat(8): improve the Size header width after r358181Piotr Pawel Stefaniak2020-06-231-1/+1
| | | | | | | | All size values use fields of width 8. Also, all other headers use fields of width 8. Make the Size header added in r358181 use 8 characters as well. Notes: svn path=/head/; revision=362547
* - Implement -h (human readable) for the size of the underlying block disk.Christian S.J. Peron2020-02-201-4/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the size of the swap device is unconditionally reported using blocks, even if -h has been used. - While here, switch to CONVERT_BLOCKS() instead of CONVERT() which will avoid overflowing size counters (in human readable form see: r196244) - Update the column headers to reflect that a size is being reported instead of the block size units being used Before: $ swapinfo Device 1K-blocks Used Avail Capacity /dev/gpt/swapfs 1048576 0 1048576 0% $ After: $ swapinfo -h Device Size Used Avail Capacity /dev/gpt/swapfs 1.0G 0B 1.0G 0% $ Differential Revision: https://reviews.freebsd.org/D23758 Reviewed by: kevans MFC after: 3 weeks Notes: svn path=/head/; revision=358181
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-0/+2
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326025
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* Commit the 64-bit inode project.Konstantin Belousov2017-05-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extend the ino_t, dev_t, nlink_t types to 64-bit ints. Modify struct dirent layout to add d_off, increase the size of d_fileno to 64-bits, increase the size of d_namlen to 16-bits, and change the required alignment. Increase struct statfs f_mntfromname[] and f_mntonname[] array length MNAMELEN to 1024. ABI breakage is mitigated by providing compatibility using versioned symbols, ingenious use of the existing padding in structures, and by employing other tricks. Unfortunately, not everything can be fixed, especially outside the base system. For instance, third-party APIs which pass struct stat around are broken in backward and forward incompatible ways. Kinfo sysctl MIBs ABI is changed in backward-compatible way, but there is no general mechanism to handle other sysctl MIBS which return structures where the layout has changed. It was considered that the breakage is either in the management interfaces, where we usually allow ABI slip, or is not important. Struct xvnode changed layout, no compat shims are provided. For struct xtty, dev_t tty device member was reduced to uint32_t. It was decided that keeping ABI compat in this case is more useful than reporting 64-bit dev_t, for the sake of pstat. Update note: strictly follow the instructions in UPDATING. Build and install the new kernel with COMPAT_FREEBSD11 option enabled, then reboot, and only then install new world. Credits: The 64-bit inode project, also known as ino64, started life many years ago as a project by Gleb Kurtsou (gleb). Kirk McKusick (mckusick) then picked up and updated the patch, and acted as a flag-waver. Feedback, suggestions, and discussions were carried by Ed Maste (emaste), John Baldwin (jhb), Jilles Tjoelker (jilles), and Rick Macklem (rmacklem). Kris Moore (kris) performed an initial ports investigation followed by an exp-run by Antoine Brodin (antoine). Essential and all-embracing testing was done by Peter Holm (pho). The heavy lifting of coordinating all these efforts and bringing the project to completion were done by Konstantin Belousov (kib). Sponsored by: The FreeBSD Foundation (emaste, kib) Differential revision: https://reviews.freebsd.org/D10439 Notes: svn path=/head/; revision=318736
* Renumber copyright clause 4Warner Losh2017-02-282-2/+2
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
* - pstat(8) does not accept any arguments other than getopt() args,Xin LI2016-12-261-3/+1
| | | | | | | | | | so don't bother to adjust argc/argv after getopt() loop. - Make a string pointer constant. MFC after: 2 weeks Notes: svn path=/head/; revision=310611
* Update dependencies after r291406 added libelf to libkvm.Bryan Drewery2015-12-011-0/+1
| | | | | | | | | | | Unfortunately filemon/meta mode tracks all indirect dependencies here since ld(1) is reading libelf when linking in libkvm. Churn would be reduced if this was able to be limited to direct dependencies. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=291558
* Add META_MODE support.Simon J. Gerraty2015-06-131-0/+20
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Off by default, build behaves normally. WITH_META_MODE we get auto objdir creation, the ability to start build from anywhere in the tree. Still need to add real targets under targets/ to build packages. Differential Revision: D2796 Reviewed by: brooks imp Notes: svn path=/head/; revision=284345
| * dirdeps.mk now sets DEP_RELDIRSimon J. Gerraty2015-06-081-2/+0
| | | | | | | | Notes: svn path=/projects/bmake/; revision=284172
| * Merge sync of headSimon J. Gerraty2015-05-271-2/+1
| |\ | |/ |/| | | Notes: svn path=/projects/bmake/; revision=283595
| * Merge from head@274682Simon J. Gerraty2014-11-191-2/+2
| |\ | | | | | | | | | Notes: svn path=/projects/bmake/; revision=274683
| * | Updated dependenciesSimon J. Gerraty2014-05-161-1/+0
| | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=266219
| * | Updated dependenciesSimon J. Gerraty2014-05-101-0/+2
| | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=265802
| * | Updated dependenciesSimon J. Gerraty2013-03-111-0/+1
| | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=248169
| * | Updated dependenciesSimon J. Gerraty2013-02-161-2/+0
| | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=246868
| * | Sync FreeBSD's bmake branch with Juniper's internal bmake branch.Marcel Moolenaar2012-08-221-0/+21
| | | | | | | | | | | | | | | | | | | | | Requested by: Simon Gerraty <sjg@juniper.net> Notes: svn path=/projects/bmake/; revision=239572
* | | Convert usr.sbin to LIBADDBaptiste Daroussin2014-11-251-2/+1
| |/ |/| | | | | | | | | | | Reduce overlinking Notes: svn path=/head/; revision=275054
* | pstat(8): Correct description of the SESS column in pstat -t.Jilles Tjoelker2014-10-111-2/+2
|/ | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=272963
* Get rid of major/minor number distinction.Ed Schouten2011-09-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | As of FreeBSD 6, devices can only be opened through devfs. These device nodes don't have major and minor numbers anymore. The st_rdev field in struct stat is simply based a copy of st_ino. Simply display device numbers as hexadecimal, using "%#jx". This is allowed by POSIX, since it explicitly states things like the following (example taken from ls(1)): "If the file is a character special or block special file, the size of the file may be replaced with implementation-defined information associated with the device in question." This makes the output of these commands more compact. For example, ls(1) now uses approximately four columns less. While there, simplify the column length calculation from ls(1) by calling snprintf() with a NULL buffer. Don't be afraid; if needed one can still obtain individual major/minor numbers using stat(1). Notes: svn path=/head/; revision=225847
* The last big commit: let usr.sbin/ use WARNS=6 by default.Ed Schouten2010-01-021-2/+0
| | | | Notes: svn path=/head/; revision=201390
* - Avoid overflowing the swap size counters in human-readable modeStanislav Sedov2009-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 Notes: svn path=/head/; revision=196244
* - Make pstat(8) WARNS=6 safe.Stanislav Sedov2009-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) Notes: svn path=/head/; revision=194014
* Correct my previous commit to pstat(8).Ed Schouten2009-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 Notes: svn path=/head/; revision=193982
* Make most of pstat(8) build with WARNS=6.Ed Schouten2009-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. Notes: svn path=/head/; revision=193978
* Serialize write() calls on TTYs.Ed Schouten2009-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 Notes: svn path=/head/; revision=188487
* Don't leave the console TTY constantly open.Ed Schouten2009-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 Notes: svn path=/head/; revision=188147
* Clamp the values of t_column to 5 digits in `pstat -t' and `show all ttys'.Ed Schouten2008-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. Notes: svn path=/head/; revision=184522
* Introduce a hooks layer for the MPSAFE TTY layer.Ed Schouten2008-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/... Notes: svn path=/head/; revision=183276
* Fix a small typo in the pstat(8) manual page.Ed Schouten2008-08-201-1/+1
| | | | | | | | The second LOW column of the pstat(8) command refers to the low watermark of the output queue. Notes: svn path=/head/; revision=181939
* Integrate the new MPSAFE TTY layer to the FreeBSD operating system.Ed Schouten2008-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 Notes: svn path=/head/; revision=181905
* Remove OTTYDISC, NETLDISC and NTTYDISC definitions.Ed Schouten2008-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) Notes: svn path=/head/; revision=180559
* Fix pstat behaviour when using coredumps. The reference to tp wasRemko Lodder2008-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) Notes: svn path=/head/; revision=178987
* Significantly reduce the memory leak as noted in BUGS section forSean Farley2007-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) Notes: svn path=/head/; revision=171195
* Back out all POSIXified *env() changes.Andrey A. Chernov2007-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. Notes: svn path=/head/; revision=169177
* Preparing for upcoming POSIXed putenv() rewrite:Andrey A. Chernov2007-04-301-3/+3
| | | | | | | don't allow const as putenv() arg, dup it Notes: svn path=/head/; revision=169134
* - Recognize -g and -m in pstat(8) too.Ruslan Ermilov2007-04-032-6/+6
| | | | | | | | | - Document -g and -m support in swapinfo(8). Reviewed by: markm Notes: svn path=/head/; revision=168292
* Add -m (megabytes) and -g (gigabytes) options. I'm tired of being toldMark Murray2007-04-012-4/+20
| | | | | | | | | I can't do this. MFC: 1 month Notes: svn path=/head/; revision=168227
* Another crashdump fix: nfiles was renamed to openfiles in 5.x.John Baldwin2007-02-141-1/+1
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=166696
* Print (total - used) as the amount of available swap for a swap deviceRobert Watson2005-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 Notes: svn path=/head/; revision=152558
* Remove unused variables.Stefan Farfeleder2005-04-091-2/+0
| | | | Notes: svn path=/head/; revision=144841
* Use a designator for initializing only one member of the nlistGiorgos Keramidas2005-03-212-6/+6
| | | | | | | | | | | structs, making pstat WARNS=3 clean on i386, sparc64 and amd64. Bump WARNS level to 3. Approved by: sam, pjd Notes: svn path=/head/; revision=143936
* - Add a -h flag to pstat to print swap sizes in "human readable"Giorgos Keramidas2005-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 Notes: svn path=/head/; revision=143929
* Sort sections.Ruslan Ermilov2005-01-181-4/+4
| | | | Notes: svn path=/head/; revision=140442
* Don't include sys/user.h merely for its side-effect of recursivelyDavid Schultz2004-11-271-1/+2
| | | | | | | including other headers. Notes: svn path=/head/; revision=138129
* Corrected the description of the -t output columns to reflect reality.Diomidis Spinellis2004-11-111-12/+11
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=137579
* Per letter dated July 22, 1999 remove 3rd clause of Berkeley derived softwareWarner Losh2004-08-072-8/+0
| | | | | | | (with permission of addtional copyright holders where appropriate) Notes: svn path=/head/; revision=133249
* Eliminated double whitespace.Ruslan Ermilov2004-07-031-1/+1
| | | | Notes: svn path=/head/; revision=131531
* Mechanically kill hard sentence breaks.Ruslan Ermilov2004-07-021-2/+4
| | | | Notes: svn path=/head/; revision=131500