fcntl.h revision b075ad5b007248d50e4c2e838b460c9c7cfd9fad
/*
* 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 (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
* The Regents of the University of California
* All Rights Reserved
*
* University Acknowledgment- Portions of this document are derived from
* software developed by the University of California, Berkeley, and its
* contributors.
*/
/* Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. */
#ifndef _SYS_FCNTL_H
#define _SYS_FCNTL_H
#include <sys/feature_tests.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Flag values accessible to open(2) and fcntl(2)
* The first five can only be set (exclusively) by open(2).
*/
#define O_RDONLY 0
#define O_WRONLY 1
#define O_RDWR 2
#define O_SEARCH 0x200000
#define O_EXEC 0x400000
#if defined(__EXTENSIONS__) || !defined(_POSIX_C_SOURCE)
#endif /* defined(__EXTENSIONS__) || !defined(_POSIX_C_SOURCE) */
#if defined(__EXTENSIONS__) || !defined(_POSIX_C_SOURCE) || \
#endif /* defined(__EXTENSIONS__) || !defined(_POSIX_C_SOURCE) ... */
#ifdef _LARGEFILE_SOURCE
#define O_LARGEFILE 0x2000
#endif
/*
* Flag values accessible only to open(2).
*/
/*
* fcntl(2) requests
*
* N.B.: values are not necessarily assigned sequentially below.
*/
#define F_DUPFD 0 /* Duplicate fildes */
/*
* new symbol "_KMEMUSER" is defined for this purpose.
*/
/* the wire compatibility */
/* clustering: lock id contains both per-node sysid and node id */
#define SYSIDMASK 0x0000ffff
#define NODEIDMASK 0xffff0000
#define BITS_IN_SYSID 16
/* Clustering: Macro used for PXFS locks */
#endif /* defined(_KERNEL) */
/*
* Numbers 20-22 have been removed and should not be reused.
*/
/* manager */
/*
* Commands that refer to flock structures. The argument types differ between
* the large and small file environments; therefore, the #defined values must
* as well.
* The NBMAND forms are private and should not be used.
*/
/* "Native" application compilation environment */
#else
/* ILP32 large file application compilation environment version */
#endif /* _LP64 || _FILE_OFFSET_BITS == 32 */
#if defined(_LARGEFILE64_SOURCE)
/*
* transitional large file interface version
* These are only valid in a 32 bit application compiled with large files
* option, for source compatibility, the 64-bit versions are mapped back
* to the native versions.
*/
#else
#endif /* !_LP64 || _KERNEL */
#endif /* _LARGEFILE64_SOURCE */
/*
* File segment locking set data type - information passed to system by user.
*/
/* regular version, for both small and large file compilation environment */
typedef struct flock {
short l_type;
short l_whence;
int l_sysid;
} flock_t;
#if defined(_SYSCALL32)
/* Kernel's view of ILP32 flock structure */
typedef struct flock32 {
} flock32_t;
#endif /* _SYSCALL32 */
/* transitional large file interface version */
#if defined(_LARGEFILE64_SOURCE)
typedef struct flock64 {
short l_type;
short l_whence;
int l_sysid;
} flock64_t;
#if defined(_SYSCALL32)
/* Kernel's view of ILP32 flock64 */
#pragma pack(4)
#endif
typedef struct flock64_32 {
} flock64_32_t;
#pragma pack()
#endif
/* Kernel's view of LP64 flock64 */
typedef struct flock64_64 {
} flock64_64_t;
#endif /* _SYSCALL32 */
#endif /* _LARGEFILE64_SOURCE */
/* SVr3 flock type; needed for rfs across the wire compatibility */
typedef struct o_flock {
} o_flock_t;
#endif /* defined(_KERNEL) */
/*
* File segment locking types.
*/
/*
* POSIX constants
*/
/* Mask for file access modes */
/*
* DIRECTIO
*/
#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX)
#define DIRECTIO_OFF (0)
#define DIRECTIO_ON (1)
/*
* File share reservation type
*/
typedef struct fshare {
short f_access;
short f_deny;
int f_id;
} fshare_t;
/*
* f_access values
*/
/*
* f_deny values
*/
#endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) */
/*
* Special flags for functions such as openat(), fstatat()....
*/
#if !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE) || \
defined(__EXTENSIONS__)
/* || defined(_XPG7) */
#define AT_FDCWD 0xffd19553
#define AT_SYMLINK_NOFOLLOW 0x1000
#define AT_REMOVEDIR 0x1
#define _AT_TRIGGER 0x2
#endif
/* advice for posix_fadvise */
#define POSIX_FADV_NORMAL 0
#define POSIX_FADV_RANDOM 1
#define POSIX_FADV_SEQUENTIAL 2
#define POSIX_FADV_WILLNEED 3
#define POSIX_FADV_DONTNEED 4
#define POSIX_FADV_NOREUSE 5
#endif
#ifdef __cplusplus
}
#endif
#endif /* _SYS_FCNTL_H */