/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1989-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* Eduardo Krell <ekrell@adexus.cl> *
* *
***********************************************************************/
#pragma prototyped
#include "3d.h"
/*
* this does the actual open, creating versions as required
*/
static int
{
register char* cp;
register char* ep;
int dirlen;
int namlen;
int fd;
int r;
/*
* construct pathname for version instance name text into buf
*/
*ep = '/';
return fd;
return -1;
{
{
return -1;
return -1;
/*
* check for old style opaque, can be removed soon
*/
{
{
return -1;
}
return -1;
{
return -1;
}
}
else
{
return -1;
}
}
return -1;
}
/*
* now create the file
*/
return -1;
*ep = 0;
return fd;
if (r)
{
}
return fd;
}
int
{
register char* sp = 0;
register int r;
int level;
int synthesize;
#if FS
#endif
#if FS
{
}
#endif
{
if ((r = OPEN((!path || *path) ? path : state.dot, oflag, mode)) < 0 || !state.call.monitor || state.in_2d == 1 || FSTAT(r, &st))
return r;
goto done;
}
for (;;)
{
{
{
if (!sp)
{
return -1;
}
{
{
return -1;
}
continue;
}
sp = 0;
}
}
{
goto done;
}
break;
}
#endif
if ((oflag & O_CREAT) && (!sp || level || (oflag & O_EXCL)) || (sp || level) && ((oflag & O_TRUNC) || (oflag & O_ACCMODE) != O_RDONLY))
{
if (sp)
{
{
if (!level)
{
goto done;
}
return -1;
}
mode = ((S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)|(st.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH)));
}
{
if (fd >= 0)
return -1;
}
if (synthesize)
}
else if (!sp)
{
r = -1;
goto done;
}
{
r = -1;
{
if (!r)
{
/*
* try again
*/
r = -1;
}
}
}
if (r > 0)
{
{
{
CLOSE(r);
return -1;
}
}
}
if (fd >= 0)
done:
if (r >= 0)
{
#if defined(fchdir3d)
{
{
}
{
}
}
#endif
#if FS
{
}
if (mp)
#endif
}
#endif
return r;
}
/*
* use this open() within 3d
* to save and restore the path state
*/
int
{
int fd;
return fd;
}
#if !_nosys_open64
int
{
#if defined(O_LARGEFILE)
oflag |= O_LARGEFILE;
#endif
}
#endif