Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Feb 2002 20:52:35 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        "Brian F. Feldman" <green@FreeBSD.org>
Cc:        Alfred Perlstein <bright@mu.org>, <bde@FreeBSD.org>, <arch@FreeBSD.org>
Subject:   Re: Do we want the _SYS_SYSPROTO_H_ junk? 
Message-ID:  <20020228202851.X52134-100000@gamplex.bde.org>
In-Reply-To: <200202272357.g1RNvjY46402@green.bikeshed.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 27 Feb 2002, Brian F. Feldman wrote:

> I want to know if, on new code, we should put them.  E.g.:
>
> #ifndef _SYS_SYSPROTO_H_
> struct open_args {
>         char    *path;
>         int     flags;
>         int     mode;
> };
> #endif
> int
> open(td, uap)
>         struct thread *td;
>         register struct open_args /* {
>                 syscallarg(char *) path;
>                 syscallarg(int) flags;
>                 syscallarg(int) mode;
>         } */ *uap;
> {
>
> The first part, if ever actually called into existence by sysproto.h not
> being included, would be bogus.  Do we want to keep introducing those?

The ifdef'ed version is better, if there is to be one at all, because it
can at least in theory be checked automatically (e.g., by not including
<sys/sysproto.h> so that the struct is not declared, but somehow declare
the function anyway; then compile and check if the compile worked and
gave the same result).

The second pseudo-declaration of the struct in the comment is bogus.  I
removed the comment globally when I implemented <sys/sysproto.h>, but it
came back in a few files in the Lite2 merge.

Both versions are really just comments.  It can be hard to remember what
is in *uap without them.  Automatic checking for the ifdefed version would
just check the consistency of the comments.  Wrong comments for simple
things are worse than no comments.

The same few files that have syscallarg() in comments also have SCARG()
in code.  We don't really use either syscallarg() or SCARG().  We just
require the MD code to arrange the struct so that ordinary struct member
references work right.  I would prefer the MD code to push the struct
members onto the stack so that no args structs or pseudo-declarations
of them are required.

I would keep introducing the ifdefed version of the struct while there
is still an args struct.

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020228202851.X52134-100000>