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

* Re: [Xenomai-help] select(2) generates EFAULT
  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-21  8:35   ` Steve
  0 siblings, 2 replies; 11+ messages in thread
From: Gilles Chanteperdrix @ 2009-05-18 14:03 UTC (permalink / raw)
  To: Steve; +Cc: xenomai

Steve wrote:
> 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.

Could you try 2.4.7, to see if you are not having a bug which has
already been fixed?

What you are trying should work, even though you are not really using
Xenomai's select but Linux plain select.

-- 
                                                 Gilles.


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

* Re: [Xenomai-help] select(2) generates EFAULT
  2009-05-18 14:03 ` Gilles Chanteperdrix
@ 2009-05-18 14:15   ` Jan Kiszka
  2009-05-18 14:20     ` Gilles Chanteperdrix
  2009-05-21  8:35   ` Steve
  1 sibling, 1 reply; 11+ messages in thread
From: Jan Kiszka @ 2009-05-18 14:15 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai

Gilles Chanteperdrix wrote:
> Steve wrote:
>> 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.
> 
> Could you try 2.4.7, to see if you are not having a bug which has
> already been fixed?
> 
> What you are trying should work, even though you are not really using
> Xenomai's select but Linux plain select.

This should have been fixed in 2.4.x.git - if my patch were applied. See
git://git.xenomai.org/xenomai-jki.git for-2.4.x

Did I missed to post some correction of that version, or what delays
this? Sorry, lost track of it.

Jan

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux


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

* Re: [Xenomai-help] select(2) generates EFAULT
  2009-05-18 14:15   ` Jan Kiszka
@ 2009-05-18 14:20     ` Gilles Chanteperdrix
  2009-05-18 14:35       ` Jan Kiszka
  0 siblings, 1 reply; 11+ messages in thread
From: Gilles Chanteperdrix @ 2009-05-18 14:20 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai

Jan Kiszka wrote:
> Gilles Chanteperdrix wrote:
>> Steve wrote:
>>> 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.
>> Could you try 2.4.7, to see if you are not having a bug which has
>> already been fixed?
>>
>> What you are trying should work, even though you are not really using
>> Xenomai's select but Linux plain select.
> 
> This should have been fixed in 2.4.x.git - if my patch were applied. See
> git://git.xenomai.org/xenomai-jki.git for-2.4.x
> 
> Did I missed to post some correction of that version, or what delays
> this? Sorry, lost track of it.

Sorry, I do not see what patch you are refering to. Is it:
http://git.xenomai.org/?p=xenomai-jki.git;a=commitdiff;h=86333965a4362f8439822ec9d22b0a84b5701141;hp=a219c4a71b381f4662df45bac5508c3ae64ab924

In this commit, I only see things which should return more -EFAULT. Or
did I miss something?

-- 
                                                 Gilles.


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

* Re: [Xenomai-help] select(2) generates EFAULT
  2009-05-18 14:20     ` Gilles Chanteperdrix
@ 2009-05-18 14:35       ` Jan Kiszka
  2009-05-18 15:08         ` Steve
  0 siblings, 1 reply; 11+ messages in thread
From: Jan Kiszka @ 2009-05-18 14:35 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai

Gilles Chanteperdrix wrote:
> Jan Kiszka wrote:
>> Gilles Chanteperdrix wrote:
>>> Steve wrote:
>>>> 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.
>>> Could you try 2.4.7, to see if you are not having a bug which has
>>> already been fixed?
>>>
>>> What you are trying should work, even though you are not really using
>>> Xenomai's select but Linux plain select.
>> This should have been fixed in 2.4.x.git - if my patch were applied. See
>> git://git.xenomai.org/xenomai-jki.git for-2.4.x
>>
>> Did I missed to post some correction of that version, or what delays
>> this? Sorry, lost track of it.
> 
> Sorry, I do not see what patch you are refering to. Is it:
> http://git.xenomai.org/?p=xenomai-jki.git;a=commitdiff;h=86333965a4362f8439822ec9d22b0a84b5701141;hp=a219c4a71b381f4662df45bac5508c3ae64ab924
> 
> In this commit, I only see things which should return more -EFAULT. Or
> did I miss something?

I mean
http://git.xenomai.org/?p=xenomai-jki.git;a=commitdiff;h=8542b9dc56b9edd16dab69e930699bcee17fa6ac

That should be...
http://permalink.gmane.org/gmane.linux.real-time.xenomai.devel/6237

Jan

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux


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

* Re: [Xenomai-help] select(2) generates EFAULT
  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
  0 siblings, 2 replies; 11+ messages in thread
From: Steve @ 2009-05-18 15:08 UTC (permalink / raw)
  To: xenomai

On 18/05/2009, Jan Kiszka <jan.kiszka@domain.hid> wrote:
> Gilles Chanteperdrix wrote:
>> Jan Kiszka wrote:
>>> Gilles Chanteperdrix wrote:
>>>> Steve wrote:
>>>>> 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.
>>>> Could you try 2.4.7, to see if you are not having a bug which has
>>>> already been fixed?
>>>>
>>>> What you are trying should work, even though you are not really using
>>>> Xenomai's select but Linux plain select.
>>> This should have been fixed in 2.4.x.git - if my patch were applied. See
>>> git://git.xenomai.org/xenomai-jki.git for-2.4.x
>>>
>>> Did I missed to post some correction of that version, or what delays
>>> this? Sorry, lost track of it.
>>
>> Sorry, I do not see what patch you are refering to. Is it:
>> http://git.xenomai.org/?p=xenomai-jki.git;a=commitdiff;h=86333965a4362f8439822ec9d22b0a84b5701141;hp=a219c4a71b381f4662df45bac5508c3ae64ab924
>>
>> In this commit, I only see things which should return more -EFAULT. Or
>> did I miss something?
>
> I mean
> http://git.xenomai.org/?p=xenomai-jki.git;a=commitdiff;h=8542b9dc56b9edd16dab69e930699bcee17fa6ac
>
> That should be...
> http://permalink.gmane.org/gmane.linux.real-time.xenomai.devel/6237
>
> Jan
>
> --
> Siemens AG, Corporate Technology, CT SE 2
> Corporate Competence Center Embedded Linux
>

I am in the process of re-compiling the kernel with the 2.4.7, and I
have just checked the fault number of my example; it is definitely
giving +14, not -14 (so EFAULT, not -EFAULT).  Might this be an issue
with my kernel config options rather than anthing else?

Steve


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

* Re: [Xenomai-help] select(2) generates EFAULT
  2009-05-18 15:08         ` Steve
@ 2009-05-18 15:17           ` Steve
  2009-05-18 15:27           ` Gilles Chanteperdrix
  1 sibling, 0 replies; 11+ messages in thread
From: Steve @ 2009-05-18 15:17 UTC (permalink / raw)
  To: xenomai

Also, because my company restricts access to all external ports except
http / https, I can't use git.  I have had to download the xenomai
releases from 'http://download.gna.org/xenomai/stable/'.  Does this
make a difference?

On 18/05/2009, Steve <sbxenomai@domain.hid> wrote:
> On 18/05/2009, Jan Kiszka <jan.kiszka@domain.hid> wrote:
>> Gilles Chanteperdrix wrote:
>>> Jan Kiszka wrote:
>>>> Gilles Chanteperdrix wrote:
>>>>> Steve wrote:
>>>>>> 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.
>>>>> Could you try 2.4.7, to see if you are not having a bug which has
>>>>> already been fixed?
>>>>>
>>>>> What you are trying should work, even though you are not really using
>>>>> Xenomai's select but Linux plain select.
>>>> This should have been fixed in 2.4.x.git - if my patch were applied.
>>>> See
>>>> git://git.xenomai.org/xenomai-jki.git for-2.4.x
>>>>
>>>> Did I missed to post some correction of that version, or what delays
>>>> this? Sorry, lost track of it.
>>>
>>> Sorry, I do not see what patch you are refering to. Is it:
>>> http://git.xenomai.org/?p=xenomai-jki.git;a=commitdiff;h=86333965a4362f8439822ec9d22b0a84b5701141;hp=a219c4a71b381f4662df45bac5508c3ae64ab924
>>>
>>> In this commit, I only see things which should return more -EFAULT. Or
>>> did I miss something?
>>
>> I mean
>> http://git.xenomai.org/?p=xenomai-jki.git;a=commitdiff;h=8542b9dc56b9edd16dab69e930699bcee17fa6ac
>>
>> That should be...
>> http://permalink.gmane.org/gmane.linux.real-time.xenomai.devel/6237
>>
>> Jan
>>
>> --
>> Siemens AG, Corporate Technology, CT SE 2
>> Corporate Competence Center Embedded Linux
>>
>
> I am in the process of re-compiling the kernel with the 2.4.7, and I
> have just checked the fault number of my example; it is definitely
> giving +14, not -14 (so EFAULT, not -EFAULT).  Might this be an issue
> with my kernel config options rather than anthing else?
>
> Steve
>


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

* Re: [Xenomai-help] select(2) generates EFAULT
  2009-05-18 15:08         ` Steve
  2009-05-18 15:17           ` Steve
@ 2009-05-18 15:27           ` Gilles Chanteperdrix
  1 sibling, 0 replies; 11+ messages in thread
From: Gilles Chanteperdrix @ 2009-05-18 15:27 UTC (permalink / raw)
  To: Steve; +Cc: xenomai

Steve wrote:
> On 18/05/2009, Jan Kiszka <jan.kiszka@domain.hid> wrote:
>> Gilles Chanteperdrix wrote:
>>> Jan Kiszka wrote:
>>>> Gilles Chanteperdrix wrote:
>>>>> Steve wrote:
>>>>>> 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.
>>>>> Could you try 2.4.7, to see if you are not having a bug which has
>>>>> already been fixed?
>>>>>
>>>>> What you are trying should work, even though you are not really using
>>>>> Xenomai's select but Linux plain select.
>>>> This should have been fixed in 2.4.x.git - if my patch were applied. See
>>>> git://git.xenomai.org/xenomai-jki.git for-2.4.x
>>>>
>>>> Did I missed to post some correction of that version, or what delays
>>>> this? Sorry, lost track of it.
>>> Sorry, I do not see what patch you are refering to. Is it:
>>> http://git.xenomai.org/?p=xenomai-jki.git;a=commitdiff;h=86333965a4362f8439822ec9d22b0a84b5701141;hp=a219c4a71b381f4662df45bac5508c3ae64ab924
>>>
>>> In this commit, I only see things which should return more -EFAULT. Or
>>> did I miss something?
>> I mean
>> http://git.xenomai.org/?p=xenomai-jki.git;a=commitdiff;h=8542b9dc56b9edd16dab69e930699bcee17fa6ac
>>
>> That should be...
>> http://permalink.gmane.org/gmane.linux.real-time.xenomai.devel/6237
>>
>> Jan
>>
>> --
>> Siemens AG, Corporate Technology, CT SE 2
>> Corporate Competence Center Embedded Linux
>>
> 
> I am in the process of re-compiling the kernel with the 2.4.7, and I
> have just checked the fault number of my example; it is definitely
> giving +14, not -14 (so EFAULT, not -EFAULT).  Might this be an issue
> with my kernel config options rather than anthing else?

No, that is the unix standard behaviour, select should return -1 and the
14 be set in errno.
Newer calls belonging to the pthread_*, clock_* families return their
errors directly as positive codes too, and not through errno.

-- 
                                                 Gilles.


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

* Re: [Xenomai-help] select(2) generates EFAULT
  2009-05-18 14:03 ` Gilles Chanteperdrix
  2009-05-18 14:15   ` Jan Kiszka
@ 2009-05-21  8:35   ` Steve
  2009-05-21  8:46     ` Jan Kiszka
  1 sibling, 1 reply; 11+ messages in thread
From: Steve @ 2009-05-21  8:35 UTC (permalink / raw)
  To: xenomai

On 18/05/2009, Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org> wrote:
> Steve wrote:
>> 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:
>>
<snip>
>>
>> I am using Xenomai 2.4.6.1 on a vanilla 2.6.24.6 Linux kernel, and
>> running on Ubuntu 8.04.
>
> Could you try 2.4.7, to see if you are not having a bug which has
> already been fixed?
>
> What you are trying should work, even though you are not really using
> Xenomai's select but Linux plain select.
>
> --
>                                                  Gilles.
>

I have just tested my example code with Xenomai version 2.4.7 but I am
still encountering the problem.


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

* Re: [Xenomai-help] select(2) generates EFAULT
  2009-05-21  8:35   ` Steve
@ 2009-05-21  8:46     ` Jan Kiszka
  2009-05-27 15:12       ` Steve
  0 siblings, 1 reply; 11+ messages in thread
From: Jan Kiszka @ 2009-05-21  8:46 UTC (permalink / raw)
  To: Steve; +Cc: xenomai

[-- Attachment #1: Type: text/plain, Size: 1276 bytes --]

Steve wrote:
> On 18/05/2009, Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org> wrote:
>> Steve wrote:
>>> 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:
>>>
> <snip>
>>> I am using Xenomai 2.4.6.1 on a vanilla 2.6.24.6 Linux kernel, and
>>> running on Ubuntu 8.04.
>> Could you try 2.4.7, to see if you are not having a bug which has
>> already been fixed?
>>
>> What you are trying should work, even though you are not really using
>> Xenomai's select but Linux plain select.
>>
>> --
>>                                                  Gilles.
>>
> 
> I have just tested my example code with Xenomai version 2.4.7 but I am
> still encountering the problem.

You need to pull the latest 2.4.x git version [1].

Jan

[1] http://git.xenomai.org/?p=xenomai-2.4.git;a=summary


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]

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

* Re: [Xenomai-help] select(2) generates EFAULT
  2009-05-21  8:46     ` Jan Kiszka
@ 2009-05-27 15:12       ` Steve
  0 siblings, 0 replies; 11+ messages in thread
From: Steve @ 2009-05-27 15:12 UTC (permalink / raw)
  To: xenomai

On 21/05/2009, Jan Kiszka <jan.kiszka@domain.hid> wrote:
> Steve wrote:
>> On 18/05/2009, Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
>> wrote:
>>> Steve wrote:
>>>> 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:
>>>>
>> <snip>
>>>> I am using Xenomai 2.4.6.1 on a vanilla 2.6.24.6 Linux kernel, and
>>>> running on Ubuntu 8.04.
>>> Could you try 2.4.7, to see if you are not having a bug which has
>>> already been fixed?
>>>
>>> What you are trying should work, even though you are not really using
>>> Xenomai's select but Linux plain select.
>>>
>>> --
>>>                                                  Gilles.
>>>
>>
>> I have just tested my example code with Xenomai version 2.4.7 but I am
>> still encountering the problem.
>
> You need to pull the latest 2.4.x git version [1].
>
> Jan
>
> [1] http://git.xenomai.org/?p=xenomai-2.4.git;a=summary
>
>

Sorry, just realised I sent this directly to Jan and no-one else:

I have grabbed the latest version of 2.4.x (19th May 2009) and the
select problem has been solved.  Thank you all for your suggestions,
and I will make sure to grab the latest git version in future (I
hadn't realised that 'snapshot' refered to the entire release instead of
a small part (or snapshot) of it, allowing for http download from that
page, sorry).

Thank you again,

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.