Manual Pages for UNIX Darwin command on man kvm_close
MyWebUniversity

Manual Pages for UNIX Darwin command on man kvm_close

KVMOPEN(3) BSD Library Functions Manual KVMOPEN(3)

NAME

kkvvmmooppeenn, kkvvmmooppeennffiilleess, kkvvmmcclloossee - initialize kernel virtual memory

access

SYNOPSIS

##iinncclluuddee <>

##iinncclluuddee <>

kvmt * kkvvmmooppeenn(const char *execfile, const char *corefile, char *swapfile, int flags, const char *errstr); kvmt * kkvvmmooppeennffiilleess(const char *execfile, const char *corefile, char *swapfile, int flags, char *errbuf); int kkvvmmcclloossee(kvmt *kd);

DESCRIPTION

The functions kkvvmmooppeenn() and kkvvmmooppeennffiilleess() return a descriptor used to access kernel virtual memory via the kvm(3) library routines. Both active kernels and crash dumps are accessible through this interface. execfile is the executable image of the kernel being examined. This file must contain a symbol table. If this argument is NULL, the currently running system is assumed, which is indicated by PATHUNIX in . corefile is the kernel memory device file. It can be either /dev/mem or a crash dump core generated by savecore(8). If corefile is NULL, the default indicated by PATHMEM from is used. swapfile should indicate the swap device. If NULL, PATHDRUM from is used. The flags argument indicates read/write access as in open(2) and applies

only to the core file. Only ORDONLY, OWRONLY, and ORDWR are permit-

ted. There are two open routines which differ only with respect to the error mechanism. One provides backward compatibility with the SunOS kvm library, while the other provides an improved error reporting framework. The kkvvmmooppeenn() function is the Sun kvm compatible open call. Here, the errstr argument indicates how errors should be handled. If it is NULL, no errors are reported and the application cannot know the specific nature of the failed kvm call. If it is not NULL, errors are printed to stderr with errstr prepended to the message, as in perror(3). Normally, the name of the program is used here. The string is assumed to persist at least until the corresponding kkvvmmcclloossee() call. The kkvvmmooppeennffiilleess() function provides BSD style error reporting. Here,

error messages are not printed out by the library. Instead, the applica-

tion obtains the error message corresponding to the most recent kvm library call using kkvvmmggeetteerrrr() (see kvmgeterr(3) ). The results are undefined if the most recent kvm call did not produce an error. Since kkvvmmggeetteerrrr() requires a kvm descriptor, but the open routines return NULL on failure, kkvvmmggeetteerrrr() cannot be used to get the error message if open fails. Thus, kkvvmmooppeennffiilleess() will place any error message in the errbuf argument. This buffer should be POSIX2LINEMAX characters large (from ).

RETURN VALUES

The kkvvmmooppeenn() and kkvvmmooppeennffiilleess() functions both return a descriptor to

be used in all subsequent kvm library calls. The library is fully re-

entrant. On failure, NULL is returned, in which case kkvvmmooppeennffiilleess() writes the error message into errbuf.

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

BUGS

There should not be two open calls. The ill-defined error semantics of

the Sun library and the desire to have a backward-compatible library for

BSD left little choice.

SEE ALSO

open(2), kvm(3), kvmgetargv(3), kvmgetenvv(3), kvmgeterr(3), kvmgetprocs(3), kvmnlist(3), kvmread(3), kvmwrite(3) BSD April 19, 1994 BSD




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