Re: fcntl example

Andy Bensky (ab@infoseek.com)
Mon, 16 May 1994 14:10:17 -0700

> > import fcntlh # values used by fcntl. created using h2py from
> > # /usr/include/sys/fcntl.h
> Actually, such a file is already present in the Python distribution in
> Lib/sgi and Lib/sun4, named FCNTL.py. Versions for other platforms
> are most welcome!

well, you asked for it :) This is the file generated by h2py on the
Solaris 2.3 version of /usr/include/sys/fcntl.h. The values of the
flags are considerably different than the version in sun4/FCNTL.py.
Why did Sun break all of their old code when the adopted this new os?
(personally, I like the module name fcntlh.py more than FCNTL since it
is more descriptive of what is in there and I hate upper case file names
unless it really means something. However, I understand the need for
portability so I will call it whatever it is called in the distribution.)
- andy bensky
InfoSeek Corp.

# FCNTL.py for Solaris 2.3

O_RDONLY = 0
O_WRONLY = 1
O_RDWR = 2
O_NDELAY = 0x04
O_APPEND = 0x08
O_SYNC = 0x10
O_DSYNC = 0x40
O_RSYNC = 0x8000
O_NONBLOCK = 0x80
O_PRIV = 0x1000
O_CREAT = 0x100
O_TRUNC = 0x200
O_EXCL = 0x400
O_NOCTTY = 0x800
F_DUPFD = 0
F_GETFD = 1
F_SETFD = 2
F_GETFL = 3
F_SETFL = 4
F_SETLK = 6
F_SETLKW = 7
F_O_GETLK = 5
F_SETLK = 6
F_SETLKW = 7
F_CHKFL = 8
F_ALLOCSP = 10
F_FREESP = 11
F_ISSTREAM = 13
F_GETLK = 14
F_PRIV = 15
F_NPRIV = 16
F_QUOTACTL = 17
F_BLOCKS = 18
F_BLKSIZE = 19
F_RSETLK = 20
F_RGETLK = 21
F_RSETLKW = 22
F_GETOWN = 23
F_SETOWN = 24
F_REVOKE = 25
F_RDLCK = 01
F_WRLCK = 02
F_UNLCK = 03
F_UNLKSYS = 04
O_ACCMODE = 3
FD_CLOEXEC = 1