Ejemplo n.º 1
0
int puts(const char *s)
{
  int len = strlen(s);
  runtime_write(len, (char*)s);
  runtime_write(1,"\n");
  return 0;
}
Ejemplo n.º 2
0
// This is used for output by this module
static void writev(int d __attribute__((unused)), 
                   const struct iovec *iov, int iovcnt)
{
  int i;

  for(i = 0; i < iovcnt; i++)
    runtime_write(iov[i].iov_len, iov[i].iov_base); 
}
Ejemplo n.º 3
0
static void
hwrite(const byte *data, uintptr len)
{
	if(len + nbuf <= BufSize) {
		runtime_memmove(buf + nbuf, data, len);
		nbuf += len;
		return;
	}
	runtime_write(dumpfd, buf, nbuf);
	if(len >= BufSize) {
		runtime_write(dumpfd, data, len);
		nbuf = 0;
	} else {
		runtime_memmove(buf, data, len);
		nbuf = len;
	}
}
Ejemplo n.º 4
0
static void
runtime_badsignal(int32 sig)
{
	if (sig == SIGPROF) {
		return;  // Ignore SIGPROFs intended for a non-Go thread.
	}
	runtime_write(2, badsignal, sizeof badsignal - 1);
	runtime_exit(1);
}
Ejemplo n.º 5
0
int vfprintf(FILE *stream, const char *format, va_list ap)
{
  static char buf[4096];

  if((stream == stdin) || (stream == stdout) || (stream == stderr)) {
    int r = vsnprintf(buf, sizeof(buf), format, ap);
    runtime_write(r, buf);
    return r;
  }

#ifdef PROFILING
  if(stream) {
    int r = vsnprintf(buf, sizeof(buf), format, ap);
    profile_write(stream, buf, r);
    return r;
  }
#endif

  return -1;
}
Ejemplo n.º 6
0
Archivo: print.c Proyecto: 0day-ci/gcc
// write to goroutine-local buffer if diverting output,
// or else standard error.
static void
gwrite(const void *v, intgo n)
{
	G* g = runtime_g();

	if(g == nil || g->writebuf == nil) {
		// Avoid -D_FORTIFY_SOURCE problems.
		int rv __attribute__((unused));

		rv = runtime_write(2, v, n);
		return;
	}

	if(g->writenbuf == 0)
		return;

	if(n > g->writenbuf)
		n = g->writenbuf;
	runtime_memmove(g->writebuf, v, n);
	g->writebuf += n;
	g->writenbuf -= n;
}
Ejemplo n.º 7
0
static void
flush(void)
{
	runtime_write(dumpfd, buf, nbuf);
	nbuf = 0;
}