(I'm implementing a queue called msgQueue using linux/list.h)
typedef struct msgQueue
{
long len;
void *data;
struct list_head queue;
} msgQueue
There are plenty of examples of iterating over a list and deleting the nodes like so:
struct list_head *pos, *q;
struct msgQueue *currentQueue;
list_for_each_safe(pos, q, &(myQueue->queue))
{
currentQueue = list_entry(pos, struct msgQueue, queue);
list_del(pos);
free(currentQueue);
}
What is a safe way to delete just the first one?
I would've thought it would be:
list_del(*(myQueue->queue));
but that's giving me problems. (kernel paging request error)