Jira (FACT-2229) load_averages fact for AIX

29 views
Skip to first unread message

Bogdan Irimie (JIRA)

unread,
Dec 11, 2019, 7:10:04 AM12/11/19
to puppe...@googlegroups.com
Bogdan Irimie updated an issue
 
Facter / Task FACT-2229
load_averages fact for AIX
Change By: Bogdan Irimie
Summary: load_averages fact for AIX
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Ciprian Badescu (JIRA)

unread,
Dec 23, 2019, 8:39:03 AM12/23/19
to puppe...@googlegroups.com
Ciprian Badescu commented on Task FACT-2229
 
Re: load_averages fact for AIX

int rc = getkerninfo(KINFO_GET_AVENRUN, reinterpret_cast<char*>(averages.data()), &buf_size, 0);

Ciprian Badescu (JIRA)

unread,
Dec 23, 2019, 9:28:05 AM12/23/19
to puppe...@googlegroups.com

I have not found getkerninfo available in system dynamic libraries on aix 6.1 (I assume bellow java related library doesn't count):

[0] [AIX] root@aix61-2:~ # for i in `find / -name *\.so*`; do nm $i 2>/dev/null | grep T | grep getkerninfo; if [ $? -eq 0 ]; then echo $i; fi; done
.getkerninfo T 268473200
/usr/java6/jre/lib/ppc/libnet.so
.getkerninfo T 268452320
/usr/lpp/cas.agent/inst_root/var/opt/tivoli/ep/_jvm/jre/lib/ppc/libnet.so
.getkerninfo T 268452320
/var/opt/tivoli/ep/_jvm/jre/lib/ppc/libnet.so

 

Instead it is found in static system library:

[0] [AIX] root@aix61-2:~ # nm /lib/libc.a | grep T | grep getkerninfo
.getkerninfo T 1298384

 

One solution would be to go with a native extension, should I give it a try or there are other ways?

Ciprian Badescu (JIRA)

unread,
Dec 24, 2019, 6:42:03 AM12/24/19
to puppe...@googlegroups.com
Ciprian Badescu assigned an issue to Ciprian Badescu
Change By: Ciprian Badescu
Assignee: Ciprian Badescu

Ciprian Badescu (JIRA)

unread,
Dec 24, 2019, 6:43:04 AM12/24/19
to puppe...@googlegroups.com

I created a gem native extension see if load_averages could be read like that: https://github.com/ciprianbadescu/aix_facter_helper

irb(main):001:0> require 'aix_facter_helper.so'
=> true
irb(main):002:0> AixFacterHelper::getLoadAverages
=> [1.7595977783203125, 1.557647705078125, 1.699554443359375]

Ciprian Badescu (JIRA)

unread,
Jan 6, 2020, 11:34:04 AM1/6/20
to puppe...@googlegroups.com

The dlopen subroutine can be used to load a module that is a member of an archive

https://www.ibm.com/support/knowledgecenter/ssw_aix_71/d_bostechref/dlopen.html

require 'ffi'

module Hello
extend FFI::Library
@ffi_lib_flags=0x00040000|0x00010000|0x00000004
ffi_lib "libc.a(shr.o)"
attach_function :puts, [ :string ], :int
end

Hello.puts("Hello, World")

Reply all
Reply to author
Forward
0 new messages