Thu Jan 20 10:45:11 2011 UTC ()
Sort sections.


(wiz)
diff -r1.6 -r1.7 src/common/lib/libprop/prop_send_ioctl.3

cvs diff -r1.6 -r1.7 src/common/lib/libprop/prop_send_ioctl.3 (switch to unified diff)

--- src/common/lib/libprop/prop_send_ioctl.3 2011/01/20 10:44:42 1.6
+++ src/common/lib/libprop/prop_send_ioctl.3 2011/01/20 10:45:10 1.7
@@ -1,150 +1,150 @@ @@ -1,150 +1,150 @@
1.\" $NetBSD: prop_send_ioctl.3,v 1.6 2011/01/20 10:44:42 wiz Exp $ 1.\" $NetBSD: prop_send_ioctl.3,v 1.7 2011/01/20 10:45:10 wiz Exp $
2.\" 2.\"
3.\" Copyright (c) 2006 The NetBSD Foundation, Inc. 3.\" Copyright (c) 2006 The NetBSD Foundation, Inc.
4.\" All rights reserved. 4.\" All rights reserved.
5.\" 5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation 6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Jason R. Thorpe. 7.\" by Jason R. Thorpe.
8.\" 8.\"
9.\" Redistribution and use in source and binary forms, with or without 9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions 10.\" modification, are permitted provided that the following conditions
11.\" are met: 11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright 12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer. 13.\" notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\" notice, this list of conditions and the following disclaimer in the 15.\" notice, this list of conditions and the following disclaimer in the
16.\" documentation and/or other materials provided with the distribution. 16.\" documentation and/or other materials provided with the distribution.
17.\" 17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 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 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 20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 21.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 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 25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 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 27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28.\" POSSIBILITY OF SUCH DAMAGE. 28.\" POSSIBILITY OF SUCH DAMAGE.
29.\" 29.\"
30.Dd January 21, 2008 30.Dd January 21, 2008
31.Dt PROP_SEND_IOCTL 3 31.Dt PROP_SEND_IOCTL 3
32.Os 32.Os
33.Sh NAME 33.Sh NAME
34.Nm prop_array_send_ioctl , 34.Nm prop_array_send_ioctl ,
35.Nm prop_array_recv_ioctl , 35.Nm prop_array_recv_ioctl ,
36.Nm prop_dictionary_send_ioctl , 36.Nm prop_dictionary_send_ioctl ,
37.Nm prop_dictionary_recv_ioctl , 37.Nm prop_dictionary_recv_ioctl ,
38.Nm prop_dictionary_sendrecv_ioctl 38.Nm prop_dictionary_sendrecv_ioctl
39.Nd Send and receive propertly lists to and from the kernel using ioctl 39.Nd Send and receive propertly lists to and from the kernel using ioctl
40.Sh SYNOPSIS 40.Sh SYNOPSIS
41.In prop/proplib.h 41.In prop/proplib.h
42.Ft int 42.Ft int
43.Fn prop_array_send_ioctl "prop_array_t array" "int fd" "unsigned long cmd" 43.Fn prop_array_send_ioctl "prop_array_t array" "int fd" "unsigned long cmd"
44.Ft int 44.Ft int
45.Fn prop_array_recv_ioctl "int fd" "unsigned long cmd" "prop_array_t *arrayp" 45.Fn prop_array_recv_ioctl "int fd" "unsigned long cmd" "prop_array_t *arrayp"
46.Ft int 46.Ft int
47.Fn prop_dictionary_send_ioctl "prop_dictionary_t dict" "int fd" \ 47.Fn prop_dictionary_send_ioctl "prop_dictionary_t dict" "int fd" \
48 "unsigned long cmd" 48 "unsigned long cmd"
49.Ft int 49.Ft int
50.Fn prop_dictionary_recv_ioctl "int fd" "unsigned long cmd" \ 50.Fn prop_dictionary_recv_ioctl "int fd" "unsigned long cmd" \
51 "prop_dictionary_t *dictp" 51 "prop_dictionary_t *dictp"
52.Fn prop_dictionary_sendrecv_ioctl "prop_dictionary_t dict" "int fd" \ 52.Fn prop_dictionary_sendrecv_ioctl "prop_dictionary_t dict" "int fd" \
53 "unsigned long cmd" "prop_dictionary_t *dictp" 53 "unsigned long cmd" "prop_dictionary_t *dictp"
54.Sh DESCRIPTION 54.Sh DESCRIPTION
55The 55The
56.Nm prop_array_send_ioctl , 56.Nm prop_array_send_ioctl ,
57.Nm prop_array_recv_ioctl , 57.Nm prop_array_recv_ioctl ,
58.Nm prop_dictionary_send_ioctl , 58.Nm prop_dictionary_send_ioctl ,
59.Nm prop_dictionary_recv_ioctl , 59.Nm prop_dictionary_recv_ioctl ,
60and 60and
61.Nm prop_dictionary_sendrecv_ioctl 61.Nm prop_dictionary_sendrecv_ioctl
62functions implement the user space side of a protocol for sending property 62functions implement the user space side of a protocol for sending property
63lists to and from the kernel using 63lists to and from the kernel using
64.Xr ioctl 2 . 64.Xr ioctl 2 .
65.Sh RETURN VALUES 65.Sh RETURN VALUES
66If successful, functions return zero. 66If successful, functions return zero.
67Otherwise, an error number is returned to indicate the error. 67Otherwise, an error number is returned to indicate the error.
68.Sh ERRORS 
69.Fn prop_array_send_ioctl 
70and 
71.Fn prop_dictionary_send_ioctl 
72will fail if: 
73.Bl -tag -width Er 
74.It Bq Er ENOMEM 
75Cannot allocate memory 
76.It Bq Er ENOTSUP 
77Not supported 
78.El 
79.Pp 
80.Fn prop_array_recv_ioctl 
81and 
82.Fn prop_dictionary_recv_ioctl 
83will fail if: 
84.Bl -tag -width Er 
85.It Bq Er EIO 
86Input/output error 
87.It Bq Er ENOTSUP 
88Not supported 
89.El 
90.Pp 
91In addition to these, 
92.Xr ioctl 2 
93errors may be returned. 
94.Sh EXAMPLES 68.Sh EXAMPLES
95The following 69The following
96.Pq simplified 70.Pq simplified
97example demonstrates using 71example demonstrates using
98.Fn prop_dictionary_send_ioctl 72.Fn prop_dictionary_send_ioctl
99and 73and
100.Fn prop_dictionary_recv_ioctl 74.Fn prop_dictionary_recv_ioctl
101in an application: 75in an application:
102.Bd -literal 76.Bd -literal
103void 77void
104foo_setprops(prop_dictionary_t dict) 78foo_setprops(prop_dictionary_t dict)
105{ 79{
106 int fd; 80 int fd;
107 81
108 fd = open("/dev/foo", O_RDWR, 0640); 82 fd = open("/dev/foo", O_RDWR, 0640);
109 if (fd == -1) 83 if (fd == -1)
110 return; 84 return;
111 85
112 (void) prop_dictionary_send_ioctl(dict, fd, FOOSETPROPS); 86 (void) prop_dictionary_send_ioctl(dict, fd, FOOSETPROPS);
113 87
114 (void) close(fd); 88 (void) close(fd);
115} 89}
116 90
117prop_dictionary_t 91prop_dictionary_t
118foo_getprops(void) 92foo_getprops(void)
119{ 93{
120 prop_dictionary_t dict; 94 prop_dictionary_t dict;
121 int fd; 95 int fd;
122 96
123 fd = open("/dev/foo", O_RDONLY, 0640); 97 fd = open("/dev/foo", O_RDONLY, 0640);
124 if (fd == -1) 98 if (fd == -1)
125 return (NULL); 99 return (NULL);
126 100
127 if (prop_dictionary_recv_ioctl(fd, FOOGETPROPS, \*[Am]dict) != 0) 101 if (prop_dictionary_recv_ioctl(fd, FOOGETPROPS, \*[Am]dict) != 0)
128 return (NULL); 102 return (NULL);
129 103
130 (void) close(fd); 104 (void) close(fd);
131 105
132 return (dict); 106 return (dict);
133} 107}
134.Ed 108.Ed
135.Pp 109.Pp
136The 110The
137.Nm prop_dictionary_sendrecv_ioctl 111.Nm prop_dictionary_sendrecv_ioctl
138function combines the send and receive functionality, allowing for 112function combines the send and receive functionality, allowing for
139ioctls that require two-way communication 113ioctls that require two-way communication
140.Pq for example to specify arguments for the ioctl operation . 114.Pq for example to specify arguments for the ioctl operation .
 115.Sh ERRORS
 116.Fn prop_array_send_ioctl
 117and
 118.Fn prop_dictionary_send_ioctl
 119will fail if:
 120.Bl -tag -width Er
 121.It Bq Er ENOMEM
 122Cannot allocate memory
 123.It Bq Er ENOTSUP
 124Not supported
 125.El
 126.Pp
 127.Fn prop_array_recv_ioctl
 128and
 129.Fn prop_dictionary_recv_ioctl
 130will fail if:
 131.Bl -tag -width Er
 132.It Bq Er EIO
 133Input/output error
 134.It Bq Er ENOTSUP
 135Not supported
 136.El
 137.Pp
 138In addition to these,
 139.Xr ioctl 2
 140errors may be returned.
141.Sh SEE ALSO 141.Sh SEE ALSO
142.Xr prop_array 3 , 142.Xr prop_array 3 ,
143.Xr prop_dictionary 3 , 143.Xr prop_dictionary 3 ,
144.Xr proplib 3 , 144.Xr proplib 3 ,
145.Xr prop_copyin_ioctl 9 145.Xr prop_copyin_ioctl 9
146.Sh HISTORY 146.Sh HISTORY
147The 147The
148.Nm proplib 148.Nm proplib
149property container object library first appeared in 149property container object library first appeared in
150.Nx 4.0 . 150.Nx 4.0 .