Results 1 to 3 of 3
Hello everybody,
I'm trying to create a function that takes a pointer of a task_struct process in input and returns the number of elements in a SystemV queue related with ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 07-26-2012 #1Just Joined!
- Join Date
- Jul 2012
- Posts
- 9
How to get the number of elements in a SystemV queue
Hello everybody,
I'm trying to create a function that takes a pointer of a task_struct process in input and returns the number of elements in a SystemV queue related with it (I have several tasks that created SystemV queues).
int getQueueElements(struct task_struct *p){
struct ipc_namespace *ns;
struct ipc_ids *ipc;
int qNum;
if(p){
ns = p->nsproxy->ipc_ns;
ipc = ns->ids[IPC_MSG_IDS];
qNum = ipc->in_use;
if(ipc->seq_max != -1)return qNum;
}
return(-1);
}
I have written the function above but it lets me to know only the number of IPC objects currently in use, and not the number of messages on queue related with the process p.
Thanks in advance for any suggestion about.
Rob
- 07-26-2012 #2Just Joined!
- Join Date
- Jul 2012
- Posts
- 9
I forgot to specify that I'm working on an optimized scheduling policy for certain real-time processes based on SystemV queues for IPC, and I need to know the queues level to perform some operations.
- 07-27-2012 #3Just Joined!
- Join Date
- Jul 2012
- Posts
- 9
Maybe I have solved adding a new field in the task_struct, in order to store the SysV queue unique Key during the queue creation.
In this way I should obtain all queues information (if the process uses queues) from the task_struct of a process...



