Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
6387d4ea
Commit
6387d4ea
authored
Aug 07, 2004
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mark tty's as being non-seekable, and remove the now
unnecessary tests at read/write time.
parent
22782ffc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
17 deletions
+1
-17
drivers/char/tty_io.c
drivers/char/tty_io.c
+1
-17
No files found.
drivers/char/tty_io.c
View file @
6387d4ea
...
@@ -345,18 +345,12 @@ EXPORT_SYMBOL(tty_check_change);
...
@@ -345,18 +345,12 @@ EXPORT_SYMBOL(tty_check_change);
static
ssize_t
hung_up_tty_read
(
struct
file
*
file
,
char
__user
*
buf
,
static
ssize_t
hung_up_tty_read
(
struct
file
*
file
,
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
size_t
count
,
loff_t
*
ppos
)
{
{
/* Can't seek (pread) on ttys. */
if
(
ppos
!=
&
file
->
f_pos
)
return
-
ESPIPE
;
return
0
;
return
0
;
}
}
static
ssize_t
hung_up_tty_write
(
struct
file
*
file
,
const
char
__user
*
buf
,
static
ssize_t
hung_up_tty_write
(
struct
file
*
file
,
const
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
size_t
count
,
loff_t
*
ppos
)
{
{
/* Can't seek (pwrite) on ttys. */
if
(
ppos
!=
&
file
->
f_pos
)
return
-
ESPIPE
;
return
-
EIO
;
return
-
EIO
;
}
}
...
@@ -648,10 +642,6 @@ static ssize_t tty_read(struct file * file, char __user * buf, size_t count,
...
@@ -648,10 +642,6 @@ static ssize_t tty_read(struct file * file, char __user * buf, size_t count,
struct
tty_struct
*
tty
;
struct
tty_struct
*
tty
;
struct
inode
*
inode
;
struct
inode
*
inode
;
/* Can't seek (pread) on ttys. */
if
(
ppos
!=
&
file
->
f_pos
)
return
-
ESPIPE
;
tty
=
(
struct
tty_struct
*
)
file
->
private_data
;
tty
=
(
struct
tty_struct
*
)
file
->
private_data
;
inode
=
file
->
f_dentry
->
d_inode
;
inode
=
file
->
f_dentry
->
d_inode
;
if
(
tty_paranoia_check
(
tty
,
inode
,
"tty_read"
))
if
(
tty_paranoia_check
(
tty
,
inode
,
"tty_read"
))
...
@@ -726,10 +716,6 @@ static ssize_t tty_write(struct file * file, const char __user * buf, size_t cou
...
@@ -726,10 +716,6 @@ static ssize_t tty_write(struct file * file, const char __user * buf, size_t cou
struct
tty_struct
*
tty
;
struct
tty_struct
*
tty
;
struct
inode
*
inode
=
file
->
f_dentry
->
d_inode
;
struct
inode
*
inode
=
file
->
f_dentry
->
d_inode
;
/* Can't seek (pwrite) on ttys. */
if
(
ppos
!=
&
file
->
f_pos
)
return
-
ESPIPE
;
tty
=
(
struct
tty_struct
*
)
file
->
private_data
;
tty
=
(
struct
tty_struct
*
)
file
->
private_data
;
if
(
tty_paranoia_check
(
tty
,
inode
,
"tty_write"
))
if
(
tty_paranoia_check
(
tty
,
inode
,
"tty_write"
))
return
-
EIO
;
return
-
EIO
;
...
@@ -755,9 +741,6 @@ ssize_t redirected_tty_write(struct file * file, const char __user * buf, size_t
...
@@ -755,9 +741,6 @@ ssize_t redirected_tty_write(struct file * file, const char __user * buf, size_t
if
(
p
)
{
if
(
p
)
{
ssize_t
res
;
ssize_t
res
;
/* Can't seek (pwrite) on ttys. */
if
(
ppos
!=
&
file
->
f_pos
)
return
-
ESPIPE
;
res
=
vfs_write
(
p
,
buf
,
count
,
&
p
->
f_pos
);
res
=
vfs_write
(
p
,
buf
,
count
,
&
p
->
f_pos
);
fput
(
p
);
fput
(
p
);
return
res
;
return
res
;
...
@@ -1339,6 +1322,7 @@ static int tty_open(struct inode * inode, struct file * filp)
...
@@ -1339,6 +1322,7 @@ static int tty_open(struct inode * inode, struct file * filp)
dev_t
device
=
inode
->
i_rdev
;
dev_t
device
=
inode
->
i_rdev
;
unsigned
short
saved_flags
=
filp
->
f_flags
;
unsigned
short
saved_flags
=
filp
->
f_flags
;
nonseekable_open
(
inode
,
filp
);
retry_open:
retry_open:
noctty
=
filp
->
f_flags
&
O_NOCTTY
;
noctty
=
filp
->
f_flags
&
O_NOCTTY
;
index
=
-
1
;
index
=
-
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment