From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp40.i.mail.ru (smtp40.i.mail.ru [94.100.177.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 903344696C3 for ; Fri, 10 Apr 2020 15:19:59 +0300 (MSK) Date: Fri, 10 Apr 2020 15:19:57 +0300 From: Alexander Turenko Message-ID: <20200410121957.pp4tpj56lixcsepy@tkn_work_nb> References: <04087d1f6a6bab4087b37d831b5fdfb9666b2605.1586486220.git.alexander.turenko@tarantool.org> <20200410083349.GQ3072@uranus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200410083349.GQ3072@uranus> Subject: Re: [Tarantool-patches] [PATCH 05/13] say: allow to set a logger file descriptor List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cyrill Gorcunov Cc: tarantool-patches@dev.tarantool.org On Fri, Apr 10, 2020 at 11:33:49AM +0300, Cyrill Gorcunov wrote: > On Fri, Apr 10, 2020 at 05:50:43AM +0300, Alexander Turenko wrote: > ... > > > > /** > > - * Default logger file descriptor. > > + * Accessors for default logger file descriptor. > > + * > > + * It is needed for dark magic inside popen implementation. > > + * Unlikely it is what you want to use anywhere else. > > */ > > I would rather comment it as "It is needed to keep the > logger fd alive if a child process in the popen engine > needs own fd intersecting with logger." But up to you. Keep it alive is one of two problems we should solve: the second one is about capturing of stderr in a parent process. I would not bury into those details here, but give few common words: we need decouple descriptors in popen, let's use those functions with caution. The wording is actually too informal, so it worth to rewrite in more serious way :) Changed: diff --git a/src/lib/core/say.h b/src/lib/core/say.h index 3ce7724c4..43883f0da 100644 --- a/src/lib/core/say.h +++ b/src/lib/core/say.h @@ -206,8 +206,11 @@ log_type(); /** * Accessors for default logger file descriptor. * - * It is needed for dark magic inside popen implementation. - * Unlikely it is what you want to use anywhere else. + * It is needed for decoupling of a logger file descriptor from + * stderr in the popen implementation. + * + * Those functions break logger incapsulation, so use them with + * caution. */ int log_get_fd(void);