summaryrefslogtreecommitdiffstats
path: root/sys/dev/syscons/scvidctl.c
diff options
context:
space:
mode:
authortanimura <tanimura@FreeBSD.org>2002-02-23 11:12:57 +0000
committertanimura <tanimura@FreeBSD.org>2002-02-23 11:12:57 +0000
commita09da298590e8c11ebafa37f79e0046814665237 (patch)
tree2289c653c0f7aa23498f82b603c33107952652ec /sys/dev/syscons/scvidctl.c
parent33e8ee5265ca2838260ab581a9cebdedb1e1e29b (diff)
downloadFreeBSD-src-a09da298590e8c11ebafa37f79e0046814665237.zip
FreeBSD-src-a09da298590e8c11ebafa37f79e0046814665237.tar.gz
Lock struct pgrp, session and sigio.
New locks are: - pgrpsess_lock which locks the whole pgrps and sessions, - pg_mtx which protects the pgrp members, and - s_mtx which protects the session members. Please refer to sys/proc.h for the coverage of these locks. Changes on the pgrp/session interface: - pgfind() needs the pgrpsess_lock held. - The caller of enterpgrp() is responsible to allocate a new pgrp and session. - Call enterthispgrp() in order to enter an existing pgrp. - pgsignal() requires a pgrp lock held. Reviewed by: jhb, alfred Tested on: cvsup.jp.FreeBSD.org (which is a quad-CPU machine running -current)
Diffstat (limited to 'sys/dev/syscons/scvidctl.c')
-rw-r--r--sys/dev/syscons/scvidctl.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/sys/dev/syscons/scvidctl.c b/sys/dev/syscons/scvidctl.c
index b28752b..9e142d0 100644
--- a/sys/dev/syscons/scvidctl.c
+++ b/sys/dev/syscons/scvidctl.c
@@ -36,6 +36,11 @@
#include <sys/kernel.h>
#include <sys/fbio.h>
#include <sys/consio.h>
+#include <sys/filedesc.h>
+#include <sys/lock.h>
+#include <sys/sx.h>
+#include <sys/mutex.h>
+#include <sys/proc.h>
#include <dev/fb/fbreg.h>
#include <dev/syscons/syscons.h>
@@ -228,7 +233,11 @@ sc_set_text_mode(scr_stat *scp, struct tty *tp, int mode, int xsize, int ysize,
|| tp->t_winsize.ws_row != scp->ysize) {
tp->t_winsize.ws_col = scp->xsize;
tp->t_winsize.ws_row = scp->ysize;
- pgsignal(tp->t_pgrp, SIGWINCH, 1);
+ if (tp->t_pgrp != NULL) {
+ PGRP_LOCK(tp->t_pgrp);
+ pgsignal(tp->t_pgrp, SIGWINCH, 1);
+ PGRP_UNLOCK(tp->t_pgrp);
+ }
}
return 0;
@@ -291,7 +300,11 @@ sc_set_graphics_mode(scr_stat *scp, struct tty *tp, int mode)
|| tp->t_winsize.ws_ypixel != scp->ypixel) {
tp->t_winsize.ws_xpixel = scp->xpixel;
tp->t_winsize.ws_ypixel = scp->ypixel;
- pgsignal(tp->t_pgrp, SIGWINCH, 1);
+ if (tp->t_pgrp != NULL) {
+ PGRP_LOCK(tp->t_pgrp);
+ pgsignal(tp->t_pgrp, SIGWINCH, 1);
+ PGRP_UNLOCK(tp->t_pgrp);
+ }
}
return 0;
@@ -423,7 +436,11 @@ sc_set_pixel_mode(scr_stat *scp, struct tty *tp, int xsize, int ysize,
|| tp->t_winsize.ws_row != scp->ysize) {
tp->t_winsize.ws_col = scp->xsize;
tp->t_winsize.ws_row = scp->ysize;
- pgsignal(tp->t_pgrp, SIGWINCH, 1);
+ if (tp->t_pgrp != NULL) {
+ PGRP_LOCK(tp->t_pgrp);
+ pgsignal(tp->t_pgrp, SIGWINCH, 1);
+ PGRP_UNLOCK(tp->t_pgrp);
+ }
}
return 0;
OpenPOWER on IntegriCloud