key-value/kv.c
/**
 * @brief Map a shared memory object for access in the current process
 * @param fd File descriptor generated by 'sm_create' call
 * @param shm Address of the pointer used for accessing shared memory object
 * @return KV_OK on success and Non KV_OK otherwise
 */
@brief Map a shared memory object for access in the current process
@param fd File descriptor generated by 'sm_create' call
@param shm Address of the pointer used for accessing shared memory object
@return KV_OK on success and Non KV_OK otherwise
@brief Map a shared memory object for access in the current process @param fd File descriptor generated by ' sm_create ' call @param shm Address of the pointer used for accessing shared memory object @return KV_OK on success and Non KV_OK otherwise
static int sm_attach(int fd, store_t **shm)
{
    if (!shm)
        return KV_ERR_ARG;
    *shm = mmap(NULL, sizeof(**shm), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
    if (*shm == MAP_FAILED) {
        *shm = NULL;
        return KV_ERR;
    }
    return KV_OK;
}
static int sm_attach ( int fd , store_t * * shm ) { if ( ! shm ) return KV_ERR_ARG ; * shm = mmap ( NULL , sizeof ( * * shm ) , PROT_READ | PROT_WRITE , MAP_SHARED , fd , 0 ) ; if ( * shm == MAP_FAILED ) { * shm = NULL ; return KV_ERR ; } return KV_OK ; }
@brief Map a shared memory object for access in the current process
 @param fd File descriptor generated by 'sm_create' call
 @param shm Address of the pointer used for accessing shared memory object
 @return KV_OK on success and Non KV_OK otherwise
@brief Map a shared memory object for access in the current process @param fd File descriptor generated by ' sm_create ' call @param shm Address of the pointer used for accessing shared memory object @return KV_OK on success and Non KV_OK otherwise