client/src/unifycr.c
inline int unifycr_intercept_fd(int* fd)
{
    int oldfd = *fd;

    /* don't intecept anything until we're initialized */
    if (! unifycr_initialized) {
        return 0;
    }

    if (oldfd < unifycr_fd_limit) {
        /* this fd is a real system fd, so leave it as is */
        return 0;
    } else if (oldfd < 0) {
        /* this is an invalid fd, so we should not intercept it */
        return 0;
    } else {
        /* this is an fd we generated and returned to the user,
         * so intercept the call and shift the fd */
        int newfd = oldfd - unifycr_fd_limit;
        *fd = newfd;
        debug("Changing fd from exposed %d to internal %d\n", oldfd, newfd);
        return 1;
    }
}
/* given an fd, return 1 if we should intercept this file, 0 otherwise,
 * convert fd to new fd value if needed */
given an fd, return 1 if we should intercept this file, 0 otherwise,
convert fd to new fd value if needed
given an fd return 1 if we should intercept this file 0 otherwise convert fd to new fd value if needed
inline int unifycr_intercept_fd(int* fd)
{
    int oldfd = *fd;
    if (! unifycr_initialized) {
        return 0;
    }
    if (oldfd < unifycr_fd_limit) {
        return 0;
    } else if (oldfd < 0) {
        return 0;
    } else {
        int newfd = oldfd - unifycr_fd_limit;
        *fd = newfd;
        debug("Changing fd from exposed %d to internal %d\n", oldfd, newfd);
        return 1;
    }
}
inline int unifycr_intercept_fd ( int * fd ) { int oldfd = * fd ; if ( ! unifycr_initialized ) { return 0 ; } if ( oldfd < unifycr_fd_limit ) { return 0 ; } else if ( oldfd < 0 ) { return 0 ; } else { int newfd = oldfd - unifycr_fd_limit ; * fd = newfd ; debug ( " \n " , oldfd , newfd ) ; return 1 ; } }
given an fd, return 1 if we should intercept this file, 0 otherwise,
 convert fd to new fd value if needed
given an fd return 1 if we should intercept this file 0 otherwise convert fd to new fd value if needed
/* don't intecept anything until we're initialized */ /* this fd is a real system fd, so leave it as is */ /* this is an invalid fd, so we should not intercept it */ /* this is an fd we generated and returned to the user,
         * so intercept the call and shift the fd */