Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

No debug output to CUPS log after filter gets a SIGTERM?



I'm trying to debug the cleanup section of my filter when it get a SIGTERM (e.g. canceling the job from the printer proxy) and I've found that I get a SIGPIPE on the next fprintf to stderr and none of my debug output after that makes it to the cups log.

I've implemented the following code for signal handling:

	struct sigaction action;
	memset(&action, 0, sizeof(action));
	sigemptyset(&action.sa_mask);
	action.sa_sigaction = signalHandler;
	action.sa_flags |= SA_SIGINFO | SA_RESTART;
	if (sigaction(SIGTERM, &action, NULL) < 0)
		perror("DEBUG: Failed to set SIGTERM handler");

	memset(&action, 0, sizeof(action));
	sigemptyset(&action.sa_mask);
	action.sa_sigaction = signalHandler;
	action.sa_flags |= SA_SIGINFO | SA_RESTART;
	if (sigaction(SIGPIPE, &action, NULL) < 0)
		perror("DEBUG: Failed to set SIGPIPE handler");

And my signal handler looks like:

static void signalHandler(int signalNo, struct __siginfo *info, void *foo)
{
if (signalNo == SIGTERM)
gSigTerm = YES;
else if (signalNo == SIGPIPE)
gSigPipe = YES;
}


With that I no longer get the SIGPIPE alert in gdb, but I still don't get my debug data either.

Is this normal for Tiger? I wasn't that way in Panther as far as I can remember. Or did I botch my signal handling somehow?

Thanks,
Dave

---
The path of least resistance, it's not just for electricity any more.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Printing mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/printing/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.