summaryrefslogtreecommitdiffstats
path: root/sys-utils/ipcrm.c
Commit message (Collapse)AuthorAgeFilesLines
* misc: consolidate version printing and close_stdout()Karel Zak2019-04-161-3/+3
| | | | 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: introduce print_usage_help_options()Ruediger Meier2017-06-271-2/+1Star
| | | | | | | | | | | | Consolidate --help and --version descriptions. We are now able to align them to the other options. We changed include/c.h. The rest of this patch was generated by sed, plus manually setting the right alignment numbers. We do not change anything but white spaces in the --help output. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: never use usage(stderr)Ruediger Meier2017-06-261-4/+5
| | | | | | | Here we fix all cases where we have usage(FILE*) functions. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: fix ggc-7 fallthrough warningsSami Kerola2017-06-141-0/+3
| | | | | | | | | | | | | | | | | | | (Original patch and commit message edited by Rudi.) gcc-7 adds -Wimplicit-fallthrough=3 to our default flag -Wextra. This warning can be silenced by using comment /* fallthrough */ which is also recognized by other tools like coverity. There are also other valid comments (see man gcc-7) but we consolidate this style now. We could have also used __attribute__((fallthrough)) but the comment looks nice and does not need to be ifdef'ed for compatibility. Reference: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=7652 Reference: https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/ Reviewed-by: Ruediger Meier <ruediger.meier@ga-group.nl> Suggested-by: Karel Zak <kzak@redhat.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* Use --help suggestion on invalid optionKarel Zak2016-12-191-2/+2
| | | | | | | | 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>
* misc: fix declarations shadowing variables in the global scope [oclint]Sami Kerola2016-07-211-4/+4
| | | | | | Fixes multiple occurences of 'optarg' overwrites. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: simplify if clauses [oclint]Sami Kerola2016-07-211-3/+2Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* build: fix printf warnings for icc (-Wformat-security)Ruediger Meier2015-01-211-1/+1
| | | | | | | | Intel compiler complains about printf style function calls with trivial format string and no other arguments. Like this one: ../sys-utils/ipcrm.c(117): warning #2279: printf/scanf format not a string literal and no format arguments err(EXIT_FAILURE, iskey ? _("key failed") : _("id failed"));
* ipcrm: fix usageKarel Zak2015-01-061-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* ipc*: use customary fputs() instead of fprintf() with the usage macrosBenno Schulenberg2015-01-061-5/+7
| | | | | | Also use the clearer word <number> with the --semaphore option. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* ipcrm: gettextize the command synopsis of the usage textBenno Schulenberg2015-01-061-3/+3
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* textual: add a docstring to most of the utilitiesBenno Schulenberg2015-01-061-1/+5
| | | | | | | | | 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>
* ipcs: fix shmctl() usageKarel Zak2014-12-191-3/+1Star
| | | | | | | | | | | | | | | | | | | | | | The function shmctl() has to be called with 'struct shmid_ds', and if you need 'struct shminfo' then the right way is to cast: bad way: struct shm_info info; shmctl(0, SHM_INFO, &info); right way: struct shmid_ds buf; struct shm_info *info; shmctl(0, SHM_INFO, &buf); info = (struct shm_info *) &buf); The patch also fixes bug in ipc_shm_get_limits() where is missing lim->shmmax in code based on shmctl(). Signed-off-by: Karel Zak <kzak@redhat.com>
* ipcrm: add hacks to avoid FTBFSAndreas Henriksson2014-09-171-0/+7
| | | | Signed-off-by: Andreas Henriksson <andreas@fatal.se>
* textual: remove square brackets from around three dotsBenno Schulenberg2014-05-061-4/+4
| | | | | | Also improve some option descriptions here and there. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* textual: spell and encode the name of Arkadiusz Miśkiewicz correctlyBenno Schulenberg2013-02-061-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* ipcrm: avoid 'uninitialized' warningBernhard Voelker2012-10-021-1/+1
| | | | | | | | | | GCC 4.1.2 on SLES 10.4: sys-utils/ipcrm.c: In function ‘main’: sys-utils/ipcrm.c:297: warning: ‘what_all’ may be used uninitialized in this function * sys-utils/ipcrm.c: Initialize what_all to ALL. Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
* sys-utils: cleanup strtoxx_or_err()Karel Zak2012-05-151-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sys-utils: verify writing to streams was successfulSami Kerola2012-04-041-0/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* sys-utils: fix typosDavidlohr Bueso2012-02-241-2/+2
| | | | Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* ipcrm: fix wrong subject in error messages for -m, -q, -s id optionsFrancesco Cosoleto2011-09-291-15/+8Star
| | | | | | This makes error messages print 'id' instead of 'key' using id options. Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
* ipcrm: use ternary operator in "(key|id) failed" messageFrancesco Cosoleto2011-09-291-3/+1Star
| | | | Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
* ipcrm: add static keyword to some functionsFrancesco Cosoleto2011-09-291-3/+3
| | | | Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
* build-sys: fixes to USAGE_* macrosSami Kerola2011-09-171-2/+2
| | | | | | | | | | | The USAGE_BEGIN_TAIL is removed as unnecessary. In between command specific options and --help & --version USAGE_SEPARATOR is inserted. For now the separator is empty line. The USAGE_MAN_TAIL is changed to take an argument. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ipcrm: check IPC syscallsDavidlohr Bueso2011-09-171-22/+24
| | | | | | | | | | It's not enough to check errno for errors as the variable is not reset, we also need to check the last syscall return value to verify a problem. This addresses bogus msgqueue errors when deleting keys. Signed-off-by: Davidlohr Bueso <dave@gnu.org> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ipcrm: add --verbose optionSami Kerola2011-09-171-1/+14
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ipcrm: add --all optionSami Kerola2011-09-171-3/+89
| | | | | | | | An --all option will remove all ipc entries. The option takes optional resource argument, which limits the removal to be applied only the given resource entries. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ipcrm: include-what-you-use header checkSami Kerola2011-09-171-9/+2Star
| | | | | | | | | | | Three removes & a sort to alphabetical order. ipcrm.c should remove these lines: - #include <ctype.h> // lines 29-29 - #include <sys/types.h> // lines 18-18 - #include <unistd.h> // lines 27-27 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ipcrm: refactor new and old main to share codeSami Kerola2011-09-171-145/+193
| | | | | | | The code is now much more tidy, and as a bonus old main has shares error printing with the `new' code. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ipcrm: exit if unknown error occursSami Kerola2011-09-171-6/+4Star
| | | | | | | Previously for instance lack of memory space caused unknown reason to be printed, and ipcrm tried to continue. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ipcrm: add long optionsSami Kerola2011-09-121-49/+56
| | | | | | | | With long options usage function had to be changed. The change also takes libc error printing facilities to use, primarily to get rid of execname & progname variables. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ipcrm: remove redundant message in case of invalid optionFrancesco Cosoleto2010-06-301-2/+0Star
| | | | | | | This leaves getopt() only to print a similar error message on invalid options. Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
* build-sys: check for union semun instead of using _SEM_SEMUN_UNDEFINEDGuillem Jover2009-10-091-3/+1Star
| | | | | | | | | | | | | | Older versions of glibc used to declare ‘union semun’ in <sys/sem.h>, but POSIX.1-2001 requires the caller to declare it instead. Later versions of glibc started defining _SEM_SEMUN_UNDEFINED to note that the union was not being declared, but conforming systems are not required to define that macro (e.g. FreeBSD). As a side effect we get rid of some obsolete __GNU_LIBRARY__ macro usage. [kzak@redhat.com: - use #ifndef] Signed-off-by: Guillem Jover <guillem@hadrons.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* Imported from util-linux-2.11r tarball.Karel Zak2006-12-071-0/+1
|
* Imported from util-linux-2.11q tarball.Karel Zak2006-12-071-16/+158
|
* Imported from util-linux-2.11b tarball.Karel Zak2006-12-071-1/+1
|
* Imported from util-linux-2.10m tarball.Karel Zak2006-12-071-29/+84
|
* Imported from util-linux-2.9v tarball.Karel Zak2006-12-071-4/+14
|
* Imported from util-linux-2.9i tarball.Karel Zak2006-12-071-0/+15
|
* Imported from util-linux-2.7.1 tarball.Karel Zak2006-12-071-0/+1
|
* Imported from util-linux-2.2 tarball.Karel Zak2006-12-071-0/+50