Listing 4. A Normal User-Space Application

#include <stdio.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <rtl_fifo.h>
#include <rtl_time.h>
#include "control.h"

#define BUFSIZE 7

char buf[BUFSIZE];

int main(void)
{
    fd_set rfds;
    struct timeval tv;
    int retval;
    int fd0, fd1, ctl;
    int n, i = 0;
    int swap = 1;
    struct my_msg_struct msg;
    int hello_thread;

    ctl = open("/dev/rtf0", O_WRONLY);
    fd0 = open("/dev/rtf3", O_RDONLY);
    fd1 = open("/dev/rtf4", O_RDONLY);