     1			/*
     2			 * This file was generated automatically by ExtUtils::ParseXS version 2.10 from the
     3			 * contents of IO.xs. Do not edit this file, edit IO.xs instead.
     4			 *
     5			 *	ANY CHANGES MADE HERE WILL BE LOST! 
     6			 *
     7			 */
     8			
     9			#line 1 "IO.xs"
    10			/*
    11			 * Copyright (c) 1997-8 Graham Barr <gbarr@pobox.com>. All rights reserved.
    12			 * This program is free software; you can redistribute it and/or
    13			 * modify it under the same terms as Perl itself.
    14			 */
    15			
    16			#define PERL_EXT_IO
    17			
    18			#define PERL_NO_GET_CONTEXT
    19			#include "EXTERN.h"
    20			#define PERLIO_NOT_STDIO 1
    21			#include "perl.h"
    22			#include "XSUB.h"
    23			#include "poll.h"
    24			#ifdef I_UNISTD
    25			#  include <unistd.h>
    26			#endif
    27			#if defined(I_FCNTL) || defined(HAS_FCNTL)
    28			#  include <fcntl.h>
    29			#endif
    30			
    31			#ifndef SIOCATMARK
    32			#   ifdef I_SYS_SOCKIO
    33			#       include <sys/sockio.h>
    34			#   endif
    35			#endif
    36			
    37			#ifdef PerlIO
    38			#if defined(MACOS_TRADITIONAL) && defined(USE_SFIO)
    39			#define PERLIO_IS_STDIO 1
    40			#undef setbuf
    41			#undef setvbuf
    42			#define setvbuf		_stdsetvbuf
    43			#define setbuf(f,b)	( __sf_setbuf(f,b) )
    44			#endif
    45			typedef int SysRet;
    46			typedef PerlIO * InputStream;
    47			typedef PerlIO * OutputStream;
    48			#else
    49			#define PERLIO_IS_STDIO 1
    50			typedef int SysRet;
    51			typedef FILE * InputStream;
    52			typedef FILE * OutputStream;
    53			#endif
    54			
    55			#define MY_start_subparse(fmt,flags) start_subparse(fmt,flags)
    56			
    57			#ifndef gv_stashpvn
    58			#define gv_stashpvn(str,len,flags) gv_stashpv(str,flags)
    59			#endif
    60			
    61			static int not_here(const char *s) __attribute__noreturn__;
    62			static int
    63			not_here(const char *s)
    64			{
    65			    croak("%s not implemented on this architecture", s);
    66			    NORETURN_FUNCTION_END;
    67			}
    68			
    69			
    70			#ifndef PerlIO
    71			#define PerlIO_fileno(f) fileno(f)
    72			#endif
    73			
    74			static int
    75			io_blocking(pTHX_ InputStream f, int block)
    76			{
    77			#if defined(HAS_FCNTL)
    78			    int RETVAL;
    79			    if(!f) {
    80				errno = EBADF;
    81				return -1;
    82			    }
    83			    RETVAL = fcntl(PerlIO_fileno(f), F_GETFL, 0);
    84			    if (RETVAL >= 0) {
    85				int mode = RETVAL;
    86				int newmode = mode;
    87			#ifdef O_NONBLOCK
    88				/* POSIX style */
    89			
    90			# ifndef O_NDELAY
    91			#  define O_NDELAY O_NONBLOCK
    92			# endif
    93				/* Note: UNICOS and UNICOS/mk a F_GETFL returns an O_NDELAY
    94				 * after a successful F_SETFL of an O_NONBLOCK. */
    95				RETVAL = RETVAL & (O_NONBLOCK | O_NDELAY) ? 0 : 1;
    96			
    97				if (block == 0) {
    98				    newmode &= ~O_NDELAY;
    99				    newmode |= O_NONBLOCK;
   100				} else if (block > 0) {
   101				    newmode &= ~(O_NDELAY|O_NONBLOCK);
   102				}
   103			#else
   104				/* Not POSIX - better have O_NDELAY or we can't cope.
   105				 * for BSD-ish machines this is an acceptable alternative
   106				 * for SysV we can't tell "would block" from EOF but that is
   107				 * the way SysV is...
   108				 */
   109				RETVAL = RETVAL & O_NDELAY ? 0 : 1;
   110			
   111				if (block == 0) {
   112				    newmode |= O_NDELAY;
   113				} else if (block > 0) {
   114				    newmode &= ~O_NDELAY;
   115				}
   116			#endif
   117				if (newmode != mode) {
   118				    const int ret = fcntl(PerlIO_fileno(f),F_SETFL,newmode);
   119				    if (ret < 0)
   120					RETVAL = ret;
   121				}
   122			    }
   123			    return RETVAL;
   124			#else
   125			    return -1;
   126			#endif
   127			}
   128			
   129			#ifndef PERL_UNUSED_VAR
   130			#  define PERL_UNUSED_VAR(var) if (0) var = var
   131			#endif
   132			
   133			#line 134 "IO.c"
   134			
   135			XS(XS_IO__Seekable_getpos); /* prototype to pass -Wmissing-prototypes */
   136			XS(XS_IO__Seekable_getpos)
   137	           1    {
   138	           1        dXSARGS;
   139	           1        if (items != 1)
   140	      ######    	Perl_croak(aTHX_ "Usage: IO::Seekable::getpos(handle)");
   141	           1        PERL_UNUSED_VAR(cv); /* -W */
   142			    {
   143	           1    	InputStream	handle = IoIFP(sv_2io(ST(0)));
   144			#line 126 "IO.xs"
   145				if (handle) {
   146			#ifdef PerlIO
   147				    ST(0) = sv_2mortal(newSV(0));
   148				    if (PerlIO_getpos(handle, ST(0)) != 0) {
   149					ST(0) = &PL_sv_undef;
   150				    }
   151			#else
   152				    if (fgetpos(handle, &pos)) {
   153					ST(0) = &PL_sv_undef;
   154				    } else {
   155					ST(0) = sv_2mortal(newSVpv((char*)&pos, sizeof(Fpos_t)));
   156				    }
   157			#endif
   158				}
   159				else {
   160				    ST(0) = &PL_sv_undef;
   161				    errno = EINVAL;
   162				}
   163			#line 164 "IO.c"
   164			    }
   165	           1        XSRETURN(1);
   166			}
   167			
   168			
   169			XS(XS_IO__Seekable_setpos); /* prototype to pass -Wmissing-prototypes */
   170			XS(XS_IO__Seekable_setpos)
   171	           2    {
   172	           2        dXSARGS;
   173	           2        if (items != 2)
   174	      ######    	Perl_croak(aTHX_ "Usage: IO::Seekable::setpos(handle, pos)");
   175	           2        PERL_UNUSED_VAR(cv); /* -W */
   176			    {
   177	           2    	InputStream	handle = IoIFP(sv_2io(ST(0)));
   178	           2    	SV *	pos = ST(1);
   179	           2    	SysRet	RETVAL;
   180			#line 150 "IO.xs"
   181				if (handle) {
   182			#ifdef PerlIO
   183				    RETVAL = PerlIO_setpos(handle, pos);
   184			#else
   185				    char *p;
   186				    STRLEN len;
   187				    if ((p = SvPV(pos,len)) && len == sizeof(Fpos_t)) {
   188					RETVAL = fsetpos(handle, (Fpos_t*)p);
   189				    }
   190				    else {
   191					RETVAL = -1;
   192					errno = EINVAL;
   193				    }
   194			#endif
   195				}
   196				else {
   197				    RETVAL = -1;
   198				    errno = EINVAL;
   199				}
   200			#line 201 "IO.c"
   201	           2    	ST(0) = sv_newmortal();
   202	           2    	if (RETVAL != -1) {
   203	           1    	    if (RETVAL == 0)
   204	           1    		sv_setpvn(ST(0), "0 but true", 10);
   205				    else
   206	      ######    		sv_setiv(ST(0), (IV)RETVAL);
   207				}
   208			    }
   209	           2        XSRETURN(1);
   210			}
   211			
   212			
   213			XS(XS_IO__File_new_tmpfile); /* prototype to pass -Wmissing-prototypes */
   214			XS(XS_IO__File_new_tmpfile)
   215	          16    {
   216	          16        dXSARGS;
   217	          16        if (items < 0 || items > 1)
   218	      ######    	Perl_croak(aTHX_ "Usage: IO::File::new_tmpfile(packname = \"IO::File\")");
   219	          16        PERL_UNUSED_VAR(cv); /* -W */
   220			    {
   221	          16    	const char *	packname;
   222			#line 178 "IO.xs"
   223				OutputStream fp;
   224				GV *gv;
   225			#line 226 "IO.c"
   226			
   227	          16    	if (items < 1)
   228	      ######    	    packname = "IO::File";
   229				else {
   230	          16    	    packname = (const char *)SvPV_nolen(ST(0));
   231				}
   232			#line 181 "IO.xs"
   233			#ifdef PerlIO
   234				fp = PerlIO_tmpfile();
   235			#else
   236				fp = tmpfile();
   237			#endif
   238				gv = (GV*)SvREFCNT_inc(newGVgen(packname));
   239				hv_delete(GvSTASH(gv), GvNAME(gv), GvNAMELEN(gv), G_DISCARD);
   240				if (do_open(gv, "+>&", 3, FALSE, 0, 0, fp)) {
   241				    ST(0) = sv_2mortal(newRV((SV*)gv));
   242				    sv_bless(ST(0), gv_stashpv(packname, TRUE));
   243				    SvREFCNT_dec(gv);   /* undo increment in newRV() */
   244				}
   245				else {
   246				    ST(0) = &PL_sv_undef;
   247				    SvREFCNT_dec(gv);
   248				}
   249			#line 250 "IO.c"
   250			    }
   251	          16        XSRETURN(1);
   252			}
   253			
   254			
   255			XS(XS_IO__Poll__poll); /* prototype to pass -Wmissing-prototypes */
   256			XS(XS_IO__Poll__poll)
   257	           2    {
   258	           2        dXSARGS;
   259	           2        if (items < 1)
   260	      ######    	Perl_croak(aTHX_ "Usage: IO::Poll::_poll(timeout, ...)");
   261	           2        PERL_UNUSED_VAR(cv); /* -W */
   262	           2        PERL_UNUSED_VAR(ax); /* -Wall */
   263	           2        SP -= items;
   264			    {
   265	           2    	int	timeout = (int)SvIV(ST(0));
   266			#line 204 "IO.xs"
   267			{
   268			#ifdef HAS_POLL
   269			    const int nfd = (items - 1) / 2;
   270			    SV *tmpsv = NEWSV(999,nfd * sizeof(struct pollfd));
   271			    struct pollfd *fds = (struct pollfd *)SvPVX(tmpsv);
   272			    int i,j,ret;
   273			    for(i=1, j=0  ; j < nfd ; j++) {
   274				fds[j].fd = SvIV(ST(i));
   275				i++;
   276				fds[j].events = (short)SvIV(ST(i));
   277				i++;
   278				fds[j].revents = 0;
   279			    }
   280			    if((ret = poll(fds,nfd,timeout)) >= 0) {
   281				for(i=1, j=0 ; j < nfd ; j++) {
   282				    sv_setiv(ST(i), fds[j].fd); i++;
   283				    sv_setiv(ST(i), fds[j].revents); i++;
   284				}
   285			    }
   286			    SvREFCNT_dec(tmpsv);
   287			    XSRETURN_IV(ret);
   288			#else
   289				not_here("IO::Poll::poll");
   290			#endif
   291			}
   292			#line 293 "IO.c"
   293				PUTBACK;
   294				return;
   295			    }
   296			}
   297			
   298			
   299			XS(XS_IO__Handle_blocking); /* prototype to pass -Wmissing-prototypes */
   300			XS(XS_IO__Handle_blocking)
   301	          10    {
   302	          10        dXSARGS;
   303	          10        if (items < 1 || items > 2)
   304	      ######    	Perl_croak(aTHX_ "Usage: IO::Handle::blocking(handle, blk=-1)");
   305	          10        PERL_UNUSED_VAR(cv); /* -W */
   306			    {
   307	          10    	InputStream	handle = IoIFP(sv_2io(ST(0)));
   308	          10    	int	blk;
   309			
   310	          10    	if (items < 2)
   311	           5    	    blk = -1;
   312				else {
   313	           5    	    blk = (int)SvIV(ST(1));
   314				}
   315			#line 238 "IO.xs"
   316			{
   317			    const int ret = io_blocking(aTHX_ handle, items == 1 ? -1 : blk ? 1 : 0);
   318			    if(ret >= 0)
   319				XSRETURN_IV(ret);
   320			    else
   321				XSRETURN_UNDEF;
   322			}
   323			#line 324 "IO.c"
   324			    }
   325	          10        XSRETURN_EMPTY;
   326			}
   327			
   328			
   329			XS(XS_IO__Handle_ungetc); /* prototype to pass -Wmissing-prototypes */
   330			XS(XS_IO__Handle_ungetc)
   331	           2    {
   332	           2        dXSARGS;
   333	           2        if (items != 2)
   334	      ######    	Perl_croak(aTHX_ "Usage: IO::Handle::ungetc(handle, c)");
   335	           2        PERL_UNUSED_VAR(cv); /* -W */
   336			    {
   337	           2    	InputStream	handle = IoIFP(sv_2io(ST(0)));
   338	           2    	int	c = (int)SvIV(ST(1));
   339	           2    	int	RETVAL;
   340	           2    	dXSTARG;
   341			#line 253 "IO.xs"
   342				if (handle)
   343			#ifdef PerlIO
   344				    RETVAL = PerlIO_ungetc(handle, c);
   345			#else
   346				    RETVAL = ungetc(c, handle);
   347			#endif
   348				else {
   349				    RETVAL = -1;
   350				    errno = EINVAL;
   351				}
   352			#line 353 "IO.c"
   353	           2    	XSprePUSH; PUSHi((IV)RETVAL);
   354			    }
   355	           2        XSRETURN(1);
   356			}
   357			
   358			
   359			XS(XS_IO__Handle_error); /* prototype to pass -Wmissing-prototypes */
   360			XS(XS_IO__Handle_error)
   361	      ######    {
   362	      ######        dXSARGS;
   363	      ######        if (items != 1)
   364	      ######    	Perl_croak(aTHX_ "Usage: IO::Handle::error(handle)");
   365	      ######        PERL_UNUSED_VAR(cv); /* -W */
   366			    {
   367	      ######    	InputStream	handle = IoIFP(sv_2io(ST(0)));
   368	      ######    	int	RETVAL;
   369	      ######    	dXSTARG;
   370			#line 270 "IO.xs"
   371				if (handle)
   372			#ifdef PerlIO
   373				    RETVAL = PerlIO_error(handle);
   374			#else
   375				    RETVAL = ferror(handle);
   376			#endif
   377				else {
   378				    RETVAL = -1;
   379				    errno = EINVAL;
   380				}
   381			#line 382 "IO.c"
   382	      ######    	XSprePUSH; PUSHi((IV)RETVAL);
   383			    }
   384	      ######        XSRETURN(1);
   385			}
   386			
   387			
   388			XS(XS_IO__Handle_clearerr); /* prototype to pass -Wmissing-prototypes */
   389			XS(XS_IO__Handle_clearerr)
   390	      ######    {
   391	      ######        dXSARGS;
   392	      ######        if (items != 1)
   393	      ######    	Perl_croak(aTHX_ "Usage: IO::Handle::clearerr(handle)");
   394	      ######        PERL_UNUSED_VAR(cv); /* -W */
   395			    {
   396	      ######    	InputStream	handle = IoIFP(sv_2io(ST(0)));
   397	      ######    	int	RETVAL;
   398	      ######    	dXSTARG;
   399			#line 287 "IO.xs"
   400				if (handle) {
   401			#ifdef PerlIO
   402				    PerlIO_clearerr(handle);
   403			#else
   404				    clearerr(handle);
   405			#endif
   406				    RETVAL = 0;
   407				}
   408				else {
   409				    RETVAL = -1;
   410				    errno = EINVAL;
   411				}
   412			#line 413 "IO.c"
   413	      ######    	XSprePUSH; PUSHi((IV)RETVAL);
   414			    }
   415	      ######        XSRETURN(1);
   416			}
   417			
   418			
   419			XS(XS_IO__Handle_untaint); /* prototype to pass -Wmissing-prototypes */
   420			XS(XS_IO__Handle_untaint)
   421	           1    {
   422	           1        dXSARGS;
   423	           1        if (items != 1)
   424	      ######    	Perl_croak(aTHX_ "Usage: IO::Handle::untaint(handle)");
   425	           1        PERL_UNUSED_VAR(cv); /* -W */
   426			    {
   427	           1    	SV *	handle = ST(0);
   428	           1    	int	RETVAL;
   429	           1    	dXSTARG;
   430			#line 306 "IO.xs"
   431			#ifdef IOf_UNTAINT
   432				IO * io;
   433				io = sv_2io(handle);
   434				if (io) {
   435				    IoFLAGS(io) |= IOf_UNTAINT;
   436				    RETVAL = 0;
   437				}
   438			        else {
   439			#endif
   440				    RETVAL = -1;
   441				    errno = EINVAL;
   442			#ifdef IOf_UNTAINT
   443				}
   444			#endif
   445			#line 446 "IO.c"
   446	           1    	XSprePUSH; PUSHi((IV)RETVAL);
   447			    }
   448	           1        XSRETURN(1);
   449			}
   450			
   451			
   452			XS(XS_IO__Handle_flush); /* prototype to pass -Wmissing-prototypes */
   453			XS(XS_IO__Handle_flush)
   454	           6    {
   455	           6        dXSARGS;
   456	           6        if (items != 1)
   457	      ######    	Perl_croak(aTHX_ "Usage: IO::Handle::flush(handle)");
   458	           6        PERL_UNUSED_VAR(cv); /* -W */
   459			    {
   460	           6    	OutputStream	handle = IoOFP(sv_2io(ST(0)));
   461	           6    	SysRet	RETVAL;
   462			#line 327 "IO.xs"
   463				if (handle)
   464			#ifdef PerlIO
   465				    RETVAL = PerlIO_flush(handle);
   466			#else
   467				    RETVAL = Fflush(handle);
   468			#endif
   469				else {
   470				    RETVAL = -1;
   471				    errno = EINVAL;
   472				}
   473			#line 474 "IO.c"
   474	           6    	ST(0) = sv_newmortal();
   475	           6    	if (RETVAL != -1) {
   476	           4    	    if (RETVAL == 0)
   477	           4    		sv_setpvn(ST(0), "0 but true", 10);
   478				    else
   479	      ######    		sv_setiv(ST(0), (IV)RETVAL);
   480				}
   481			    }
   482	           6        XSRETURN(1);
   483			}
   484			
   485			
   486			XS(XS_IO__Handle_setbuf); /* prototype to pass -Wmissing-prototypes */
   487			XS(XS_IO__Handle_setbuf)
   488	      ######    {
   489	      ######        dXSARGS;
   490	      ######        if (items < 1)
   491	      ######    	Perl_croak(aTHX_ "Usage: IO::Handle::setbuf(handle, ...)");
   492	      ######        PERL_UNUSED_VAR(cv); /* -W */
   493			    {
   494	      ######    	OutputStream	handle = IoOFP(sv_2io(ST(0)));
   495			#line 344 "IO.xs"
   496				if (handle)
   497			#ifdef PERLIO_IS_STDIO
   498			        {
   499				    char *buf = items == 2 && SvPOK(ST(1)) ?
   500				      sv_grow(ST(1), BUFSIZ) : 0;
   501				    setbuf(handle, buf);
   502				}
   503			#else
   504				    not_here("IO::Handle::setbuf");
   505			#endif
   506			#line 507 "IO.c"
   507			    }
   508	      ######        XSRETURN_EMPTY;
   509			}
   510			
   511			
   512			XS(XS_IO__Handle_setvbuf); /* prototype to pass -Wmissing-prototypes */
   513			XS(XS_IO__Handle_setvbuf)
   514	      ######    {
   515	      ######        dXSARGS;
   516	      ######        PERL_UNUSED_VAR(cv); /* -W */
   517			    {
   518	      ######    	SysRet	RETVAL;
   519			#line 358 "IO.xs"
   520				if (items != 4)
   521			            Perl_croak(aTHX_ "Usage: IO::Handle::setvbuf(handle, buf, type, size)");
   522			#if defined(PERLIO_IS_STDIO) && defined(_IOFBF) && defined(HAS_SETVBUF)
   523			    {
   524			        OutputStream	handle = 0;
   525				char *		buf = SvPOK(ST(1)) ? sv_grow(ST(1), SvIV(ST(3))) : 0;
   526				int		type;
   527				int		size;
   528			
   529				if (items == 4) {
   530				    handle = IoOFP(sv_2io(ST(0)));
   531				    buf    = SvPOK(ST(1)) ? sv_grow(ST(1), SvIV(ST(3))) : 0;
   532				    type   = (int)SvIV(ST(2));
   533				    size   = (int)SvIV(ST(3));
   534				}
   535				if (!handle)			/* Try input stream. */
   536				    handle = IoIFP(sv_2io(ST(0)));
   537				if (items == 4 && handle)
   538				    RETVAL = setvbuf(handle, buf, type, size);
   539				else {
   540				    RETVAL = -1;
   541				    errno = EINVAL;
   542				}
   543			    }
   544			#else
   545				RETVAL = (SysRet) not_here("IO::Handle::setvbuf");
   546			#endif
   547			#line 548 "IO.c"
   548				ST(0) = sv_newmortal();
   549				if (RETVAL != -1) {
   550				    if (RETVAL == 0)
   551					sv_setpvn(ST(0), "0 but true", 10);
   552				    else
   553					sv_setiv(ST(0), (IV)RETVAL);
   554				}
   555			    }
   556			    XSRETURN(1);
   557			}
   558			
   559			
   560			XS(XS_IO__Handle_sync); /* prototype to pass -Wmissing-prototypes */
   561			XS(XS_IO__Handle_sync)
   562	      ######    {
   563	      ######        dXSARGS;
   564	      ######        if (items != 1)
   565	      ######    	Perl_croak(aTHX_ "Usage: IO::Handle::sync(handle)");
   566	      ######        PERL_UNUSED_VAR(cv); /* -W */
   567			    {
   568	      ######    	OutputStream	handle = IoOFP(sv_2io(ST(0)));
   569	      ######    	SysRet	RETVAL;
   570			#line 393 "IO.xs"
   571			#ifdef HAS_FSYNC
   572				if(handle)
   573				    RETVAL = fsync(PerlIO_fileno(handle));
   574				else {
   575				    RETVAL = -1;
   576				    errno = EINVAL;
   577				}
   578			#else
   579				RETVAL = (SysRet) not_here("IO::Handle::sync");
   580			#endif
   581			#line 582 "IO.c"
   582	      ######    	ST(0) = sv_newmortal();
   583	      ######    	if (RETVAL != -1) {
   584	      ######    	    if (RETVAL == 0)
   585	      ######    		sv_setpvn(ST(0), "0 but true", 10);
   586				    else
   587	      ######    		sv_setiv(ST(0), (IV)RETVAL);
   588				}
   589			    }
   590	      ######        XSRETURN(1);
   591			}
   592			
   593			
   594			XS(XS_IO__Socket_sockatmark); /* prototype to pass -Wmissing-prototypes */
   595			XS(XS_IO__Socket_sockatmark)
   596	      ######    {
   597	      ######        dXSARGS;
   598	      ######        if (items != 1)
   599	      ######    	Perl_croak(aTHX_ "Usage: IO::Socket::sockatmark(sock)");
   600	      ######        PERL_UNUSED_VAR(cv); /* -W */
   601			    {
   602	      ######    	InputStream	sock = IoIFP(sv_2io(ST(0)));
   603			#line 414 "IO.xs"
   604			     int fd;
   605			#line 606 "IO.c"
   606	      ######    	SysRet	RETVAL;
   607			#line 416 "IO.xs"
   608			   {
   609			     fd = PerlIO_fileno(sock);
   610			#ifdef HAS_SOCKATMARK
   611			     RETVAL = sockatmark(fd);
   612			#else
   613			     {
   614			       int flag = 0;
   615			#   ifdef SIOCATMARK
   616			#     if defined(NETWARE) || defined(WIN32)
   617			       if (ioctl(fd, SIOCATMARK, (void*)&flag) != 0)
   618			#     else
   619			       if (ioctl(fd, SIOCATMARK, &flag) != 0)
   620			#     endif
   621				 XSRETURN_UNDEF;
   622			#   else
   623			       not_here("IO::Socket::atmark");
   624			#   endif
   625			       RETVAL = flag;
   626			     }
   627			#endif
   628			   }
   629			#line 630 "IO.c"
   630	      ######    	ST(0) = sv_newmortal();
   631	      ######    	if (RETVAL != -1) {
   632	      ######    	    if (RETVAL == 0)
   633	      ######    		sv_setpvn(ST(0), "0 but true", 10);
   634				    else
   635	      ######    		sv_setiv(ST(0), (IV)RETVAL);
   636				}
   637			    }
   638	      ######        XSRETURN(1);
   639			}
   640			
   641			#ifdef __cplusplus
   642			extern "C"
   643			#endif
   644			XS(boot_IO); /* prototype to pass -Wmissing-prototypes */
   645			XS(boot_IO)
   646	          99    {
   647	          99        dXSARGS;
   648	          99        char* file = __FILE__;
   649			
   650	          99        PERL_UNUSED_VAR(cv); /* -W */
   651	          99        PERL_UNUSED_VAR(items); /* -W */
   652	          99        XS_VERSION_BOOTCHECK ;
   653			
   654	          99            newXS("IO::Seekable::getpos", XS_IO__Seekable_getpos, file);
   655	          99            newXS("IO::Seekable::setpos", XS_IO__Seekable_setpos, file);
   656	          99            newXS("IO::File::new_tmpfile", XS_IO__File_new_tmpfile, file);
   657	          99            newXS("IO::Poll::_poll", XS_IO__Poll__poll, file);
   658	          99            newXSproto("IO::Handle::blocking", XS_IO__Handle_blocking, file, "$;$");
   659	          99            newXS("IO::Handle::ungetc", XS_IO__Handle_ungetc, file);
   660	          99            newXS("IO::Handle::error", XS_IO__Handle_error, file);
   661	          99            newXS("IO::Handle::clearerr", XS_IO__Handle_clearerr, file);
   662	          99            newXS("IO::Handle::untaint", XS_IO__Handle_untaint, file);
   663	          99            newXS("IO::Handle::flush", XS_IO__Handle_flush, file);
   664	          99            newXS("IO::Handle::setbuf", XS_IO__Handle_setbuf, file);
   665	          99            newXS("IO::Handle::setvbuf", XS_IO__Handle_setvbuf, file);
   666	          99            newXS("IO::Handle::sync", XS_IO__Handle_sync, file);
   667	          99            newXSproto("IO::Socket::sockatmark", XS_IO__Socket_sockatmark, file, "$");
   668			
   669			    /* Initialisation Section */
   670			
   671			#line 441 "IO.xs"
   672			{
   673			    HV *stash;
   674			    /*
   675			     * constant subs for IO::Poll
   676			     */
   677			    stash = gv_stashpvn("IO::Poll", 8, TRUE);
   678			#ifdef	POLLIN
   679				newCONSTSUB(stash,"POLLIN",newSViv(POLLIN));
   680			#endif
   681			#ifdef	POLLPRI
   682			        newCONSTSUB(stash,"POLLPRI", newSViv(POLLPRI));
   683			#endif
   684			#ifdef	POLLOUT
   685			        newCONSTSUB(stash,"POLLOUT", newSViv(POLLOUT));
   686			#endif
   687			#ifdef	POLLRDNORM
   688			        newCONSTSUB(stash,"POLLRDNORM", newSViv(POLLRDNORM));
   689			#endif
   690			#ifdef	POLLWRNORM
   691			        newCONSTSUB(stash,"POLLWRNORM", newSViv(POLLWRNORM));
   692			#endif
   693			#ifdef	POLLRDBAND
   694			        newCONSTSUB(stash,"POLLRDBAND", newSViv(POLLRDBAND));
   695			#endif
   696			#ifdef	POLLWRBAND
   697			        newCONSTSUB(stash,"POLLWRBAND", newSViv(POLLWRBAND));
   698			#endif
   699			#ifdef	POLLNORM
   700			        newCONSTSUB(stash,"POLLNORM", newSViv(POLLNORM));
   701			#endif
   702			#ifdef	POLLERR
   703			        newCONSTSUB(stash,"POLLERR", newSViv(POLLERR));
   704			#endif
   705			#ifdef	POLLHUP
   706			        newCONSTSUB(stash,"POLLHUP", newSViv(POLLHUP));
   707			#endif
   708			#ifdef	POLLNVAL
   709			        newCONSTSUB(stash,"POLLNVAL", newSViv(POLLNVAL));
   710			#endif
   711			    /*
   712			     * constant subs for IO::Handle
   713			     */
   714			    stash = gv_stashpvn("IO::Handle", 10, TRUE);
   715			#ifdef _IOFBF
   716			        newCONSTSUB(stash,"_IOFBF", newSViv(_IOFBF));
   717			#endif
   718			#ifdef _IOLBF
   719			        newCONSTSUB(stash,"_IOLBF", newSViv(_IOLBF));
   720			#endif
   721			#ifdef _IONBF
   722			        newCONSTSUB(stash,"_IONBF", newSViv(_IONBF));
   723			#endif
   724			#ifdef SEEK_SET
   725			        newCONSTSUB(stash,"SEEK_SET", newSViv(SEEK_SET));
   726			#endif
   727			#ifdef SEEK_CUR
   728			        newCONSTSUB(stash,"SEEK_CUR", newSViv(SEEK_CUR));
   729			#endif
   730			#ifdef SEEK_END
   731			        newCONSTSUB(stash,"SEEK_END", newSViv(SEEK_END));
   732			#endif
   733			}
   734			
   735			#line 736 "IO.c"
   736			
   737			    /* End of Initialisation Section */
   738			
   739	          99        XSRETURN_YES;
   740			}
   741			
