From: Alexander Turenko <alexander.turenko@tarantool.org> To: Maxim Melentiev <m.melentiev@corp.mail.ru> Cc: tarantool-patches@freelists.org, Konstantin Osipov <kostja@tarantool.org> Subject: [tarantool-patches] Re: [PATCH] Enable support for NOTIFY_SOCKET on macOS Date: Thu, 22 Aug 2019 01:45:58 +0300 [thread overview] Message-ID: <20190821224557.h4z3bnu44mlhqium@tkn_work_nb> (raw) In-Reply-To: <28f95bdb-d3c7-6d70-7af8-2e40b62cf9c7@corp.mail.ru> > ${MODULE_LUAPATH}" > find_package_message(MODULE_LIBPATH "Lua package.cpath: ${MODULE_LIBPATH}" > "${MODULE_LIBPATH}") > > +option(WITH_NOTIFY_SOCKET "Enable notifications on NOTIFY_SOCKET" ON) Kostya asks to enable it always when WITH_SYSTEMD is enabled. It is ON be default, so I guess the acceptable way to achieve the requested behaviour is to give an error when WITH_SYSTEMD is enabled, but WITH_NOTIFY_SOCKET is disabled. > +/* > + * Linux supports MSG_NOSIGNAL flag for sendmsg. > + * macOS lacks it, but has SO_NOSIGPIPE for setsockopt > + * to achieve same behavior. > + */ > +#if !defined(MSG_NOSIGNAL) && !defined(SO_NOSIGPIPE) > +#error "No way to block SIGPIPE in sendmsg!" > +#endif I think it is better to give an error on the configuration step (check it is cmake files). > - int sndbuf_sz = 8 * 1024 * 1024; > + if (fcntl(systemd_fd, F_SETFD, FD_CLOEXEC) == -1) { > + say_syserror("systemd: fcntl failed to set FD_CLOEXEC"); > + goto error; > + } > + > + #ifdef SO_NOSIGPIPE AFAIR, Kostya asks to set WITH_SO_NOSIGNAL / WITH_SO_NOSIGPIPE from cmake. Nit: We don't indent preprocessor directives. > say_debug("systemd: sending message '%s'", message); > + #ifdef MSG_NOSIGNAL > + int flags = MSG_NOSIGNAL; > + #else > + int flags = 0; > + #endif Nit: I would write it so: | int flags = 0; | #ifdef WITH_MSG_NOSIGNAL | flags |= MSG_NOSIGNAL | #endif This way it is simpler to add a flag in a future. Don't worry about a generated machine code: a compiler will perform the constant propagation at compile time.
next prev parent reply other threads:[~2019-08-21 22:46 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-08-19 8:28 [tarantool-patches] " Max Melentiev 2019-08-19 19:33 ` [tarantool-patches] " Alexander Turenko 2019-08-21 8:31 ` Maxim Melentiev 2019-08-21 15:52 ` Konstantin Osipov 2019-08-22 8:59 ` Maxim Melentiev 2019-08-22 10:06 ` Konstantin Osipov 2019-08-22 12:44 ` Maxim Melentiev 2019-08-22 13:03 ` Konstantin Osipov 2019-08-22 14:27 ` Maxim Melentiev 2019-08-23 12:11 ` Alexander Turenko 2019-08-27 23:51 ` Kirill Yukhin 2019-08-21 22:45 ` Alexander Turenko [this message] 2019-08-19 20:18 ` Konstantin Osipov 2019-08-20 15:26 ` Maxim Melentiev 2019-08-20 16:22 ` Konstantin Osipov 2019-08-27 23:54 ` Kirill Yukhin
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190821224557.h4z3bnu44mlhqium@tkn_work_nb \ --to=alexander.turenko@tarantool.org \ --cc=kostja@tarantool.org \ --cc=m.melentiev@corp.mail.ru \ --cc=tarantool-patches@freelists.org \ --subject='[tarantool-patches] Re: [PATCH] Enable support for NOTIFY_SOCKET on macOS' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox