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