Intended semantics for syscalls function _read?

s.achterop@rug.nl s.achterop@rug.nl
Mon Nov 21 13:16:00 GMT 2016


   Hello list,

The documentation of this function does not describe how this function is to behave.
Is it blocking, or can it also be non-blocking.
What is the meaning of the return value? Or is it intentionally left ambiguous?
My guess would be:
   >=0  number of characters actually read
         zero meaning: zero characters read.
   < 0  error code (including eof?)

I want to use this function to read from serial/usb ports, using (man 2) read and scanf.
But also to test for the availability of a character on a port: a character_ready function.

Can I use (man 2) read in a non-blocking way? Or is there an other way?
Or should I directly use the _read function to make the character_ready function?

   Thanks in advance,
       Sietse Achterop


PS. I am using newlib as part of the GNU Embedded toolchain for a number of arm systems (stm32f4 based).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3619 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://sourceware.org/pipermail/newlib/attachments/20161121/c64f5aec/attachment.p7s>


More information about the Newlib mailing list