/var/lib/pcp/testsuite/src/exerlock.c is in pcp-testsuite 3.8.12ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | /*
* Copyright (c) 2011 Ken McDonell. All Rights Reserved.
*
* exercise low-level libpcp locking primitives
*/
#include <pcp/pmapi.h>
#include <pcp/impl.h>
static void
timeout(int i, void *j)
{
fprintf(stderr, "Timeout!\n");
exit(2);
}
static void
_usage()
{
fprintf(stderr, "Usage: exerlock reqs\n");
fprintf(stderr, "reqs is a string of: i (initialize), l (lock) and u (unlock)\n");
exit(1);
}
int
main(int argc, char **argv)
{
char *p;
struct timeval delta = { 1, 0 };
if (argc != 2) _usage();
__pmAFregister(&delta, NULL, timeout);
#ifdef DBG_TRACE_DESPERATE
pmDebug |= DBG_TRACE_DESPERATE;
#endif
for (p = argv[1]; *p; p++) {
switch (*p) {
case 'i':
fprintf(stderr, "initialize\n");
PM_INIT_LOCKS();
break;
case 'l':
fprintf(stderr, "lock\n");
PM_LOCK(__pmLock_libpcp);
break;
case 'u':
fprintf(stderr, "unlock\n");
PM_UNLOCK(__pmLock_libpcp);
break;
default:
_usage();
}
}
return 0;
}
|