ext/iodine/fio.c
/**
 * Replaces an existing read/write hook with another from within a read/write
 * hook callback.
 *
 * Does NOT call any cleanup callbacks.
 *
 * Returns -1 on error, 0 on success.
 */
Replaces an existing read/write hook with another from within a read/write
hook callback.

Does NOT call any cleanup callbacks.

1 on error, 0 on success.
Replaces an existing read / write hook with another from within a read / write hook callback . Does NOT call any cleanup callbacks . 1 on error 0 on success .
int fio_rw_hook_replace_unsafe(intptr_t uuid, fio_rw_hook_s *rw_hooks,
                               void *udata) {
  int replaced = -1;
  uint8_t was_locked;
  intptr_t fd = fio_uuid2fd(uuid);
  fio_rw_hook_validate(rw_hooks);
  was_locked = fio_trylock(&fd_data(fd).sock_lock);
  if (uuid_is_valid(uuid)) {
    fd_data(fd).rw_hooks = rw_hooks;
    fd_data(fd).rw_udata = udata;
    replaced = 0;
  }
  if (!was_locked)
    fio_unlock(&fd_data(fd).sock_lock);
  return replaced;
}
int fio_rw_hook_replace_unsafe ( intptr_t uuid , fio_rw_hook_s * rw_hooks , void * udata ) { int replaced = -1 ; uint8_t was_locked ; intptr_t fd = fio_uuid2fd ( uuid ) ; fio_rw_hook_validate ( rw_hooks ) ; was_locked = fio_trylock ( & fd_data ( fd ) . sock_lock ) ; if ( uuid_is_valid ( uuid ) ) { fd_data ( fd ) . rw_hooks = rw_hooks ; fd_data ( fd ) . rw_udata = udata ; replaced = 0 ; } if ( ! was_locked ) fio_unlock ( & fd_data ( fd ) . sock_lock ) ; return replaced ; }
Replaces an existing read/write hook with another from within a read/write
 hook callback.
Replaces an existing read / write hook with another from within a read / write hook callback .
/* protect against some fulishness... but not all of it. */