All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfgang Grandegger <wg@domain.hid>
To: xenomai-help <xenomai@xenomai.org>
Cc: Haukur Hafsteinsson <haukur@domain.hid>,
	socketcan-users@domain.hid, Jan Kiszka <jan.kiszka@domain.hid>,
	Daniel Schnell <danielsch@domain.hid>
Subject: [Xenomai-help] Re: [Socketcan-users] Select on a RTCAN socket
Date: Wed, 23 Aug 2006 20:19:56 +0200	[thread overview]
Message-ID: <44EC9C4C.1040806@domain.hid> (raw)
In-Reply-To: <44EC976E.4000601@domain.hid>

Wolfgang Grandegger wrote:
> Jan Kiszka wrote:
>> Hi all,
>>
>> Wolfgang Grandegger wrote:
>>> Hi Daniel,
>>>
>>> Daniel Schnell wrote:
>>>> Hi,
>>>>
>>>>  
>>>>
>>>> I wanted to use select() on a socket to find out how many messages are 
>>>> available. I have opened this socket to access the RTCAN sockets under 
>>>> Xenomai. According to /usr/xenomai/lib/posix.wrappers select is not 
>>>> "supported" by the realtime kernel. Accordingly it doesn't work. If i 
>>>> start the according task under SCHED_FIFO, the task simply hangs when 
>>>> initiating select(), in SCHED_OTHER it is simply returning: bad file 
>>>> descriptor.
>>> select is not supported and cannot be used, indeed.
>> And select is tricky to provide under hard-RT constraints.
>>
>>>> Any ideas ? Is there any other way to find out, how many messages are 
>>>> waiting ?
>>> Select returns the sockets which have data but it does not tell you how 
>>> many messages are waiting. You could use separate threads to read from 
>>> sockets.
>>>
>>> BTW: this mail is off-topic on the socketcan MLs.
>> Mmh, do you mean it the other way around?
> 
> Well, I think this is a RTDM/Xenomai related questions and sending it to 
> xenomai-help is OK. CAN related questions should go to the 
> socketcan-users maling-list. Am I wrong?
> 
>> Anyway, is there a mechanism of the standard socket API the obtain the
>> current incoming queue length? Don't think so actually, but it wouldn't
>> be the first time I'm blind.
> 
> Not that I know of. For normal file I/O I remember vague some ioctl() or 
> fnctl(). Does POSIX define a function for this purpose?

Got it! In Linux it can be done with ioctl FIONREAD, which returns the 
number of bytes that are immediately available to be read on a file 
descriptor. It could be implemented, if useful.

Wolfgang.


      reply	other threads:[~2006-08-23 18:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <DD39B5C3F4963040ADC9768BE7E430CB01081D6B@is-hdq-exchange.marel.net>
2006-08-23 17:07 ` [Xenomai-help] Re: [Socketcan-users] Select on a RTCAN socket Wolfgang Grandegger
2006-08-23 17:21   ` Jan Kiszka
2006-08-23 17:59     ` Wolfgang Grandegger
2006-08-23 18:19       ` Wolfgang Grandegger [this message]

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=44EC9C4C.1040806@domain.hid \
    --to=wg@domain.hid \
    --cc=danielsch@domain.hid \
    --cc=haukur@domain.hid \
    --cc=jan.kiszka@domain.hid \
    --cc=socketcan-users@domain.hid \
    --cc=xenomai@xenomai.org \
    /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 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.