asst3-Virtual Memory Translation/kern/syscall/runprogram.c
static
int
placed_open(const char *path, int openflags, int fd)
{
	struct openfile *newfile, *oldfile;
	char mypath[32];
	int result;

	/*
	 * The filename comes from the kernel, in fact right in this
	 * file; assume reasonable length. But make sure we fit.
	 */
	KASSERT(strlen(path) < sizeof(mypath));
	strcpy(mypath, path);

	result = openfile_open(mypath, openflags, 0664, &newfile);
	if (result) {
		return result;
	}

	/* place the file in the filetable in the right slot */
	filetable_placeat(curproc->p_filetable, newfile, fd, &oldfile);

	/* the table should previously have been empty */
	KASSERT(oldfile == NULL);

	return 0;
}
/*
 * Open a file on a selected file descriptor. Takes care of various
 * minutiae, like the vfs-level open destroying pathnames.
 */
Open a file on a selected file descriptor. Takes care of various
minutiae, like the vfs-level open destroying pathnames.
Open a file on a selected file descriptor . Takes care of various minutiae like the vfs - level open destroying pathnames .
static
int
placed_open(const char *path, int openflags, int fd)
{
	struct openfile *newfile, *oldfile;
	char mypath[32];
	int result;
	KASSERT(strlen(path) < sizeof(mypath));
	strcpy(mypath, path);
	result = openfile_open(mypath, openflags, 0664, &newfile);
	if (result) {
		return result;
	}
	filetable_placeat(curproc->p_filetable, newfile, fd, &oldfile);
	KASSERT(oldfile == NULL);
	return 0;
}
static int placed_open ( const char * path , int openflags , int fd ) { struct openfile * newfile , * oldfile ; char mypath [ 32 ] ; int result ; KASSERT ( strlen ( path ) < sizeof ( mypath ) ) ; strcpy ( mypath , path ) ; result = openfile_open ( mypath , openflags , 0664 , & newfile ) ; if ( result ) { return result ; } filetable_placeat ( curproc -> p_filetable , newfile , fd , & oldfile ) ; KASSERT ( oldfile == NULL ) ; return 0 ; }
Open a file on a selected file descriptor.
Open a file on a selected file descriptor .
/*
	 * The filename comes from the kernel, in fact right in this
	 * file; assume reasonable length. But make sure we fit.
	 */ /* place the file in the filetable in the right slot */ /* the table should previously have been empty */