diff options
-rw-r--r-- | doio.c | 8 | ||||
-rw-r--r-- | embed.h | 18 | ||||
-rwxr-xr-x | embed.pl | 11 | ||||
-rw-r--r-- | makedef.pl | 21 | ||||
-rw-r--r-- | perlsdio.h | 13 | ||||
-rw-r--r-- | proto.h | 11 |
6 files changed, 48 insertions, 34 deletions
@@ -2090,18 +2090,20 @@ Perl_do_shmio(pTHX_ I32 optype, SV **mark, SV **sp) #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. **/ -#ifdef SOCKS_64BIT_BUG + static S64_IOB *s64_buffer = (S64_IOB *) NULL; /* get a buffered stream pointer */ -static S64_IOB *_s64_get_buffer( PerlIO *f) { +static S64_IOB *S_s64_get_buffer( PerlIO *fp) { S64_IOB *ptr = s64_buffer; - while( ptr && ptr->fp != f) + while( ptr && ptr->fp != fp) ptr = ptr->next; return( ptr); } @@ -193,7 +193,8 @@ #define do_vecget Perl_do_vecget #define do_vecset Perl_do_vecset #define do_vop Perl_do_vop -#ifdef SOCKS_64BIT_BUG +#if defined(SOCKS_64BIT_BUG) +#define s64_get_buffer S_s64_get_buffer #endif #define dofile Perl_dofile #define dowantarray Perl_dowantarray @@ -1663,7 +1664,8 @@ #define do_vecget(a,b,c) Perl_do_vecget(aTHX_ a,b,c) #define do_vecset(a) Perl_do_vecset(aTHX_ a) #define do_vop(a,b,c,d) Perl_do_vop(aTHX_ a,b,c,d) -#ifdef SOCKS_64BIT_BUG +#if defined(SOCKS_64BIT_BUG) +#define s64_get_buffer(a) S_s64_get_buffer(aTHX_ a) #endif #define dofile(a) Perl_dofile(aTHX_ a) #define dowantarray() Perl_dowantarray(aTHX) @@ -3259,13 +3261,15 @@ #define do_vecset Perl_do_vecset #define Perl_do_vop CPerlObj::Perl_do_vop #define do_vop Perl_do_vop -#ifdef SOCKS_64BIT_BUG -#define do_getc Perl_do_getc -#define do_ungetc Perl_do_ungetc -#define do_fread Perl_do_fread -#define do_s64_delete_buffer Perl_do_s64_delete_buffer +#if defined(SOCKS_64BIT_BUG) +#define S_s64_get_buffer CPerlObj::S_s64_get_buffer +#define s64_get_buffer S_s64_get_buffer #define do_s64_tell Perl_do_s64_tell +#define do_s64_fread Perl_do_s64_fread +#define do_s64_getc Perl_do_s64_getc #define do_s64_seek Perl_do_s64_seek +#define do_s64_ungetc Perl_do_s64_ungetc +#define do_s64_delete_buffer Perl_do_s64_delete_buffer #endif #define Perl_dofile CPerlObj::Perl_dofile #define dofile Perl_dofile @@ -1505,13 +1505,14 @@ p |I32 |do_trans |SV* sv p |UV |do_vecget |SV* sv|I32 offset|I32 size p |void |do_vecset |SV* sv p |void |do_vop |I32 optype|SV* sv|SV* left|SV* right -#ifdef SOCKS_64BIT_BUG -Ajnop |int |do_getc |PerlIO* fp -Ajnop |int |do_ungetc |int ch|PerlIO* fp -Ajnop |SSize_t|do_fread |void *buf|SSize_t count|PerlIO* fp -Ajnop |void |do_s64_delete_buffer|PerlIO* fp +#if defined(SOCKS_64BIT_BUG) +s |S64_IOB*|s64_get_buffer|PerlIO* fp Ajnop |Off_t |do_s64_tell |PerlIO* fp +Ajnop |SSize_t|do_s64_fread |void *buf|SSize_t count|PerlIO* fp +Ajnop |int |do_s64_getc |PerlIO* fp Ajnop |int |do_s64_seek |PerlIO* fp|Off_t pos|int whence +Ajnop |int |do_s64_ungetc |int ch|PerlIO* fp +Ajnop |void |do_s64_delete_buffer|PerlIO* fp #endif p |OP* |dofile |OP* term Ap |I32 |dowantarray diff --git a/makedef.pl b/makedef.pl index e576245831..bf43e665b2 100644 --- a/makedef.pl +++ b/makedef.pl @@ -88,7 +88,7 @@ unless ($PLATFORM eq 'win32') { } if ($PLATFORM eq 'os2') { $CONFIG_ARGS = $1 if /^(?:config_args)='(.+)'$/; - $ARCHNAME = $1 if /^(?:archname)='(.+)'$/; + $ARCHNAME = $1 if /^(?:archname)='(.+)'$/; } } close(CFG); @@ -97,12 +97,9 @@ unless ($PLATFORM eq 'win32') { open(CFG,$config_h) || die "Cannot open $config_h: $!\n"; while (<CFG>) { $define{$1} = 1 if /^\s*#\s*define\s+(MYMALLOC)\b/; - $define{$1} = 1 if /^\s*#\s*define\s+(USE_5005THREADS)\b/; - $define{$1} = 1 if /^\s*#\s*define\s+(USE_ITHREADS)\b/; - $define{$1} = 1 if /^\s*#\s*define\s+(USE_PERLIO)\b/; $define{$1} = 1 if /^\s*#\s*define\s+(MULTIPLICITY)\b/; - $define{$1} = 1 if /^\s*#\s*define\s+(PERL_IMPLICIT_SYS)\b/; - $define{$1} = 1 if /^\s*#\s*define\s+(PERL_BINCOMPAT_5005)\b/; + $define{$1} = 1 if /^\s*#\s*define\s+(PERL_\w+)\b/; + $define{$1} = 1 if /^\s*#\s*define\s+(USE_\w+)\b/; } close(CFG); @@ -480,6 +477,18 @@ unless ($define{'FAKE_THREADS'}) { skip_symbols [qw(PL_curthr)]; } +# All quad int platforms are assumed to have broken SOCKS +unless ($define{USE_SOCKS} && $define{USE_64_BIT_ALL}) { + skip_symbols [qw( + Perl_do_s64_fread + Perl_do_s64_getc + Perl_do_s64_delete_buffer + Perl_do_s64_seek + Perl_do_s64_tell + Perl_do_s64_tell + )]; +} + sub readvar { my $file = shift; my $proc = shift || sub { "PL_$_[2]" }; diff --git a/perlsdio.h b/perlsdio.h index 9e668f6184..1eb10d3abc 100644 --- a/perlsdio.h +++ b/perlsdio.h @@ -48,12 +48,14 @@ #else # ifdef SOCKS_64BIT_BUG # define PerlIO_getc(f) Perl_do_s64_getc(f) -# define PerlIO_ungetc(f,c) Perl_do_s64_ungetc(c,f) +# define PerlIO_ungetc(f,c) Perl_do_s64_ungetc(c,f) # define PerlIO_read(f,buf,count) Perl_do_s64_fread(buf,count,f) +# define PerlIO_tell(f) Perl_do_s64_tell(f) # else # define PerlIO_getc(f) getc(f) # define PerlIO_ungetc(f,c) ungetc(c,f) # define PerlIO_read(f,buf,count) (SSize_t)fread(buf,1,count,f) +# define PerlIO_tell(f) ftell(f) # endif /* SOCKS_64BIT_BUG */ #endif #define PerlIO_eof(f) feof(f) @@ -63,16 +65,11 @@ #define PerlIO_clearerr(f) clearerr(f) #define PerlIO_flush(f) Fflush(f) #ifdef SOCKS_64BIT_BUG -# define PerlIO_tell(f) Perl_do_s64_tell(f) +# define PerlIO_seek(f,o,w) Perl_do_s64_seek(f,o,w) #else -# define PerlIO_tell(f) ftell(f) -#endif -#if defined(VMS) && !defined(__DECC) +# if defined(VMS) && !defined(__DECC) /* Old VAXC RTL doesn't reset EOF on seek; Perl folk seem to expect this */ # define PerlIO_seek(f,o,w) (((f) && (*f) && ((*f)->_flag &= ~_IOEOF)),fseek(f,o,w)) -#else -# ifdef SOCKS_64BIT_BUG -# define PerlIO_seek(f,o,w) Perl_do_s64_seek(f,o,w) # else # define PerlIO_seek(f,o,w) fseek(f,o,w) # endif @@ -247,13 +247,14 @@ PERL_CALLCONV I32 Perl_do_trans(pTHX_ SV* sv); PERL_CALLCONV UV Perl_do_vecget(pTHX_ SV* sv, I32 offset, I32 size); PERL_CALLCONV void Perl_do_vecset(pTHX_ SV* sv); PERL_CALLCONV void Perl_do_vop(pTHX_ I32 optype, SV* sv, SV* left, SV* right); -#ifdef SOCKS_64BIT_BUG -PERL_CALLCONV int Perl_do_getc(PerlIO* fp); -PERL_CALLCONV int Perl_do_ungetc(int ch, PerlIO* fp); -PERL_CALLCONV SSize_t Perl_do_fread(void *buf, SSize_t count, PerlIO* fp); -PERL_CALLCONV void Perl_do_s64_delete_buffer(PerlIO* fp); +#if defined(SOCKS_64BIT_BUG) +STATIC S64_IOB* S_s64_get_buffer(pTHX_ PerlIO* fp); PERL_CALLCONV Off_t Perl_do_s64_tell(PerlIO* fp); +PERL_CALLCONV SSize_t Perl_do_s64_fread(void *buf, SSize_t count, PerlIO* fp); +PERL_CALLCONV int Perl_do_s64_getc(PerlIO* fp); PERL_CALLCONV int Perl_do_s64_seek(PerlIO* fp, Off_t pos, int whence); +PERL_CALLCONV int Perl_do_s64_ungetc(int ch, PerlIO* fp); +PERL_CALLCONV void Perl_do_s64_delete_buffer(PerlIO* fp); #endif PERL_CALLCONV OP* Perl_dofile(pTHX_ OP* term); PERL_CALLCONV I32 Perl_dowantarray(pTHX); |