SMB_VFS_OP_OPEN flags

Jeremy Allison jra at samba.org
Tue Jul 5 05:17:11 GMT 2005


On Tue, Jul 05, 2005 at 06:44:51AM +0300, Tomas Simonaitis wrote:
> Hi,
> 
> while developing VFS module I've encountered that files which are intended to 
> be read or written have flags==0 set on

flags == 0 usually means O_RDONLY,
flags = 1 == O_WRONLY,
flags = 3 == O_RDWR

at least on Linux. You can check these values on your system.

See your system man page for the open() call for the meaning of these.
Sounds like you're just seeing read-only opens on files. Ensure that
flags != 0 when the file is actually open for write.

> "_open(vfs_handle_struct *handle, connection_struct *conn, const char *fname, 
> int flags, mode_t mode)" call (e.g. using smbclient get command or opening 
> file with some other client).
> 
> However, if file is intended to be created, client opens it with correct flags 
> (e.g. 65).

that's O_CREATE|O_WRONLY

> Is this expected behavior and flags==0 should be interpreted as "might both 
> read/write file", or I'm just hitting some problem here?

I'd check closer into this - remember these VFS calls are how
smbd interacts with the underlying open() system call - so it's
unlikely there's a problem with the Samba code here, or we couldn't
open files.

Jeremy.


More information about the samba-technical mailing list