Commit Graph

38 Commits

Author SHA1 Message Date
Jim Warner
423297c9db all: make buildable again for new 'misc.h' header file
With the 4 header files removed in the previous patch,
this commit just changes all those obsolete references
to that new consolidated 'misc.h' header file instead.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-01-21 17:30:25 +11:00
Qualys Security Advisory
69b67b6f6e 0040-proc/devname.c: Never write more than "chop" (part 2).
"chop" is the maximum offset where the null-byte should be written;
respect this even if about to write just one (non-null) character.
2018-06-09 21:35:19 +10:00
Qualys Security Advisory
0e365c8930 0039-proc/devname.c: Never write more than "chop" characters.
This should be guaranteed by "tmp[chop] = '\0';" and "if(!c) break;" but
this patch adds a very easy belt-and-suspenders check.
2018-06-09 21:35:19 +10:00
Qualys Security Advisory
a3111efa71 0038-proc/devname.c: Prevent off-by-one overflow in dev_to_tty(). 2018-06-09 21:35:19 +10:00
Qualys Security Advisory
170397d59c 0037-proc/devname.c: Use snprintf() in link_name().
Found no problematic use case at the moment, but better safe than sorry.
Also, return an error on snprintf() or readlink() truncation.
2018-06-09 21:35:19 +10:00
Jim Warner
18e684d65d library: eliminate all dependencies on alloc.h/alloc.c
While that old master branch library may utilize those
memory allocation functions found in the alloc module,
it was inappropriate for this newlib branch to subject
callers to a stderr message followed by an early exit.

Of course, the old libprocps offered a message handler
override provision (xalloc_err_handler) but that, too,
would seem to be inappropriate for our modern library.

[ remember the battles fought with that damn libnuma ]

So, this commit will tweak those old inherited sources
setting the stage for standardized return values/errno
settings in connection with a memory allocation error.

------------------------------------------------------
Along the way, we'll address the following miscellany:

. Completely eliminate usage of anything from alloc.h.
This, of course, entails our own error checking of the
alternative allocation calls from stdlib.h & string.h.

. Eliminate use of the strdup function where possible,
as with 'procps_uptime' and 'procps_loadavg' routines.

. Whack some obsolete code (getslabinfo) in sysinfo.c.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2017-12-20 21:18:53 +11: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
Simon Tatham
f888a30d23 library: find tty device name of process quicker
The procps library attempts to work out the tty of a process
through several methods. For things like /dev/tty123 or
/dev/foo it works fine.

For tty devices that put the minor number in a directory
of the major name this fails. So then we have to fallback
to stating things like the processes STDERR and try again.

Considering a lot of processes sit on ttys such as
/dev/pts/3 this is a lot of wasted time. At the point of
entering driver_name we know "/dev/pts" and we know "3"
we just didn't join them up the right way as this is old
code.

This change now looks for /dev/pts/3 as well. It does it
after looking for /dev/pts3 so the behaviour is the same.

References:
 https://bugs.debian.org/770215

Signed-off-by: Craig Small <csmall@enc.com.au>
2016-07-03 10:47:25 +10:00
Craig Small
6252bf439f library: Remove tty_to_dev()
This library call was imported into w as it was only used in
this program.  Converting a tty to a device is not really the
work for libprocps.
2015-09-01 20:41:25 +10:00
Jim Warner
fe75e26ab6 miscellaneous: clean up trailing whitespace throughout
The entire tree's polluted with inappropriate trailing
whitespace. This commit rids our environment of all of
those useless keystrokes. Unfortunately, it sure ain't
a permanent solution and requires every contributor to
instruct their editor(s) to prevent or eliminate them.

Plus it's strongly recommended we all insert something
like what's shown below to our '.gitconfig' file so as
to provide at least some warnings when we try to apply
any patches (git am) that do contain the #@!%& things!

References(s):
~/.gitconfig excerpt ---------------------------------
[core]
  whitespace = trailing-space, space-before-tab, blank-at-eof
[apply]
  whitespace = warn
--------------------------------- ~/.gitconfig excerpt

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-03-14 12:36:47 +01:00
Sami Kerola
ce61089059 docs: clarification to license headers in files
Add license header to all files.  The summary of licensing is below,
taken from Craig Small's email which is referred in commit message
tail.

sysctl and pgrep are GPL 2+
The rest is LGPL 2.1+

Reference: http://www.freelists.org/post/procps/Incorrect-FSF-address-in-the-license-files,8
Bug-Redhat: https://bugzilla.redhat.com/show_bug.cgi?id=797962
CC: Craig Small <csmall@enc.com.au>
CC: Jaromir Capik <jcapik@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-03 18:41:11 +11:00
Sami Kerola
79d163568b libprocps: remove linux 2.7.0 check
Checking for linux kernel version 2.7.0 is meaningless now when 3.0.0
is out.

Reported-By: Christian Hofstaedtler
Bug-Debian: http://bugs.debian.org/635553
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-02-11 21:44:29 +01:00
Sami Kerola
c1fa3bfce8 misc: compiler warning fixes
Fix few compiler warnings. Some of these warnings appeared multiple
times, and the listing bellow is more about which sort of errors
where fixed.

devname.c:87:12: warning: comparison of integers of different signs: 'int' and 'unsigned long'
output.c:389:36: warning: passing 'char **const' to parameter of type 'const char *const restrict *' discards qualifiers in nested pointer types
output.c:611:31: warning: comparison of integers of different signs: 'const unsigned long' and 'int'
stacktrace.c:33:37: warning: unused parameter 'signum'

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:50 +01:00
Jim Warner
827334870d library: exploit enhanced library memory allocation provisions
There were numerous library memory allocation inconsistencies.
Some were checked for failure and others were not.

All library source modules were modified to utilize the alloc.h
memory rouines which are consistent in dealing with errors.
2011-12-11 22:26:55 +11:00
albert
b0210803bf update /dev/tty* info to May 2009 devices.txt 2009-05-03 06:39:33 +00:00
albert
0231385023 fix the low_density_names table, maybe 2006-07-09 06:58:39 +00:00
albert
86de01f3d0 Linux 2.6.17 tty devices. Lose support for original pty numbering. 2006-07-09 04:41:30 +00:00
albert
f9d99085e7 crazy Debian GNU/kFreeBSD guy wanted this 2005-01-27 04:08:10 +00:00
albert
0586dc8b6d fix warnings; put CFLAGS on lib link command 2004-09-23 13:41:33 +00:00
albert
0d77d98bf3 ttySMX* devices, /proc/vmstat change, /proc/meminfo change 2004-08-27 20:21:46 +00:00
albert
0bdf88ffac SGI Altix console port ttySG0 is #40 2004-07-17 03:15:21 +00:00
albert
34c4da73d1 tolerate IA-64 headers w/o PAGE_SIZE 2004-07-15 05:29:56 +00:00
albert
b8a775d32e Linux 2.6.4 devices.txt 2004-03-17 18:30:10 +00:00
albert
2fc41eefa8 Linux 2.6.4 Documentation/devices.txt 2004-02-24 22:39:48 +00:00
albert
fbadfaa850 protect against BSD pty w/ 20-bit minor 2004-02-24 04:14:36 +00:00
albert
efd8648fc7 add slabtop, fix top ^Z terminal handling 2004-01-24 22:33:56 +00:00
albert
ac6260bc23 hard disk about to die 2003-09-28 02:45:05 +00:00
albert
256e1f767c new gcc+ld+gas features 2003-01-15 10:52:39 +00:00
albert
3e67b58ec2 satisfy GPL section 2a and LGPL section 2b name+date requirement 2002-12-15 00:30:17 +00:00
albert
cec50aa831 fixed config parser 2002-12-04 01:59:45 +00:00
albert
7ac9a0e1f5 present for Jim 2002-12-03 09:07:59 +00:00
albert
bd1a19b577 c99 2002-11-25 10:16:33 +00:00
albert
81a4a3d281 gcc 3.0 warnings 2002-10-12 04:25:57 +00:00
albert
e96d6b6141 Avoid opening System.map just to check it, etc. 2002-10-02 12:10:39 +00:00
albert
c0b92a2db2 unused variable 2002-05-29 22:14:24 +00:00
albert
ea1d89ec4f follow coding style -- but it's still strange code 2002-05-28 03:24:12 +00:00
csmall
e4c67b2724 Put most of the Debian patches in
added a lot of cvsignore files
2002-02-01 23:40:38 +00:00
csmall
03a9b5a30f procps 010114 2002-02-01 22:47:29 +00:00