MyWebUniversity.com Home Page
 



OpenSolaris man pages main menu


Kernel VM Library Functions                        kvmopen(3KVM)



NAME
     kvmopen, kvmclose - specify a kernel to examine

SYNOPSIS
     cc [ flag... ] file... -lkvm [ library...]
     #include 
     #include 

     kvmt *kvmopen(char *namelist, char *corefile, char *swapfile, int flag,
          char *errstr);


     int kvmclose(kvmt *kd);


DESCRIPTION
     The kvmopen() function initializes a set of  file  descrip-
     tors to be used in subsequent calls to kernel virtual memory
     ( VM) routines.  It returns a pointer to a kernel identifier
     that must be used as the kd argument in subsequent kernel VM
     function calls.


     The namelist argument  specifies  an  unstripped  executable
     file  whose  symbol  table  will  be  used to locate various
     offsets in corefile. If namelist is NUL, the  symbol  table
     of the currently running kernel is used to determine offsets
     in the core image.  In this case, it is up to the  implemen-
     tation  to  select  an  appropriate  way to resolve symbolic
     references, for instance,  using  /dev/ksyms  as  a  default
     namelist file.


     The corefile argument specifies  a  file  that  contains  an
     image  of physical memory, for instance, a kernel crash dump
     file (see savecore(1M)) or the special device  /dev/mem.  If
     corefile  is NUL, the currently running kernel is accessed,
     using /dev/mem and /dev/kmem.


     The swapfile argument specifies a file that  represents  the
     swap  device.  If  both  corefile and swapfile are NUL, the
     swap device of the currently  running  kernel  is  accessed.
     Otherwise,  if  swapfile is NUL, kvmopen() may succeed but
     subsequent kvmgetu(3KVM) function calls  may  fail  if  the
     desired information is swapped out.


     The flag function is used to specify read  or  write  access
     for corefile and may have one of the following values:





SunOS 5.11           Last change: 2 May 2002                    1






Kernel VM Library Functions                        kvmopen(3KVM)



     ORDONLY    open for reading


     ORDWR      open for reading and writing



     The errstr argument is used to control error reporting.   If
     it  is a null pointer, no error messages will be printed. If
     it is non-null, it is assumed to be the address of a  string
     that  will  be  used  to  prefix error messages generated by
     kvmopen. Errors are printed to stderr. A  useful  value  to
     supply  for  errstr would be argv[0]. This has the effect of
     printing the process name in front of any error messages.


     Applications using  libkvm are dependent on  the  underlying
     data  model  of  the  kernel image, that is, whether it is a
     32-bit or 64-bit kernel.


     The data model of these applications  must  match  the  data
     model of the kernel in order to correctly interpret the size
     and offsets of  kernel  data  structures.   For  example,  a
     32-bit  application  that  uses  the  32-bit  version of the
     libkvm interfaces will fail to open a 64-bit  kernel  image.
     Similarly, a 64-bit application that uses the 64-bit version
     of the libkvm interfaces will fail to open a  32-bit  kernel
     image.


     The kvmclose() function closes all  file  descriptors  that
     were  associated  with  kd.  These  files are also closed on
     exit(2) and execve() (see exec(2)). kvmclose() also  resets
     the  proc  pointer  associated  with  kvmnextproc(3KVM) and
     flushes any cached kernel data.

RETURN VALUES
     The kvmopen() function returns a  non-null  value  suitable
     for  use  with  subsequent  kernel  VM  function  calls.  On
     failure, it returns NUL and no files are opened.


     The kvmclose() function returns 0  on  success  and  -1  on
     failure.

FILES
     /dev/kmem


     /dev/ksyms




SunOS 5.11           Last change: 2 May 2002                    2






Kernel VM Library Functions                        kvmopen(3KVM)



     /dev/mem


ATRIBUTES
     See attributes(5) for descriptions of the  following  attri-
     butes:



     
           ATRIBUTE TYPE               ATRIBUTE VALUE       
    
     Interface Stability          Stable                      
    
     MT-Level                     Unsafe                      
    


SEE ALSO
     savecore(1M), exec(2), exit(2), pathconf(2), getloadavg(3C),
     kstat(3KSTAT),      kvmgetu(3KVM),      kvmnextproc(3KVM),
     kvmnlist(3KVM), kvmkread(3KVM),  libkvm(3LIB),sysconf(3C),
     proc(4), attributes(5), lfcompile(5)

NOTES
     Kernel core dumps should be  examined  on  the  platform  on
     which  they were created. While a 32-bit application running
     on a 64-bit kernel can examine a 32-bit core dump, a  64-bit
     application running on a 64-bit kernel cannot examine a ker-
     nel core dump from the 32-bit system.


     On 32-bit systems, applications that use  libkvm  to  access
     the  running  kernel must be 32-bit applications. On systems
     that support both 32-bit and 64-bit  applications,  applica-
     tions  that  use the libkvm interfaces to access the running
     kernel must themselves be 64-bit applications.


     Although the libkvm API is Stable, the symbol names and data
     values  that  can be accessed through this set of interfaces
     are Private and are subject to ongoing change.


     Applications using  libkvm are likely to  be  platform-  and
     release-dependent.


     Most of the traditional uses of libkvm have been  superseded
     by more stable interfaces that allow the same information to
     be extracted more efficiently, yet  independent of the  ker-
     nel  data  model.   For  examples, see sysconf(3C), proc(4),



SunOS 5.11           Last change: 2 May 2002                    3






Kernel VM Library Functions                        kvmopen(3KVM)



     kstat(3KSTAT), getloadavg(3C), and pathconf(2).






















































SunOS 5.11           Last change: 2 May 2002                    4



OpenSolaris man pages main menu

Contact us      |       About us      |       Term of use      |       Copyright © 2000-2010 MyWebUniversity.com ™