Re: Messaging

From: Sri Ram Vemulpali
Date: Mon Jan 24 2011 - 14:32:51 EST


Hi Anil,

Thanks for your response. There are many implementation of
messaging in kernel. I am looking for specific implementation of Linux
kernel.
So, If I am not wrong, from your structures you posted, it seems Linux
is implementing using file system. Lets make this an assumption and
post it to groups.

Please if anyone has idea of messaging implementation, please let us know.

Thanks,
Sri.

On Sun, Jan 23, 2011 at 3:48 PM, anil joshi <anilsjoshi123@xxxxxxxxx> wrote:
> I would like to share my knowledge with you Âif any technical error
> please suggest me
>
> As in Process management
>
> struct thread_info {
>     struct task_struct   Â*task;     Â/* main task structure */
>     struct exec_domain   Â*exec_domain;  /* execution domain */
> Â Â Â Â __u32 Â Â Â Â Â Â Â Â Â flags; Â Â Â Â Â/* low level flags */
> Â Â Â Â __u32 Â Â Â Â Â Â Â Â Â status; Â Â Â Â /* thread synchronous flags */
> Â Â Â Â __u32 Â Â Â Â Â Â Â Â Â cpu; Â Â Â Â Â Â/* current CPU */
>     int           preempt_count; Â/* 0 => preemptable,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â <0 => BUG */
>     mm_segment_t      Âaddr_limit;
>     struct restart_block  Ârestart_block;
>     void __user       *sysenter_return;
> Â#ifdef CONFIG_X86_32
>     unsigned long      previous_esp;  /* ESP of the previous stack in
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âcase of nested (IRQ) stacks
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â */
> Â Â Â Â __u8 Â Â Â Â Â Â Â Â Â Âsupervisor_stack[0];
> Â#endif
>     int           uaccess_err;
> Â};
>
>
>
>
> struct task_struct Â{
>
> -----
> --
> -
> ----
> -----
> }
>
>
> in a similar fashion ÂFile System Management in that VFS
> the four Primary object of VFS are
> (courtesy Âby Robert ÂLove Linux kernel Dev elopement)
> super block object Â-> represent mounted file system (contained in
> struct vfsmount)
> i node object -> represent a specific Âfile
>
> d entry object -> represent directory entry, a single component of a path
> fiie object -> open file as associated with process
>
> Layered approach
> Object of struct mqueue_inode_info layered Âon Object of struct inode
> (vfs_inode)
>
> or
>
> Object of struct inode (vfs_inode) Âcontained in struct mqueue_inode_info
>
>
>
> it contain particular message specific information like
>
> $ ls /dev/mqueue/mymq
> QSIZE:129 Â Â NOTIFY:2 Â ÂSIGNO:0 Â ÂNOTIFY_PID:8260
>
>
>
> struct mqueue_inode_info {
> Â Â Â Âspinlock_t lock;
> Â Â Â Âstruct inode vfs_inode;
> Â Â Â Âwait_queue_head_t wait_q;
>
> Â Â Â Âstruct msg_msg **messages;
> Â Â Â Âstruct mq_attr attr;
>
> Â Â Â Âstruct sigevent notify;
> Â Â Â Âstruct pid* notify_owner;
> Â Â Â Âstruct user_struct *user; Â Â Â /* user who created, for accounting */
> Â Â Â Âstruct sock *notify_sock;
> Â Â Â Âstruct sk_buff *notify_cookie;
>
> Â Â Â Â/* for tasks waiting for free space and messages, respectively */
> Â Â Â Â struct ext_wait_queue e_wait_q[2];
>
> Â Â Â Â unsigned long qsize; /* size of queue in memory (sum of all msgs) */
> Â};
>
> struct inode Â{
> Â----
> ----
> ----
> }
>
>
> we used the generic inode structure as the inode layer does not need
> to know about the Â/dev/mqueue/mymq stucture(mqueue_inode_info)
>
> flush
> unlnk
> look up
> mqueue_poll_file,
> mqueue_read_file
> are specific to mqueue inode
> static const struct inode_operations mqueue_dir_inode_operations = {
> Â Â Â Â.lookup = simple_lookup,
> Â Â Â Â.create = mqueue_create,
> Â Â Â .unlink = mqueue_unlink,
> Â};
>
> static const struct file_operations mqueue_file_operations = {
> Â Â Â Â.flush = mqueue_flush_file,
> Â Â Â Â.poll = mqueue_poll_file,
> Â Â Â Â.read = mqueue_read_file,
> Â};
>
> inode->i_fop = &mqueue_file_operations;
> inode->i_op = &mqueue_dir_inode_operations;
>
>
> refer http://bec-systems.com/web/content/view/94/9/
> http://www.kroah.com/log/linux/container_of.html
>
> if u know more regarding mqueue share it
>
> Regards
> Anil.S.Joshi
>



--
Regards,
Sri.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/