#include <u.h>
#include <libc.h>
#define NODEFINE
#include <9pm/u.h>
#include <9pm/libc.h>

/*
 * Make the internal view of the file descriptors consistent
 * with the view held by the outside world, so that (say) if
 * we exec, we will see the appropriate file descriptors.
 *
 * On Windows, we can only specify three file descriptors:
 * stdin, stdout, and stderr.  For consistency we only handle
 * the first three file descriptors everywhere.  The others are
 * silently closed.
 */
void
pm_fdcoherence(void)
{


	rfork(RFFDG);
	m = getproc()->fgrp->mchan;
	for(i=3; i<m; i++)
		close(i);


syntax highlighted by Code2HTML, v. 0.9.1