asst3-Virtual Memory Translation/kern/syscall/file_syscalls.c
int
sys_chdir(const_userptr_t path)
{
	char *pathbuf;
	int result;

	pathbuf = kmalloc(PATH_MAX);
	if (pathbuf == NULL) {
		return ENOMEM;
	}

	result = copyinstr(path, pathbuf, PATH_MAX, NULL);
	if (result) {
		kfree(pathbuf);
		return result;
	}

	result = vfs_chdir(pathbuf);
	kfree(pathbuf);
	return result;
}
/*
 * chdir() - change directory. Send the path off to the vfs layer.
 */
change directory. Send the path off to the vfs layer.
change directory . Send the path off to the vfs layer .
int
sys_chdir(const_userptr_t path)
{
	char *pathbuf;
	int result;
	pathbuf = kmalloc(PATH_MAX);
	if (pathbuf == NULL) {
		return ENOMEM;
	}
	result = copyinstr(path, pathbuf, PATH_MAX, NULL);
	if (result) {
		kfree(pathbuf);
		return result;
	}
	result = vfs_chdir(pathbuf);
	kfree(pathbuf);
	return result;
}
int sys_chdir ( const_userptr_t path ) { char * pathbuf ; int result ; pathbuf = kmalloc ( PATH_MAX ) ; if ( pathbuf == NULL ) { return ENOMEM ; } result = copyinstr ( path , pathbuf , PATH_MAX , NULL ) ; if ( result ) { kfree ( pathbuf ) ; return result ; } result = vfs_chdir ( pathbuf ) ; kfree ( pathbuf ) ; return result ; }
chdir() - change directory.
chdir () - change directory .