/** * <Ring 1> Perform the FCHDIR syscall. */ PUBLIC int do_fchdir(MESSAGE * p) { struct file_desc * filp = pcaller->filp[p->FD]; if (!filp) return EINVAL; return change_node(&(pcaller->pwd), filp->fd_inode); }
static void rotate_left (MonoSimpleBasicBlock *bb, MonoSimpleBasicBlock **root) { MonoSimpleBasicBlock *other = bb->right; if (other->left) { bb->right = other->left; bb->right->parent = bb; } else bb->right = NULL; other->left = bb; change_node (bb, other, root); bb->parent = other; }
static void rotate_right (MonoSimpleBasicBlock *parent, MonoSimpleBasicBlock **root) { MonoSimpleBasicBlock *bb = parent->left; if (bb->right) { parent->left = bb->right; parent->left->parent = parent; } else parent->left = NULL; bb->right = parent; change_node (parent, bb, root); parent->parent = bb; }
/** * <Ring 1> Change the directory. * @param ppin Directory to be change. * @param string Pathname. * @param len Length of pathname. * @return Zero on success. */ PRIVATE int change_directory(struct inode ** ppin, char * string, int len) { char pathname[MAX_PATH]; if (len > MAX_PATH) return ENAMETOOLONG; /* fetch the name */ data_copy(getpid(), D, pathname, proc2pid(pcaller), D, string, len); //phys_copy(va2pa(getpid(), pathname), va2pa(proc2pid(pcaller), string), len); pathname[len] = '\0'; struct inode * pin = resolve_path(pathname, pcaller); if (!pin) return err_code; int retval = change_node(ppin, pin); put_inode(pin); return retval; }