On Thu, Jan 11, 2001 at 03:46:55PM +0000, David L. Nicol wrote:
> 
> what if /var/qmail/control/smtproutes was replaced with a fifo that
> gave a different relay every time it was read?
> 
> 
> #!/usr/local/bin/perl
> while(++$count){
>     unlink '/var/qmail/control/smtproutes';
>     system 'mkfifo /var/qmail/control/smtproutes';
>     $c=$count % 5;    # or however many there are
>     open R,">/var/qmail/control/smtproutes"; #block until it is read
>     print R ":bsdrelay$c.macrosys.com\n";
> };
> __END__
> 
> 
> Will the above cause unexpected freezes?

Perhaps not, but unexpected results:

1. Nothing stops a pipe being opened by multiple readers at once. What
will the second and subsequent reader get? Almost certainly eof with
no data.

2. You have a timing window between the mkfifo and the unlink where a
qmail-remote instance will find no smtproutes file.

Doesn't plan9 have something that does this properly, where you open a
file system object and each open gets a matching process on the other
side?


Regards.

Reply via email to