Ejemplo n.º 1
0
void _init(void)
{
  if (getpagesize() != CI_PAGE_SIZE)
    ci_fail(("Page size mismatch, expected %u, "
             "but the current value is %u",
             CI_PAGE_SIZE, getpagesize()));
  /* must not do any logging yet... */
  if( citp_do_init(CITP_INIT_ALL) < 0 )
    ci_fail(("EtherFabric transport library: failed to initialise (%d)",
             citp.init_level));

  Log_S(log("citp: initialisation done."));
}
Ejemplo n.º 2
0
int __ci_udp_shutdown(ci_netif* netif, ci_udp_state* us, int how)
{
    ci_assert(netif);
    ci_assert(us);

    /* On Windows you can shutdown socket even if it is not connected */
    if( udp_raddr_be32(us) == 0 )
        return -ENOTCONN;
    /* Maybe ESHUTDOWN is suitable, but Linux returns EPIPE */
    switch( how ) {
    case SHUT_RD:
        us->s.rx_errno |= CI_SHUT_RD;
        break;
    case SHUT_WR:
        us->s.rx_errno |= CI_SHUT_WR;
        us->s.tx_errno = EPIPE;
        break;
    case SHUT_RDWR:
        us->s.rx_errno |= (CI_SHUT_RD | CI_SHUT_WR);
        us->s.tx_errno = EPIPE;
        ci_assert(UDP_IS_SHUT_RDWR(us));
        break;
    default:
        ci_fail(("'how' parameter of shutdown() must be verified earlier"));
        return -EINVAL;
    }
    /* shutdown() must not disconnect */
    return 0;
}
Ejemplo n.º 3
0
void _init(void)
{
  /* must not do any logging yet... */
  if( citp_do_init(CITP_INIT_ALL) < 0 )
    ci_fail(("EtherFabric transport library: failed to initialise (%d)",
             citp.init_level));

  Log_S(log("citp: initialisation done."));
}
Ejemplo n.º 4
0
int citp_ep_ioctl(citp_fdinfo* fdinfo, unsigned long request, long arg)
{
  CITP_FDINFO_ASSERT_VALID(fdinfo);

  Log_V(log(LPF "ioctl(%d, %lu, %ld)", fdinfo->fd, request, arg));

  /*! \TODO see /usr/include/bits/ioctls.h for lots of socketey ones */

  ci_fail(("?? not yet implemented"));
  errno = ENOTSUP;
  return -1;
}
Ejemplo n.º 5
0
void __ci_sys_fail(const char* fn, int rc, const char* file, int line)
{
  ci_log("*** UNEXPECTED ERROR ***");
  ci_log("        what: %s", fn);
  ci_log(" called from: %s:%d", file, line);
  ci_log(" return code: %d", rc);
#ifndef __KERNEL__
  ci_log("       errno: %d", errno);
  ci_log("    strerror: %s", strerror(errno));
#endif
  ci_fail((" "));
}