[Tarantool-patches] [PATCH 05/13] say: allow to set a logger file descriptor

Alexander Turenko alexander.turenko at tarantool.org
Fri Apr 10 15:19:57 MSK 2020


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);


More information about the Tarantool-patches mailing list