File:  [MW Coherent from dump] / coherent / d / PS2_KERNEL / coh.286 / fifo_rewind.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:39 2019 UTC (7 years ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent

/* fifo_rewind.c -- Rewind an internally typed fifo.  */
#include <sys/typed.h>

/* Go back to the start of the fifo.
 * Takes a FIFO.  For reading, go back to the first space; for writing
 * truncate the FIFO to empty.
 * Returns 1 on success, 0 otherwise.
 */
int
fifo_rewind(ffp)
	FIFO *ffp;
{
	/* Error checking of arguments.  */
	if (0 == ffp->f_flags) {
		return(0);	/* This ffp is not open.  */
	}

	/* Either reading or writing MUST be set.  */
	if ((F_READ != F_READ & ffp->f_flags) &&
	    (F_WRITE != F_WRITE & ffp->f_flags) ){
		return(0);	/* Illegal flags.  */
	}

	/* Rewind to the first space in this fifo (skip the header).  */
	ffp->f_offset = ((typed_space *) (ffp->f_space)) + 1;

	return(1);
} /* fifo_rewind() */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.