summaryrefslogtreecommitdiffstats
path: root/sys-utils/ipcs.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: 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>
* ipcs: make shmall overflow a bit less worseRuediger Meier2017-04-031-2/+8
| | | | | | | | | | | | | | | | | Still no large integer support but on overflow we print now the largest possible value, maybe even the largest one which makes sense at all. So on x86_64 systems we'll see now: $ echo "4503599627370496" > /proc/sys/kernel/shmall $ ipcs -m -l | grep "max total" max total shared memory (kbytes) = 18014398509481980 rather than this: $ ipcs -m -l | grep "max total" max total shared memory (kbytes) = 0 Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* 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-1/+1
| | | | | | | | 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>
* ipcs: consolidate output header printingRuediger Meier2016-03-211-5/+11
| | | | | | | | | | | | | Print a warning (instead of header) if --limits fails, like we did it in past (2.20.1) and like we are still doing for --summary. Note in past we were printing the same message like for --summary "kernel not configured for ...", but actually this message is not really correct. This patch simply consolidates the current behavior. Probably we should refactor it regarding warnings (stderr) and exit codes. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: fix some includesRuediger Meier2016-02-291-1/+0Star
| | | | | | | | | features.h: any glibc header includes this already libgen.h: was unused there sys/uio.h: for writev(3p) sys/queue.h seems like it was never used Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* ipcs: show gid instead of uidHushan Jia2016-02-221-3/+3
| | | | | | ipcs -i incorrectly used uid where it should be gid Signed-off-by: Hushan Jia <hushan.jia@gmail.com>
* sys-utils/disk-utils/lib: fix printf format types [cppcheck]Boris Egorov2015-06-251-2/+2
| | | | | | Fix 'invalidPrintfArgType' cppcheck warnings Signed-off-by: Boris Egorov <egorov@linux.com>
* ipc*: use customary fputs() instead of fprintf() with the usage macrosBenno Schulenberg2015-01-061-6/+9
| | | | | | Also use the clearer word <number> with the --semaphore option. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* ipcs: in usage show resource option as nonoptional when used with -iBenno Schulenberg2015-01-061-4/+4
| | | | | | | | Also, the resource option -a is not valid with -i, so show the valid ones explicitly. Also gettextize the synopsis as a single string, as the two lines are tightly related and other synopses do this too. 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-7/+9
| | | | | | | | | | | | | | | | | | | | | | 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>
* ipcs: remaining kFreeBSD hackery for building.Aurelien Jarno2014-09-171-0/+2
| | | | | Addresses-Debian-Bug: #527384 Signed-off-by: LaMont Jones <lamont@debian.org>
* ipcs: do not gettextize wordless stringsBenno Schulenberg2014-05-061-5/+5
| | | | | | Also tweak a few parts of the usage message. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* ipcs: fix size_t overflowKarel Zak2014-03-111-1/+1
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/51 Signed-off-by: Karel Zak <kzak@redhat.com>
* ipcs: assigned values are never read [clang-analyzer]Sami Kerola2013-07-091-3/+0Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* textual: spell and encode the name of Arkadiusz Miśkiewicz correctlyBenno Schulenberg2013-02-061-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* ipcs: report an error when -i is used with multiple resourcesBenno Schulenberg2013-02-061-19/+19
| | | | | | Also put everything in POSIX order: queues, memory, sempahores. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* ipcs: fix spacing in summary outputSami Kerola2013-01-091-1/+1
| | | | | | Change 56692a6 introduced spacing error to --summary printing. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ipcs: fix compiler warnings, use 64bit timeKarel Zak2012-12-201-20/+23
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* ipcs: make --human really sexyKarel Zak2012-12-191-2/+12
| | | | | | Align the "size" columns to the right. Signed-off-by: Karel Zak <kzak@redhat.com>
* ipcs: add --bytes size output optionSami Kerola2012-12-191-1/+6
| | | | | | | | This makes the command being a little closer standard compliant. See IEEE Std 1003.1 referral link below for more information. References: http://pubs.opengroup.org/onlinepubs/009696799/utilities/ipcs.html Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ipcs: add --human readable size conversion optionSami Kerola2012-12-191-34/+54
| | | | | | | | | Introduces new function ipc_print_size() which will call size_to_human_string(), and handles the occasional '([k]bytes)' printing if default size format is requested. Reviewed-by: Karel Zak <kzak@redhat.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ipcs: assist debuggingSami Kerola2012-12-191-6/+9
| | | | | | | One will be able to see enum symbols when debugging, which is not the case when values are specified as define list. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ipcs: remove print_perms()Sami Kerola2012-11-231-26/+0Star
| | | | | | The function is no longer in use. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ipcs: make individual message queue id printing to use /procSami Kerola2012-11-231-24/+23Star
| | | | | | | | [kzak@redhat.com: - fix msgctl() call, move q_qbytes to ipc_msg_get_info] Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* ipcs: clean up do_msg(), and add ipc_msg_get_info()Sami Kerola2012-11-231-45/+44Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ipcs: make individual semaphore id printing to use /procSami Kerola2012-11-231-35/+28Star
| | | | | | | | | And reindent the print_shm() function. [kzak@redhat.com: move semctl(GET*...) calls to ipcutils.c] Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* ipcs: clean up do_sem(), and add ipc_sem_get_info()Sami Kerola2012-11-231-40/+40
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ipcs: make individual shared memory id printing to use /procSami Kerola2012-11-231-21/+24
| | | | | | | And reindent the print_shm() function. Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* ipcs: clean up do_shm()Karel Zak2012-11-231-11/+22
| | | | | | | | - don't expect maxid as argument in ipc_shm_get_info() - if there is @id argument then use it everywhere in ipc_shm_get_info() - don't call shmctl() if not necessary in do_shm() Signed-off-by: Karel Zak <kzak@redhat.com>
* ipcs: read shared memory values from /procSami Kerola2012-11-231-39/+34Star
| | | | | | | | [kzak@redhat.com: - move to ipcutils.{c,h}, - fix datatypes to be arch independent] Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* ipcs: determine ipc limits from /procSami Kerola2012-11-231-100/+20Star
| | | | | | | | | | | | Some of the limit values are not dynamic. Like in kernel these values are #defined. [kzak@redhat.com: - use better names for functions, - add ipcutils.{c,h} - read also shmmax from /proc] Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* Fix typos found by misspellingsBernhard Voelker2012-04-231-1/+1
| | | | | | | | | | | | | | | The tool misspellings (https://github.com/lyda/misspell-check) detected several typos. Command used: $ git ls-files | grep -v ^po/ | misspellings -f - * isosize: Fix typo in usage string. * configure.ac: Fix typo in help string of --enable-most-builds option. * fdisk: Fix typo in man page. * libblkid, blkid, mount: Likewise. * Fix various typos in docs and in source code comments. Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
* sys-utils: verify writing to streams was successfulSami Kerola2012-04-041-0/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ipcs: minor changes to usage()Karel Zak2011-09-271-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: fixes to USAGE_* macrosSami Kerola2011-09-171-2/+1Star
| | | | | | | | | | | 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>
* ipcs: comment & white space clean upSami Kerola2011-09-171-86/+83Star
| | | | | | | Add to multiline comments to have left side stars, convert spaces to tabs and indent preprocessor directives Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ipcs: include-what-you-use header checkSami Kerola2011-09-171-9/+11
| | | | | | | | | | Two includes added & a sort to alphabetical order. ipcs.c should add these lines: #include <features.h> // for __GLIBC__ #include <stddef.h> // for size_t Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ipcs: add long optionsSami Kerola2011-09-171-41/+49
| | | | | | Includes necessary usage() changes. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ipcs: use unsigned type for uid/gidKarel Zak2011-08-091-17/+17
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* ipcs: fix compiler warnings [-Wsign-compare]Karel Zak2011-08-011-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* ipcs: fix typoKarel Zak2011-02-211-1/+1
| | | | | Reported-by: Francesco Cosoleto <cosoleto@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* ipcs: really show all resources when -a and -i are combinedJens Kristian Søgaard2011-02-211-4/+5
| | | | | | | | When you have more than one resource with the same id (but differing types) combining -a and -i does not show all resources. This patch corrects that. Signed-off-by: Jens Kristian Søgaard <jens@mermaidconsulting.dk>
* build-sys: provide alternatives for err, errx, warn and warnxFabian Groffen2011-02-141-1/+1
| | | | | | | | Solaris lacks err, errx, warn and warnx. This also means the err.h header doesn't exist. Removed err.h include from all files, and included err.h from c.h instead if it exists, otherwise alternatives are provided. Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* ipcs: advise translators a different output formatFrancesco Cosoleto2010-06-301-5/+19
| | | | | | | | | Shared memory status output format need changes but there are backward compatibility problems. This is a invite to apply in translations the same style used for the rest of the summaries as well as for the limits reported by -l option. Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
* ipcs: reorganize help and usage textsFrancesco Cosoleto2010-06-011-14/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Help text old version: ipcs provides information on ipc facilities for which you have read access. Resource Specification: -m : shared_mem -q : messages -s : semaphores -a : all (default) Output Format: -t : time -p : pid -c : creator -l : limits -u : summary -i id [-s -q -m] : details on resource identified by id usage : ipcs -asmq -tclup ipcs [-s -m -q] -i id ipcs -h for help. New version: Usage: ipcs [resource]... [output-format] ipcs [resource] -i id Provide information on IPC facilities for which you have read access. -h display this help -i id print details on resource identified by id Resource options: -m shared memory segments -q message queues -s semaphores -a all (default) Output format: -t time -p pid -c creator -l limits -u summary Usage text old version: usage : ipcs -asmq -tclup ipcs [-s -m -q] -i id ipcs -h for help. New version: Usage: ipcs [-asmq] [-t|-c|-l|-u|-p] ipcs [-s|-m|-q] -i id ipcs -h for help [kzak@redhat.com: - use program_invocation_short_name - minor cleanups] Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>