diff --git a/lib/libc/sys/fspacectl.2 b/lib/libc/sys/fspacectl.2 --- a/lib/libc/sys/fspacectl.2 +++ b/lib/libc/sys/fspacectl.2 @@ -27,7 +27,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd August 18, 2021 +.Dd August 25, 2021 .Dt FSPACECTL 2 .Os .Sh NAME @@ -73,10 +73,9 @@ .Fa "rmsr->r_len" is updated to be the value 0, and .Fa "rmsr->r_offset" -is updated to be the smallest of -.Fa "rqsr->r_offset" + -.Fa "rqsr->r_len" ; -and the end-of-file offset. +is updated to be +.Fa "rqsr->r_offset" +plus the number of bytes zeroed before the end-of-file. The file descriptor's file offset is not used or modified by the system call. Both .Fa rqsr diff --git a/share/man/man9/VOP_DEALLOCATE.9 b/share/man/man9/VOP_DEALLOCATE.9 --- a/share/man/man9/VOP_DEALLOCATE.9 +++ b/share/man/man9/VOP_DEALLOCATE.9 @@ -27,7 +27,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd August 11, 2021 +.Dd August 25, 2021 .Dt VOP_DEALLOCATE 9 .Os .Sh NAME @@ -74,14 +74,11 @@ are updated to reflect the portion of the range that still needs to be zeroed/deallocated on return. Partial result is considered a successful operation. -For a successful completion without an unprocessed portion of the range, +For a non-partial successful completion, .Fa *len is updated to be the value 0, and .Fa *offset -is updated to be the smallest of -.Fa *offset + -.Fa *len -passed to the call and the end-of-file offset. +is incremented by the number of bytes zeroed before the end-of-file. .Sh LOCKS The vnode should be locked on entry and will still be locked on exit. .Sh RETURN VALUES diff --git a/share/man/man9/vn_deallocate.9 b/share/man/man9/vn_deallocate.9 --- a/share/man/man9/vn_deallocate.9 +++ b/share/man/man9/vn_deallocate.9 @@ -27,7 +27,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd August 11, 2021 +.Dd August 25, 2021 .Dt VN_DEALLOCATE 9 .Os .Sh NAME @@ -99,10 +99,7 @@ .Fa *length is updated to be the value 0, and .Fa *offset -is updated to be the smallest of -.Fa *offset + -.Fa *length -passed to the call and the end-of-file offset. +is incremented by the number of bytes zeroed before the end-of-file. .Sh RETURN VALUES Upon successful completion, the value 0 is returned; otherwise the appropriate error is returned. diff --git a/sys/kern/uipc_shm.c b/sys/kern/uipc_shm.c --- a/sys/kern/uipc_shm.c +++ b/sys/kern/uipc_shm.c @@ -1917,7 +1917,6 @@ /* Handle the case when offset is on or beyond shm size. */ if ((off_t)len <= 0) { - *offset = shmfd->shm_size; *length = 0; return (0); } diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -1156,6 +1156,7 @@ /* * No more data region to be filled */ + offset += len; len = 0; error = 0; break; @@ -1185,10 +1186,8 @@ break; } /* Handle the case when offset is beyond EOF */ - if (len < 0) { - offset += len; + if (len < 0) len = 0; - } out: *ap->a_offset = offset; *ap->a_len = len;