[OpenAFS] How can I get PAG number of a certain process programmically?

Russ Allbery rra@stanford.edu
Tue, 23 Jul 2013 07:38:50 -0700


shuaijie wang <wangshuaijie@gmail.com> writes:

> In AFS, separate processes can be put into different PAGs, my question
> is:  How can I get the PAG number of certain process programically?

#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;
}

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>