From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id B2C4E2701F for ; Wed, 21 Aug 2019 18:46:22 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id y05CcV8nniVO for ; Wed, 21 Aug 2019 18:46:22 -0400 (EDT) Received: from smtp17.mail.ru (smtp17.mail.ru [94.100.176.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 730E526EAE for ; Wed, 21 Aug 2019 18:46:22 -0400 (EDT) Date: Thu, 22 Aug 2019 01:45:58 +0300 From: Alexander Turenko Subject: [tarantool-patches] Re: [PATCH] Enable support for NOTIFY_SOCKET on macOS Message-ID: <20190821224557.h4z3bnu44mlhqium@tkn_work_nb> References: <20190819082813.38237-1-m.melentiev@corp.mail.ru> <20190819193333.z525sey6oe2dbnvg@tkn_work_nb> <28f95bdb-d3c7-6d70-7af8-2e40b62cf9c7@corp.mail.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <28f95bdb-d3c7-6d70-7af8-2e40b62cf9c7@corp.mail.ru> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: Maxim Melentiev Cc: tarantool-patches@freelists.org, Konstantin Osipov > ${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.