Unsubscribe
Unsubscribe
- Subject: Unsubscribe
- From: "Don Witt" <email@hidden>
- Date: Mon, 6 Apr 2009 12:06:08 -0700
- Organization: Cylogistics
-----Original Message-----
From: darwin-dev-bounces+witt=email@hidden
[mailto:darwin-dev-bounces+witt=email@hidden] On Behalf
Of email@hidden
Sent: Monday, April 06, 2009 12:04 PM
To: email@hidden
Subject: Darwin-dev Digest, Vol 6, Issue 84
Send Darwin-dev mailing list submissions to
email@hidden
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.apple.com/mailman/listinfo/darwin-dev
or, via email, send a message with subject or body 'help' to
email@hidden
You can reach the person managing the list at
email@hidden
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Darwin-dev digest..."
Today's Topics:
1. Re: Run daemon from installer as root (Iceberg-Dev)
2. Re: Run daemon from installer as root (Rakesh Singhal)
3. Re: Are kqueue events "round robin"? (P?hl Melin)
4. Re: Run daemon from installer as root (Rakesh Singhal)
5. Double Fault Causes? (Duane Murphy)
----------------------------------------------------------------------
Message: 1
Date: Mon, 6 Apr 2009 00:54:41 +0200
From: Iceberg-Dev <email@hidden>
Subject: Re: Run daemon from installer as root
To: Darwin Dev <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
On Apr 5, 2009, at 5:27 PM, Duane Murphy wrote:
> --- At Sun, 5 Apr 2009 20:03:42 +0530, Rakesh Singhal wrote:
>
>> Hi all,
>>
>> I have created an installer for my daemon application. I want my
>> daemon
>> to run as root after installation. Before installation I used to run
>> daemon using "sudo launchctl load /Library/LaunchDaemons/
>> com.mycompany.mydaemon.plist". In installer I tried using run
>> command or
>> run script but it works only in 10.4.11 ppc but not with 10.5.4
>> intel. I
>> want to set some file permissions/ownerships also but it doesnt work.
>> Installer can be run only from admin users. Is there anyway to run
>> daemon as root using command or script?
>
> This is not a limitation of the installer. This is a limitation of the
> sh (and perl). Well, not really a limitation, it's a security feature.
> Some script interpreters will refuse to run a script as root as a
> security precaution. I don't recall the exact details about when this
> choice is made or how to overcome it.
>
> My choice for overcoming the problem was to choose a different
> interpreter (python). I suppose it's just a matter of time before that
> door is closed also.
>
> I'd like to know what the alternatives are so that scripts within an
> installer can be run with Administrator/root privileges.
Just in case, a simple solution is probably to:
1) Be sure that the installer requires an admon/root authentication.
2) Use sudo to call launchctl even from the shell script.
------------------------------
Message: 2
Date: Mon, 6 Apr 2009 12:25:51 +0530
From: Rakesh Singhal <email@hidden>
Subject: Re: Run daemon from installer as root
To: email@hidden, email@hidden
Message-ID:
<email@hidden>
Content-Type: text/plain; charset="iso-8859-1"
Hi Duane,
I am using InstallAnyWhere to create installer. I am trying using excuting
commands or script but I am not able to do it. But I think, I will have to
use "sudo launchctl load
/Library/LaunchDaemons/com.mycompany.mydaemon.plist" to load my daemon and
run it. Is it possible that when installer execute this command or script,
it can pop-up for authentication?
Please advice me.
Regards
Date: Sun, 5 Apr 2009 08:27:48 -0700
From: "Duane Murphy" <email@hidden>
Subject: Re: Run daemon from installer as root
To: "Darwin Dev" <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=ISO-8859-1
--- At Sun, 5 Apr 2009 20:03:42 +0530, Rakesh Singhal wrote:
>Hi all,
>
>I have created an installer for my daemon application. I want my daemon
>to run as root after installation. Before installation I used to run
>daemon using "sudo launchctl load /Library/LaunchDaemons/
>com.mycompany.mydaemon.plist". In installer I tried using run command or
>run script but it works only in 10.4.11 ppc but not with 10.5.4 intel. I
>want to set some file permissions/ownerships also but it doesnt work.
>Installer can be run only from admin users. Is there anyway to run
>daemon as root using command or script?
This is not a limitation of the installer. This is a limitation of the
sh (and perl). Well, not really a limitation, it's a security feature.
Some script interpreters will refuse to run a script as root as a
security precaution. I don't recall the exact details about when this
choice is made or how to overcome it.
My choice for overcoming the problem was to choose a different
interpreter (python). I suppose it's just a matter of time before that
door is closed also.
I'd like to know what the alternatives are so that scripts within an
installer can be run with Administrator/root privileges.
...Duane
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://lists.apple.com/mailman/private/darwin-dev/attachments/20090406/71cff
d93/attachment.html
------------------------------
Message: 3
Date: Mon, 6 Apr 2009 13:12:42 +0200
From: P?hl Melin <email@hidden>
Subject: Re: Are kqueue events "round robin"?
To: email@hidden
Message-ID:
<email@hidden>
Content-Type: text/plain; charset=ISO-8859-1
2009/4/2 A.M. <email@hidden>:
> On Apr 2, 2009, at 11:07 AM, Pehl Melin wrote:
>> Hi all,
>>
>> I have a question regarding the order events are returned from a
>> kevent() call on a kqueue, if I only supply one event in the event
>> list and no events are changed? Is there a predefined order in which
>> the filters are processed and returned as events when there are
>> multiple events available at the same time?
>>
>> For example if I have two filters, one EVFILT_READ filter and one
>> EVFILT_WRITE filter and there is available room in both the read and
>> the write buffers. If I make four subsequent calls, in what order will
>> the events be returned? Will I get EVFILT_READ, EVFILT_WRITE,
>> EVFILT_READ, EVFILT_WRITE? Or will I e.g. get one of the events
>> repeatedly until that buffer is empty/full, like EVFILT_READ until I
>> have read everything in the read buffer? Or is random or some other
>> algorithm?
>>
>> What I want to do is to alternate between read and write events to get
>> good responsiveness. I suppose I could change the events in the kqueue
>> but it would be easier to rely on some guaranteed behavior.
>
> The order you receive is the order that the kernel put the events in the
> queue- that is, after all, what makes it a k*queue*. If this is socket
> communications, you will get spammed with EVFILT_WRITE events as long as
the
> socket buffer is full; however, this does not imply that you will get no
> read events in between. But you should selectively enable and disable
> EVFILT_WRITE events based on whether or not you actually have stuffed the
> socket buffer (when the non-blocking socket I/O returns fewer bytes than
> what you passed in).
I'm writing a messaging framework that sends asynchronous messages
between processes on a local machine using Unix Domain Sockets and
between machines using normal TCP/IP sockets. My idea was to use a
design where I keep an open socket between two nodes and have one
"service" thread handling the communication on the socket using a
kqueue and looping around a kevent() call. When there are outgoing
commands present, the thread enables the EVFILT_WRITE filter and waits
for available space in the write buffer. When all commands are written
to the socket, the EVFILT_WRITE filter is disabled.
At the same time I also would have a EVFILT_READ enabled, receiving
incoming replies for the commands and also asynchronous incoming
messages. In a very simplified form without error checking, my loop
would look like this:
for (;;) {
numberOfEvents = kevent(kq, NULL, 0, &event, 1, NUL);
if (event.filter == EVFILT_READ) {
// handle read events
}
else if (event.filter == EVFILT_WRITE) {
// handle write events
}
}
In the read and write event handling I would read or write a few bytes
for the current command and I would then continue the loop waiting in
the kevent() statement again. When I have multiple commands and
replies I assume that the kevent() would return immediately with the
data member containing the remaining bytes to be read (or space left
in the write buffer).
I would expect the kqueue not to be filled up with EVFILT_READ and
EVFILT_WRITE events, but to have only one of each whenever the buffers
are "ready". But the question is if I'm guaranteed to have alternating
read and write events? Or if I get starvation of any kind? I don't see
anything about this matter in the man pages so I'm curious if it's
specified at all?
> I haven't experienced any event starvation situation, but in case you
have,
> the best approach would be to implement an array over kqueue. Simply read
> more than one event into your own queue and you can algortithmically
decide
> which events to process (and then remove them from the array- obviously
it's
> no longer a queue). But don't waste time implementing this approach unless
> you are indeed experiencing starvation.
Thanks, I hadn't really considered returning multiple events and make
my own decision. But it would of course be easier if a reasonable
decision was already made by the kevent() call.
> Since one thread can only do so much, if you have lots of socket or
sources,
> then you may want to break their processing into separate thread (kqueue
is
> thread-safe and works well across multiple threads). Even a single socket
> read and write events could be broken out across threads.
That's interesting. I what sense is kqueue thread safe? Can I wait on
the same kqueue in two different threads, each calling kevent() or do
I make two kqueue:s, one with a read filter and the other queue with a
write event on the same socket descriptor?
> Cheers,
> M
------------------------------
Message: 4
Date: Mon, 6 Apr 2009 20:46:08 +0530
From: Rakesh Singhal <email@hidden>
Subject: Re: Run daemon from installer as root
To: email@hidden, Duane Murphy <email@hidden>
Message-ID:
<email@hidden>
Content-Type: text/plain; charset="iso-8859-1"
Installer asks for admin/root rights in starting and user enters the
password of admin account. If I use sudo then also it doesnt work. As I
wrote, if I use sudo it does work only in 10.4.11 ppc but not in 10.5.4
intel.
Regards
--- At Sun, 5 Apr 2009 20:03:42 +0530, Rakesh Singhal wrote:
Hi all,
I have created an installer for my daemon application. I want my daemon
to run as root after installation. Before installation I used to run
daemon using "sudo launchctl load /Library/LaunchDaemons/
com.mycompany.mydaemon.plist". In installer I tried using run command or
run script but it works only in 10.4.11 ppc but not with 10.5.4 intel. I
want to set some file permissions/ownerships also but it doesnt work.
Installer can be run only from admin users. Is there anyway to run
daemon as root using command or script?
This is not a limitation of the installer. This is a limitation of the
sh (and perl). Well, not really a limitation, it's a security feature.
Some script interpreters will refuse to run a script as root as a
security precaution. I don't recall the exact details about when this
choice is made or how to overcome it.
My choice for overcoming the problem was to choose a different
interpreter (python). I suppose it's just a matter of time before that
door is closed also.
I'd like to know what the alternatives are so that scripts within an
installer can be run with Administrator/root privileges.
Just in case, a simple solution is probably to:
1) Be sure that the installer requires an admon/root authentication.
2) Use sudo to call launchctl even from the shell script.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://lists.apple.com/mailman/private/darwin-dev/attachments/20090406/6dc2d
9b0/attachment.html
------------------------------
Message: 5
Date: Mon, 6 Apr 2009 11:38:50 -0700
From: "Duane Murphy" <email@hidden>
Subject: Double Fault Causes?
To: "Darwin Dev" <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=ISO-8859-1
I'm getting a double fault in a disk driver that I am building. I'm
working on more detailed debugging.
>From a bit of archive reading, it appears that a double fault is
classically a stack overflow. However, the stack that the double fault
is reported on is clearly not overflowed. The resulting back trace is
actually very reasonable.
What other problems should I be looking for in determining the cause of
the double fault?
A few more details. This only happens at boot time and is 100%
reproducible at the same location every time.
...Duane
ps
Sorry, I can't post the actual back trace due to license restrictions
(please draw your own conclusions. :-)
------------------------------
_______________________________________________
Darwin-dev mailing list
email@hidden
http://lists.apple.com/mailman/listinfo/darwin-dev
End of Darwin-dev Digest, Vol 6, Issue 84
*****************************************
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden