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

Fix for the fact that windows file descriptors do not follow posix numbering standard #20

Closed
wants to merge 7 commits into from

Conversation

johnjuuljensen
Copy link
Contributor

Resubmitting as requested.

Hey

So I tried to build and run under windows, but calling kept failing in fd_listen due to out of bounds check on the file descriptor.
I was pointed to this change: 49834b7
But thought it was somewhat invasive.

I ended up making this change instead. It's pretty simple and consists mostly of renaming of variables to clearly distinguish between what is an index into fhs and what is an actual descriptor handle.

The only new thing is the windows-only lookup_fd_index which maps file descriptors to indices.

Baresip compiles and runs and makes calls, when build with this version on windows SDK 10.

I have not tested anything under linux, not even compilation.

If you're interested, I can make any recommended changes and test it under linux.

Cheers,
John

@sreimers
Copy link
Member

Can you fix the following code style errors:

The command "wget "https://raw.githubusercontent.com/baresip/baresip/master/test/ccheck.py"" exited with 0.
0.54s$ python3 ccheck.py
./src/main/main.c:227: C++ comment, use C comments /* ... */ instead
./src/main/main.c:227: line is too wide (83 - max 79)
./src/main/main.c:228: C++ comment, use C comments /* ... */ instead
./src/main/main.c:228: line is too wide (86 - max 79)
./src/main/main.c:237: C++ comment, use C comments /* ... */ instead
./src/main/main.c:596: C++ comment, use C comments /* ... */ instead
./src/main/main.c:598: C++ comment, use C comments /* ... */ instead
Statistics:
~~~~~~~~~~~
Number of files processed:     c: 202  cpp: 0  h: 69  mk: 49  m4: 0  py: 1  m: 0  s: 0  java: 0  php: 0 
Number of lines with errors:   7

@sreimers sreimers changed the title Fix for the fact that windows file descriptors do not follow possix numbering standard Fix for the fact that windows file descriptors do not follow posix numbering standard Sep 14, 2020
src/main/main.c Outdated
@@ -221,6 +223,26 @@ static struct re *re_get(void)

#endif

#ifdef WIN32
// This code emulates possix numbering. There is no locking, so zero thread-safety.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wording s/possix/POSIX/

@sreimers
Copy link
Member

Can you check again with "EPOLL", the patch runs in timeouts.

@johnjuuljensen
Copy link
Contributor Author

johnjuuljensen commented Sep 20, 2020 via email

@sreimers
Copy link
Member

Hi, I have fixed EPOLL and SELECT (0 is a valid file descriptor). I close this pull request, can you check/test the new one?

#25

@sreimers sreimers closed this Sep 29, 2020
sreimers pushed a commit that referenced this pull request Sep 29, 2020
sreimers added a commit that referenced this pull request Oct 3, 2020
main: fix windows file descriptors #20

Co-authored-by: jjj <john.juul.jensen@hotmail.com>
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

Successfully merging this pull request may close these issues.

2 participants