xref: /illumos-gate/usr/src/man/man3proc/Pwrite.3proc (revision 1c207ae9a87e9b2ff04aa0cdad948fee76ac5dd7)
1.\"
2.\" This file and its contents are supplied under the terms of the
3.\" Common Development and Distribution License ("CDDL"), version 1.0.
4.\" You may only use this file in accordance with the terms of version
5.\" 1.0 of the CDDL.
6.\"
7.\" A full copy of the text of the CDDL should have accompanied this
8.\" source.  A copy of the CDDL is also available via the Internet at
9.\" http://www.illumos.org/license/CDDL.
10.\"
11.\"
12.\" Copyright 2015 Joyent, Inc.
13.\"
14.Dd May 11, 2016
15.Dt PWRITE 3PROC
16.Os
17.Sh NAME
18.Nm Pwrite
19.Nd write data to the address space of a process
20.Sh SYNOPSIS
21.Lb libproc
22.In libproc.h
23.Ft ssize_t
24.Fo Pwrite
25.Fa "struct ps_prochandle *P"
26.Fa "const void *buf"
27.Fa "size_t nbyte"
28.Fa "uintptr_t address"
29.Fc
30.Sh DESCRIPTION
31The
32.Fn Pwrite
33function writes data from
34.Fa buf
35to the the process handle
36.Fa P
37starting at the address
38.Fa address .
39It writes at most
40.Fa nbyte
41of data. The
42.Fn Pwrite
43function is logically analogous to the
44.Xr pwrite 2
45function.
46.Pp
47For live processes, this function is equivalent to writing to the
48/proc file system
49.Sy as
50file for the process. For core files, it writes to the logical address
51space of what was once the process and not the corresponding offset in
52the on-disk file. ELF objects grabbed through
53.Xr Pgrab_file 3PROC
54do not support being written to.
55.Pp
56The
57.Fn Pwrite
58function cannot be used to
59.Em extend
60the size of a mapping; writing to an unmapped region generates an
61error.
62.Sh RETURN VALUES
63Upon successful completion, the
64.Fn Pwrite
65function returns the number of bytes successfully written to
66.Fa P .
67This number is never greater than
68.Fa nbyte .
69Otherwise, it returns
70.Sy -1
71and
72.Sy errno
73is set to indicate an error. For the full list of errors see the
74.Sy DIAGNOSTICS
75section in
76.Xr proc 4
77and
78the
79.Sy ERRORS
80section in
81.Xr pwrite 2 .
82.Pp
83In addition, the
84.Fn Pwrite
85function will fail if:
86.Bl -tag -width Er
87.It Er EIO
88.Fa P
89refers to an ELF object and not a core file or active process.
90.El
91.Sh INTERFACE STABILITY
92.Sy Uncommitted
93.Sh MT-LEVEL
94See
95.Sy LOCKING
96in
97.Xr libproc 3LIB .
98.Sh SEE ALSO
99.Xr pwrite 2 ,
100.Xr libproc 3LIB ,
101.Xr proc 4
102