/*
 * Libraries and headers for PDC release 3.3 (C) 1989 Lionel Hummel.
 * PDC Software Distribution (C) 1989 Lionel Hummel and Paul Petersen.
 * PDC I/O Library (C) 1987 by J.A. Lydiatt.
 *
 * This code is freely redistributable upon the conditions that this 
 * notice remains intact and that modified versions of this file not
 * be included as part of the PDC Software Distribution without the
 * express consent of the copyright holders.  No warrantee of any
 * kind is provided with this code.  For further information, contact:
 *
 *  PDC Software Distribution    Internet:                     BIX:
 *  P.O. Box 4006             or hummel@cs.uiuc.edu            lhummel
 *  Urbana, IL  61801-8801       petersen@uicsrd.csrd.uiuc.edu
 */

/*
 *  fcntl.h
 *
 *  Structures and symbolic constants used by PDC to manage file I/O.
 */

/*
 * 14.7.91 sjw; mods to allow dup(), dup2() implementation.  _devtab[]
 *              now points to an array of _devices rather than being one.
 *              I've included the two declarations here to make sure the
 *              correct interpretation is being used.  Also, ensure
 *              only effective once.
 */

#ifndef __FCNTL_H__
#define __FCNTL_H__

#define O_RDONLY	0x0000
#define O_WRONLY	0x0001
#define O_RDWR		0x0002
#define O_CREAT		0x0100
#define O_TRUNC		0x0200
#define O_EXCL		0x0400
#define O_APPEND	0x0800
#define O_STDIO		0x1000

#define _DO_FSTAT

struct _device {
    long	_useCount;	/* Number of users of this descriptor   */
    long	_fileHandle;	/* Actually, a (struct FileHandle *)	*/
    long	_mode;		/* The mode flags of this device	*/
#ifdef _DO_FSTAT
    long        _lock;		/* Lock when reading (for fstat)        */
#endif
};

extern struct _device *_devtab[];
extern struct _device __devtab[];

#define OPEN_MAX	20
extern short _numdev;	/* may not be the same as OPEN_MAX */

#define DEF_PMODE 0666L

#endif /* __FCNTL_H__ */


