From: Nick Ing-Simmons Date: Sat, 25 Nov 2000 21:26:54 +0000 (+0000) Subject: Integrate mainline. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=24c23ab4f49a594279883afef247c728d1f5a636;p=p5sagit%2Fp5-mst-13.2.git Integrate mainline. p4raw-id: //depot/perlio@7859 --- 24c23ab4f49a594279883afef247c728d1f5a636 diff --cc doio.c index 3e36ea3,c325e78..094bf84 --- a/doio.c +++ b/doio.c @@@ -474,17 -463,13 +463,17 @@@ Perl_do_open9(pTHX_ GV *gv, register ch #endif } if (saveifp) { /* must use old fp? */ + /* If fd is less that PL_maxsysfd i.e. STDIN..STDERR - then dup the new fileno down ++ then dup the new fileno down + */ fd = PerlIO_fileno(saveifp); if (saveofp) { - PerlIO_flush(saveofp); /* emulate PerlIO_close() */ + PerlIO_flush(saveofp); /* emulate PerlIO_close() */ if (saveofp != saveifp) { /* was a socket? */ PerlIO_close(saveofp); - /* This looks very suspect - NI-S 24 Nov 2000 */ ++ /* This looks very suspect - NI-S 24 Nov 2000 */ if (fd > 2) - Safefree(saveofp); + Safefree(saveofp); /* ??? */ } } if (fd != PerlIO_fileno(fp)) { @@@ -2051,152 -2039,3 +2040,4 @@@ Perl_do_shmio(pTHX_ I32 optype, SV **ma #endif /* SYSV IPC */ - #ifdef SOCKS_64BIT_BUG - - /** - ** getc and ungetc wrappers for the 64 bit problems with SOCKS 5 support - ** Workaround to the problem, that SOCKS maps a socket 'getc' to revc - ** without checking the ungetc buffer. - **/ - - static S64_IOB *s64_buffer = (S64_IOB *) NULL; - - /* initialize the buffer area */ - /* required after a fork(2) call in order to remove side effects */ - void Perl_do_s64_init_buffer() { - s64_buffer = (S64_IOB *) NULL; - } - - /* get a buffered stream pointer */ - static S64_IOB *S_s64_get_buffer( PerlIO *fp) { - S64_IOB *ptr = s64_buffer; - while( ptr && ptr->fp != fp) - ptr = ptr->next; - return( ptr); - } - - /* create a buffered stream pointer */ - static S64_IOB *S_s64_create_buffer( PerlIO *f) { - S64_IOB *ptr = malloc( sizeof( S64_IOB)); - if( ptr) { - ptr->fp = f; - ptr->cnt = ptr->size = 0; - ptr->buffer = (int *) NULL; - ptr->next = s64_buffer; - ptr->last = (S64_IOB *) NULL; - if( s64_buffer) s64_buffer->last = ptr; - s64_buffer = ptr; - } - return( ptr); - } - - /* delete a buffered stream pointer */ - void Perl_do_s64_delete_buffer( PerlIO *f) { - S64_IOB *ptr = _s64_get_buffer(f); - if( ptr) { - /* fix the stream pointer according to the bytes buffered */ - /* required, if this is called in a seek-context */ - if( ptr->cnt) fseek(f,-ptr->cnt,SEEK_CUR); - if( ptr->buffer) free( ptr->buffer); - if( ptr->last) - ptr->last->next = ptr->next; - else - s64_buffer = ptr->next; - free( ptr); - } - } + - /* internal buffer management */ - #define _S64_BUFFER_SIZE 32 - static int S_s64_malloc( S64_IOB *ptr) { - if( ptr) { - if( !ptr->buffer) { - ptr->buffer = (int *) calloc( _S64_BUFFER_SIZE, sizeof( int)); - ptr->size = ptr->cnt = 0; - } else { - ptr->buffer = (int *) realloc( ptr->buffer, ptr->size + _S64_BUFFER_SIZE); - } - - if( !ptr->buffer) - return( 0); - - ptr->size += _S64_BUFFER_SIZE; - - return( 1); - } - - return( 0); - } - - /* SOCKS 64 bit getc replacement */ - int Perl_do_s64_getc( PerlIO *f) { - S64_IOB *ptr = _s64_get_buffer(f); - if( ptr) { - if( ptr->cnt) - return( ptr->buffer[--ptr->cnt]); - } - return( getc(f)); - } - - /* SOCKS 64 bit ungetc replacement */ - int Perl_do_s64_ungetc( int ch, PerlIO *f) { - S64_IOB *ptr = _s64_get_buffer(f); - - if( !ptr) ptr=_s64_create_buffer(f); - if( !ptr) return( EOF); - if( !ptr->buffer || (ptr->buffer && ptr->cnt >= ptr->size)) - if( !_s64_malloc( ptr)) return( EOF); - ptr->buffer[ptr->cnt++] = ch; - - return( ch); - } - - /* SOCKS 64 bit fread replacement */ - SSize_t Perl_do_s64_fread(void *buf, SSize_t count, PerlIO* f) { - SSize_t len = 0; - char *bufptr = (char *) buf; - S64_IOB *ptr = _s64_get_buffer(f); - if( ptr) { - while( ptr->cnt && count) { - *bufptr++ = ptr->buffer[--ptr->cnt]; - count--, len++; - } - } - if( count) - len += (SSize_t)fread(bufptr,1,count,f); - - return( len); - } - - /* SOCKS 64 bit fseek replacement */ - int Perl_do_s64_seek(PerlIO* f, Off_t offset, int whence) { - S64_IOB *ptr = _s64_get_buffer(f); - - /* Simply clear the buffer and seek if the position is absolute */ - if( SEEK_SET == whence || SEEK_END == whence) { - if( ptr) ptr->cnt = 0; - - /* In case of relative positioning clear the buffer and calculate */ - /* a fixed offset */ - } else if( SEEK_CUR == whence) { - if( ptr) { - offset -= (Off_t)ptr->cnt; - ptr->cnt = 0; - } - } - - /* leave out buffer untouched otherwise, because fseek will fail */ - /* seek now */ - return( fseeko( f, offset, whence)); - } - - /* SOCKS 64 bit ftell replacement */ - Off_t Perl_do_s64_tell(PerlIO* f) { - Off_t offset = 0; - S64_IOB *ptr = _s64_get_buffer(f); - if( ptr) - offset = ptr->cnt; - return( ftello(f) - offset); - } - - #endif diff --cc win32/makefile.mk index 5a7bbd1,681e28f..16278aa --- a/win32/makefile.mk +++ b/win32/makefile.mk @@@ -89,7 -89,7 +89,7 @@@ INST_ARCH *= \$(ARCHNAME # # uncomment exactly one of the following --# ++# # Visual C++ 2.x #CCTYPE *= MSVC20 # Visual C++ > 2.x and < 6.x @@@ -290,7 -290,7 +290,7 @@@ ARCHNAME !:= $(ARCHNAME)-threa # VC 6.0 can load the socket dll on demand. Makes the test suite # run in about 10% less time. --DELAYLOAD *= -DELAYLOAD:wsock32.dll -DELAYLOAD:shell32.dll delayimp.lib ++DELAYLOAD *= -DELAYLOAD:wsock32.dll -DELAYLOAD:shell32.dll delayimp.lib # VC 6.0 seems capable of compiling perl correctly with optimizations # enabled. Anything earlier fails tests. @@@ -332,7 -332,7 +332,7 @@@ RSC = r # Options # INCLUDES = -I$(COREDIR) -I.\include -I. -I.. -I"$(CCINCDIR)" --#PCHFLAGS = -H -Hc -H=c:\temp\bcmoduls.pch ++#PCHFLAGS = -H -Hc -H=c:\temp\bcmoduls.pch DEFINES = -DWIN32 $(CRYPT_FLAG) LOCDEFS = -DPERLDLL -DPERL_CORE SUBSYS = console @@@ -346,7 -346,7 +346,7 @@@ OPTIMIZE = -v -D_RTLDLL -DDEBUGGIN LINK_DBG = -v .ELSE OPTIMIZE = -O2 -D_RTLDLL --LINK_DBG = ++LINK_DBG = .ENDIF CFLAGS = -w -g0 -tWM -tWD $(INCLUDES) $(DEFINES) $(LOCDEFS) \ @@@ -354,7 -354,7 +354,7 @@@ LINK_FLAGS = $(LINK_DBG) -L"$(INST_COREDIR)" -L"$(CCLIBDIR)" OBJOUT_FLAG = -o EXEOUT_FLAG = -e --LIBOUT_FLAG = ++LIBOUT_FLAG = .ELIF "$(CCTYPE)" == "GCC" @@@ -371,7 -371,7 +371,7 @@@ a = . # Options # --INCLUDES = -I.\include -I. -I.. -I$(COREDIR) ++INCLUDES = -I.\include -I. -I.. -I$(COREDIR) DEFINES = -DWIN32 $(CRYPT_FLAG) LOCDEFS = -DPERLDLL -DPERL_CORE SUBSYS = console @@@ -391,14 -391,14 +391,14 @@@ OPTIMIZE = -g -O2 -DDEBUGGIN LINK_DBG = -g .ELSE OPTIMIZE = -g -O2 --LINK_DBG = -g ++LINK_DBG = -g .ENDIF CFLAGS = $(INCLUDES) $(DEFINES) $(LOCDEFS) $(OPTIMIZE) LINK_FLAGS = $(LINK_DBG) -L"$(INST_COREDIR)" -L"$(CCLIBDIR)" OBJOUT_FLAG = -o EXEOUT_FLAG = -o --LIBOUT_FLAG = ++LIBOUT_FLAG = # NOTE: we assume that GCC uses MSVCRT.DLL BUILDOPT += -fno-strict-aliasing -DPERL_MSVCRT_READFIX @@@ -415,7 -415,7 +415,7 @@@ RSC = r # INCLUDES = -I$(COREDIR) -I.\include -I. -I.. --#PCHFLAGS = -Fpc:\temp\vcmoduls.pch -YX ++#PCHFLAGS = -Fpc:\temp\vcmoduls.pch -YX DEFINES = -DWIN32 -D_CONSOLE -DNO_STRICT $(CRYPT_FLAG) LOCDEFS = -DPERLDLL -DPERL_CORE SUBSYS = console @@@ -496,7 -496,7 +496,7 @@@ LKPOST = # # Rules --# ++# .SUFFIXES : .c $(o) .dll $(a) .exe .rc .res @@@ -515,7 -515,7 +515,7 @@@ $(o).dll $(IMPLIB) --input-def $(*B).def --output-lib $(*B).a $@ .ELSE $(LINK32) -dll -subsystem:windows -implib:$(*B).lib -def:$(*B).def \ -- -out:$@ $(BLINK_FLAGS) $(LIBFILES) $< $(LIBPERL) ++ -out:$@ $(BLINK_FLAGS) $(LIBFILES) $< $(LIBPERL) .ENDIF .rc.res: @@@ -532,13 -532,6 +532,13 @@@ CONFIGPM = ..\lib\Config.p MINIMOD = ..\lib\ExtUtils\Miniperl.pm X2P = ..\x2p\a2p.exe - # Nominate a target which causes extensions to be re-built ++# Nominate a target which causes extensions to be re-built +# This used to be $(PERLEXE), but at worst it is the .dll that they depend +# on and really only the interface - i.e. the .def file used to export symbols +# from the .dll +PERLDEP = perldll.def + + PL2BAT = bin\pl2bat.pl GLOBBAT = bin\perlglob.bat @@@ -645,7 -638,7 +645,7 @@@ EXTRACORE_SRC += ..\perlio. WIN32_SRC = \ .\win32.c \ .\win32sck.c \ -- .\win32thread.c ++ .\win32thread.c .IF "$(CRYPT_SRC)" != "" WIN32_SRC += .\$(CRYPT_SRC) @@@ -745,8 -738,8 +745,8 @@@ DPROF = $(EXTDIR)\Devel\DProf\DPro GLOB = $(EXTDIR)\File\Glob\Glob HOSTNAME = $(EXTDIR)\Sys\Hostname\Hostname STORABLE = $(EXTDIR)\Storable\Storable - FILTER = $(EXTDIR)\Filter\Util\Call - ENCODE = $(EXTDIR)\Encode\Encode + FILTER = $(EXTDIR)\Filter\Util\Call\Call -ENCODE = $(EXTDIR)\Encode\Encode ++ENCODE = $(EXTDIR)\Encode\Encode SOCKET_DLL = $(AUTODIR)\Socket\Socket.dll FCNTL_DLL = $(AUTODIR)\Fcntl\Fcntl.dll @@@ -864,7 -857,7 +864,7 @@@ RIGHTMAKE = __switch_makefile NOOP = @rem .ELSE MK2 = __not_needed --RIGHTMAKE = ++RIGHTMAKE = .ENDIF # @@@ -920,7 -913,7 +920,7 @@@ __no_such_target #--------------------- END Win95 SPECIFIC --------------------- # a blank target for when builds don't need to do certain things --# this target added for Win95 port but used to keep the WinNT port able to ++# this target added for Win95 port but used to keep the WinNT port able to # use this file __not_needed: $(NOOP) @@@ -934,7 -927,7 +934,7 @@@ $(GLOBEXE) : perlglob$(o $(LINK32) $(BLINK_FLAGS) -mconsole -o $@ perlglob$(o) $(LIBFILES) .ELSE $(LINK32) $(BLINK_FLAGS) $(LIBFILES) -out:$@ -subsystem:$(SUBSYS) \ -- perlglob$(o) setargv$(o) ++ perlglob$(o) setargv$(o) .ENDIF perlglob$(o) : perlglob.c @@@ -979,7 -972,7 +979,7 @@@ $(MINIPERL) : $(MINIDIR) $(MINI_OBJ) $( @$(mktmp c0x32$(o) $(MINI_OBJ:s,\,\\),$(@:s,\,\\),,$(LIBFILES),) .ELIF "$(CCTYPE)" == "GCC" $(LINK32) -v -mconsole -o $@ $(BLINK_FLAGS) \ -- $(mktmp $(LKPRE) $(MINI_OBJ:s,\,\\) $(LIBFILES) $(LKPOST)) ++ $(mktmp $(LKPRE) $(MINI_OBJ:s,\,\\) $(LIBFILES) $(LKPOST)) .ELSE $(LINK32) -subsystem:console -out:$@ \ @$(mktmp $(BLINK_FLAGS) $(LIBFILES) $(MINI_OBJ:s,\,\\)) @@@ -1077,7 -1070,7 +1077,7 @@@ $(X2P) : $(MINIPERL) $(X2P_OBJ @$(mktmp $(BLINK_FLAGS) $(LIBFILES) $(X2P_OBJ:s,\,\\)) .ENDIF --perlmain.c : runperl.c ++perlmain.c : runperl.c copy runperl.c perlmain.c perlmain$(o) : perlmain.c @@@ -1098,7 -1091,7 +1098,7 @@@ $(PERLEXE): $(PERLDLL) $(CONFIGPM) $(PE .ENDIF copy $(PERLEXE) $(WPERLEXE) $(MINIPERL) -I..\lib bin\exetype.pl $(WPERLEXE) WINDOWS -- copy splittree.pl .. ++ copy splittree.pl .. $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" $(AUTODIR) $(DYNALOADER).c: $(MINIPERL) $(EXTDIR)\DynaLoader\dl_win32.xs $(CONFIGPM) @@@ -1203,12 -1196,12 +1203,12 @@@ $(STORABLE_DLL): $(PERLDEP) $(STORABLE) ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl cd $(EXTDIR)\$(*B) && $(MAKE) -$(FILTER_DLL): $(PERLEXE) $(FILTER).xs +$(FILTER_DLL): $(PERLDEP) $(FILTER).xs - cd $(EXTDIR)\Filter\Util && \ + cd $(EXTDIR)\Filter\Util\Call && \ ..\..\..\miniperl -I..\..\..\lib Makefile.PL INSTALLDIRS=perl - cd $(EXTDIR)\Filter\Util && $(MAKE) + cd $(EXTDIR)\Filter\Util\Call && $(MAKE) -$(ERRNO_PM): $(PERLEXE) $(ERRNO)_pm.PL +$(ERRNO_PM): $(PERLDEP) $(ERRNO)_pm.PL cd $(EXTDIR)\$(*B) && \ ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl cd $(EXTDIR)\$(*B) && $(MAKE) @@@ -1280,7 -1274,7 +1281,7 @@@ installhtml : do $(RCOPY) html\*.* $(INST_HTML)\*.* inst_lib : $(CONFIGPM) -- copy splittree.pl .. ++ copy splittree.pl .. $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" $(AUTODIR) $(RCOPY) ..\lib $(INST_LIB)\*.* @@@ -1321,7 -1315,7 +1322,7 @@@ test-wide-notty : test-pre set HARNESS_PERL_SWITCHES=-C && \ cd ..\t && $(PERLEXE) -I..\lib harness --clean : ++clean : -@erase miniperlmain$(o) -@erase $(MINIPERL) -@erase perlglob$(o) @@@ -1352,9 -1346,9 +1353,9 @@@ ok: util okfile: utils $(PERLEXE) -I..\lib ..\utils\perlbug -ok -s "(UNINSTALLED)" -F perl.ok -- ++ nok: utils $(PERLEXE) -I..\lib ..\utils\perlbug -nok -s "(UNINSTALLED)" -- ++ nokfile: utils $(PERLEXE) -I..\lib ..\utils\perlbug -nok -s "(UNINSTALLED)" -F perl.nok