aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* top(1): include what you useEitan Adler2018-06-047-24/+26
| | | | | | | | | | | | - Change headers to more closely match what we use - use more standard functions instead of bzero, bcmp, bcopy - Add myself to authors. Tested with: base clang (amd64), gcc 9 (amd64), base clang (i386), base gcc (mips) Notes: svn path=/head/; revision=334600
* top(1): Prefer memcpy over bcopyEitan Adler2018-06-041-1/+1
| | | | Notes: svn path=/head/; revision=334599
* hwpmc: fix fixed counters checksMatt Macy2018-06-041-4/+3
| | | | Notes: svn path=/head/; revision=334598
* top(1): Use strsep instead of homegrown alternativeEitan Adler2018-06-042-69/+16
| | | | | | | | | | This replaces some complex, and not quite correct logic, with a more common strsep pattern. Reviewed by: mmacy (older version) Notes: svn path=/head/; revision=334597
* hwpmc: ABI fixesMatt Macy2018-06-0410-70/+69
| | | | | | | | | | | | | - increase pmc cpuid field from 8 to 12 bits - add cpuid version string to initialize entry in the log so that filter can identify which counter index an event name maps to - GC unused config flags - make fixed counter assignment more robust as well as the changes needed to be properly identified for filter Notes: svn path=/head/; revision=334596
* hwpmc: support sampling both kernel and user stacks when interrupted in kernelMatt Macy2018-06-049-63/+261
| | | | | | | | | | | | | | | | This adds the -U options to pmcstat which will attribute in-kernel samples back to the user stack that invoked the system call. It is not the default, because when looking at kernel profiles it is generally more desirable to merge all instances of a given system call together. Although heavily revised, this change is directly derived from D7350 by Jonathan T. Looney. Obtained from: jtl Sponsored by: Juniper Networks, Limelight Networks Notes: svn path=/head/; revision=334595
* dwatch(1): Update manual to reference actual releaseDevin Teske2018-06-031-1/+1
| | | | | | | | | MFC after: 3 days X-MFC-to: stable/11 Sponsored by: Smule, Inc. Notes: svn path=/head/; revision=334594
* top(1): another pass of cleanupEitan Adler2018-06-037-49/+35
| | | | | | | | | | | | | | | | | | | - avoid the need to call a function to get size of known array. I'll likely re-arrange some of the indirect in a later to avoid the magic constants. - use correct type - add const - replace caddr_t with void*. This corrects an alignment warning. - remove duplicated include from immediately prior commit Under base clang we're now down to: - 3 warning in top.c, 1 warning in mahcine.c, 4 warning in display.c, - 1 warning in utils.c Tested with base clang, gcc7, gcc9, base gcc (mips) Notes: svn path=/head/; revision=334593
* audit(4): add tests for the cl audit classAlan Somers2018-06-032-1/+240
| | | | | | | | | | | | The only syscalls in this class are close, closefrom, munmap, and revoke. Submitted by: aniketp MFC after: 2 weeks Sponsored by: Google, Inc. (GSoC 2018) Differential Revision: https://reviews.freebsd.org/D15650 Notes: svn path=/head/; revision=334592
* top(1): top warnings and cleanupEitan Adler2018-06-036-112/+93
| | | | | | | | | | | | | - Add const where helpful - add missing 'static' for file-local functions - use nitems where possible - convert manual abort() to assert - use strndup instead of homegrown version Tested with clang, gcc7, and gcc9 Notes: svn path=/head/; revision=334591
* indent(1): new option -lplPiotr Pawel Stefaniak2018-06-035-1/+24
| | | | | | | | | | | | | | | | With -lpl, code surrounded by parentheses in continuation lines is lined up even if it would extend past the right margin. With -nlpl (the default), such a line that would extend past the right margin is moved left to keep it within the margin, if that does not require placing it to the left of the prevailing indentation level. These switches have no effect if -nlp is selected. Submitted by: Tom Lane Notes: svn path=/head/; revision=334590
* indent(1): revert introduction of -lplPiotr Pawel Stefaniak2018-06-035-24/+1
| | | | | | | That was committed with the wrong message. Will be re-added. Notes: svn path=/head/; revision=334589
* indent(1): new option -lpl (always line up to parenthesis)Piotr Pawel Stefaniak2018-06-035-1/+24
| | | | | | | | | | | With -lp, if a line has an opening paren which is not closed on that line, then continuation lines will be lined up to start at the character position just after the opening paren. Submitted by: Tom Lane Notes: svn path=/head/; revision=334588
* indent(1): manual page corretionsPiotr Pawel Stefaniak2018-06-031-11/+12
| | | | | | | | | | Add missing options, synchronize syntax summary with the actual option list, and other fixes. Submitted by: Tom Lane Notes: svn path=/head/; revision=334587
* Fix a gcc8 warning about a write only variable.Rick Macklem2018-06-031-1/+6
| | | | | | | | | | | | | | gcc8 warns that "verf" was set but not used. This was because the code that uses it is disabled via a "#if 0". This patch adds a "#if 0" to the variable's declaration and assignment to get rid of the warning. This way the code could be re-enabled without difficulty. Requested by: mmacy MFC after: 2 weeks Notes: svn path=/head/; revision=334586
* hwpmc: ensure that mapin updates are synchronousMatt Macy2018-06-031-1/+1
| | | | Notes: svn path=/head/; revision=334585
* pmc: remove assert that is invalid in interrupt contextMatt Macy2018-06-031-1/+0
| | | | Notes: svn path=/head/; revision=334584
* indent(1): if an identifier can be either a typedef name or as a structPiotr Pawel Stefaniak2018-06-034-1/+11
| | | | | | | member, it is taken as the latter Notes: svn path=/head/; revision=334583
* indent(1): if the token is a "[" then neither of the blocks is relevantPiotr Pawel Stefaniak2018-06-031-2/+4
| | | | Notes: svn path=/head/; revision=334581
* indent(1): don't add a space after a labelPiotr Pawel Stefaniak2018-06-031-1/+0
| | | | | | | It's not needed and it fools pr_comment(). Notes: svn path=/head/; revision=334580
* indent(1): ignore null characters from inputPiotr Pawel Stefaniak2018-06-031-1/+2
| | | | Notes: svn path=/head/; revision=334579
* indent(1): don't overflow di_stack[]Piotr Pawel Stefaniak2018-06-031-1/+6
| | | | Notes: svn path=/head/; revision=334578
* indent(1): improve CHECK_SIZE_ macrosPiotr Pawel Stefaniak2018-06-034-96/+111
| | | | | | | | | | | | | | | | | | | | Rewrite the macros so that they take a parameter. Consumers use it to signal how much room in the buffer they need; this lets them do that once when required space is known instead of doing the check once every loop step. Also take the parameter value into consideration when resizing the buffer; the requested space may be larger than the constant 400 bytes that the previous version used - now it's the sum of those two values. On the consumer side, don't copy strings byte by byte - use memcpy(). Deduplicate code that copied base 2, base 8 and base 16 literals. Don't advance the e_token pointer once the token has been copied into s_token. This allows easy calculation of the token's length. Notes: svn path=/head/; revision=334576
* indent(1): remove troff output supportPiotr Pawel Stefaniak2018-06-038-363/+63
| | | | | | | | | | | | | | | | | | | The troff output in indent was invented at Sun and the online documentation for some post-SunOS operating system includes this: The usual way to get a troffed listing is with the command indent -troff program.c | troff -mindent The indent manual page in FreeBSD 1.0 already lacks that information and troff -mindent complains about not being able to find the macro file. It seems that the file did exist on SunOS and was supposed to be imported into 4.3BSD together with the feature, but that has never happened. Removal of troff output support simplifies a lot of indent's code. vgrind(1) seems to be a promising replacement. Notes: svn path=/head/; revision=334574
* indent(1): avoid resetting last_bl to a bogus value when reallocatingPiotr Pawel Stefaniak2018-06-031-2/+7
| | | | | | | underlying buffer Notes: svn path=/head/; revision=334571
* indent(1): the check for buffer overflow has to be done before copyPiotr Pawel Stefaniak2018-06-031-2/+2
| | | | Notes: svn path=/head/; revision=334570
* indent(1): use errx() instead of abort()Piotr Pawel Stefaniak2018-06-031-2/+2
| | | | Notes: svn path=/head/; revision=334569
* indent(1): limit character classification functions' input to unsigned charPiotr Pawel Stefaniak2018-06-034-15/+17
| | | | Notes: svn path=/head/; revision=334568
* indent(1): recognize more type namesPiotr Pawel Stefaniak2018-06-031-0/+10
| | | | | | | Most are from C99. Notes: svn path=/head/; revision=334567
* indent(1): don't format function declarations as variablesPiotr Pawel Stefaniak2018-06-035-27/+119
| | | | Notes: svn path=/head/; revision=334566
* indent(1): remove is_procname.Piotr Pawel Stefaniak2018-06-031-6/+4
| | | | | | | | | It was a shorthand for checking if ps.procname is a non-empty string; the same can be done with ps.procname[0] which avoids the need for updating is_procname after every call to lexi(). Notes: svn path=/head/; revision=334565
* indent(1): disjoint parser state from lexi()Piotr Pawel Stefaniak2018-06-035-30/+35
| | | | | | | | The function is sometimes used as a look-ahead, so ideally it should bear no information about parser state. Notes: svn path=/head/; revision=334564
* indent(1): improve handling of boxed comments indentationPiotr Pawel Stefaniak2018-06-035-8/+67
| | | | | | | | | | | | | The trick is to copy everything from the start of the line into the buffer that stores newlines and comments until indent finds a brace or an else. pr_comment() will use that information to calculate the original indentation of the boxed comment. This requires storing two pieces of information: the real start of the buffer (sc_buf) and the start of the comment (save_com). Notes: svn path=/head/; revision=334563
* indent(1): improve predictability of lexi()Piotr Pawel Stefaniak2018-06-033-51/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | lexi() reads the input stream and categorizes the next token. indent will sometimes buffer up a sequence of tokens in order rearrange them. That is needed for properly cuddling else or placing braces correctly according to the chosen style (KNF vs Allman) when comments are around. The loop that buffers tokens up uses lexi() to decide if it's time to stop buffering. Then the temporary buffer is used to feed lexi() the same tokens again, this time for normal processing. The problem is that lexi() apart from recognizing the token, can change a lot of information about the current state, for example ps.last_nl, ps.keyword, buf_ptr. It also abandons leading whitespace, which is needed mainly for comment-related considerations. So the call to lexi() while tokens are buffered up and categorized can change the state before they're read again for normal processing which may easily result in changing interpretation of the current state and lead to incorrect output. To work around the problems: 1) copy the whitespace into the save_com buffer so that it will be read again when processed 2) trick lexi() into modifying a temporary copy of the parser state instead of the original. Notes: svn path=/head/; revision=334560
* indent(1): improve handling of comments and newlines between "if (...)" orPiotr Pawel Stefaniak2018-06-033-126/+175
| | | | | | | | | | | | | | | | | | "while (...)" and "else" or "{" * Don't flush newlines - there can be multiple of them and they can happen before a token that isn't else or {. Instead, always store them in save_com. * Don't dump the buffer's contents on newline assuming that there is only one comment before else or {. * Avoid producing surplus newlines, especially before else when -ce is on. * When -bl is on, don't treat { as a comment (was implemented by falling through "case lbrace:" to "case comment:"). This commit fixes the above, but exposes another bug and thus breaks several other tests. Another commit will make them pass again. Notes: svn path=/head/; revision=334559
* top(1): restore size for kern.cp_timesEitan Adler2018-06-031-0/+1
| | | | | | | Restore last minute change that broke top(1). Notes: svn path=/head/; revision=334557
* indent(1): remove undocumented and rather useless option (-ps)Piotr Pawel Stefaniak2018-06-033-8/+3
| | | | | | | | It's used to treat the "->" access operator as a binary operator and put space characters around it. Notes: svn path=/head/; revision=334556
* [evdev] Sync event codes with Linux kernel 4.16Vladimir Kondratyev2018-06-032-0/+42
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=334555
* top(1): Only use NO_WERROR for base gccEitan Adler2018-06-031-1/+3
| | | | | | | This is what was intended. If statements are hard. Notes: svn path=/head/; revision=334554
* top(1): partial revert of r334517Eitan Adler2018-06-037-18/+16
| | | | | | | | | | In fixing issues with uid > INT_MAX, I broke the uid without username case. The latter is more important so return the old state. Discussed with: allanjude Notes: svn path=/head/; revision=334553
* top(1): remove chdir to /Eitan Adler2018-06-031-9/+0
| | | | | | | | While this came out of a conversation in IRC, it turn out that some people don't like it. Since this was a courtesy feature, just remove it. Notes: svn path=/head/; revision=334552
* top(1): use greater warningsEitan Adler2018-06-032-2/+12
| | | | | | | | | | | | | | | | One of the downsides of using numeric WARNS is that if we only have a single type of issue we get no protection from other changes. For example, we got no warning for missing variable declaration, due to the issues with "const". For this utility, explicitly list out the warnings which are failing. They should still be fixed, so only reduce them to warning instead of error. Tested with: clang base (amd64, i386), gcc6, gcc7, gcc9, gcc base (mips) Notes: svn path=/head/; revision=334551
* Revert r326083, it doesn't behave as expected.Justin Hibbits2018-06-031-1/+1
| | | | | | | | | Even though there do appear to be more artificial frames, with 12, stack traces no longer list at all. Revert until a better, more stable value can be determined. Notes: svn path=/head/; revision=334550
* top(1): misc minor improvementsEitan Adler2018-06-033-13/+11
| | | | | | | | | | | | | - use bool instead of int [0] - use calloc correctly [0] (this also caught an incorrect sizeof argument) [1] - use size_t over int [2] - correct style Reported by: pfg [0], scan-build [1], gcc [2] Notes: svn path=/head/; revision=334549
* pty.3: Add a HISTORY sectionAlan Somers2018-06-021-1/+16
| | | | | | | | | | | | These functions were first added in 4.3 BSD-Reno, according to http://unix.superglobalmegacorp.com/ and the CSRG svn repository. Reviewed by: bcr, bjk MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D15652 Notes: svn path=/head/; revision=334547
* Remove an unused argument to turnstile_unpend.Mateusz Guzik2018-06-026-12/+8
| | | | | | | | PR: 228694 Submitted by: Julian Pszczołowski <julian.pszczolowski@gmail.com> Notes: svn path=/head/; revision=334546
* malloc: try to use builtins for zeroing at the callsiteMateusz Guzik2018-06-024-1/+22
| | | | | | | | | | | | | Plenty of allocation sites pass M_ZERO and sizes which are small and known at compilation time. Handling them internally in malloc loses this information and results in avoidable calls to memset. Instead, let the compiler take the advantage of it whenever possible. Discussed with: jeff Notes: svn path=/head/; revision=334545
* top(1): Fix two speeling errors I introducedEitan Adler2018-06-022-2/+2
| | | | Notes: svn path=/head/; revision=334544
* top(1): chdir to / as init; remove unneeded commentEitan Adler2018-06-022-5/+9
| | | | | | | | | - chdir to / to allow unmounting of wd - remove warning about running top(1) as setuid. If this is a concern we should just drop privs instead. Notes: svn path=/head/; revision=334543
* top(1): cleanup memory allocation and warningsEitan Adler2018-06-025-25/+22
| | | | | | | | | | | | | | - Prefer calloc over malloc. This is more predicable and we're not in a performance sensitive context. [1] - Remove bogus comment (obsolete from prior commit). [2] - Remove void casts and type casts of NULL - Remove redundant declaration of 'quit' - Add additional const Reported by: kib [1], vangyzen [2] Notes: svn path=/head/; revision=334540