[linux-audio-dev] Daemon mode

Lars Luthman lars.luthman at gmail.com
Sat Dec 16 14:00:14 UTC 2006


On Sat, 2006-12-16 at 20:48 +0700, Patrick Shirkey wrote:
> Thanks for the pointer Lars.
> 
> However I'm using c so this code doesn't work. I have modified it like so:
> 
> 		    int run = TRUE;
> 
> 		    while (run)
> 			   sleep(10000);
> 		
> but that just gives a segv. It runs for about a second then gives up.
> 
> I'm also looking at the code for jackd and have spotted this function:
> 
> 		sigwait (&signals, &sig);
> 			
> 
> so I added some new bits and pieces like so:
> 
> static sigset_t signals;
> 
> int main(int argc, char *argv[])
> {
> 
>      int run;
>      int sig;
>      sigset_t allsignals;
> 	
> 	sigemptyset (&signals);
> 	sigaddset(&signals, SIGHUP);
> 	sigaddset(&signals, SIGINT);
> 	sigaddset(&signals, SIGQUIT);
> 	sigaddset(&signals, SIGPIPE);
> 	sigaddset(&signals, SIGTERM);
> 	sigfillset (&allsignals);
> 
> 
> 	process_init();
> 
> 	run = TRUE;
> 
> 	while (run)
> 		sigwait (&signals, &sig);
> 
> 	return 0;
> 
> }
> 
> 			
> but that also returns segv at sigwait(). If I put a printf after sigwait 
> it doesn't print. Before is ok.

That code compiles and runs fine here (after adding #include <signal.h>
and commenting out process_init()). The problem is probably somewhere
else in your code. I'd try running it in valgrind to spot any memory
bugs (with JACK in softmode and using the dummy driver).

-- 
Lars Luthman - please encrypt any email sent to me if possible
PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x04C77E2E
Fingerprint: FCA7 C790 19B9 322D EB7A E1B3 4371 4650 04C7 7E2E
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.linuxaudio.org/pipermail/linux-audio-dev/attachments/20061216/b23f2738/attachment.pgp>


More information about the Linux-audio-dev mailing list