7 #include <prop/proplib.h>
11 struct mydev_params params
;
17 strcpy(params
.string
, "Hello World");
20 if ((devfd
= open("/dev/mydev", O_RDONLY
, 0)) < 0) {
21 fprintf(stderr
, "Failed to open /dev/mydev\n");
25 /* Send ioctl request in the traditional way */
26 if (ioctl(devfd
, MYDEVTEST
, ¶ms
) < 0) {
31 /* Create dictionary and add a <key, value> pair in it */
32 pd
= prop_dictionary_create();
35 err("prop_dictionary_create()");
38 ps
= prop_string_create_cstring("key");
41 prop_object_release(pd
);
42 err("prop_string_create_cstring()");
45 if (prop_dictionary_set(pd
, "value", ps
) == false) {
47 prop_object_release(ps
);
48 prop_object_release(pd
);
49 err("prop_dictionary_set()");
52 prop_object_release(ps
);
54 /* Send dictionary to kernel space */
55 prop_dictionary_send_ioctl(pd
, devfd
, MYDEVSETPROPS
);
57 prop_object_release(pd
);