develooper Front page | perl.perl5.porters | Postings from March 2003

PerlIO and seek problem with non-ithreaded perl

Stas Bekman
March 12, 2003 22:04
PerlIO and seek problem with non-ithreaded perl
Message ID:
I have an interesting case of an argument nullification on the function call.

Here is a snippet of Perl_PerlIO_seek:

Perl_PerlIO_seek(pTHX_ PerlIO *f, Off_t offset, int whence)
     if (PerlIOValid(f))
	return (*PerlIOBase(f)->tab->Seek) (aTHX_ f, offset, whence);

when the line above gets called it invokes

static IV PerlIOAPR_seek(pTHX_ PerlIO *f, Off_t offset, int whence)

However 'whence' always becomes 0. Here is the a snippet of a debug session:

(gdb) step
Breakpoint 6, Perl_PerlIO_seek (f=0x86bdd14, offset=0, whence=2) at perlio.c:1506
(gdb) step
Breakpoint 7, PerlIOAPR_seek (f=0x86bdd14, offset=0, whence=0) at apr_perlio.c:209

if I go a frame up, I see again '2', go down it becomes '0'. Any ideas why 
this happens? The same happens if I pass '1' as 'whence'.

This only happens with perl built w/o ithreads. w/ ithreads it works fine. 
Reproduced with 5.8.0 and blead-perl.

Any clues on how to debug this further are welcome.

perl -V:

Summary of my perl5 (revision 5.0 version 9 subversion 0 patch 18958) 
     osname=linux, osvers=2.4.19-16mdksmp, archname=i686-linux
     uname='linux 2.4.19-16mdksmp #1 smp fri sep 20 16:08:37 
cest 2002 i686 unknown unknown gnulinux '
     config_args='-des -Dprefix=/home/stas/perl/blead -Doptimize=-g 
-Duseshrplib -Dusedevel -DDEBUG_LEAKING_SCALARS'
     hint=recommended, useposix=true, d_sigaction=define
     usethreads=undef useithreads=undef usemultiplicity=undef
     useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
     use64bitint=undef use64bitall=undef uselongdouble=undef
     usemymalloc=n, bincompat5005=undef
     cc='cc', ccflags ='-DDEBUGGING -fno-strict-aliasing -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
     cppflags='-DDEBUGGING -fno-strict-aliasing -I/usr/include/gdbm'
     ccversion='', gccversion='3.2 (Mandrake Linux 9.0 3.2-1mdk)', gccosandvers=''
     intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
     d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
     ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', 
     alignbytes=4, prototype=define
   Linker and Libraries:
     ld='cc', ldflags =' -L/usr/local/lib'
     libpth=/usr/local/lib /lib /usr/lib
     libs=-lnsl -lgdbm -ldb -ldl -lm -lc -lcrypt -lutil -lrt
     perllibs=-lnsl -ldl -lm -lc -lcrypt -lutil -lrt
     libc=/lib/, so=so, useshrplib=true,
   Dynamic Linking:
     dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic 
     cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Characteristics of this binary (from libperl):
   Compile-time options: DEBUGGING USE_LARGE_FILES
   Locally applied patches:
   Built under linux
   Compiled at Mar 13 2003 16:31:18

Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker     mod_perl Guide ---> Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About