I am writing a process that has a parent running as a daemon process
that has to spawn an appropriate child to parse whatever the parent has
in one of several formats (hence the variety of child parsers)

I am getting occasional SIGPIPE errors (and the boring bit is that I
have put in code that I think _should_prevent the SIGPIPE occurring

any comments or guidance welcome ...


parent pseudo code

main()
{
        daemon

        while(1)
        {
                get test data

                pipe()

                fork()
                in Parent
                        read(child->parent pipe) until \n
                        log string to logfile
                        write(parent->child pipe) real data to child for
processing
                        close(parent->child pipe)
        
                        read(child->parent pipe) until EOF for result
        
                        waitpid(child)
                        get return code

                in Child
                        set stdin nonblocking so child will inherit
                        execve the correct parser
        }
}

child pseudo code

main()
{
        read cmdline params

        write(child->parent pipe) my PID

        read(parent->child pipe) intil EOF
        process through flex/bison parser
        write(child->parent pipe) the result
        return (code)
}

I am catching SIPPIPE in the parent and logging it, and have a 
test on the parent write for EPIPE and am doing a go-around twice loop
through
the write before giving up.



Murray Taylor
Bytecraft Systems
Special Projects Engineer

P: +61 3 8710 0600
D: +61 3 9238 4275
F: +61 3 9238 4140

--
 |_|0|_|        "Absence of evidence
 |_|_|0|        is not evidence of absence"
 |0|0|0|        Carl Sagan
---------------------------------------------------------------
The information transmitted in this e-mail is for the exclusive
use of the intended addressee and may contain confidential
and/or privileged material. Any review, re-transmission,
dissemination or other use of it, or the taking of any action
in reliance upon this information by persons and/or entities
other than the intended recipient is prohibited. If you
received this in error, please inform the sender and/or
addressee immediately and delete the material. 

E-mails may not be secure, may contain computer viruses and
may be corrupted in transmission. Please carefully check this
e-mail (and any attachment) accordingly. No warranties are
given and no liability is accepted for any loss or damage
caused by such matters.
---------------------------------------------------------------

### This e-mail message has been scanned for Viruses by Bytecraft ###
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

Reply via email to