summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2015-06-17 01:15:09 +0200
committerSven Eden <yamakuzure@gmx.net>2017-03-14 10:03:02 +0100
commited3fd617456efb0aac69526e6350441415792420 (patch)
treee96d4118341b6142392dfdbeff98349085c370fa /src/shared
parent198eb9458184a7b82a85df1d03a3dd52f24f5f26 (diff)
sd-event: make errors on EPOLL_CTL_DEL pseudo-fatal
If we call EPOLL_CTL_DEL, we *REALLY* expect the file-descriptor to be present in that given epoll-set. We actually track such state via our s->io.registered flag, so it better be true. Make sure if that's not true, we treat it similar to assert_return() (ie., print a loud warning).
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/macro.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/shared/macro.h b/src/shared/macro.h
index cc1c9e73c..5fa17ed20 100644
--- a/src/shared/macro.h
+++ b/src/shared/macro.h
@@ -248,18 +248,19 @@ static inline unsigned long ALIGN_POWER2(unsigned long u) {
REENABLE_WARNING
#endif
+#define assert_log(expr) ((_likely_(expr)) \
+ ? (true) \
+ : (log_assert_failed_return(#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__), false))
+
#define assert_return(expr, r) \
do { \
- if (_unlikely_(!(expr))) { \
- log_assert_failed_return(#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__); \
+ if (!assert_log(expr)) \
return (r); \
- } \
} while (false)
#define assert_return_errno(expr, r, err) \
do { \
- if (_unlikely_(!(expr))) { \
- log_assert_failed_return(#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__); \
+ if (!assert_log(expr)) { \
errno = err; \
return (r); \
} \