ifconfig RSVP
| |
| |
V V
+-----------------------+
| open | System call
+-----------------------+
| wfqopen | Kernel
| |
+-----------------------+
In order for the user to open the device a command similar to the one shown below should be issued, how to attach a command like this to RSVP is discussed in the Kernel/RSVP interface section.
wfqfd = open(``/dev/wfq0'', RDWR);
A file descriptor is returned by the system as a result of issuing the open call, the path and name of the device should be specified as a string and the flags indicating how the device should be opened. Write is necessary to use the ``IO control'' (ioctl) system call (man 2 ioctl).
Thereafter the wfqfd file descriptor can be used as with normal file operations, read/write3/close. Should the open fail for some reason, then -1 will be returned, this should be checked for and reported to the application program.
We use the file descriptor particularly for ioctls allowing parameters to set in the kernel called from the RSVP protocol, described next.