I got the kernel mode module to compile by including /usr/src/linux/include/linux/in.h and /usr/src/linux/include/linux/net.h
It is a modified version of the RTnet 0.8.3 "raw-packets.c" example. The module periodically transmits, and continuously receives LAN packets. The modified version uses (sin_family=AF_INET), where the old one used (sll_family=PF_PACKET). I also added a socket - one is used for Rx, while the other is used for Tx. When I load the module, both rt_dev_recv() and rt_dev_sendmsg() return error code -38. My question is basically - what is this error code? I am not too sure where to look. --======-- I have attached the source code. The output when loading the module is: --- Begin output --- Tx local port: 1 Tx server IP: 10.0.0.2 Tx server port: 2 Tx rt_dev_socket() result: 0 Tx rt_dev_bind() result: 0 Tx rt_dev_connect() result: 0 Rx local port: 2 Rx rt_dev_socket() result: 1 Rx rt_dev_bind() result: 0 rt_dev_recv() = -38 Sending message of 40 bytes rt_dev_sendmsg() = -38! Sending message of 40 bytes rt_dev_sendmsg() = -38! Sending message of 40 bytes rt_dev_sendmsg() = -38! --- End output --- Both nodes' output are the same (excluding the IP adresses, of course). Thanks Thinus -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 29 July 2006 11:30 To: Thinus Viljoen Cc: rtnet-users@lists.sourceforge.net Subject: Re: [RTnet-users] RTnet in RTAI kernel space Thinus Viljoen wrote: > Hi > > I am trying to get RTnet running under RTAI kernel space, basically as > described in > > http://www.mail-archive.com/rtnet-users@lists.sourceforge.net/msg01127.html > > I am using RTnet 0.9.2, RTAI 3.3 Vulcano, kernel 2.6.15.1. > > The basic RTAI and RTnet installations seems fine: the RTAI test > programs work, rtping works, I can compile and execute the RTnet (user > space) example shipped with the code, etc. > > I run into problems trying to compile a basic kernel-space RTnet > application, however. It seems that the "sockaddr_in" structure is > declared in > /usr/include/netinet/in.h > while > /usr/src/linux/include/linux/module.h > and > /usr/src/linux/include/linux/kernel.h > is required to compile a kernel module (please correct me if I am > wrong). > > I added /usr/include as an include path, in order to include NEVER include user-space headers in kernel space (typically, vice versa is true as well). Look out for the related kernel header instead, e.g. lxr.free-electrons.com can help in those cases (http://lxr.free-electrons.com/ident?i=sockaddr_in) > netinet/in.h. When I include all three of these files I get a number of > errors. The first one is: > > /usr/include/stdint.h:37: error: redefinition of typedef ‘int8_t’ > include/linux/types.h:108: error: previous declaration of ‘int8_t’ was > here > > Can anyone help me? > > (As an aside: why isn't there a RTAI kernel mode example included with > 0.9.x ? It would have saved me a lot of sweat, tears and swearwords) I do understand. Let me explain: We used to have almost only kernel-space examples in older versions (LXRT was not usable that days). Those got outdated and I also wanted to push more useful user-space examples in, specifically to direct more commercial users on a sane path. You may know, there exist quite strong opinions about non-GPL kernel space modules: "Closed source Linux kernel modules are illegal" (Greg Kroah-Hartman, kernel developer). We now have a few Xenomai module examples again. But regarding RTAI you have to note that it is only "passively" supported since development and testing of RTnet completely switched to Xenomai last year. I typically run a simple compile test before release, but RTAI-specific contributions like examples depend on the RTAI users. So, if you want to share your code with others, you are welcome! Given your code is in reasonable shape, I will definitely merge it. Jan ******************************************************************************************************* Disclaimer: The information contained in this communication is confidential and may be legally privileged. It is intended solely for the use of the individual or entity to whom it is addressed and others authorised to receive it. Any review, retransmission, dissemination, copying, disclosure or other use of, or taking of any action in reliance upon, this information by person or entities other then the intended recipient is prohibited. If you have received this message in error, please notify the sender immediately by e-mail, facsimile or telephone and return and/or destroy the original message and all copies from any computer. Denel (Pty) Ltd exercises no editorial control over e-mail messages originating in the organisation and does not accept any responsibility for either the contents of the message or any copyright laws that may have been violated by the person sending this message. Denel (Pty) Ltd is neither liable for the proper and complete transmission of the information contained in this communication nor any delay in its receipt. This message should not be copied or used for any purpose other than intended, nor should it be disclosed to any other person. *******************************************************************************************************
raw-packets.c
Description: raw-packets.c
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ RTnet-users mailing list RTnet-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rtnet-users