[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: What is needed to run a tool like a daemon?
From: |
Richard Frith-Macdonald |
Subject: |
Re: What is needed to run a tool like a daemon? |
Date: |
Thu, 3 Dec 2009 07:36:43 +0000 |
On 3 Dec 2009, at 06:35, Germán Arias wrote:
> As you know I'm working on GSTaskBar. Until now I run GSTB from a
> terminal. But when I try start this tool in my .profile file (where I
> start gbps and gdnc) I can not start my session. The error occurs
> because GSTB can't register with the name GSTaskBar.
I know of three reasons for failure to register a name:
1. the name is already registered to another connection.
2. the temporary files used for name registration have had their ownership or
access permissions changed so that your process can't access them.
3. the app is using inter-host connections, and the nameserver (gdomap) is not
running and can't be auto-started for some reason (eg access permissions).
4. the app is using inter-host connections, and gdomap has the name registered
to another process (A) which died without unregistering, and another process
(B) is running which happens to have the same process ID that A had (in this
case gdomap can't tell that the name is no longer in use by A, because it will
check the running process IDs and think that A is still running because it sees
a process with the ID its expecting).
I guess 3 and 4 should not be the case (your code sample shows you have not
chosen to use inter-host connections). Reason 2 would seem almost impossible
to happen without you knowing you had reprotected the files.
> I need to delete
> the file /tmp/.X0-lock and type: startx. This start my session. After
> this, the process GSTB is running and work fine. Then, why I get this
> error?
That sounds like you have some X issue, then ... nothing to do with registering
the name.
> Basically I have something like
>
> NSAutoreleasePool *pool;
> GSTaskBar *gsbar;
> NSConnection *conn;
>
> pool = [NSAutoreleasePool new];
> gsbar = [GSTaskBar new];
> conn = [NSConnection defaultConnection];
> [conn setRootObject: gsbar];
>
> if (![conn registerName: @"GSTaskBar"])
> {
> NSLog (@"Could not register us as GSTaskBar");
> exit (1);
> }
You can run with -GNU-Debug=NSMessagePort to get some debug output about
registering the name for the port.
If that's not helpful,probably you should try adding a load of NSLog statements
to your code (and in the libraries) to try to see what's going on.