Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Aug 2000 21:45:14 +0100
From:      Karl Pielorz <kpielorz@tdx.co.uk>
To:        Mikko Tyolajarvi <mikko@dynas.se>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Critical (or equivalent) section in Userland?
Message-ID:  <399DA05A.633A7179@tdx.co.uk>
References:  <399C5201.5B6911CE@tdx.co.uk> <200008181931.MAA10908@explorer.rsa.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Mikko Tyolajarvi wrote:

> Warning, here be dragons...

But, they can be tamed! :)

> You could try replacing sendmail (using mailer.conf) with a script
> that sets LD_PRELOAD and then execs sendmail.  Then you have to write
> a little shared lib to wrap some system calls. If you are lucky,
> wrapping open() will be sufficient.  In your wrapper function, you
> should have the opportunity to use any of a number of mutual exclusion
> schemes, including advisory locking.

I have recently been doing a lot of work with LD_PRELOAD and wrapping
syscalls... (a strange co-incidence? :) - but, sending all the sendmail calls
a SIGSTOP seems to have done the trick...

> Of course, this still may not help much when sendmail has opened some
> of its files, and you then change all of them, which might lead to
> inconsistencies.

My original idea of 'mv'ing the files seems to cope admirably with this... If
sendmail open()'s one of the original files, it's FD is still valid _after_
the mv operations.

The question has never been 'pulling the rug' from under sendmail, it's more
been of keeping sendmail from talking to the rug, while I do the dirty...

SIGSTOP and SIGCONT seem to do the trick nicely... Yes, It's not ideal, but it
seems to work perfectly well (which maybe, makes it as ideal as you can get in
the real world... ? :)

-Kp


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?399DA05A.633A7179>