Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/subr_terminal.c
Show First 20 Lines • Show All 474 Lines • ▼ Show 20 Lines | termtty_ioctl(struct tty *tp, u_long cmd, caddr_t data, struct thread *td) | ||||
/* | /* | ||||
* Unlike various other drivers, this driver will never | * Unlike various other drivers, this driver will never | ||||
* deallocate TTYs. This means it's safe to temporarily unlock | * deallocate TTYs. This means it's safe to temporarily unlock | ||||
* the TTY when handling ioctls. | * the TTY when handling ioctls. | ||||
*/ | */ | ||||
tty_unlock(tp); | tty_unlock(tp); | ||||
error = tm->tm_class->tc_ioctl(tm, cmd, data, td); | error = tm->tm_class->tc_ioctl(tm, cmd, data, td); | ||||
tty_lock(tp); | tty_lock(tp); | ||||
if (error != 0) | |||||
return (error); | |||||
switch (cmd) { | |||||
emaste: IMO it'd be fine to do `if (cmd == CONS_CLRHIST)` which neatly avoids the slightly confusing… | |||||
case CONS_CLRHIST: { | |||||
/* | |||||
* Scrollback history has been successfully cleared, | |||||
* so reset the cursor position to the top left of the screen. | |||||
*/ | |||||
teken_pos_t p; | |||||
p.tp_row = 0; | |||||
p.tp_col = 0; | |||||
teken_set_cursor(&tm->tm_emulator, &p); | |||||
Done Inline ActionsThis exposes a new issue: before, it was practically guaranteed that the cursor would be at the bottom of the screen, so the CLRHIST ioctl would be immediately followed by a scroll event that would invalidate the entire visible rect. Now that may no longer be the case: for example if you issue 'vidcontrol -C', then do a few things that don't fill the screen, then issue 'vidcontrol -C' again, some prior artifacts might still remain visible. Let me see if I can fix that... jah: This exposes a new issue: before, it was practically guaranteed that the cursor would be at the… | |||||
break; | |||||
} | |||||
} | |||||
return (error); | return (error); | ||||
} | } | ||||
static int | static int | ||||
termtty_mmap(struct tty *tp, vm_ooffset_t offset, vm_paddr_t * paddr, | termtty_mmap(struct tty *tp, vm_ooffset_t offset, vm_paddr_t * paddr, | ||||
int nprot, vm_memattr_t *memattr) | int nprot, vm_memattr_t *memattr) | ||||
{ | { | ||||
struct terminal *tm = tty_softc(tp); | struct terminal *tm = tty_softc(tp); | ||||
▲ Show 20 Lines • Show All 214 Lines • Show Last 20 Lines |
IMO it'd be fine to do if (cmd == CONS_CLRHIST) which neatly avoids the slightly confusing double } at the same indentation; we can deal with the awkwardness if we ever have a 2nd case to deal with. Yes, this is slightly inconsistent with the switch above.