marioroy has asked for the wisdom of the Perl Monks concerning the following question:

Greetings all,

I'm wanting to include support for AIX for enqueue/dequeue and wait/notify features to be added to MCE::Shared for the upcoming 1.7 release. The optional features require the shared process to pass file handles (mutex fd's) to workers. The mutex handles are enabled on-demand. The reason is that not all shares require enqueue/dequeue or wait/notify capability.

This link suggest sendmsg/recvmsg compatibility between AIX and Linux. Thus, doing sendmsg/recvmsg in pure-Perl is possible on Linux, BSD/Darwin/DragonFly, including AIX. I'm missing the actual values from an AIX box.

Can a monk with access to an AIX box run the 3 liners please?

require 'sys/syscall.ph'; # this is built with h2ph print "SYS_sendmsg: ", SYS_sendmsg(), "\n"; print "SYS_recvmsg: ", SYS_recvmsg(), "\n";

Building syscall.ph is typically done with one of the following:

( cd /usr/include; h2ph * sys/* ) or ( cd /usr/include; h2ph -r -l . )

But that requires root access. One can run as non-root with the -d option (destination). It has been a while and forgotten where the include files are located on AIX.

A likely fallback plan is IO::FDPass. It requires C and not sure if the module works on AIX. This module has one dependency which is Canary::Stability.

Thank you in advance for your time.

Sincerely, Mario

Replies are listed 'Best First'.
Re: Need SYS_sendmsg and SYS_recvmsg values from an AIX box
by Laurent_R (Canon) on Aug 19, 2015 at 20:39 UTC
    Hi Mario,

    I have an (old) AIX system (and old Perl), but I could not get anything from your command. Perl for AIX:

    $perl -v This is perl, v5.10.1 (*) built for ppc-aix-thread-multi Copyright 1987-2009, Larry Wall Perl may be copied only under the terms of either the Artistic License + or the GNU General Public License, which may be found in the Perl 5 source ki +t. Complete documentation for Perl, including FAQ lists, should be found +on this system using "man perl" or "perldoc perl". If you have access to + the Internet, point your browser at http://www.perl.org/, the Perl Home Pa +ge.
    Your command:
    perl -e ' > require "sys/syscall.ph"; > print "SYS_sendmsg: ", SYS_sendmsg(), "\n"; > print "SYS_recvmsg: ", SYS_recvmsg(), "\n"; > ' Can't locate sys/syscall.ph in @INC (@INC contains: /opt/freeware/lib/ +perl5/5.10.1/ppc-aix-thread-multi /opt/freeware/lib/perl5/5.10.1 /opt +/freeware/lib/perl5/site_perl/5.10.1/ppc-aix-thread-multi /opt/freewa +re/lib/perl5/site_perl/5.10.1 .) at -e line 2. 22:31:14|prod@op66idb1[/exec/applis/prod/MDSP_LOG]$
    Hmm, not sure I ran the command you really needed. Please let me know if I can help you better.

    Cheers,

    Laurent.

      Thank you very much Laurent_R. The syscall.ph file is typically not installed and requires one to run the h2ph command. Maybe that's not feasible, but not sure.

Re: Need SYS_sendmsg and SYS_recvmsg values from an AIX box
by Laurent_R (Canon) on Aug 19, 2015 at 21:11 UTC
    Hmm, I notice only now that I had not seen your full message (silly from me).

    I do not have root access. I might be able to ask someone having root access to run the command. But please supply the exact full command, that person (a supplier of my client) would most probably do it as a favor to me, but I am not going to ask several times.

    Again, if I can help you further, please ask.

      Updated with output from a Linux VM.

      Thank you Laurent_R. I just tried with the -d option and root access is not required. There is space followed by a dot after the -l (letter l as in larry).

      mkdir /tmp/phfiles cd /usr/include h2ph -d /tmp/phfiles -r -l . cd /tmp/phfiles grep sendmsg */*.ph grep recvmsg */*.ph

      Below, the grep output from a 64-bit Linux OS. Thus, the values are 46 and 47 for sendmsg and recvmsg respectively.

      $ cd /tmp/phfiles $ grep sendmsg */*.ph asm-generic/unistd.ph:eval 'sub __NR_sendmsg () {211;}' unless defined +(&__NR_sendmsg); asm/unistd_64.ph: eval 'sub __NR_sendmsg () {46;}' unless defined(& +__NR_sendmsg); asm/unistd_x32.ph: eval 'sub __NR_sendmsg () {( &__X32_SYSCALL_BIT ++ 518);}' unless defined(&__NR_sendmsg); bits/syscall.ph: eval 'sub SYS_sendmsg () { &__NR_sendmsg;}' unless + defined(&SYS_sendmsg); bits/syscall.ph: eval 'sub SYS_sendmsg () { &__NR_sendmsg;}' unless + defined(&SYS_sendmsg); $ grep recvmsg */*.ph asm-generic/unistd.ph:eval 'sub __NR_recvmsg () {212;}' unless defined +(&__NR_recvmsg); asm/unistd_64.ph: eval 'sub __NR_recvmsg () {47;}' unless defined(& +__NR_recvmsg); asm/unistd_x32.ph: eval 'sub __NR_recvmsg () {( &__X32_SYSCALL_BIT ++ 519);}' unless defined(&__NR_recvmsg); bits/syscall.ph: eval 'sub SYS_recvmsg () { &__NR_recvmsg;}' unless + defined(&SYS_recvmsg); bits/syscall.ph: eval 'sub SYS_recvmsg () { &__NR_recvmsg;}' unless + defined(&SYS_recvmsg);
        Hi Mario, this is the output of your first grep command: And the second one: I don't make sense on that, but I hope this helps you.

        Cheers,

        Laurent.