acctctl  -  controls and provides status for comprehensive
       system accounting (CSA)


SYNOPSIS

       #include <csa.h>

       int acctctl (int function, void *act);


DESCRIPTION

       The aaccccttccttll system call checks the status of, enables, and
       disables  process,  daemon,  and  record  accounting.  The
       record accounting types supported  are  memory  and   I/O.
       The  kernel and daemon accounting types supported are csa,
       nqs, tape, and workload management.   The  aaccccttccttll  system
       call accepts the following arguments:

       fnc    Identifies a function to be performed as follows:

              Function            Description

              AACC_SSTTAARRTT            Starts   kernel,   daemon,   or
                                  record  accounting;  sets   cpu
                                  time or memory threshold.

              AACC_SSTTOOPP             Stops kernel, daemon, or record
                                  accounting.

              AACC_HHAALLTT             Stops all kernel,  daemon,  and
                                  record accounting.

              AACC_CCHHEECCKK            Checks  a  kernel,  daemon,  or
                                  record accounting state.

              AACC_KKDDSSTTAATT           Checks all  kernel  and  daemon
                                  accounting states.

              AACC_RRCCDDSSTTAATT          Checks  all  record  accounting
                                  states.

              AACC_JJAASSTTAARRTT          Starts user job accounting.

              AACC_JJAASSTTOOPP           Stops user job accounting.

              AACC_WWRRAACCCCTT           Writes accounting record for  a
                                  daemon program.

              AACC_AAUUTTHH             Checks if caller has the neces­
                                  sary  capabilities  for  privi­
                                  leged aaccccttccttll calls

       act    Points  to  either  an  actctl,  actstat, or actwra
              structure, depending on the function (that is, fnc)
              to be performed.  The aaccttccttll structure is used with

              TTAARRTT,  and AACC_JJAASSTTOOPP functions.  The actstat struc­
              ture is used with AACC_CCHHEECCKK  function.   The  actwra
              structure is used with the AACC_WWRRAACCCCTT function.

       This parameter is ignored for the AACC_AAUUTTHH function.

       The  AACC_SSTTAARRTT,  AACC_SSTTOOPP,  AACC_HHAALLTT, and AACC_WWRRAACCCCTT functions
       require the CAP_ACCT_MGT  capability.   See  the  capabil­
       ity(4)  and capabilities(4) man pages for more information
       on the capability mechanism  that  provides  fine  grained
       control over the privileges of a process.

       If the type of accounting you specified already is enabled
       and the path information in the actctl  structure  differs
       from  the accounting file currently in use, the accounting
       file will be switched to the new path without  losing  any
       accounting information.

       Only  a  process  with  appropriate privilege can use this
       system call to enable  or  disable  accounting.   However,
       privilege  is not required to check the status of account­
       ing.


EXAMPLES

       The following example shows how to  write  an  NQS  daemon
       accounting  record.   Similar  code  would  be written for
       other daemon accounting record types.

       You need to use the following include statements:

            #include <sys/types.h>
            #include <sys/time.h>
            #include <csa.h>
            #include <csaacct.h>
               ...

       To write a daemon accounting record  within  a  procedure,
       see the following example:

                    struct nqsbs nqsbs;
                    struct actwra actwra;

                    memset((char *)&nqsbs, 0, sizeof(nqsbs));

                    nqsbs.hdr.ah_magic = ACCT_MAGIC;
                    nqsbs.hdr.ah_revision = REV_NQS;
                    nqsbs.hdr.ah_type = ACCT_DAEMON_NQS;
                    nqsbs.hdr.ah_flag = 0;
                    nqsbs.hdr.ah_size = sizeof(nqsbs);

                    nqsbs.type = type;
                    nqsbs.subtype = subtype;
                    nqsbs.jid = jid;


                    /*  convert  time  values from clock ticks to
            microseconds */
                    nqsbs.utime = clock_to_microsec(utime);
                    nqsbs.stime = clock_to_microsec(stime);

                    /* fill in remaining nqsbs fields */

                    actwra.ac_did = ACCT_DMD_NQS;
                    actwra.ac_len = sizeof(nqsbs);
                    actwra.ac_jid = jid;
                    actwra.ac_buf = (char *)&nqsbs;
                    if (acctctl(AC_WRACCT, &actwra)) {
                          /* handle error condition */
                    }

            }


ERRORS

       Under the following conditions, the aaccccttccttll function fails
       and sets errno to:

       [EACCESS]      Search  permission is denied on a component
                      of the path prefix.

       [EFAULT]       The  act  argument  points  to  an  illegal
                      address.

       [EINVAL]       An invalid argument was specified.

       [EPERM]        The process does not have appropriate capa­
                      bility to use this system call.

       [ENOSYS]       The  CSA  loadable  kernel  module  is  not
                      installed.

       [ENOENT]       No job table entry is found when attempting
                      to start or stop user job accounting.


DIAGNOSTICS

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


SEE ALSO

       ja(1).


Man(1) output converted with man2html