From 33e4a028707b5fb69e1265b5ae83015f5b7b83e8 Mon Sep 17 00:00:00 2001 From: linggao Date: Fri, 12 Nov 2010 14:51:51 +0000 Subject: [PATCH] added TEAL sepaphore.pm to the rmc package git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8145 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-rmc/lib/perl/TEAL/Semaphore.pm | 22 ++++++++++++++++++++++ xCAT-rmc/xCAT-rmc.spec | 4 ++++ 2 files changed, 26 insertions(+) create mode 100644 xCAT-rmc/lib/perl/TEAL/Semaphore.pm diff --git a/xCAT-rmc/lib/perl/TEAL/Semaphore.pm b/xCAT-rmc/lib/perl/TEAL/Semaphore.pm new file mode 100644 index 000000000..5c912e625 --- /dev/null +++ b/xCAT-rmc/lib/perl/TEAL/Semaphore.pm @@ -0,0 +1,22 @@ +package TEAL::Semaphore; + +use strict; +use warnings; +require IPC::SysV; + +sub new { + my $class = shift; + my $self = {}; + my $key = IPC::SysV::ftok("/var/log/teal",0x646c6100); + $self->{ID} = semget($key,1,0); + bless $self,$class; + return $self; +} + +sub post { + my $self = shift; + my $op = pack("s!3",0,1,0); + semop $self->{ID},$op || die "failed to post" +} + +1; diff --git a/xCAT-rmc/xCAT-rmc.spec b/xCAT-rmc/xCAT-rmc.spec index 46ab616e8..afc9f4354 100644 --- a/xCAT-rmc/xCAT-rmc.spec +++ b/xCAT-rmc/xCAT-rmc.spec @@ -35,6 +35,7 @@ mkdir -p $RPM_BUILD_ROOT/%{prefix}/sbin/rmcmon mkdir -p $RPM_BUILD_ROOT/install/postscripts mkdir -p $RPM_BUILD_ROOT/install/postscripts/rmcmon/resources mkdir -p $RPM_BUILD_ROOT/install/postscripts/rmcmon/scripts +mkdir -p $RPM_BUILD_ROOT/%{prefix}/lib/perl/TEAL set +x cp plugin/* $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_monitoring @@ -42,6 +43,9 @@ cp -r resources $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_monitoring/rmc cp scripts/* $RPM_BUILD_ROOT/%{prefix}/sbin/rmcmon chmod 755 $RPM_BUILD_ROOT/%{prefix}/sbin/rmcmon/* + +cp lib/perl/TEAL/* $RPM_BUILD_ROOT/%{prefix}/lib/perl/TEAL + set -x cp scripts/configrmcnode $RPM_BUILD_ROOT/install/postscripts