OK, no problem it just looked strange when reading the code as most
definitions in that file don't have them.

btw) I'm by now way more puzzled why this file has a function to create a pipe

struct pipe_pair *pipe_pair_create(void);

but lacks a corresponding destroy function. This makes it look like
the pipes created as a pipe_pair don't get properly destroyed, but my C
is rusty.

On Sat, 14 Nov 2020 at 18:21, Theo de Raadt <dera...@openbsd.org> wrote:
>
> I don't see the point of this.
>
> Yes, style(9) says don't do that.  It is because of cpp issues.
> It definately matters for userland-exposed definitions.
>
> But the kernel is largely immune to this concern, even in .h files
> Sice this is on one file, it matters even less since nothing in
> any .h file will define kn, fp, p, or ub.
>
> In the meantime, this provides a stronger understanding for the
> programmer working *in this file*
>
> Standing back further, how did this happen?  Someone felt more
> comfortable leaving the names there when cloning the definitions
> from the actual function start.  I don't think that is dangerous.
>
> In summary, I think the style(9) advice has't place, and that
> place isn't everywhere, or C itself would have made naming of
> prototype arguments illegal to cover for the risk of cpp confusion.
>
>
>
> henkjan gersen <h.ger...@gmail.com> wrote:
>
> > Patch below removes a couple of variable names from function prototypes
> > in sys_pipe.c to match style(9)
> >
> > ---
> > diff --git sys/kern/sys_pipe.c sys/kern/sys_pipe.c
> > index 04ec907d21f..85e69af7741 100644
> > --- sys/kern/sys_pipe.c
> > +++ sys/kern/sys_pipe.c
> > @@ -62,9 +62,9 @@ int   pipe_read(struct file *, struct uio *, int);
> >  int    pipe_write(struct file *, struct uio *, int);
> >  int    pipe_close(struct file *, struct proc *);
> >  int    pipe_poll(struct file *, int events, struct proc *);
> > -int    pipe_kqfilter(struct file *fp, struct knote *kn);
> > +int    pipe_kqfilter(struct file *, struct knote *);
> >  int    pipe_ioctl(struct file *, u_long, caddr_t, struct proc *);
> > -int    pipe_stat(struct file *fp, struct stat *ub, struct proc *p);
> > +int    pipe_stat(struct file *, struct stat *, struct proc *);
> >
> >  static const struct fileops pipeops = {
> >         .fo_read        = pipe_read,
> > @@ -76,9 +76,9 @@ static const struct fileops pipeops = {
> >         .fo_close       = pipe_close
> >  };
> >
> > -void   filt_pipedetach(struct knote *kn);
> > -int    filt_piperead(struct knote *kn, long hint);
> > -int    filt_pipewrite(struct knote *kn, long hint);
> > +void   filt_pipedetach(struct knote *);
> > +int    filt_piperead(struct knote *, long);
> > +int    filt_pipewrite(struct knote *, long);
> >
> >  const struct filterops pipe_rfiltops = {
> >         .f_flags        = FILTEROP_ISFD,
> >

Reply via email to