Beispiel #1
0
char*
fsclose(Qid qid, int mode)
{
	if(mode&ORCLOSE)	/* remove on close */
		return fsremove(qid);
	return nil;
}
Beispiel #2
0
void
xrm(int argc, char **argv)
{
	int i;
	CFsys *fs;
	char *p;

	ARGBEGIN{
	default:
		usage();
	}ARGEND
	
	if(argc == 0)
		usage();
	
	for(i=0; i<argc; i++){
		fs = xparse(argv[i], &p);
		if(fsremove(fs, p) < 0)
			fprint(2, "remove %s: %r\n", argv[i]);
		fsunmount(fs);
	}
}
Beispiel #3
0
/*
 * sysmkfifo
 */
FILE *
sysmkfifo(const char *ospath)
{
	FILE	*fifo;
	int	result;
	int	fn;
	struct  stat buf;

	/* if file already exists AND is a pipefile, remove it */
	if(!stat(ospath, &buf) && S_ISFIFO(buf.st_mode))
		fsremove(ospath);

	result = mkfifo(ospath, 0600);
	if(result != 0)
		return NULL;

	fifo = fopen(ospath, "w+");
	if(fifo){
		fn = fileno(fifo);
		fcntl(fn, F_SETFL, O_NONBLOCK);
	}

	return fifo;
}