Re: sysctl
Re: sysctl
- Subject: Re: sysctl
- From: Quinn <email@hidden>
- Date: Wed, 24 Nov 2004 15:34:58 +0000
At 16:28 -0700 8/11/04, Matt Jaffa wrote:
I thought that setting the flag to CTLFLAG_ANYBODY would allow
anyone to be able to set this structure no matter if it is a root
app or regular user app.
You'd think so, wouldn't you? Alas, it doesn't work, for reasons
I'll explain below.
Is it because I am branching off of _kern that it will only allow a
root app to set my structure.
This is the problem. The implementation of sysctl (__sysctl in
"xnu/bsd/kern/kern_sysctl.c") has a special-case test for non-super
user attempts to set variables in "kern", "hw", "vm", and "vfs", and
bounces them with an EPERM error. *sigh*
This special case doesn't apply if you hang off other roots. When I
changed my test to attached to "net", everything worked fine.
I'd be tempted to call this a bug, but I'm not 100% certain because
the implementation of sysctl is /way/ complex and there may be side
effects that I don't understand. Nevertheless, I'd appreciate it if
you could file a bug report, to give kernel engineering the
opportunity to make the final decision.
<http://developer.apple.com/bugreporter/>
Please email me the bug number so that I can keep an eye on it.
And if is this way, must I branch off of something else like _user
to allow me to modify it with a non-root app. I have tried
to tie my structure to the _user branch, but it doesn't register it
with _user so that when I do sysctlbyname it returns ENOENT = 2.
"user" is designed for variables that are implemented entirely within
user space. The System framework implementation of sysctl captures
"user" requests and implements them internally; it never passes them
to the kernel.
S+E
--
Quinn "The Eskimo!" <http://www.apple.com/developer/>
Apple Developer Technical Support * Networking, Communications, Hardware
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >sysctl (From: Matt Jaffa <email@hidden>) |