From nobody Sun May 3 15:35:32 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4g7pky2dhSz6W1vs for ; Sun, 03 May 2026 15:35:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4g7pky0pbyz3GrC for ; Sun, 03 May 2026 15:35:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1777822538; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZJ7QpZZTTDH5IxvPtWFHdeHVq9ngzYcvKi6wS4TjMKM=; b=huZHPyozyXtLmLsYlokmr9Fe4cOdG9P/Af4rsVt3DMNGSCIt+uto45HNagzKgqCBhYhHfO tsNEFOGYQhRzwneUVTEQRt2jP+jkvMX2P4NbJjXwPRTs3awfMXGZ82sSSNjgP/Phd9Kju6 21WpP3FscmTQR7mlB9Tq2t/8fX9dl7MgguuxpjpF8VkjEpkit8fdWJHTTkDDEO/Y24kCcz T+iq0OY9cYCEEe3cFUZi4i6A8AgLnxcInFTY/PhFKp77QnQmBpNPiQw7OjwJinyf6vIdQe AiueraMx6iSKEMgkDR6RkLjqPyeIXuKqUFzdTuMPGlwaXN2WQgZq9FQ1PKePgA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1777822538; a=rsa-sha256; cv=none; b=sZA6DR1LGjVr4Co+k4d/p+pRR3TpZAFsVZ8w5r8FY9bIPyP80uP5lC7/9PEWeBL3YSBJIZ eWNVxseX2hTAAW2xcoh+M92K07MWLb1QiygjByW6FWZA/QdW5fdgEQD4aRiUfl3SyABR5u cARw100MeM4jnjS0rTOlhOT2mrpGSgSqpDpHg8QJ90/090ZrRzgGqgh9ZU3Gxciwm5H5cm ZE2s3O0mCixqs1t+DJ5k9XBm15yKWfbhYiKz21gQ/UFmFbHR7gE95IraE4eIJ3tUbWK8qs oRu74e2JN1IWmpy7tcdUnhBZLYzazfXZePb6JAZgHTrpQddGy6zaAQF/y1LlTQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1777822538; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZJ7QpZZTTDH5IxvPtWFHdeHVq9ngzYcvKi6wS4TjMKM=; b=veGOI+LtBORBX6TFt49gu7T4LkxSY7US2zmTu6cgcd83qCqR+XZ3X8rjwNDrYSOjd+mpax 7WPE6Uj6flSOlvaY83rpFPNg8GmaBoHmH3AVxbLYzfDVhXdZoWsLJZ3jVtKKzAtNH7CQlu vrSbaNzTbnj3ajHM/oLeVB+Blk8c7vpT3Xvfhpm9YaJbzWlvq+U0KECASRJyG3QXUrbHCk dGzBf00j/r5umWoQBLKpvGygLePnLcmlCoKC448fk9oDGe+86b3I49Lx1qr3DWGuLMCKrN LbVF4UQqNUbiO5TcC2aSAe9DdlXHRpmfucgZPAmhWj7FOojxUZ1rA6P9aN+deQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4g7pky0H6DzfkS for ; Sun, 03 May 2026 15:35:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1d227 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 03 May 2026 15:35:32 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: 0095c1425633 - main - stat: Drop unused code and conditionals List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0095c1425633cb6a40fd86fc870ac5945363df2f Auto-Submitted: auto-generated Date: Sun, 03 May 2026 15:35:32 +0000 Message-Id: <69f76b44.1d227.39c3147f@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=0095c1425633cb6a40fd86fc870ac5945363df2f commit 0095c1425633cb6a40fd86fc870ac5945363df2f Author: Dag-Erling Smørgrav AuthorDate: 2026-05-03 15:35:06 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-05-03 15:35:06 +0000 stat: Drop unused code and conditionals We haven't pulled from upstream in over 15 years, and the codebases have diverged so far it is unlikely that we ever will. * Drop NetBSD and OpenBSD version control information. * Drop support for building on non-BSD / non-POSIX platforms. * Fix a few minor style issues. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D56771 --- usr.bin/stat/stat.c | 81 ++++++++--------------------------------------------- 1 file changed, 11 insertions(+), 70 deletions(-) diff --git a/usr.bin/stat/stat.c b/usr.bin/stat/stat.c index ad2b3f9fb3d1..0707c762d100 100644 --- a/usr.bin/stat/stat.c +++ b/usr.bin/stat/stat.c @@ -7,7 +7,7 @@ * This code is derived from software contributed to The NetBSD Foundation * by Andrew Brown. * - * Copyright (c) 2025 Klara, Inc. + * Copyright (c) 2025-2026 Klara, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -31,26 +31,9 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include -#if 0 -#ifndef lint -__RCSID("$NetBSD: stat.c,v 1.33 2011/01/15 22:54:10 njoly Exp $" -"$OpenBSD: stat.c,v 1.14 2009/06/24 09:44:25 sobrado Exp $"); -#endif -#endif -#if HAVE_CONFIG_H -#include "config.h" -#else /* HAVE_CONFIG_H */ -#define HAVE_STRUCT_STAT_ST_FLAGS 1 -#define HAVE_STRUCT_STAT_ST_GEN 1 -#define HAVE_STRUCT_STAT_ST_BIRTHTIME 1 -#define HAVE_STRUCT_STAT_ST_MTIMENSEC 1 -#define HAVE_DEVNAME 1 -#endif /* HAVE_CONFIG_H */ - #include -#include #include +#include #include #include @@ -68,44 +51,18 @@ __RCSID("$NetBSD: stat.c,v 1.33 2011/01/15 22:54:10 njoly Exp $" #include #include -#if HAVE_STRUCT_STAT_ST_FLAGS -#define DEF_F "%#Xf " -#define RAW_F "%f " -#define SHELL_F " st_flags=%f" -#else /* HAVE_STRUCT_STAT_ST_FLAGS */ -#define DEF_F -#define RAW_F -#define SHELL_F -#endif /* HAVE_STRUCT_STAT_ST_FLAGS */ - -#if HAVE_STRUCT_STAT_ST_BIRTHTIME -#define DEF_B "\"%SB\" " -#define RAW_B "%B " -#define SHELL_B "st_birthtime=%B " -#else /* HAVE_STRUCT_STAT_ST_BIRTHTIME */ -#define DEF_B -#define RAW_B -#define SHELL_B -#endif /* HAVE_STRUCT_STAT_ST_BIRTHTIME */ - -#if HAVE_STRUCT_STAT_ST_ATIM -#define st_atimespec st_atim -#define st_ctimespec st_ctim -#define st_mtimespec st_mtim -#endif /* HAVE_STRUCT_STAT_ST_ATIM */ - #define DEF_FORMAT \ - "%d %i %Sp %l %Su %Sg %r %z \"%Sa\" \"%Sm\" \"%Sc\" " DEF_B \ - "%k %b " DEF_F "%N" -#define RAW_FORMAT "%d %i %#p %l %u %g %r %z %a %m %c " RAW_B \ - "%k %b " RAW_F "%N" + "%d %i %Sp %l %Su %Sg %r %z \"%Sa\" \"%Sm\" \"%Sc\" \"%SB\" " \ + "%k %b %#Xf %N" +#define RAW_FORMAT "%d %i %#p %l %u %g %r %z %a %m %c %B " \ + "%k %b %f %N" #define LS_FORMAT "%Sp %l %Su %Sg %Z %Sm %N%SY" #define LSF_FORMAT "%Sp %l %Su %Sg %Z %Sm %N%T%SY" #define SHELL_FORMAT \ "st_dev=%d st_ino=%i st_mode=%#p st_nlink=%l " \ "st_uid=%u st_gid=%g st_rdev=%r st_size=%z " \ - "st_atime=%a st_mtime=%m st_ctime=%c " SHELL_B \ - "st_blksize=%k st_blocks=%b" SHELL_F + "st_atime=%a st_mtime=%m st_ctime=%c st_birthtime=%B " \ + "st_blksize=%k st_blocks=%b st_flags=%f" #define LINUX_FORMAT \ " File: \"%N\"%n" \ " Size: %-11z FileType: %HT%n" \ @@ -190,9 +147,7 @@ static int format1(const struct stat *, /* stat info */ int, int, int, int, /* the parsed format */ int, int); static int hex2byte(const char [2]); -#if HAVE_STRUCT_STAT_ST_FLAGS static char *xfflagstostr(unsigned long); -#endif static int fdlistholes(int, const char *); static int listholes(const char *); @@ -210,7 +165,7 @@ int main(int argc, char *argv[]) { struct stat st; - char dname[sizeof _PATH_DEV + SPECNAMELEN] = _PATH_DEV; + char dname[sizeof(_PATH_DEV) + SPECNAMELEN] = _PATH_DEV; const char *statfmt, *options, *synopsis; const char *file; fhandle_t fhnd; @@ -413,7 +368,6 @@ main(int argc, char *argv[]) return (am_readlink ? linkfail : errs); } -#if HAVE_STRUCT_STAT_ST_FLAGS /* * fflagstostr() wrapper that leaks only once */ @@ -430,7 +384,6 @@ xfflagstostr(unsigned long fflags) err(1, "fflagstostr"); return (str); } -#endif /* HAVE_STRUCT_STAT_ST_FLAGS */ static void usage(const char *synopsis) @@ -664,19 +617,17 @@ format1(const struct stat *st, case SHOW_st_dev: case SHOW_st_rdev: small = (sizeof(st->st_dev) == 4); - data = (what == SHOW_st_dev) ? st->st_dev : st->st_rdev; -#if HAVE_DEVNAME switch (what) { case SHOW_st_dev: + data = st->st_dev; dtype = S_IFCHR; break; case SHOW_st_rdev: + data = st->st_rdev; dtype = st->st_mode & (S_IFCHR | S_IFBLK); break; } - sdata = devname(data, dtype); -#endif /* HAVE_DEVNAME */ if (hilo == HIGH_PIECE) { data = major(data); hilo = 0; @@ -686,11 +637,7 @@ format1(const struct stat *st, hilo = 0; } formats = FMTF_DECIMAL | FMTF_OCTAL | FMTF_UNSIGNED | FMTF_HEX | -#if HAVE_DEVNAME FMTF_STRING; -#else /* HAVE_DEVNAME */ - 0; -#endif /* HAVE_DEVNAME */ if (ofmt == 0) ofmt = FMTF_UNSIGNED; break; @@ -779,11 +726,9 @@ format1(const struct stat *st, if (tsp == NULL) tsp = &st->st_ctimespec; /* FALLTHROUGH */ -#if HAVE_STRUCT_STAT_ST_BIRTHTIME case SHOW_st_btime: if (tsp == NULL) tsp = &st->st_birthtimespec; -#endif /* HAVE_STRUCT_STAT_ST_BIRTHTIME */ ts = *tsp; /* copy so we can muck with it */ small = (sizeof(ts.tv_sec) == 4); data = ts.tv_sec; @@ -824,7 +769,6 @@ format1(const struct stat *st, if (ofmt == 0) ofmt = FMTF_UNSIGNED; break; -#if HAVE_STRUCT_STAT_ST_FLAGS case SHOW_st_flags: small = (sizeof(st->st_flags) == 4); data = st->st_flags; @@ -836,8 +780,6 @@ format1(const struct stat *st, if (ofmt == 0) ofmt = FMTF_UNSIGNED; break; -#endif /* HAVE_STRUCT_STAT_ST_FLAGS */ -#if HAVE_STRUCT_STAT_ST_GEN case SHOW_st_gen: small = (sizeof(st->st_gen) == 4); data = st->st_gen; @@ -846,7 +788,6 @@ format1(const struct stat *st, if (ofmt == 0) ofmt = FMTF_UNSIGNED; break; -#endif /* HAVE_STRUCT_STAT_ST_GEN */ case SHOW_realpath: small = 0; data = 0;