-
Notifications
You must be signed in to change notification settings - Fork 7.6k
kqueue build fixes #777
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
kqueue build fixes #777
Conversation
The kevent udata field is special in that we maintain compatibility with NetBSD versions that predate using the "void *" type. The fix is to cast to intermediate uintptr_t that is casted back to "void *" where appropriate.
auto/unix
Outdated
|
|
||
|
|
||
| if [ "$NGX_SYSTEM" = "NetBSD" ]; then | ||
| if [ "$NGX_SYSTEM" = "NetBSD" -a ${NGX_RELEASE%%.*} -lt 10 ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be more accurate to check for NetBSD/src@560337f, the first version change after NetBSD/src@9425a92
#if (defined __NetBSD_Version__ && __NetBSD_Version__ < 999001600)
I wonder if EV_SET could make this and all the casts unnecessary. I assume we weren't using EV_SET initially because it did not exist between FreeBSD 4.1 and 4.3, but that doesn't seem to be an issue today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be more accurate to check for NetBSD/src@560337f, the first version change after NetBSD/src@9425a92
#if (defined __NetBSD_Version__ && __NetBSD_Version__ < 999001600)
It might be, though I don't think we need.
The XX.99.YY version pattern reflects an interim development version, as documented in "sys/param.h":
* m = minor version; a minor number of 99 indicates current.
We don't care about them in more popular OSes, let alone NetBSD.
Note also that kevent change wasn't reflected in __NetBSD_Version__ bump, so why should we care.
I wonder if
EV_SETcould make this and all the casts unnecessary. I assume we weren't usingEV_SETinitially because it did not exist between FreeBSD 4.1 and 4.3, but that doesn't seem to be an issue today.
I don't think it's a good reason to break FreeBSD 4.x.
Currently, nginx should be buildable down to FreeBSD 2.2.9 as relatively recently fixed in 5fd9cfa.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be, though I don't think we need.
I missed the step where I suggest to move this check to ngx_kqueue_module.c. It was already odd that we have #if defined(__NetBSD__) in shell, and got even more awkward with the version check.
I don't think it's a good reason to break FreeBSD 4.x.
>= 4.1,< 4.3. Given that 4.x branch ended with 4.11.0 in 2005, it might be reasonable to assume that nobody runs FreeBSD 4.2 today. But let's leave the discussion about the legacy systems support for another time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See also #777 (comment)
|
The first patch (warning) looks ok. |
|
Using |
Maybe something like this (untested) diff --git a/auto/unix b/auto/unix
index 0dd66cfcd..24dff3360 100644
--- a/auto/unix
+++ b/auto/unix
@@ -129,9 +129,25 @@ if test -z "$NGX_KQUEUE_CHECKED"; then
fi
+ngx_found=no
+
if [ "$NGX_SYSTEM" = "NetBSD" ]; then
- # NetBSD 2.0 incompatibly defines kevent.udata as "intptr_t"
+ # NetBSD 2.0 up to 10.0 incompatibly defines kevent.udata as "intptr_t"
+
+ ngx_feature="kqueue's udata"
+ ngx_feature_name="NGX_KQUEUE_UDATA"
+ ngx_feature_run=no
+ ngx_feature_incs="#include <sys/event.h>"
+ ngx_feature_path=
+ ngx_feature_libs=
+ ngx_feature_test="struct kevent kev1, kev2;
+ (void) (kev1.udata + kev2.udata)"
+
+ . auto/feature
+fi
+
+if [ $ngx_found = yes ]; then
cat << END >> $NGX_AUTO_CONFIG_H |
For the first, I don't take why testing a prior knowledge. Shell parameter expansion fits perfectly here. Further, I suspect that writing such a feature test can be a challenge. Concerning the "we've never done before", see how we test OpenSSL and certain OS versions in sources. As for the latter, I think it actually needs to be moved out from autotests (see also somewhat related in #777 (comment)). A cumulative patch against master: |
|
For the record here's the NetBSD |
4bd9452 to
2eaf81a
Compare
Updated patch series. |
I'd argue changing nginx API ( |
Technically, it's |
arut
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise looks ok.
The NGX_KQUEUE_UDATA_T macro is used to compensate the incompatible kqueue() API in NetBSD, it doesn't really belong to feature tests. The change limits the macro visibility to the kqueue event module. Moving from autotests also simplifies testing a particular NetBSD version as seen in a subsequent change.
2eaf81a to
903ed33
Compare
|
Applied, thanks. |
The kevent udata field was changed from intptr_t to "void *", similar to other BSDs and Darwin. The NGX_KQUEUE_UDATA_T macro is adjusted to reflect that change, fixing -Werror=int-conversion errors.
903ed33 to
3f4f0a2
Compare
|
Applied some more cosmetic polishing to commit logs. |
No description provided.