* Dima Dorfman <[EMAIL PROTECTED]> [010518 01:05] wrote:
> Hi folks,
>
> ipcs(1) is currently installed as setgid kmem. This isn't good for
> obvious reasons. Moreover, the information it needs is easily
> exported via sysctl. Below is a patch which adds the necessary sysctl
> oids and changes ipcs(1) to use them. I had to export msgids,
> msginfo, sema, seminfo, shmsegs, and shminfo. The *info variables
> were exported via SYSCTL_STRUCT, and the rest via SYSCTL_PROC. All
> read-only by anyone. I'm not particuarly sure it's appropriate to
> export the *info variables like that--at least one of them has most
> (all?) of its members already exported via SYSCTL_INT, but that would
> be a pain to use in this case. The patch preserves ipcs(1)'s ability
> to operate on a saved kernel and core. In addition, I also added a -y
> command line flag that will cause it to use kvm(3) instead of
> sysctl(3), even on a running system.
>
> Comments? Particuarly, I'd like comments on whether I exported
> everything correctly.
Probably not the commentary you're looking for, however the
getopt parsing shouldn't be done like this:
> - while ((i = getopt(argc, argv, "MmQqSsabC:cN:optT")) != -1)
> + use_sysctl = 1;
> + while ((i = getopt(argc, argv, "MmQqSsabC:cN:optTy")) != -1)
> switch (i) {
> case 'M':
> display = SHMTOTAL;
> @@ -184,39 +187,45 @@
> case 't':
> option |= TIME;
> break;
> + case 'y':
> + use_sysctl = !use_sysctl;
> + break;
> default:
> usage();
> }
Multiple -y options will invert the sense of the flag right?
Might as well inialize it to 1 in the DATA segment and replace
!use_sysctl with just 0.
I'm glad you kept kmem backwards compatibility, as this is required
for post mortem analysis of crashdumps.
--
-Alfred Perlstein [[EMAIL PROTECTED]]
Instead of asking why a piece of software is using "1970s technology,"
start asking why software is ignoring 30 years of accumulated wisdom.
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message