5e2a1ba42b08f3cde16f2ac63f0eaf78a977a67d
[dragonfly.git] / lib / libprop / prop_send_syscall.3
1 .\"     $NetBSD: prop_send_syscall.3,v 1.3 2011/01/20 10:48:37 wiz 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 LIBRARY
40 .Lb libprop
41 .Sh SYNOPSIS
42 .In libprop/proplib.h
43 .Ft bool
44 .Fn prop_array_send_syscall "prop_array_t array" "struct plistref *prefp"
45 .Ft bool
46 .Fn prop_array_recv_syscall "const struct plistref *prefp" \
47     "prop_array_t *arrayp"
48 .Ft bool
49 .Fn prop_dictionary_send_syscall "prop_dictionary_t dict" \
50     "struct plistref *prefp"
51 .Ft bool
52 .Fn prop_dictionary_recv_syscall "const struct plistref *prefp" \
53     "prop_dictionary_t *dictp"
54 .Sh DESCRIPTION
55 The
56 .Nm prop_array_send_syscall ,
57 .Nm prop_array_recv_syscall ,
58 .Nm prop_dictionary_send_syscall ,
59 and
60 .Nm prop_dictionary_recv_syscall
61 functions implement the user space side of a protocol for sending property
62 lists to and from the kernel using
63 .Xr syscall 2 .
64 .Sh RETURN VALUES
65 If successful, the functions return true, false otherwise.
66 .Sh EXAMPLES
67 The following
68 .Pq simplified
69 example demonstrates using
70 .Fn prop_dictionary_send_syscall
71 and
72 .Fn prop_dictionary_recv_syscall
73 in an application:
74 .Bd -literal
75 void
76 foo_setprops(prop_dictionary_t dict)
77 {
78     struct pref pref;
79
80     (void) prop_dictionary_send_syscall(dict, \*[Am]pref);
81     (void) my_syscall_set(\*[Am]pref);
82
83 }
84
85 prop_dictionary_t
86 foo_getprops(void)
87 {
88     prop_dictionary_t dict;
89     struct pref pref;
90
91     (void) my_syscall_get(\*[Am]pref);
92     if (!prop_dictionary_recv_syscall(\*[Am]pref, \*[Am]dict))
93         return (NULL);
94
95     return (dict);
96 }
97 .Ed
98 .Sh SEE ALSO
99 .Xr prop_array 3 ,
100 .Xr prop_dictionary 3 ,
101 .Xr proplib 3 ,
102 .Xr prop_copyin_ioctl 9
103 .Sh HISTORY
104 The
105 .Nm proplib
106 property container object library first appeared in
107 .Nx 4.0 .