[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 1


knlist Subroutine

Purpose

Translates names to addresses in the running system.

Syntax

#include <nlist.h>


int knlist( NList, NumberOfElements, Size)
struct nlist *NList;
int NumberOfElements;
int Size;

Description

The knlist subroutine allows a program to examine the list of symbols exported by kernel routines to other kernel modules.

The first field in the nlist structure is an input parameter to the knlist subroutine. The n_value field is modified by the knlist subroutine, and all the others remain unchanged. The nlist structure consists of the following fields:

char *n_name Specifies the name of the symbol whose attributes are to be retrieved.
long n_value Indicates the virtual address of the object. This will also be the offset when using segment descriptor 0 as the extension parameter of the readx or writex subroutines against the /dev/mem file.

If the name is not found, all fields, other than n_name, are set to 0.

The nlist.h file is automatically included by the a.out.h file for compatibility. However, do not include the a.out.h file if you only need the information necessary to use the knlist subroutine. If you do include the a.out.h file, follow the #include statement with the line:

#undef n_name

Notes:
  1. If both the nlist.h and netdb.h files are to be included, the netdb.h file should be included before the nlist.h file in order to avoid a conflict with the n_name structure member. Likewise, if both the a.out.h and netdb.h files are to be included, the netdb.h file should be included before the a.out.h file to avoid a conflict with the n_name structure.
  2. If the netdb.h file and either the nlist.h or syms.h file are included, the n_name field will be defined as _n._n_name. This definition allows you to access the n_name field in the nlist or syment structure. If you need to access the n_name field in the netent structure, undefine the n_name field by entering:

    #undef n_name
    

    before accessing the n_name field in the netent structure. If you need to access the n_name field in a syment or nlist structure after undefining it, redefine the n_name field with:

    #define n_name _n._n_name
    

Parameters


NList Points to an array of nlist structures.
NumberOfElements Specifies the number of structures in the array of nlist structures.
Size Specifies the size of each structure.

Return Values

Upon successful completion, knlist returns a value of 0. Otherwise, a value of -1 is returned, and the errno global variable is set to indicate the error.

Error Codes

The knlist subroutine fails when the following is true:

EFAULT Indicates that the NList parameter points outside the limit of the array of nlist structures.

Implementation Specifics

This subroutine is part of Base Operating System (BOS) Runtime.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]