fcntlcom.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* Copyright (c) 1998,2001 by Sun Microsystems, Inc.
* All rights reserved.
*/
/*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
#ifndef __SYS_FCNTLCOM_H
#define __SYS_FCNTLCOM_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Rewack the FXXXXX values as _FXXXX so that _POSIX_SOURCE works.
*/
/*
* Flag values for open(2) and fcntl(2)
* The kernel adds 1 to the open modes to turn it into some
* combination of FREAD and FWRITE.
*/
#define O_RDONLY 0 /* +1 == FREAD */
/* O_SYNC _FSYNC not posix, defined below */
#define O_NONBLOCK _FNONBLOCK
#ifndef _POSIX_SOURCE
/*
* Flags that work for fcntl(fd, F_SETFL, FXXXX)
*/
/*
* Flags that are disallowed for fcntl's (FCNTLCANT);
* used for opens, internal state, or locking.
*/
/*
* The rest of the flags, used only for opens
*/
#endif /* !_POSIX_SOURCE */
/* XXX close on exec request; must match UF_EXCLOSE in user.h */
/* fcntl(2) requests */
#define F_DUPFD 0 /* Duplicate fildes */
#ifndef _POSIX_SOURCE
#endif /* !_POSIX_SOURCE */
#ifndef _POSIX_SOURCE
#endif /* !_POSIX_SOURCE */
/* fcntl(2) flags (l_type field of flock structure) */
#ifndef _POSIX_SOURCE
#endif /* !_POSIX_SOURCE */
#include <sys/stdtypes.h>
/* file segment locking set data type - information passed to system by user */
struct flock {
short l_type; /* F_RDLCK, F_WRLCK, or F_UNLCK */
short l_whence; /* flag to choose starting offset */
long l_start; /* relative offset, in bytes */
long l_len; /* length, in bytes; 0 means lock to EOF */
short l_pid; /* returned with F_GETLK */
short l_xxx; /* reserved for future use */
};
#ifndef _POSIX_SOURCE
/* extended file segment locking set data type */
struct eflock {
short l_type; /* F_RDLCK, F_WRLCK, or F_UNLCK */
short l_whence; /* flag to choose starting offset */
long l_start; /* relative offset, in bytes */
long l_len; /* length, in bytes; 0 means lock to EOF */
short l_pid; /* returned with F_GETLK */
short l_xxx; /* reserved for future use */
long l_rpid; /* Remote process id wanting this lock */
long l_rsys; /* Remote system id wanting this lock */
};
#endif /* !_POSIX_SOURCE */
#ifndef KERNEL
int open(/* char *path, int flags, mode_t modes */);
int creat(/* char *path, mode_t modes */);
int fcntl(/* int fd, cmd, ... */);
#endif /* !KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* __SYS_FCNTLCOM_H */