enum
{
	Nfd = 100,		/* maximum number of open fds */
};

enum
{
	Tfree,		/* not used */
	Tfile,		/* a regular file */
	Tpipe,		/* a pipe */
	Tstdin,		/* pipe acting as an interactive stdin - notices ctl-d */
	Tdir,		/* a directory */
};

typedef struct File File;
struct File
{
	QLock lk;
	int type;
	/* the following is zeroed when a File is allocated */
	char *path;
	int qid;
	int mode;	/* mode that file was opened for */
	int eof;	/* reached eof - but has not closed */
	int offset;	/* offset within file */
	int ufd;	/* unix file descriptor */
	int pmfd;
	char *dents;
	int rdents;
	int wdents;
	int mdents;
};


RWLock pm_dotlk;

File *pm_lockfile(int, int);
File *pm_allocfile(int);
int pm_closefile(File*);
void pm_fdinit(void);
char *pm_openpath(char*);
int pm_stat2buf(struct stat*, char*, uchar*, uint);
int pm_pmfd2ufd(int);
