xref: /illumos-gate/usr/src/man/man3proc/proc_content2str.3proc (revision 9b9d39d2a32ff806d2431dbcc50968ef1e6d46b2)
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 November 27, 2023
15.Dt PROC_CONTENT2STR 3PROC
16.Os
17.Sh NAME
18.Nm proc_content2str ,
19.Nm proc_str2content
20.Nd convert a string to and from a core_content_t
21.Sh LIBRARY
22.Lb libproc
23.Sh SYNOPSIS
24.In libproc.h
25.Ft int
26.Fo proc_content2str
27.Fa "core_content_t content"
28.Fa "char *buf"
29.Fa "size_t size"
30.Fc
31.Ft int
32.Fo proc_str2content
33.Fa "const char *str"
34.Fa "core_content_t *cp"
35.Fc
36.Sh DESCRIPTION
37The
38.Fn proc_content2str
39function converts the contents of a process (whether active or a core
40file) from
41.Fa content
42into a string and writes up to
43.Fa size
44characters, including the null-terminator, into
45.Fa buf .
46.Pp
47A content string will be a series of one or more tokens concatenated
48together with the
49.Sy +
50or
51.Sy -
52characters, indicating that the subsequent token should be added or
53subtracted from the previous ones.
54The full list of tokens and constants is available in the
55.Sy core_content_t
56portion of the
57.Sy TYPES
58section in
59.Xr libproc 3LIB .
60.Pp
61The
62.Fn proc_str2content
63function takes the character string
64.Fa str
65and based on the format described in the previous paragraph, converts it
66back into a
67.Vt core_content_t
68which is placed into
69.Fa cp .
70.Sh RETURN VALUES
71Upon successful completion, the
72.Fn proc_content2str
73function will return the number of characters written into
74.Fa buf ,
75excluding the terminating null character.
76.Pp
77Upon successful completion, the
78.Fn proc_str2content
79function will return
80.Sy 0 .
81Otherwise,
82.Sy -1
83will be returned to indicate an unknown string.
84.Sh INTERFACE STABILITY
85.Sy Uncommitted
86.Sh MT-LEVEL
87.Sy MT-Safe
88.Sh SEE ALSO
89.Xr libproc 3LIB ,
90.Xr proc 5 ,
91.Xr coreadm 8
92