summaryrefslogtreecommitdiff
path: root/src/lib9/open.c
diff options
context:
space:
mode:
authorHector Chu <hectorchu@gmail.com>2009-11-30 11:53:11 -0800
committerHector Chu <hectorchu@gmail.com>2009-11-30 11:53:11 -0800
commit24dff2fa7785801a25f1fcac53313e83ae61201b (patch)
tree7ac62e529fdf4675e7449e7171ed7cc0a573e517 /src/lib9/open.c
parent0106c26c2d751926fc223eee01e6fac8e2b0b1d4 (diff)
downloadgo-24dff2fa7785801a25f1fcac53313e83ae61201b.tar.gz
Ports of lib9, libbio and libmach to Windows.
R=rsc http://codereview.appspot.com/157159 Committer: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/lib9/open.c')
-rw-r--r--src/lib9/open.c27
1 files changed, 4 insertions, 23 deletions
diff --git a/src/lib9/open.c b/src/lib9/open.c
index 1fa3c1bc7..4ac81ba5f 100644
--- a/src/lib9/open.c
+++ b/src/lib9/open.c
@@ -35,16 +35,13 @@ THE SOFTWARE.
int
p9open(char *name, int mode)
{
- int cexec, rclose;
- int fd, umode, lock, rdwr;
- struct flock fl;
+ int rclose;
+ int fd, umode, rdwr;
rdwr = mode&3;
umode = rdwr;
- cexec = mode&OCEXEC;
rclose = mode&ORCLOSE;
- lock = mode&OLOCK;
- mode &= ~(3|OCEXEC|ORCLOSE|OLOCK);
+ mode &= ~(3|ORCLOSE);
if(mode&OTRUNC){
umode |= O_TRUNC;
mode ^= OTRUNC;
@@ -53,10 +50,6 @@ p9open(char *name, int mode)
umode |= O_DIRECT;
mode ^= ODIRECT;
}
- if(mode&ONONBLOCK){
- umode |= O_NONBLOCK;
- mode ^= ONONBLOCK;
- }
if(mode&OAPPEND){
umode |= O_APPEND;
mode ^= OAPPEND;
@@ -65,21 +58,9 @@ p9open(char *name, int mode)
werrstr("mode 0x%x not supported", mode);
return -1;
}
+ umode |= O_BINARY;
fd = open(name, umode);
if(fd >= 0){
- if(lock){
- fl.l_type = (rdwr==OREAD) ? F_RDLCK : F_WRLCK;
- fl.l_whence = SEEK_SET;
- fl.l_start = 0;
- fl.l_len = 0;
- if(fcntl(fd, F_SETLK, &fl) < 0){
- close(fd);
- werrstr("lock: %r");
- return -1;
- }
- }
- if(cexec)
- fcntl(fd, F_SETFL, FD_CLOEXEC);
if(rclose)
remove(name);
}