From nobody Tue Feb 10 01:15:12 2026 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; arc=fail (BodyHash is different from the expected one); dmarc=fail(p=none dis=none) header.from=oracle.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1709192511490548.0582508708342; Wed, 28 Feb 2024 23:41:51 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 253091B6F; Thu, 29 Feb 2024 02:41:50 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id D9A681A18; Thu, 29 Feb 2024 02:40:27 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 2232E1A22; Thu, 29 Feb 2024 02:40:24 -0500 (EST) Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 4B0491A18 for ; Thu, 29 Feb 2024 02:40:21 -0500 (EST) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41T1xrmG017944 for ; Thu, 29 Feb 2024 06:47:05 GMT Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3wf722mju9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 29 Feb 2024 06:47:05 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41T5nBPV022403 for ; Thu, 29 Feb 2024 06:47:04 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2101.outbound.protection.outlook.com [104.47.70.101]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3wf6wadft2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 29 Feb 2024 06:47:04 +0000 Received: from SJ0PR10MB5768.namprd10.prod.outlook.com (2603:10b6:a03:421::12) by CH2PR10MB4150.namprd10.prod.outlook.com (2603:10b6:610:ac::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.41; Thu, 29 Feb 2024 06:47:02 +0000 Received: from SJ0PR10MB5768.namprd10.prod.outlook.com ([fe80::64bd:3256:48da:16cc]) by SJ0PR10MB5768.namprd10.prod.outlook.com ([fe80::64bd:3256:48da:16cc%7]) with mapi id 15.20.7316.039; Thu, 29 Feb 2024 06:47:02 +0000 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gtZnPrwn0PhfyRmzBL5T10AYIpU/yC5MprzBWD2Zb5jzELqpWt/W/L5tVcnHbqmn+0b8CQdurAOkDPdFXBtHafnq3/9XWZsrBlVa7J7HBM5q3kx/+nEggT3tSNWK6RIxfuQhud/I7RFXvp2VoDPT1SRXYR1bMR7m8Aqt19euAKaSEZSLqBZIOe7oizrkWmLiDUXjFNEgcrSBXDlQ9sKNJ//TPj8TOu8w/oc4xWheCgKrOm9AHjkKYJy8BsIWjlxUCLVWCOcQZXGv19v4wJElWSWQr+sd33JOPp3yw2tcl50H9b0TfruEOdvMSsX3GiZmbOUuhhWB3oOeoKfzWTX7gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=62Xjy8DFqxqQuKbAVmyLmQwA8gHvKR4553FZNLa2Xw4=; b=QOaSCq31Y3IVpNwN0EwEEl5pktFEOs3FVzOAGPYQZ5LiV7/umxoEF4HS5X4/5LnAGKjaMxgK3vCe711yNUIZAnlv4U4+dKfaeHj7y4xz/RhkoAYOxPRFVeHRCrxJxn+35o2HykjRBbydOnuU4hthsZQsGG3fVXYCQsmAGtTAcvXNlzR3kSBIjflEY99qRX8ybIQiedtUpe/TimmHYa/NeWE28P9pQVogAVTP7OtpO3yRkhP63peeD4RnPSK3xo++P0fJCI0Bq+2LsUQk4UDbLY1zJ3OMa0jEJ/l2B6riZ/4p/8fVRxEGySKA+2GVVZb7EXqVb0e1MKFjW4NWUBeCVA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none From: Shaleen Bathla To: devel@lists.libvirt.org Subject: [libvirt] [PATCH 2/4] util: virrotatingfile: Introduce virRotatingFileWriterAppendTimestamp Date: Thu, 29 Feb 2024 12:16:37 +0530 Message-Id: <20240229064639.1731653-3-shaleen.bathla@oracle.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240229064639.1731653-1-shaleen.bathla@oracle.com> References: <20240229064639.1731653-1-shaleen.bathla@oracle.com> X-ClientProxiedBy: SJ0PR03CA0350.namprd03.prod.outlook.com (2603:10b6:a03:39c::25) To SJ0PR10MB5768.namprd10.prod.outlook.com (2603:10b6:a03:421::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR10MB5768:EE_|CH2PR10MB4150:EE_ X-MS-Office365-Filtering-Correlation-Id: f94e60ff-aa0a-4fd8-d13c-08dc38f23c35 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PBuD5VcVh0WEBY3qwCNUXo+5M/wT7+8mBgxMOsmGAPVhntAjjKGn7zcwUgo3ag7aYzT02X5Ra2jN0E0iF3FqFxUV6mm4hoqFZwOgZDRwqHwGRy21lqDqi1iZ879zcVFWxY/YKKCmhFe44leYv7D0xyYoLgl/vSSC59pgAWXGmoHbndTtClV6YCmbadZCO14b4Nv5glm1mVri0HqUAyVhHuz1SbqNxbrf5SYoT3X87lT21JRZPKfBK8gaySeArMvlcgL6PAiVzpyEXn9xP85RLCSj1ZgKnfZamT4BLQCpJmydgcETgkm99U9BiyFjXcXl2vNnI5pzCEpiyrym2A2+mldGtCgUtStZGE+yWH7I0IFOmzc9+zNuZjKY1gt4tYBl3AdfowIUwYYVUxPFj3hQNRWD/O0LzkqCfb0LESQor6jtNQa1/IT3yJdK8MNnmMf7fbgphLdnMwPDPBYavoGmf12nGEDFCVwQcbxLpNOnZMNwJH8Wiw9fpqQonbQaPW07kDytYyaLHdN7tHgQm2Z7EoGIDjsV+eDXLw7yohivlMNotjQWu3t+MXrAR2sOdRpvqJUGiDS6CmFrvIR4lrAsRVqkrU+ZUUWneuLvIXukPo86qL3sPAwe3hRIG4BHmyNCEnZqR8wkaITPwXuisvzyVQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR10MB5768.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?4DJGYw9ygWZOjT5xv022r/dnyj0yM9M7iPyaQn9JfZMJwGanwforV+oQ3rrg?= =?us-ascii?Q?Awm7uO4oXViszXZO8syvWuCIPJw1Cg6B+Zwqm2KHbGDkWiN5zJusPYFTX3MV?= =?us-ascii?Q?wJwzhhpX0xGd6EZzKv5UgPps1G1pJnLywkeTne1KYsqYece3NsYRbS2+NBZx?= =?us-ascii?Q?pOYOd0xidpPUlnS45V7B0VvJ7rfR2gMIX2OuuHmtqeX8Gqj1Qfxbf1xEr592?= =?us-ascii?Q?YrO7/is6PagWy4GRQXYJUxgOEsMFIBU8onhM2jAgWZbR0+fXn6cl0GrN+uK2?= =?us-ascii?Q?TLDpYRA5Nt8rmx2A0Az8IfUqsJYOt7crf7HY2GYQhgRHHCBJH4Dm8xXRVvBa?= =?us-ascii?Q?u04DkHbtVw4j1XlUckWFzkLqKZvHaiBWKCRhsTezdaYsJNLQmngRbbnIrUU9?= =?us-ascii?Q?uVnue2VdlzsGxSFHX/1XxGOXgxacqEFlTwi4JXBdka3NUst499SImusXW+gG?= =?us-ascii?Q?08gGxyq8xZsENNJFC8AcQMC0mac4SKXLbh/PbWu/pepLEz4r0kHzrkY8RiTm?= =?us-ascii?Q?i9jTGXUkJBACyoDU04+RQ7ap/HTd7I3+tj9bOXys0VAezEKFzlT+Bzr0DM3s?= =?us-ascii?Q?vqc8LOn7IR1GlUP755b+Zy04VYviq8YDnc1V3/96GBU8h8LNCchSfiHsSnI0?= =?us-ascii?Q?HH/193FdYBvHxgxpl6X0uTgwlj10aXLtgONvlH0OXsaV5RYxgGv1DqDNcXBZ?= =?us-ascii?Q?aB8Vj2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HWibl4Lbw?= =?us-ascii?Q?mg=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: zuki+fHA7CP4AKAu6u61lhwPDdba3lj6Sn7GIM0D9wXJ99USS3I6Iag4lY6+I7rY4VcdhDu4/+9HG2SazOPMTJtTfPuneWSeiA7ODfwNR7vdU9uchzZ05V4dwQLNE4+vJzdIzn/1Gz83+/rw1vLvtB8mGe+JXpeyKKT/zH84/ul15sdhJR1DkFd7koSjqaUwOaLffsDDsGGbZ77o9B26I75QA/qXTn3Sl+hHvyoqEmYXJ7d6lKuSyLCuaj3i5UvR5r/DR+fvJovN1TSK+eKiFVBFghDrZ9pckXnnda0fE4yYtegN5NzHkJugCgNU86M6EuxHE7NQbLXkCoWjqWr+9uZotUhTCIb+psKp3tKGYuUwLPZc38BXXGakolxS8F6qjXdIlklA87rVTr2KbGiqsDddcV38vPjV9PAQ8wxU6S499BbqC249/U7aL+rALVABIGNZuGTqYsU/Nvxz4OCPB5nzZ+35/7Z5ib7edIEHNGvkrZzT2pGrJQOJIel3zfEzoxPZQHlxIDOfEmFSBI9O1NDHAiVxf0NP+DPI1Dic5avMpoPPJPanm8oMh6ddWxSrhLzj1Gh2/mref6TvsYQpqNu9MbVCiR8qjOEeRKANkXc= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f94e60ff-aa0a-4fd8-d13c-08dc38f23c35 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB5768.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Feb 2024 06:47:02.4195 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: hOkzX3zk6+nNmSAcbUsBf+d8WdOnYaANIHhDHR6/G/dn7Z91N1W/ztjActiX1s4rKu5YyrxV6LiHt8UXGu9cW13C8kVyi+6JL2Z6Y9K/AA0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4150 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-28_08,2024-02-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 spamscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402290051 X-Proofpoint-ORIG-GUID: PxNysKv3wcwXKitVnRIuFlS3KWhXKUoS X-Proofpoint-GUID: PxNysKv3wcwXKitVnRIuFlS3KWhXKUoS Message-ID-Hash: BJL7XRDG6I2WDRIIGNT4L5PWCKJCB5GQ X-Message-ID-Hash: BJL7XRDG6I2WDRIIGNT4L5PWCKJCB5GQ X-MailFrom: shaleen.bathla@oracle.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1709192512431100001 virRotatingFileWriterAppendTimestamp function appends timestamp to a file. Signed-off-by: Shaleen Bathla --- src/util/virrotatingfile.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/util/virrotatingfile.c b/src/util/virrotatingfile.c index b02a88c4b08d..2a44c9bf93e3 100644 --- a/src/util/virrotatingfile.c +++ b/src/util/virrotatingfile.c @@ -30,6 +30,7 @@ #include "virerror.h" #include "virfile.h" #include "virlog.h" +#include "virtime.h" =20 VIR_LOG_INIT("util.rotatingfile"); =20 @@ -406,6 +407,40 @@ virRotatingFileWriterRollover(virRotatingFileWriter *f= ile) } =20 =20 +/** + * virRotatingFileWriterAppendTimestamp: + * @file: the file context + * + * Append current timestamp with a trailing ' ' char to @file + * + * Returns 0 on success and -1 on error + */ +static ssize_t +virRotatingFileWriterAppendTimestamp(virRotatingFileWriter* file) +{ + char* timestamp =3D NULL; + size_t len =3D 0; + + if (!(timestamp =3D virTimeStringNow())) { + g_free(timestamp); + return -1; + } + + len =3D VIR_TIME_STRING_BUFLEN; + timestamp =3D g_realloc(timestamp, len+1); + timestamp[len-1] =3D ' '; + timestamp[len] =3D '\0'; + + if (virRotatingFileWriterAppend(file, timestamp, len) !=3D len) { + g_free(timestamp); + return -1; + } + + g_free(timestamp); + return 0; +} + + /** * virRotatingFileWriterAppend: * @file: the file context --=20 2.39.3 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org