From owner-freebsd-hackers Sat Oct 16 23:34:16 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from celery.dragondata.com (celery.dragondata.com [205.253.12.6]) by hub.freebsd.org (Postfix) with ESMTP id 06B0514F21 for ; Sat, 16 Oct 1999 23:34:14 -0700 (PDT) (envelope-from toasty@celery.dragondata.com) Received: (from root@localhost) by celery.dragondata.com (8.9.3/8.9.3) id BAA10112; Sun, 17 Oct 1999 01:35:42 -0500 (CDT) (envelope-from toasty) From: Kevin Day Message-Id: <199910170635.BAA10112@celery.dragondata.com> Subject: Re: Handling segV's To: wes@softweyr.com (Wes Peters) Date: Sun, 17 Oct 1999 01:35:42 -0500 (CDT) Cc: toasty@dragondata.com (Kevin Day), newton@internode.com.au (Mark Newton), gupz@hotmail.com (Dodge Ram), freebsd-hackers@FreeBSD.ORG In-Reply-To: <38096D39.794E9EC0@softweyr.com> from "Wes Peters" at Oct 17, 1999 12:31:21 AM X-Mailer: ELM [version 2.5 PL1] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > > > I mmap() files in, then copy them to a device. This works great except when > > > > someone tries to change that file during the copy. If the size of the file > > > > shrinks, I'll SIGBUS or SIGSEGV when i try to touch past the new file size. > > > > So, i setup a signal handler and longjmp into some recovery code. > > > > > > > > Perhaps there's a better way, but I don't consider this a bug really, and > > > > i'll get a SEGV. :) > > > > > > MAP_PRIVATE? > > > > > > > This has the undesired effect of me not noticing that the file changed then. > > stat(2) it after the copy? OK, I'm reaching. Handling SEGV seems like a > rather iffy solution at best. In my case, it's a very very very rare thing that the file's been changed out from under me, and I'm doing several thousand copies per second, so doing a stat() on each copy makes things very slow. I know it's a crappy solution, but it's the only one that works. :) Also, consider that *during* the copy, the file could be changed. Kevin To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message