xref: /illumos-gate/usr/src/man/man3proc/Pwrite.3proc (revision a40ea1a7d80eee1b409e9dcc2e48c730988147ea)
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 process handle
36.Fa P
37starting at the address
38.Fa address .
39It writes at most
40.Fa nbyte
41of data.
42The
43.Fn Pwrite
44function is logically analogous to the
45.Xr pwrite 2
46function.
47.Pp
48For live processes, this function is equivalent to writing to the
49/proc file system
50.Sy as
51file for the process.
52For core files, it writes to the logical address space of what was once the
53process and not the corresponding offset in the on-disk file.
54ELF objects grabbed through
55.Xr Pgrab_file 3PROC
56do not support being written to.
57.Pp
58The
59.Fn Pwrite
60function cannot be used to
61.Em extend
62the size of a mapping; writing to an unmapped region generates an
63error.
64.Sh RETURN VALUES
65Upon successful completion, the
66.Fn Pwrite
67function returns the number of bytes successfully written to
68.Fa P .
69This number is never greater than
70.Fa nbyte .
71Otherwise, it returns
72.Sy -1
73and
74.Sy errno
75is set to indicate an error.
76For the full list of errors see the
77.Sy DIAGNOSTICS
78section in
79.Xr proc 4
80and
81the
82.Sy ERRORS
83section in
84.Xr pwrite 2 .
85.Pp
86In addition, the
87.Fn Pwrite
88function will fail if:
89.Bl -tag -width Er
90.It Er EIO
91.Fa P
92refers to an ELF object and not a core file or active process.
93.El
94.Sh INTERFACE STABILITY
95.Sy Uncommitted
96.Sh MT-LEVEL
97See
98.Sy LOCKING
99in
100.Xr libproc 3LIB .
101.Sh SEE ALSO
102.Xr pwrite 2 ,
103.Xr libproc 3LIB ,
104.Xr proc 4
105