C/ajinject.c
/* aj_getnonblock accepts the airjack_data structure with an open socket, and
   returns whether the interface is currently in blocking (0) or nonblock (1)
   mode.  aj_getnonblock returns a 0 or 1, respectively. */
aj_getnonblock accepts the airjack_data structure with an open socket, and
returns whether the interface is currently in blocking (0) or nonblock (1)
mode.  aj_getnonblock returns a 0 or 1, respectively.
aj_getnonblock accepts the airjack_data structure with an open socket and returns whether the interface is currently in blocking ( 0 ) or nonblock ( 1 ) mode . aj_getnonblock returns a 0 or 1 respectively .
int aj_getnonblock(char *ifname) {
    int flags, mode, sock;
    if((sock = aj_getsocket(ifname)) < 0) {
        perror("aj_getsocket");
        close(sock);
        return(-1);
    }
    flags = fcntl(sock, F_GETFL, 0);
    if (flags < 0) {
        perror("fcntl[F_GETFL]");
        close(sock);
        return(-1);
    }
    mode = flags & O_NONBLOCK;
    close(sock);
    return(mode);
}
int aj_getnonblock ( char * ifname ) { int flags , mode , sock ; if ( ( sock = aj_getsocket ( ifname ) ) < 0 ) { perror ( " " ) ; close ( sock ) ; return ( -1 ) ; } flags = fcntl ( sock , F_GETFL , 0 ) ; if ( flags < 0 ) { perror ( " " ) ; close ( sock ) ; return ( -1 ) ; } mode = flags & O_NONBLOCK ; close ( sock ) ; return ( mode ) ; }
aj_getnonblock accepts the airjack_data structure with an open socket, and
returns whether the interface is currently in blocking (0) or nonblock (1)
mode.
aj_getnonblock accepts the airjack_data structure with an open socket and returns whether the interface is currently in blocking ( 0 ) or nonblock ( 1 ) mode .