Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Ruby/HPUX/syscall problem/bug

Reply
Thread Tools

Ruby/HPUX/syscall problem/bug

 
 
tad.bochan@bnpparibas.com
Guest
Posts: n/a
 
      09-07-2004


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.



 
Reply With Quote
 
 
 
 
nobu.nokada@softhome.net
Guest
Posts: n/a
 
      09-07-2004
Hi,

At Tue, 7 Sep 2004 22:10:57 +0900,
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote in [ruby-talk:111729]:
> 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.

--
Nobu Nakada


 
Reply With Quote
 
 
 
 
Ara.T.Howard@noaa.gov
Guest
Posts: n/a
 
      09-07-2004
On Tue, 7 Sep 2004 (E-Mail Removed) wrote:

> 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
================================================== =============================
 
Reply With Quote
 
ts
Guest
Posts: n/a
 
      09-07-2004
>>>>> "t" == tad bochan <(E-Mail Removed)> writes:

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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments