Ruby/HPUX/syscall problem/bug

Discussion in 'Ruby' started by tad.bochan@bnpparibas.com, Sep 7, 2004.

  1. Guest

    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.
    , Sep 7, 2004
    #1
    1. Advertising

  2. Guest

    Hi,

    At Tue, 7 Sep 2004 22:10:57 +0900,
    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
    , Sep 7, 2004
    #2
    1. Advertising

  3. Guest

    On Tue, 7 Sep 2004 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
    ===============================================================================
    , Sep 7, 2004
    #3
  4. ts Guest

    >>>>> "t" == tad bochan <> 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
    ts, Sep 7, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Thomas Keller

    Problem with getpwnam() syscall

    Thomas Keller, Jan 19, 2004, in forum: Perl
    Replies:
    1
    Views:
    1,360
    Joe Smith
    Jan 20, 2004
  2. Basile Starynkevitch [news]

    [ANN] Tracery - a ruby interface to ptrace syscall on linux

    Basile Starynkevitch [news], Jan 29, 2004, in forum: Ruby
    Replies:
    0
    Views:
    115
    Basile Starynkevitch [news]
    Jan 29, 2004
  3. Andrew Walrond

    [BUG] Kernel#syscall on x86_64 linux

    Andrew Walrond, Sep 9, 2004, in forum: Ruby
    Replies:
    6
    Views:
    112
    Andrew Walrond
    Sep 10, 2004
  4. John Carter
    Replies:
    0
    Views:
    113
    John Carter
    Jun 30, 2008
  5. Daniel KamiÅ?ski

    execve syscall in ruby

    Daniel KamiÅ?ski, Jul 19, 2008, in forum: Ruby
    Replies:
    6
    Views:
    143
    Daniel Kaminski
    Jul 19, 2008
Loading...

Share This Page