From patchwork Tue Jul 2 19:33:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 809225 Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8645484A40 for ; Tue, 2 Jul 2024 19:33:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719948827; cv=none; b=fDA9J8hVTCUdyM7Ffm1m1YQcr24xjjDHk1XBD3jjThfZ/Wp/n6+5hTua8TosK6ffC09rRh5VjSt/XMdXiUg5kInEzzEB49wa4CVKNamDG4om9O/ck+Hnu4bc0XDW2ro5XkG/fe7VrVri0UgaFUthmPk2pACTtQ0NmbCTKBQihNk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719948827; c=relaxed/simple; bh=40st7mPKZij9jstwJzfHwLX45We4KAKNRTENmBiHm8A=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=UOq8/FTWtL/TKY6fdJgW8TH43JFuYijD6wrMfnM9FiGlrQ/9ZVvYKGwR/JEdACuPctyFMbznJnCJ8MVYe5l40tQewCrFL9hir43mDakzoxaGp8x5iOk+wqOLFyTIzgVmYDytuUUagYTcfU2mlbf6wRrmV4f4hGA65fCcltWnInc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=IMdu04vE; arc=none smtp.client-ip=209.85.215.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IMdu04vE" Received: by mail-pg1-f182.google.com with SMTP id 41be03b00d2f7-7515437ff16so1027712a12.2 for ; Tue, 02 Jul 2024 12:33:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719948826; x=1720553626; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=MIowyqY6eNOt56QWbFHmTDApGZxYSpM/6yioPScisso=; b=IMdu04vExATHlwU3HIvQ3QHQhiRrPewz2OseqTfaKT/Wz3iKWhstaJqEhgYZNzsCWB FmtGRaJXbKUTSTkK5M0hto1UADZy051Lm1twMoQIKefQ/L1zfCvSEURBhGe/piTAk9rJ CNF/E+vmhvNRDEV3hXpFosQuczZjjOJMphEszddrLOsxLG6H7kxPIJjAvs1O6Esk/j1N UsHrNX0xpFYn2RSr3pGzuETMcR/aAxi5+8caPSES7zVO1Qj+U8fdus0k4cb6Hql7JFnZ tyIGDnZugDqVxjlql3ZA1H1dPhTZpTd54pjj/byRXM5vINu/fWtrLG8KVdFu0eD4iqWp pXVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719948826; x=1720553626; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MIowyqY6eNOt56QWbFHmTDApGZxYSpM/6yioPScisso=; b=Ak4ayOhTbUTP8fHNiXYWGg58gFpyOyf9Ia55IwuJy2WZJD/SvFfsuSa+nEAWBOhmTd 8Ib7XCz/qUHNbeFou6E45DCtqD8THD1k0mwBkZYhSGKnSO7vTi+5iUZmtZL4SFNC8/+0 lWBKVbBV/z30oEbWn21xaubD34fO7blm84iFttFWemkblVQku8Uz9u6SSVszAhTUts2W jfL+kSj9PsVcj2p2m4tRaySn2isIZmUaOdLgD9rYefLvR77FIHirJGkJjKIfjJrHGD+p ewuaoxDOp5B6CeR8hOPcC3aMeu/k3Q45pUGY8f8TzpN7WZpy145pVYiA8Dx+8kT5W2eg /2Lw== X-Gm-Message-State: AOJu0YzdSbW5NFCEkZr23KVfzNvZNfD4SPUUYDZePlLL+ffQE8b25Vsr /k6TlwI0nB8VZlTqmCt5YtUrYZWHGH1jrwNkYGpHIA3lYemRR44k3L9mBQ== X-Google-Smtp-Source: AGHT+IFv5k3bDIxwaM2JS6NZUbCeg9KRoxHRqKbYYaDFoXijCW/28n0nTizEnhSreE/ZmQD7ce7f1Q== X-Received: by 2002:a05:6a20:d48c:b0:1be:d703:bc47 with SMTP id adf61e73a8af0-1bef620fba2mr13888550637.49.1719948825554; Tue, 02 Jul 2024 12:33:45 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fac1538fe7sm88441795ad.172.2024.07.02.12.33.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 12:33:45 -0700 (PDT) From: Rosen Penev To: linux-media@vger.kernel.org Subject: [PATCH 1/4] v4l-utils: fix formats under alpha/ppc64/mips64 Date: Tue, 2 Jul 2024 12:33:40 -0700 Message-ID: <20240702193343.5742-1-rosenp@gmail.com> X-Mailer: git-send-email 2.45.2 Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Unlike libc, kernel headers use long long for 64-bit types. __SANE_USERSPACE_TYPES__ needs to be defined for the exceptions. Fixes -Wformat warnings about llu being used instead of lu. Signed-off-by: Rosen Penev --- meson.build | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/meson.build b/meson.build index 900377fa..15b16971 100644 --- a/meson.build +++ b/meson.build @@ -69,6 +69,12 @@ elif host_machine.system() == 'freebsd' v4l2_utils_incdir_arr += 'contrib/freebsd/include' endif +# These platforms default to __[us]64 as long. Add this define to get long long +# as is done elsewhere. +if host_machine.cpu_family() in ['alpha', 'mips64', 'ppc64'] + add_project_arguments('-D__SANE_USERSPACE_TYPES__', language: ['c', 'cpp']) +endif + v4l2_utils_incdir = include_directories(v4l2_utils_incdir_arr) prog_bash = find_program('bash') From patchwork Tue Jul 2 19:33:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 809613 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 784D21BB687 for ; Tue, 2 Jul 2024 19:33:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719948828; cv=none; b=p2HNpVm1MxAMsjdGEiwgKRBbZDyKxPTeKtgWIm7igC9Ker4BXVWPJ5QHHyNtelodkd/BZuW8TUbjoczR5SX2UOEB1yWY991U+lvLTN4yoITacuVsOD9SjE3Q8+h4fQxqRLZInXmVqRMBEfbLFeJpdnuI91EDbk/TuVSMjnKZq9s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719948828; c=relaxed/simple; bh=NfffHtNEHZDNcyTRkNfyL1+hleQtBsh1ViMfls57PYw=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cD7bKRy0Ie4zkxa4wPn1lStoyZYzypbdDrOxk8X8rcON3oBdiIBV6rqBwCSqoWpcRgGWLAE+Oh8rUzlTzEJu119MV/MbbVxyWH5XgLMAfOQ/ZtzvkA9bFyBNJatVbmrpHl8GnQeug+uoJf12tEY1aWZ5iZvg9Pu/UlohnpaxEJs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=J/rokyG0; arc=none smtp.client-ip=209.85.214.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="J/rokyG0" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-1fafb9a33b3so6407355ad.1 for ; Tue, 02 Jul 2024 12:33:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719948827; x=1720553627; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=mXoetJmK4vT3sSD+N7bEiQjNsv5uxd1VKnOIwzzaiNM=; b=J/rokyG0IyX56wXkY2+A70YXTNftYrwdrmst1gEfZcTzyBm9rKHbLIb4NxX1ZBkjjv vpY+Zh93x4KJ/Pr1Ci4vvWknZSx566uXrMUfS6R3SjMlrL96epQfbLDGXuy646VP6pgg 9pwyNf4mGMw1Gy2LCj8xRBj9EAwp7OJ5RA1gjJoDnv4mIntoG1ImLURQrDnXwRAxSDd/ cvLvukT9Lq3jnPT4n/l94P4mrgeCuvpSBiSDVAICr2+bNxROYO0TH/FtlnOud0V1E+Bv 1PRPCM6vTTeVWLlX+++m5RUFJZ5RA0BFxcMk5CaH5u4fY03MDdbZ0499dYaGGK0q5grI eyuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719948827; x=1720553627; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mXoetJmK4vT3sSD+N7bEiQjNsv5uxd1VKnOIwzzaiNM=; b=D4Y/12QPggKAEbxYgzDFDtAWtcTo4gMkZUf2QU4fBTfGK7Mv0l/1OjE1dzi2qbL2V6 h0omonAGYNDYYxs6wT8+uMacNg/uBNUv9ImPArTR3bVeYN3DPx+oKlzUg2bQIFTfp4OK YkAwj2XLVCJYVTtb+IT14PV+whiZ/5SCD1HDVDzg7XCErzMuBSwI34qYTdTo4843sRZv qkU65hWAL8vPkP5ZW9N6Pt4iY+RJ5Sgz1GRgUP7mIHU4+qft2eaHY4JFrFXSjOsd5gtf xIyg+PL+2keGh03TX1vIpH4WLnVevVJVtSKh/tErEHqgIjlot/iba2ly6ml8T4eUPmxe JTSA== X-Gm-Message-State: AOJu0YxOroDURXjsW1c3KqwmdFfXQoVHYvg1Iqyq53CZJMu89CnXzT4m 1aAXGW2N9FMMpDcf+xPfcqHH+JL+XyQ7jzBOzfUGRDV4HBR5Yqo44K+5BA== X-Google-Smtp-Source: AGHT+IHGcI4yvGjj9HeYbrrVwzmI3q9LsBDpoh9eMKGZg5gX/3vLe8o8aQvXal6/MBlyB03Q6IJjqA== X-Received: by 2002:a17:903:18d:b0:1e0:bae4:48f9 with SMTP id d9443c01a7336-1fadbcb50e7mr66264865ad.32.1719948826404; Tue, 02 Jul 2024 12:33:46 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fac1538fe7sm88441795ad.172.2024.07.02.12.33.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 12:33:45 -0700 (PDT) From: Rosen Penev To: linux-media@vger.kernel.org Subject: [PATCH 2/4] v4l-utils: fix potential crashing with 32-bit musl Date: Tue, 2 Jul 2024 12:33:41 -0700 Message-ID: <20240702193343.5742-2-rosenp@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240702193343.5742-1-rosenp@gmail.com> References: <20240702193343.5742-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Under musl, if a format string has an integer followed by %s, a mismatch between types can cause the second half of the integer to be interpreted by %s. Eg: printf("%d %s", 64bittype, string); will crash, especially on 32-bit big endian. The reason these are cast to __u64 is because time_t and suseconds_t are 64-bit under musl, even on 32-bit platforms. __u64 helps avoid any truncation issues that may or may not arise. Signed-off-by: Rosen Penev --- utils/cec-follower/cec-follower.cpp | 2 +- utils/libv4l2util/v4l2_driver.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/cec-follower/cec-follower.cpp b/utils/cec-follower/cec-follower.cpp index a7481aea..67e0d92b 100644 --- a/utils/cec-follower/cec-follower.cpp +++ b/utils/cec-follower/cec-follower.cpp @@ -354,7 +354,7 @@ void print_timers(struct node *node) printf("source: %s, ", source.c_str()); if (t.recording_seq) printf("rec-seq: 0x%x, ", t.recording_seq); - printf("needs: %ld %s\n", t.duration, "MB."); /* 1MB per second. */ + printf("needs: %llu %s\n", (__u64)t.duration, "MB."); /* 1MB per second. */ } printf("Total media space available for recording: "); if (node->state.media_space_available >= 0) diff --git a/utils/libv4l2util/v4l2_driver.c b/utils/libv4l2util/v4l2_driver.c index 6b6366fa..51e97b61 100644 --- a/utils/libv4l2util/v4l2_driver.c +++ b/utils/libv4l2util/v4l2_driver.c @@ -174,13 +174,13 @@ static void prt_buf_info(char *name,struct v4l2_buffer *p) { struct v4l2_timecode *tc=&p->timecode; - printf ("%s: %02ld:%02d:%02d.%08ld index=%d, type=%s, " + printf ("%s: %02llu:%02d:%02d.%08llu index=%d, type=%s, " "bytesused=%d, flags=0x%08x, " "field=%s, sequence=%d, memory=%s, offset=0x%08x, length=%d\n", - name, (p->timestamp.tv_sec/3600), + name, (__u64)(p->timestamp.tv_sec/3600), (int)(p->timestamp.tv_sec/60)%60, (int)(p->timestamp.tv_sec%60), - p->timestamp.tv_usec, + (__u64)p->timestamp.tv_usec, p->index, prt_names(p->type,v4l2_type_names), p->bytesused,p->flags, From patchwork Tue Jul 2 19:33:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 809224 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C13B1CCCDA for ; Tue, 2 Jul 2024 19:33:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719948829; cv=none; b=ZSlAuT4YzFkThdUgEIF+Mouy0wB0uY7UNfjndYDhxhVKrsw2EKqoyZ+muPfftNhvz07gjeBuF9qd6/8ZINvAM2N+c0koRIMxSeJ7T5j6/lYPQVjRBiNYNmtVUfZHzCyMzV26LjdWXx/nxoJ6PLUC4ZuPK5si0HPhN+p4acG88uU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719948829; c=relaxed/simple; bh=fOIhJz+0yod2SuxSAgHdmqPoeVWNlgLlZDHJ9qgMFzg=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sII86BPcBZTRKMxbr8RXUOYgk+tjAwytsuFKmuawC3GM+HJTnhxLQllqd/OZY4eS5VkoVLshm/tvzao9W045XOOkemcihebyNL8Hj5DS69lgeuICWznR/GiioERUym7QH931vXjNOqtbSGZjnE+aPxtW100UuEam26i6SJ4DaS0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=AQDE/297; arc=none smtp.client-ip=209.85.214.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AQDE/297" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1f9fb3ca81bso26427125ad.3 for ; Tue, 02 Jul 2024 12:33:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719948827; x=1720553627; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=WPV/17eP89KjnNG6iXD4b3yUiVesxwTGG7KbdEadf2w=; b=AQDE/297iTuMJfjk7XetbR4jh4i/MmEZg45gtpeUqo4nwYDu9LhQb2/Xc+QGVwJfdl vvMSb55Gbwyv2eCR2qwmZiKqkUbrv9fiuzjiyBezvKvVmN16YhOb9P72xng38h85bLFr hrbd7AnhZEKr7Sj85NeizmLUfSBi0JPsKFDcTQg/NA/xZ3TDQhV4jz5WozALu+p3xzx/ TBrpYWJkWo8sfycE9SwT2F2nuhUH109Y1Y1NhYvqCyBfWyiZggGo7qNqIcXtO6xT0Chw igj8QCHjO5DErozyngoCz6kDJczfkHLB0KII0lee4+vKzgm4vxla2KEHK8mvM5qt88n+ vePA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719948827; x=1720553627; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WPV/17eP89KjnNG6iXD4b3yUiVesxwTGG7KbdEadf2w=; b=D2mTnD0wjB5xyjhosZ+kQKBWi3grsqb2yDakehmcMlch/dEVS74l2nDuJEXbHBaMnD Rz6nwC3LRqaTdTabHx8MbSlJaIduug1vutA1+GlGjmheK4UBdZcNjkkmAFLRVOSkhjof LiKus1Rhxfj3T83U/RJm032xRYBjHvWOoq55vbRuZaPS8SRzz3oh/HWNOGMr+5KDQ5xI dALl3fhL0GH/5AIo2kptRwOvdALLWlg8jYiA/Hp6NzjNIUVcKgSQKHpFZrnCDrZ16RH5 94J7cKNfBXYry3h7QrPmRCxfPZu8Ig/BcDqVwY1K5EcG9M/IOGkdIIwmpzekJA0cACqJ uDHg== X-Gm-Message-State: AOJu0YzKw+DB7IGyJ8S/3dt7XHXyzqu7nQ8FKoC0NWC7LbotpxuctoBE ucjST9/l72WDF2PkpO8OdGgje6XoUJpYw0QtvQIrUuVaHfxY+LJYtb/fbw== X-Google-Smtp-Source: AGHT+IHC151wiVBhSKHdTqWhDSfpQmTJhIVUhZc5FuRL+ZyHHumV0/DNCirqZkt2MxXgpL4Ha7hLgg== X-Received: by 2002:a17:902:f68e:b0:1fa:925b:5b77 with SMTP id d9443c01a7336-1fadbd07fc8mr67128385ad.64.1719948827339; Tue, 02 Jul 2024 12:33:47 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fac1538fe7sm88441795ad.172.2024.07.02.12.33.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 12:33:46 -0700 (PDT) From: Rosen Penev To: linux-media@vger.kernel.org Subject: [PATCH 3/4] v4l-utils: use 64-bit off_t format Date: Tue, 2 Jul 2024 12:33:42 -0700 Message-ID: <20240702193343.5742-3-rosenp@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240702193343.5742-1-rosenp@gmail.com> References: <20240702193343.5742-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 musl uses 64-bit off_t by default on all platforms. Cast and fix format to work everywhere. Signed-off-by: Rosen Penev --- utils/v4l2-tracer/retrace.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/v4l2-tracer/retrace.cpp b/utils/v4l2-tracer/retrace.cpp index 60d64d8b..010936c0 100644 --- a/utils/v4l2-tracer/retrace.cpp +++ b/utils/v4l2-tracer/retrace.cpp @@ -72,7 +72,7 @@ void retrace_mmap(json_object *mmap_obj, bool is_mmap64) (long) buf_address_retrace_pointer); if (is_verbose() || (errno != 0)) { - fprintf(stderr, "fd: %d, offset: %ld, ", fd_retrace, off); + fprintf(stderr, "fd: %d, offset: %lld, ", fd_retrace, (long long)off); if (is_mmap64) perror("mmap64"); else From patchwork Tue Jul 2 19:33:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 809612 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4EA211CE081 for ; Tue, 2 Jul 2024 19:33:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719948830; cv=none; b=tZ8vjD44plftIYNtWDVoqPDMlRi7ExtTORYibvBSisUoIKvnk4n8ZO4MBiPKmhwIdnIX840wvL7JqSlT4n5c2/K3TZYFRF/Vg0F3I+tGh3bz6QRjele9g2YSpl3+ncMRcJtXbJU8lsooxT2IrIPg8oYOynvdR7rZ+8OqURJ55HY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719948830; c=relaxed/simple; bh=p7XPvdD3tU9HWSeYM7FSJ3s5IUoQWIUGBokEvSrzuqs=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TBLQlr/ktMasVV2uvTABny92wahhH61LxlCE8ks/NVZeuCngn3ZOHAphfilr/Ts847TEyjHVOhKIsWafW7nBhltU6ekdCBBiHUtM9nfTgT0K4s1lHoPBn+xUgcNMLFXXF6E1LKkh/F2Ayu6ZzNoiUMlyGZIY889QtblvYGGEP/c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=W+Q5HPV6; arc=none smtp.client-ip=209.85.214.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="W+Q5HPV6" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1fa2ea1c443so35334005ad.0 for ; Tue, 02 Jul 2024 12:33:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719948828; x=1720553628; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=N8DON55o4cPvj6aXXqf3IWICHP4RWWJXn1rdii7VIzw=; b=W+Q5HPV6AzHHDFvWrFswbhHrAW+wg/DhcCDvU4k/aFbW92nU7xz+bNu/amL4++YgeZ HX4+CJHhHh3JwkrJ1N+UokB8T7dOQifUK624VnXHa5X8x2z3Iq+m1LVvuPnqBXJBoRbP VOBuQs9m8YGJATYwzCRbVUmzEci5M3ACgbkLmKJlT/JWsnLmNxkVlPOwYaa6vgvUNFJL 7bdD38iXhOsmfeRZXEstGbOAYIP4dBbQeja+LuQyyiSeFyy5loiBhLbvY5LoTDw0FmwA UrrDtjbcQ8Xu07R3wk0nFXfSCx9C5qzTplO3+xOiYUfriwD2jlVE+YepY9Jf2UnlOxwj kzug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719948828; x=1720553628; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=N8DON55o4cPvj6aXXqf3IWICHP4RWWJXn1rdii7VIzw=; b=fv2tfJ9NVd8kTyV+5phEok8cE82oJAHb6oSiRxkOcOJDHh8RBUmSJMMXxqjZJl6vS+ uKZrS7jTEJA9Cu++joih0YHGOei51DVuVU4C0cIkMs+/NTyRMc9P8DaNvBHwkSO8DIMc 8Wngeia0q0upegL+GwlcajNhlaQMjUdA4mYXy05WIVJtxfW+tyrLcAX8nmOGX0ZRjOdH KERlm5bxPLKBgV+/efgWd9dCg+IfUhVn3NigvwiYHWkmJwHORV5mC6U+bh4rNdr1EC61 p2dn1nSWV42BjY2Ucme3IvMVrVkbtWGC6AVhiddKv7iEu0o50rqlIIzTWaz20VGbC13L HGcA== X-Gm-Message-State: AOJu0YyWJDtQnDdwpAX4i8cx/O0U4d7RV9LQxgZptiRPwxeVT/W9oU6A 2PbvN6LD6+uVqWfXfkCnxI4tbsgNhVlneynZV9u/RsaaMIkkioEiNGH9MA== X-Google-Smtp-Source: AGHT+IHSXSsiquxTFeSHLfzmNYRYkdP5vlSepejHYswP0ARCNyqI7ow9WY9BEP4pPJILtSpLOYa1/Q== X-Received: by 2002:a17:903:22d1:b0:1f9:d111:8a19 with SMTP id d9443c01a7336-1fadbd01fbcmr78177025ad.64.1719948828297; Tue, 02 Jul 2024 12:33:48 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fac1538fe7sm88441795ad.172.2024.07.02.12.33.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 12:33:47 -0700 (PDT) From: Rosen Penev To: linux-media@vger.kernel.org Subject: [PATCH 4/4] v4l-utils: use 64-bit formats for time Date: Tue, 2 Jul 2024 12:33:43 -0700 Message-ID: <20240702193343.5742-4-rosenp@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240702193343.5742-1-rosenp@gmail.com> References: <20240702193343.5742-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 musl since version 1.2.0 uses 64-bit time_t and suseconds_t on all platforms, even 32-bit. Cast to avoid warnings and potentially future proof for when glibc and others gain support. Signed-off-by: Rosen Penev --- utils/cec-compliance/cec-compliance.cpp | 2 +- utils/cec-compliance/cec-test-adapter.cpp | 4 ++-- utils/cec-ctl/cec-ctl.cpp | 18 +++++++++--------- utils/cec-follower/cec-processing.cpp | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/utils/cec-compliance/cec-compliance.cpp b/utils/cec-compliance/cec-compliance.cpp index 8075e1d6..bddd57cb 100644 --- a/utils/cec-compliance/cec-compliance.cpp +++ b/utils/cec-compliance/cec-compliance.cpp @@ -279,7 +279,7 @@ static std::string ts2s(__u64 ts) t = res.tv_sec; s = ctime(&t); s = s.substr(0, s.length() - 6); - sprintf(buf, "%03lu", res.tv_usec / 1000); + sprintf(buf, "%03llu", (__u64)res.tv_usec / 1000); return s + "." + buf; } diff --git a/utils/cec-compliance/cec-test-adapter.cpp b/utils/cec-compliance/cec-test-adapter.cpp index 08c856af..f96baaf3 100644 --- a/utils/cec-compliance/cec-test-adapter.cpp +++ b/utils/cec-compliance/cec-test-adapter.cpp @@ -1276,9 +1276,9 @@ static int testLostMsgs(struct node *node) printf("\t\tReceived messages: %d of which %d were CEC_MSG_CEC_VERSION\n", pending_rx_msgs, pending_rx_cec_version_msgs); if (pending_quick_msgs < pending_msgs) - printf("\t\tReceived %d messages immediately, and %d over %ld seconds\n", + printf("\t\tReceived %d messages immediately, and %d over %llu seconds\n", pending_quick_msgs, pending_msgs - pending_quick_msgs, - time(nullptr) - start); + (__u64)time(nullptr) - start); } print_sfts(sft[1][1], "SFTs for repeating messages (>= 7)"); print_sfts(sft[1][0], "SFTs for repeating remote messages (>= 7)"); diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp index 8848a49d..f7ba7409 100644 --- a/utils/cec-ctl/cec-ctl.cpp +++ b/utils/cec-ctl/cec-ctl.cpp @@ -414,7 +414,7 @@ std::string ts2s(__u64 ts) strftime(buf, sizeof(buf), "%a %b %e %T.000000", &tm); } secs = last_secs + t - last_t; - sprintf(buf + 14, "%02u:%02u.%06lu", secs / 60, secs % 60, res.tv_usec); + sprintf(buf + 14, "%02u:%02u.%06llu", secs / 60, secs % 60, (__u64)res.tv_usec); return buf; } @@ -942,10 +942,10 @@ static void monitor(const struct node &node, __u32 monitor_time, const char *sto } fprintf(fstore, "# cec-ctl --store-pin\n"); fprintf(fstore, "# version %d\n", CEC_CTL_VERSION); - fprintf(fstore, "# start_monotonic %lu.%09lu\n", - start_monotonic.tv_sec, start_monotonic.tv_nsec); - fprintf(fstore, "# start_timeofday %lu.%06lu\n", - start_timeofday.tv_sec, start_timeofday.tv_usec); + fprintf(fstore, "# start_monotonic %llu.%09llu\n", + (__u64)start_monotonic.tv_sec, (__u64)start_monotonic.tv_nsec); + fprintf(fstore, "# start_timeofday %llu.%06llu\n", + (__u64)start_timeofday.tv_sec, (__u64)start_timeofday.tv_usec); fprintf(fstore, "# log_addr_mask 0x%04x\n", node.log_addr_mask); fprintf(fstore, "# phys_addr %x.%x.%x.%x\n", cec_phys_addr_exp(node.phys_addr)); @@ -984,10 +984,10 @@ static void monitor(const struct node &node, __u32 monitor_time, const char *sto */ clock_gettime(CLOCK_MONOTONIC, &start_monotonic); gettimeofday(&start_timeofday, nullptr); - fprintf(fstore, "# start_monotonic %lu.%09lu\n", - start_monotonic.tv_sec, start_monotonic.tv_nsec); - fprintf(fstore, "# start_timeofday %lu.%06lu\n", - start_timeofday.tv_sec, start_timeofday.tv_usec); + fprintf(fstore, "# start_monotonic %llu.%09llu\n", + (__u64)start_monotonic.tv_sec, (__u64)start_monotonic.tv_nsec); + fprintf(fstore, "# start_timeofday %llu.%06llu\n", + (__u64)start_timeofday.tv_sec, (__u64)start_timeofday.tv_usec); fflush(fstore); start_minute = now; } diff --git a/utils/cec-follower/cec-processing.cpp b/utils/cec-follower/cec-processing.cpp index 14ee211b..cd20df59 100644 --- a/utils/cec-follower/cec-processing.cpp +++ b/utils/cec-follower/cec-processing.cpp @@ -72,7 +72,7 @@ static std::string ts2s(__u64 ts, bool wallclock) t = res.tv_sec; s = ctime(&t); s = s.substr(0, s.length() - 6); - sprintf(buf, "%03lu", res.tv_usec / 1000); + sprintf(buf, "%03llu", (__u64)res.tv_usec / 1000); return s + "." + buf; }