#include <sys/types.h>
#include <dirent.h>
#include <sys/time.h> 
#include <unistd.h>
#include <sys/stat.h>
#include <errno.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <sys/socket.h>

#define NODEFINE
#include <u.h>
#include <libc.h>
#include <fcall.h>
#include "fd.h"

int
pm_fd2path(int fd, char *path, int npath)
{
	File *f;
	
	if((f = pm_lockfile(fd, 0)) == nil)
		return -1;
	pm_utfecpy(path, path+npath, f->path);
	pm_qunlock(&f->lk);
	return 0;	/* BUG is this right? */
}


syntax highlighted by Code2HTML, v. 0.9.1