From owner-freebsd-hackers Fri May 21 8:12:56 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from sol (cs1-gw.cs.binghamton.edu [128.226.171.72]) by hub.freebsd.org (Postfix) with SMTP id 354CF14D4B for ; Fri, 21 May 1999 08:12:49 -0700 (PDT) (envelope-from zzhang@cs.binghamton.edu) Received: from localhost (zzhang@localhost) by sol (SMI-8.6/8.6.9) with SMTP id LAA12279 for ; Fri, 21 May 1999 11:01:46 -0400 Date: Fri, 21 May 1999 11:01:46 -0400 (EDT) From: Zhihui Zhang To: freebsd-hackers@freebsd.org Subject: open a file for read and write Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG If I want to read and write a file, I can do it in two ways: (1) Open the file as read and write, using one file descriptor. (2) Open the file as read only and open it again as write only, using a total of two file descriptors. Method (2) is more clear in logic and uses a little more resource (file descriptors). Other than these, are there any performance reasons for doing so? Method (2) is used in source code file mkfs.c when we open a special device file to create a file system. Thanks for any help. -Zhihui -------------------------------------------------- Zhihui Zhang. Please visit http://www.freebsd.org -------------------------------------------------- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message