Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 May 1999 11:01:46 -0400 (EDT)
From:      Zhihui Zhang <zzhang@cs.binghamton.edu>
To:        freebsd-hackers@freebsd.org
Subject:   open a file for read and write
Message-ID:  <Pine.GSO.3.96.990521110117.12277A-100000@sol.cs.binghamton.edu>

next in thread | raw e-mail | index | archive | help

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.3.96.990521110117.12277A-100000>