xref: /minix3/common/lib/libprop/prop_send_syscall.3 (revision 6b6d114a21a24bee45291fa4af8899e108396c4a)
1.\"	$NetBSD: prop_send_syscall.3,v 1.5 2011/09/30 22:08:18 jym Exp $
2.\"
3.\" Copyright (c) 2006 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Jason R. Thorpe.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\" notice, this list of conditions and the following disclaimer in the
16.\" documentation and/or other materials provided with the distribution.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28.\" POSSIBILITY OF SUCH DAMAGE.
29.\"
30.Dd January 17, 2011
31.Dt PROP_SEND_SYCALL 3
32.Os
33.Sh NAME
34.Nm prop_array_send_syscall ,
35.Nm prop_array_recv_syscall ,
36.Nm prop_dictionary_send_syscall ,
37.Nm prop_dictionary_recv_syscall
38.Nd send and receive property lists to and from the kernel using syscalls
39.Sh SYNOPSIS
40.In prop/proplib.h
41.Ft int
42.Fn prop_array_send_syscall "prop_array_t array" "struct plistref *prefp"
43.Ft int
44.Fn prop_array_recv_syscall "const struct plistref *prefp" \
45    "prop_array_t *arrayp"
46.Ft int
47.Fn prop_dictionary_send_syscall "prop_dictionary_t dict" \
48    "struct plistref *prefp"
49.Ft int
50.Fn prop_dictionary_recv_syscall "const struct plistref *prefp" \
51    "prop_dictionary_t *dictp"
52.Sh DESCRIPTION
53The
54.Nm prop_array_send_syscall ,
55.Nm prop_array_recv_syscall ,
56.Nm prop_dictionary_send_syscall ,
57and
58.Nm prop_dictionary_recv_syscall
59functions implement the user space side of a protocol for sending property
60lists to and from the kernel using
61.Xr syscall 2 .
62.Sh RETURN VALUES
63If successful, functions return zero.
64Otherwise, an error number is returned to indicate the error.
65.Sh EXAMPLES
66The following
67.Pq simplified
68example demonstrates using
69.Fn prop_dictionary_send_syscall
70and
71.Fn prop_dictionary_recv_syscall
72in an application:
73.Bd -literal
74void
75foo_setprops(prop_dictionary_t dict)
76{
77    struct pref pref;
78
79    (void) prop_dictionary_send_syscall(dict, \*[Am]pref);
80    (void) my_syscall_set(\*[Am]pref);
81
82}
83
84prop_dictionary_t
85foo_getprops(void)
86{
87    prop_dictionary_t dict;
88    struct pref pref;
89
90    (void) my_syscall_get(\*[Am]pref);
91    if (prop_dictionary_recv_syscall(\*[Am]pref, \*[Am]dict) != 0)
92        return (NULL);
93
94    return (dict);
95}
96.Ed
97.Sh ERRORS
98.Fn prop_array_send_syscall
99and
100.Fn prop_dictionary_send_syscall
101will fail if:
102.Bl -tag -width Er
103.It Bq Er ENOMEM
104Cannot allocate memory
105.It Bq Er ENOTSUP
106Not supported
107.El
108.Pp
109.Fn prop_array_recv_syscall
110and
111.Fn prop_dictionary_recv_syscall
112will fail if:
113.Bl -tag -width Er
114.It Bq Er EIO
115Input/output error
116.It Bq Er ENOTSUP
117Not supported
118.El
119.Sh SEE ALSO
120.Xr prop_array 3 ,
121.Xr prop_dictionary 3 ,
122.Xr proplib 3 ,
123.Xr prop_copyin_ioctl 9
124.Sh HISTORY
125The
126.Nm proplib
127property container object library first appeared in
128.Nx 4.0 .
129