/* * Sample program for acct system call - No.51 * * acct - switch process accounting on or off * * Synopsis * #include * * int acct(const char *filename); * * Description * When called with the name of an existing file as argument, * accounting is turned on, records for each termination process * are appended to filename as it terminates. An argument * of NULL causes accounting to be turned off. */ #include main(int argc, char *argv[]) { if (argc != 2) exit(1); if (strcmp(argv[1], "on") == 0) acct("/var/tmp/test_acct"); else acct(NULL); exit(0); }