NetBSD Problem Report #59162

From www@netbsd.org  Sun Mar  9 17:32:55 2025
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits)
	 client-signature RSA-PSS (2048 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 5960E1A9239
	for <gnats-bugs@gnats.NetBSD.org>; Sun,  9 Mar 2025 17:32:55 +0000 (UTC)
Message-Id: <20250309173254.2E4681A923C@mollari.NetBSD.org>
Date: Sun,  9 Mar 2025 17:32:54 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: statvfs(5) man page gives wrong/unusable declaration of fsid_t
X-Send-Pr-Version: www-1.0

>Number:         59162
>Category:       kern
>Synopsis:       statvfs(5) man page gives wrong/unusable declaration of fsid_t
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 09 17:35:00 +0000 2025
>Originator:     Taylor R Campbell
>Release:        current, 10, 9, ...
>Organization:
The StatVFS Identification
>Environment:
>Description:
The statvfs(5) man page says:

     typedef struct { int32_t val[2]; } fsid_t;      /* file system id type */
...
     struct statvfs {
...
             unsigned long   f_fsid;   /* POSIX compliant file system id */
             fsid_t          f_fsidx;  /* NetBSD compatible file system id */
...

But this is not correct.  The header file actually defines:

/* sys/fstypes.h */
typedef struct { int32_t __fsid_val[2]; } fsid_t; /* file system id type */
>How-To-Repeat:
$ cat foo.c
#include <sys/statvfs.h>
int foo(struct statvfs *f) { return f->f_fsidx.val[0]; }
$ make foo.o
cc -O2   -c foo.c
foo.c: In function ‘foo’:
foo.c:2:47: error: ‘fsid_t {aka struct <anonymous>}’ has no member named ‘val’
 int foo(struct statvfs *f) { return f->f_fsidx.val[0]; }
                                               ^
*** Error code 1

Stop.
make: stopped in /tmp/riastradh

>Fix:
Yes, please!

Not sure __fsid_val is actually meant to be a public member name.  But `#define val ...' is surely asking for trouble, and I'm not sure why it was called __fsid_val.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2025 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.