One more example: http://groups.google.com/group/android-ndk/browse_thread/thread/8a916e5ec751d3fd
On Sat, Jun 18, 2011 at 8:58 AM, Peter Teoh <htmldevelo...@gmail.com> wrote: > See these for netlink usage (from userspace) to facilitate communication > with kernel: > > > http://www.netmite.com/android/mydroid/external/bluez/utils/plugins/netlink.c > http://blog.csdn.net/m346759541/archive/2011/01/12/6131220.aspx > > And this is the kernel component: > > http://www.netmite.com/android/mydroid/kernel/net/tipc/netlink.c > > And searching on my android git download: > > ./system/core/libsysutils/src/NetlinkEvent.cpp: > #define LOG_TAG "NetlinkEvent" > #include <sysutils/NetlinkEvent.h> > const int NetlinkEvent::NlActionUnknown = 0; > const int NetlinkEvent::NlActionAdd = 1; > const int NetlinkEvent::NlActionRemove = 2; > const int NetlinkEvent::NlActionChange = 3; > NetlinkEvent::NetlinkEvent() { > NetlinkEvent::~NetlinkEvent() { > void NetlinkEvent::dump() { > bool NetlinkEvent::decode(char *buffer, int size) { > const char *NetlinkEvent::findParam(const char *paramName) { > SLOGE("NetlinkEvent::FindParam(): Parameter '%s' not found", > paramName); > > ./system/core/libsysutils/src/NetlinkListener.cpp: > #include <sysutils/NetlinkEvent.h> > NetlinkEvent *evt = new NetlinkEvent(); > SLOGE("Error decoding NetlinkEvent"); > > ./system/vold/DirectVolume.cpp: > #include <sysutils/NetlinkEvent.h> > int DirectVolume::handleBlockEvent(NetlinkEvent *evt) { > if (action == NetlinkEvent::NlActionAdd) { > } else if (action == NetlinkEvent::NlActionRemove) { > } else if (action == NetlinkEvent::NlActionChange) { > void DirectVolume::handleDiskAdded(const char *devpath, NetlinkEvent *evt) > { > void DirectVolume::handlePartitionAdded(const char *devpath, NetlinkEvent > *evt) { > void DirectVolume::handleDiskChanged(const char *devpath, NetlinkEvent > *evt) { > void DirectVolume::handlePartitionChanged(const char *devpath, NetlinkEvent > *evt) { > void DirectVolume::handleDiskRemoved(const char *devpath, NetlinkEvent > *evt) { > void DirectVolume::handlePartitionRemoved(const char *devpath, NetlinkEvent > *evt) { > > ./system/vold/NetlinkHandler.cpp: > #include <sysutils/NetlinkEvent.h> > void NetlinkHandler::onEvent(NetlinkEvent *evt) { > > ./system/vold/Volume.cpp: > int Volume::handleBlockEvent(NetlinkEvent *evt) { > > ./system/vold/VolumeManager.cpp: > #include <sysutils/NetlinkEvent.h> > void VolumeManager::handleSwitchEvent(NetlinkEvent *evt) { > void VolumeManager::handleUsbCompositeEvent(NetlinkEvent *evt) { > void VolumeManager::handleBlockEvent(NetlinkEvent *evt) { > > ./system/netd/NetlinkHandler.cpp: > #include <sysutils/NetlinkEvent.h> > void NetlinkHandler::onEvent(NetlinkEvent *evt) { > > Perhaps these can be your examples? > > On Sat, Jun 18, 2011 at 1:27 AM, Pavan Savoy <pavan.sa...@gmail.com>wrote: > >> On Fri, Jun 17, 2011 at 9:13 AM, fan zhang <fzhang...@gmail.com> wrote: >> > We developed an Android service and a kernel module. Android service >> > and the Kernel module need to exchange data with each other. >> > >> > >> > Following are the requirements for the IPC between user space and >> > Kernel. >> > >> > 1. The communication should be secure. No authorized apps could not >> > talk to that Kernel module. >> > >> > 2. IPC should have minimal impact to the Kernel operation (scheduling >> > etc) >> > >> > 3. The communication should be duplex. >> > >> > Please give me some suggestions to setup that IPC. >> >> I've always liked netlink, However the genetlink library is kind of >> missing from Android. >> But it does suffice to all your requirements. >> >> >> > Thanks >> > >> > Fan >> > >> > -- >> > unsubscribe: android-kernel+unsubscr...@googlegroups.com >> > website: http://groups.google.com/group/android-kernel >> >> >> >> -- >> --Pavan Savoy >> >> -- >> unsubscribe: android-kernel+unsubscr...@googlegroups.com >> website: http://groups.google.com/group/android-kernel >> > > > > -- > Regards, > Peter Teoh > -- Regards, Peter Teoh -- unsubscribe: android-kernel+unsubscr...@googlegroups.com website: http://groups.google.com/group/android-kernel