diff options
author | nik <nik@FreeBSD.org> | 2001-05-18 08:52:56 +0000 |
---|---|---|
committer | nik <nik@FreeBSD.org> | 2001-05-18 08:52:56 +0000 |
commit | 288113e7a883fb602d402afb36dcb3622557dc49 (patch) | |
tree | c24af2c4620d7753503d3ed10c761a68f06eb10c /sys/dev/syscons | |
parent | 85b499e6f868ac8c73b82e03d9db2515e623c786 (diff) | |
download | FreeBSD-src-288113e7a883fb602d402afb36dcb3622557dc49.zip FreeBSD-src-288113e7a883fb602d402afb36dcb3622557dc49.tar.gz |
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 <joelh@gnu.org>
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.
Diffstat (limited to 'sys/dev/syscons')
-rw-r--r-- | sys/dev/syscons/syscons.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index da11de9..f3305c4 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; |