summaryrefslogtreecommitdiff
blob: 48568889a661acce23ea524820a71e3362a94ee6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
https://github.com/lighttpd/lighttpd1.4/commit/88ff3763dae65371eab9f8a22ac1c95c96fe4490
https://github.com/lighttpd/lighttpd1.4/commit/524614455554163ec78b27b89ff52bbf7fe96958

From 88ff3763dae65371eab9f8a22ac1c95c96fe4490 Mon Sep 17 00:00:00 2001
From: Glenn Strauss <gstrauss@gluelogic.com>
Date: Tue, 23 Apr 2024 00:16:29 -0400
Subject: [PATCH] Revert "[core] special value for Linux POLLRDHUP on SPARC"
 (fixes #3251)

This reverts commit f14f9142f4487704e2ce0f196263c091accdb12c.

x-ref:
  "[1.4.76] buildroot compile error with bootlin-sparc{64-g,-uc}libc"
  https://redmine.lighttpd.net/issues/3251
---
 src/fdevent.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/fdevent.h b/src/fdevent.h
index e9c380b0f..1b0a062fc 100644
--- a/src/fdevent.h
+++ b/src/fdevent.h
@@ -40,8 +40,6 @@ struct fdnode_st {
 #if (defined(__sun) && defined(__SVR4)) /* Solaris */ \
  || defined(__FreeBSD__)
 #define FDEVENT_RDHUP  0x4000
-#elif (defined(__linux__) && (defined(__sparc__) || defined(__sparc)))
-#define FDEVENT_RDHUP  0x0800
 #else
 #define FDEVENT_RDHUP  0x2000
 #endif

From 524614455554163ec78b27b89ff52bbf7fe96958 Mon Sep 17 00:00:00 2001
From: Glenn Strauss <gstrauss@gluelogic.com>
Date: Wed, 24 Apr 2024 03:07:37 -0400
Subject: [PATCH] [core] special value for Linux POLLRDHUP on SPARC (fixes
 #3251)

x-ref:
  "[1.4.76] buildroot compile error with bootlin-sparc{64-g,-uc}libc"
  https://redmine.lighttpd.net/issues/3251
---
 src/fdevent.h      |  2 ++
 src/fdevent_impl.c | 18 ++++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/src/fdevent.h b/src/fdevent.h
index 1b0a062fc..556a14455 100644
--- a/src/fdevent.h
+++ b/src/fdevent.h
@@ -40,6 +40,8 @@ struct fdnode_st {
 #if (defined(__sun) && defined(__SVR4)) /* Solaris */ \
  || defined(__FreeBSD__)
 #define FDEVENT_RDHUP  0x4000
+#elif (defined(__linux__) && (defined(__sparc__) || defined(__sparc)))
+#define FDEVENT_RDHUP  0x2800 /*(0x2000 EPOLLRDHUP | 0x0800 POLLRDHUP)*/
 #else
 #define FDEVENT_RDHUP  0x2000
 #endif
diff --git a/src/fdevent_impl.c b/src/fdevent_impl.c
index 8bfc1cc68..c84c8df57 100644
--- a/src/fdevent_impl.c
+++ b/src/fdevent_impl.c
@@ -338,6 +338,11 @@ fdevent_linux_sysepoll_event_set (fdevents *ev, fdnode *fdn, int events)
     struct epoll_event ep;
   #ifndef EPOLLRDHUP
     events &= ~FDEVENT_RDHUP;
+  #elif (defined(__linux__) && (defined(__sparc__) || defined(__sparc)))
+    if (events & FDEVENT_RDHUP) {
+        events &= ~FDEVENT_RDHUP;
+        events |= EPOLLRDHUP;
+    }
   #endif
     ep.events = events | EPOLLERR | EPOLLHUP;
     ep.data.ptr = fdn;
@@ -376,7 +381,11 @@ fdevent_linux_sysepoll_init (fdevents *ev)
     ck_static_assert(EPOLLERR   == FDEVENT_ERR);
     ck_static_assert(EPOLLHUP   == FDEVENT_HUP);
   #ifdef EPOLLRDHUP
+   #if (defined(__linux__) && (defined(__sparc__) || defined(__sparc)))
+    ck_static_assert(EPOLLRDHUP  & FDEVENT_RDHUP);
+   #else
     ck_static_assert(EPOLLRDHUP == FDEVENT_RDHUP);
+   #endif
   #endif
 
     ev->type      = FDEVENT_HANDLER_LINUX_SYSEPOLL;
@@ -770,6 +779,11 @@ fdevent_poll_event_set (fdevents *ev, fdnode *fdn, int events)
 
   #ifndef POLLRDHUP
     events &= ~FDEVENT_RDHUP;
+  #elif (defined(__linux__) && (defined(__sparc__) || defined(__sparc)))
+    if (events & FDEVENT_RDHUP) {
+        events &= ~FDEVENT_RDHUP;
+        events |= POLLRDHUP;
+    }
   #endif
 
     if (k >= 0) {
@@ -854,7 +868,11 @@ fdevent_poll_init (fdevents *ev)
     ck_static_assert(POLLHUP   == FDEVENT_HUP);
     ck_static_assert(POLLNVAL  == FDEVENT_NVAL);
   #ifdef POLLRDHUP
+   #if (defined(__linux__) && (defined(__sparc__) || defined(__sparc)))
+    ck_static_assert(POLLRDHUP  & FDEVENT_RDHUP);
+   #else
     ck_static_assert(POLLRDHUP == FDEVENT_RDHUP);
+   #endif
   #endif
 
     ev->type      = FDEVENT_HANDLER_POLL;