Error while running pqos_alloc_assoc_set_pid() in c
kazi-m22 opened this issue · 6 comments
I am trying to associate a running program to a specific COS using its PID. From terminal it is very easy to do using pqos -I -s "pid1:123456"
. But when I tried c examples, I have done the following:
pid_t pid = 123456;
int ret;
ret = pqos_alloc_assoc_set_pid(123456, 1)
This returns 3 which is not equal to PQOS_RETVAL_OK and so I can not do the association. How can I do that. The PID is running and tested using ps aux
.
Hi,
Could you provide error code and logs form running the command?
@aleksinx when I try to run the above code (i.e. pqos_alloc_assoc_set_pid(123456, 1):
WARN: resctl filesystem mounted! Using MSR interface may corrupt resctrl filesystem and cause unexpected behaviour
return of pqos_alloc_assoc_set_pid(pid, 1): 3
Failed to associate
How do you initialize libpqos (pqos_init CALL)?
@aleksinx
In the code, I have kept the example as it is, like:
struct pqos_config cfg;
cfg.fd_log = STDOUT_FILENO;
cfg.verbose = 0;
ret = pqos_init(&cfg);
In order to use PID association you need to initialize library with OS interface
struct pqos_config cfg;
memset(&cfg, 0, sizeof(cfg));
cfg.fd_log = STDOUT_FILENO;
cfg.verbose = 0;
cfg.interface = PQOS_INTER_OS; // Change interface to OS
ret = pqos_init(&cfg);