IBM AIX Continuous Availability Features - IBM Redbooks
IBM AIX Continuous Availability Features - IBM Redbooks
IBM AIX Continuous Availability Features - IBM Redbooks
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
myprog: myprog.c<br />
$(CC) -q64 -o myprog myprog.c $(LIB)<br />
clean:<br />
rm -f *.o myprog service kkey_set64<br />
The kernel extension will create a private heap protected by key KKEY_VMM. Then kernel<br />
extension will try to access it with and without KKEY_VMM in its keyset.<br />
When trying access without KKEY_VMM, it should cause a DSI with exception<br />
EXCEPT_SKEY; see Example 3-22.<br />
Example 3-22 Kernel extension code, system call is kkey_test(): kkey_set.c<br />
#include <br />
#include <br />
#include <br />
#include <br />
#include <br />
#include <br />
#include <br />
kkey_test_init(int cmd, struct uio * uio)<br />
{<br />
printf("Kernel Extension kkey_set loaded successfully\n");<br />
return 0;<br />
}<br />
int kkey_test(int mode)<br />
{<br />
kerrno_t rc;<br />
kkey_t kkey=KKEY_VMM;<br />
heapattr_t heapattr;<br />
heapaddr_t my_heap=HPA_INVALID_HEAP;<br />
kkeyset_t myset=KKEYSET_INVALID;<br />
hkeyset_t hwset, hwset1, oldhwset, oldhwset1;<br />
printf("\n");<br />
if ((rc=kkeyset_create( &myset))!=0){<br />
printf("kkeyset_create() failed\n");<br />
return -1;<br />
}<br />
hwset1=hkeyset_get();<br />
printf("Current hardware keyset =%016lx\n",hwset1);<br />
/*<br />
* Add keyset KKEYSET_KERNEXT to our keyset.<br />
* Remember KKEYSET_KERNEXT= {KKEY_PUBLIC, KKEY_BLOCK_DEV, KKEY_COMMO,<br />
* KKEY_USB, KKEY_GRPAPHICS, KKEY_FILESYSTEM, KKEY_DMA, KKEY_TRB, KKEY_MBUF,<br />
* KKEY_IOMAP}<br />
*/<br />
if ((rc=kkeyset_add_set(myset, KKEYSET_KERNEXT))!=0){<br />
printf("kkseyset_add_set() failed\n");<br />
return -1;<br />
}<br />
if ((rc=kkeyset_to_hkeyset(myset, &hwset))!=0){<br />
printf("kkeyset_to_hkeyset() failed: rc=%lx\n",rc);<br />
return -1;<br />
Chapter 3. <strong>AIX</strong> advanced continuous availability tools and features 91