fcntl.h revision 7a5aac98bc37534537d4896efd4efd30627d221e
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 1998 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
* Copyright 2015 Joyent, Inc. All rights reserved.
*/
/* 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.
*/
#ifndef _SYS_FCNTL_H
#define _SYS_FCNTL_H
#ifndef _SYS_TYPES_H
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* Flag values accessible to open(2) and fcntl(2) */
/* (The first three can only be set by open) */
#define O_RDONLY 0
#define O_WRONLY 1
#define O_RDWR 2
#ifdef _LARGEFILE_SOURCE
#define O_LARGEFILE 0x2000
#endif
/* Flag values accessible only to open(2) */
/* fcntl(2) requests */
#define F_DUPFD 0 /* Duplicate fildes */
/*
* symbol "_KMEMUSER" is defined for this purpose.
* to an "_LTYPES" definition.
*/
#else /* user definition */
#if defined(_LTYPES) /* EFT definition */
#else
#endif /* defined(_LTYPES) */
#endif /* defined(_KERNEL) */
#ifndef FOPEN
#define FOPEN 0xFFFFFFFF
#define FREAD 0x01
#define FWRITE 0x02
#define FNDELAY 0x04
#define FAPPEND 0x08
#define FSYNC 0x10
#define FNONBLOCK 0x80
/* open-only modes */
#define FCREAT 0x0100
#define FTRUNC 0x0200
#define FEXCL 0x0400
#define FNOCTTY 0x0800
#define FASYNC 0x1000
/* file descriptor flags */
#endif
/*
* File segment locking set data type - information passed to system by user.
*/
/* EFT definition */
typedef struct flock {
short l_type;
short l_whence;
int l_sysid;
} flock_t;
typedef struct o_flock {
short l_type;
short l_whence;
int l_start;
int l_len; /* len == 0 means until end of file */
short l_sysid;
} o_flock_t;
#else /* user level definition */
#if defined(_STYPES)
/* SVR3 definition */
typedef struct flock {
short l_type;
short l_whence;
short l_sysid;
} flock_t;
#else
typedef struct flock {
short l_type;
short l_whence;
int l_sysid;
} flock_t;
#endif /* define(_STYPES) */
#endif /* defined(_KERNEL) */
/*
* File segment locking types.
*/
/*
* POSIX constants
*/
/* large file compilation environment setup */
#ifdef __PRAGMA_REDEFINE_EXTNAME
#else
#endif
#endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */
#if defined(_LP64) && defined(_LARGEFILE64_SOURCE)
#ifdef __PRAGMA_REDEFINE_EXTNAME
#else
#endif
#endif /* _LP64 && _LARGEFILE64_SOURCE */
#if defined(__STDC__)
extern int fcntl(int, int, ...);
extern int open(const char *, int, ...);
!defined(__PRAGMA_REDEFINE_EXTNAME))
extern int open64(const char *, int, ...);
#endif
#endif
#ifdef __cplusplus
}
#endif
#endif /* _SYS_FCNTL_H */