public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
To: Midhun A <midhunagni@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Userspace - Kernel Space "Connector" test
Date: Thu, 27 Mar 2008 17:38:23 +0300	[thread overview]
Message-ID: <20080327143823.GA20443@2ka.mipt.ru> (raw)
In-Reply-To: <e1d5030b0803260311j25831caeyd9fc111a06e572e2@mail.gmail.com>

Hi.

On Wed, Mar 26, 2008 at 03:41:16PM +0530, Midhun A (midhunagni@gmail.com) wrote:
>    I want to use the Connector module (CONFIG_CONNECTOR) for Kernel
> space to User space communication.  My kernel version is 2.6.22.
> Before using it, I am trying out the example programs in the
> Documentation folder. I have cn_test.c built into the kernel (not
> loaded as a module) and I have compiled ucon.c.

You have to use smaller index than 32 or increase CN_NETLINK_USERS
parameter in include/linux/connector.h

Currently all kernel users fit that limitation, which is ok.

Also, parameter used in bind() is a bitmap of requested groups, to
listen on 0x123 idx you have to add it via setsockopt(), which is
commented in ucon.c.

So, either switch to smaller group number (connector index) or increase
above limit. If you will select the former case (it is simpler from
userspace point of view), you have to change bind() group, note that it
is a bitmap, os group N equals to (1<<N) bind() value. If you will
select the latter case and recompile connector module, then you have to
uncomment setsockopt() code in ucon.c

Both methods work, and you will get something like this:
$ sudo ./ucon
Thu Mar 27 17:29:19 2008 : [123.457] [00000002.00000000].
Thu Mar 27 17:29:20 2008 : [123.457] [00000003.00000000].
Thu Mar 27 17:29:21 2008 : [123.457] [00000004.00000000].
Thu Mar 27 17:29:22 2008 : [123.457] [00000005.00000000].
Thu Mar 27 17:29:23 2008 : [123.457] [00000006.00000000].

-- 
	Evgeniy Polyakov

  reply	other threads:[~2008-03-27 14:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-26 10:11 Userspace - Kernel Space "Connector" test Midhun A
2008-03-27 14:38 ` Evgeniy Polyakov [this message]
2008-04-04  7:01   ` Midhun A
2008-04-21 10:29     ` Midhun A
2008-04-21 10:43       ` Evgeniy Polyakov
2008-04-23  8:19         ` Midhun A
2008-04-23  8:33           ` Evgeniy Polyakov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080327143823.GA20443@2ka.mipt.ru \
    --to=johnpol@2ka.mipt.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=midhunagni@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox