Commit Graph

43 Commits

Author SHA1 Message Date
Dimitry Andric
2f301637c8 Fix multiple warnings in usr.bin/top about variables shadowing global
declarations from base gcc, by renaming those variables.

MFC after:	1 week
2019-02-10 13:34:21 +00:00
Dimitry Andric
d0f687d30f Fix multiple warnings in usr.bin/top about discarded qualifiers from
both clang and gcc, by either constifying variables, or when that is not
possible, using __DECONST.

MFC after:	1 week
2019-02-10 13:31:08 +00:00
Eitan Adler
00abcb6acd top(1): increase warnings
top(1) now builds without cast-qual warnings, so remove the exemption
for that.

Tested with clang, gcc7, gcc9
2018-06-22 10:20:21 +00:00
Eitan Adler
51c834c490 top(1): reimplement header formatting as sbuf
The current header formatting is a giant format string that changes
global state during the format process.

Make the following changes:
- use sbuf to build up the header rather than use the above
pseudo-dynamic one
- Change name length to 10
- Reduce size of RES and SIZE by making humanize more aggressive
- Restore a version number line to the copyright. This may be required
by the copyright (and may not be; its unclear)

This is also a pre-req to implementing TOPCOLOR from newer versions of
top(1)

Discussed with:	allanjude, rpolka, danfe, rgrimes
Differential Revision: https://reviews.freebsd.org/D15801
2018-06-22 09:21:01 +00:00
Eitan Adler
8e4b205ea5 top(1): format_time, format_k, etc.
- Use humanize_number for format_k and format_k2
- Fix some style nits in format_time
2018-06-13 08:52:09 +00:00
Eitan Adler
59c50d8277 top(1): several small bugfixes and nits
- initialize all maybe uninitialized vars with bogus values. This shuts
up the compiler, and causes crashes if it changes later.
- mark noreturn as noreturn
- removed unused macro
- handle x_procstate as runtime rather than pre-processor
- avoid using void functions in condtionals

Tested with clang, gcc 7, gcc 9
2018-06-13 00:45:38 +00:00
Eitan Adler
fb7b896cd8 top(1): handle 0 in "digits" functions 2018-06-11 05:05:20 +00:00
Eitan Adler
561b0720cf top(1): use sys_signame instead of hard coding signals
This enables the removal of the signal.h awk script. Shamelessly stolen
from kill(1).
2018-06-10 09:00:01 +00:00
Eitan Adler
b4aadfd27e top(1): filter fewer warnings; clean up
- remove WARNS?=6. It is default
- we no longer have cast-qual problems
- remove unused macros
- remove unneeded casts
- add include guard for loadavg.h
2018-06-10 06:21:51 +00:00
Eitan Adler
c5484668f1 top(1): Only use NO_WERROR for base gcc
This is what was intended. If statements are hard.
2018-06-03 06:02:31 +00:00
Eitan Adler
1d5b01e66e top(1): use greater warnings
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)
2018-06-03 05:07:39 +00:00
Eitan Adler
6ffc72df9d top(1): fix build
Remove 'top.local.hs'. This was not noticed since
/srv/obj/fbsd/srv/src/freebsd/svn/head/amd64.amd64/usr.bin/top/top.local.h
existed locally on my machine despite "make clean". Only fully removing
the objdir allowed me to observe the error directly.

Pointyhat to:	me
2018-05-21 09:43:50 +00:00
Eitan Adler
00157b4c04 Revert r333969 which contained one too many changes 2018-05-21 09:20:26 +00:00
Eitan Adler
bfb79c2ccc top(1): modernize a bit; reduce warnings
- Replace caddr_t with "void *". This reduces
the number of warnings at WARNS=6
- use "static" where possible
- sprinkle const where possible

This leaves at WARNS=6:
35 warnings in top.c
72 warnings in machine.c
5 warnings in commands.c

all of which are either "incompatible-pointer-types-discards-qualifiers"
or "cast-qual"
2018-05-21 09:18:01 +00:00
Eitan Adler
1d6a4ba350 top(1): build with WARNS=3
This fixes everything but
-Wincompatible-pointer-types-discards-qualifiers
2018-05-21 03:58:15 +00:00
Eitan Adler
4901ca088d top(1): build with WARN=2 2018-05-21 00:32:48 +00:00
Eitan Adler
668af25d2e top(1): pull configuration directly into header files
This sets configuration variables directly in the various header files,
avoiding the need to have special logic in our Makefile to build the
header.
2018-05-20 23:37:30 +00:00
Eitan Adler
500cd2d6a1 revert r333928
I had missed a file when testing this, and it does not build. Will try again.
2018-05-20 18:02:40 +00:00
Eitan Adler
808862b298 top(1): remove 'xs' and 'xh' source files
Now that we're our own upstream these files buy us nothing.
2018-05-20 17:58:22 +00:00
Eitan Adler
8a133278b7 top(1): unconditionally provide 'FreeBSD' as a version 2018-05-19 23:04:42 +00:00
Eitan Adler
946e91ab0c top(1): assume that we're building on FreeBSD
This allows us to avoid the ifdefs that we set unconditionally.
2018-05-19 22:59:58 +00:00
Eitan Adler
a4af6c0592 top(1): bump WARNS to 1
Nothing else builds without errors yet, but 1 is better than 0
2018-05-19 22:45:43 +00:00
Eitan Adler
3be6ef0659 top(1): Migrate top to usr.bin
We've been maintaining top(1) for a long time, and the upstream
hasn't existed/been used in similarly as long. Make it clear that we own
top(1)

Tested with 'make universe'. Everything passed except MIPS which failed
for unrelated reasons. Install also tested for amd64.

Reviewed by:		sbruno
No objections:		imp, mmacy
Differential Revision:	https://reviews.freebsd.org/D15387
2018-05-19 22:40:23 +00:00
Warner Losh
a35f04fba2 Adopt SRCTOP in usr.bin
Prefer ${SRCTOP}/foo over ${.CURDIR}/../../foo and ${SRCTOP}/usr.bin/foo
over ${.CURDIR}/../foo for paths in Makefiles.

Differential Revision:	https://reviews.freebsd.org/D9932
Sponsored by:		Netflix
Silence on:		arch@ (twice)
2017-03-12 18:58:44 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
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
2015-06-13 19:20:56 +00:00
Marcel Moolenaar
529b5c137e Move contrib/top/top.X to contrib/top/top.xs and move
contrib/top/top.local.H to contrib/top/top.local.hs.
This fixes a build breakage when src is on a case-
insensitive file system -- we never properly create
top.x nor top.local.h. Change the makefile accordingly.

MFC after:	3 days
2015-06-08 19:45:24 +00:00
Simon J. Gerraty
98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Baptiste Daroussin
3e11bd9e2a Convert to usr.bin/ to LIBADD
Reduce overlinking
2014-11-25 14:29:10 +00:00
Simon J. Gerraty
cc3f4b9965 Merge from head 2014-05-08 23:54:15 +00:00
Bryan Drewery
1b60f97272 Add -J command/flag to filter by jail name/jid. This will automatically
display the JID as well (the -j command/flag).

  0 displays host.
  + displays all.

MFC after:	2 weeks
Relnotes:	yes
2014-05-02 23:30:39 +00:00
Simon J. Gerraty
34ce9cc44f Do no assume ${DESTDIR}/usr/include is always valid 2013-02-20 00:13:26 +00:00
Ed Schouten
b7946da96b Build usr.bin/ with WARNS=6 by default.
Also add some missing $FreeBSD$ to keep svn happy.
2010-01-02 10:27:05 +00:00
Giorgos Keramidas
d2d6d8d537 The sigconv.awk script generates a sigdesc.h header file, which
contains a sigdec[] vector of structures, but the generated output is
missing braces around the initializer of each struct, which
triggers warnings in WARNS=3:

src/usr.bin/top/sigdesc.h:10: warning: missing braces around initializer
src/usr.bin/top/sigdesc.h:10: warning: (near initialization for `sigdesc[0]')

  * Fix the sigconv.awk script to generate a header with initializers
    which look better.

  * Add rules to usr.bin/top/Makefile that rebuilds a new sigconv.h
    header which matches the correct signal set from the build-time
    version of `${DESTDIR}/usr/include/signal.h' (so sigconv.h doesn't
    get stale once changes are made to the header).

  * Remove the old sigconv.h header, now that it is autoupdated at
    build time.

  * Various Makefile style fixes (the committed Makefile was kindly
    submitted by Ruslan):

    - Reorder .PATH, PROG, SRCS and CFLAGS to match style.Makefile(5)
    - Split off the generated sources (sigdesc.h top.local.h) in an
      SRCS+= line of their own.
    - Add entries to CLEANFILES near the rules that generate the
      respective files.
    - Move the explicit rule which builds top.1 after the implicit
      rules which generate its dependencies.

Reviewed by:	ru, bde
Submitted by:	ru (Makefile)
MFC after:	2 weeks
2006-12-01 07:01:19 +00:00
Mark Murray
e35f9517d6 Remove NO_WERRORs and WARNS=n's. To be revisited after GCC3. 2002-02-08 23:07:37 +00:00
David Malone
24bd57cbbd Add new option HAVE_STRERROR to CFLAGS. 2002-01-24 17:59:39 +00:00
Mark Murray
19964b3233 Protect this against the coming WARNS=2 default. 2001-12-12 00:05:16 +00:00
Ruslan Ermilov
7d20bafcad Generate top.local.h and manpage dynamically, with sed(1) script.
The generated manpage will now describe the actual behavior of
top(1) WRT how many processes it displays.  This also eliminates
all troff(1) warnings.
2001-07-12 15:07:30 +00:00
Robert Watson
0ce14ceb84 Remove directive to install top as group kmem. Remove directive to
install top with setgid bit.
2001-02-23 18:55:43 +00:00
Wolfram Schneider
f3b2c2d1d3 Merge from stable: support for the o, order, command 1998-08-12 09:58:15 +00:00
Bruce Evans
745ec60f07 Added top.1 to CLEANFILES. 1997-07-21 16:06:00 +00:00
Peter Wemm
aa9278ffa9 move top.1 -> top.local.1, and generate top.1 so that the man page
is remotely useful
1997-04-05 22:05:46 +00:00
Andrey A. Chernov
d9c406718c Remove libcurses, it is pure termcap application 1997-03-24 14:29:46 +00:00
Joerg Wunsch
511d9c6565 This is the FreeBSD-specific files for top, plus the Makefile
that pulls all the files from contrib.

Obtained from:	The ports collection (mostly).
1997-03-23 18:55:20 +00:00