open.c revision 93aeed832de7673ee68c1c82129a4fb8819c16bc
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Portions of this source code were derived from Berkeley 4.3 BSD
* under license from the Regents of the University of California.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/isa_defs.h>
#include <sys/sysmacros.h>
/*
* Common code for open()/openat() and creat(). Check permissions, allocate
* an open file structure, and call the device open routine (if any).
*/
static int
{
int error;
char *open_filename = fname;
/*
* Regular open()
*/
} else {
/*
* We're here via openat()
*/
char startchar;
/*
* if startchar is / then startfd is ignored
*/
if (startchar == '/')
else {
}
}
/*
* Handle openattrdirat request
*/
if (filemode & FXATTRDIROPEN) {
if (audit_active)
if (startvp) {
}
}
/*
* Do we need to go into extended attribute space?
*/
/*
* Make sure we have a valid request.
* We must either have a real fd or AT_FDCWD
*/
goto out;
}
goto out;
}
mutex_enter(&p->p_lock);
mutex_exit(&p->p_lock);
}
/*
* In order to access hidden attribute directory the
* user must be able to stat() the file
*/
goto out;
}
} else {
}
/*
* For openattrdirat use "." as filename to open
* as part of vn_openat()
*/
open_filename = ".";
seg = UIO_SYSSPACE;
}
if (error != 0)
goto out;
}
if (error == 0) {
if (audit_active)
/*
* Last arg is a don't-care term if
* !(filemode & FCREAT).
*/
(int)(createmode & MODEMASK),
if (error == 0) {
if (audit_active)
/*
* We must now fill in the slot
* falloc reserved.
*/
return (fd);
} else {
/*
* Give up the file pointer
* and dup the indicated file descriptor
* (in v_rdev). This is ugly, but I've
* seen worse.
*/
}
}
return (fd);
} else {
}
}
} else {
}
out:
}
#define OPENMODEATTRDIR FXATTRDIROPEN
#ifdef _LP64
#define CREATMODE CREATMODE64
#else
#define OPENMODE OPENMODE32
#define CREATMODE CREATMODE32
#endif
/*
* Open a file.
*/
int
{
}
/*
* Create a file.
*/
int
{
}
int
{
}
#if defined(_ILP32) || defined(_SYSCALL32_IMPL)
/*
* Open and Creat for large files in 32-bit environment. Sets the FOFFMAX flag.
*/
int
{
}
int
{
}
int
{
}
#endif /* _ILP32 || _SYSCALL32_IMPL */
#ifdef _SYSCALL32_IMPL
/*
* Open and Creat for 32-bit compatibility on 64-bit kernel
*/
int
{
}
int
{
}
int
{
}
#endif /* _SYSCALL32_IMPL */
/*
* Special interface to open hidden attribute directory.
*/
int
{
}