1 /* 2 * Copyright (c) 2025 Apple Inc. All rights reserved. 3 * 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. The rights granted to you under the License 10 * may not be used to create, or enable the creation or redistribution of, 11 * unlawful or unlicensed copies of an Apple operating system, or to 12 * circumvent, violate, or enable the circumvention or violation of, any 13 * terms of an Apple operating system software license agreement. 14 * 15 * Please obtain a copy of the License at 16 * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 * 18 * The Original Code and all software distributed under the License are 19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 * Please see the License for the specific language governing rights and 24 * limitations under the License. 25 * 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 */ 28 /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ 29 /*- 30 * Copyright (c) 1983, 1990, 1993 31 * The Regents of the University of California. All rights reserved. 32 * (c) UNIX System Laboratories, Inc. 33 * All or some portions of this file are derived from material licensed 34 * to the University of California by American Telephone and Telegraph 35 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 36 * the permission of UNIX System Laboratories, Inc. 37 * 38 * Redistribution and use in source and binary forms, with or without 39 * modification, are permitted provided that the following conditions 40 * are met: 41 * 1. Redistributions of source code must retain the above copyright 42 * notice, this list of conditions and the following disclaimer. 43 * 2. Redistributions in binary form must reproduce the above copyright 44 * notice, this list of conditions and the following disclaimer in the 45 * documentation and/or other materials provided with the distribution. 46 * 3. All advertising materials mentioning features or use of this software 47 * must display the following acknowledgement: 48 * This product includes software developed by the University of 49 * California, Berkeley and its contributors. 50 * 4. Neither the name of the University nor the names of its contributors 51 * may be used to endorse or promote products derived from this software 52 * without specific prior written permission. 53 * 54 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 55 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 56 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 57 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 58 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 59 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 60 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 61 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 62 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 63 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 64 * SUCH DAMAGE. 65 * 66 * @(#)fcntl.h 8.3 (Berkeley) 1/21/94 67 */ 68 69 70 #ifndef _SYS_FCNTL_PRIVATE_H_ 71 #define _SYS_FCNTL_PRIVATE_H_ 72 73 #include <sys/cdefs.h> 74 #include <sys/_types/_mode_t.h> 75 76 #if __DARWIN_C_LEVEL >= 200809L 77 #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL 78 #define AT_REMOVEDIR_DATALESS 0x0100 /* Remove a dataless directory without materializing first */ 79 #define AT_SYSTEM_DISCARDED 0x1000 /* Indicated file/folder was discarded by system */ 80 #endif 81 #endif 82 83 /* 84 * Constants used for fcntl(2) 85 */ 86 87 /* command values */ 88 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) 89 #define F_OPENFROM 56 /* SPI: open a file relative to fd (must be a dir) */ 90 #define F_UNLINKFROM 57 /* SPI: open a file relative to fd (must be a dir) */ 91 #define F_CHECK_OPENEVT 58 /* SPI: if a process is marked OPENEVT, or in O_EVTONLY on opens of this vnode */ 92 93 /* Deprecated/Removed in 10.9 */ 94 #define F_MARKDEPENDENCY 60 /* this process hosts the device supporting the fs backing this fd */ 95 96 #define F_SETSTATICCONTENT 68 /* 97 * indicate to the filesystem/storage driver that the content to be 98 * written is usually static. a nonzero value enables it, 0 disables it. 99 */ 100 #define F_MOVEDATAEXTENTS 69 /* Swap only the data associated with two files */ 101 102 #define F_GETDEFAULTPROTLEVEL 79 /* Get the default protection level for the filesystem */ 103 #define F_MAKECOMPRESSED 80 /* Make the file compressed; truncate & toggle BSD bits */ 104 #define F_SET_GREEDY_MODE 81 /* 105 * indicate to the filesystem/storage driver that the content to be 106 * written should be written in greedy mode for additional speed at 107 * the cost of storage efficiency. A nonzero value enables it, 0 disables it. 108 */ 109 110 #define F_SETIOTYPE 82 /* 111 * Use parameters to describe content being written to the FD. See 112 * flag definitions below for argument bits. 113 */ 114 115 #define F_RECYCLE 84 /* Recycle vnode; debug/development builds only */ 116 117 #define F_OFD_GETLKPID 94 /* get record locking information */ 118 119 #define F_SETCONFINED 95 /* "confine" OFD to process */ 120 #define F_GETCONFINED 96 /* is-fd-confined? */ 121 122 #define F_ASSERT_BG_ACCESS 108 /* Assert background access to a file */ 123 #define F_RELEASE_BG_ACCESS 109 /* Release background access to a file */ 124 125 #endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ 126 127 /* file descriptor flags (F_GETFD, F_SETFD) */ 128 #define FD_CLOFORK 2 /* close-on-fork flag */ 129 130 /* 131 * ISOCHRONOUS attempts to sustain a minimum platform-dependent throughput 132 * for the duration of the I/O delivered to the driver. 133 */ 134 #define F_IOTYPE_ISOCHRONOUS 0x0001 135 136 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) 137 /* fassertbgaccess_t used by F_ASSERT_BG_ACCESS */ 138 typedef struct fassertbgaccess { 139 unsigned int fbga_flags; /* unused */ 140 unsigned int reserved; /* (to maintain 8-byte alignment) */ 141 unsigned long long ttl; /* IN: time to live for the assertion (nanoseconds; continuous) */ 142 } fassertbgaccess_t; 143 144 /* 145 * SPI: Argument data for F_OPENFROM 146 */ 147 struct fopenfrom { 148 unsigned int o_flags; /* same as open(2) */ 149 mode_t o_mode; /* same as open(2) */ 150 char * o_pathname; /* relative pathname */ 151 }; 152 153 #ifdef KERNEL 154 /* 155 * LP64 version of fopenfrom. Memory pointers 156 * grow when we're dealing with a 64-bit process. 157 * 158 * WARNING - keep in sync with fopenfrom (above) 159 */ 160 struct user32_fopenfrom { 161 unsigned int o_flags; 162 mode_t o_mode; 163 user32_addr_t o_pathname; 164 }; 165 166 struct user_fopenfrom { 167 unsigned int o_flags; 168 mode_t o_mode; 169 user_addr_t o_pathname; 170 }; 171 #endif /* KERNEL */ 172 173 174 #endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ 175 176 #endif /* !_SYS_FCNTL_PRIVATE_H_ */ 177