/*
Copyright (c) 1993 Xerox Corporation.  All rights reserved.
*/
/*
 */

#ifndef	←←XR←fcntl←h
#define	←←XR←fcntl←h

#include <config/PCR←OS.h>

#define XR←O←RDONLY	0
#define XR←O←WRONLY	1
#define	XR←O←RDWR	2

#define	XR←O←APPEND	0x0008
#define	XR←O←CREAT	0x0200
#define	XR←O←TRUNC	0x0400
#define	XR←O←EXCL	0x0800
#define	XR←O←NOCTTY	0x8000
#define XR←O←NONBLOCK	0x4000

#define	XR←O←ACCMODE	0x3

/* close on exec request */
#define	XR←FD←CLOEXEC	1

/* fcntl(2) requests */
#define	XR←F←DUPFD	0	/* Duplicate fildes */
#define	XR←F←GETFD	1	/* Get fildes flags (close on exec) */
#define	XR←F←SETFD	2	/* Set fildes flags (close on exec) */
#define	XR←F←GETFL	3	/* Get file flags */
#define	XR←F←SETFL	4	/* Set file flags */
#define	XR←F←GETOWN 	5	/* Get owner - for ASYNC */
#define	XR←F←SETOWN 	6	/* Set owner - for ASYNC */
#define	XR←F←GETLK  	7	/* Get record-locking information */
#define	XR←F←SETLK  	8	/* Set or Clear a record-lock (Non-Blocking) */
#define	XR←F←SETLKW 	9	/* Set or Clear a record-lock (Blocking) */

/* fcntl(2) flags (l←type field of flock structure) */
#define	XR←F←RDLCK		1	/* read lock */
#define	XR←F←WRLCK		2	/* write lock */
#define	XR←F←UNLCK		3	/* remove lock(s) */

struct XR←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 */
};

#if defined(PCR←OS←SUNOS4)

#   include <fcntl.h>

#   define XR←fcntl←CmdToHost(cmd) (cmd)
#   define XR←fcntl←FlagToHost(flag) (flag)
#   define XR←fcntl←FlagFromHost(flag) (flag)
#   define XR←fcntl←FDToHost(fd) (fd)
#   define XR←fcntl←FDFromHost(fd) (fd)

extern void XR←fcntl←FLockToHost(struct flock *hfl, struct XR←flock *xfl);
extern void XR←fcntl←FLockFromHost(struct XR←flock *xfl, struct flock *hfl);

#elif defined(PCR←OS←SUNOS5)

#   include <fcntl.h>

extern int XR←fcntl←CmdToHost(int cmd);
extern int XR←fcntl←FlagToHost(int flag);
extern int XR←fcntl←FlagFromHost(int flag);
extern int XR←fcntl←FDToHost(int fd);
extern int XR←fcntl←FDFromHost(int fd);

extern void XR←fcntl←FLockToHost(struct flock *hfl, struct XR←flock *xfl);
extern void XR←fcntl←FLockFromHost(struct XR←flock *xfl, struct flock *hfl);

#else

#   error os ?

#endif

#endif	/* !←←XR←fcntl←h */