1 .\" $NetBSD: prop_copyin_ioctl.9,v 1.9 2011/01/20 10:47:33 wiz Exp $
3 .\" Copyright (c) 2006, 2009 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
7 .\" by Jason R. Thorpe.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
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.
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.
31 .Dt PROP_COPYIN_IOCTL 9
34 .Nm prop_array_copyin_ioctl ,
35 .Nm prop_array_copyout_ioctl ,
36 .Nm prop_array_copyin ,
37 .Nm prop_array_copyout ,
38 .Nm prop_dictionary_copyin_ioctl ,
39 .Nm prop_dictionary_copyout_ioctl ,
40 .Nm prop_dictionary_copyin ,
41 .Nm prop_dictionary_copyout
42 .Nd Copy property lists to and from kernel space
46 .Fn prop_array_copyin_ioctl "const struct plistref *pref" \
47 "const u_long cmd" "prop_array_t *arrayp"
49 .Fn prop_array_copyin "const struct plistref *pref" \
50 "prop_array_t *arrayp"
52 .Fn prop_array_copyout_ioctl "struct plistref *pref" \
53 "const u_long cmd" "prop_array_t array"
55 .Fn prop_array_copyout "struct plistref *pref" \
58 .Fn prop_dictionary_copyin_ioctl "const struct plistref *pref" \
59 "const u_long cmd" "prop_dictionary_t *dictp"
61 .Fn prop_dictionary_copyin "const struct plistref *pref" \
62 "prop_dictionary_t *dictp"
64 .Fn prop_dictionary_copyout_ioctl "struct plistref *pref" \
65 "const u_long cmd" "prop_dictionary_t dict"
67 .Fn prop_dictionary_copyout "struct plistref *pref" \
68 "prop_dictionary_t dict"
71 .Nm prop_array_copyin_ioctl ,
72 .Nm prop_array_copyout_ioctl ,
73 .Nm prop_dictionary_copyin_ioctl ,
75 .Nm prop_dictionary_copyout_ioctl
76 functions implement the kernel side of a protocol for copying property lists
77 to and from the kernel using
80 .Nm prop_array_copyin ,
81 .Nm prop_array_copyout ,
82 .Nm prop_dictionary_copyin ,
84 .Nm prop_dictionary_copyout
85 implement the kernel side of a protocol for copying property lists to the
86 kernel as arguments of normal system calls.
88 A kernel routine receiving or returning a property list will be passed a
91 This structure encapsulates the reference to the property list in externalized
94 If successful, functions return zero.
95 Otherwise, an error number will be returned to indicate the error.
99 example demonstrates using
100 .Fn prop_dictionary_copyin_ioctl
102 .Fn prop_dictionary_copyout_ioctl
105 extern prop_dictionary_t fooprops;
108 fooioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct lwp *l)
110 prop_dictionary_t dict, odict;
115 const struct plistref *pref = (const struct plistref *) data;
116 error = prop_dictionary_copyin_ioctl(pref, cmd, \*[Am]dict);
121 prop_object_release(odict);
126 struct plistref *pref = (struct plistref *) data;
127 error = prop_dictionary_copyout_ioctl(pref, cmd, fooprops);
132 return (EPASSTHROUGH);
140 example demonstrates using
141 .Fn prop_array_copyin
145 foocopyin(const struct plistref *pref))
150 error = prop_array_copyin(pref, \*[Am]array);
157 .Fn prop_array_copyin_ioctl
159 .Fn prop_dictionary_copyin_ioctl
167 Cannot allocate memory
172 .Fn prop_array_copyout_ioctl
174 .Fn prop_dictionary_copyout_ioctl
180 Cannot allocate memory
186 .Xr prop_dictionary 3 ,
187 .Xr prop_send_ioctl 3 ,
188 .Xr prop_send_syscall 3 ,
193 property container object library first appeared in