prev="${COMP_WORDS[COMP_CWORD-1]}"
case $prev in
'-m'|'--shmem-id')
- KEYIDS="$(lsipc -m | awk 'NR>1 {print $2}')"
+ KEYIDS="$(lsipc -m --noheadings -o ID)"
COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) )
return 0
;;
'-M'|'--shmem-key')
- KEYIDS="$(lsipc -m | awk 'NR>1 {print $1}')"
+ KEYIDS="$(lsipc -m --noheadings -o KEY)"
COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) )
return 0
;;
'--posix-shmem')
- KEYIDS="$(lsipc -M | awk 'NR>1 {print $1}')"
+ KEYIDS="$(lsipc -M --noheadings -o NAME)"
COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) )
return 0
;;
'-q'|'--queue-id')
- KEYIDS="$(lsipc -q | awk 'NR>1 {print $2}')"
+ KEYIDS="$(lsipc -q --noheadings -o ID)"
COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) )
return 0
;;
'-Q'|'--queue-key')
- KEYIDS="$(lsipc -q | awk 'NR>1 {print $1}')"
+ KEYIDS="$(lsipc -q --noheadings -o KEY)"
COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) )
return 0
;;
'--posix-mqueue')
- KEYIDS="$(lsipc -Q | awk 'NR>1 {print $1}')"
+ KEYIDS="$(lsipc -Q --noheadings -o NAME)"
COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) )
return 0
;;
'-s'|'--semaphore-id')
- KEYIDS="$(lsipc -s | awk '{if (3 < NR) {print $2}}')"
+ KEYIDS="$(lsipc -s --noheadings -o ID)"
COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) )
return 0
;;
'-S'|'--semaphore-key')
- KEYIDS="$(lsipc -s | awk '{if (3 < NR) {print $1}}')"
+ KEYIDS="$(lsipc -s --noheadings -o KEY)"
COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) )
return 0
;;
'--posix-semaphore')
- KEYIDS="$(lsipc -S | awk 'NR>1 {print $1}')"
+ KEYIDS="$(lsipc -S --noheadings -o NAME)"
COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) )
return 0
;;
ipcrm_sources,
include_directories : includes,
link_with : [lib_common],
- dependencies : [mount_dep] + posixipc_libs,
+ dependencies : posixipc_libs,
install_dir : usrbin_exec_dir,
install : opt,
build_by_default : opt)
ipcs_sources,
include_directories : includes,
link_with : [lib_common],
- dependencies : [mount_dep] + posixipc_libs,
+ dependencies : posixipc_libs,
install_dir : usrbin_exec_dir,
install : opt,
build_by_default : opt)
include_directories : includes,
link_with : [lib_common,
lib_smartcols],
- dependencies : [mount_dep] + posixipc_libs,
+ dependencies : posixipc_libs,
install_dir : usrbin_exec_dir,
install : opt,
build_by_default : opt)
ipcrm_SOURCES = sys-utils/ipcrm.c \
sys-utils/ipcutils.c \
sys-utils/ipcutils.h
-ipcrm_LDADD = $(LDADD) $(POSIXIPC_LIBS) libcommon.la libmount.la
-ipcrm_CFLAGS = $(AM_CFLAGS) -I$(ul_libmount_incdir)
+ipcrm_LDADD = $(LDADD) $(POSIXIPC_LIBS) libcommon.la
endif
if BUILD_IPCS
ipcs_SOURCES = sys-utils/ipcs.c \
sys-utils/ipcutils.c \
sys-utils/ipcutils.h
-ipcs_LDADD = $(LDADD) $(POSIXIPC_LIBS) libcommon.la libmount.la
-ipcs_CFLAGS = $(AM_CFLAGS) -I$(ul_libmount_incdir)
+ipcs_LDADD = $(LDADD) $(POSIXIPC_LIBS) libcommon.la
endif
if BUILD_IRQTOP
lsipc_SOURCES = sys-utils/lsipc.c \
sys-utils/ipcutils.c \
sys-utils/ipcutils.h
-lsipc_LDADD = $(LDADD) $(POSIXIPC_LIBS) libcommon.la libsmartcols.la libmount.la
-lsipc_CFLAGS = $(AM_CFLAGS) -I$(ul_libsmartcols_incdir) -I$(ul_libmount_incdir)
+lsipc_LDADD = $(LDADD) $(POSIXIPC_LIBS) libcommon.la libsmartcols.la
+lsipc_CFLAGS = $(AM_CFLAGS) -I$(ul_libsmartcols_incdir)
endif
if BUILD_RENICE
{
FILE *f;
DIR *d;
- int i = 0, mounted = 0;
+ int i = 0;
struct posix_msg_data *p;
struct dirent *de;
p = *msgds = xcalloc(1, sizeof(struct msg_data));
p->next = NULL;
+ if (access(_PATH_DEV_MQUEUE, F_OK) != 0) {
+ warnx(_("%s does not seem to be mounted. Use 'mount -t mqueue none %s' to mount it."), _PATH_DEV_MQUEUE, _PATH_DEV_MQUEUE);
+ return -1;
+ }
+
d = opendir(_PATH_DEV_MQUEUE);
if (!d) {
- /* Mount the mqueue filesystem if it is not mounted */
- if (errno == ENOENT) {
- struct libmnt_context *ctx;
-
- ctx = mnt_new_context();
- if (!ctx)
- err(EXIT_FAILURE, _("cannot create libmount context"));
-
- if (mnt_context_set_source(ctx, "none") < 0)
- err(EXIT_FAILURE, _("cannot set source"));
-
- if (mnt_context_set_target(ctx, _PATH_DEV_MQUEUE) < 0)
- err(EXIT_FAILURE, _("cannot set target"));
-
- if (mnt_context_set_fstype(ctx, "mqueue") < 0)
- err(EXIT_FAILURE, _("cannot set filesystem type"));
-
- if (mnt_context_mount(ctx) < 0)
- err(EXIT_FAILURE, _("cannot mount %s"), _PATH_DEV_MQUEUE);
-
- mnt_free_context(ctx);
- mounted = 1;
- } else err(EXIT_FAILURE, _("cannot open %s"), _PATH_DEV_MQUEUE);
+ warnx(_("cannot open %s"), _PATH_DEV_MQUEUE);
+ return -1;
}
while ((de = readdir(d)) != NULL) {
free(*msgds);
closedir(d);
- /* Unmount the mqueue filesystem if it was not mounted by default */
- if (mounted) {
- struct libmnt_context *ctx;
-
- ctx = mnt_new_context();
- if (!ctx)
- err(EXIT_FAILURE, _("cannot create libmount context"));
-
- if (mnt_context_set_target(ctx, _PATH_DEV_MQUEUE) < 0)
- err(EXIT_FAILURE, _("cannot set target"));
-
- if (mnt_context_umount(ctx) < 0)
- err(EXIT_FAILURE, _("cannot umount %s"), _PATH_DEV_MQUEUE);
-
- mnt_free_context(ctx);
- }
-
return i;
}
#include <grp.h>
#include <pwd.h>
#include <stdint.h>
-#include <libmount.h>
/*
* SHM_DEST and SHM_LOCKED are defined in kernel headers, but inside
struct posix_msg_data *msgds, *p;
char *arg = NULL;
- if (posix_ipc_msg_get_info(name, &msgds) < 1) {
+ int rc = posix_ipc_msg_get_info(name, &msgds);
+ if (rc == -1)
+ return;
+
+ if (rc < 1) {
if (name != NULL)
warnx(_("mqueue %s not found"), name);
return;
{
struct posix_msg_data *pmsgds;
struct ipc_limits lim;
- int pmsgqs = 0;
+ int pmsgqs = posix_ipc_msg_get_info(NULL, &pmsgds);
ipc_msg_get_limits(&lim);
- /* count number of used posix queues */
- if (posix_ipc_msg_get_info(NULL, &pmsgds) > 0) {
- struct posix_msg_data *p;
-
- for (p = pmsgds; p->next != NULL; p = p->next)
- ++pmsgqs;
- posix_ipc_msg_free_info(pmsgds);
- }
+ if (pmsgqs == -1)
+ pmsgqs = 0;
global_set_data(ctl, tb, "MQUMNI", _("Number of POSIX message queues"), pmsgqs, lim.msgmni_posix, 1, 0);
global_set_data(ctl, tb, "MQUMAX", _("Max size of POSIX message (bytes)"), 0, lim.msgmax_posix, 0, 1);