4.4BSD/usr/share/man/cat2/ktrace.0

Compare this file to the similar file:
Show the results in this format:

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

NNAAMMEE
     kkttrraaccee - process tracing

SSYYNNOOPPSSIISS
     ##iinncclluuddee <<ssyyss//ttyyppeess..hh>>
     ##iinncclluuddee <<ssyyss//kkttrraaccee..hh>>

     _i_n_t
     kkttrraaccee(_c_o_n_s_t _c_h_a_r _*_t_r_a_c_e_f_i_l_e, _i_n_t _o_p_s, _i_n_t _t_r_p_o_i_n_t_s, _i_n_t _p_i_d);

DDEESSCCRRIIPPTTIIOONN
     The kkttrraaccee() 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.

     The _t_r_a_c_e_f_i_l_e 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), _t_r_a_c_e_f_i_l_e may be NULL.

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

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

     The ttrrppooiinnttss 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 kkttrr__lleenn field specifies the length of the kkttrr__ttyyppee data that follows
     this header.  The kkttrr__ppiidd and kkttrr__ccoommmm fields specify the process and
     command generating the record.  The kkttrr__ttiimmee field gives the time (with
     microsecond resolution) that the record was generated.  The kkttrr__bbuuff is an
     internal kernel pointer and is not useful.

     The generic header is followed by kkttrr__lleenn bytes of a kkttrr__ttyyppee record.
     The type specific records are defined in the _<_s_y_s_/_k_t_r_a_c_e_._h_> include file.

RREETTUURRNN VVAALLUUEESS
     On successful completion a value of 0 is returned.  Otherwise, a value of
     -1 is returned and _e_r_r_n_o is set to show the error.

EERRRROORRSS
     KKttrraaccee() 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.

SSEEEE AALLSSOO
     ktrace(1),  kdump(1)

HHIISSTTOORRYY
     A kkttrraaccee function call first appeared in 4.4BSD.

4th Berkeley Distribution        June 4, 1993                                2