All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] select(2) generates EFAULT
@ 2009-05-18 13:56 Steve
  2009-05-18 14:03 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 11+ messages in thread
From: Steve @ 2009-05-18 13:56 UTC (permalink / raw)
  To: xenomai

First, thank you for the help on my previous query.

I am still working on porting a c++ application from RTAI to Xenomai,
and have encountered a problem with sockets, specifically the select
function.

When Xenomai is not being used the code runs as expected.  Once the
Xenomai headers, compile options, etc, are used the select function
fails with the error EFAULT.  I have reproduced the error (works
without Xenomai, EFAULTs with Xenomai) using the following program:

#include <stdio.h>
#include <arpa/inet.h>
#include <errno.h>

int handleError(char *msg, int err);

int main(void)
{
   int sfd;
   struct sockaddr_in sai;
   fd_set SockSet;
   struct timeval tv;
   tv.tv_sec = 2;
   tv.tv_usec = 0;

   sai.sin_family = AF_INET;
   sai.sin_port = htons(1025);
   sai.sin_addr.s_addr = htonl(INADDR_ANY);

   if((sfd = socket(AF_INET, SOCK_STREAM, 0)) == -1)
   { return handleError("creation error", errno); }

   if(bind(sfd, (struct sockaddr*)&sai, sizeof(sai)) == -1)
   { return handleError("bind error", errno); }

   if(listen(sfd, 5) == -1)
   { return handleError("listen error", errno); }

   FD_ZERO(&SockSet);
   FD_SET(sfd, &SockSet);

   if(select(sfd+1, &SockSet, 0, 0, &tv) == -1)
   { return handleError("select error", errno); }

   printf("success\n");

   return 0;
}

I am using Xenomai 2.4.6.1 on a vanilla 2.6.24.6 Linux kernel, and
running on Ubuntu 8.04.

Once again, any thoughts would be much appreciated.

Steve


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2009-05-27 15:12 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-18 13:56 [Xenomai-help] select(2) generates EFAULT Steve
2009-05-18 14:03 ` Gilles Chanteperdrix
2009-05-18 14:15   ` Jan Kiszka
2009-05-18 14:20     ` Gilles Chanteperdrix
2009-05-18 14:35       ` Jan Kiszka
2009-05-18 15:08         ` Steve
2009-05-18 15:17           ` Steve
2009-05-18 15:27           ` Gilles Chanteperdrix
2009-05-21  8:35   ` Steve
2009-05-21  8:46     ` Jan Kiszka
2009-05-27 15:12       ` Steve

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.