summaryrefslogtreecommitdiffstats
path: root/man2/process_madvise.2
diff options
context:
space:
mode:
Diffstat (limited to 'man2/process_madvise.2')
-rw-r--r--man2/process_madvise.261
1 files changed, 26 insertions, 35 deletions
diff --git a/man2/process_madvise.2 b/man2/process_madvise.2
index b95f4e3..37ec5fd 100644
--- a/man2/process_madvise.2
+++ b/man2/process_madvise.2
@@ -5,7 +5,7 @@
.\"
.\" Commit ecb8ac8b1f146915aa6b96449b66dd48984caacc
.\"
-.TH process_madvise 2 2023-03-30 "Linux man-pages 6.05.01"
+.TH process_madvise 2 2024-02-28 "Linux man-pages 6.7"
.SH NAME
process_madvise \- give advice about use of memory to a process
.SH LIBRARY
@@ -13,23 +13,12 @@ Standard C library
.RI ( libc ", " \-lc )
.SH SYNOPSIS
.nf
-.BR "#include <sys/mman.h>" " /* Definition of " MADV_* " constants */"
-.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
-.BR "#include <sys/uio.h>" " /* Definition of " "struct iovec" " type */"
-.B #include <unistd.h>
-.PP
-.BI "ssize_t syscall(SYS_process_madvise, int " pidfd ,
-.BI " const struct iovec *" iovec ", size_t " vlen \
-", int " advice ,
-.BI " unsigned int " flags ");"
+.B #include <sys/mman.h>
+.P
+.BI "ssize_t process_madvise(int " pidfd ", const struct iovec " iovec [. n ],
+.BI " size_t " n ", int " advice \
+", unsigned int " flags );
.fi
-.PP
-.IR Note :
-glibc provides no wrapper for
-.BR process_madvise (),
-necessitating the use of
-.BR syscall (2).
-.\" FIXME: See <https://sourceware.org/bugzilla/show_bug.cgi?id=27380>
.SH DESCRIPTION
The
.BR process_madvise ()
@@ -38,23 +27,23 @@ address ranges of another process or of the calling process.
It provides the advice for the address ranges described by
.I iovec
and
-.IR vlen .
+.IR n .
The goal of such advice is to improve system or application performance.
-.PP
+.P
The
.I pidfd
argument is a PID file descriptor (see
.BR pidfd_open (2))
that specifies the process to which the advice is to be applied.
-.PP
+.P
The pointer
.I iovec
points to an array of
.I iovec
structures, described in
.BR iovec (3type).
-.PP
-.I vlen
+.P
+.I n
specifies the number of elements in the array of
.I iovec
structures.
@@ -64,7 +53,7 @@ This value must be less than or equal to
.I <limits.h>
or accessible via the call
.IR sysconf(_SC_IOV_MAX) ).
-.PP
+.P
The
.I advice
argument is one of the following values:
@@ -84,31 +73,31 @@ See
.B MADV_WILLNEED
See
.BR madvise (2).
-.PP
+.P
The
.I flags
argument is reserved for future use; currently, this argument must be
specified as 0.
-.PP
+.P
The
-.I vlen
+.I n
and
.I iovec
arguments are checked before applying any advice.
If
-.I vlen
+.I n
is too big, or
.I iovec
is invalid,
then an error will be returned immediately and no advice will be applied.
-.PP
+.P
The advice might be applied to only a part of
.I iovec
if one of its elements points to an invalid memory region in the
remote process.
No further elements will be processed beyond that point.
(See the discussion regarding partial advice in RETURN VALUE.)
-.PP
+.P
.\" commit 96cfe2c0fd23ea7c2368d14f769d287e7ae1082e
Starting in Linux 5.12,
permission to apply advice to another process is governed by
@@ -133,7 +122,7 @@ if an error occurred after some
elements were already processed.
The caller should check the return value to determine whether a partial
advice occurred.
-.PP
+.P
On error, \-1 is returned and
.I errno
is set to indicate the error.
@@ -163,7 +152,7 @@ overflows a
value.
.TP
.B EINVAL
-.I vlen
+.I n
is too large.
.TP
.B ENOMEM
@@ -177,7 +166,7 @@ The caller does not have permission to access the address space of the process
.TP
.B ESRCH
The target process does not exist (i.e., it has terminated and been waited on).
-.PP
+.P
See
.BR madvise (2)
for
@@ -187,13 +176,15 @@ errors.
Linux.
.SH HISTORY
Linux 5.10.
-.\" commit ecb8ac8b1f146915aa6b96449b66dd48984caacc
-.PP
+.\" Linux commit ecb8ac8b1f146915aa6b96449b66dd48984caacc
+glibc 2.36.
+.\" glibc commit d19ee3473d68ca0e794f3a8b7677a0983ae1342e
+.P
Support for this system call is optional,
depending on the setting of the
.B CONFIG_ADVISE_SYSCALLS
configuration option.
-.PP
+.P
When this system call first appeared in Linux 5.10,
permission to apply advice to another process was entirely governed by
ptrace access mode