[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] [lwip] Why value of O_NONBLOCK/O_RDONLY/O_WRONLY/O_RDWR
From: |
address@hidden |
Subject: |
Re: [lwip-users] [lwip] Why value of O_NONBLOCK/O_RDONLY/O_WRONLY/O_RDWR in src/include/lwip/sockets.h are not equal to the posix? |
Date: |
Fri, 5 Mar 2021 06:43:30 +0100 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 |
Am 05.03.2021 um 06:18 schrieb Ajay Bhargav via lwip-users:
> If you’re using a posix style system of any system which already define
> O_RDONLY/WRONLY/RDWR then you can include that file in your arch.h or
> cc.h probably
>
>
>
> The sockets.h definition is only for the system which does not define
> anything. So it does not matter what the values are.
While it probably should be like that, the values cited below do not
work: the lwIP code currently relies on "O_RDWR == (O_RDONLY|O_WRONLY)"
and on none of them being zero...
Regards,
Simon
>
>
>
> Regards,
>
> Ajay Bhargav
>
>
>
>
>
> *From: *唐尧 <mailto:tangyao@cmiot.chinamobile.com>
> *Sent: *Friday, March 5, 2021 9:35 AM
> *To: *lwip-users <mailto:lwip-users@nongnu.org>
> *Cc: *jlledom <mailto:jlledom@member.fsf.org>
> *Subject: *[lwip-users] [lwip] Why value of
> O_NONBLOCK/O_RDONLY/O_WRONLY/O_RDWR in src/include/lwip/sockets.h are
> not equal to the posix?
>
>
>
> *In posix fcntl.h , the definations is:*
>
>
>
> #define O_RDONLY 00000000
>
> #define O_WRONLY 00000001
>
> #define O_RDWR 00000002
>
>
>
> *but in src/include/lwip/sockets.h , the value is:*
>
>
>
> #ifndef O_NONBLOCK
>
> #define O_NONBLOCK 1 /* nonblocking I/O */
>
> #endif
>
> #ifndef O_NDELAY
>
> #define O_NDELAY O_NONBLOCK /* same as O_NONBLOCK, for compatibility */
>
> #endif
>
> #ifndef O_RDONLY
>
> #define O_RDONLY 2
>
> #endif
>
> #ifndef O_WRONLY
>
> #define O_WRONLY 4
>
> #endif
>
> #ifndef O_RDWR
>
> #define O_RDWR (O_RDONLY|O_WRONLY)
>
> #endif
>
>
>
> *any reason of the difference?*
>
>
>
>
>
> BRs//tangyao
>
>
>
>
> _______________________________________________
> lwip-users mailing list
> lwip-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>