Click here to get back home

Looking for portable signal handling to implement Server Daemon

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Looking for portable signal handling to implement Server Daemon Joachim Schrod 07-29-2004
Posted by Joachim Schrod on July 29, 2004, 12:33 am
Please log in for more thread options
Hello,

I want to write a server daemon class, from the concept similar to
Net::Daemon -- i.e., a framework where the actual server inherits my
class and implements several methods like handle_data(), reconfig(),
terminate(), get_data(), etc. I cannot use Net::Daemon as I need that
for arbitrary data sources (e.g., named pipes), and not just for network
services. Proc::Daemon doesn't target this demand either.

For the implementation I need portable signal handling that interrupts
system calls, in particular I/O functions. E.g., I want read (or
sysread) to terminate on SIGTERM, setting $! to EINTR. (Termination of
the server shall not wait until the next data arrives. Similar arguments
exist for SIGHUP.)

Does there exist a CPAN module that provides such signal behavior in a
portable way? (I won't complain if somebody calls me dumb and points to
a ready made server daemon module, btw.) Is Sys::SigAction the way to
go? I have read the man page, but couldn't answer that question, and
decided to ask here before I write test scripts myself. ;-)

I've got some experience with POSIX sigaction() in C, btw; though it's
some years ago. But that experience doesn't seem to be enough -- I
couldn't create a quick script with POSIX::sigaction() within 15
minutes. :-( Therefore, if Sys::SigAction is not the way to go and if
there's no other CPAN module, where can I find usage examples of
POSIX::sigaction()?

Btw, I am aware that signal semantics changed in Perl 5.8.2. In the end,
I need to run appropriate code in 5.6.1, 5.8.0, 5.8.1, and 5.8.3.
Starting now, I would be glad for any code that I can reuse in whatever
Perl version...

Cheers,
        Joachim

--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Joachim Schrod                                Email: jschrod@acm.org
Roedermark, Germany


Similar ThreadsPosted
XML-RPC server using Frontier::Daemon keeps crashing August 25, 2004, 12:06 pm
Portable dot-files (hidden-files) ? November 5, 2007, 1:20 am
Net::Daemon::SSL January 18, 2006, 11:35 pm
Combining HTTP:Daemon and CGI May 27, 2006, 5:07 pm
LWP, timeouts and error handling September 5, 2004, 3:31 am
handling UTF-8 characters in LWP module August 31, 2006, 10:39 pm
Frontier::Daemon encoding question August 15, 2005, 10:40 am
HTTP::Daemon IPv6 support? March 16, 2006, 5:18 pm
ANNOUNCE: new module: Daemon::Generic October 26, 2006, 4:31 pm
New modules: Plugins, SyslogScan::Daemon::* January 2, 2007, 7:58 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap