Skip to content

CSA C Library Functions

jgrantham-SGI edited this page Jun 9, 2016 · 1 revision

csa_check

 

NAME

csa_check - check a kernel, daemon, or record accounting state  

LIBRARY

Linux CSA Application Interface library (libcsa_api, -lcsa_api).  

SYNOPSIS

#include <csa_api.h>

int csa_check( struct csa_check_req *check_req );

 

DESCRIPTION

The csa_check library call is part of the csa_api library that allows processes to manipulate and obtain status about linux CSA accounting methods. When the csa_api library is to be used, the csa_api.h header file should be included to obtain the proper definitions.

csa_check checks the state of a specified accounting method.

The caller should provide as a parameter a pointer to a variable of data structure type csa_check_req:

 /* CSA\_CHECK request and reply */

struct csa\_check\_req {
    struct csa\_am\_stat ck\_stat;

};
/* CSA Accounting Method Status struct */

struct csa\_am\_stat { \
    int     am\_id;          /* accounting method ID */
    int     am\_status;      /* accounting method status */
    int64\_t am\_param;      /* accounting method parameter */

};

The state of the inquired accounting method is returned in am_status.

 

RETURN VALUE

Upon successful completion, csa_check returns 0 and check_req->ck_status contains the status of the inquired accounting method. Otherwise, a value of -1 is returned and errno is set to indicate the error.  

ERRORS

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

[EACCESS]

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

[EFAULT]

The check_req argument points to an illegal address.

[EINVAL]

An invalid argument was specified.

[EPERM]

The process does not have appropriate capability to use this system call.

[ENOENT]

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

csa_halt

 

NAME

csa_halt - stop all accounting methods  

LIBRARY

Linux CSA Application Interface library (libcsa_api, -lcsa_api).  

SYNOPSIS

    #include <csa_api.h>

    int csa_halt( );

 

DESCRIPTION

The csa_halt library call is part of the csa_api library that allows processes to manipulate and obtain status about linux CSA accounting methods. When the csa_api library is to be used, the csa_api.h header file should be included to obtain the proper definitions.

csa_halt stops all accounting methods.

 

RETURN VALUE

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

ERRORS

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

[EACCESS]

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

[EPERM]

The process does not have appropriate capability to use this system call.

[ENOENT]

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

csa_auth

 

NAME

csa_auth - checks if caller has the necessary capabilities  

LIBRARY

Linux CSA Application Interface library (libcsa_api, -lcsa_api).  

SYNOPSIS

    #include <csa_api.h>

    int csa_auth();

 

DESCRIPTION

The csa_auth library call is part of the csa_api library that allows processes to manipulate and obtain status about linux CSA accounting methods. When the csa_api library is to be used, the csa_api.h header file should be included to obtain the proper definitions.

csa_auth checks if caller has the necessary capabilities for privileged csa_api library calls.

 

RETURN VALUE

Upon successful verification of proper capabilities, csa_auth returns 0. Otherwise, a value of -1 is returned and errno is set to indicate the error.  

ERRORS

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

[EACCESS]

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

[EPERM]

The process does not have appropriate capability to use this system call.

csa_kdstat

 

NAME

csa_kdstat - get the kernel and daemon accounting status  

LIBRARY

Linux CSA Application Interface library (libcsa_api, -lcsa_api).  

SYNOPSIS

    #include <csa_api.h>

    int csa_kdstat( struct csa_status_req *kdstat_req );

 

DESCRIPTION

The csa_kdstat library call is part of the csa_api library that allows processes to manipulate and obtain status about linux CSA accounting methods. When the csa_api library is to be used, the csa_api.h header file should be included to obtain the proper definitions.

csa_kdstat gets the kernel and daemon accounting status.

The caller should provide as a parameter a pointer to a variable of data structure type csa_status_req:

\* CSA_KDSTAT/CSA_RCDSTAT request *\

struct csa_status_req {
    int     st_num;         /* num of entries in kd_method array */

    char    st_path[ACCT_PATH+1];
    struct csa_am_stat st_stat[NUM_KDRCDS];

};
/* CSA Accounting Method Status struct */

struct csa_am_stat {
    int     am_id;          /* accounting method ID */
    int     am_status;      /* accounting method status */
    int64_t am_param;       /* accounting method parameter */

};

The inquired status are returned in the am_status field of st_stat array.

 

RETURN VALUE

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

ERRORS

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

[EACCESS]

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

[EFAULT]

The kdstat_req argument points to an illegal address.

[EINVAL]

An invalid argument was specified.

[EPERM]

The process does not have appropriate capability to use this system call.

[ENOENT]

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

csa_jastart

 

NAME

csa_jastart - start job accounting  

LIBRARY

Linux CSA Application Interface library (libcsa_api, -lcsa_api).  

SYNOPSIS

    #include <csa_api.h>

    int csa_jastart( struct csa_job_req *job_req );

 

DESCRIPTION

The csa_jastart library call is part of the csa_api library that allows processes to manipulate and obtain status about linux CSA accounting methods. When the csa_api library is to be used, the csa_api.h header file should be included to obtain the proper definitions.

csa_jastart starts job accounting.

The caller should provide as a parameter a pointer to a variable of data structure type csa_job_req:

/*
 * CSA_JASTART/CSA_JASTOP request
 */

struct csa_job_req {
    char    job_path[ACCT_PATH+1];

};

 

RETURN VALUE

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

ERRORS

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

[EACCESS]

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

[EFAULT]

The job_req argument points to an illegal address.

[EINVAL]

An invalid argument was specified.

[EPERM]

The process does not have appropriate capability to use this system call.

[ENOENT]

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

csa_rcdstat

 

NAME

csa_rcdstat - get the record accounting status  

LIBRARY

Linux CSA Application Interface library (libcsa_api, -lcsa_api).  

SYNOPSIS

    #include <csa_api.h>

    int csa_rcdstat( struct csa_status_req *rcdstat_req );

 

DESCRIPTION

The csa_rcdstat library call is part of the csa_api library that allows processes to manipulate and obtain status about linux CSA accounting methods. When the csa_api library is to be used, the csa_api.h header file should be included to obtain the proper definitions.

csa_rcdstat gets the record accounting status.

The caller should provide as a parameter a pointer to a variable of data structure type csa_status_req:

/*
 * CSA_KDSTAT/CSA_RCDSTAT request
 */

struct csa_status_req {
    int     st_num;         /* num of entries in kd_method array */

    char    st_path[ACCT_PATH+1];
    struct csa_am_stat st_stat[NUM_KDRCDS];

};
/*
 * CSA Accounting Method Status struct
 */

struct csa_am_stat {
    int     am_id;          /* accounting method ID */
    int     am_status;      /* accounting method status */
    int64_t am_param;       /* accounting method parameter */

};

The inquired status are returned in the am_status field of st_stat array.

 

RETURN VALUE

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

ERRORS

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

[EACCESS]

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

[EFAULT]

The rcdstat_req argument points to an illegal address.

[EINVAL]

An invalid argument was specified.

[EPERM]

The process does not have appropriate capability to use this system call.

[ENOENT]

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

csa_stop

 

NAME

csa_stop - stop specified accounting method(s)  

LIBRARY

Linux CSA Application Interface library (libcsa_api, -lcsa_api).  

SYNOPSIS

    #include <csa_api.h>

    int csa_stop( struct csa_stop_req *stop_req );

 

DESCRIPTION

The csa_stop library call is part of the csa_api library that allows processes to manipulate and obtain status about linux CSA accounting methods. When the csa_api library is to be used, the csa_api.h header file should be included to obtain the proper definitions.

csa_stop stops the specified accounting method(s).

The caller should provide as a parameter a pointer to a variable of data structure type csa_stop_req:

/*
 * CSA_STOP request
 */

struct csa_stop_req {
    int     pr_num;         /* num of entries in pr_id[] array */
    int     pr_id[NUM_KDRCDS];      /* Accounting Method type id */

};

 

RETURN VALUE

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

ERRORS

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

[EACCESS]

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

[EFAULT]

The stop_req argument points to an illegal address.

[EINVAL]

An invalid argument was specified.

[EPERM]

The process does not have appropriate capability to use this system call.

[ENOENT]

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

csa_jastop

 

NAME

csa_jastop - stop job accounting  

LIBRARY

Linux CSA Application Interface library (libcsa_api, -lcsa_api).  

SYNOPSIS

    #include <csa_api.h>

    int csa_jastop( struct csa_job_req *job_req );

 

DESCRIPTION

The csa_jastop library call is part of the csa_api library that allows processes to manipulate and obtain status about linux CSA accounting methods. When the csa_api library is to be used, the csa_api.h header file should be included to obtain the proper definitions.

csa_jastop stops job accounting.

The caller should provide as a parameter a pointer to a variable of data structure type csa_job_req:

/*
 * CSA_JASTART/CSA_JASTOP request
 */

struct csa_job_req {
    char    job_path[ACCT_PATH+1];

};

 

RETURN VALUE

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

ERRORS

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

[EACCESS]

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

[EFAULT]

The job_req argument points to an illegal address.

[EINVAL]

An invalid argument was specified.

[EPERM]

The process does not have appropriate capability to use this system call.

[ENOENT]

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

csa_wracct

 

NAME

csa_wracct - write accounting record to file  

LIBRARY

Linux CSA Application Interface library (libcsa_api, -lcsa_api).  

SYNOPSIS

    #include <csa_api.h>

    #include <csaacct.h>

    int csa_wracct( struct csa_wra_req *wra_req );

 

DESCRIPTION

The csa_wracct library call is part of the csa_api library that allows processes to manipulate and obtain status about linux CSA accounting methods. When the csa_api library is to be used, the csa_api.h header file should be included to obtain the proper definitions. In addition, the csaacct.h header file provides structure definitions that are necessary for CSA applications.

csa_wracct writes accounting record to file.

The caller should provide as a parameter a pointer to a variable of data structure type csa_wra_req:

/*
 * CSA_WRACCT request   
 */             

struct csa_wra_req {
    int             wra_did;        /* Daemon Index */
    int             wra_len;        /* Length of buffer (bytes) */
    uint64_t        wra_jid;        /* Job ID */
    char            *wra_buf;       /* Daemon accounting buffer */

};

 

RETURN VALUE

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

ERRORS

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

[EACCESS]

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

[EFAULT]

The wra_req argument points to an illegal address.

[EINVAL]

An invalid argument was specified.

[EPERM]

The process does not have appropriate capability to use this system call.

[ENOENT]

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

csa_start

 

NAME

csa_start - get the user ID of a job  

LIBRARY

Linux CSA Application Interface library (libcsa_api, -lcsa_api).  

SYNOPSIS

    #include <csa_api.h>

    int csa_start( struct csa_start_req *start_req );

 

DESCRIPTION

The csa_start library call is part of the csa_api library that allows processes to manipulate and obtain status about linux CSA accounting methods. When the csa_api library is to be used, the csa_api.h header file should be included to obtain the proper definitions.

csa_start starts specified CSA accounting method(s).

The caller should provide as a parameter a pointer to a variable of data structure type struct csa_start_req:

/*
 * CSA_START request
 */

struct csa_start_req {
    int    sr_num;         /* num of entries in sr_method array */
    char   sr_path[ACCT_PATH+1];  /* path name for accounting file */

    struct method_info {
           int     sr_id;         /* Accounting Method type id */
           int64_t param;         /* Entry parameter */
    } sr_method[NUM_KDRCDS];

}

 

RETURN VALUE

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

ERRORS

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

[EACCESS]

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

[EFAULT]

The start_req argument points to an illegal address.

[EINVAL]

An invalid argument was specified.

[EPERM]

The process does not have appropriate capability to use this system call.

[ENOENT]

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