From owner-freebsd-hackers Fri Aug 18 13:45:28 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from viper.dmpriest.com (viper.dmpriest.com [195.188.177.3]) by hub.freebsd.org (Postfix) with ESMTP id 67B1D37B423 for ; Fri, 18 Aug 2000 13:45:25 -0700 (PDT) Received: from tdx.co.uk (lorca.tdx.co.uk [195.188.177.195]) by viper.dmpriest.com (8.9.3/8.9.3/Kp) with ESMTP id VAA16803; Fri, 18 Aug 2000 21:45:14 +0100 (BST) Message-ID: <399DA05A.633A7179@tdx.co.uk> Date: Fri, 18 Aug 2000 21:45:14 +0100 From: Karl Pielorz Organization: The Digital eXchange X-Mailer: Mozilla 4.73 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 To: Mikko Tyolajarvi Cc: freebsd-hackers@freebsd.org Subject: Re: Critical (or equivalent) section in Userland? References: <399C5201.5B6911CE@tdx.co.uk> <200008181931.MAA10908@explorer.rsa.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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