icon Top 9 categories map      RocketAware > man pages >

ktrace(2)

Tips: Browse or Search all pages for efficient awareness of more than 6000 of the most popular reusable and open source applications, functions, libraries, and FAQs.


The "RKT couplings" below include links to source code, updates, additional information, advice, FAQs, and overviews.


Home

Search all pages


Subjects

By activity
Professions, Sciences, Humanities, Business, ...

User Interface
Text-based, GUI, Audio, Video, Keyboards, Mouse, Images,...

Text Strings
Conversions, tests, processing, manipulation,...

Math
Integer, Floating point, Matrix, Statistics, Boolean, ...

Processing
Algorithms, Memory, Process control, Debugging, ...

Stored Data
Data storage, Integrity, Encryption, Compression, ...

Communications
Networks, protocols, Interprocess, Remote, Client Server, ...

Hard World
Timing, Calendar and Clock, Audio, Video, Printer, Controls...

File System
Management, Filtering, File & Directory access, Viewers, ...

    

RocketLink!--> Man page versions: OpenBSD FreeBSD NetBSD Others



KTRACE(2)                 OpenBSD Programmer's Manual                KTRACE(2)

NAME
     ktrace - process tracing



SYNOPSIS
     #include <sys/types.h>
     #include <sys/param.h>
     #include <sys/uio.h>
     #include <sys/ktrace.h>

     int
     ktrace(const char *tracefile, int ops, int trpoints, int pid);

DESCRIPTION
     The ktrace() function enables or disables tracing of one or more process-
     es.  Users may only trace their own processes.  Only the super-user can
     trace setuid or setgid programs.

     tracefile gives the pathname of the file to be used for tracing.  The
     file must exist and be writable by the calling process.  All trace
     records are always appended to the file, so the file must be truncated to
     zero length to discard previous trace data.  If tracing points are being
     disabled (see KTROP_CLEAR below), tracefile may be NULL.

     The ops parameter specifies the requested ktrace operation.  The defined
     operations are:

           KTROP_SET             Enable trace points specified in trpoints.
           KTROP_CLEAR           Disable trace points specified in trpoints.
           KTROP_CLEARFILE       Stop all tracing.
           KTRFLAG_DESCEND       The tracing change should apply to the speci-
                                 fied process and all its current children.

     The trpoints parameter specifies the trace points of interest.  The de-
     fined trace points are:

           KTRFAC_SYSCALL       Trace system calls.
           KTRFAC_SYSRET        Trace return values from system calls.
           KTRFAC_NAMEI         Trace name lookup operations.
           KTRFAC_GENIO         Trace all I/O (note that this option can gen-
                                erate much output).
           KTRFAC_PSIG          Trace posted signals.
           KTRFAC_CSW           Trace context switch points.
           KTRFAC_INHERIT       Inherit tracing to future children.

     Each tracing event outputs a record composed of a generic header followed
     by a trace point specific structure.  The generic header is:

     struct ktr_header {
             int     ktr_len;                /* length of buf */
             short   ktr_type;               /* trace record type */
             pid_t   ktr_pid;                /* process id */
             char    ktr_comm[MAXCOMLEN+1];  /* command name */
             struct  timeval ktr_time;       /* timestamp */
             caddr_t ktr_buf;
     };

     The ktr_len field specifies the length of the ktr_type data that follows
     this header.  The ktr_pid and ktr_comm fields specify the process and
     command generating the record.  The ktr_time field gives the time (with
     microsecond resolution) that the record was generated.  The ktr_buf is an
     internal kernel pointer and is not useful.

     The generic header is followed by ktr_len bytes of a ktr_type record.
     The type specific records are defined in the <sys/ktrace.h> include file.

RETURN VALUES
     On successful completion a value of 0 is returned.  Otherwise, a value of
     -1 is returned and errno is set to show the error.

ERRORS
     ktrace() will fail if:

     [ENOTDIR]       A component of the path prefix is not a directory.

     [EINVAL]        The pathname contains a character with the high-order bit
                     set.

     [ENAMETOOLONG]  A component of a pathname exceeded 255 characters, or an
                     entire path name exceeded 1023 characters.

     [ENOENT]        The named tracefile does not exist.

     [EACCES]        Search permission is denied for a component of the path
                     prefix.

     [ELOOP]         Too many symbolic links were encountered in translating
                     the pathname.

     [EIO]           An I/O error occurred while reading from or writing to
                     the file system.

SEE ALSO
     kdump(1),  ktrace(1)

HISTORY
     A ktrace() function call first appeared in 4.4BSD.

OpenBSD 2.6                      June 4, 1993                                2

Source: OpenBSD 2.6 man pages. Copyright: Portions are copyrighted by BERKELEY
SOFTWARE DESIGN, INC., The Regents of the University of California, Massachusetts
Institute of Technology, Free Software Foundation, FreeBSD Inc., and others.



(Corrections, notes, and links courtesy of RocketAware.com)


[Detailed Topics]


[Overview Topics]

Up to: Debugging and Tracing (utilities, system and library calls which support debugging and tracing)


RocketLink!--> Man page versions: OpenBSD FreeBSD NetBSD Others






Rapid-Links: Search | About | Comments | Submit Path: RocketAware > man pages > ktrace.2/
RocketAware.com is a service of Mib Software
Copyright 1999, Forrest J. Cavalier III. All Rights Reserved.
We welcome submissions and comments