Ok... at my company we have a legacy system that runs on solaris. It is 99 percent Perl except for a C app called mtimestamp which basically is a log daemon.

The system used a pipe and SysV streams to have one point of entry but keep track of which process sent the message in (my knowledge of this is minimal, please forgive me if I am not explaining it exactly right).

Our people have been having issues getting sysV streams to work on Linux, and really we figure there is probably a better solution.

What happens is this... the C daemon is started with some information about the application it is logging (a process manager). When jobs are started, they fork off and maintain the pipe, sending ininitialization info about who they are, which the logger stores. Somehow sysV streams can distinguish between which process is sending over the pipe, even though it is all just forked versions of the same copy. From that point on, anything from that subprocess' STDOUT and STDERR (and programs run in backticks, etc) is redirected to the logger and in mtimestamp is prefixed with a timestamp and the identifier the initializer set.

I am exploring ways of implementing this all in perl without sysV streams so that we can port it to Linux easier and to bring the codebase into line with the rest of the project.

So far I verified that UDP sockets would work alright, and of course TCP could be used... new sockets just have to be created at initialization, no big deal.

One thing I had tried was UDP over UNIX sockets, but I couldn't figure out a way to distinguish senders. The peerpath blows up IO::Socket::UNIX in this case...

Does anyone know if sender can be distinguished somehow in UDP UNIX domain sockets?

Does anyone have any other suggestions? Keep in mind that programs run in backticks and system calls also have to be redirected with on the same pipe.

                - Ant
                - Some of my best work - (1 2 3)


In reply to Porting a system 5 streams app to linux by suaveant

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.