From nobody Thu Apr 25 20:09:13 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1663874015; cv=none; d=zohomail.com; s=zohoarc; b=QjF1/66GydlR27qR6c2SeAbA+qXxEM0GDc+Ib24XB3F/jHSkSN5yujS/xIGWfQSYnuzQd/PHmAepjJ8K0ey8mFhqRbJ02My4gHwnpPZcdlOyse/GAPm0yDhwcXABP/GEv8l2KECFAXEPTC6k7FtFPNHxSB3VAw9MzOc9/ClpmcQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663874015; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=a6eRj6bAV8UuEC00GNQIVJoZQaUjVO+7XesBendHQ1k=; b=AcaOEGNn++EoJjvs8xk1MZFbkeIOhCLQ+ivjHL9s2AAq0fnodo6Rwwrfuw30EBT5VwfeUgNsMAZbYO+TBd5iLwNv2sz2f+oVeZa7HiqJdSScSDlR3H+LLk6PHEQXPAKRPWn0zyvDhWkh6U7K7RLRdRYEiNxoGfag+HNECHMs8Ng= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1663874015237404.6847347506821; Thu, 22 Sep 2022 12:13:35 -0700 (PDT) Received: from localhost ([::1]:36202 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obRdd-00022H-1Z for importer@patchew.org; Thu, 22 Sep 2022 15:13:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35178) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obPuV-0003ys-4d for qemu-devel@nongnu.org; Thu, 22 Sep 2022 13:22:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:59119) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obPuT-0006ne-7I for qemu-devel@nongnu.org; Thu, 22 Sep 2022 13:22:50 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-442-_hj8fWr_OkafygwXWwf_Kg-1; Thu, 22 Sep 2022 13:22:45 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 01B21100F810; Thu, 22 Sep 2022 17:22:45 +0000 (UTC) Received: from localhost (unknown [10.39.192.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5720D2028CE4; Thu, 22 Sep 2022 17:22:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663867368; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=a6eRj6bAV8UuEC00GNQIVJoZQaUjVO+7XesBendHQ1k=; b=HN3TolPtOrUjkx+9EmOjsRbHSKEHJjeZoJsm8HGg5cInsntPc1plBKWTahHW+vukPqyO3v dAac4cqaNnWR+Jr+CM0bt2xPXtgqwFUq1CAKlC12shyrdy/Lm8xQjlo/Aa7/WysCVNpl0C 0FYxRAtvCm8kLJs63X6l3C5qzNXm5w4= X-MC-Unique: _hj8fWr_OkafygwXWwf_Kg-1 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi , qemu-block@nongnu.org, "Dr. David Alan Gilbert" , virtio-fs@redhat.com, Yusuke Okada Subject: [PULL 1/1] virtiofsd: use g_date_time_get_microsecond to get subsecond Date: Thu, 22 Sep 2022 13:14:47 -0400 Message-Id: <20220922171447.166958-2-stefanha@redhat.com> In-Reply-To: <20220922171447.166958-1-stefanha@redhat.com> References: <20220922171447.166958-1-stefanha@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1663874017460100001 Content-Type: text/plain; charset="utf-8" From: Yusuke Okada The "%f" specifier in g_date_time_format() is only available in glib 2.65.2 or later. If combined with older glib, the function returns null and the timestamp displayed as "(null)". For backward compatibility, g_date_time_get_microsecond should be used to retrieve subsecond. In this patch the g_date_time_format() leaves subsecond field as "%06d" and let next snprintf to format with g_date_time_get_microsecond. Signed-off-by: Yusuke Okada Reviewed-by: Dr. David Alan Gilbert Message-id: 20220818184618.2205172-1-yokada.996@gmail.com Signed-off-by: Stefan Hajnoczi --- tools/virtiofsd/passthrough_ll.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough= _ll.c index 371a7bead6..20f0f41f99 100644 --- a/tools/virtiofsd/passthrough_ll.c +++ b/tools/virtiofsd/passthrough_ll.c @@ -4185,6 +4185,7 @@ static void setup_nofile_rlimit(unsigned long rlimit_= nofile) static void log_func(enum fuse_log_level level, const char *fmt, va_list a= p) { g_autofree char *localfmt =3D NULL; + char buf[64]; =20 if (current_log_level < level) { return; @@ -4197,9 +4198,11 @@ static void log_func(enum fuse_log_level level, cons= t char *fmt, va_list ap) fmt); } else { g_autoptr(GDateTime) now =3D g_date_time_new_now_utc(); - g_autofree char *nowstr =3D g_date_time_format(now, "%Y-%m-%d = %H:%M:%S.%f%z"); + g_autofree char *nowstr =3D g_date_time_format(now, + "%Y-%m-%d %H:%M:%S.%%06d%z"); + snprintf(buf, 64, nowstr, g_date_time_get_microsecond(now)); localfmt =3D g_strdup_printf("[%s] [ID: %08ld] %s", - nowstr, syscall(__NR_gettid), fmt); + buf, syscall(__NR_gettid), fmt); } fmt =3D localfmt; } --=20 2.37.3