summaryrefslogtreecommitdiffstats
path: root/debian/patches/use-nfds_t-in-cl_poll.patch
blob: 9f7af9043e9dcac1d55bf93e212a849935b5e3b2 (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
112
113
114
115
116
117
118
From: =?utf-8?q?Ferenc_W=C3=A1gner?= <wferi@debian.org>
Date: Sat, 31 Aug 2024 14:29:02 +0200
Subject: Use nfds_t in cl_poll()

This complements our long-existing ipc_param_type patch.

Closes: #1077353
---

Index: cluster-glue/lib/clplumbing/cl_poll.c
===================================================================
--- cluster-glue.orig/lib/clplumbing/cl_poll.c	2024-08-31 14:47:54.956141061 +0200
+++ cluster-glue/lib/clplumbing/cl_poll.c	2024-08-31 14:48:12.635692755 +0200
@@ -98,8 +98,8 @@
 }
 
 #else /* HAVE_FCNTL_F_SETSIG */
-static void dump_fd_info(struct pollfd *fds, unsigned int nfds, int timeoutms);
-static void check_fd_info(struct pollfd *fds, unsigned int nfds);
+static void dump_fd_info(struct pollfd *fds, nfds_t nfds, int timeoutms);
+static void check_fd_info(struct pollfd *fds, nfds_t nfds);
 static void cl_real_poll_fd(int fd);
 static void cl_poll_sigpoll_overflow_sigaction(int nsig, siginfo_t* , void*);
 static void cl_poll_sigpoll_overflow(void);
@@ -136,7 +136,7 @@
 static int		cl_nsig = 0;
 static gboolean		SigQOverflow = FALSE;
 
-static int	cl_init_poll_sig(struct pollfd *fds, unsigned int nfds);
+static int	cl_init_poll_sig(struct pollfd *fds, nfds_t nfds);
 static short	cl_poll_assignsig(int fd);
 static void	cl_poll_sigaction(int nsig, siginfo_t* info, void* v);
 static int	cl_poll_prepsig(int nsig);
@@ -216,9 +216,9 @@
  * file descriptors.
  */
 static int
-cl_init_poll_sig(struct pollfd *fds, unsigned int nfds)
+cl_init_poll_sig(struct pollfd *fds, nfds_t nfds)
 {
-	unsigned	j;
+	nfds_t		j;
 	int		maxmonfd = -1;
 	int		nmatch = 0;
 
@@ -543,7 +543,7 @@
  */
 
 int
-cl_poll(struct pollfd *fds, unsigned int nfds, int timeoutms)
+cl_poll(struct pollfd *fds, nfds_t nfds, int timeoutms)
 {
 	int				nready;
 	struct	timespec		ts;
@@ -551,7 +551,7 @@
 	const struct timespec*		itertime = &ts;
 	siginfo_t			info;
 	int				eventcount = 0;
-	unsigned int			j;
+	nfds_t				j;
 	int				savederrno = errno;
 	int				stw_errno;
 	int				rc;
@@ -679,19 +679,20 @@
  * Debugging routine for printing current poll arguments, etc.
  */
 static void
-dump_fd_info(struct pollfd *fds, unsigned int nfds, int timeoutms)
+dump_fd_info(struct pollfd *fds, nfds_t nfds, int timeoutms)
 {
 	unsigned	j;
+	nfds_t		fd_index;
 
 	cl_log(LOG_DEBUG, "timeout: %d milliseconds", timeoutms);
-	for (j=0; j < nfds; ++j) {
-		int	fd = fds[j].fd;
+	for (fd_index=0; fd_index < nfds; ++fd_index) {
+		int	fd = fds[fd_index].fd;
 		poll_info_t*	moni = monitorinfo+fd;
 
 		cl_log(LOG_DEBUG, "fd %d flags: 0%o, signal: %d, events: 0x%x"
 		", revents: 0x%x, pendevents: 0x%x"
 		,	fd, fcntl(fd, F_GETFL), moni->nsig
-		,	fds[j].events, fds[j].revents, moni->pendevents);
+		,	fds[fd_index].events, fds[fd_index].revents, moni->pendevents);
 	}
 	for (j=SIGRTMIN; j < (unsigned)SIGRTMAX; ++j) {
 		if (!sigismember(&SignalSet, j)) {
@@ -705,12 +706,13 @@
  * Debugging routine for auditing our file descriptors, etc.
  */
 static void
-check_fd_info(struct pollfd *fds, unsigned int nfds)
+check_fd_info(struct pollfd *fds, nfds_t nfds)
 {
 	unsigned	j;
+	nfds_t		fd_index;
 
-	for (j=0; j < nfds; ++j) {
-		int	fd = fds[j].fd;
+	for (fd_index=0; fd_index < nfds; ++fd_index) {
+		int	fd = fds[fd_index].fd;
 		poll_info_t*	moni = monitorinfo+fd;
 
 		if (!sigismember(&SignalSet, moni->nsig)) {
Index: cluster-glue/include/clplumbing/cl_poll.h
===================================================================
--- cluster-glue.orig/include/clplumbing/cl_poll.h	2024-08-31 14:47:54.956141061 +0200
+++ cluster-glue/include/clplumbing/cl_poll.h	2024-08-31 14:47:54.952141163 +0200
@@ -31,7 +31,7 @@
  * uses the real poll() call.
  *
  */
-int cl_poll(struct pollfd *fds, unsigned int nfds, int timeout_ms);
+int cl_poll(struct pollfd *fds, nfds_t nfds, int timeout_ms);
 
 /*
  * Call cl_poll_ignore() when you close a file descriptor you monitored