Print this page
3665 Implement O_CLOEXEC as an open() flag
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Gordon Ross <gwr@nexenta.com>
Reviewed by: Dan McDonald <danmcd@nexenta.com>


   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
  24  */
  25 
  26 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  27 /*        All Rights Reserved   */
  28 


  29 #ifndef _SYS_FILE_H
  30 #define _SYS_FILE_H
  31 
  32 #include <sys/t_lock.h>
  33 #ifdef _KERNEL
  34 #include <sys/model.h>
  35 #include <sys/user.h>
  36 #endif
  37 
  38 #ifdef  __cplusplus
  39 extern "C" {
  40 #endif
  41 
  42 /*
  43  * fio locking:
  44  *   f_rwlock   protects f_vnode and f_cred
  45  *   f_tlock    protects the rest
  46  *
  47  *   The purpose of locking in this layer is to keep the kernel
  48  *   from panicing if, for example, a thread calls close() while


  96 #define FASYNC          0x1000  /* asyncio in progress pseudo flag */
  97 #define FOFFMAX         0x2000  /* large file */
  98 #define FXATTR          0x4000  /* open as extended attribute */
  99 #define FNOCTTY         0x0800
 100 #define FRSYNC          0x8000  /* sync read operations at same level of */
 101                                 /* integrity as specified for writes by */
 102                                 /* FSYNC and FDSYNC flags */
 103 
 104 #define FNODSYNC        0x10000 /* fsync pseudo flag */
 105 
 106 #define FNOFOLLOW       0x20000 /* don't follow symlinks */
 107 #define FNOLINKS        0x40000 /* don't allow multiple hard links */
 108 #define FIGNORECASE     0x80000 /* request case-insensitive lookups */
 109 #define FXATTRDIROPEN   0x100000  /* only opening hidden attribute directory */
 110 
 111 /* f_flag2 (open-only) */
 112 
 113 #define FSEARCH         0x200000        /* O_SEARCH = 0x200000 */
 114 #define FEXEC           0x400000        /* O_EXEC = 0x400000 */
 115 


 116 #ifdef _KERNEL
 117 
 118 /*
 119  * Fake flags for driver ioctl calls to inform them of the originating
 120  * process' model.  See <sys/model.h>
 121  *
 122  * Part of the Solaris 2.6+ DDI/DKI
 123  */
 124 #define FMODELS DATAMODEL_MASK  /* Note: 0x0ff00000 */
 125 #define FILP32  DATAMODEL_ILP32
 126 #define FLP64   DATAMODEL_LP64
 127 #define FNATIVE DATAMODEL_NATIVE
 128 
 129 /*
 130  * Large Files: The macro gets the offset maximum (refer to LFS API doc)
 131  * corresponding to a file descriptor. We had the choice of storing
 132  * this value in file descriptor. Right now we only have two
 133  * offset maximums one if MAXOFF_T and other is MAXOFFSET_T. It is
 134  * inefficient to store these two values in a separate member in
 135  * file descriptor. To avoid wasting spaces we define this macro.




   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
  24  */
  25 
  26 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  27 /*        All Rights Reserved   */
  28 
  29 /* Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. */
  30 
  31 #ifndef _SYS_FILE_H
  32 #define _SYS_FILE_H
  33 
  34 #include <sys/t_lock.h>
  35 #ifdef _KERNEL
  36 #include <sys/model.h>
  37 #include <sys/user.h>
  38 #endif
  39 
  40 #ifdef  __cplusplus
  41 extern "C" {
  42 #endif
  43 
  44 /*
  45  * fio locking:
  46  *   f_rwlock   protects f_vnode and f_cred
  47  *   f_tlock    protects the rest
  48  *
  49  *   The purpose of locking in this layer is to keep the kernel
  50  *   from panicing if, for example, a thread calls close() while


  98 #define FASYNC          0x1000  /* asyncio in progress pseudo flag */
  99 #define FOFFMAX         0x2000  /* large file */
 100 #define FXATTR          0x4000  /* open as extended attribute */
 101 #define FNOCTTY         0x0800
 102 #define FRSYNC          0x8000  /* sync read operations at same level of */
 103                                 /* integrity as specified for writes by */
 104                                 /* FSYNC and FDSYNC flags */
 105 
 106 #define FNODSYNC        0x10000 /* fsync pseudo flag */
 107 
 108 #define FNOFOLLOW       0x20000 /* don't follow symlinks */
 109 #define FNOLINKS        0x40000 /* don't allow multiple hard links */
 110 #define FIGNORECASE     0x80000 /* request case-insensitive lookups */
 111 #define FXATTRDIROPEN   0x100000  /* only opening hidden attribute directory */
 112 
 113 /* f_flag2 (open-only) */
 114 
 115 #define FSEARCH         0x200000        /* O_SEARCH = 0x200000 */
 116 #define FEXEC           0x400000        /* O_EXEC = 0x400000 */
 117 
 118 #define FCLOEXEC        0x800000 /* O_CLOEXEC = 0x800000 */
 119 
 120 #ifdef _KERNEL
 121 
 122 /*
 123  * Fake flags for driver ioctl calls to inform them of the originating
 124  * process' model.  See <sys/model.h>
 125  *
 126  * Part of the Solaris 2.6+ DDI/DKI
 127  */
 128 #define FMODELS DATAMODEL_MASK  /* Note: 0x0ff00000 */
 129 #define FILP32  DATAMODEL_ILP32
 130 #define FLP64   DATAMODEL_LP64
 131 #define FNATIVE DATAMODEL_NATIVE
 132 
 133 /*
 134  * Large Files: The macro gets the offset maximum (refer to LFS API doc)
 135  * corresponding to a file descriptor. We had the choice of storing
 136  * this value in file descriptor. Right now we only have two
 137  * offset maximums one if MAXOFF_T and other is MAXOFFSET_T. It is
 138  * inefficient to store these two values in a separate member in
 139  * file descriptor. To avoid wasting spaces we define this macro.