From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 661636EC5B; Thu, 13 May 2021 14:17:19 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 661636EC5B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1620904639; bh=pu2MWkRSzR19N/XpnPUNYwLw31Ac4BeSX7bJqPuv31M=; h=To:References:Date:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=umAu8PETXz5oba2Y0WwMtDAOxDwt4zdQRyeSpmbVXrKaA7cjAlsbcBgozYf4YbIJY jER01ezD44Zk5Ukdsf93WJ9xcMliulAF2xeqo12pNyhDBCGkvQt84c6gkQG7RupCNi x+9n1jrcHFaR+ABi8Ml1uC/u64s0nQP2Wv4SenUA= Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (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 F20416EC5B for ; Thu, 13 May 2021 14:17:17 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org F20416EC5B Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1lh9LB-0002yM-0t; Thu, 13 May 2021 14:17:17 +0300 To: Cyrill Gorcunov References: <20210504155819.290874-1-gorcunov@gmail.com> <3917eb85-85e6-56d1-4176-7d6926587a49@tarantool.org> Message-ID: <8da1ce85-e510-9d27-95b1-b07c14dacf4a@tarantool.org> Date: Thu, 13 May 2021 13:17:15 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD95978C26455E69BE0B2C7F7C3B0039F1303CE517DE434612D182A05F538085040F17259F44884FEE07F93D45D8748434F20C3A6BCE303E81043FDFFA08B0F9229 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7978947DCA0D4215FEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006378B49D47CE295E66E8638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B27E6C961A1A14FA1EF4088AC7678A37313C8827A907CBE77DD2E47CDBA5A96583C09775C1D3CA48CFED8438A78DFE0A9E117882F4460429724CE54428C33FAD30A8DF7F3B2552694AC26CFBAC0749D213D2E47CDBA5A9658378DA827A17800CE767883B903EA3BAEA9FA2833FD35BB23DF004C906525384302BEBFE083D3B9BA71A620F70A64A45A98AA50765F79006372E808ACE2090B5E1725E5C173C3A84C3C5EA940A35A165FF2DBA43225CD8A89F83C798A30B85E16B262FEC7FBD7D1F5BB5C8C57E37DE458BEDA766A37F9254B7 X-C1DE0DAB: 0D63561A33F958A58E7C29FA4BBD177EE1A81E8D479E4554AD639258B582DF9FD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34A1AF43396E40A36FE6B8519CB7DCA679B507334B08D0A18FAB9FAC1B28AAB7C6DDFFC56CE168725F1D7E09C32AA3244CE691AD25F213214D4C15D28004A8AC7ABBA718C7E6A9E042927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojoybArHp+PQUFS8AZwALBYQ== X-Mailru-Sender: 689FA8AB762F73936BC43F508A063822B030C56C30129D9BBD25180632EA17A13841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v3 00/10] fix say_x format and rework fibers X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Cc: tml Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" On 13.05.2021 10:17, Cyrill Gorcunov wrote: > On Wed, May 12, 2021 at 08:41:42PM +0200, Vladislav Shpilevoy wrote: >>> >>> static int >>> lbox_fiber_top_entry(struct fiber *f, void *cb_ctx) >>> { >>> struct lua_State *L = (struct lua_State *) cb_ctx; >>> >>> --> lua_pushfstring(L, "%f/%s", (lua_Number)f->fid, f->name); >>> >>> why do we use float formate here at all?! >> >> Because lua_pushfstring() does not support %llu. > > What about the idea below? float is 4 byte len and won't cover the > 8 byte integer so we will have a rounding error. Looks good. But also this is strange how did it work before? lua_Number is double, if I am not mistaken. Which means it should have %lf format, and it should be fine for all the reachable fiber IDs. Anyway, the solution below looks good too. > --- > [cyrill@grain tarantool.git] git diff > diff --git a/src/lua/fiber.c b/src/lua/fiber.c > index 02ec3d158..753b9aa16 100644 > --- a/src/lua/fiber.c > +++ b/src/lua/fiber.c > @@ -337,7 +337,10 @@ lbox_fiber_top_entry(struct fiber *f, void *cb_ctx) > { > struct lua_State *L = (struct lua_State *) cb_ctx; > > - lua_pushfstring(L, "%f/%s", (lua_Number)f->fid, f->name); > + char sbuf[FIBER_NAME_MAX + 32]; > + snprintf(sbuf, sizeof(sbuf), "%llu/%s", > + (long long)f->fid, f->name); > + lua_pushstring(L, sbuf); > > lua_newtable(L); > >