summaryrefslogtreecommitdiffstats
path: root/sys-utils/prlimit.c
Commit message (Collapse)AuthorAgeFilesLines
* misc: consolidate version printing and close_stdout()Karel Zak2019-04-161-7/+6Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sys-utils: use errexec()Karel Zak2018-02-011-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: consolidate macro style USAGE_HELP_OPTIONSRuediger Meier2017-06-291-2/+2
| | | | | | | | | changed in include/c.h and applied via sed: sed -i 's/fprintf.*\(USAGE_MAN_TAIL.*\)/printf(\1/' $(git ls-files -- "*.c") sed -i 's/print_usage_help_options\(.*\);/printf(USAGE_HELP_OPTIONS\1);/' $(git ls-files -- "*.c") Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: consolidate all --help option descriptionsRuediger Meier2017-06-271-2/+2
| | | | | | | | Now we are always using the same text also for commands which had still hardcoded descriptions or where we can't use the standard print_usage_help_options macro. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: cosmetics, remove argument from usage(FILE*)Ruediger Meier2017-06-261-3/+4
| | | | | | | | | | | | | | This patch is trivial and changes nothing, because we were always using usage(stdout) Now all our usage() functions look very similar. If wanted we could auto-generate another big cosmetical patch to remove all the useless "FILE *out" constants and use printf and puts rather than their f* friends. Such patch could be automatically synchronized with the translation project (newlines!) to not make the translators sick. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: consolidate usage() "Available columns"Karel Zak2017-06-261-2/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: fix some warningsRuediger Meier2017-06-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sys-utils/prlimit.c: In function 'do_prlimit': sys-utils/prlimit.c:367:16: warning: format '%ju' expects argument of type 'uintmax_t', but argument 2 has type 'rlim_t {aka long long unsigned int}' [-Wformat=] printf("<%ju", new->rlim_cur); lib/plymouth-ctrl.c: In function 'open_un_socket_and_connect': lib/plymouth-ctrl.c:88:20: warning: passing argument 2 of 'connect' from incompatible pointer type [-Wincompatible-pointer-types] ret = connect(fd, &su, offsetof(struct sockaddr_un, sun_path) + 1 + strlen(su.sun_path+1)); ^ In file included from lib/plymouth-ctrl.c:35:0: /usr/include/sys/socket.h:314:5: note: expected 'const struct sockaddr *' but argument is of type 'struct sockaddr_un *' int connect (int, const struct sockaddr *, socklen_t); login-utils/last.c: In function 'list': login-utils/last.c:506:54: warning: pointer targets in passing argument 4 of 'dns_lookup' differ in signedness [-Wpointer-sign] r = dns_lookup(domain, sizeof(domain), ctl->useip, p->ut_addr_v6); ^ login-utils/last.c:291:12: note: expected 'int32_t * {aka int *}' but argument is of type 'unsigned int *' static int dns_lookup(char *result, int size, int useip, int32_t *a) ^~~~~~~~~~ In file included from sys-utils/hwclock-cmos.c:92:0: sys-utils/hwclock.h:67:32: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration extern double time_diff(struct timeval subtrahend, struct timeval subtractor); misc-utils/test_uuidd.c: In function 'create_nthreads': misc-utils/test_uuidd.c:187:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] proc->pid, (int) th->tid, th->index)); Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: consolidate smartcols error messagesKarel Zak2017-05-181-6/+5Star
| | | | | | ... just to keep translators happy Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: add static keyword to where needed [smatch scan]Sami Kerola2017-02-201-1/+1
| | | | | | | text-utils/rev.c:68:9: warning: symbol 'buf' was not declared. Should it be static? Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* Use --help suggestion on invalid optionKarel Zak2016-12-191-2/+1Star
| | | | | | | | The current default is to print all usage() output. This is overkill in many case. Addresses: https://github.com/karelzak/util-linux/issues/338 Signed-off-by: Karel Zak <kzak@redhat.com>
* prlimit: cleanup output unitsKarel Zak2015-11-051-7/+7
| | | | | | The change is based on kernel fs/proc/base.c. Signed-off-by: Karel Zak <kzak@redhat.com>
* prlimit: tell in --verbose output which pid got the new limitSami Kerola2015-02-241-1/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* textual: add a docstring to most of the utilitiesBenno Schulenberg2015-01-061-0/+3
| | | | | | | | | 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>
* prlimit: clean up columns[] usageKarel Zak2014-07-181-8/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: add debug messagesKarel Zak2014-06-061-0/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: clean up flags usageKarel Zak2014-04-031-3/+3
| | | | | | | | | * 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>
* prlimit: clean up scols usageKarel Zak2014-04-031-14/+8Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* prlimit: use libsmartcolsOndrej Oprala2014-04-031-24/+31
| | | | Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
* prlimit: use TT_FL_FREEDATA for tt tableKarel Zak2013-09-161-5/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* prlimit: delete rem_prlim prototypeDavidlohr Bueso2013-05-061-12/+8Star
| | | | | | We can just move the function up before any of its callers. Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* translation: unify exec error messagesSami Kerola2013-02-061-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* prlimit: don't care about xasprintf() return codeKarel Zak2012-12-121-8/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* prlimit: improve error messages for bad --pid invocationBernhard Voelker2012-07-261-2/+2
| | | | Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
* prlimit: use err_exclusive_options()Karel Zak2012-07-261-10/+3Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* prlimit: use exclusive_option()Sami Kerola2012-06-171-6/+10
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* sys-utils: cleanup strtoxx_or_err()Karel Zak2012-05-151-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* prlimit: remove bogus instructionsDavidlohr Bueso2012-04-231-2/+0Star
| | | | Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* sys-utils: verify writing to streams was successfulSami Kerola2012-04-041-0/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* xalloc: use xasprintf in all filesSami Kerola2012-03-181-6/+6
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* docs: corrections to FSF license files, and postal addressSami Kerola2012-02-241-3/+3
| | | | | | | | | | | | | | 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>
* prlimit: use xalloc libsDavidlohr Bueso2011-12-201-1/+1
| | | | Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* prlimit: return proper typeDavidlohr Bueso2011-12-161-1/+1
| | | | | | The add_prlim() function's definition currently returns a bogus structure. Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* prlimit: s/amount/number/Jim Meyering2011-11-231-5/+5
|
* prlimit: add support for executing a commandBernhard Voelker2011-11-231-4/+13
| | | | | | | | | 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>
* prlimit: don't share pointer for old and new in prlimit(2)Karel Zak2011-11-161-3/+4
| | | | | | | | 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>
* prlimit: avoid segfault due to array-out-of-bounds errorKarel Zak2011-11-161-39/+63
| | | | | | | | | | | | | 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>
* prlimit: replace lims[i] with pointerKarel Zak2011-11-161-12/+13
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* prlimit: fix case when PID is given laterBernhard Voelker2011-11-161-29/+33
| | | | | | | | | | | | | | | | | | | # 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>
* prlimit: fix error messageKarel Zak2011-11-161-2/+4
| | | | | | | | | | - 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>
* prlimit: show all limits if called without optionsBernhard Voelker2011-11-161-2/+1Star
| | | | | | | | 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>
* prlimit: fix SYS_ macroKarel Zak2011-11-091-1/+1
| | | | | Reported-by: "Voelker, Bernhard" <bernhard.voelker@siemens-enterprise.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* prlimit: add --{raw,noheadings} optionsKarel Zak2011-11-071-7/+21
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* prlimit: add a units columnDavidlohr Bueso2011-11-071-16/+23
| | | | | Signed-off-by: Davidlohr Bueso <dave@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* prlimit: add add falbacksKarel Zak2011-11-031-0/+14
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* prlimit: new commandDavidlohr Bueso2011-10-211-0/+571
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>