Commit Graph

113 Commits

Author SHA1 Message Date
Craig Small d9c3e3676d revert: pidfd_open check
This change confused the pidfd_open check with the existance
of NR_pidfd_open
2022-11-09 21:32:26 +11:00
Fabrice Fontaine 17f94796a9 fix pifd_open check
Replace AC_CHECK_FUNC by AC_CHECK_FUNCS otherwise HAVE_PIDFD_OPEN will
never be defined resulting in the following build failure if pidfd_open
is available but __NR_pidfd_open is not available:

pgrep.c: In function 'pidfd_open':
pgrep.c:748:17: error: '__NR_pidfd_open' undeclared (first use in this function); did you mean 'pidfd_open'?
  748 |  return syscall(__NR_pidfd_open, pid, flags);
      |                 ^~~~~~~~~~~~~~~
      |                 pidfd_open

This build failure is raised since the addition of pwait in version
3.3.17 and
c8384e682c

Fixes:
 - http://autobuild.buildroot.org/results/f23a5156e641b2ebdd673973dec0f9c87760c688

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2022-11-09 10:15:05 +00:00
Craig Small f9f5f6ad38 build-sys: Allow enable-watch9bit and with-ncurses
The commit that changed configure.ac was supposed to check for when
someone removes ncurses using the flag --without-ncurses

Unfortunately the change didn't check if the user was specifying
--without or --with meaning if they didn use --with-ncurses the
configure script would error out.

Signed-off-by: Craig Small <csmall@dropbear.xyz>

References:
  commit 8128641814
  procps-ng/procps#251
2022-09-28 17:46:52 +10:00
Craig Small b72eb5c9ea build-sys: Move git-version-gen
git-version-gen was the only file in misc/ moving it to local/
2022-08-29 20:53:01 +10:00
Craig Small 1502648ff9 library: Rename to libproc2
The newlib library used to be called libproc-2 but the new
name is preferred.

References:
 https://www.freelists.org/post/procps/Next-for-newlib,3

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2022-08-29 20:38:17 +10:00
Craig Small 47a8676625 build-sys: Relocate lib/
test files in lib go to src/tests
include/ goes to local/
lib/*.c goes to local/

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2022-08-29 20:28:03 +10:00
Craig Small 3d0871728b build-sys: Relocate library to library/
All the dependent programs needed to have their includes moved too

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2022-08-29 19:02:44 +10:00
Craig Small dd60d6d6e8 misc: Move all binaries to src
*.c -> src/
ps/* src/ps/
top/* src/top/

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2022-08-29 18:29:28 +10:00
Craig Small 8e889ae682 build-sys: Rearrange the manual pages
All man pages are found in ./man
man-po -> po-man

References:
 https://www.freelists.org/post/procps/Next-for-newlib,3

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2022-08-29 18:07:43 +10:00
Craig Small 6e661d2724 build-sys: Give sensible errors if missing pkg-config
pkg-config is used to find various libraries used by procps.
Unfortunately it, or rather automake, give terrible misleading
error messages if pkg-config is not installed.

At ./configure time you get this:
configure: error: ncurses support missing/incomplete (for partial
build use --without-ncurses)

At automake time you get this:
configure.ac:33: error: possibly undefined macro: AC_MSG_ERROR
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.ac:48: error: possibly undefined macro: AS_IF
configure.ac:113: error: possibly undefined macro: AC_DEFINE

The internet is filled with such wonderful other examples.

This commit does two things:
 At autoconf time, check PKG_PREREQ macro is defined which is found in
pkg.m4 and tells us pkg-config has its macros available.
 At configure time, check the result of the pkg-config test and error
 if it didn't find it.

Now it actually says its missing pkg-config. To be fair, the autoconf
check is "documented" and recommended in pkg.m4 file.

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2022-05-25 21:08:50 +10:00
Craig Small 8128641814 build-sys: Use ncursesw by default
The existing build system would only require wide ncurses for
a wide watch and even if the library was there would not link
anything else to it.

The first issue which #123 made me think of, is if ncursesw
was there and ncurses is not, why not use ncursesw?

A more major issue is if programs such as slabtop are linked
to ncurses, then certain languages will display their text
wrong, as found in #237.

The days of assuming ASCII only is ok are over the build system
now does the following:
 1. If ncursesw is available use this for all relevant programs
 2. If ncursesw is not but ncurses is, use this instead
 3. If you enable 8bit watch and either disable ncurses or
    we cannot find ncursesw error at configure time.

In related news, I hate M4sh.

References:
 procps-ng/procps#123
 procps-ng/procps#237

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2022-05-21 11:06:57 +10:00
Craig Small 9dd75a4ac8 build-sys: Add missing configure flag
Missed adding configure.acfor the use ctty commit

References:
 commit b47693c078

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2022-05-04 17:02:39 +10:00
Craig Small cb5fa94982 build-sys:
While the previous commit checked for a GNU environment so Hurd
compilied ok, this tripped up Cygwin. configure now explicitly tests
for the structure field rather than trying to guess through compilier
flags about what the environment tells us about signals.h

References:
 commit d39d9db079

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2022-04-11 17:09:53 +10:00
Sven Eden d014c5c9f2 Add support for elogind
A session manager similar to logind from systemd.
See https://github.com/elogind/elogind

Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
2022-04-01 06:24:38 +00:00
Henrik Grimler c63c712134 configure: add macro to check for __PROGNAME
in include/c.h we check if HAVE___PROGNAME is defined, but the
corresponding macro for setting (or not setting) it is missing from
the configure script. This commit adds the missing macro, by
copying it from the macro in tmux.
2021-05-29 16:14:52 +10:00
Christian Hermann d40db79c60 build-sys: find split systemd libraries
With 4e7f4237 and 5e73c832, systemd library detection through pkg-config
was changed to unconditionally look for unified libsystemd.

This adds a fallback to match the previous behavior and find the split
libs as well.

References:
 procps-ng/procps!128

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2021-04-24 11:57:32 +10:00
Issam E. Maghni 71764980c3 configure: Add --disable-w
Some systems implement utmp as a stub so it doesn't make sense to have
a non-functioning w.  This change mitigates #193 and !126

References:
 procps-ng/procps!129
 procps-ng/procps!126
 procps-ng/procps#193
2021-04-24 11:29:48 +10:00
Craig Small 9aa09d8862 library: Rename to libproc-2
What to call the new library?

Keep using libprocps wouldn't do, its a very different library from
the programs' point of view. It would also mean we could have some
clashes around the packages (two package names, same library name).

The ancient procps used libproc or libproc-a.b.c where a.b.c was the
package version. Kept the revision numbers down (it was always 0.0.0)
but the name of the library changed.

So if we use libproc-2 is there a clash with an ancient procps?
procps v 2.0.0 was around in 1999 so it was 22 years ago, also the
name of the library would have been libproc-2.0.0.so not libproc-2.so
so we're fine with that.

libproc-2 seems to fit, our second major re-work of the procps
library.

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2021-02-20 22:30:31 +11:00
Craig Small 9c1a62b637 pidwait: Rename from pwait
pwait is already in at least Debian in a different package

References:
 https://bugs.debian.org/982391
2021-02-15 21:55:05 +11:00
Craig Small 10c6b859b0 build-sys: Update building of translations
newlib was lagging behind oldlib in how the build system created
the translation files.
2021-02-15 21:36:57 +11:00
Craig Small 68f0941433 Merge branch 'awilfox/procps-utmpx-support'
References:
 procps-ng/procps!67
2020-12-22 15:09:08 +11:00
Alex Xu (Hello71) c8384e682c pgrep: add pwait 2020-12-22 13:13:32 +11:00
Nipunn Koorapati 9f33a6bcd0 watch: Support wide char ncurses on mac with enable-watch8bit
Fixes #47
2020-12-22 11:53:12 +11:00
Jim Warner 0745bcdab6 build-sys: updated autoscan for that configure.ac file
Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-09-13 10:00:49 +10:00
Craig Small d8fb86dbc5 Port of merge request 49 to newlib
Wayne Porter made !49 which added Cygwin support to the master branch
This is the port of those changes to newlib
2017-08-19 23:05:22 +10:00
Jim Warner f318be467b top: show fewer decimal places for memory (by default)
After much reflection I've come to the conclusion that
displaying 3 decimal places (usually) when memory data
had been scaled is no longer optimal with today's ever
increasing amounts. And given that not all task memory
fields are the same widths, inconsistencies can easily
arise as illustrated and discussed in the issue below.

Instead of unilaterally reducing the number of decimal
places, this commit will sneak in such a change via an
existing configure option that was very likely unused.

The former 'disable-wide-memory' option has now become
'enable-wide-memory', which can be used if the current
behavior (3 decimal places) is preferred. Without that
option, whenever memory is scaled beyond KiB, just one
decimal place will be shown in Summary and Task areas.

And Task area field width will no longer be changed by
this revised configure option. Instead, all such field
widths will now be fixed at the former maximum values.

Reference(s):
https://gitlab.com/procps-ng/procps/issues/50

[ this patch has been adapted from the master branch ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2017-03-16 22:08:07 +11:00
Jim Warner 518358dd50 build sys: update configure.ac for the latest autoscan
Signed-off-by: Jim Warner <james.warner@comcast.net>
2016-07-09 12:48:28 +10:00
Craig Small 9c877bf636 build-sys: Enable optional hardening flags
With the configure option --enable-harden-flags the CFLAGS and
LDFLAGS are manipulated to provide some hardening protection
to the binaries.

psmisc uses these flags on by default with no troubles, however
it doesn't have a library in it either.

References:
  https://wiki.debian.org/Hardening
2016-04-25 17:07:22 +10:00
Wayne Porter e50ad77997 Added Cygwin build support
strverscmp is included to satisfy a dependency in Cygwin.
Excluded utmp and prctl functions that are not supported currently.
2016-03-12 15:07:30 +11:00
Mike Frysinger 69d0199672 enable transparent large file support
Historically LFS mattered only to open/read large files.  A few programs
here use open/seek, but not generally on files that are large.  However,
LFS also applies to stat which procps does in a bunch of places -- some
filesystems have 64bit inodes and attempts to do a 32bit stat will throw
an error.

Enable transparent LFS everywhere to avoid this.
2016-03-10 22:30:02 +11:00
Craig Small 471cf4cd36 Merge branch 'master' into newlib
Conflicts:
	pgrep.c
	proc/sysinfo.c
	ps/output.c
	skill.c
	top/top.c
	top/top.h
	w.c
2015-10-28 21:09:26 +11:00
Jim Warner 64238730fa build, library & top: make OOMEM options unconditional
It was probably always wrong to have a variable length
proc_t structure. This patch takes all remaining oomem
former suse only options and makes them unconditional.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2015-08-23 21:08:18 +10:00
John Keeping 049e206689 configure.ac: do not check for C++ compiler
We do not have any C++ code, so there is no point in checking for C++
tools in the configure script.

Signed-off-by: John Keeping <john@keeping.me.uk>
2015-08-18 12:05:11 +01:00
Craig Small 5e73c83262 build-sys: Clean up libsystemd in configure
The previous commit got rid of some but not all the library. The
format of it was a little odd with the library being explicitly
defined instead of letting autoconf do it for you.
2015-07-09 23:11:40 +10:00
Craig Small 4e7f42375a build-sys: use merged systemd library
Since systemd 209 released in Feb 2014 three systemd libraries
including systemd-login have been merged. This change merely
checks for, and links to, the new library.

References:
  http://lists.freedesktop.org/archives/systemd-devel/2014-February/017146.html
  https://bugs.debian.org/731256
2015-07-09 22:12:10 +10:00
Craig Small 1daaac2180 Merge branch 'filbranden/procps-build_sys_cleanup_usrbin'
configure.ac conflict was due to the git url being
changed after the merge request.

Conflicts:
	configure.ac
2015-05-10 15:28:56 +10:00
Craig Small 96dc43d72b Changed git site to gitlab 2015-05-10 14:57:50 +10:00
Filipe Brandenburger 430b559ba2 build-sys: install binaries in bindir (get rid of usrbin_execdir)
The "usrbin_execdir" hack meant to install some binaries in /bin and
others in /usr/bin. However:

- It is very inflexible: not much control on the final directory name
  and it is not possible to get rid of the usr/bin suffix without
  patching the build system.

- It is hard to use: it requires configure to receive --exec_prefix=/
  and other settings do not make much sense. It is not very obvious that
  that setting needs to be passed and it takes a while to figure it out.

- It produces garbage with the default setup: the default prefix of
  /usr/local ends up installing the binaries under /usr/local/usr/bin
  which does not make any sense.

Furthermore, the requirement to split binaries in /bin and /usr/bin is
not that strong since some distributions adopted the /usr merge and so
would agree to just deploy all binaries to /usr/bin directly.

Distributions that would still like to split /bin from /usr/bin should
actually move binaries such as `ps` and `kill` to /bin after the install
of procps-ng is complete. After all, they are the ones responsible for
determining what are the binaries that need to be in the root partition
and that list depends on their early boot init scripts, so it is
possible that the list must be augmented with other binaries from this
package.

Therefore, I propose here to get rid of that hack and simply install all
the binaries to bindir instead, which solves the problems described
above and simplifies the build and install of procps-ng.

Tested that it builds and both `make check` and `make distcheck` work.

Tested that `make install` works and produces the expected tree, the
only difference being the absence of the bogus /usr/local/usr/bin
directory and now all binaries are merged into /usr/local/bin as
expected.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
2015-05-01 23:27:23 -07:00
Filipe Brandenburger edd66515ef build-sys: enable "subdir-objects" automake option
Otherwise, automake 1.14 will warn that this option will become the
default in an upcoming release, which will cause problems for the
procps-ng build.

Now that the automake rules were merged in the top level Makefile.am,
it is possible to enable "subdir-objects" without breaking the build or
the dist.

Tested that it builds and both `make check` and `make distcheck` work.

Tested that `make install` works and produces the same tree before and
after this change. Confirmed that binaries are also placed in the same
locations in the build tree.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
2015-05-01 23:19:51 -07:00
Filipe Brandenburger c1c73c0d00 build-sys: merge automake subdirs into toplevel
This will be required for subdir-objects, otherwise automake will have
problems with more than one Makefile.am having rules to build the same
files.

Tested that it builds and both `make check` and `make distcheck` work.

Tested `make install` and compared the tree with the one installed
before this commit, both installed the binaries to the same locations.
The binaries are also in the same location in the build tree (for
instance, ps/pscommand is still there.)

Checked the binaries for the correct libraries linked into them. Binary
sizes matched before and after this change.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
2015-05-01 23:19:31 -07:00
Filipe Brandenburger 04d96fe136 build-sys: remove AC_PROG_RANLIB from configure.ac
This suppresses the following warning from libtoolize 2.4.2:

  libtoolize: `AC_PROG_RANLIB' is rendered obsolete by `LT_INIT'

Tested that this does not break the build and that both `make check` and
`make distcheck` continue working as expected.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
2015-05-01 17:15:34 -07:00
Jaromir Capik d63ef52995 configure.ac: re-enabling the ALL_LINGUAS related checks 2014-09-15 15:30:08 +02:00
Michael Forney d6a3a3d97e Handle 'none required' result from AC_SEARCH_LIBS 2014-08-28 13:39:22 +02:00
Jim Warner 9d8ad6419f library: generalize then add former 'ps' systemd logic
Signed-off-by: Jim Warner <james.warner@comcast.net>
2014-07-17 13:31:06 +02:00
Jim Warner 8ef6cd91fc top: retire old stale startup defaults in favor of new
For over a decade top has used a startup configuration
mimicking the original redhat top. This decision dates
back to when the forked Sourceforge version was trying
to win over users in battles with that ancient kludge.

Will anybody deny that those defaults are coyote ugly?

Well, it is time that top presented a more modern look
at startup, providing that no saved rcfile exists. But
just in case some distro prefers that old, comfortable
look, there's the '--disable-modern-top' build option.

[ Pssst. With the widened memory fields it turns out ]
[ the 'Mem' default window had become almost useless ]
[ on an 80x24 terminal since %CPU & COMMAND were out ]
[ of view. So some other defaults were tweaked a bit ]
[ whether or not --disable-modern-top was specified. ]

Reference(s)
http://www.freelists.org/post/procps/tops-graph-mode-saga-continues,3

Signed-off-by: Jim Warner <james.warner@comcast.net>
2014-07-01 21:30:46 +10:00
Craig Small 0f8f760307 Manpage translations in Makefiles
The translated manpage generation has moved from scripts to
Makefiles. This asists with conditional building as well, no
need to regenerate the German pgrep man page if both
the original pgrep.1 and man-po/de.po is not changed.

My Makefile-fu fails me on producing a cross-product or double
iteration for languages and man pages. Until that is solved
each man page is explicitly built. No big deal but it doesn't
look elegant in the Makefile. Languages will be picked
up automatically if they are found in man-po, man-po/top or
man-po/ps

The README describes the three-step process for translating
the files, incase I forget or someone else wants to update them.
2014-06-28 23:38:13 +10:00
Lukas Nykryn d66ed3350e ps: possibility to display slice unit for a process
Library systemd-login offers possibility to display
name of a systemd slice unit for specific pid.

This patch adds output option "slice" which will
show name of systemd slice unit.

To maintain compatibility with non-systemd systems,
procps must be configured with --with-systemd option
to enable this option.
2013-10-16 15:18:08 +02:00
Jaromir Capik afe862ebe4 pidof: reimplemented from scratch (replacing sysvinit pidof)
As the sysvinit becomes obsolete, some of the bundled tools
need to find a new home. The procps-ng project seems to be
the most suitable project for adopting the pidof tool.
This commit introduces a redesigned version of pidof
that satisfies the LSB requirements.
In corner cases the behaviour might differ from the former
one as the new version doesn't use any stat(2) calls.
2013-10-10 17:01:48 +02:00
Karel Zak fd1d13e170 build-sys: add support for silent buils
The automake AM_SILENT_RULES macro is supported since automake 1.11
(which is required for procps). The silent functionality is enabled by
default, you can change it by:

  ./configure --disable-silent-rules
or
   make V=1

Note that make still prints compiler errors, etc.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-13 19:49:01 +02:00
Jim Warner c43297442c build-sys: correct one AC_ARG_ENABLE() cleanup default
Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-08-13 19:44:10 +02:00