base/ipc/mq/mq.c File Reference

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/version.h>
#include <linux/errno.h>
#include <linux/stat.h>
#include <asm/uaccess.h>
#include <rtai_schedcore.h>
#include <rtai_proc_fs.h>

Include dependency graph for mq.c:

Include dependency graph

Go to the source code of this file.

Defines

#define pthread_cond_t   SEM
#define pthread_mutex_t   SEM
#define pthread_mutex_init(mutex, attr)   rt_mutex_init(mutex)
#define pthread_mutex_unlock   rt_mutex_unlock
#define pthread_mutex_lock   rt_mutex_lock
#define pthread_mutex_destroy   rt_mutex_destroy
#define pthread_cond_init(cond, attr)   rt_cond_init(cond)
#define pthread_cond_wait   rt_cond_wait
#define pthread_cond_signal   rt_cond_signal
#define pthread_cond_destroy   rt_cond_destroy
#define OK   0
#define ERROR   -1
#define MAX_RT_TASKS   128
#define mqueues   system_data_ptr

Functions

 MODULE_LICENSE ("GPL")
int name_to_id (char *name)
mq_bool_t is_empty (struct queue_control *q)
mq_bool_t is_full (struct queue_control *q)
MSG_HDR * getnode (Q_CTRL *queue)
int freenode (void *node, Q_CTRL *queue)
void insert_message (Q_CTRL *q, MSG_HDR *this_msg)
mq_bool_t is_blocking (MSG_QUEUE *q)
mq_bool_t can_access (MSG_QUEUE *q, Q_ACCESS access)
void initialise_queue (Q_CTRL *q)
void delete_queue (int q_index)
mqd_t mq_open (char *mq_name, int oflags, mode_t permissions, struct mq_attr *mq_attr)
size_t _mq_receive (mqd_t mq, char *msg_buffer, size_t buflen, unsigned int *msgprio, int space)
size_t _mq_timedreceive (mqd_t mq, char *msg_buffer, size_t buflen, unsigned int *msgprio, const struct timespec *abstime, int space)
int _mq_send (mqd_t mq, const char *msg, size_t msglen, unsigned int msgprio, int space)
int _mq_timedsend (mqd_t mq, const char *msg, size_t msglen, unsigned int msgprio, const struct timespec *abstime, int space)
int mq_close (mqd_t mq)
int mq_getattr (mqd_t mq, struct mq_attr *attrbuf)
int mq_setattr (mqd_t mq, const struct mq_attr *new_attrs, struct mq_attr *old_attrs)
int mq_notify (mqd_t mq, const struct sigevent *notification)
int mq_unlink (char *mq_name)
int set_rt_fun_entries (struct rt_native_fun_entry *entry)
void reset_rt_fun_entries (struct rt_native_fun_entry *entry)
int __rtai_mq_init (void)
void __rtai_mq_exit (void)
 module_init (__rtai_mq_init)
 module_exit (__rtai_mq_exit)
 EXPORT_SYMBOL (mq_open)
 EXPORT_SYMBOL (_mq_receive)
 EXPORT_SYMBOL (_mq_timedreceive)
 EXPORT_SYMBOL (_mq_send)
 EXPORT_SYMBOL (_mq_timedsend)
 EXPORT_SYMBOL (mq_close)
 EXPORT_SYMBOL (mq_getattr)
 EXPORT_SYMBOL (mq_setattr)
 EXPORT_SYMBOL (mq_notify)
 EXPORT_SYMBOL (mq_unlink)

Variables

int num_pqueues = 0
_pqueue_descr_struct rt_pqueue_descr [MAX_PQUEUES] = {{0}}
_pqueue_access_struct task_pqueue_access [MAX_RT_TASKS] = {{0}}
MQ_ATTR default_queue_attrs = { MAX_MSGS, MAX_MSGSIZE, MQ_NONBLOCK, 0 }
pthread_mutex_t pqueue_mutex
rt_native_fun_entry rt_pqueue_entries []


Define Documentation

#define ERROR   -1
 

Definition at line 60 of file mq.c.

Referenced by _mq_receive(), _mq_timedreceive(), mq_notify(), and name_to_id().

#define MAX_RT_TASKS   128
 

Definition at line 67 of file mq.c.

Referenced by mq_open().

#define mqueues   system_data_ptr
 

Definition at line 162 of file mq.c.

#define OK   0
 

Definition at line 57 of file mq.c.

Referenced by __rtai_mq_init(), mq_close(), mq_getattr(), mq_notify(), mq_setattr(), and mq_unlink().

#define pthread_cond_destroy   rt_cond_destroy
 

Definition at line 54 of file mq.c.

Referenced by delete_queue().

#define pthread_cond_init cond,
attr   )     rt_cond_init(cond)
 

Definition at line 51 of file mq.c.

Referenced by mq_open().

#define pthread_cond_signal   rt_cond_signal
 

Definition at line 53 of file mq.c.

Referenced by _mq_receive(), _mq_send(), _mq_timedreceive(), and _mq_timedsend().

#define pthread_cond_t   SEM
 

Definition at line 45 of file mq.c.

Referenced by pthread_cond_open_rt().

#define pthread_cond_wait   rt_cond_wait
 

Definition at line 52 of file mq.c.

Referenced by _mq_receive(), and _mq_send().

#define pthread_mutex_destroy   rt_mutex_destroy
 

Definition at line 50 of file mq.c.

Referenced by __rtai_mq_exit(), and delete_queue().

#define pthread_mutex_init mutex,
attr   )     rt_mutex_init(mutex)
 

Definition at line 47 of file mq.c.

Referenced by __rtai_mq_init(), and mq_open().

#define pthread_mutex_lock   rt_mutex_lock
 

Definition at line 49 of file mq.c.

Referenced by _mq_receive(), _mq_send(), _mq_timedreceive(), _mq_timedsend(), mq_close(), mq_notify(), mq_open(), mq_setattr(), and mq_unlink().

#define pthread_mutex_t   SEM
 

Definition at line 46 of file mq.c.

Referenced by pthread_mutex_open_rt().

#define pthread_mutex_unlock   rt_mutex_unlock
 

Definition at line 48 of file mq.c.

Referenced by _mq_receive(), _mq_send(), _mq_timedreceive(), _mq_timedsend(), delete_queue(), mq_close(), mq_notify(), mq_open(), mq_setattr(), and mq_unlink().


Function Documentation

void __rtai_mq_exit void   ) 
 

Definition at line 926 of file mq.c.

References pqueue_mutex, printk(), pthread_mutex_destroy, reset_rt_fun_entries(), and rt_pqueue_entries.

Here is the call graph for this function:

int __rtai_mq_init void   ) 
 

Definition at line 914 of file mq.c.

References num_pqueues, OK, pqueue_mutex, printk(), pthread_mutex_init, rt_pqueue_entries, and set_rt_fun_entries().

Here is the call graph for this function:

size_t _mq_receive mqd_t  mq,
char *  msg_buffer,
size_t  buflen,
unsigned int *  msgprio,
int  space
 

Definition at line 427 of file mq.c.

References can_access(), ERROR, freenode(), is_blocking(), is_empty(), MAX_PQUEUES, mqd_t, pthread_cond_signal, pthread_cond_wait, pthread_mutex_lock, pthread_mutex_unlock, rt_pqueue_descr, and TRACE_RTAI_POSIX.

Here is the call graph for this function:

int _mq_send mqd_t  mq,
const char *  msg,
size_t  msglen,
unsigned int  msgprio,
int  space
 

Definition at line 546 of file mq.c.

References can_access(), getnode(), insert_message(), is_blocking(), is_empty(), is_full(), MAX_PQUEUES, MQ_PRIO_MAX, mqd_t, pthread_cond_signal, pthread_cond_wait, pthread_mutex_lock, pthread_mutex_unlock, rt_pqueue_descr, and TRACE_RTAI_POSIX.

Here is the call graph for this function:

size_t _mq_timedreceive mqd_t  mq,
char *  msg_buffer,
size_t  buflen,
unsigned int *  msgprio,
const struct timespec *  abstime,
int  space
 

Definition at line 481 of file mq.c.

References can_access(), ERROR, freenode(), is_blocking(), is_empty(), MAX_PQUEUES, mqd_t, pthread_cond_signal, pthread_mutex_lock, pthread_mutex_unlock, rt_cond_wait_until(), rt_pqueue_descr, timespec2count(), and TRACE_RTAI_POSIX.

Here is the call graph for this function:

int _mq_timedsend mqd_t  mq,
const char *  msg,
size_t  msglen,
unsigned int  msgprio,
const struct timespec *  abstime,
int  space
 

Definition at line 608 of file mq.c.

References can_access(), getnode(), insert_message(), is_blocking(), is_empty(), is_full(), MAX_PQUEUES, MQ_PRIO_MAX, mqd_t, pthread_cond_signal, pthread_mutex_lock, pthread_mutex_unlock, rt_cond_wait_until(), rt_pqueue_descr, timespec2count(), and TRACE_RTAI_POSIX.

Here is the call graph for this function:

mq_bool_t can_access MSG_QUEUE *  q,
Q_ACCESS  access
[static]
 

Definition at line 179 of file mq.c.

References MQ_OPEN_MAX, and RT_TASK.

Referenced by _mq_receive(), _mq_send(), _mq_timedreceive(), and _mq_timedsend().

void delete_queue int  q_index  )  [static]
 

Definition at line 232 of file mq.c.

References INVALID_PQUEUE, MQ_ATTR, num_pqueues, pthread_cond_destroy, pthread_mutex_destroy, pthread_mutex_unlock, rt_free(), and rt_pqueue_descr.

Referenced by mq_close(), and mq_unlink().

Here is the call graph for this function:

EXPORT_SYMBOL mq_unlink   ) 
 

EXPORT_SYMBOL mq_notify   ) 
 

EXPORT_SYMBOL mq_setattr   ) 
 

EXPORT_SYMBOL mq_getattr   ) 
 

EXPORT_SYMBOL mq_close   ) 
 

EXPORT_SYMBOL _mq_timedsend   ) 
 

EXPORT_SYMBOL _mq_send   ) 
 

EXPORT_SYMBOL _mq_timedreceive   ) 
 

EXPORT_SYMBOL _mq_receive   ) 
 

EXPORT_SYMBOL mq_open   ) 
 

int freenode void *  node,
Q_CTRL *  queue
[inline, static]
 

Definition at line 114 of file mq.c.

Referenced by _mq_receive(), and _mq_timedreceive().

MSG_HDR* getnode Q_CTRL *  queue  )  [inline, static]
 

Definition at line 109 of file mq.c.

Referenced by _mq_send(), and _mq_timedsend().

void initialise_queue Q_CTRL *  q  )  [inline, static]
 

Definition at line 213 of file mq.c.

References MQ_MIN_MSG_PRIORITY.

Referenced by mq_open().

void insert_message Q_CTRL *  q,
MSG_HDR *  this_msg
[static]
 

Definition at line 124 of file mq.c.

Referenced by _mq_send(), and _mq_timedsend().

mq_bool_t is_blocking MSG_QUEUE *  q  )  [static]
 

Definition at line 164 of file mq.c.

References MQ_OPEN_MAX.

Referenced by _mq_receive(), _mq_send(), _mq_timedreceive(), and _mq_timedsend().

mq_bool_t is_empty struct queue_control *  q  )  [inline, static]
 

Definition at line 97 of file mq.c.

Referenced by _mq_receive(), _mq_send(), _mq_timedreceive(), and _mq_timedsend().

mq_bool_t is_full struct queue_control *  q  )  [inline, static]
 

Definition at line 103 of file mq.c.

Referenced by _mq_send(), and _mq_timedsend().

module_exit __rtai_mq_exit   ) 
 

module_init __rtai_mq_init   ) 
 

MODULE_LICENSE "GPL"   ) 
 

int mq_close mqd_t  mq  ) 
 

Definition at line 680 of file mq.c.

References delete_queue(), INVALID_PQUEUE, MAX_PQUEUES, MQ_OPEN_MAX, mqd_t, OK, pqueue_mutex, pthread_mutex_lock, pthread_mutex_unlock, rt_pqueue_descr, RT_TASK, and TRACE_RTAI_POSIX.

Here is the call graph for this function:

int mq_getattr mqd_t  mq,
struct mq_attr attrbuf
 

Definition at line 723 of file mq.c.

References MAX_PQUEUES, mqd_t, OK, rt_pqueue_descr, and TRACE_RTAI_POSIX.

int mq_notify mqd_t  mq,
const struct sigevent *  notification
 

Definition at line 778 of file mq.c.

References ERROR, MAX_PQUEUES, mqd_t, OK, pthread_mutex_lock, pthread_mutex_unlock, rt_pqueue_descr, and TRACE_RTAI_POSIX.

mqd_t mq_open char *  mq_name,
int  oflags,
mode_t  permissions,
struct mq_attr mq_attr
 

Definition at line 260 of file mq.c.

References default_queue_attrs, initialise_queue(), INVALID_PQUEUE, MAX_PQUEUES, MAX_RT_TASKS, mq_attr::mq_maxmsg, mq_attr::mq_msgsize, MQ_NAME_MAX, MQ_OPEN_MAX, mqd_t, name_to_id(), num_pqueues, pqueue_mutex, pthread_cond_init, pthread_mutex_init, pthread_mutex_lock, pthread_mutex_unlock, rt_malloc(), rt_pqueue_descr, RT_TASK, task_pqueue_access, and TRACE_RTAI_POSIX.

Here is the call graph for this function:

int mq_setattr mqd_t  mq,
const struct mq_attr new_attrs,
struct mq_attr old_attrs
 

Definition at line 737 of file mq.c.

References MAX_PQUEUES, MQ_BLOCK, mq_attr::mq_flags, MQ_NONBLOCK, MQ_OPEN_MAX, mqd_t, OK, pthread_mutex_lock, pthread_mutex_unlock, rt_pqueue_descr, RT_TASK, and TRACE_RTAI_POSIX.

int mq_unlink char *  mq_name  ) 
 

Definition at line 809 of file mq.c.

References delete_queue(), name_to_id(), OK, pqueue_mutex, pthread_mutex_lock, pthread_mutex_unlock, rt_pqueue_descr, and TRACE_RTAI_POSIX.

Here is the call graph for this function:

int name_to_id char *  name  )  [static]
 

Definition at line 84 of file mq.c.

References ERROR, MAX_PQUEUES, and rt_pqueue_descr.

Referenced by mq_open(), and mq_unlink().


Variable Documentation

MQ_ATTR default_queue_attrs = { MAX_MSGS, MAX_MSGSIZE, MQ_NONBLOCK, 0 } [static]
 

Definition at line 76 of file mq.c.

Referenced by mq_open().

int num_pqueues = 0 [static]
 

Definition at line 73 of file mq.c.

Referenced by __rtai_mq_init(), delete_queue(), and mq_open().

pthread_mutex_t pqueue_mutex [static]
 

Definition at line 78 of file mq.c.

Referenced by __rtai_mq_exit(), __rtai_mq_init(), mq_close(), mq_open(), and mq_unlink().

struct _pqueue_descr_struct rt_pqueue_descr[MAX_PQUEUES] = {{0}} [static]
 

Definition at line 74 of file mq.c.

Referenced by _mq_receive(), _mq_send(), _mq_timedreceive(), _mq_timedsend(), delete_queue(), mq_close(), mq_getattr(), mq_notify(), mq_open(), mq_setattr(), mq_unlink(), and name_to_id().

struct rt_native_fun_entry rt_pqueue_entries[]
 

Initial value:

{ { { UR1(1, 5) | UR2(4, 6), mq_open }, MQ_OPEN }, { { 1, _mq_receive }, MQ_RECEIVE }, { { 1, _mq_send }, MQ_SEND }, { { 1, mq_close }, MQ_CLOSE }, { { UW1(2, 3), mq_getattr }, MQ_GETATTR }, { { UR1(2, 4) | UW1(3, 4), mq_setattr }, MQ_SETATTR }, { { UR1(2, 3), mq_notify }, MQ_NOTIFY }, { { UR1(1, 2), mq_unlink }, MQ_UNLINK }, { { 1, _mq_timedreceive }, MQ_TIMEDRECEIVE }, { { 1, _mq_timedsend }, MQ_TIMEDSEND }, { { 0, 0 }, 000 } }
Definition at line 897 of file mq.c.

Referenced by __rtai_mq_exit(), and __rtai_mq_init().

struct _pqueue_access_struct task_pqueue_access[MAX_RT_TASKS] = {{0}} [static]
 

Definition at line 75 of file mq.c.

Referenced by mq_open().


Generated on Thu Nov 20 11:54:52 2008 for RTAI API by doxygen 1.3.8