Complete re-implementation of mq_close

This commit is contained in:
Gregory Nutt
2014-09-29 15:33:34 -06:00
parent 584d0fe4ad
commit 1f2cc9f4fe
13 changed files with 167 additions and 71 deletions
+23 -9
View File
@@ -66,20 +66,21 @@ struct mq_des; /* forward reference */
struct mqueue_inode_s
{
sq_queue_t msglist; /* Prioritized message list */
int16_t maxmsgs; /* Maximum number of messages in the queue */
int16_t nmsgs; /* Number of message in the queue */
int16_t nwaitnotfull; /* Number tasks waiting for not full */
int16_t nwaitnotempty; /* Number tasks waiting for not empty */
FAR struct inode *inode; /* Containing inode */
sq_queue_t msglist; /* Prioritized message list */
int16_t maxmsgs; /* Maximum number of messages in the queue */
int16_t nmsgs; /* Number of message in the queue */
int16_t nwaitnotfull; /* Number tasks waiting for not full */
int16_t nwaitnotempty; /* Number tasks waiting for not empty */
#if CONFIG_MQ_MAXMSGSIZE < 256
uint8_t maxmsgsize; /* Max size of message in message queue */
uint8_t maxmsgsize; /* Max size of message in message queue */
#else
uint16_t maxmsgsize; /* Max size of message in message queue */
uint16_t maxmsgsize; /* Max size of message in message queue */
#endif
#ifndef CONFIG_DISABLE_SIGNALS
FAR struct mq_des *ntmqdes; /* Notification: Owning mqdes (NULL if none) */
pid_t ntpid; /* Notification: Receiving Task's PID */
int ntsigno; /* Notification: Signal number */
pid_t ntpid; /* Notification: Receiving Task's PID */
int ntsigno; /* Notification: Signal number */
union sigval ntvalue; /* Notification: Signal value */
#endif
};
@@ -175,6 +176,19 @@ struct tcb_s;
mqd_t mq_descreate(FAR struct tcb_s* mtcb, FAR struct mqueue_inode_s* msgq,
int oflags);
/****************************************************************************
* Name: mq_desfree
*
* Description:
* Deallocate a message queue descriptor but returning it to the free list
*
* Inputs:
* mqdes - message queue descriptor to free
*
****************************************************************************/
void mq_desfree(mqd_t mqdes);
#undef EXTERN
#ifdef __cplusplus
}
+4
View File
@@ -116,6 +116,10 @@
#endif
/* Task Management Definitions **************************************************/
/* Special task IDS. Any negative PID is invalid. */
#define NULL_TASK_PROCESS_ID (pid_t)0
#define INVALID_PROCESS_ID (pid_t)-1
/* This is the maximum number of times that a lock can be set */
+1 -1
View File
@@ -62,8 +62,8 @@ struct nsem_inode_s
{
/* Inode payload unique to named semaphores */
sem_t ns_sem; /* The semaphore */
FAR struct inode *ns_inode; /* Containing inode */
sem_t ns_sem; /* The semaphore */
};
#endif