From: <jsi...@us...> - 2007-04-11 20:19:39
|
Revision: 2372 http://linuxconsole.svn.sourceforge.net/linuxconsole/?rev=2372&view=rev Author: jsimmons Date: 2007-04-11 13:19:34 -0700 (Wed, 11 Apr 2007) Log Message: ----------- more updates Modified Paths: -------------- branches/ruby-2.6.21/ruby-2.6/drivers/char/vc_screen.c branches/ruby-2.6.21/ruby-2.6/drivers/char/vt.c branches/ruby-2.6.21/ruby-2.6/drivers/char/vt_ioctl.c Modified: branches/ruby-2.6.21/ruby-2.6/drivers/char/vc_screen.c =================================================================== --- branches/ruby-2.6.21/ruby-2.6/drivers/char/vc_screen.c 2007-04-11 19:53:20 UTC (rev 2371) +++ branches/ruby-2.6.21/ruby-2.6/drivers/char/vc_screen.c 2007-04-11 20:19:34 UTC (rev 2372) @@ -21,13 +21,10 @@ * - making it shorter - scr_readw are macros which expand in PRETTY long code */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/major.h> #include <linux/errno.h> #include <linux/tty.h> -#include <linux/devfs_fs_kernel.h> -#include <linux/sched.h> #include <linux/interrupt.h> #include <linux/mm.h> #include <linux/init.h> @@ -87,7 +84,7 @@ static loff_t vcs_lseek(struct file *file, loff_t offset, int orig) { - struct inode *inode = file->f_dentry->d_inode; + struct inode *inode = file->f_path.dentry->d_inode; struct vc_data *vc = file->private_data; long attr = iminor(inode) & 128; int size; @@ -115,10 +112,11 @@ return file->f_pos; } + static ssize_t vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { - struct inode *inode = file->f_dentry->d_inode; + struct inode *inode = file->f_path.dentry->d_inode; struct vc_data *vc = file->private_data; long attr = iminor(inode) & 128; unsigned short *org = NULL; @@ -284,7 +282,7 @@ static ssize_t vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { - struct inode *inode = file->f_dentry->d_inode; + struct inode *inode = file->f_path.dentry->d_inode; struct vc_data *vc = file->private_data; long viewed, size, written, pos; long attr = iminor(inode) & 128; @@ -472,43 +470,36 @@ return 0; } -static struct file_operations vcs_fops = { +static const struct file_operations vcs_fops = { .llseek = vcs_lseek, .read = vcs_read, .write = vcs_write, .open = vcs_open, }; -static struct class_simple *vc_class; +static struct class *vc_class; -void vcs_make_devfs(struct tty_struct *tty) +void vcs_make_sysfs(struct tty_struct *tty) { - devfs_mk_cdev(MKDEV(VCS_MAJOR, tty->index + 1), - S_IFCHR|S_IRUSR|S_IWUSR, - "vcc/%u", tty->index + 1); - devfs_mk_cdev(MKDEV(VCS_MAJOR, tty->index + 129), - S_IFCHR|S_IRUSR|S_IWUSR, - "vcc/a%u", tty->index + 1); - class_simple_device_add(vc_class, MKDEV(VCS_MAJOR, tty->index + 1), NULL, "vcs%u", tty->index + 1); - class_simple_device_add(vc_class, MKDEV(VCS_MAJOR, tty->index + 129), NULL, "vcsa%u", tty->index + 1); + device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 1), + "vcs%u", tty->index + 1); + device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 129), + "vcsa%u", tty->index + 1); } -void vcs_remove_devfs(struct tty_struct *tty) + +void vcs_remove_sysfs(struct tty_struct *tty) { - devfs_remove("vcc/%u", tty->index + 1); - devfs_remove("vcc/a%u", tty->index + 1); - class_simple_device_remove(MKDEV(VCS_MAJOR, tty->index + 1)); - class_simple_device_remove(MKDEV(VCS_MAJOR, tty->index + 129)); + device_destroy(vc_class, MKDEV(VCS_MAJOR, tty->index + 1)); + device_destroy(vc_class, MKDEV(VCS_MAJOR, tty->index + 129)); } int __init vcs_init(void) { if (register_chrdev(VCS_MAJOR, "vcs", &vcs_fops)) panic("unable to get major %d for vcs device", VCS_MAJOR); - vc_class = class_simple_create(THIS_MODULE, "vc"); + vc_class = class_create(THIS_MODULE, "vc"); - devfs_mk_cdev(MKDEV(VCS_MAJOR, 0), S_IFCHR|S_IRUSR|S_IWUSR, "vcc/0"); - devfs_mk_cdev(MKDEV(VCS_MAJOR, 128), S_IFCHR|S_IRUSR|S_IWUSR, "vcc/a0"); - class_simple_device_add(vc_class, MKDEV(VCS_MAJOR, 0), NULL, "vcs"); - class_simple_device_add(vc_class, MKDEV(VCS_MAJOR, 128), NULL, "vcsa"); + device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 0), "vcs"); + device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 128), "vcsa"); return 0; } Modified: branches/ruby-2.6.21/ruby-2.6/drivers/char/vt.c =================================================================== --- branches/ruby-2.6.21/ruby-2.6/drivers/char/vt.c 2007-04-11 19:53:20 UTC (rev 2371) +++ branches/ruby-2.6.21/ruby-2.6/drivers/char/vt.c 2007-04-11 20:19:34 UTC (rev 2372) @@ -1054,7 +1054,7 @@ vc->vt_mode.relsig = 0; vc->vt_mode.acqsig = 0; vc->vt_mode.frsig = 0; - vc->vt_pid = -1; + put_pid(vc->vt_pid); vc->vt_newvt = -1; if (!in_interrupt()) /* Via keyboard.c:SAK() - akpm */ reset_palette(vc) ; @@ -1163,6 +1163,28 @@ return 0; } +void vc_SAK(struct work_struct *work) +{ + struct vc *vc_con = + container_of(work, struct vc, SAK_work); + struct tty_struct *tty; + struct vc_data *vc; + + acquire_console_sem(); + vc = vc_con->d; + if (vc) { + tty = vc->vc_tty; + /* + * SAK should also work in all raw modes and reset + * them properly. + */ + if (tty) + __do_SAK(tty); + reset_vc(vc); + } + release_console_sem(); +} + /* * Selection stuff for GPM. */ Modified: branches/ruby-2.6.21/ruby-2.6/drivers/char/vt_ioctl.c =================================================================== --- branches/ruby-2.6.21/ruby-2.6/drivers/char/vt_ioctl.c 2007-04-11 19:53:20 UTC (rev 2371) +++ branches/ruby-2.6.21/ruby-2.6/drivers/char/vt_ioctl.c 2007-04-11 20:19:34 UTC (rev 2372) @@ -11,7 +11,6 @@ * Check put/get_user, cleanups - ac...@co... - Jun 2001 */ -#include <linux/config.h> #include <linux/types.h> #include <linux/errno.h> #include <linux/sched.h> @@ -82,10 +81,22 @@ add_wait_queue(&vt_activate_queue, &wait); for (;;) { + retval = 0; + + /* + * Synchronize with redraw_screen(). By acquiring the console + * semaphore we make sure that the console switch is completed + * before we return. If we didn't wait for the semaphore, we + * could return at a point where fg_console has already been + * updated, but the console switch hasn't been completed. + */ + acquire_console_sem(); set_current_state(TASK_INTERRUPTIBLE); - retval = 0; - if (IS_VISIBLE) + if (IS_VISIBLE) { + release_console_sem(); break; + } + release_console_sem(); retval = -EINTR; if (signal_pending(current)) break; @@ -108,6 +119,9 @@ if (copy_from_user(&tmp, user_kbe, sizeof(struct kbentry))) return -EFAULT; + if (!capable(CAP_SYS_TTY_CONFIG)) + perm = 0; + switch (cmd) { case KDGKBENT: key_map = key_maps[s]; @@ -122,7 +136,7 @@ if (!perm) return -EPERM; if (!i && v == K_NOSUCHMAP) { - /* disallocate map */ + /* deallocate map */ key_map = key_maps[s]; if (s && key_map) { key_maps[s] = NULL; @@ -154,7 +168,7 @@ !capable(CAP_SYS_RESOURCE)) return -EPERM; - key_map = (ushort *) kmalloc(sizeof(plain_map), GFP_KERNEL); + key_map = kmalloc(sizeof(plain_map), GFP_KERNEL); if (!key_map) return -ENOMEM; key_maps[s] = key_map; @@ -214,6 +228,9 @@ u_char __user *up; u_char *q; + if (!capable(CAP_SYS_TTY_CONFIG)) + perm = 0; + kbs = kmalloc(sizeof(*kbs), GFP_KERNEL); if (!kbs) { ret = -ENOMEM; @@ -275,7 +292,7 @@ sz = 256; while (sz < funcbufsize - funcbufleft + delta) sz <<= 1; - fnw = (char *) kmalloc(sz, GFP_KERNEL); + fnw = kmalloc(sz, GFP_KERNEL); if (!fnw) { ret = -ENOMEM; goto reterr; @@ -657,11 +674,11 @@ */ if (old_vc->vt_mode.mode == VT_PROCESS) { /* - * Send the signal as privileged - kill_proc() will + * Send the signal as privileged - kill_pid() will * tell us if the process has gone or something else * is awry */ - if (kill_proc(old_vc->vt_pid, old_vc->vt_mode.relsig, 1) == 0) { + if (kill_pid(old_vc->vt_pid, old_vc->vt_mode.relsig, 1) == 0) { /* * It worked. Mark the vt to switch to and * return. The process needs to send us a @@ -714,7 +731,7 @@ switch_screen(new_vc, old_vc); /* - * This can't appear below a successful kill_proc(). If it did, + * This can't appear below a successful kill_pid(). If it did, * then the *blank_screen operation could occur while X, having * received acqsig, is waking up on another processor. This * condition can lead to overlapping accesses to the VGA range @@ -739,11 +756,11 @@ */ if (new_vc->vt_mode.mode == VT_PROCESS) { /* - * Send the signal as privileged - kill_proc() will + * Send the signal as privileged - kill_pid() will * tell us if the process has gone or something else * is awry */ - if (kill_proc(new_vc->vt_pid,new_vc->vt_mode.acqsig, 1) != 0) { + if (kill_pid(new_vc->vt_pid,new_vc->vt_mode.acqsig, 1) != 0) { /* * The controlling process has died, so we revert back * to normal operation. In this case, we'll also change @@ -1054,13 +1071,16 @@ */ case KDSIGACCEPT: { - extern int spawnpid, spawnsig; if (!perm || !capable(CAP_KILL)) return -EPERM; if (!valid_signal(arg) || arg < 1 || arg == SIGKILL) return -EINVAL; - spawnpid = current->pid; - spawnsig = arg; + + spin_lock_irq(&vt_spawn_con.lock); + put_pid(vt_spawn_con.pid); + vt_spawn_con.pid = get_pid(task_pid(current)); + vt_spawn_con.sig = arg; + spin_unlock_irq(&vt_spawn_con.lock); return 0; } @@ -1078,7 +1098,8 @@ vc->vt_mode = tmp; /* the frsig is ignored, so we set it to 0 */ vc->vt_mode.frsig = 0; - vc->vt_pid = current->pid; + put_pid(vc->vt_pid); + vc->vt_pid = get_pid(task_pid(current)); /* no switch is required -- sa...@sh... */ vc->vt_newvt = -1; release_console_sem(); @@ -1248,13 +1269,13 @@ if (arg > MAX_NR_CONSOLES) return -ENXIO; if (arg == 0) { - /* disallocate all unused consoles, but leave visible VC */ + /* deallocate all unused consoles, but leave visible VC */ acquire_console_sem(); for (i = 1; i < vt->vc_count; i++) { tmp = find_vc(i + vt->first_vc); if (tmp && !VT_BUSY(tmp)) - vc_disallocate(tmp); + vc_deallocate(tmp); } release_console_sem(); } else { @@ -1263,7 +1284,7 @@ if (!tmp || VT_BUSY(tmp)) return -EBUSY; acquire_console_sem(); - vc_disallocate(tmp); + vc_deallocate(tmp); release_console_sem(); } return 0; @@ -1280,9 +1301,7 @@ for (i = 0; i < vc->display_fg->vc_count; i++) { struct vc_data *tmp = vc->display_fg->vc_cons[i]; - acquire_console_sem(); - vc_resize(tmp, cc, ll); - release_console_sem(); + vc_lock_resize(tmp, cc, ll); } return 0; } @@ -1441,6 +1460,8 @@ return -EPERM; vc->display_fg->vt_dont_switch = 0; return 0; + case VT_GETHIFONTMASK: + return put_user(vc->vc_hi_font_mask, (unsigned short __user *)arg); default: return -ENOIOCTLCMD; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |