Updated: 2025/Nov/16

Please read Privacy Policy. It's for your privacy.


PROP_SEND_IOCTL(3)         Library Functions Manual         PROP_SEND_IOCTL(3)

NAME
     prop_object_send_ioctl, prop_object_recv_ioctl,
     prop_object_sendrecv_ioctl - Send and receive property lists to and from
     the kernel using ioctl

SYNOPSIS
     #include <prop/proplib.h>

     int
     prop_object_send_ioctl(prop_object_t obj, int fd, unsigned long cmd);

     int
     prop_object_recv_ioctl(int fd, unsigned long cmd, prop_object_t *objp);

     int
     prop_object_sendrecv_ioctl(prop_object_t dict, int fd, unsigned long cmd,
         prop_object_t *objp);

DESCRIPTION
     The prop_object_send_ioctl(), prop_object_recv_ioctl(), and
     prop_object_sendrecv_ioctl() functions implement the user space side of a
     protocol for sending property lists to and from the kernel using
     ioctl(2).

     The functions prop_array_send_ioctl(), prop_array_recv_ioctl(),
     prop_dictionary_send_ioctl(), prop_dictionary_recv_ioctl(), and
     prop_dictionary_sendrecv_ioctl() are provided as wrappers around the
     corresponding generic object functions for backwards compatibility.

RETURN VALUES
     If successful, functions return zero.  Otherwise, an error number is
     returned to indicate the error.

EXAMPLES
     The following (simplified) example demonstrates using
     prop_object_send_ioctl() and prop_object_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_object_send_ioctl(dict, fd, FOOSETPROPS);

         (void) close(fd);
     }

     prop_dictionary_t
     foo_getprops(void)
     {
         prop_object_t obj;
         int fd;

         fd = open("/dev/foo", O_RDONLY, 0640);
         if (fd == -1)
             return (NULL);

         if (prop_object_recv_ioctl(fd, FOOGETPROPS, &obj) != 0)
             return (NULL);

         (void) close(fd);

         return (obj);
     }

     The prop_object_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).

ERRORS
     prop_object_send_ioctl() will fail if:

     [ENOMEM]           Cannot allocate memory

     prop_object_recv_ioctl() will fail if:

     [EIO]              Input/output error

     In addition to these, ioctl(2) errors may be returned.

SEE ALSO
     prop_array(3), prop_dictionary(3), proplib(3), prop_copyin_ioctl(9)

HISTORY
     The proplib(3) property container object library first appeared in
     NetBSD 4.0.

NetBSD 11.99                    April 20, 2025                    NetBSD 11.99