Bool keydown(wm_t *wm, wm_event_t *event) { XKeyEvent kev = event->xevent->xkey; KeySym sym; wm_log(wm, LOG_INFO, "%s", __func__); sym = XKeycodeToKeysym(wm->dpy, kev.keycode, 0); wm_log(wm, LOG_INFO, "%s: key %d / %d", __func__, sym, XK_j); if (kev.state == Mod1Mask) { switch (sym) { case XK_j: container_split(current_container, SPLIT_VERTICAL); break; case XK_h: container_split(current_container, SPLIT_HORIZONTAL); break; default: wm_log(wm, LOG_WARN, "%s: unexpected keysym %d", __func__, sym); } } switch (sym) { case XK_Return: run("xterm -bg black -fg white"); break; } XUngrabServer(wm->dpy); return True; }
int MPTKern_test1() { unsigned int vaddr = 4096*1024*300; container_split(0, 100); if (get_ptbl_entry_by_va(1, vaddr) != 0) { dprintf("test 1.1 failed.\n"); return 1; } if (get_pdir_entry_by_va(1, vaddr) != 0) { dprintf("test 1.2 failed.\n"); return 1; } map_page(1, vaddr, 100, 7); if (get_ptbl_entry_by_va(1, vaddr) == 0) { dprintf("test 1.3 failed.\n"); return 1; } if (get_pdir_entry_by_va(1, vaddr) == 0) { dprintf("test 1.4 failed.\n"); return 1; } unmap_page(1, vaddr); if (get_ptbl_entry_by_va(1, vaddr) != 0) { dprintf("test 1.5 failed.\n"); return 1; } dprintf("test 1 passed.\n"); return 0; }
/** * Designate some memory quota for the next child process. */ unsigned int alloc_mem_quota (unsigned int id, unsigned int quota) { unsigned int child; child = container_split (id, quota); return child; }