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
Kirill Smelkov
linux
Commits
87aad03b
Commit
87aad03b
authored
Mar 03, 2002
by
Benjamin LaHaise
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add sendfile64 syscall to generic code and i386.
parent
2e9f2e35
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
13 deletions
+39
-13
arch/i386/kernel/entry.S
arch/i386/kernel/entry.S
+1
-0
include/asm-i386/unistd.h
include/asm-i386/unistd.h
+1
-0
mm/filemap.c
mm/filemap.c
+37
-13
No files found.
arch/i386/kernel/entry.S
View file @
87aad03b
...
@@ -716,6 +716,7 @@ ENTRY(sys_call_table)
...
@@ -716,6 +716,7 @@ ENTRY(sys_call_table)
.
long
SYMBOL_NAME
(
sys_lremovexattr
)
.
long
SYMBOL_NAME
(
sys_lremovexattr
)
.
long
SYMBOL_NAME
(
sys_fremovexattr
)
.
long
SYMBOL_NAME
(
sys_fremovexattr
)
.
long
SYMBOL_NAME
(
sys_tkill
)
.
long
SYMBOL_NAME
(
sys_tkill
)
.
long
SYMBOL_NAME
(
sys_sendfile64
)
.
rept
NR_syscalls
-(
.
-
sys_call_table
)/
4
.
rept
NR_syscalls
-(
.
-
sys_call_table
)/
4
.
long
SYMBOL_NAME
(
sys_ni_syscall
)
.
long
SYMBOL_NAME
(
sys_ni_syscall
)
...
...
include/asm-i386/unistd.h
View file @
87aad03b
...
@@ -243,6 +243,7 @@
...
@@ -243,6 +243,7 @@
#define __NR_lremovexattr 236
#define __NR_lremovexattr 236
#define __NR_fremovexattr 237
#define __NR_fremovexattr 237
#define __NR_tkill 238
#define __NR_tkill 238
#define __NR_sendfile64 239
/* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */
/* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */
...
...
mm/filemap.c
View file @
87aad03b
...
@@ -1715,7 +1715,7 @@ static int file_send_actor(read_descriptor_t * desc, struct page *page, unsigned
...
@@ -1715,7 +1715,7 @@ static int file_send_actor(read_descriptor_t * desc, struct page *page, unsigned
return
written
;
return
written
;
}
}
asmlinkage
ssize_t
sys_sendfile
(
int
out_fd
,
int
in_fd
,
off_t
*
offset
,
size_t
count
)
static
ssize_t
common_sendfile
(
int
out_fd
,
int
in_fd
,
l
off_t
*
offset
,
size_t
count
)
{
{
ssize_t
retval
;
ssize_t
retval
;
struct
file
*
in_file
,
*
out_file
;
struct
file
*
in_file
,
*
out_file
;
...
@@ -1760,27 +1760,19 @@ asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t *offset, size_t cou
...
@@ -1760,27 +1760,19 @@ asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t *offset, size_t cou
retval
=
0
;
retval
=
0
;
if
(
count
)
{
if
(
count
)
{
read_descriptor_t
desc
;
read_descriptor_t
desc
;
loff_t
pos
=
0
,
*
ppos
;
retval
=
-
EFAULT
;
if
(
!
offset
)
ppos
=
&
in_file
->
f_pos
;
offset
=
&
in_file
->
f_pos
;
if
(
offset
)
{
if
(
get_user
(
pos
,
offset
))
goto
fput_out
;
ppos
=
&
pos
;
}
desc
.
written
=
0
;
desc
.
written
=
0
;
desc
.
count
=
count
;
desc
.
count
=
count
;
desc
.
buf
=
(
char
*
)
out_file
;
desc
.
buf
=
(
char
*
)
out_file
;
desc
.
error
=
0
;
desc
.
error
=
0
;
do_generic_file_read
(
in_file
,
ppos
,
&
desc
,
file_send_actor
);
do_generic_file_read
(
in_file
,
offset
,
&
desc
,
file_send_actor
);
retval
=
desc
.
written
;
retval
=
desc
.
written
;
if
(
!
retval
)
if
(
!
retval
)
retval
=
desc
.
error
;
retval
=
desc
.
error
;
if
(
offset
)
put_user
(
pos
,
offset
);
}
}
fput_out:
fput_out:
...
@@ -1791,6 +1783,38 @@ asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t *offset, size_t cou
...
@@ -1791,6 +1783,38 @@ asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t *offset, size_t cou
return
retval
;
return
retval
;
}
}
asmlinkage
ssize_t
sys_sendfile
(
int
out_fd
,
int
in_fd
,
off_t
*
offset
,
size_t
count
)
{
loff_t
pos
,
*
ppos
=
NULL
;
ssize_t
ret
;
if
(
offset
)
{
off_t
off
;
if
(
unlikely
(
get_user
(
off
,
offset
)))
return
-
EFAULT
;
pos
=
off
;
ppos
=
&
pos
;
}
ret
=
common_sendfile
(
out_fd
,
in_fd
,
ppos
,
count
);
if
(
offset
)
put_user
((
off_t
)
pos
,
offset
);
return
ret
;
}
asmlinkage
ssize_t
sys_sendfile64
(
int
out_fd
,
int
in_fd
,
loff_t
*
offset
,
size_t
count
)
{
loff_t
pos
,
*
ppos
=
NULL
;
ssize_t
ret
;
if
(
offset
)
{
if
(
unlikely
(
copy_from_user
(
&
pos
,
offset
,
sizeof
(
loff_t
))))
return
-
EFAULT
;
ppos
=
&
pos
;
}
ret
=
common_sendfile
(
out_fd
,
in_fd
,
ppos
,
count
);
if
(
offset
)
put_user
(
pos
,
offset
);
return
ret
;
}
static
ssize_t
do_readahead
(
struct
file
*
file
,
unsigned
long
index
,
unsigned
long
nr
)
static
ssize_t
do_readahead
(
struct
file
*
file
,
unsigned
long
index
,
unsigned
long
nr
)
{
{
struct
address_space
*
mapping
=
file
->
f_dentry
->
d_inode
->
i_mapping
;
struct
address_space
*
mapping
=
file
->
f_dentry
->
d_inode
->
i_mapping
;
...
...
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