Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POSIX compatibility #5

Open
Pesa opened this issue May 8, 2019 · 6 comments
Open

POSIX compatibility #5

Pesa opened this issue May 8, 2019 · 6 comments

Comments

@Pesa
Copy link

Pesa commented May 8, 2019

This package is targeted at "POSIX compatible OS". However, looking at the code, I noticed several incompatibilities with POSIX. These are a couple of examples I saw so far, but I only took a quick look and there may be others:

size = recvfrom(ptr->sock, ptr->buf, sizeof(ptr->buf), MSG_DONTWAIT,
(struct sockaddr*)&client_addr, &addr_len);

MSG_DONTWAIT is not specified by POSIX.

}else if(size == -1 && errno == EWOULDBLOCK){

POSIX.1-2001 allows either EAGAIN or EWOULDBLOCK to be returned for this case, and does not guarantee that these constants have the same value, so a portable application should check for both.

if(ioctl(ptr->sock, FIONBIO, (char *)&iyes) == -1){

FIONBIO is non-standard. You should use fcntl(...O_NONBLOCK...) instead.

@zjkmxy
Copy link
Collaborator

zjkmxy commented May 9, 2019

Fixed. Thank you for your comments!

@Pesa
Copy link
Author

Pesa commented May 9, 2019

Well... there are several more instances of these or similar problems still present in the codebase... how do you plan to address them? The 3 cases I reported above were just a few examples I noticed from a quick look.

@zjkmxy
Copy link
Collaborator

zjkmxy commented May 10, 2019

We are planning to review our design recently. I will figure it out then.

@Pesa
Copy link
Author

Pesa commented Feb 24, 2020

Any updates?

@zjkmxy
Copy link
Collaborator

zjkmxy commented Feb 24, 2020

No. Till now we haven't figured out what else is not compatible to POSIX.

@yoursunny
Copy link
Contributor

Is there a linter that automatically find non POSIX complaint function calls?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants