From 96bf38f272780fdf94071cb9580afd2bb7cf9851 Mon Sep 17 00:00:00 2001 From: Nik Clayton Date: Fri, 18 May 2001 08:52:56 +0000 Subject: Add a new ioctl to syscons, CONS_SCRSHOT. Given a userland buffer, it copies out the current contents of the video buffer for a syscons terminal, providing a snapshot of the text and attributes. Based heavily on work originally submitted by Joel Holveck for 2.2.x almost 30 months ago, which I cleaned up a little, and forward ported to -current. See also the usr.bin/scrshot utility. --- sys/dev/syscons/syscons.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'sys/dev') diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index da11de91c9a4..f3305c4eb8e9 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -838,6 +838,24 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) splx(s); return 0; + case CONS_SCRSHOT: /* get a screen shot */ + { + scrshot_t *ptr = (scrshot_t*)data; + s = spltty(); + if (ISGRAPHSC(scp)) { + splx(s); + return EOPNOTSUPP; + } + if (scp->xsize != ptr->xsize || scp->ysize != ptr->ysize) { + splx(s); + return EINVAL; + } + copyout ((void*)scp->vtb.vtb_buffer, ptr->buf, + ptr->xsize * ptr->ysize * sizeof(u_int16_t)); + splx(s); + return 0; + } + case VT_SETMODE: /* set screen switcher mode */ { struct vt_mode *mode; -- cgit v1.3