Ruby/HPUX/syscall problem/bug

T

tad.bochan

Hello, I need a little help please.
If anyone on the list is running ruby on hpux 11+ with a ruby
version later than "ruby 1.8.0 (2003-08-04) [hppa2.0w-hpux11.11]",
could you please try the following code to see if the problem/bug
has been fixed in the later version ?.
TIA.
Tad.

sysfunc="SYS_mmap"
lib="/usr/include/sys/scall_define.h"
scall=open(lib).readlines.grep(/\s#{sysfunc}\s/)[0].split[2].to_i
puts "#{sysfunc} = #{scall}"
SYS_mmap = 71
PROT_NONE = 0
PROT_USER = 0
PROT_READ = 1
PROT_WRITE = 2
MAP_SHARED = 1
addr,len,prot,flags,ofs=0,80,PROT_READ, MAP_SHARED,0
filedes=open("shmfile","a+")
mmfptr=syscall(SYS_mmap, addr, len, prot, flags, filedes.fileno, ofs)

On my system, this fails with the following error report,
ruby pntrs.rb
SYS_mmap = 71
pntrs.rb:13: [BUG] rb_sys_fail() - errno == 0
ruby 1.8.0 (2003-08-04) [hppa2.0w-hpux11.11]

Abort(coredump)





This message and any attachments (the "message") is
intended solely for the addressees and is confidential.
If you receive this message in error, please delete it and
immediately notify the sender. Any use not in accord with
its purpose, any dissemination or disclosure, either whole
or partial, is prohibited except formal approval. The internet
can not guarantee the integrity of this message.
BNP PARIBAS (and its subsidiaries) shall (will) not
therefore be liable for the message if modified.

---------------------------------------------

Ce message et toutes les pieces jointes (ci-apres le
"message") sont etablis a l'intention exclusive de ses
destinataires et sont confidentiels. Si vous recevez ce
message par erreur, merci de le detruire et d'en avertir
immediatement l'expediteur. Toute utilisation de ce
message non conforme a sa destination, toute diffusion
ou toute publication, totale ou partielle, est interdite, sauf
autorisation expresse. L'internet ne permettant pas
d'assurer l'integrite de ce message, BNP PARIBAS (et ses
filiales) decline(nt) toute responsabilite au titre de ce
message, dans l'hypothese ou il aurait ete modifie.
 
N

nobu.nokada

Hi,

At Tue, 7 Sep 2004 22:10:57 +0900,
If anyone on the list is running ruby on hpux 11+ with a ruby
version later than "ruby 1.8.0 (2003-08-04) [hppa2.0w-hpux11.11]",
could you please try the following code to see if the problem/bug
has been fixed in the later version ?.

syscall decides that an error occurred when a negative value is
returned. Therefore it cannot be used for system calls which
return addresses.
 
A

Ara.T.Howard

Hello, I need a little help please.
If anyone on the list is running ruby on hpux 11+ with a ruby
version later than "ruby 1.8.0 (2003-08-04) [hppa2.0w-hpux11.11]",
could you please try the following code to see if the problem/bug
has been fixed in the later version ?.
TIA.
Tad.

sysfunc="SYS_mmap"
lib="/usr/include/sys/scall_define.h"
scall=open(lib).readlines.grep(/\s#{sysfunc}\s/)[0].split[2].to_i
puts "#{sysfunc} = #{scall}"
SYS_mmap = 71
PROT_NONE = 0
PROT_USER = 0
PROT_READ = 1
PROT_WRITE = 2
MAP_SHARED = 1
addr,len,prot,flags,ofs=0,80,PROT_READ, MAP_SHARED,0
filedes=open("shmfile","a+")
mmfptr=syscall(SYS_mmap, addr, len, prot, flags, filedes.fileno, ofs)

On my system, this fails with the following error report,
ruby pntrs.rb
SYS_mmap = 71
pntrs.rb:13: [BUG] rb_sys_fail() - errno == 0
ruby 1.8.0 (2003-08-04) [hppa2.0w-hpux11.11]

Abort(coredump)


i can't help you with the hpux problem - but have you tried to compile guy's
mmap module? i use it all the time and it's very good - seems like that would
be easier that using syscall...

cheers.

-a
--
===============================================================================
| EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE :: 303.497.6469
| A flower falls, even though we love it;
| and a weed grows, even though we do not love it.
| --Dogen
===============================================================================
 
T

ts

t> mmfptr=syscall(SYS_mmap, addr, len, prot, flags, filedes.fileno, ofs)

Well, I don't know for HP/UX but at least on linux you must give it a
packed struct, for example


svg% cat b.rb
#!/usr/bin/ruby
SYS_mmap = 90
PROT_NONE = 0
PROT_USER = 0
PROT_READ = 1
PROT_WRITE = 2
MAP_SHARED = 1
fd = open("b.rb", "a+")
vec = [0, 80, PROT_READ, MAP_SHARED, fd.fileno, 0]
mmfptr = syscall(SYS_mmap, vec.pack("IIIIII"))
printf "0x%x\n", mmfptr
svg%

svg% b.rb
0x40014000
svg%


Guy Decoux
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top