Welcome to Soft32 Forums!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

signal call failing on 10.1?

 
   Soft32 Home -> Mac -> Programmer Help RSS
Next:  databrowser question  
Author Message
Heath Raftery

External


Since: Jul 10, 2003
Posts: 297



(Msg. 1) Posted: Mon Oct 13, 2003 7:14 pm
Post subject: signal call failing on 10.1?
Archived from groups: comp>sys>mac>programmer>help (more info?)

Argh! There is one thing stopping me from releasing the latest version
of my shareware: it doesn't work on 10.1.

I've narrowed it down to exactly this line:

signal(SIGCHLD, fireman);

The line before this one is executed, but the line after is not. The
application dies straightaway. The really funky (s/n/c/) thing is that
I've got another test application which looks like this:

int main(int argc, char* argv[])
{
printf("Hello\n");
signal(SIGCHLD, signalCatch);
daemon(0, 0);
switch(fork())
{
case 0:
syslog(LOG_INFO, "Child1");
exit(EXIT_SUCCESS);

default:
syslog(LOG_INFO, "Parent");
for(;Wink;
}
return 0;
}

void signalCatch(int para)
{
syslog(LOG_INFO, "Caught");
}

Which works exactly as you would expect on 10.1 and 10.2. The start of
my real application looks like this:

int main(int argc, char* argv[])
{
int clientSocket;
char *authStr;
JSFunction *compiledPAC;

if(argc != 7)
{
syslog(LOG_ERR, "Fatal Error: authoxyd needs 6 command line
parameters. Check there are no spaces in your settings.");
return 1;
}

syslog(LOG_ERR, "One.");
signal(SIGCHLD, fireman);
syslog(LOG_ERR, "Two.");
daemon(0, 0);
syslog(LOG_ERR, "Three.");

....

void fireman(int sig)
{
while (waitpid(-1, NULL, WNOHANG) > 0)
;
}

But "Two." is never written to the system log! I've tried changing the
order of statements, changing the signiture of the signal handler,
making sacrifices, and still no luck. Why on earth would one of these
programs work and the other not? My real program is started by a
preference pane with a system() call which passes various arguments, but
it doesn't appear to matter if I call it manually from the command line.

I don't have the developer tools installed on my 10.1 install, which may
or may not be relevant. I know it makes it very hard to debug!

Has anyone got the slightest of clues? I'm really unsure where to go
from here! The only thing I can think of that has changed between when
this did work is perhaps my library linking. My app now links to the
static libdl library (as well as libcurl and libjs) but I can't imagine
why this would matter. signal is part of the standard c library (libc)
which should be dynamically linked as normal, right?

--
Heath
________________________________________________________
| *Nothing is foolproof to a sufficiently talented fool* |
| _\|/_ |
|________________________________________m(. .)m_________|
Back to top
Login to vote
Eric Albert

External


Since: Jun 28, 2003
Posts: 201



(Msg. 2) Posted: Mon Oct 13, 2003 7:14 pm
Post subject: Re: signal call failing on 10.1? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <hraftery-456C36.00140014102003.RemoveThis@seagoon.newcastle.edu.au>,
Heath Raftery <hraftery.RemoveThis@myrealbox.com> wrote:

> Argh! There is one thing stopping me from releasing the latest version
> of my shareware: it doesn't work on 10.1.

I'm a bit surprised that you care about 10.1 support. Smile If someone
won't pay the money for either of two upgrades that'll greatly improve
their system (10.2 or 10.3), I can't imagine they'll be paying for much
shareware.

-Eric

--
Eric Albert ejalbert.RemoveThis@stanford.edu
http://rescomp.stanford.edu/~ejalbert/
Back to top
Login to vote
Heath Raftery

External


Since: Jul 10, 2003
Posts: 297



(Msg. 3) Posted: Mon Oct 13, 2003 7:42 pm
Post subject: Re: signal call failing on 10.1? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Miro Jurisic <macdev.TakeThisOut@meeroh.org> wrote:
>> I don't have the developer tools installed on my 10.1 install, which may
>> or may not be relevant. I know it makes it very hard to debug!

> Well, then, install them, and run the program under GDB. Set a breakpoint on
> exit(), and you will either die on a signal (in which case GDB will tell you
> which signal) or you will hit the exit() breakpoint.

Hate to be painful... but how do I set that breakpoint on exit()? Obviously,
exit() is not part of my source... Still, good hint. I guess I might have to
take the plunge. I was actually hoping to have a clean install of 10.1
precisely for testing purposes - not everyone has the developer tools
installed. I'll let you know what the signal is (don't suppose that is
possible to find without the Dev Tools?).

--
*--------------------------------------------------------*
| ^Nothing is foolproof to a sufficiently talented fool^ |
| Heath Raftery, HRSoftWorks _\|/_ |
*______________________________________m_('.')_m_________*
Back to top
Login to vote
Heath Raftery

External


Since: Jul 10, 2003
Posts: 297



(Msg. 4) Posted: Tue Oct 14, 2003 4:58 pm
Post subject: Re: signal call failing on 10.1? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <macdev-10FEE6.12570113102003.TakeThisOut@senator-bedfellow.mit.edu>,
Miro Jurisic <macdev.TakeThisOut@meeroh.org> wrote:
>
> Well, then, install them, and run the program under GDB. Set a breakpoint on
> exit(), and you will either die on a signal (in which case GDB will tell you
> which signal) or you will hit the exit() breakpoint.

After rather little thought, I realised of course, that I have gdb
installed on another harddrive, which is mounted while I'm in 10.1
anyway. It took a little chroot'ing, but I was able to run gdb without
installing the Dev Tools for 10.1. Nonetheless, I actually found the
reason for the exit with gdb. Here's what appeared at the Terminal when
I launched my application by hand, with the signal() call before the
daemon() call:

myApp undefined reference to ___fegetfltrounds expected to be defined in
/usr/lib/libSystem.B.dylib
myApp undefined reference to _getnameinfo expected to be defined in
/usr/lib/libSystem.B.dylib
myApp undefined reference to _gmtime_r expected to be defined in
/usr/lib/libSystem.B.dylib
myApp undefined reference to _localtime_r expected to be defined in
/usr/lib/libSystem.B.dylib
myApp undefined reference to _strlcat expected to be defined in
/usr/lib/libSystem.B.dylib

Well there it is. Somehow linking against a different libSystem in 10.2
is now causing problems in 10.1. I imagine (although am not certain)
that it has something to do with the way I am handling lib linking for
the curl library. Any ideas?

--
Heath
________________________________________________________
| *Nothing is foolproof to a sufficiently talented fool* |
| _\|/_ |
|________________________________________m(. .)m_________|
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Shared library / Mach-O: Application crashs if I call a fu.. - Hi, me again Meanwhile, I can load the shared library in my Mach-O Application and I found my function (BeepTwice) in ...

Shared library / Mach-O: Application crashs if I call a fu.. - Hi, me again Meanwhile, I can load the shared library in my Mach-O Application and I found my function (BeepTwice) in ...

function (not in object code) to call Cocoa object method ? - How to call an object method from a function not inside the object code ? By example how to get the width of the string...
       Soft32 Home -> Mac -> Programmer Help All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum

Categories:
 Windows
 Linux
  Mac
 PDA


[ Contact us | Terms of Service/Privacy Policy ]