}
}
+HV *PerlIO_layer_hv;
+AV *PerlIO_layer_av;
+
void
PerlIO_cleanup(void)
{
XSRETURN_EMPTY;
}
-HV *PerlIO_layer_hv;
-AV *PerlIO_layer_av;
-
SV *
PerlIO_find_layer(char *name, STRLEN len)
{
if (code == 0)
{
b->posn = PerlIO_tell(PerlIONext(f));
- PerlIO_debug(__FUNCTION__ " f=%p posn=%ld\n",f,(long) b->posn);
}
}
- if (code)
- PerlIO_debug(__FUNCTION__ " f=%p code%d\n",f,code);
return code;
}
Off_t posn = b->posn;
if (b->buf)
posn += (b->ptr - b->buf);
- PerlIO_debug(__FUNCTION__ " f=%p posn=%ld\n",f,(long) posn);
return posn;
}
if (len > 0)
{
b->buf = (STDCHAR *) mmap(NULL, len, PROT_READ, MAP_PRIVATE, fd, b->posn);
- PerlIO_debug(__FUNCTION__ " f=%p b=%p for %ld @ %ld\n",
- f, b->buf, (long) len, (long) b->posn);
if (b->buf && b->buf != (STDCHAR *) -1)
{
#if defined(HAS_MADVISE) && defined(MADV_SEQUENTIAL)
- madvise(b->buf, len, MADV_SEQUENTIAL);
+ madvise((Mmap_t) b->buf, len, MADV_SEQUENTIAL);
#endif
PerlIOBase(f)->flags = flags | PERLIO_F_RDBUF;
b->end = b->buf+len;
m->len = 0;
if (PerlIO_seek(PerlIONext(f),b->posn,SEEK_SET) != 0)
code = -1;
- PerlIO_debug(__FUNCTION__ " f=%p b=%p c=%ld posn=%ld\n",
- f,b->buf,(long)m->len,(long) b->posn);
}
b->ptr = b->end = b->buf;
PerlIOBase(f)->flags &= ~(PERLIO_F_RDBUF|PERLIO_F_WRBUF);
}
if (m->len)
{
- PerlIO_debug(__FUNCTION__ " f=%p %d '%.*s'\n",f,count,count,(char *)vbuf);
+ /* Loose the unwritable mapped buffer */
PerlIO_flush(f);
}
return PerlIOBuf_unread(f,vbuf,count);
m->bbuf = b->buf;
}
}
- if (code)
- PerlIO_debug(__FUNCTION__ " f=%p %d\n",f,code);
return code;
}
{
PerlIOBuf *b = PerlIOSelf(f,PerlIOBuf);
IV code = PerlIO_flush(f);
- PerlIO_debug(__FUNCTION__ " f=%p flush posn=%ld\n",f,(long)b->posn);
if (code == 0 && !b->buf)
{
code = PerlIOMmap_map(f);
- PerlIO_debug(__FUNCTION__ " f=%p mmap code=%d posn=%ld\n",f,code,(long)b->posn);
}
if (code == 0 && !(PerlIOBase(f)->flags & PERLIO_F_RDBUF))
{
code = PerlIOBuf_fill(f);
- PerlIO_debug(__FUNCTION__ " f=%p fill code=%d posn=%ld\n",f,code,(long)b->posn);
}
return code;
}
}
if (PerlIOBuf_close(f) != 0)
code = -1;
- PerlIO_debug(__FUNCTION__ " f=%p %d\n",f,code);
return code;
}