Date: Wed, 08 Aug 2007 12:38:37 -0400 From: "Constantine A. Murenin" <cnst@FreeBSD.org> To: Jesper Brix Rosenkilde <jbr@FreeBSD.org> Cc: Perforce Change Reviews <perforce@FreeBSD.org>, "Constantine A. Murenin" <cnst@FreeBSD.org> Subject: Re: PERFORCE change 124900 for review Message-ID: <46B9F18D.8080801@FreeBSD.org> In-Reply-To: <200708081419.l78EJWQM070706@repoman.freebsd.org> References: <200708081419.l78EJWQM070706@repoman.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 08/08/2007 10:19, Jesper Brix Rosenkilde wrote: > http://perforce.freebsd.org/chv.cgi?CH=124900 > > Change 124900 by jbr@jbr_bob on 2007/08/08 14:19:22 > > readded sysctl > > Affected files ... > > .. //depot/projects/soc2007/jbr-syscall/src/sys/kern/kern_exec.c#7 edit > .. //depot/projects/soc2007/jbr-syscall/src/sys/sys/sysctl.h#2 edit > > Differences ... > > ==== //depot/projects/soc2007/jbr-syscall/src/sys/kern/kern_exec.c#7 (text+ko) ==== > > @@ -86,6 +86,7 @@ > > static int sysctl_kern_ps_strings(SYSCTL_HANDLER_ARGS); > static int sysctl_kern_usrstack(SYSCTL_HANDLER_ARGS); > +static int sysctl_kern_usrsysshm(SYSCTL_HANDLER_ARGS); > static int sysctl_kern_stackprot(SYSCTL_HANDLER_ARGS); > static int do_execve(struct thread *td, struct image_args *args, > struct mac *mac_p); > @@ -99,6 +100,9 @@ > SYSCTL_PROC(_kern, KERN_USRSTACK, usrstack, CTLTYPE_ULONG|CTLFLAG_RD, > NULL, 0, sysctl_kern_usrstack, "LU", ""); > > +SYSCTL_PROC(_kern, KERN_USRSYSSHM, usrsysshm, CTLTYPE_ULONG|CTLFLAG_RD, > + NULL, 0, sysctl_kern_usrsysshm, "LU", ""); > + > SYSCTL_PROC(_kern, OID_AUTO, stackprot, CTLTYPE_INT|CTLFLAG_RD, > NULL, 0, sysctl_kern_stackprot, "I", ""); > > @@ -145,6 +149,25 @@ > } > > static int > +sysctl_kern_usrsysshm(SYSCTL_HANDLER_ARGS) > +{ > + struct proc *p; > + int error; > + > + p = curproc; > +#ifdef SCTL_MASK32 > + if (req->flags & SCTL_MASK32) { > + unsigned int val; > + val = (unsigned int)p->p_sysent->sv_sysshm; > + error = SYSCTL_OUT(req, &val, sizeof(val)); > + } else > +#endif > + error = SYSCTL_OUT(req, &p->p_sysent->sv_sysshm, > + sizeof(p->p_sysent->sv_sysshm)); > + return error; > +} > + > +static int > sysctl_kern_stackprot(SYSCTL_HANDLER_ARGS) > { > struct proc *p; > > ==== //depot/projects/soc2007/jbr-syscall/src/sys/sys/sysctl.h#2 (text+ko) ==== > > @@ -393,6 +393,7 @@ > #define KERN_HOSTUUID 36 /* string: host UUID identifier */ > #define KERN_ARND 37 /* int: from arc4rand() */ > #define KERN_MAXID 38 /* number of valid kern ids */ > +#define KERN_USRSYSSHM 39 /* int: address of sysshm page */ This looks wrong. First, you use whitespaces instead of tabs. Second, KERN_USRSYSSHM should be put before KERN_MAXID, and KERN_MAXID value increased by one. Or, alternatively, a good choice might be to use OID_AUTO. :) > #define CTL_KERN_NAMES { \ > { 0, 0 }, \ > @@ -431,6 +432,7 @@ > { "logsigexit", CTLTYPE_INT }, \ > { "iov_max", CTLTYPE_INT }, \ > { "hostuuid", CTLTYPE_STRING }, \ > + { "usrsysshm", CTLTYPE_INT }, \ > } This is adding more stuff to the things that seem to be no longer supported in FreeBSD and are in fact already broken -- the index in this array is supposed to correspond to the above KERN_ defines, and the whole array is supposed to be of size KERN_MAXID. Although this array in no longer used by any programmes in FreeBSD's src tree, if you actually try to compile and run older sysctl(8) with it, you're screwed. Looking more at sysctl.h, it looks like CTL_KERN_NAMES is not the only place where these problems are present. Sigh. C.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?46B9F18D.8080801>