11.01.2013 Views

IBM AIX Continuous Availability Features - IBM Redbooks

IBM AIX Continuous Availability Features - IBM Redbooks

IBM AIX Continuous Availability Features - IBM Redbooks

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Example 3-41 Sample Vue script pvue2.e<br />

#!/usr/bin/probevue<br />

/*<br />

* Strings are by default Global variables<br />

*/<br />

String global_var[4096];<br />

/*<br />

* Global variables are accessible throughout the scope of Vue file in any clause<br />

*/<br />

__global global_var1;<br />

__kernel long lbolt;<br />

/*<br />

* Thread variables are like globals but instantiated per traced thread first<br />

* time it executes an action block that uses the variable<br />

*/<br />

__thread int thread_var;<br />

/*<br />

* Built-in variables are not supposed to be defined. They are by default<br />

* available to the clauses where is makes any sense. They are : __rv, __arg1,<br />

* __pid etc. __rv (return value for system calls) makes sense only when system<br />

* call is returning and hence available only for syscall()->exit() action block.<br />

* While __arg1, __arg2 and arg3 are accessible at syscall()->entry(). As system<br />

* call read() accespts only 3 arguments so only __arg1, __arg2 and __arg2 are<br />

* valid for read()->entry() action block.<br />

* __pid can be accessed in any clause as current process id is valid everywhere<br />

*/<br />

int read(int fd, void *buf, int n);<br />

@@BEGIN<br />

{<br />

global_var1=0;<br />

lst=list();<br />

printf("lbolt=%lld\n",lbolt);<br />

}<br />

@@uft:$1:*:printf:entry<br />

{<br />

global_var1=global_var1+1;<br />

append(lst,1);<br />

}<br />

/*<br />

* Valid built-in variables : __pid, __arg1, __arg2, __arg3<br />

* __rv not valid here, its valid only inside read()->exit()<br />

*/<br />

@@syscall:*:read:entry<br />

when ( __pid == $1 )<br />

{<br />

/*<br />

* Automatic variable is not accessible outside their own clause. So auto_var<br />

Chapter 3. <strong>AIX</strong> advanced continuous availability tools and features 123

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!