sync_file_range.2: Document the architecture-specific sync_file_range2() system call

As described in commit edd5cd4a9424f22b0fa08bef5e299d41befd5622,
the sync_file_range() argument order is broken for some
architectures (PowerPC, ARM, tile). The remedy was a different
system call using the right argument order on those architectures.

Reported-by: Stephan Mueller <stephan.mueller@atsec.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2010-10-09 05:18:17 +02:00
parent 6d80e8c747
commit cd95b6a6ab
1 changed files with 36 additions and 1 deletions

View File

@ -25,8 +25,9 @@
.\"
.\" 2006-07-05 Initial creation, Michael Kerrisk based on
.\" Andrew Morton's comments in fs/sync.c
.\" 2010-10-09, mtk, Document sync_file_range2()
.\"
.TH SYNC_FILE_RANGE 2 2010-01-17 "Linux" "Linux Programmer's Manual"
.TH SYNC_FILE_RANGE 2 2010-10-09 "Linux" "Linux Programmer's Manual"
.SH NAME
sync_file_range \- sync a file segment with disk
.SH SYNOPSIS
@ -179,6 +180,40 @@ appeared on Linux in kernel 2.6.17.
.SH "CONFORMING TO"
This system call is Linux-specific, and should be avoided
in portable programs.
.SH NOTES
Some architectures (e.g., PowerPC, ARM)
need 64-bit arguments to be aligned in a suitable pair of registers.
.\" See kernel commit edd5cd4a9424f22b0fa08bef5e299d41befd5622
On such architectures, the call signature of
.BR sync_file_range ()
is flawed, since it forces a register to be wasted as padding between the
.I fd
and
.I offset
arguments.
Therefore, these architectures define a different
system call that orders the arguments suitably:
.PP
.in +4n
.nf
.BI "int sync_file_range2(int " fd ", unsigned int " flags ,
.BI " off64_t " offset ", off64_t " nbytes );
.fi
.in
.PP
The behavior of this system call is otherwise exactly the same as
.BR sync_file_range().
A system call with this signature first appeared on the ARM architecture
in Linux 2.6.20, with the name
.BR arm_sync_file_range ().
It was renamed in Linux 2.6.22,
when the analogous system call was added for PowerPC.
On architectures where glibc support is provided,
glibc transparently wraps
.BR sync_file_range2 ()
under the name
.BR sync_file_range ().
.SH "SEE ALSO"
.BR fdatasync (2),
.BR fsync (2),