Module Name:    src
Committed By:   bouyer
Date:           Wed Jan 19 20:34:24 UTC 2011

Modified Files:
        src/common/include/prop: prop_array.h prop_dictionary.h
        src/common/lib/libprop: prop_copyin_ioctl.9 prop_kern.c proplib.3
        src/distrib/sets/lists/comp: mi
        src/lib/libprop: Makefile
Added Files:
        src/common/lib/libprop: prop_send_syscall.3

Log Message:
- Implement prop_{array,dictionary}_copyout(), based on
  prop_{array,dictionary}_copyout_ioctl().
- Implement prop_{array,dictionary}_recv_syscall(), which
  takes as parameter the pref we got from kernel and internalize it,
  and unmaps the buffer prop_{array,dictionary}_copyout() mapped for us.
- add a prop_{array,dictionary}_send_syscall() for symetry, which is
  an alias to prop_{array,dictionary}_externalize_to_pref()

Discussed on tech-kern@ and tech-userlevel@


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/common/include/prop/prop_array.h
cvs rdiff -u -r1.10 -r1.11 src/common/include/prop/prop_dictionary.h
cvs rdiff -u -r1.7 -r1.8 src/common/lib/libprop/prop_copyin_ioctl.9
cvs rdiff -u -r1.14 -r1.15 src/common/lib/libprop/prop_kern.c
cvs rdiff -u -r0 -r1.1 src/common/lib/libprop/prop_send_syscall.3
cvs rdiff -u -r1.6 -r1.7 src/common/lib/libprop/proplib.3
cvs rdiff -u -r1.1572 -r1.1573 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.17 -r1.18 src/lib/libprop/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/common/include/prop/prop_array.h
diff -u src/common/include/prop/prop_array.h:1.9 src/common/include/prop/prop_array.h:1.10
--- src/common/include/prop/prop_array.h:1.9	Sat Oct 10 21:26:16 2009
+++ src/common/include/prop/prop_array.h	Wed Jan 19 20:34:23 2011
@@ -1,4 +1,4 @@
-/*     $NetBSD: prop_array.h,v 1.9 2009/10/10 21:26:16 bad Exp $    */
+/*     $NetBSD: prop_array.h,v 1.10 2011/01/19 20:34:23 bouyer Exp $    */
 
 /*-
  * Copyright (c) 2006, 2009 The NetBSD Foundation, Inc.
@@ -72,8 +72,12 @@
 bool		prop_array_externalize_to_pref(prop_array_t, struct plistref *);
 int		prop_array_send_ioctl(prop_array_t, int, unsigned long);
 int		prop_array_recv_ioctl(int, unsigned long, prop_array_t *);
+bool		prop_array_send_syscall(prop_array_t, struct plistref *);
+bool		prop_array_recv_syscall(const struct plistref *,
+					prop_array_t *);
 #elif defined(_KERNEL)
 int		prop_array_copyin(const struct plistref *, prop_array_t *);
+int		prop_array_copyout(struct plistref *, prop_array_t *);
 int		prop_array_copyin_ioctl(const struct plistref *, const u_long,
 					prop_array_t *);
 int		prop_array_copyout_ioctl(struct plistref *, const u_long,

Index: src/common/include/prop/prop_dictionary.h
diff -u src/common/include/prop/prop_dictionary.h:1.10 src/common/include/prop/prop_dictionary.h:1.11
--- src/common/include/prop/prop_dictionary.h:1.10	Sat Oct 10 21:26:16 2009
+++ src/common/include/prop/prop_dictionary.h	Wed Jan 19 20:34:23 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: prop_dictionary.h,v 1.10 2009/10/10 21:26:16 bad Exp $	*/
+/*	$NetBSD: prop_dictionary.h,v 1.11 2011/01/19 20:34:23 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2009 The NetBSD Foundation, Inc.
@@ -93,9 +93,15 @@
 int		prop_dictionary_sendrecv_ioctl(prop_dictionary_t,
 					       int, unsigned long,
 					       prop_dictionary_t *);
+bool		prop_dictionary_send_syscall(prop_dictionary_t,
+		     struct plistref *);
+bool		prop_dictionary_recv_syscall(const struct plistref *,
+					   prop_dictionary_t *);
 #elif defined(_KERNEL)
 int		prop_dictionary_copyin(const struct plistref *,
 				       prop_dictionary_t *);
+int		prop_dictionary_copyout(struct plistref *,
+				       prop_dictionary_t *);
 int		prop_dictionary_copyin_ioctl(const struct plistref *,
 					     const u_long,
 					     prop_dictionary_t *);

Index: src/common/lib/libprop/prop_copyin_ioctl.9
diff -u src/common/lib/libprop/prop_copyin_ioctl.9:1.7 src/common/lib/libprop/prop_copyin_ioctl.9:1.8
--- src/common/lib/libprop/prop_copyin_ioctl.9:1.7	Mon Dec 14 05:47:30 2009
+++ src/common/lib/libprop/prop_copyin_ioctl.9	Wed Jan 19 20:34:23 2011
@@ -1,4 +1,4 @@
-.\"	$NetBSD: prop_copyin_ioctl.9,v 1.7 2009/12/14 05:47:30 dholland Exp $
+.\"	$NetBSD: prop_copyin_ioctl.9,v 1.8 2011/01/19 20:34:23 bouyer Exp $
 .\"
 .\" Copyright (c) 2006, 2009 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,16 +27,18 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd October 10, 2009
+.Dd January 17, 2011
 .Dt PROP_COPYIN_IOCTL 9
 .Os
 .Sh NAME
 .Nm prop_array_copyin_ioctl ,
 .Nm prop_array_copyout_ioctl ,
 .Nm prop_array_copyin ,
+.Nm prop_array_copyout ,
 .Nm prop_dictionary_copyin_ioctl ,
 .Nm prop_dictionary_copyout_ioctl ,
 .Nm prop_dictionary_copyin
+.Nm prop_dictionary_copyout
 .Nd Copy property lists to and from kernel space
 .Sh SYNOPSIS
 .In prop/proplib.h
@@ -50,6 +52,9 @@
 .Fn prop_array_copyout_ioctl "struct plistref *pref" \
     "const u_long cmd" "prop_array_t array"
 .Ft int
+.Fn prop_array_copyout "struct plistref *pref" \
+    "prop_array_t array"
+.Ft int
 .Fn prop_dictionary_copyin_ioctl "const struct plistref *pref" \
     "const u_long cmd" "prop_dictionary_t *dictp"
 .Ft int
@@ -58,6 +63,9 @@
 .Ft int
 .Fn prop_dictionary_copyout_ioctl "struct plistref *pref" \
     "const u_long cmd" "prop_dictionary_t dict"
+.Ft int
+.Fn prop_dictionary_copyout "struct plistref *pref" \
+    "prop_dictionary_t dict"
 .Sh DESCRIPTION
 The
 .Nm prop_array_copyin_ioctl ,
@@ -69,9 +77,11 @@
 to and from the kernel using
 .Xr ioctl 2 .
 The functions
-.Nm prop_array_copyin
-and
+.Nm prop_array_copyin ,
+.Nm prop_array_copyout ,
 .Nm prop_dictionary_copyin
+and
+.Nm prop_dictionary_copyout
 implement the kernel side of a protocol for copying property lists to the
 kernel as arguments of normal system calls.
 .Pp
@@ -175,6 +185,7 @@
 .Xr prop_array 3 ,
 .Xr prop_dictionary 3 ,
 .Xr prop_send_ioctl 3 ,
+.Xr prop_send_syscall 3 ,
 .Xr proplib 3
 .Sh HISTORY
 The

Index: src/common/lib/libprop/prop_kern.c
diff -u src/common/lib/libprop/prop_kern.c:1.14 src/common/lib/libprop/prop_kern.c:1.15
--- src/common/lib/libprop/prop_kern.c:1.14	Tue Dec 14 08:04:14 2010
+++ src/common/lib/libprop/prop_kern.c	Wed Jan 19 20:34:23 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: prop_kern.c,v 1.14 2010/12/14 08:04:14 pooka Exp $	*/
+/*	$NetBSD: prop_kern.c,v 1.15 2011/01/19 20:34:23 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2009 The NetBSD Foundation, Inc.
@@ -90,6 +90,7 @@
 		errno = rv;	/* pass up error value in errno */
 	return (rv == 0);
 }
+__strong_alias(prop_array_send_syscall, prop_array_externalize_to_pref)
 
 /*
  * prop_dictionary_externalize_to_pref --
@@ -106,6 +107,8 @@
 		errno = rv;	/* pass up error value in errno */
 	return (rv == 0);
 }
+__strong_alias(prop_dictionary_send_syscall,
+    prop_dictionary_externalize_to_pref)
 
 static int
 _prop_object_send_ioctl(prop_object_t obj, int fd, unsigned long cmd)
@@ -222,6 +225,31 @@
 }
 
 /*
+ * prop_array_recv_syscall --
+ *	Receive an array from the kernel as pref.
+ *	Pref's buf is freed on exit
+ */
+bool
+prop_array_recv_syscall(const struct plistref *pref, prop_array_t *arrayp)
+{
+	return (_prop_object_internalize_from_pref(pref, PROP_TYPE_ARRAY,
+					 (prop_object_t *)arrayp));
+}
+
+/*
+ * prop_dictionary_recv_syscall --
+ *	Receive a dictionary from the kernel as pref.
+ *	Pref's buf is freed on exit
+ */
+bool
+prop_dictionary_recv_syscall(const struct plistref *pref,
+    prop_dictionary_t *dictp)
+{
+	return (_prop_object_internalize_from_pref(pref, PROP_TYPE_DICTIONARY,
+					 (prop_object_t *)dictp));
+}
+
+/*
  * prop_dictionary_sendrecv_ioctl --
  *	Combination send/receive a dictionary to/from the kernel using
  *	the specified ioctl.
@@ -385,8 +413,7 @@
 }
 
 static int
-_prop_object_copyout_ioctl(struct plistref *pref, const u_long cmd,
-			   prop_object_t obj)
+_prop_object_copyout(struct plistref *pref, prop_object_t obj)
 {
 	struct lwp *l = curlwp;		/* XXX */
 	struct proc *p = l->l_proc;
@@ -395,9 +422,6 @@
 	int error = 0;
 	vaddr_t uaddr;
 
-	if ((cmd & IOC_OUT) == 0)
-		return (EFAULT);
-
 	switch (prop_object_type(obj)) {
 	case PROP_TYPE_ARRAY:
 		buf = prop_array_externalize(obj);
@@ -443,6 +467,36 @@
 }
 
 /*
+ * prop_array_copyout --
+ *	Copy out an array to a syscall arg.
+ */
+int
+prop_array_copyout(struct plistref *pref, prop_array_t *arrayp)
+{
+	return (_prop_object_copyout(pref, (prop_object_t *)arrayp));
+}
+
+/*
+ * prop_dictionary_copyout --
+ *	Copy out a dictionary to a syscall arg.
+ */
+int
+prop_dictionary_copyout(struct plistref *pref, prop_dictionary_t *dictp)
+{
+	return (_prop_object_copyout(pref, (prop_object_t *)dictp));
+}
+
+static int
+_prop_object_copyout_ioctl(struct plistref *pref, const u_long cmd,
+			   prop_object_t obj)
+{
+	if ((cmd & IOC_OUT) == 0)
+		return (EFAULT);
+	return _prop_object_copyout(pref, obj);
+}
+
+
+/*
  * prop_array_copyout_ioctl --
  *	Copy out an array being received with an ioctl.
  */
@@ -461,7 +515,8 @@
 prop_dictionary_copyout_ioctl(struct plistref *pref, const u_long cmd,
 			      prop_dictionary_t dict)
 {
-	return (_prop_object_copyout_ioctl(pref, cmd, dict));
+	return (
+	    _prop_object_copyout_ioctl(pref, cmd, dict));
 }
 #endif /* _KERNEL */
 

Index: src/common/lib/libprop/proplib.3
diff -u src/common/lib/libprop/proplib.3:1.6 src/common/lib/libprop/proplib.3:1.7
--- src/common/lib/libprop/proplib.3:1.6	Wed May 13 22:31:59 2009
+++ src/common/lib/libprop/proplib.3	Wed Jan 19 20:34:23 2011
@@ -1,4 +1,4 @@
-.\"	$NetBSD: proplib.3,v 1.6 2009/05/13 22:31:59 wiz Exp $
+.\"	$NetBSD: proplib.3,v 1.7 2011/01/19 20:34:23 bouyer Exp $
 .\"
 .\" Copyright (c) 2006 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd June 21, 2007
+.Dd January 17, 2011
 .Dt PROPLIB 3
 .Os
 .Sh NAME
@@ -94,6 +94,7 @@
 .Xr prop_number 3 ,
 .Xr prop_object 3 ,
 .Xr prop_send_ioctl 3 ,
+.Xr prop_send_syscall 3 ,
 .Xr prop_string 3
 .Sh HISTORY
 The

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.1572 src/distrib/sets/lists/comp/mi:1.1573
--- src/distrib/sets/lists/comp/mi:1.1572	Tue Jan 18 23:12:37 2011
+++ src/distrib/sets/lists/comp/mi	Wed Jan 19 20:34:23 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.1572 2011/01/18 23:12:37 jruoho Exp $
+#	$NetBSD: mi,v 1.1573 2011/01/19 20:34:23 bouyer Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -7655,8 +7655,10 @@
 ./usr/share/man/cat3/prop_array_make_immutable.0	comp-c-catman		.cat
 ./usr/share/man/cat3/prop_array_mutable.0	comp-c-catman		.cat
 ./usr/share/man/cat3/prop_array_recv_ioctl.0	comp-c-catman		.cat
+./usr/share/man/cat3/prop_array_recv_syscall.0	comp-c-catman		.cat
 ./usr/share/man/cat3/prop_array_remove.0	comp-c-catman		.cat
 ./usr/share/man/cat3/prop_array_send_ioctl.0	comp-c-catman		.cat
+./usr/share/man/cat3/prop_array_send_syscall.0	comp-c-catman		.cat
 ./usr/share/man/cat3/prop_array_set.0		comp-c-catman		.cat
 ./usr/share/man/cat3/prop_array_set_bool.0	comp-c-catman		.cat
 ./usr/share/man/cat3/prop_array_set_cstring.0	comp-c-catman		.cat
@@ -7718,9 +7720,11 @@
 ./usr/share/man/cat3/prop_dictionary_make_immutable.0	comp-c-catman		.cat
 ./usr/share/man/cat3/prop_dictionary_mutable.0	comp-c-catman		.cat
 ./usr/share/man/cat3/prop_dictionary_recv_ioctl.0	comp-c-catman		.cat
+./usr/share/man/cat3/prop_dictionary_recv_syscall.0	comp-c-catman		.cat
 ./usr/share/man/cat3/prop_dictionary_remove.0	comp-c-catman		.cat
 ./usr/share/man/cat3/prop_dictionary_remove_keysym.0	comp-c-catman		.cat
 ./usr/share/man/cat3/prop_dictionary_send_ioctl.0	comp-c-catman		.cat
+./usr/share/man/cat3/prop_dictionary_send_syscall.0	comp-c-catman		.cat
 ./usr/share/man/cat3/prop_dictionary_sendrecv_ioctl.0	comp-c-catman		.cat
 ./usr/share/man/cat3/prop_dictionary_set.0	comp-c-catman		.cat
 ./usr/share/man/cat3/prop_dictionary_set_bool.0	comp-c-catman		.cat
@@ -7763,6 +7767,7 @@
 ./usr/share/man/cat3/prop_object_retain.0	comp-c-catman		.cat
 ./usr/share/man/cat3/prop_object_type.0		comp-c-catman		.cat
 ./usr/share/man/cat3/prop_send_ioctl.0		comp-c-catman		.cat
+./usr/share/man/cat3/prop_send_syscall.0	comp-c-catman		.cat
 ./usr/share/man/cat3/prop_string.0		comp-c-catman		.cat
 ./usr/share/man/cat3/prop_string_append.0	comp-c-catman		.cat
 ./usr/share/man/cat3/prop_string_append_cstring.0	comp-c-catman		.cat
@@ -13658,8 +13663,10 @@
 ./usr/share/man/html3/prop_array_make_immutable.html	comp-c-htmlman		html
 ./usr/share/man/html3/prop_array_mutable.html	comp-c-htmlman		html
 ./usr/share/man/html3/prop_array_recv_ioctl.html	comp-c-htmlman		html
+./usr/share/man/html3/prop_array_recv_syscall.html	comp-c-htmlman		html
 ./usr/share/man/html3/prop_array_remove.html	comp-c-htmlman		html
 ./usr/share/man/html3/prop_array_send_ioctl.html	comp-c-htmlman		html
+./usr/share/man/html3/prop_array_send_syscall.html	comp-c-htmlman		html
 ./usr/share/man/html3/prop_array_set.html	comp-c-htmlman		html
 ./usr/share/man/html3/prop_array_set_bool.html	comp-c-htmlman		html
 ./usr/share/man/html3/prop_array_set_cstring.html	comp-c-htmlman		html
@@ -13721,9 +13728,11 @@
 ./usr/share/man/html3/prop_dictionary_make_immutable.html	comp-c-htmlman		html
 ./usr/share/man/html3/prop_dictionary_mutable.html	comp-c-htmlman		html
 ./usr/share/man/html3/prop_dictionary_recv_ioctl.html	comp-c-htmlman		html
+./usr/share/man/html3/prop_dictionary_recv_syscall.html	comp-c-htmlman		html
 ./usr/share/man/html3/prop_dictionary_remove.html	comp-c-htmlman		html
 ./usr/share/man/html3/prop_dictionary_remove_keysym.html	comp-c-htmlman		html
 ./usr/share/man/html3/prop_dictionary_send_ioctl.html	comp-c-htmlman		html
+./usr/share/man/html3/prop_dictionary_send_syscall.html	comp-c-htmlman		html
 ./usr/share/man/html3/prop_dictionary_sendrecv_ioctl.html	comp-c-htmlman		html
 ./usr/share/man/html3/prop_dictionary_set.html	comp-c-htmlman		html
 ./usr/share/man/html3/prop_dictionary_set_bool.html	comp-c-htmlman		html
@@ -13766,6 +13775,7 @@
 ./usr/share/man/html3/prop_object_retain.html	comp-c-htmlman		html
 ./usr/share/man/html3/prop_object_type.html	comp-c-htmlman		html
 ./usr/share/man/html3/prop_send_ioctl.html	comp-c-htmlman		html
+./usr/share/man/html3/prop_send_syscall.html	comp-c-htmlman		html
 ./usr/share/man/html3/prop_string.html		comp-c-htmlman		html
 ./usr/share/man/html3/prop_string_append.html	comp-c-htmlman		html
 ./usr/share/man/html3/prop_string_append_cstring.html	comp-c-htmlman		html
@@ -19653,8 +19663,10 @@
 ./usr/share/man/man3/prop_array_make_immutable.3	comp-c-man		.man
 ./usr/share/man/man3/prop_array_mutable.3	comp-c-man		.man
 ./usr/share/man/man3/prop_array_recv_ioctl.3	comp-c-man		.man
+./usr/share/man/man3/prop_array_recv_syscall.3	comp-c-man		.man
 ./usr/share/man/man3/prop_array_remove.3	comp-c-man		.man
 ./usr/share/man/man3/prop_array_send_ioctl.3	comp-c-man		.man
+./usr/share/man/man3/prop_array_send_syscall.3	comp-c-man		.man
 ./usr/share/man/man3/prop_array_set.3		comp-c-man		.man
 ./usr/share/man/man3/prop_array_set_bool.3	comp-c-man		.man
 ./usr/share/man/man3/prop_array_set_cstring.3	comp-c-man		.man
@@ -19716,9 +19728,11 @@
 ./usr/share/man/man3/prop_dictionary_make_immutable.3	comp-c-man		.man
 ./usr/share/man/man3/prop_dictionary_mutable.3	comp-c-man		.man
 ./usr/share/man/man3/prop_dictionary_recv_ioctl.3	comp-c-man		.man
+./usr/share/man/man3/prop_dictionary_recv_syscall.3	comp-c-man		.man
 ./usr/share/man/man3/prop_dictionary_remove.3	comp-c-man		.man
 ./usr/share/man/man3/prop_dictionary_remove_keysym.3	comp-c-man		.man
 ./usr/share/man/man3/prop_dictionary_send_ioctl.3	comp-c-man		.man
+./usr/share/man/man3/prop_dictionary_send_syscall.3	comp-c-man		.man
 ./usr/share/man/man3/prop_dictionary_sendrecv_ioctl.3	comp-c-man		.man
 ./usr/share/man/man3/prop_dictionary_set.3	comp-c-man		.man
 ./usr/share/man/man3/prop_dictionary_set_bool.3	comp-c-man		.man
@@ -19761,6 +19775,7 @@
 ./usr/share/man/man3/prop_object_retain.3	comp-c-man		.man
 ./usr/share/man/man3/prop_object_type.3		comp-c-man		.man
 ./usr/share/man/man3/prop_send_ioctl.3		comp-c-man		.man
+./usr/share/man/man3/prop_send_syscall.3	comp-c-man		.man
 ./usr/share/man/man3/prop_string.3		comp-c-man		.man
 ./usr/share/man/man3/prop_string_append.3	comp-c-man		.man
 ./usr/share/man/man3/prop_string_append_cstring.3	comp-c-man		.man

Index: src/lib/libprop/Makefile
diff -u src/lib/libprop/Makefile:1.17 src/lib/libprop/Makefile:1.18
--- src/lib/libprop/Makefile:1.17	Sat Oct 10 18:06:54 2009
+++ src/lib/libprop/Makefile	Wed Jan 19 20:34:24 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.17 2009/10/10 18:06:54 bad Exp $
+#	$NetBSD: Makefile,v 1.18 2011/01/19 20:34:24 bouyer Exp $
 
 .include <bsd.own.mk>
 
@@ -31,6 +31,12 @@
 MLINKS+= prop_send_ioctl.3 prop_dictionary_recv_ioctl.3
 MLINKS+= prop_send_ioctl.3 prop_dictionary_sendrecv_ioctl.3
 
+MAN+=	prop_send_syscall.3
+MLINKS+= prop_send_syscall.3 prop_array_send_syscall.3
+MLINKS+= prop_send_syscall.3 prop_array_recv_syscall.3
+MLINKS+= prop_send_syscall.3 prop_dictionary_send_syscall.3
+MLINKS+= prop_send_syscall.3 prop_dictionary_recv_syscall.3
+
 MAN+=	prop_dictionary_util.3
 MLINKS+= prop_dictionary_util.3 prop_dictionary_get_bool.3
 MLINKS+= prop_dictionary_util.3 prop_dictionary_set_bool.3

Added files:

Index: src/common/lib/libprop/prop_send_syscall.3
diff -u /dev/null src/common/lib/libprop/prop_send_syscall.3:1.1
--- /dev/null	Wed Jan 19 20:34:24 2011
+++ src/common/lib/libprop/prop_send_syscall.3	Wed Jan 19 20:34:23 2011
@@ -0,0 +1,106 @@
+.\"	$NetBSD: prop_send_syscall.3,v 1.1 2011/01/19 20:34:23 bouyer Exp $
+.\"
+.\" Copyright (c) 2006 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Jason R. Thorpe.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd January 17, 2011
+.Dt PROP_SEND_SYCALL 3
+.Os
+.Sh NAME
+.Nm prop_array_send_syscall ,
+.Nm prop_array_recv_syscall ,
+.Nm prop_dictionary_send_syscall ,
+.Nm prop_dictionary_recv_syscall ,
+.Nd Helper to send and receive propertly lists to and from the kernel using
+syscall
+.Sh SYNOPSIS
+.In prop/proplib.h
+.Ft bool
+.Fn prop_array_send_syscall "prop_array_t array" "struct plistref *prefp"
+.Ft bool
+.Fn prop_array_recv_syscall "const struct plistref *prefp" \
+    "prop_array_t *arrayp"
+.Ft bool
+.Fn prop_dictionary_send_syscall "prop_dictionary_t dict" \
+    "struct plistref *prefp"
+.Ft bool
+.Fn prop_dictionary_recv_syscall "const struct plistref *prefp" \
+    "prop_dictionary_t *dictp"
+.Sh DESCRIPTION
+The
+.Nm prop_array_send_syscall ,
+.Nm prop_array_recv_syscall ,
+.Nm prop_dictionary_send_syscall ,
+and
+.Nm prop_dictionary_recv_syscall 
+functions implement the user space side of a protocol for sending property
+lists to and from the kernel using
+.Xr syscall 2 .
+.Sh RETURN VALUES
+If successful, functions return true, false otherwise.
+.Sh EXAMPLES
+The following
+.Pq simplified
+example demonstrates using
+.Fn prop_dictionary_send_syscall
+and
+.Fn prop_dictionary_recv_syscall
+in an application:
+.Bd -literal
+void
+foo_setprops(prop_dictionary_t dict)
+{
+    struct pref pref;
+
+    (void) prop_dictionary_send_ioctl(dict, \*[Am]pref);
+    (void) my_syscall_set(\*[Am]pref);
+
+}
+
+prop_dictionary_t
+foo_getprops(void)
+{
+    prop_dictionary_t dict;
+    struct pref pref;
+
+    (void) my_syscall_get(\*[Am]pref);
+    if (!prop_dictionary_recv_syscall(\*[Am]pref, \*[Am]dict))
+        return (NULL);
+
+    return (dict);
+}
+.Ed
+.Sh SEE ALSO
+.Xr prop_array 3 ,
+.Xr prop_dictionary 3 ,
+.Xr proplib 3 ,
+.Xr prop_copyin_ioctl 9
+.Sh HISTORY
+The
+.Nm proplib
+property container object library first appeared in
+.Nx 4.0 .

Reply via email to