lwip-users
[Top][All Lists]
Advanced

[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: Ajay Bhargav
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 11:38:57 +0530

Even newlib’s fcntl define O_* as follows

 

/*

 * Flag values for open(2) and fcntl(2)

 * The kernel adds 1 to the open modes to turn it into some

 * combination of FREAD and FWRITE.

 */

#define O_RDONLY    0       /* +1 == FREAD */

#define O_WRONLY    1       /* +1 == FWRITE */

#define O_RDWR      2       /* +1 == FREAD|FWRITE */

 

Maybe he is mentioning that?

 

Regards,

Ajay Bhargav

 

From: goldsimon@gmx.de
Sent: Friday, March 5, 2021 11:17 AM
To: Mailing list for lwIP users
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?

 

Am 05.03.2021 um 04:32 schrieb 唐尧:

> *In posix fcntl.h , the definations is:*

 

Which "posix" fcntl.h do you mean? Do you mean Linux instead? Because as

far as I'm aware, posix is a standard for source code compatibility, not

for binary compatibility. And being like that, it defines the named

constants, not their values.

 

If you're looking at compiler errors because some file includes both

Linux and lwIP defines, have a look at LWIP_SOCKET_EXTERNAL_HEADERS. But

at least O_RDWR might not work as it is now...

 

Regards,

Simon

 

> 

> #define O_RDONLY00000000

> #define O_WRONLY00000001

> #define O_RDWR00000002

> 

> *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

> 

 

 

_______________________________________________

lwip-users mailing list

lwip-users@nongnu.org

https://lists.nongnu.org/mailman/listinfo/lwip-users

 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]