Exemplo n.º 1
0
static int copy_to_remote(const char *lname, const char *rname)
{
  int code = 0;
  int fn = s_open_file(rname, NULL, false);
  if ( fn != -1 )
  {
    linput_t *li = open_linput(lname, false);
    if ( li != NULL )
    {
      size_t size = qlsize(li);
      if ( size > 0 )
      {
        char *buf = (char *)qalloc(size);
        qlread(li, buf, size);
        if ( s_write_file(fn, 0, buf, size) != ssize_t(size) )
          code = qerrcode();
      }
      close_linput(li);
    }
    else
    {
      code = qerrcode();
    }
    s_close_file(fn);
#if DEBUGGER_ID == DEBUGGER_ID_X86_IA32_LINUX_USER
    // chmod +x
    s_ioctl(0, rname, strlen(rname)+1, NULL, 0);
#endif
  }
  else
  {
    code = qerrcode();
  }
  return code;
}
//----------------------------------------------------------------------
// map process slot to slot 0
static ea_t idaapi local_pstos0(ea_t ea, const regval_t *, int)
{
  if ( slot == BADADDR )
  {
    slot = s_ioctl(1, NULL, 0, NULL, NULL);        // get slot number
  }
  return pstos0(ea);
}
//----------------------------------------------------------------------
static bool enable_hwbpts(bool enable)
{
  if ( debugger_inited )
  {
    int32 x = enable;
    return s_ioctl(2, &x, sizeof(x), NULL, NULL) != 0;
  }
  return true;
}
Exemplo n.º 4
0
void SockNonBlock(int Socket)
{
#if defined(WIN32)

    unsigned long onoff=1;

    if (ioctlsocket(Socket, FIONBIO, &onoff)==SOCKET_ERROR)
        perror("ioctlsocket() fallita.");

#elif defined(SOCKETLIB)
    int onoff=1;

    s_ioctl(Socket, FIONBIO, (char *)&onoff);
    s_ioctl(Socket, FIOASYNC, (char *)&onoff);

#elif defined(BSDSOCKETLIB)
    int onoff=1;

    IoctlSocket(Socket, FIONBIO, (char *)&onoff);
    IoctlSocket(Socket, FIOASYNC, (char *)&onoff);

#elif defined(LSCO)

  int nFlags;
  
  nFlags = fcntl( Socket, F_GETFL );
  nFlags |= O_NONBLOCK;
  if( fcntl( Socket, F_SETFL, nFlags ) < 0 )
  {
    perror( "Fatal error executing nonblock" );
    exit( 1 );
  }
#elif defined(AROS)

#else

  if (fcntl(Socket, F_SETFL, FNDELAY) == -1)    {
    perror("Noblock");
    exit (1);
  }

#endif
 
}