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

PerlIO and seek problem with non-ithreaded perl

From:
Stas Bekman
Date:
March 12, 2003 22:04
Subject:
PerlIO and seek problem with non-ithreaded perl
Message ID:
3E701EF0.5000100@stason.org
I have an interesting case of an argument nullification on the function call.

Here is a snippet of Perl_PerlIO_seek:

int
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) 
configuration:
   Platform:
     osname=linux, osvers=2.4.19-16mdksmp, archname=i686-linux
     uname='linux hope.stason.org 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
   Compiler:
     cc='cc', ccflags ='-DDEBUGGING -fno-strict-aliasing -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
     optimize='-g',
     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', 
lseeksize=8
     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/libc-2.3.1.so, so=so, useshrplib=true, libperl=libperl.so
     gnulibc_version='2.3.1'
   Dynamic Linking:
     dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic 
-Wl,-rpath,/home/stas/perl/blead/lib/5.9.0/i686-linux/CORE'
     cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl):
   Compile-time options: DEBUGGING USE_LARGE_FILES
   Locally applied patches:
   	DEVEL18374
   Built under linux
   Compiled at Mar 13 2003 16:31:18
   @INC:
     /home/stas/perl/blead/lib/5.9.0/i686-linux
     /home/stas/perl/blead/lib/5.9.0
     /home/stas/perl/blead/lib/site_perl/5.9.0/i686-linux
     /home/stas/perl/blead/lib/site_perl/5.9.0
     /home/stas/perl/blead/lib/site_perl
     .


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About