Ask a Question related to PERL Modules, Design and Development.
-
peter pilsl #1
IPC : destroy IPC::ShareLite-segments
I use IPC::ShareLite-segments but havnt figured out an elegant way to
destroy the created segments. The recommended way (manpage) always fails
with "invalid argument", which reminds to a false shmctl-call.
So I do a syscall on ipcs to get the id of the segment and call shmctl on
my own, which doesnt feel good to me.
----------share_del.pl---------
#!/usr/bin/perl -w
use strict;
use IPC::ShareLite;
use IPC::SysV qw(IPC_RMID);
# CREATE A SEGMENT WITH KEY=1234 alias 0x42d
my $cache = new IPC::ShareLite (-key=>1234,
-create=>'yes',
-size=>50000,
-destroy=>'no') or warn "$!\n";
undef $cache;
print `ipcs -m | grep 4d2`;
# try to remove via ShareLite ..
print "try with ShareLite\n";
my $cache_d = new IPC::ShareLite (-key=>1234,
-destroy=>'yes') or warn "could not destroy segment : $!\n";
undef $cache_d;
print `ipcs -m | grep 4d2`;
# try to remove via direct call
print "try with shmctl\n";
$a=`ipcs -m | grep 4d2`;
$b=$1 if $a=~/^.*?\s(.*?)\s/;
shmctl($b,IPC_RMID,0) or warn "could not destroy segment : $!\n";
print `ipcs -m | grep 4d2`;
--------------------------
$ ~/bin/devel/share_del.pl
0x000004d2 26869763 pilsl 666 50000 0
try with ShareLite
could not destroy segment : Invalid argument
0x000004d2 26869763 pilsl 666 50000 0
try with shmctl
any help ?
thnx,
peter
--
peter pilsl
[email]pilsl_usenet@goldfisch.at[/email]
[url]http://www.goldfisch.at[/url]
peter pilsl Guest
-
The IPC::ShareLite is very slow than fetch data from file ??
time shmTest.pl .... 0.11u 0.02s 0:00.13 100.0% ---------------------------------------------------------------------------- --- time... -
preloading in segments
How can I preload a flashwebsite in segments? I'm building a website with 9 'rooms'. The background and the main navigation are the same in all the... -
How many rollback segments can a transaction use?
Oracle8(TM) Server Concepts " When a transaction runs out of space in the current extent and needs to continue writing, Oracle finds an available... -
newbie DBA - rollback segments
I'm new to the oracle dba roll, so please be gentle. I load several large tables every night. My database is only about 20gB and is 24x7. I... -
mapping segments to sessions
I am trying to trace segment growth in the temp tablespace back to a specific session. The tablespace will grow rapidly (40Gb) without warning. I... -
Ron Reidy #2
Re: IPC : destroy IPC::ShareLite-segments
peter pilsl wrote:What happens if "$a=~/^.*?\s(.*?)\s/" fails?> I use IPC::ShareLite-segments but havnt figured out an elegant way to
> destroy the created segments. The recommended way (manpage) always fails
> with "invalid argument", which reminds to a false shmctl-call.
>
> So I do a syscall on ipcs to get the id of the segment and call shmctl on
> my own, which doesnt feel good to me.
>
> ----------share_del.pl---------
> #!/usr/bin/perl -w
>
> use strict;
> use IPC::ShareLite;
> use IPC::SysV qw(IPC_RMID);
>
> # CREATE A SEGMENT WITH KEY=1234 alias 0x42d
> my $cache = new IPC::ShareLite (-key=>1234,
> -create=>'yes',
> -size=>50000,
> -destroy=>'no') or warn "$!\n";
>
> undef $cache;
>
>
> print `ipcs -m | grep 4d2`;
>
> # try to remove via ShareLite ..
> print "try with ShareLite\n";
> my $cache_d = new IPC::ShareLite (-key=>1234,
> -destroy=>'yes') or warn "could not destroy segment : $!\n";
>
> undef $cache_d;
> print `ipcs -m | grep 4d2`;
>
> # try to remove via direct call
> print "try with shmctl\n";
> $a=`ipcs -m | grep 4d2`;
> $b=$1 if $a=~/^.*?\s(.*?)\s/;
> shmctl($b,IPC_RMID,0) or warn "could not destroy segment : $!\n";
> print `ipcs -m | grep 4d2`;
> --------------------------
>
> $ ~/bin/devel/share_del.pl
> 0x000004d2 26869763 pilsl 666 50000 0
> try with ShareLite
> could not destroy segment : Invalid argument
> 0x000004d2 26869763 pilsl 666 50000 0
> try with shmctl
>
>
> any help ?
> thnx,
> peter
>
--
Ron Reidy
Oracle DBA
Ron Reidy Guest
-
peter pilsl #3
Re: IPC : destroy IPC::ShareLite-segments
Ron Reidy wrote:
>> shmctl($b,IPC_RMID,0) or warn "could not destroy segment : $!\n";I dont think about this. The code is only for demonstration of my problem>
> What happens if "$a=~/^.*?\s(.*?)\s/" fails?
>
and not productional code.
The problem and the warning occures at a different position.
thnx,
peter
--
peter pilsl
[email]pilsl_usenet@goldfisch.at[/email]
[url]http://www.goldfisch.at[/url]
peter pilsl Guest



Reply With Quote

