![](/images/new-backgrounds/1319792/319792335x1.webp)
Sample Programs
Raw Mode
#define GOT_DATA | 2 |
#define GOT_BOTH | 3 |
#define GOT_INTR | 4 |
get_msg(fd)
int fd;
{
int | flags = 0; |
int | res, ret; |
ctl_area[0] = 0; dat_area[0] = 0; ret = 0;
res = getmsg(fd, &ctl, &dat, &flags);
if(res < 0) { if(errno == EINTR) {
return(GOT_INTR); } else {
printf(”%s,get_msg: getmsg failed, errno = %d\n”, tag, errno); exit(1);
}
}
if(ctl.len > 0) { ret = GOT_CTRL;
}
if(dat.len > 0) { ret = GOT_DATA;
}
return(ret);
}
check_ctrl(prim)
int prim;
{
dl_error_ack_t *err_ack = (dl_error_ack_t *)ctl_area;
printf(”%s,check_ctrl: got DL_ERROR_ACK\n”,tag); printf(” dl_error_primitive = 0x%02x\n”,
168 | Appendix A |