base/ipc/msg/msg.c File Reference


Detailed Description

Message handling functions.

Author:
Paolo Mantegazza
Note:
Copyright (C) 1999-2003 Paolo Mantegazza <mantegazza@aero.polimi.it> [ Specific COPYRIGHTS follow along the code ]
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

Definition in file msg.c.

Include dependency graph for msg.c:

Go to the source code of this file.

Defines

#define TASK_INVAL   ((RT_TASK *)RTE_OBJINV)
#define msg_not_sent()
#define msg_not_received()
#define CHECK_SENDER_MAGIC(task)   do { if (task->magic != RT_TASK_MAGIC) return TASK_INVAL; } while (0)
#define CHECK_RECEIVER_MAGIC(task)   do { if (task && task->magic != RT_TASK_MAGIC) return TASK_INVAL; } while (0)
#define SET_RPC_MCB()
#define task_mcb   (task->mcb)
#define SET_SEND_MCB()
#define DO_RCV_MSG()

Functions

 MODULE_LICENSE ("GPL")
RTAI_SYSCALL_MODE RT_TASKrt_send (RT_TASK *task, unsigned long msg)
  Send a message.
RTAI_SYSCALL_MODE RT_TASKrt_send_if (RT_TASK *task, unsigned long msg)
  Send a message, only if the calling task will not be blocked.
RTAI_SYSCALL_MODE RT_TASKrt_send_until (RT_TASK *task, unsigned long msg, RTIME time)
  brief Send a message with an absolute timeout.
RTAI_SYSCALL_MODE RT_TASKrt_send_timed (RT_TASK *task, unsigned long msg, RTIME delay)
  brief Send a message with a relative timeout.
RTAI_SYSCALL_MODE RT_TASKrt_rpc (RT_TASK *task, unsigned long to_do, void *result)
  Make a remote procedure call
RTAI_SYSCALL_MODE RT_TASKrt_rpc_if (RT_TASK *task, unsigned long to_do, void *result)
  Make a remote procedure call, only if the calling task will not be blocked.
RTAI_SYSCALL_MODE RT_TASKrt_rpc_until (RT_TASK *task, unsigned long to_do, void *result, RTIME time)
  Make a remote procedure call with an absolute timeout.
RTAI_SYSCALL_MODE RT_TASKrt_rpc_timed (RT_TASK *task, unsigned long to_do, void *result, RTIME delay)
  Make a remote procedure call with a relative timeout.
RTAI_SYSCALL_MODE int rt_isrpc (RT_TASK *task)
  Check if sender waits for reply or not.
RTAI_SYSCALL_MODE RT_TASKrt_return (RT_TASK *task, unsigned long result)
  Return (sends) the result back to the task that made the related remote procedure call.
RTAI_SYSCALL_MODE RT_TASKrt_evdrp (RT_TASK *task, void *msg)
  Eavedrop (spy) the content of a message.
RTAI_SYSCALL_MODE RT_TASKrt_receive (RT_TASK *task, void *msg)
  Receive a message.
RTAI_SYSCALL_MODE RT_TASKrt_receive_if (RT_TASK *task, void *msg)
  Receive a message, only if the calling task is not blocked.
RTAI_SYSCALL_MODE RT_TASKrt_receive_until (RT_TASK *task, void *msg, RTIME time)
  Receive a message with an absolute timeout.
RTAI_SYSCALL_MODE RT_TASKrt_receive_timed (RT_TASK *task, void *msg, RTIME delay)
  Receive a message with a relative timeout.
RTAI_SYSCALL_MODE RT_TASKrt_rpcx (RT_TASK *task, void *smsg, void *rmsg, int ssize, int rsize)
  Make an extended remote procedure call
RTAI_SYSCALL_MODE RT_TASKrt_rpcx_if (RT_TASK *task, void *smsg, void *rmsg, int ssize, int rsize)
  Make an extended remote procedure call, only if the calling task will not be blocked.
RTAI_SYSCALL_MODE RT_TASKrt_rpcx_until (RT_TASK *task, void *smsg, void *rmsg, int ssize, int rsize, RTIME time)
  Make an extended remote procedure call with absolute timeout.
RTAI_SYSCALL_MODE RT_TASKrt_rpcx_timed (RT_TASK *task, void *smsg, void *rmsg, int ssize, int rsize, RTIME delay)
  Make an extended remote procedure call with a relative timeout.
RTAI_SYSCALL_MODE RT_TASKrt_sendx (RT_TASK *task, void *msg, int size)
  Send an extended message.
RTAI_SYSCALL_MODE RT_TASKrt_sendx_if (RT_TASK *task, void *msg, int size)
  Send an extended message, only if the calling task will not be blocked.
RTAI_SYSCALL_MODE RT_TASKrt_sendx_until (RT_TASK *task, void *msg, int size, RTIME time)
  Send an extended message with absolute timeout.
RTAI_SYSCALL_MODE RT_TASKrt_sendx_timed (RT_TASK *task, void *msg, int size, RTIME delay)
  Send an extended message with relative timeout.
RTAI_SYSCALL_MODE RT_TASKrt_returnx (RT_TASK *task, void *msg, int size)
  Return (sends) an extended result back to the task that made the related extended remote procedure call.
RTAI_SYSCALL_MODE RT_TASKrt_evdrpx (RT_TASK *task, void *msg, int size, long *len)
  Eavedrop (spy) the content of an extended message.
RTAI_SYSCALL_MODE RT_TASKrt_receivex (RT_TASK *task, void *msg, int size, long *len)
  Receive an extended message.
RTAI_SYSCALL_MODE RT_TASKrt_receivex_if (RT_TASK *task, void *msg, int size, long *len)
  Receive an extended message, only if the calling task is not blocked.
RTAI_SYSCALL_MODE RT_TASKrt_receivex_until (RT_TASK *task, void *msg, int size, long *len, RTIME time)
  Receive an extended message with an absolute timeout.
RTAI_SYSCALL_MODE RT_TASKrt_receivex_timed (RT_TASK *task, void *msg, int size, long *len, RTIME delay)
  Receive an extended message with a relative timeout.
static void proxy_task (RT_TASK *me)
RT_TASK__rt_proxy_attach (void(*agent)(long), RT_TASK *task, void *msg, int nbytes, int priority)
RTAI_SYSCALL_MODE RT_TASKrt_proxy_attach (RT_TASK *task, void *msg, int nbytes, int prio)
RTAI_SYSCALL_MODE int rt_proxy_detach (RT_TASK *proxy)
RTAI_SYSCALL_MODE RT_TASKrt_trigger (RT_TASK *proxy)
RTAI_SYSCALL_MODE int rt_Send (pid_t pid, void *smsg, void *rmsg, size_t ssize, size_t rsize)
RTAI_SYSCALL_MODE pid_t rt_Receive (pid_t pid, void *msg, size_t maxsize, size_t *msglen)
RTAI_SYSCALL_MODE pid_t rt_Creceive (pid_t pid, void *msg, size_t maxsize, size_t *msglen, RTIME delay)
RTAI_SYSCALL_MODE int rt_Reply (pid_t pid, void *msg, size_t size)
static void Proxy_Task (RT_TASK *me)
RTAI_SYSCALL_MODE pid_t rt_Proxy_attach (pid_t pid, void *msg, int nbytes, int prio)
RTAI_SYSCALL_MODE int rt_Proxy_detach (pid_t pid)
RTAI_SYSCALL_MODE pid_t rt_Trigger (pid_t pid)
RTAI_SYSCALL_MODE pid_t rt_Name_attach (const char *argname)
RTAI_SYSCALL_MODE pid_t rt_Name_locate (const char *arghost, const char *argname)
RTAI_SYSCALL_MODE int rt_Name_detach (pid_t pid)
int __rtai_msg_init (void)
void __rtai_msg_exit (void)
 module_init (__rtai_msg_init)
 module_exit (__rtai_msg_exit)
 EXPORT_SYMBOL (rt_send)
 EXPORT_SYMBOL (rt_send_if)
 EXPORT_SYMBOL (rt_send_until)
 EXPORT_SYMBOL (rt_send_timed)
 EXPORT_SYMBOL (rt_rpc)
 EXPORT_SYMBOL (rt_rpc_if)
 EXPORT_SYMBOL (rt_rpc_until)
 EXPORT_SYMBOL (rt_rpc_timed)
 EXPORT_SYMBOL (rt_isrpc)
 EXPORT_SYMBOL (rt_return)
 EXPORT_SYMBOL (rt_evdrp)
 EXPORT_SYMBOL (rt_receive)
 EXPORT_SYMBOL (rt_receive_if)
 EXPORT_SYMBOL (rt_receive_until)
 EXPORT_SYMBOL (rt_receive_timed)
 EXPORT_SYMBOL (rt_rpcx)
 EXPORT_SYMBOL (rt_rpcx_if)
 EXPORT_SYMBOL (rt_rpcx_until)
 EXPORT_SYMBOL (rt_rpcx_timed)
 EXPORT_SYMBOL (rt_sendx)
 EXPORT_SYMBOL (rt_sendx_if)
 EXPORT_SYMBOL (rt_sendx_until)
 EXPORT_SYMBOL (rt_sendx_timed)
 EXPORT_SYMBOL (rt_returnx)
 EXPORT_SYMBOL (rt_evdrpx)
 EXPORT_SYMBOL (rt_receivex)
 EXPORT_SYMBOL (rt_receivex_if)
 EXPORT_SYMBOL (rt_receivex_until)
 EXPORT_SYMBOL (rt_receivex_timed)
 EXPORT_SYMBOL (__rt_proxy_attach)
 EXPORT_SYMBOL (rt_proxy_attach)
 EXPORT_SYMBOL (rt_proxy_detach)
 EXPORT_SYMBOL (rt_trigger)
 EXPORT_SYMBOL (rt_Send)
 EXPORT_SYMBOL (rt_Receive)
 EXPORT_SYMBOL (rt_Creceive)
 EXPORT_SYMBOL (rt_Reply)
 EXPORT_SYMBOL (rt_Proxy_attach)
 EXPORT_SYMBOL (rt_Proxy_detach)
 EXPORT_SYMBOL (rt_Trigger)
 EXPORT_SYMBOL (rt_Name_attach)
 EXPORT_SYMBOL (rt_Name_locate)
 EXPORT_SYMBOL (rt_Name_detach)

Variables

rt_native_fun_entry rt_msg_entries []


Define Documentation

#define CHECK_RECEIVER_MAGIC ( task   )     do { if (task && task->magic != RT_TASK_MAGIC) return TASK_INVAL; } while (0)

Definition at line 77 of file msg.c.

Referenced by rt_evdrp(), rt_receive(), rt_receive_if(), and rt_receive_until().

#define CHECK_SENDER_MAGIC ( task   )     do { if (task->magic != RT_TASK_MAGIC) return TASK_INVAL; } while (0)

Definition at line 74 of file msg.c.

Referenced by rt_return(), rt_rpc(), rt_rpc_if(), rt_rpc_until(), rt_send(), rt_send_if(), and rt_send_until().

 
#define DO_RCV_MSG (  ) 

Value:

do { \
        if ((*len = size <= mcb->sbytes ? size : mcb->sbytes)) { \
            memcpy(msg, mcb->sbuf, *len); \
        } \
    } while (0)

Definition at line 1552 of file msg.c.

Referenced by rt_evdrpx(), rt_receivex(), rt_receivex_if(), rt_receivex_timed(), and rt_receivex_until().

 
#define msg_not_received (  ) 

Value:

do { \
    rt_current->ret_queue.task = NULL; \
    task = (void *)(long)(CONFIG_RTAI_USE_NEWERR ? (((void *)rt_current->blocked_on != RTP_UNBLKD) ? RTE_TIMOUT : RTE_UNBLKD) : 0); \
} while (0)

Definition at line 66 of file msg.c.

Referenced by rt_receive(), and rt_receive_until().

 
#define msg_not_sent (  ) 

Value:

do { \
    void *retp; \
    if ((retp = rt_current->blocked_on) != RTP_OBJREM) { \
        set_task_prio_from_resq(task); \
        dequeue_blocked(rt_current); \
        task = (void *)(long)(CONFIG_RTAI_USE_NEWERR ? ((likely(retp > RTP_HIGERR) ? RTE_TIMOUT : RTE_UNBLKD)) : 0); \
    } else { \
        rt_current->prio_passed_to = NULL; \
        task = (void *)(long)(CONFIG_RTAI_USE_NEWERR ? RTE_OBJREM : 0); \
    } \
    rt_current->msg_queue.task = rt_current; \
} while (0)

Definition at line 52 of file msg.c.

Referenced by rt_rpc(), rt_rpc_if(), rt_rpc_until(), rt_send(), and rt_send_until().

 
#define SET_RPC_MCB (  ) 

Value:

do { \
        mcb.sbuf   = smsg; \
        mcb.sbytes = ssize; \
        mcb.rbuf   = rmsg; \
        mcb.rbytes = rsize; \
    } while (0)

Definition at line 1096 of file msg.c.

Referenced by rt_rpcx(), rt_rpcx_if(), rt_rpcx_timed(), and rt_rpcx_until().

 
#define SET_SEND_MCB (  ) 

Value:

do { \
        task_mcb.sbuf   = msg; \
        task_mcb.sbytes = size; \
        task_mcb.rbuf   = 0; \
        task_mcb.rbytes = 0; \
    } while (0)

Definition at line 1308 of file msg.c.

Referenced by rt_sendx(), rt_sendx_if(), rt_sendx_timed(), and rt_sendx_until().

#define TASK_INVAL   ((RT_TASK *)RTE_OBJINV)

Definition at line 50 of file msg.c.

#define task_mcb   (task->mcb)

Definition at line 1307 of file msg.c.

Referenced by rt_sendx(), rt_sendx_if(), rt_sendx_timed(), and rt_sendx_until().


Function Documentation

RT_TASK* __rt_proxy_attach ( void(*)(long)  agent,
RT_TASK task,
void *  msg,
int  nbytes,
int  priority 
)

Definition at line 1837 of file msg.c.

References rt_free(), rt_kthread_init(), rt_malloc(), RT_SCHED_LINUX_PRIORITY, RT_SCHED_LOWEST_PRIORITY, and task.

Referenced by rt_proxy_attach(), and rt_Proxy_attach().

Here is the call graph for this function:

void __rtai_msg_exit ( void   ) 

Definition at line 2155 of file msg.c.

References reset_rt_fun_entries().

Here is the call graph for this function:

int __rtai_msg_init ( void   ) 

Definition at line 2150 of file msg.c.

References set_rt_fun_entries().

Here is the call graph for this function:

EXPORT_SYMBOL ( rt_Name_detach   ) 

EXPORT_SYMBOL ( rt_Name_locate   ) 

EXPORT_SYMBOL ( rt_Name_attach   ) 

EXPORT_SYMBOL ( rt_Trigger   ) 

EXPORT_SYMBOL ( rt_Proxy_detach   ) 

EXPORT_SYMBOL ( rt_Proxy_attach   ) 

EXPORT_SYMBOL ( rt_Reply   ) 

EXPORT_SYMBOL ( rt_Creceive   ) 

EXPORT_SYMBOL ( rt_Receive   ) 

EXPORT_SYMBOL ( rt_Send   ) 

EXPORT_SYMBOL ( rt_trigger   ) 

EXPORT_SYMBOL ( rt_proxy_detach   ) 

EXPORT_SYMBOL ( rt_proxy_attach   ) 

EXPORT_SYMBOL ( __rt_proxy_attach   ) 

EXPORT_SYMBOL ( rt_receivex_timed   ) 

EXPORT_SYMBOL ( rt_receivex_until   ) 

EXPORT_SYMBOL ( rt_receivex_if   ) 

EXPORT_SYMBOL ( rt_receivex   ) 

EXPORT_SYMBOL ( rt_evdrpx   ) 

EXPORT_SYMBOL ( rt_returnx   ) 

EXPORT_SYMBOL ( rt_sendx_timed   ) 

EXPORT_SYMBOL ( rt_sendx_until   ) 

EXPORT_SYMBOL ( rt_sendx_if   ) 

EXPORT_SYMBOL ( rt_sendx   ) 

EXPORT_SYMBOL ( rt_rpcx_timed   ) 

EXPORT_SYMBOL ( rt_rpcx_until   ) 

EXPORT_SYMBOL ( rt_rpcx_if   ) 

EXPORT_SYMBOL ( rt_rpcx   ) 

EXPORT_SYMBOL ( rt_receive_timed   ) 

EXPORT_SYMBOL ( rt_receive_until   ) 

EXPORT_SYMBOL ( rt_receive_if   ) 

EXPORT_SYMBOL ( rt_receive   ) 

EXPORT_SYMBOL ( rt_evdrp   ) 

EXPORT_SYMBOL ( rt_return   ) 

EXPORT_SYMBOL ( rt_isrpc   ) 

EXPORT_SYMBOL ( rt_rpc_timed   ) 

EXPORT_SYMBOL ( rt_rpc_until   ) 

EXPORT_SYMBOL ( rt_rpc_if   ) 

EXPORT_SYMBOL ( rt_rpc   ) 

EXPORT_SYMBOL ( rt_send_timed   ) 

EXPORT_SYMBOL ( rt_send_until   ) 

EXPORT_SYMBOL ( rt_send_if   ) 

EXPORT_SYMBOL ( rt_send   ) 

module_exit ( __rtai_msg_exit   ) 

module_init ( __rtai_msg_init   ) 

MODULE_LICENSE ( "GPL"   ) 

static void Proxy_Task ( RT_TASK me  )  [static]

Definition at line 2004 of file msg.c.

References rt_rpc(), and rt_task_suspend().

Referenced by rt_Proxy_attach().

Here is the call graph for this function:

static void proxy_task ( RT_TASK me  )  [static]

Definition at line 1821 of file msg.c.

References rt_rpc(), and rt_task_suspend().

Referenced by rt_proxy_attach().

Here is the call graph for this function:

RTAI_SYSCALL_MODE pid_t rt_Creceive ( pid_t  pid,
void *  msg,
size_t  maxsize,
size_t *  msglen,
RTIME  delay 
)

Definition at line 1958 of file msg.c.

References rt_receive_if(), rt_receive_timed(), and task.

Here is the call graph for this function:

RTAI_SYSCALL_MODE pid_t rt_Name_attach ( const char *  argname  ) 

Definition at line 2057 of file msg.c.

References current, pid, task, TSKEXT0, and TSKEXT1.

RTAI_SYSCALL_MODE int rt_Name_detach ( pid_t  pid  ) 

Definition at line 2087 of file msg.c.

References current, TSKEXT0, and TSKEXT1.

RTAI_SYSCALL_MODE pid_t rt_Name_locate ( const char *  arghost,
const char *  argname 
)

Definition at line 2070 of file msg.c.

References cpuid, pid, rt_get_adr(), rt_smp_linux_task, task, and TSKEXT1.

Here is the call graph for this function:

RTAI_SYSCALL_MODE pid_t rt_Proxy_attach ( pid_t  pid,
void *  msg,
int  nbytes,
int  prio 
)

Definition at line 2024 of file msg.c.

References __rt_proxy_attach(), Proxy_Task(), and task.

Here is the call graph for this function:

RTAI_SYSCALL_MODE RT_TASK* rt_proxy_attach ( RT_TASK task,
void *  msg,
int  nbytes,
int  prio 
)

Definition at line 1877 of file msg.c.

References __rt_proxy_attach(), proxy_task(), and task.

Here is the call graph for this function:

RTAI_SYSCALL_MODE int rt_Proxy_detach ( pid_t  pid  ) 

Definition at line 2030 of file msg.c.

References rt_free(), and rt_task_delete.

Here is the call graph for this function:

RTAI_SYSCALL_MODE int rt_proxy_detach ( RT_TASK proxy  ) 

Definition at line 1884 of file msg.c.

References rt_free(), and rt_task_delete.

Here is the call graph for this function:

RTAI_SYSCALL_MODE pid_t rt_Receive ( pid_t  pid,
void *  msg,
size_t  maxsize,
size_t *  msglen 
)

Definition at line 1941 of file msg.c.

References rt_receive(), and task.

Here is the call graph for this function:

RTAI_SYSCALL_MODE int rt_Reply ( pid_t  pid,
void *  msg,
size_t  size 
)

Definition at line 1981 of file msg.c.

References rt_return(), and task.

Here is the call graph for this function:

RTAI_SYSCALL_MODE int rt_Send ( pid_t  pid,
void *  smsg,
void *  rmsg,
size_t  ssize,
size_t  rsize 
)

Definition at line 1919 of file msg.c.

References rt_rpc(), and task.

Here is the call graph for this function:

RTAI_SYSCALL_MODE pid_t rt_Trigger ( pid_t  pid  ) 

Definition at line 2040 of file msg.c.

References atomic_inc, and rt_task_resume().

Here is the call graph for this function:

RTAI_SYSCALL_MODE RT_TASK* rt_trigger ( RT_TASK proxy  ) 

Definition at line 1894 of file msg.c.

References atomic_inc, and rt_task_resume().

Here is the call graph for this function:


Variable Documentation

struct rt_native_fun_entry rt_msg_entries[]

Definition at line 2104 of file msg.c.


Generated on Tue Feb 2 17:47:35 2010 for RTAI API by  doxygen 1.4.7