help-rcs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

open with O_EXCL and O_TRUNC


From: Tom Brown
Subject: open with O_EXCL and O_TRUNC
Date: Mon, 23 Feb 2004 08:06:13 -0600
User-agent: Mutt/1.5.4i

on src/rcsedit.c:1426 of rcs version 5.7

#   define create(f) open(f, 
OPEN_O_BINARY|OPEN_O_LOCK|OPEN_O_WRONLY|O_CREAT|O_EXCL|O_TRUNC, 
OPEN_CREAT_READONLY) 

uses both the O_EXCL and O_TRUNC flags, which seem to describe mutally
exclusive behavior. The comments on lines 1382-1383 say this is atomic
according to Posix 1003.1-1990.

http://www.opengroup.org/onlinepubs/007904975/functions/open.html
does not say anything about the use of O_EXCL|O_TRUNC, except that any
combination of the flags are allowed.

What is the reason for O_EXCL|O_TRUNC instead of only O_EXCL? My only
guess would be truncating is used for locking on systems that don't
support O_EXCL, but I can't find the code to support that guess.

Tom


I bumped into this because the vfs driver (vmhgfs-only/driver.c) provided with 
VMWare build 5592 returns an error if O_CREAT|O_EXCL|O_TRUNC is set.

-- 
28 70 20 71 2C 65 29 61 9C B1 36 3D D4 69 CE 62 4A 22 8B 0E DC 3E
mailto:address@hidden
http://thecap.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]