asst3-Virtual Memory Translation/kern/syscall/runprogram.c
static
int
open_stdfds(const char *inpath, const char *outpath, const char *errpath)
{
	int result;

	result = placed_open(inpath, O_RDONLY, STDIN_FILENO);
	if (result) {
		return result;
	}

	result = placed_open(outpath, O_WRONLY, STDOUT_FILENO);
	if (result) {
		return result;
	}

	result = placed_open(errpath, O_WRONLY, STDERR_FILENO);
	if (result) {
		return result;
	}

	return 0;
}
/*
 * Open the standard file descriptors: stdin, stdout, stderr.
 *
 * Note that if we fail part of the way through we can leave the fds
 * we've already opened in the file table and they'll get cleaned up
 * by process exit.
 */
Open the standard file descriptors: stdin, stdout, stderr.
Note that if we fail part of the way through we can leave the fds
we've already opened in the file table and they'll get cleaned up
by process exit.
Open the standard file descriptors : stdin stdout stderr . Note that if we fail part of the way through we can leave the fds we ' ve already opened in the file table and they ' ll get cleaned up by process exit .
static
int
open_stdfds(const char *inpath, const char *outpath, const char *errpath)
{
	int result;
	result = placed_open(inpath, O_RDONLY, STDIN_FILENO);
	if (result) {
		return result;
	}
	result = placed_open(outpath, O_WRONLY, STDOUT_FILENO);
	if (result) {
		return result;
	}
	result = placed_open(errpath, O_WRONLY, STDERR_FILENO);
	if (result) {
		return result;
	}
	return 0;
}
static int open_stdfds ( const char * inpath , const char * outpath , const char * errpath ) { int result ; result = placed_open ( inpath , O_RDONLY , STDIN_FILENO ) ; if ( result ) { return result ; } result = placed_open ( outpath , O_WRONLY , STDOUT_FILENO ) ; if ( result ) { return result ; } result = placed_open ( errpath , O_WRONLY , STDERR_FILENO ) ; if ( result ) { return result ; } return 0 ; }
Open the standard file descriptors: stdin, stdout, stderr.
Open the standard file descriptors : stdin stdout stderr .