-
Notifications
You must be signed in to change notification settings - Fork 1
CSA C Library Functions
csa_check - check a kernel, daemon, or record accounting state
Linux CSA Application Interface library (libcsa_api, -lcsa_api).
#include <csa_api.h>
int csa_check( struct csa_check_req *check_req );
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.
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.
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 - stop all accounting methods
Linux CSA Application Interface library (libcsa_api, -lcsa_api).
#include <csa_api.h>
int csa_halt( );
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.
Upon successful completion, csa_halt returns 0. Otherwise, a value of
-1 is returned and errno is set to indicate the error.
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 - checks if caller has the necessary capabilities
Linux CSA Application Interface library (libcsa_api, -lcsa_api).
#include <csa_api.h>
int csa_auth();
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.
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.
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 - get the kernel and daemon accounting status
Linux CSA Application Interface library (libcsa_api, -lcsa_api).
#include <csa_api.h>
int csa_kdstat( struct csa_status_req *kdstat_req );
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.
Upon successful completion, csa_kdstat returns 0. Otherwise, a value
of -1 is returned and errno is set to indicate the error.
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 - start job accounting
Linux CSA Application Interface library (libcsa_api, -lcsa_api).
#include <csa_api.h>
int csa_jastart( struct csa_job_req *job_req );
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];
};
Upon successful completion, csa_jastart returns 0. Otherwise, a value
of -1 is returned and errno is set to indicate the error.
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 - get the record accounting status
Linux CSA Application Interface library (libcsa_api, -lcsa_api).
#include <csa_api.h>
int csa_rcdstat( struct csa_status_req *rcdstat_req );
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.
Upon successful completion, csa_rcdstat returns 0. Otherwise, a value
of -1 is returned and errno is set to indicate the error.
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 - stop specified accounting method(s)
Linux CSA Application Interface library (libcsa_api, -lcsa_api).
#include <csa_api.h>
int csa_stop( struct csa_stop_req *stop_req );
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 */
};
Upon successful completion, csa_stop returns 0. Otherwise, a value of -1 is returned and errno is set to indicate the error.
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 - stop job accounting
Linux CSA Application Interface library (libcsa_api, -lcsa_api).
#include <csa_api.h>
int csa_jastop( struct csa_job_req *job_req );
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];
};
Upon successful completion, csa_jastop returns 0. Otherwise, a value
of -1 is returned and errno is set to indicate the error.
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 - write accounting record to file
Linux CSA Application Interface library (libcsa_api, -lcsa_api).
#include <csa_api.h>
#include <csaacct.h>
int csa_wracct( struct csa_wra_req *wra_req );
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 */
};
Upon successful completion, csa_wracct returns 0. Otherwise, a value
of -1 is returned and errno is set to indicate the error.
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 - get the user ID of a job
Linux CSA Application Interface library (libcsa_api, -lcsa_api).
#include <csa_api.h>
int csa_start( struct csa_start_req *start_req );
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];
}
Upon successful completion, csa_start returns 0. Otherwise, a value of
-1 is returned and errno is set to indicate the error.
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.
Linux CSA is the outcome of a joint effort between Los Alamos National Laboratory (LANL) and SGI to port the IRIX CSA tool to the Linux Operating System. This project is a community driven fork of that code base and is not supported by either organization at this time.