Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ShExBy/shex_roo.../usr/include
File: fcntl.h
/* Copyright (C) 1991-2018 Free Software Foundation, Inc.
[0] Fix | Delete
This file is part of the GNU C Library.
[1] Fix | Delete
[2] Fix | Delete
The GNU C Library is free software; you can redistribute it and/or
[3] Fix | Delete
modify it under the terms of the GNU Lesser General Public
[4] Fix | Delete
License as published by the Free Software Foundation; either
[5] Fix | Delete
version 2.1 of the License, or (at your option) any later version.
[6] Fix | Delete
[7] Fix | Delete
The GNU C Library is distributed in the hope that it will be useful,
[8] Fix | Delete
but WITHOUT ANY WARRANTY; without even the implied warranty of
[9] Fix | Delete
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
[10] Fix | Delete
Lesser General Public License for more details.
[11] Fix | Delete
[12] Fix | Delete
You should have received a copy of the GNU Lesser General Public
[13] Fix | Delete
License along with the GNU C Library; if not, see
[14] Fix | Delete
<http://www.gnu.org/licenses/>. */
[15] Fix | Delete
[16] Fix | Delete
/*
[17] Fix | Delete
* POSIX Standard: 6.5 File Control Operations <fcntl.h>
[18] Fix | Delete
*/
[19] Fix | Delete
[20] Fix | Delete
#ifndef _FCNTL_H
[21] Fix | Delete
#define _FCNTL_H 1
[22] Fix | Delete
[23] Fix | Delete
#include <features.h>
[24] Fix | Delete
[25] Fix | Delete
/* This must be early so <bits/fcntl.h> can define types winningly. */
[26] Fix | Delete
__BEGIN_DECLS
[27] Fix | Delete
[28] Fix | Delete
/* Get __mode_t, __dev_t and __off_t .*/
[29] Fix | Delete
#include <bits/types.h>
[30] Fix | Delete
[31] Fix | Delete
/* Get the definitions of O_*, F_*, FD_*: all the
[32] Fix | Delete
numbers and flag bits for `open', `fcntl', et al. */
[33] Fix | Delete
#include <bits/fcntl.h>
[34] Fix | Delete
[35] Fix | Delete
/* Detect if open needs mode as a third argument (or for openat as a fourth
[36] Fix | Delete
argument). */
[37] Fix | Delete
#ifdef __O_TMPFILE
[38] Fix | Delete
# define __OPEN_NEEDS_MODE(oflag) \
[39] Fix | Delete
(((oflag) & O_CREAT) != 0 || ((oflag) & __O_TMPFILE) == __O_TMPFILE)
[40] Fix | Delete
#else
[41] Fix | Delete
# define __OPEN_NEEDS_MODE(oflag) (((oflag) & O_CREAT) != 0)
[42] Fix | Delete
#endif
[43] Fix | Delete
[44] Fix | Delete
/* POSIX.1-2001 specifies that these types are defined by <fcntl.h>.
[45] Fix | Delete
Earlier POSIX standards permitted any type ending in `_t' to be defined
[46] Fix | Delete
by any POSIX header, so we don't conditionalize the definitions here. */
[47] Fix | Delete
#ifndef __mode_t_defined
[48] Fix | Delete
typedef __mode_t mode_t;
[49] Fix | Delete
# define __mode_t_defined
[50] Fix | Delete
#endif
[51] Fix | Delete
[52] Fix | Delete
#ifndef __off_t_defined
[53] Fix | Delete
# ifndef __USE_FILE_OFFSET64
[54] Fix | Delete
typedef __off_t off_t;
[55] Fix | Delete
# else
[56] Fix | Delete
typedef __off64_t off_t;
[57] Fix | Delete
# endif
[58] Fix | Delete
# define __off_t_defined
[59] Fix | Delete
#endif
[60] Fix | Delete
[61] Fix | Delete
#if defined __USE_LARGEFILE64 && !defined __off64_t_defined
[62] Fix | Delete
typedef __off64_t off64_t;
[63] Fix | Delete
# define __off64_t_defined
[64] Fix | Delete
#endif
[65] Fix | Delete
[66] Fix | Delete
#ifndef __pid_t_defined
[67] Fix | Delete
typedef __pid_t pid_t;
[68] Fix | Delete
# define __pid_t_defined
[69] Fix | Delete
#endif
[70] Fix | Delete
[71] Fix | Delete
/* For XPG all symbols from <sys/stat.h> should also be available. */
[72] Fix | Delete
#ifdef __USE_XOPEN2K8
[73] Fix | Delete
# include <bits/types/struct_timespec.h>
[74] Fix | Delete
#endif
[75] Fix | Delete
#if defined __USE_XOPEN || defined __USE_XOPEN2K8
[76] Fix | Delete
# include <bits/stat.h>
[77] Fix | Delete
[78] Fix | Delete
# define S_IFMT __S_IFMT
[79] Fix | Delete
# define S_IFDIR __S_IFDIR
[80] Fix | Delete
# define S_IFCHR __S_IFCHR
[81] Fix | Delete
# define S_IFBLK __S_IFBLK
[82] Fix | Delete
# define S_IFREG __S_IFREG
[83] Fix | Delete
# ifdef __S_IFIFO
[84] Fix | Delete
# define S_IFIFO __S_IFIFO
[85] Fix | Delete
# endif
[86] Fix | Delete
# ifdef __S_IFLNK
[87] Fix | Delete
# define S_IFLNK __S_IFLNK
[88] Fix | Delete
# endif
[89] Fix | Delete
# if (defined __USE_UNIX98 || defined __USE_XOPEN2K8) && defined __S_IFSOCK
[90] Fix | Delete
# define S_IFSOCK __S_IFSOCK
[91] Fix | Delete
# endif
[92] Fix | Delete
[93] Fix | Delete
/* Protection bits. */
[94] Fix | Delete
[95] Fix | Delete
# define S_ISUID __S_ISUID /* Set user ID on execution. */
[96] Fix | Delete
# define S_ISGID __S_ISGID /* Set group ID on execution. */
[97] Fix | Delete
[98] Fix | Delete
# if defined __USE_MISC || defined __USE_XOPEN
[99] Fix | Delete
/* Save swapped text after use (sticky bit). This is pretty well obsolete. */
[100] Fix | Delete
# define S_ISVTX __S_ISVTX
[101] Fix | Delete
# endif
[102] Fix | Delete
[103] Fix | Delete
# define S_IRUSR __S_IREAD /* Read by owner. */
[104] Fix | Delete
# define S_IWUSR __S_IWRITE /* Write by owner. */
[105] Fix | Delete
# define S_IXUSR __S_IEXEC /* Execute by owner. */
[106] Fix | Delete
/* Read, write, and execute by owner. */
[107] Fix | Delete
# define S_IRWXU (__S_IREAD|__S_IWRITE|__S_IEXEC)
[108] Fix | Delete
[109] Fix | Delete
# define S_IRGRP (S_IRUSR >> 3) /* Read by group. */
[110] Fix | Delete
# define S_IWGRP (S_IWUSR >> 3) /* Write by group. */
[111] Fix | Delete
# define S_IXGRP (S_IXUSR >> 3) /* Execute by group. */
[112] Fix | Delete
/* Read, write, and execute by group. */
[113] Fix | Delete
# define S_IRWXG (S_IRWXU >> 3)
[114] Fix | Delete
[115] Fix | Delete
# define S_IROTH (S_IRGRP >> 3) /* Read by others. */
[116] Fix | Delete
# define S_IWOTH (S_IWGRP >> 3) /* Write by others. */
[117] Fix | Delete
# define S_IXOTH (S_IXGRP >> 3) /* Execute by others. */
[118] Fix | Delete
/* Read, write, and execute by others. */
[119] Fix | Delete
# define S_IRWXO (S_IRWXG >> 3)
[120] Fix | Delete
#endif
[121] Fix | Delete
[122] Fix | Delete
#ifdef __USE_MISC
[123] Fix | Delete
# ifndef R_OK /* Verbatim from <unistd.h>. Ugh. */
[124] Fix | Delete
/* Values for the second argument to access.
[125] Fix | Delete
These may be OR'd together. */
[126] Fix | Delete
# define R_OK 4 /* Test for read permission. */
[127] Fix | Delete
# define W_OK 2 /* Test for write permission. */
[128] Fix | Delete
# define X_OK 1 /* Test for execute permission. */
[129] Fix | Delete
# define F_OK 0 /* Test for existence. */
[130] Fix | Delete
# endif
[131] Fix | Delete
#endif /* Use misc. */
[132] Fix | Delete
[133] Fix | Delete
/* XPG wants the following symbols. <stdio.h> has the same definitions. */
[134] Fix | Delete
#if defined __USE_XOPEN || defined __USE_XOPEN2K8
[135] Fix | Delete
# define SEEK_SET 0 /* Seek from beginning of file. */
[136] Fix | Delete
# define SEEK_CUR 1 /* Seek from current position. */
[137] Fix | Delete
# define SEEK_END 2 /* Seek from end of file. */
[138] Fix | Delete
#endif /* XPG */
[139] Fix | Delete
[140] Fix | Delete
/* The constants AT_REMOVEDIR and AT_EACCESS have the same value. AT_EACCESS
[141] Fix | Delete
is meaningful only to faccessat, while AT_REMOVEDIR is meaningful only to
[142] Fix | Delete
unlinkat. The two functions do completely different things and therefore,
[143] Fix | Delete
the flags can be allowed to overlap. For example, passing AT_REMOVEDIR to
[144] Fix | Delete
faccessat would be undefined behavior and thus treating it equivalent to
[145] Fix | Delete
AT_EACCESS is valid undefined behavior. */
[146] Fix | Delete
#ifdef __USE_ATFILE
[147] Fix | Delete
# define AT_FDCWD -100 /* Special value used to indicate
[148] Fix | Delete
the *at functions should use the
[149] Fix | Delete
current working directory. */
[150] Fix | Delete
# define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */
[151] Fix | Delete
# define AT_REMOVEDIR 0x200 /* Remove directory instead of
[152] Fix | Delete
unlinking file. */
[153] Fix | Delete
# define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */
[154] Fix | Delete
# ifdef __USE_GNU
[155] Fix | Delete
# define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount
[156] Fix | Delete
traversal. */
[157] Fix | Delete
# define AT_EMPTY_PATH 0x1000 /* Allow empty relative pathname. */
[158] Fix | Delete
# define AT_STATX_SYNC_TYPE 0x6000
[159] Fix | Delete
# define AT_STATX_SYNC_AS_STAT 0x0000
[160] Fix | Delete
# define AT_STATX_FORCE_SYNC 0x2000
[161] Fix | Delete
# define AT_STATX_DONT_SYNC 0x4000
[162] Fix | Delete
# endif
[163] Fix | Delete
# define AT_EACCESS 0x200 /* Test access permitted for
[164] Fix | Delete
effective IDs, not real IDs. */
[165] Fix | Delete
#endif
[166] Fix | Delete
[167] Fix | Delete
/* Do the file control operation described by CMD on FD.
[168] Fix | Delete
The remaining arguments are interpreted depending on CMD.
[169] Fix | Delete
[170] Fix | Delete
This function is a cancellation point and therefore not marked with
[171] Fix | Delete
__THROW. */
[172] Fix | Delete
#ifndef __USE_FILE_OFFSET64
[173] Fix | Delete
extern int fcntl (int __fd, int __cmd, ...);
[174] Fix | Delete
#else
[175] Fix | Delete
# ifdef __REDIRECT
[176] Fix | Delete
extern int __REDIRECT (fcntl, (int __fd, int __cmd, ...), fcntl64);
[177] Fix | Delete
# else
[178] Fix | Delete
# define fcntl fcntl64
[179] Fix | Delete
# endif
[180] Fix | Delete
#endif
[181] Fix | Delete
#ifdef __USE_LARGEFILE64
[182] Fix | Delete
extern int fcntl64 (int __fd, int __cmd, ...);
[183] Fix | Delete
#endif
[184] Fix | Delete
[185] Fix | Delete
/* Open FILE and return a new file descriptor for it, or -1 on error.
[186] Fix | Delete
OFLAG determines the type of access used. If O_CREAT or O_TMPFILE is set
[187] Fix | Delete
in OFLAG, the third argument is taken as a `mode_t', the mode of the
[188] Fix | Delete
created file.
[189] Fix | Delete
[190] Fix | Delete
This function is a cancellation point and therefore not marked with
[191] Fix | Delete
__THROW. */
[192] Fix | Delete
#ifndef __USE_FILE_OFFSET64
[193] Fix | Delete
extern int open (const char *__file, int __oflag, ...) __nonnull ((1));
[194] Fix | Delete
#else
[195] Fix | Delete
# ifdef __REDIRECT
[196] Fix | Delete
extern int __REDIRECT (open, (const char *__file, int __oflag, ...), open64)
[197] Fix | Delete
__nonnull ((1));
[198] Fix | Delete
# else
[199] Fix | Delete
# define open open64
[200] Fix | Delete
# endif
[201] Fix | Delete
#endif
[202] Fix | Delete
#ifdef __USE_LARGEFILE64
[203] Fix | Delete
extern int open64 (const char *__file, int __oflag, ...) __nonnull ((1));
[204] Fix | Delete
#endif
[205] Fix | Delete
[206] Fix | Delete
#ifdef __USE_ATFILE
[207] Fix | Delete
/* Similar to `open' but a relative path name is interpreted relative to
[208] Fix | Delete
the directory for which FD is a descriptor.
[209] Fix | Delete
[210] Fix | Delete
NOTE: some other `openat' implementation support additional functionality
[211] Fix | Delete
through this interface, especially using the O_XATTR flag. This is not
[212] Fix | Delete
yet supported here.
[213] Fix | Delete
[214] Fix | Delete
This function is a cancellation point and therefore not marked with
[215] Fix | Delete
__THROW. */
[216] Fix | Delete
# ifndef __USE_FILE_OFFSET64
[217] Fix | Delete
extern int openat (int __fd, const char *__file, int __oflag, ...)
[218] Fix | Delete
__nonnull ((2));
[219] Fix | Delete
# else
[220] Fix | Delete
# ifdef __REDIRECT
[221] Fix | Delete
extern int __REDIRECT (openat, (int __fd, const char *__file, int __oflag,
[222] Fix | Delete
...), openat64) __nonnull ((2));
[223] Fix | Delete
# else
[224] Fix | Delete
# define openat openat64
[225] Fix | Delete
# endif
[226] Fix | Delete
# endif
[227] Fix | Delete
# ifdef __USE_LARGEFILE64
[228] Fix | Delete
extern int openat64 (int __fd, const char *__file, int __oflag, ...)
[229] Fix | Delete
__nonnull ((2));
[230] Fix | Delete
# endif
[231] Fix | Delete
#endif
[232] Fix | Delete
[233] Fix | Delete
/* Create and open FILE, with mode MODE. This takes an `int' MODE
[234] Fix | Delete
argument because that is what `mode_t' will be widened to.
[235] Fix | Delete
[236] Fix | Delete
This function is a cancellation point and therefore not marked with
[237] Fix | Delete
__THROW. */
[238] Fix | Delete
#ifndef __USE_FILE_OFFSET64
[239] Fix | Delete
extern int creat (const char *__file, mode_t __mode) __nonnull ((1));
[240] Fix | Delete
#else
[241] Fix | Delete
# ifdef __REDIRECT
[242] Fix | Delete
extern int __REDIRECT (creat, (const char *__file, mode_t __mode),
[243] Fix | Delete
creat64) __nonnull ((1));
[244] Fix | Delete
# else
[245] Fix | Delete
# define creat creat64
[246] Fix | Delete
# endif
[247] Fix | Delete
#endif
[248] Fix | Delete
#ifdef __USE_LARGEFILE64
[249] Fix | Delete
extern int creat64 (const char *__file, mode_t __mode) __nonnull ((1));
[250] Fix | Delete
#endif
[251] Fix | Delete
[252] Fix | Delete
#if !defined F_LOCK && (defined __USE_MISC || (defined __USE_XOPEN_EXTENDED \
[253] Fix | Delete
&& !defined __USE_POSIX))
[254] Fix | Delete
/* NOTE: These declarations also appear in <unistd.h>; be sure to keep both
[255] Fix | Delete
files consistent. Some systems have them there and some here, and some
[256] Fix | Delete
software depends on the macros being defined without including both. */
[257] Fix | Delete
[258] Fix | Delete
/* `lockf' is a simpler interface to the locking facilities of `fcntl'.
[259] Fix | Delete
LEN is always relative to the current file position.
[260] Fix | Delete
The CMD argument is one of the following. */
[261] Fix | Delete
[262] Fix | Delete
# define F_ULOCK 0 /* Unlock a previously locked region. */
[263] Fix | Delete
# define F_LOCK 1 /* Lock a region for exclusive use. */
[264] Fix | Delete
# define F_TLOCK 2 /* Test and lock a region for exclusive use. */
[265] Fix | Delete
# define F_TEST 3 /* Test a region for other processes locks. */
[266] Fix | Delete
[267] Fix | Delete
# ifndef __USE_FILE_OFFSET64
[268] Fix | Delete
extern int lockf (int __fd, int __cmd, off_t __len);
[269] Fix | Delete
# else
[270] Fix | Delete
# ifdef __REDIRECT
[271] Fix | Delete
extern int __REDIRECT (lockf, (int __fd, int __cmd, __off64_t __len), lockf64);
[272] Fix | Delete
# else
[273] Fix | Delete
# define lockf lockf64
[274] Fix | Delete
# endif
[275] Fix | Delete
# endif
[276] Fix | Delete
# ifdef __USE_LARGEFILE64
[277] Fix | Delete
extern int lockf64 (int __fd, int __cmd, off64_t __len);
[278] Fix | Delete
# endif
[279] Fix | Delete
#endif
[280] Fix | Delete
[281] Fix | Delete
#ifdef __USE_XOPEN2K
[282] Fix | Delete
/* Advice the system about the expected behaviour of the application with
[283] Fix | Delete
respect to the file associated with FD. */
[284] Fix | Delete
# ifndef __USE_FILE_OFFSET64
[285] Fix | Delete
extern int posix_fadvise (int __fd, off_t __offset, off_t __len,
[286] Fix | Delete
int __advise) __THROW;
[287] Fix | Delete
# else
[288] Fix | Delete
# ifdef __REDIRECT_NTH
[289] Fix | Delete
extern int __REDIRECT_NTH (posix_fadvise, (int __fd, __off64_t __offset,
[290] Fix | Delete
__off64_t __len, int __advise),
[291] Fix | Delete
posix_fadvise64);
[292] Fix | Delete
# else
[293] Fix | Delete
# define posix_fadvise posix_fadvise64
[294] Fix | Delete
# endif
[295] Fix | Delete
# endif
[296] Fix | Delete
# ifdef __USE_LARGEFILE64
[297] Fix | Delete
extern int posix_fadvise64 (int __fd, off64_t __offset, off64_t __len,
[298] Fix | Delete
int __advise) __THROW;
[299] Fix | Delete
# endif
[300] Fix | Delete
[301] Fix | Delete
[302] Fix | Delete
/* Reserve storage for the data of the file associated with FD.
[303] Fix | Delete
[304] Fix | Delete
This function is a possible cancellation point and therefore not
[305] Fix | Delete
marked with __THROW. */
[306] Fix | Delete
# ifndef __USE_FILE_OFFSET64
[307] Fix | Delete
extern int posix_fallocate (int __fd, off_t __offset, off_t __len);
[308] Fix | Delete
# else
[309] Fix | Delete
# ifdef __REDIRECT
[310] Fix | Delete
extern int __REDIRECT (posix_fallocate, (int __fd, __off64_t __offset,
[311] Fix | Delete
__off64_t __len),
[312] Fix | Delete
posix_fallocate64);
[313] Fix | Delete
# else
[314] Fix | Delete
# define posix_fallocate posix_fallocate64
[315] Fix | Delete
# endif
[316] Fix | Delete
# endif
[317] Fix | Delete
# ifdef __USE_LARGEFILE64
[318] Fix | Delete
extern int posix_fallocate64 (int __fd, off64_t __offset, off64_t __len);
[319] Fix | Delete
# endif
[320] Fix | Delete
#endif
[321] Fix | Delete
[322] Fix | Delete
[323] Fix | Delete
/* Define some inlines helping to catch common problems. */
[324] Fix | Delete
#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function \
[325] Fix | Delete
&& defined __va_arg_pack_len
[326] Fix | Delete
# include <bits/fcntl2.h>
[327] Fix | Delete
#endif
[328] Fix | Delete
[329] Fix | Delete
__END_DECLS
[330] Fix | Delete
[331] Fix | Delete
#endif /* fcntl.h */
[332] Fix | Delete
[333] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function