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>


  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 /*
  30  * University Copyright- Copyright (c) 1982, 1986, 1988
  31  * The Regents of the University of California
  32  * All Rights Reserved
  33  *
  34  * University Acknowledgment- Portions of this document are derived from
  35  * software developed by the University of California, Berkeley, and its
  36  * contributors.
  37  */
  38 


  39 #ifndef _SYS_FCNTL_H
  40 #define _SYS_FCNTL_H
  41 
  42 #include <sys/feature_tests.h>
  43 
  44 #include <sys/types.h>
  45 
  46 #ifdef  __cplusplus
  47 extern "C" {
  48 #endif
  49 
  50 /*
  51  * Flag values accessible to open(2) and fcntl(2)
  52  * The first five can only be set (exclusively) by open(2).
  53  */
  54 #define O_RDONLY        0
  55 #define O_WRONLY        1
  56 #define O_RDWR          2
  57 #define O_SEARCH        0x200000
  58 #define O_EXEC          0x400000


  65 #define O_SYNC          0x10    /* synchronized file update option */
  66 #define O_DSYNC         0x40    /* synchronized data update option */
  67 #define O_RSYNC         0x8000  /* synchronized file update option */
  68                                 /* defines read/write file integrity */
  69 #endif /* defined(__EXTENSIONS__) || !defined(_POSIX_C_SOURCE) ... */
  70 #define O_NONBLOCK      0x80    /* non-blocking I/O (POSIX) */
  71 #ifdef  _LARGEFILE_SOURCE
  72 #define O_LARGEFILE     0x2000
  73 #endif
  74 
  75 /*
  76  * Flag values accessible only to open(2).
  77  */
  78 #define O_CREAT         0x100   /* open with file create (uses third arg) */
  79 #define O_TRUNC         0x200   /* open with truncation */
  80 #define O_EXCL          0x400   /* exclusive open */
  81 #define O_NOCTTY        0x800   /* don't allocate controlling tty (POSIX) */
  82 #define O_XATTR         0x4000  /* extended attribute */
  83 #define O_NOFOLLOW      0x20000 /* don't follow symlinks */
  84 #define O_NOLINKS       0x40000 /* don't allow multiple hard links */

  85 
  86 /*
  87  * fcntl(2) requests
  88  *
  89  * N.B.: values are not necessarily assigned sequentially below.
  90  */
  91 #define F_DUPFD         0       /* Duplicate fildes */
  92 #define F_GETFD         1       /* Get fildes flags */
  93 #define F_SETFD         2       /* Set fildes flags */
  94 #define F_GETFL         3       /* Get file flags */
  95 #define F_GETXFL        45      /* Get file flags including open-only flags */
  96 #define F_SETFL         4       /* Set file flags */
  97 
  98 /*
  99  * Applications that read /dev/mem must be built like the kernel.  A
 100  * new symbol "_KMEMUSER" is defined for this purpose.
 101  */
 102 #if defined(_KERNEL) || defined(_KMEMUSER)
 103 #define F_O_GETLK       5       /* SVR3 Get file lock (need for rfs, across */
 104                                 /* the wire compatibility */




  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 /*
  30  * University Copyright- Copyright (c) 1982, 1986, 1988
  31  * The Regents of the University of California
  32  * All Rights Reserved
  33  *
  34  * University Acknowledgment- Portions of this document are derived from
  35  * software developed by the University of California, Berkeley, and its
  36  * contributors.
  37  */
  38 
  39 /* Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. */
  40 
  41 #ifndef _SYS_FCNTL_H
  42 #define _SYS_FCNTL_H
  43 
  44 #include <sys/feature_tests.h>
  45 
  46 #include <sys/types.h>
  47 
  48 #ifdef  __cplusplus
  49 extern "C" {
  50 #endif
  51 
  52 /*
  53  * Flag values accessible to open(2) and fcntl(2)
  54  * The first five can only be set (exclusively) by open(2).
  55  */
  56 #define O_RDONLY        0
  57 #define O_WRONLY        1
  58 #define O_RDWR          2
  59 #define O_SEARCH        0x200000
  60 #define O_EXEC          0x400000


  67 #define O_SYNC          0x10    /* synchronized file update option */
  68 #define O_DSYNC         0x40    /* synchronized data update option */
  69 #define O_RSYNC         0x8000  /* synchronized file update option */
  70                                 /* defines read/write file integrity */
  71 #endif /* defined(__EXTENSIONS__) || !defined(_POSIX_C_SOURCE) ... */
  72 #define O_NONBLOCK      0x80    /* non-blocking I/O (POSIX) */
  73 #ifdef  _LARGEFILE_SOURCE
  74 #define O_LARGEFILE     0x2000
  75 #endif
  76 
  77 /*
  78  * Flag values accessible only to open(2).
  79  */
  80 #define O_CREAT         0x100   /* open with file create (uses third arg) */
  81 #define O_TRUNC         0x200   /* open with truncation */
  82 #define O_EXCL          0x400   /* exclusive open */
  83 #define O_NOCTTY        0x800   /* don't allocate controlling tty (POSIX) */
  84 #define O_XATTR         0x4000  /* extended attribute */
  85 #define O_NOFOLLOW      0x20000 /* don't follow symlinks */
  86 #define O_NOLINKS       0x40000 /* don't allow multiple hard links */
  87 #define O_CLOEXEC       0x800000        /* set the close-on-exec flag */
  88 
  89 /*
  90  * fcntl(2) requests
  91  *
  92  * N.B.: values are not necessarily assigned sequentially below.
  93  */
  94 #define F_DUPFD         0       /* Duplicate fildes */
  95 #define F_GETFD         1       /* Get fildes flags */
  96 #define F_SETFD         2       /* Set fildes flags */
  97 #define F_GETFL         3       /* Get file flags */
  98 #define F_GETXFL        45      /* Get file flags including open-only flags */
  99 #define F_SETFL         4       /* Set file flags */
 100 
 101 /*
 102  * Applications that read /dev/mem must be built like the kernel.  A
 103  * new symbol "_KMEMUSER" is defined for this purpose.
 104  */
 105 #if defined(_KERNEL) || defined(_KMEMUSER)
 106 #define F_O_GETLK       5       /* SVR3 Get file lock (need for rfs, across */
 107                                 /* the wire compatibility */