[OpenAFS] Re: How can I get PAG number of a certain process programmically?
Andrew Deason
adeason@sinenomine.net
Tue, 23 Jul 2013 11:32:20 -0500
On Tue, 23 Jul 2013 07:38:50 -0700
Russ Allbery <rra@stanford.edu> wrote:
> #include <stdio.h>
> #include <afs/param.h>
> #include <afs/afssyscalls.h>
> #include <afs/vice.h>
> #include <afs/vioc.h>
>
> int
> main(void)
> {
> struct ViceIoctl iob;
> afs_uint32 pag;
> int code;
>
> iob.in = NULL;
> iob.in_size = 0;
> iob.out = (void *) &pag;
> iob.out_size = sizeof(pag);
> code = pioctl(NULL, VIOC_GETPAG, &iob, 0);
> if (code != 0) {
> fprintf(stderr, "Cannot get PAG\n");
> return 1;
> }
> printf("PAG number is: %lu\n", (unsigned long) pag);
> return 0;
> }
Link this with -lafsauthent -lafsrpc, I believe.
Or use the k_pioctl function from kopenafs.h, and link with -lkopenafs.
--
Andrew Deason
adeason@sinenomine.net