int sys_dup2(unsigned int oldfd, unsigned int newfd)
{
+ if (oldfd >= NR_OPEN || !current->filp[oldfd])
+ return -EBADF;
if (newfd == oldfd)
return newfd;
sys_close(newfd);
void copy_to_cooked(struct tty_struct * tty);
void update_screen(int new_console);
+void blank_screen(void);
+void unblank_screen(void);
int kill_pg(int pgrp, int sig, int priv);
wake_up(&bh->b_wait);
}
-extern inline void next_buffer(int uptodate)
-{
- struct buffer_head *tmp;
-
- CURRENT->bh->b_uptodate = uptodate;
- unlock_buffer(CURRENT->bh);
- if (!uptodate) {
- printk(DEVICE_NAME " I/O error\n\r");
- printk("dev %04x, block %d\n\r",CURRENT->dev,
- CURRENT->bh->b_blocknr);
- }
- tmp = CURRENT->bh;
- CURRENT->bh = CURRENT->bh->b_reqnext;
- tmp->b_reqnext = NULL;
- if (!CURRENT->bh)
- panic("next_buffer: request buffer list destroyed\r\n");
- CURRENT->buffer = CURRENT->bh->b_data;
- CURRENT->errors = 0;
-}
-
extern inline void end_request(int uptodate)
{
struct request * tmp;
wake_up(&wait_for_request);
}
+extern inline void next_buffer(int uptodate)
+{
+ struct buffer_head *tmp;
+
+ tmp = CURRENT->bh;
+ CURRENT->bh = tmp->b_reqnext;
+ tmp->b_reqnext = NULL;
+ tmp->b_uptodate = uptodate;
+ unlock_buffer(tmp);
+ if (!uptodate) {
+ printk(DEVICE_NAME " I/O error\n\r");
+ printk("dev %04x, block %d\n\r",tmp->b_dev, tmp->b_blocknr);
+ }
+ if (!CURRENT->bh) {
+ printk("next_buffer: request buffer list destroyed\r\n");
+ end_request(0);
+ return;
+ }
+ CURRENT->buffer = CURRENT->bh->b_data;
+ CURRENT->errors = 0;
+}
+
#ifdef DEVICE_INTR
#define CLEAR_INTR SET_INTR(NULL)
#else
return;
if (++CURRENT->errors >= MAX_ERRORS)
if (CURRENT->bh && CURRENT->nr_sectors > 2) {
- CURRENT->nr_sectors &= ~1;
+ CURRENT->nr_sectors--;
+ CURRENT->sector++;
+ if (CURRENT->nr_sectors & 1) {
+ CURRENT->nr_sectors--;
+ CURRENT->sector++;
+ }
next_buffer(0);
} else
end_request(0);
cli();
if (++CURRENT->errors >= MAX_ERRORS)
if (CURRENT->bh && CURRENT->nr_sectors > 2) {
- CURRENT->nr_sectors &= ~1;
+ CURRENT->nr_sectors--;
+ CURRENT->sector++;
+ if (CURRENT->nr_sectors & 1) {
+ CURRENT->nr_sectors--;
+ CURRENT->sector++;
+ }
next_buffer(0);
} else
end_request(0);
INIT_C_CC \
}
-static void blank_screen(void);
-static void unblank_screen(void);
-
/*
* These are set up by the setup-routine at boot-time:
*/
{
if (video_type != VIDEO_TYPE_EGAC && video_type != VIDEO_TYPE_EGAM)
return;
- if (currcons != fg_console)
+ if (currcons != fg_console || vt_cons[currcons].vt_mode == KD_GRAPHICS)
return;
cli();
outb_p(12, video_port_reg);
printk("con_write: illegal tty\n\r");
return;
}
- if (vt_cons[currcons].vt_mode == KD_GRAPHICS) {
- flush(tty->write_q);
- return; /* no output in graphics mode */
- }
while (!tty->stopped && (c = GETCH(tty->write_q)) >= 0) {
if (c == 24 || c == 26)
state = ESnormal;
state = ESnormal;
}
}
- set_cursor(currcons);
timer_active &= ~(1<<BLANK_TIMER);
+ if (vt_cons[currcons].vt_mode == KD_GRAPHICS)
+ return;
+ set_cursor(currcons);
if (currcons == fg_console)
if (console_blanked) {
timer_table[BLANK_TIMER].expires = 0;
if (currcons<0 || currcons>=NR_CONSOLES)
currcons = 0;
- if (vt_cons[currcons].vt_mode == KD_GRAPHICS)
- return; /* no output in graphics mode */
while (c = *(b++)) {
if (c == 10) {
cr(currcons);
#include <linux/sched.h>
#include <linux/tty.h>
+#include <linux/timer.h>
#include <linux/kernel.h>
#include "vt_kern.h"
default:
return -EINVAL;
}
- vt_cons[console].vt_mode = arg;
+ if (vt_cons[console].vt_mode == (unsigned char) arg)
+ return 0;
+ vt_cons[console].vt_mode = (unsigned char) arg;
+ if (console != fg_console)
+ return 0;
+ if (arg == KD_TEXT)
+ unblank_screen();
+ else {
+ timer_active &= 1<<BLANK_TIMER;
+ blank_screen();
+ }
return 0;
case KDGETMODE:
verify_area((void *) arg, sizeof(unsigned long));