Commit Graph

35 Commits

Author SHA1 Message Date
Karel Zak 803172f63d prlimit: cleanup output units
The change is based on kernel fs/proc/base.c.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-11-05 18:59:00 +01:00
Sami Kerola 288cb6f5dd prlimit: tell in --verbose output which pid got the new limit
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-02-24 11:22:26 +01:00
Benno Schulenberg 451dbcfae1 textual: add a docstring to most of the utilities
This adds a concise description of a tool to its usage text.

A first form of this patch was proposed by Steven Honeyman
(see http://www.spinics.net/lists/util-linux-ng/msg09994.html).

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-01-06 11:27:38 +01:00
Karel Zak 7887c6e0f0 prlimit: clean up columns[] usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-07-18 13:54:31 +02:00
Karel Zak 710ed55dcd libsmartcols: add debug messages
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-06-06 13:47:06 +02:00
Karel Zak 0925a9dd6c libsmartcols: clean up flags usage
* rename flags functions to scols_table_enable_*
 * rename *_no_foo() functions to _nofoo()
 * output formats are mutually exclusive, so don't use flags there
 * don't assume symbols in scols_new_table(), use scols_table_set_symbols()

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-03 16:09:57 +02:00
Karel Zak 05186e79ff prlimit: clean up scols usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-03 12:29:20 +02:00
Ondrej Oprala 226d76e667 prlimit: use libsmartcols
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2014-04-03 12:29:19 +02:00
Karel Zak 1e7708511f prlimit: use TT_FL_FREEDATA for tt table
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:59 +02:00
Davidlohr Bueso a971fa18b6 prlimit: delete rem_prlim prototype
We can just move the function up before any of its callers.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2013-05-06 19:27:03 +02:00
Sami Kerola 07ff972eb6 translation: unify exec error messages
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-02-06 11:51:17 +01:00
Karel Zak 76a9fcc913 prlimit: don't care about xasprintf() return code
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-12-12 12:16:16 +01:00
Bernhard Voelker a1ec61372c prlimit: improve error messages for bad --pid invocation
Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
2012-07-26 17:24:07 +02:00
Karel Zak 2dac37dd68 prlimit: use err_exclusive_options()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-26 09:26:34 +02:00
Sami Kerola 73e1d7fb02 prlimit: use exclusive_option()
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-06-17 17:59:59 +02:00
Karel Zak 20a3998222 sys-utils: cleanup strtoxx_or_err()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-05-15 17:45:17 +02:00
Davidlohr Bueso 3f1789ce5d prlimit: remove bogus instructions
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-04-23 12:05:25 +02:00
Sami Kerola efb8854f4c sys-utils: verify writing to streams was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-04 19:49:40 +02:00
Sami Kerola 6f312c8957 xalloc: use xasprintf in all files
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-18 14:28:05 +01:00
Sami Kerola 7cebf0bb4f docs: corrections to FSF license files, and postal address
The COPYING and Documentation/licenses/COPYING* files are being
replaced by files from GNU web site.

http://www.gnu.org/licenses/gpl-2.0.txt
http://www.gnu.org/licenses/lgpl-2.1.txt

Postal addresses to FSF in other files are updated to match with the
address in license files.

Reference: http://lists.gnu.org/archive/html/freefont-announce/2005-04/msg00001.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-02-24 14:13:35 +01:00
Davidlohr Bueso 212db7f2af prlimit: use xalloc libs
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2011-12-20 13:09:32 +01:00
Davidlohr Bueso 16fb9b3d11 prlimit: return proper type
The add_prlim() function's definition currently returns a bogus structure.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2011-12-16 11:20:51 +01:00
Jim Meyering 1023db5015 prlimit: s/amount/number/ 2011-11-23 12:52:36 +01:00
Bernhard Voelker 53e1f461f9 prlimit: add support for executing a command
prlimit.c: Alternatively to applying the limits to an existing process via the
--pid option, allow a command to be executed. Adapted usage() accordingly.

prlimit.1: mention new syntax.

Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
2011-11-23 12:11:46 +01:00
Karel Zak 8b6e450388 prlimit: don't share pointer for old and new in prlimit(2)
This patch makes the code more robust. We should not share the same
pointer for old and new arguments for prlimit(2) syscall.

Reported-by: Bernhard Voelker <mail@bernhard-voelker.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-16 13:30:05 +01:00
Karel Zak 94c0166257 prlimit: avoid segfault due to array-out-of-bounds error
Example:
$ prlimit -l -l -l -l -l -l -l -l -l -l -l -l -l -l -l -l -l -l -l
RESOURCE DESCRIPTION                         SOFT   HARD UNITS
MEMLOCK  max locked-in-memory address space 65536 262144 bytes
MEMLOCK  max locked-in-memory address space 65536 262144 bytes
...
Segmentation fault

Reported-by: Bernhard Voelker <mail@bernhard-voelker.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-16 13:21:40 +01:00
Karel Zak 2f0948b18d prlimit: replace lims[i] with pointer
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-16 12:04:52 +01:00
Bernhard Voelker 044bc8de2d prlimit: fix case when PID is given later
# prlimit --nofile=:4000 --pid $$

When the PID is given later than a partially given limit, then prlimit
used the current PID for getting the missing part (hard, soft) of the
limit.

Factored out the retrieval of the unknown limit from parse_prlim() to
new get_unknown_hardsoft() which is to be called by do_prlimit() based
on the struct prlimit member 'modify' set by add_prlim().

[kzak@redhat.com: - use prlimit->mofify as mask
                  - add soft vs. hard limit check from another
                    Bernhard's patch]

Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-16 11:55:43 +01:00
Karel Zak f88e44be57 prlimit: fix error message
- differentiate between set and get operations
 - add limit name to the error message
 - remove PID from the message (whole util works always with only one
   PID, so this info is superfluous)

Reported-by: Bernhard Voelker <mail@bernhard-voelker.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-16 10:54:07 +01:00
Bernhard Voelker 8f71d37bc5 prlimit: show all limits if called without options
Fix option parsing: prlimit ran into usage() if called
without arguments which should only be done for surplus
arguments. Instead, it should display all limits.

Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
2011-11-16 10:24:28 +01:00
Karel Zak ebdd79c9ee prlimit: fix SYS_ macro
Reported-by: "Voelker, Bernhard" <bernhard.voelker@siemens-enterprise.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-09 11:53:49 +01:00
Karel Zak d254c1dbae prlimit: add --{raw,noheadings} options
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-07 09:57:46 +01:00
Davidlohr Bueso d76f904af3 prlimit: add a units column
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-07 09:43:29 +01:00
Karel Zak 945ac25080 prlimit: add add falbacks
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-03 12:32:51 +01:00
Davidlohr Bueso 6bac2825af prlimit: new command
This program uses the prlimit() system call to get and/or set resource limits
for a given process.

[kzak@redhat,com: - improve <soft:hard> parsing,
                  - use short cmdline options compatible with ulimits
                  - add --verbose mode
                  - fix gcc warnings]

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-10-21 23:19:51 +02:00