Index | Thread | Search

From:
Jeremie Courreges-Anglas <jca@wxcvbn.org>
Subject:
Re: ITIMER names
To:
Jan Stary <hans@stare.cz>
Cc:
tech@openbsd.org
Date:
Sat, 27 Jun 2026 10:33:17 +0200

Download raw body.

Thread
  • Jan Stary:

    ITIMER names

    • Jeremie Courreges-Anglas:

      ITIMER names

On Fri, Jun 26, 2026 at 05:54:34PM +0200, Jan Stary wrote:
> The setitimer(2) manpage lists the #define's
> for the ITIMER_* names in the SYNOPSIS.
> 
> Is that intended?

I think it is.  Even though this practice isn't widespread in the base
system, a bunch of our manpages do the same.

> These are already defined in sys/time.h,
> and surely the caller is not supposed to #define them.

The caller isn't supposed to copy/paste the declarations for
getitimer(2) and setitimer(2) either, yet their declarations also are
provided in the SYNOPSIS.

> In fact, the caller should only use the names,
> described in detail in DESCRIPTION, right?

Yep.

I don't feel too strongly about removing the #defines, but I don't
find the current manpage confusing either. I could understand if
people wanted to drop the #defines from the manpage because they
hardcode a value that isn't portable and shouldn't be depended upon.
But I strongly doubt that it will actually help prevent people from
hardcoding stuff.

> 	Jan
> 
> 
> diff --git a/lib/libc/sys/getitimer.2 b/lib/libc/sys/getitimer.2
> index 1e1d25ddc28..fb305c8439c 100644
> --- a/lib/libc/sys/getitimer.2
> +++ b/lib/libc/sys/getitimer.2
> @@ -40,9 +40,6 @@
>  .Sh SYNOPSIS
>  .In sys/time.h
>  .Pp
> -.Fd #define ITIMER_REAL		0
> -.Fd #define ITIMER_VIRTUAL	1
> -.Fd #define ITIMER_PROF		2
>  .Ft int
>  .Fn getitimer "int which" "struct itimerval *value"
>  .Ft int
> 

-- 
jca