public inbox for lvm2-cvs@sourceware.org help / color / mirror / Atom feed
From: prajnoha@sourceware.org To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org Subject: LVM2/tools dmsetup.c Date: Thu, 06 Aug 2009 15:05:00 -0000 [thread overview] Message-ID: <20090806150511.30932.qmail@sourceware.org> (raw) CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: prajnoha@sourceware.org 2009-08-06 15:05:11 Modified files: tools : dmsetup.c Log message: Add 'udevcookies' command for dmsetup. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/dmsetup.c.diff?cvsroot=lvm2&r1=1.121&r2=1.122 --- LVM2/tools/dmsetup.c 2009/08/06 15:04:30 1.121 +++ LVM2/tools/dmsetup.c 2009/08/06 15:05:10 1.122 @@ -36,6 +36,7 @@ #include <sys/param.h> #include <locale.h> #include <langinfo.h> +#include <time.h> #include <fcntl.h> #include <sys/stat.h> @@ -853,6 +854,45 @@ } #endif +static int _udevcookies(int argc __attribute((unused)), char **argv __attribute((unused)), void *data __attribute((unused))) +{ + int max_id, id, sid; + struct seminfo sinfo; + struct semid_ds sdata; + int val; + char *time_str; + + if ((max_id = semctl(0, 0, SEM_INFO, &sinfo)) < 0) { + log_sys_error("sem_ctl", "SEM_INFO"); + return 0; + } + + printf("cookie semid value last_semop_time\n"); + + for (id = 0; id <= max_id; id++) { + if ((sid = semctl(id, 0, SEM_STAT, &sdata)) < 0) + continue; + + if (sdata.sem_perm.__key >> 16 == DM_COOKIE_MAGIC) { + if ((val = semctl(sid, 0, GETVAL)) < 0) { + log_error("semid %d: sem_ctl failed for " + "cookie 0x%" PRIx32 ": %s", + sid, sdata.sem_perm.__key, + strerror(errno)); + continue; + } + + time_str = ctime((const time_t *) &sdata.sem_otime); + + printf("0x%-10x %-10d %-10d %s", sdata.sem_perm.__key, + sid, val, time_str ? time_str : "unknown"); + } + } + + return 1; +} + + static int _version(int argc __attribute((unused)), char **argv __attribute((unused)), void *data __attribute((unused))) { char version[80]; @@ -2385,6 +2425,7 @@ {"mknodes", "[<device>]", 0, 1, _mknodes}, {"udevcomplete", "<cookie>", 1, 1, _udevcomplete}, {"udevcomplete_all", "", 0, 0, _udevcomplete_all}, + {"udevcookies", "", 0, 0, _udevcookies}, {"targets", "", 0, 0, _targets}, {"version", "", 0, 0, _version}, {"setgeometry", "<device> <cyl> <head> <sect> <start>", 5, 5, _setgeometry},
next reply other threads:[~2009-08-06 15:05 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2009-08-06 15:05 prajnoha [this message] -- strict thread matches above, loose matches on Subject: below -- 2012-03-01 21:50 zkabelac 2012-02-15 14:27 zkabelac 2012-02-15 14:21 prajnoha 2012-01-20 10:58 zkabelac 2011-12-01 14:57 agk 2011-03-29 21:56 zkabelac 2010-12-20 14:36 zkabelac 2010-11-30 22:53 zkabelac 2010-10-25 13:36 zkabelac 2010-07-08 13:31 zkabelac 2010-07-05 22:56 agk 2009-12-11 13:04 zkabelac 2009-08-06 15:56 prajnoha 2008-10-31 18:53 agk
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20090806150511.30932.qmail@sourceware.org \ --to=prajnoha@sourceware.org \ --cc=lvm-devel@redhat.com \ --cc=lvm2-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).