Fixed a bug in sendfile(2) where the sent data would be corrupted due
to sendfile(2) being erroneously automatically restarted after a signal is delivered. Fixed by converting ERESTART to EINTR prior to exiting. Updated manual page to indicate the potential EINTR error, its cause and consequences. Approved by: re@freebsd.org
This commit is contained in:
parent
90bc0f9dcd
commit
186e347f2c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=123094
@ -1,4 +1,4 @@
|
||||
.\" Copyright (c) 1998, David Greenman
|
||||
.\" Copyright (c) 2003, David G. Lawrence
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
@ -191,6 +191,10 @@ An error occurred while reading from
|
||||
.Fa fd .
|
||||
.It Bq Er EFAULT
|
||||
An invalid address was specified for an argument.
|
||||
.It Bq Er EINTR
|
||||
A signal interrupted sendfile before it could be completed. If specified, the number
|
||||
of bytes successfully sent will be returned in
|
||||
.Fa *sbytes .
|
||||
.It Bq Er EAGAIN
|
||||
The socket is marked for non-blocking I/O and not all data was sent due to the socket buffer being filled.
|
||||
If specified, the number of bytes successfully sent will be returned in
|
||||
@ -215,4 +219,4 @@ The
|
||||
.Fn sendfile
|
||||
system call
|
||||
and this manual page were written by
|
||||
.An David Greenman Aq dg@root.com .
|
||||
.An David G. Lawrence Aq dg@dglawrence.com .
|
||||
|
@ -1994,6 +1994,11 @@ do_sendfile(struct thread *td, struct sendfile_args *uap, int compat)
|
||||
vrele(vp);
|
||||
if (so)
|
||||
fputsock(so);
|
||||
|
||||
mtx_unlock(&Giant);
|
||||
|
||||
if (error == ERESTART)
|
||||
error = EINTR;
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user