int
prop_array_send_ioctl(
prop_array_t array
, int fd
, unsigned long cmd
)
int
prop_array_recv_ioctl(
int fd
, unsigned long cmd
, prop_array_t *arrayp
)
int
prop_dictionary_send_ioctl(
prop_dictionary_t dict
, int fd
, unsigned long cmd
)
int
prop_dictionary_recv_ioctl(
int fd
, unsigned long cmd
, prop_dictionary_t *dictp
)
prop_dictionary_sendrecv_ioctl(
prop_dictionary_t dict
, int fd
, unsigned long cmd
, prop_dictionary_t *dictp
)
)
and
prop_dictionary_send_ioctl(
)
will fail if:
ENOMEM
]
ENOTSUP
]
prop_array_recv_ioctl()
and
prop_dictionary_recv_ioctl(
)
will fail if:
EIO
]
ENOTSUP
]In addition to these, ioctl(2) errors may be returned.
)
and
prop_dictionary_recv_ioctl(
)
in an application:
void
foo_setprops(prop_dictionary_t dict)
{
int fd;
fd = open("/dev/foo", O_RDWR, 0640);
if (fd == -1)
return;
(void) prop_dictionary_send_ioctl(dict, fd, FOOSETPROPS);
(void) close(fd);
}
prop_dictionary_t
foo_getprops(void)
{
prop_dictionary_t dict;
int fd;
fd = open("/dev/foo", O_RDONLY, 0640);
if (fd == -1)
return (NULL);
if (prop_dictionary_recv_ioctl(fd, FOOGETPROPS, &dict) != 0)
return (NULL);
(void) close(fd);
return (dict);
}
The prop_dictionary_sendrecv_ioctl function combines the send and receive functionality, allowing for ioctls that require two-way communication (for example to specify arguments for the ioctl operation).