linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Linux 2.4.21-rc3, writing to /dev/console returns ESPIPE
@ 2003-05-25 11:22 Mitch
  2003-05-25 11:39 ` viro
  0 siblings, 1 reply; 3+ messages in thread
From: Mitch @ 2003-05-25 11:22 UTC (permalink / raw)
  To: linux-kernel


Hi,

With 21-rc3, syslogd (sysklogd package)  stopped writing
messages to  /dev/console anymore. In the log files i see:

	May 25 11:14:19 core syslogd: /dev/console: Illegal seek
	May 25 11:14:19 core syslogd 1.4.1: restart (remote reception).

And strace  shows
# strace echo foo >/dev/console

	write(1, "foo\n", 4)                    = -1 ESPIPE (Illegal seek)
	close(1)                                = 0
	munmap(0x40016000, 4096)                = 0
	write(2, "echo: ", 6echo: )             = 6
	write(2, "write error", 11write error)  = 11
	write(2, "\n", 1)                       = 1
	_exit(1)                                = ?

We all understand that /dev/console can't be seeked, but it shouldn't
be so strict in enforcing this or else syslogd and friends will fail
to work. Unfortunately Linux doesn't have a pwritev() to not update
the file pointer.

The checkin on linux-2.4.21-rc3/drivers/char/tty_io.c

+       /* Can't seek (pwrite) on ttys.  */
+       if (ppos != &file->f_pos)
+               return -ESPIPE;

should not be there in my opinion.

Comments ?
Mitch


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Linux 2.4.21-rc3, writing to /dev/console returns ESPIPE
  2003-05-25 11:22 Linux 2.4.21-rc3, writing to /dev/console returns ESPIPE Mitch
@ 2003-05-25 11:39 ` viro
  2003-05-25 11:52   ` viro
  0 siblings, 1 reply; 3+ messages in thread
From: viro @ 2003-05-25 11:39 UTC (permalink / raw)
  To: Mitch; +Cc: linux-kernel

On Sun, May 25, 2003 at 12:22:14PM +0100, Mitch@0Bits.COM wrote:
> The checkin on linux-2.4.21-rc3/drivers/char/tty_io.c
> 
> +       /* Can't seek (pwrite) on ttys.  */
> +       if (ppos != &file->f_pos)
> +               return -ESPIPE;
> 
> should not be there in my opinion.

s/not be/be not/

--- drivers/char/tty_io.c	Sat May 17 11:14:02 2003
+++ /tmp/tty_io.c	Sun May 25 07:37:37 2003
@@ -751,6 +751,10 @@
 	struct tty_struct * tty;
 	struct inode *inode = file->f_dentry->d_inode;
 
+	/* Can't seek (pwrite) on ttys.  */
+	if (ppos != &file->f_pos)
+		return -ESPIPE;
+
 	/*
 	 *      For now, we redirect writes from /dev/console as
 	 *      well as /dev/tty0.
@@ -775,10 +779,6 @@
 			return res;
 		}
 	}
-
-	/* Can't seek (pwrite) on ttys.  */
-	if (ppos != &file->f_pos)
-		return -ESPIPE;
 
 	tty = (struct tty_struct *)file->private_data;
 	if (tty_paranoia_check(tty, inode->i_rdev, "tty_write"))

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Linux 2.4.21-rc3, writing to /dev/console returns ESPIPE
  2003-05-25 11:39 ` viro
@ 2003-05-25 11:52   ` viro
  0 siblings, 0 replies; 3+ messages in thread
From: viro @ 2003-05-25 11:52 UTC (permalink / raw)
  To: Mitch; +Cc: linux-kernel

On Sun, May 25, 2003 at 12:39:12PM +0100, viro@parcelfarce.linux.theplanet.co.uk wrote:
> On Sun, May 25, 2003 at 12:22:14PM +0100, Mitch@0Bits.COM wrote:
> > The checkin on linux-2.4.21-rc3/drivers/char/tty_io.c
> > 
> > +       /* Can't seek (pwrite) on ttys.  */
> > +       if (ppos != &file->f_pos)
> > +               return -ESPIPE;
> > 
> > should not be there in my opinion.
> 
> s/not be/be not/

Grrr....  Correct patch follows:

--- drivers/char/tty_io.c	Sat May 17 11:14:02 2003
+++ /tmp/tty_io.c	Sun May 25 07:49:08 2003
@@ -751,6 +751,10 @@
 	struct tty_struct * tty;
 	struct inode *inode = file->f_dentry->d_inode;
 
+	/* Can't seek (pwrite) on ttys.  */
+	if (ppos != &file->f_pos)
+		return -ESPIPE;
+
 	/*
 	 *      For now, we redirect writes from /dev/console as
 	 *      well as /dev/tty0.
@@ -770,15 +774,11 @@
 		spin_unlock(&redirect_lock);
 
 		if (p) {
-			ssize_t res = p->f_op->write(p, buf, count, ppos);
+			ssize_t res = p->f_op->write(p, buf, count, &p->f_pos);
 			fput(p);
 			return res;
 		}
 	}
-
-	/* Can't seek (pwrite) on ttys.  */
-	if (ppos != &file->f_pos)
-		return -ESPIPE;
 
 	tty = (struct tty_struct *)file->private_data;
 	if (tty_paranoia_check(tty, inode->i_rdev, "tty_write"))

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-05-25 11:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-25 11:22 Linux 2.4.21-rc3, writing to /dev/console returns ESPIPE Mitch
2003-05-25 11:39 ` viro
2003-05-25 11:52   ` viro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).