Sha256: f6a0fb46dcd03762ec7a49118fa2655c8265d2159707d5442093a8cd092d04c4

Contents?: true

Size: 501 Bytes

Versions: 3

Compression:

Stored size: 501 Bytes

Contents

#include <poll.h>
#include <unistd.h>
#include "e.h"
#include "writeall.h"

int writeall(int fd,const void *x,long long xlen)
{
  long long w;
  while (xlen > 0) {
    w = xlen;
    if (w > 1048576) w = 1048576;
    w = write(fd,x,w);
    if (w < 0) {
      if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK) {
        struct pollfd p;
	p.fd = fd;
	p.events = POLLOUT | POLLERR;
	poll(&p,1,-1);
        continue;
      }
      return -1;
    }
    x += w;
    xlen -= w;
  }
  return 0;
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby_nacl-0.1.2 ext/ruby_nacl/NaCl/curvecp/writeall.c
ruby_nacl-0.1.1 ext/ruby_nacl/NaCl/curvecp/writeall.c
ruby_nacl-0.1.0 ext/ruby_nacl/NaCl/curvecp/writeall.c