Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Sep 1998 15:59:39 -0700
From:      Don Lewis <Don.Lewis@tsc.tdk.com>
To:        Don Lewis <Don.Lewis@tsc.tdk.com>, Graham Wheeler <gram@cdsec.com>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: The inetd realloc problem: an observation
Message-ID:  <199809222259.PAA19262@salsa.gv.tsc.tdk.com>
In-Reply-To: Don Lewis <Don.Lewis@tsc.tdk.com> "Re: The inetd realloc problem: an observation" (Sep 22,  6:32am)

next in thread | previous in thread | raw e-mail | index | archive | help
On Sep 22,  6:32am, Don Lewis wrote:
} Subject: Re: The inetd realloc problem: an observation
} On Sep 22,  3:27pm, Graham Wheeler wrote:
} } Subject: Re: The inetd realloc problem: an observation
} 
} } I've just changed the source so that all three signal handlers just set
} } flags, and the flags are tested at the start of the main processing loop
} } and the old handlers called if necessary. It will be interesting to see
} } if this improves things.
} 
} You'll probably want to set a reasonable timeout on select() so that you
} don't wait forever if a signal happens when you're not in select() and
} no inputs arrive to activate select.  Also, if select() returns -1,
} the code should examine the flags before returning to the top of the loop.

I thought of a more elegant way of handling the timeout problem.  Before
starting the select loop, create a pipe.  Add the fd of the read end of the
pipe to the list of descriptors passed to select.  In each of the signal
handlers, write a single character to the pipe in addition to setting the
flag.  When select indicates that the pipe has data to read, block
the signals that have handlers, read a character from the pipe, test
and clear each of the flags, execute the appropriate code for each flag,
and unblock signals.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199809222259.PAA19262>