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

Does not build on FreeBSD 9 #17

Closed
rbgarga opened this issue Dec 29, 2015 · 5 comments
Closed

Does not build on FreeBSD 9 #17

rbgarga opened this issue Dec 29, 2015 · 5 comments

Comments

@rbgarga
Copy link
Contributor

rbgarga commented Dec 29, 2015

SOCK_CLOEXEC was added in FreeBSD 10.0 [1], it's better if fcntl() is used instead

[1] https://wiki.freebsd.org/AtomicCloseOnExec

Warning: Object directory not changed from original /wrkdirs/usr/ports/net/dpinger/work/dpinger-1.1
cc -O2 -pipe -fno-strict-aliasing -std=gnu99 -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -c dpinger.c
dpinger.c: In function 'main':
dpinger.c:1120: error: 'SOCK_CLOEXEC' undeclared (first use in this function)
dpinger.c:1120: error: (Each undeclared identifier is reported only once
dpinger.c:1120: error: for each function it appears in.)
*** [dpinger.o] Error code 1

Stop in /wrkdirs/usr/ports/net/dpinger/work/dpinger-1.1.
*** [do-build] Error code 1

Stop in /usr/ports/net/dpinger.

@rbgarga
Copy link
Contributor Author

rbgarga commented Dec 29, 2015

@dennypage
Copy link
Owner

Okay, thanks Renato.

Btw, I assume the ports tree doesn't allow conditional patches based on target version?

I added a temporary fix.

@rbgarga
Copy link
Contributor Author

rbgarga commented Dec 29, 2015

Didn't you like the fcntl() fix?

@dennypage
Copy link
Owner

No, your fcntl() change was just fine. I was looking at all the descriptors for close on exec and ran into other problems. The remaining issue is the file descriptor from accept(). Since accept/fcntl isn't atomic, this fd is left exposed. I would like to use accept4(), but this has some issues on some Linux systems (you have to define __USE_GNU which I don't want to do), and isn't present in older FreeBSD systems. Given that I can't fix it completely on any system, I'm going to change it back to fcntl() in all locations and revisit it in a year.

After many years of coding for maximum portability and legacy systems, I've become tired of it. I have grown to absolutely hate ifdefs. :)

@dennypage
Copy link
Owner

I've pushed an update that covers all the FDs as best as can be done with fcntl(). Please let me know if you run into any other problems. Many thanks.

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

2 participants