From dwc@sac.sfbay.sun.com Mon Jun  9 09:21:45 2008
Received: from newsunmail1brm.central.sun.com (newsunmail1brm.Central.Sun.COM [129.147.62.245])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id m59GLjua007324
	for <psarc-ext@sac.sfbay.sun.com>; Mon, 9 Jun 2008 09:21:45 -0700 (PDT)
Received: from nwk-avmta-2.sfbay.sun.com (nwk-avmta-2.SFBay.Sun.COM [129.145.155.6])
	by newsunmail1brm.central.sun.com (8.13.7+Sun/8.13.7/ENSMAIL,v2.2) with ESMTP id m59GLhjM055358;
	Mon, 9 Jun 2008 10:21:44 -0600 (MDT)
Received: from pmxchannel-daemon.nwk-avmta-2.sfbay.sun.com by
 nwk-avmta-2.sfbay.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0K2700J1NES8ON00@nwk-avmta-2.sfbay.sun.com>; Mon,
 09 Jun 2008 09:21:44 -0700 (PDT)
Received: from dm-sfbay-02.sfbay.sun.com ([129.146.11.31])
 by nwk-avmta-2.sfbay.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0K2700J29ES71X10@nwk-avmta-2.sfbay.sun.com>; Mon,
 09 Jun 2008 09:21:43 -0700 (PDT)
Received: from sac.sfbay.sun.com (new-sac.SFBay.Sun.COM [129.146.175.65])
	by dm-sfbay-02.sfbay.sun.com (8.13.8+Sun/8.13.8/ENSMAIL,v2.2)
 with ESMTP id m59GLh94002143; Mon, 09 Jun 2008 09:21:43 -0700 (PDT)
Received: from sac.sfbay.sun.com (localhost [127.0.0.1])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id m59GLfnO007319; Mon,
 09 Jun 2008 09:21:41 -0700 (PDT)
Received: (from dwc@localhost)	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8/Submit)
 id m59GLft6007315; Mon, 09 Jun 2008 09:21:41 -0700 (PDT)
Date: Mon, 09 Jun 2008 09:21:41 -0700 (PDT)
From: Don Cragun <don.cragun@sun.com>
Subject: Add timeradd() and timersub() to <sys/time.h>. [PSARC/2008/368
 FastTrack timeout 06/16/2008]
To: PSARC-ext@sun.com
Cc: Dan.McDonald@sun.com
Message-id: <200806091621.m59GLft6007315@sac.sfbay.sun.com>
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
Status: RO
Content-Length: 3400


Template Version: @(#)sac_nextcase 1.66 04/17/08 SMI
This information is Copyright 2008 Sun Microsystems
1. Introduction
    1.1. Project/Component Working Name:
	 Add timeradd() and timersub() to <sys/time.h>.
    1.2. Name of Document Author/Supplier:
	 Author:  Dan McDonald
    1.3  Date of This Document:
	09 June, 2008
4. Technical Description
We propose the addition of two macros in sys/time.h commonly found in
BSD and Linux systems -- timeradd() and timersub() -- and the
documentation of both these AND the existing timerisset(),
timerclear(), and timercmp() functions.

The proposed interface taxonomy is "Committed", and the proposed
release binding is Micro/Patch.

A draft man page for these functions is in the case's materials
directory and is included here:

Standard C Library Functions				timeradd(3C)

NAME
     timeradd, timersub, timerclear, timerisset, timercmp -- operations on
     timeval structures

SYNOPSIS
     #include <sys/time.h>

     void
     timeradd(struct timeval *a, struct timeval *b, struct timeval *res);

     void
     timerclear(struct timeval *tvp);

     int
     timercmp(struct timeval *a, struct timeval *b, CMP);

     int
     timerisset(struct timeval *tvp);

     void
     timersub(struct timeval *a, struct timeval *b, struct timeval *res);

DESCRIPTION
     These macros are provided for manipulating timeval structures for use
     with gettimeofday() and settimeofday() operands.  The structure is
     defined in <sys/time.h> as:

     struct timeval {
	     long    tv_sec;	     /* seconds since Jan. 1, 1970 */
	     long    tv_usec;	     /* and microseconds */
     };

     timeradd() adds the time information stored in a to b and stores the
     resulting timeval in res.	The results are simplified such that the value
     of res->tv_usec is always less than 1,000,000 (1 second).

     timersub() subtracts the time information stored in b from a and stores
     the resulting timeval in res.

     timerclear() initializes tvp to midnight (0 hour) January 1st, 1970 (the
     Epoch).

     timerisset() returns true if tvp is set to any time value other than the
     Epoch.

     timercmp() compares a to b using the form a CMP b, where CMP is one of
     <, <=, ==, !=, >=, or >.

SEE ALSO
     gettimeofday(3C)

USAGE

     These macros are not available in function form.  All of these macros
     evaulate their arguments more than once.  If parameters passed to these
     macros are expressions with side effects, the results are undefined.

     lint will complain about a constant conditional for timeradd() and
     timersub().  Use of the /* LINTED */ comment before timeradd() or
     timersub() is recommended.

ATTRIBUTES

     ____________________________________________________________
    |       ATTRIBUTE TYPE        |       ATTRIBUTE VALUE       |
    |_____________________________|_____________________________|
    | Interface Stability         | These macros are Committed. |
    |_____________________________|_____________________________|
    | MT-Level                    | MT-Safe with Exceptions     |
    |				  | (See USAGE about arguments) |
    |_____________________________|_____________________________|


6. Resources and Schedule
    6.4. Steering Committee requested information
   	6.4.1. Consolidation C-team Name:
		ON
    6.5. ARC review type: FastTrack
    6.6. ARC Exposure: open


From gdamore@Sun.COM Mon Jun  9 09:44:18 2008
Received: from newsunmail1brm.central.sun.com (newsunmail1brm.Central.Sun.COM [129.147.62.245])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id m59GiIBk008265
	for <psarc-ext@sac.sfbay.sun.com>; Mon, 9 Jun 2008 09:44:18 -0700 (PDT)
Received: from nwk-avmta-1.SFBay.Sun.COM (nwk-avmta-1.SFBay.Sun.COM [129.146.11.74])
	by newsunmail1brm.central.sun.com (8.13.7+Sun/8.13.7/ENSMAIL,v2.2) with ESMTP id m59GiHUc064752;
	Mon, 9 Jun 2008 10:44:17 -0600 (MDT)
Received: from pmxchannel-daemon.nwk-avmta-1.sfbay.Sun.COM by
 nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0K2700H07FTRL500@nwk-avmta-1.sfbay.Sun.COM>; Mon,
 09 Jun 2008 09:44:15 -0700 (PDT)
Received: from sca-es-mail-2.sun.com ([192.18.43.133])
 by nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0K27007EHFTQJMC0@nwk-avmta-1.sfbay.Sun.COM>; Mon,
 09 Jun 2008 09:44:14 -0700 (PDT)
Received: from fe-sfbay-10.sun.com ([192.18.43.129])
	by sca-es-mail-2.sun.com (8.13.7+Sun/8.12.9) with ESMTP id m59GiEWt025093;
 Mon, 09 Jun 2008 09:44:14 -0700 (PDT)
Received: from conversion-daemon.fe-sfbay-10.sun.com by fe-sfbay-10.sun.com
 (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007))
 id <0K2700301FKN9G00@fe-sfbay-10.sun.com> (original mail from gdamore@sun.com)
 ; Mon, 09 Jun 2008 09:44:14 -0700 (PDT)
Received: from [192.168.251.106] ([76.174.83.55])
 by fe-sfbay-10.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb
 28 2007)) with ESMTPSA id <0K27006ZWFTESID0@fe-sfbay-10.sun.com>; Mon,
 09 Jun 2008 09:44:02 -0700 (PDT)
Date: Mon, 09 Jun 2008 09:43:14 -0700
From: "Garrett D'Amore" <gdamore@Sun.COM>
Subject: Re: Add timeradd() and timersub() to <sys/time.h>. [PSARC/2008/368
 FastTrack timeout 06/16/2008]
In-reply-to: <200806091621.m59GLft6007315@sac.sfbay.sun.com>
Sender: Garrett.Damore@Sun.COM
To: Don Cragun <don.cragun@Sun.COM>
Cc: PSARC-ext@Sun.COM, Dan.McDonald@Sun.COM
Message-id: <484D5DA2.5070508@sun.com>
MIME-version: 1.0
Content-type: text/plain; format=flowed; charset=ISO-8859-1
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
References: <200806091621.m59GLft6007315@sac.sfbay.sun.com>
User-Agent: Thunderbird 2.0.0.6 (X11/20071023)
Status: RO
Content-Length: 5063

Mostly looks good.  A few quick questions:

     lint will complain about a constant conditional for timeradd() and
     timersub().  Use of the /* LINTED */ comment before timeradd() or
     timersub() is recommended.


Can't this be rectified in the header by use of #ifdef lint and some 
special lint-only version of the macros?  I particularly dislike the 
cases where system headers (or system-supplied macros) make lint harder 
to use.

Are macros the best way to add these?  As opposed to inline functions or 
somesuch?  (In particular, do we know if the other systems -- Linux and 
FreeBSD -- all implement these as macros?)  The various caveats with 
macros tend to make me want to shy away from their use in system 
headers, particularly where the intended consumers are the larger 
audience of general programmers.  But if that's the way they are 
implemented everywhere else, then I suppose it won't hurt too badly to 
have them implemented as such as here.

Are there any #define's to conditionally enable or disable these being 
added to the namespace?  (I'm thinking along the lines of dialect 
options that the C compiler exports, e.g. __STDC__, _POSIX_C_SOURCE, and 
__EXTENSIONS__.)

The other question (and this is just general, not architectural in 
nature) is, given that these functions seem to be widely useful and 
popular, are you aware of any movement in any of the standards bodies 
(POSIX) to standardize on these?

    -- Garrett

Don Cragun wrote:
> Template Version: @(#)sac_nextcase 1.66 04/17/08 SMI
> This information is Copyright 2008 Sun Microsystems
> 1. Introduction
>     1.1. Project/Component Working Name:
> 	 Add timeradd() and timersub() to <sys/time.h>.
>     1.2. Name of Document Author/Supplier:
> 	 Author:  Dan McDonald
>     1.3  Date of This Document:
> 	09 June, 2008
> 4. Technical Description
> We propose the addition of two macros in sys/time.h commonly found in
> BSD and Linux systems -- timeradd() and timersub() -- and the
> documentation of both these AND the existing timerisset(),
> timerclear(), and timercmp() functions.
>
> The proposed interface taxonomy is "Committed", and the proposed
> release binding is Micro/Patch.
>
> A draft man page for these functions is in the case's materials
> directory and is included here:
>
> Standard C Library Functions				timeradd(3C)
>
> NAME
>      timeradd, timersub, timerclear, timerisset, timercmp -- operations on
>      timeval structures
>
> SYNOPSIS
>      #include <sys/time.h>
>
>      void
>      timeradd(struct timeval *a, struct timeval *b, struct timeval *res);
>
>      void
>      timerclear(struct timeval *tvp);
>
>      int
>      timercmp(struct timeval *a, struct timeval *b, CMP);
>
>      int
>      timerisset(struct timeval *tvp);
>
>      void
>      timersub(struct timeval *a, struct timeval *b, struct timeval *res);
>
> DESCRIPTION
>      These macros are provided for manipulating timeval structures for use
>      with gettimeofday() and settimeofday() operands.  The structure is
>      defined in <sys/time.h> as:
>
>      struct timeval {
> 	     long    tv_sec;	     /* seconds since Jan. 1, 1970 */
> 	     long    tv_usec;	     /* and microseconds */
>      };
>
>      timeradd() adds the time information stored in a to b and stores the
>      resulting timeval in res.	The results are simplified such that the value
>      of res->tv_usec is always less than 1,000,000 (1 second).
>
>      timersub() subtracts the time information stored in b from a and stores
>      the resulting timeval in res.
>
>      timerclear() initializes tvp to midnight (0 hour) January 1st, 1970 (the
>      Epoch).
>
>      timerisset() returns true if tvp is set to any time value other than the
>      Epoch.
>
>      timercmp() compares a to b using the form a CMP b, where CMP is one of
>      <, <=, ==, !=, >=, or >.
>
> SEE ALSO
>      gettimeofday(3C)
>
> USAGE
>
>      These macros are not available in function form.  All of these macros
>      evaulate their arguments more than once.  If parameters passed to these
>      macros are expressions with side effects, the results are undefined.
>
>      lint will complain about a constant conditional for timeradd() and
>      timersub().  Use of the /* LINTED */ comment before timeradd() or
>      timersub() is recommended.
>
> ATTRIBUTES
>
>      ____________________________________________________________
>     |       ATTRIBUTE TYPE        |       ATTRIBUTE VALUE       |
>     |_____________________________|_____________________________|
>     | Interface Stability         | These macros are Committed. |
>     |_____________________________|_____________________________|
>     | MT-Level                    | MT-Safe with Exceptions     |
>     |				  | (See USAGE about arguments) |
>     |_____________________________|_____________________________|
>
>
> 6. Resources and Schedule
>     6.4. Steering Committee requested information
>    	6.4.1. Consolidation C-team Name:
> 		ON
>     6.5. ARC review type: FastTrack
>     6.6. ARC Exposure: open
>
>   


From danmcd@sun.com Mon Jun  9 09:47:46 2008
Received: from sunmail4.singapore.sun.com (sunmail4.Singapore.Sun.COM [129.158.71.19])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id m59GljlD008471
	for <psarc-ext@sac.sfbay.Sun.COM>; Mon, 9 Jun 2008 09:47:46 -0700 (PDT)
Received: from nwk-avmta-1.SFBay.Sun.COM (nwk-avmta-1.SFBay.Sun.COM [129.146.11.74])
	by sunmail4.singapore.sun.com (8.13.4+Sun/8.13.3/ENSMAIL,v2.2) with ESMTP id m59GlWuL001713;
	Tue, 10 Jun 2008 00:47:41 +0800 (SGT)
Received: from pmxchannel-daemon.nwk-avmta-1.sfbay.Sun.COM by
 nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0K2700H01FZGXK00@nwk-avmta-1.sfbay.Sun.COM>; Mon,
 09 Jun 2008 09:47:40 -0700 (PDT)
Received: from everywhere.east.sun.com ([10.7.251.255])
 by nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0K27007XRFZFJMC0@nwk-avmta-1.sfbay.Sun.COM>; Mon,
 09 Jun 2008 09:47:39 -0700 (PDT)
Received: from everywhere.east.sun.com (localhost [127.0.0.1])
	by everywhere.east.sun.com (8.14.2+Sun/8.14.2) with ESMTP id m59GlcEL027840;
 Mon, 09 Jun 2008 12:47:38 -0400 (EDT)
Received: (from danmcd@localhost)	by everywhere.east.sun.com
 (8.14.2+Sun/8.14.2/Submit) id m59GlcrX027839; Mon,
 09 Jun 2008 12:47:38 -0400 (EDT)
Date: Mon, 09 Jun 2008 12:47:38 -0400
From: Dan McDonald <danmcd@sun.com>
Subject: Re: Add timeradd() and timersub() to <sys/time.h>. [PSARC/2008/368
	FastTrack timeout 06/16/2008]
In-reply-to: <484D5DA2.5070508@sun.com>
To: "Garrett D'Amore" <gdamore@sun.com>
Cc: Don Cragun <don.cragun@sun.com>, PSARC-ext@sun.com, Dan.McDonald@sun.com
Message-id: <20080609164738.GF21644@sun.com>
Organization: Sun Microsystems, Inc. - Solaris Networking & Security
MIME-version: 1.0
Content-type: text/plain; charset=us-ascii
Content-transfer-encoding: 7BIT
Content-disposition: inline
X-PMX-Version: 5.4.1.325704
References: <200806091621.m59GLft6007315@sac.sfbay.sun.com>
 <484D5DA2.5070508@sun.com>
X-Authentication-warning: everywhere.east.sun.com: danmcd set sender to
 danmcd@sun.com using -f
User-Agent: Mutt/1.5.17 (2007-11-01)
Status: RO
Content-Length: 1961

On Mon, Jun 09, 2008 at 09:43:14AM -0700, Garrett D'Amore wrote:
> Mostly looks good.  A few quick questions:
>
>     lint will complain about a constant conditional for timeradd() and
>     timersub().  Use of the /* LINTED */ comment before timeradd() or
>     timersub() is recommended.
>
> Can't this be rectified in the header by use of #ifdef lint and some special 
> lint-only version of the macros?  I particularly dislike the cases where 
> system headers (or system-supplied macros) make lint harder to use.

#ifdef lint seems to be the most expedient solution to the problem.

> Are macros the best way to add these?  As opposed to inline functions or 
> somesuch?  (In particular, do we know if the other systems -- Linux and 
> FreeBSD -- all implement these as macros?)

*BSD still has 'em as macros.  Not sure about Linux -- feel free to look,
though.

> The various caveats with macros tend to make me want to shy away from their
> use in system headers, particularly where the intended consumers are the
> larger audience of general programmers.  But if that's the way they are
> implemented everywhere else, then I suppose it won't hurt too badly to have
> them implemented as such as here.

I know for sure they're in BSD as macros.

> Are there any #define's to conditionally enable or disable these being
> added to the namespace?  (I'm thinking along the lines of dialect options
> that the C compiler exports, e.g. __STDC__, _POSIX_C_SOURCE, and
> __EXTENSIONS__.)

That's why I went to Don Cragun first.

Three of the five documented were ALREADY IN sys/time.h.  The two new ones
(timeradd/timersub) are in the same blocked areas as the first three.

> The other question (and this is just general, not architectural in nature)
> is, given that these functions seem to be widely useful and popular, are
> you aware of any movement in any of the standards bodies (POSIX) to
> standardize on these?

Ask Don -- that's his department.

Dan

From carlsonj@phorcys.east.sun.com Mon Jun  9 09:49:52 2008
Received: from sunmail5.uk.sun.com (sunmail5.UK.Sun.COM [129.156.85.165])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id m59GnpFE008572
	for <psarc-ext@sac.sfbay.sun.com>; Mon, 9 Jun 2008 09:49:51 -0700 (PDT)
Received: from nwk-avmta-2.sfbay.sun.com (nwk-avmta-2.SFBay.Sun.COM [129.145.155.6])
	by sunmail5.uk.sun.com (8.13.8+Sun/8.13.8/ENSMAIL,v2.2) with ESMTP id m59GnjVu013875;
	Mon, 9 Jun 2008 17:49:48 +0100 (BST)
Received: from pmxchannel-daemon.nwk-avmta-2.sfbay.sun.com by
 nwk-avmta-2.sfbay.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0K2700K0TG2YZN00@nwk-avmta-2.sfbay.sun.com>; Mon,
 09 Jun 2008 09:49:46 -0700 (PDT)
Received: from phorcys.east.sun.com ([129.148.174.143])
 by nwk-avmta-2.sfbay.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0K2700J49G2W2120@nwk-avmta-2.sfbay.sun.com>; Mon,
 09 Jun 2008 09:49:45 -0700 (PDT)
Received: from phorcys.east.sun.com (localhost [127.0.0.1])
	by phorcys.east.sun.com (8.14.3+Sun/8.14.3) with ESMTP id m59Gni9x020823; Mon,
 09 Jun 2008 12:49:44 -0400 (EDT)
Received: (from carlsonj@localhost)
	by phorcys.east.sun.com (8.14.3+Sun/8.14.3/Submit) id m59Gni3s020820; Mon,
 09 Jun 2008 12:49:44 -0400 (EDT)
Date: Mon, 09 Jun 2008 12:49:44 -0400
From: James Carlson <james.d.carlson@sun.com>
Subject: Re: Add timeradd() and timersub() to <sys/time.h>. [PSARC/2008/368
 FastTrack timeout 06/16/2008]
In-reply-to: <200806091621.m59GLft6007315@sac.sfbay.sun.com>
To: Don Cragun <don.cragun@sun.com>
Cc: PSARC-ext@sun.com, Dan.McDonald@sun.com
Message-id: <18509.24360.701840.849143@gargle.gargle.HOWL>
MIME-version: 1.0
X-Mailer: VM 7.01 under Emacs 21.3.1
Content-type: text/plain; charset=us-ascii
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
References: <200806091621.m59GLft6007315@sac.sfbay.sun.com>
Status: RO
Content-Length: 1318

Don Cragun writes:
>      void
>      timeradd(struct timeval *a, struct timeval *b, struct timeval *res);
[...]
>      int
>      timercmp(struct timeval *a, struct timeval *b, CMP);
> 
>      int
>      timerisset(struct timeval *tvp);
> 
>      void
>      timersub(struct timeval *a, struct timeval *b, struct timeval *res);

It'd be nice to be able to make 'a', 'b', and 'tvp' const.

(Man, that "CMP" thing sure is evil ...)

>      These macros are not available in function form.  All of these macros
>      evaulate their arguments more than once.  If parameters passed to these
>      macros are expressions with side effects, the results are undefined.

Except for timercmp, where the issue is obvious, it's unclear to me
why the others must be defined as function-like macros, especially as
ones with hidden side-effect warts.

>      lint will complain about a constant conditional for timeradd() and
>      timersub().  Use of the /* LINTED */ comment before timeradd() or
>      timersub() is recommended.

Ick.  Is there no way to fix that rather than just documenting it away?

-- 
James Carlson, Solaris Networking              <james.d.carlson@sun.com>
Sun Microsystems / 35 Network Drive        71.232W   Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757   42.496N   Fax +1 781 442 1677

From dwc@spartan.eng.sun.com Mon Jun  9 10:12:39 2008
Received: from sunmail5.uk.sun.com (sunmail5.UK.Sun.COM [129.156.85.165])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id m59HCdDR009221
	for <psarc-ext@sac.sfbay.sun.com>; Mon, 9 Jun 2008 10:12:39 -0700 (PDT)
Received: from nwk-avmta-1.SFBay.Sun.COM (nwk-avmta-1.SFBay.Sun.COM [129.146.11.74])
	by sunmail5.uk.sun.com (8.13.8+Sun/8.13.8/ENSMAIL,v2.2) with ESMTP id m59HCVSV025712;
	Mon, 9 Jun 2008 18:12:37 +0100 (BST)
Received: from pmxchannel-daemon.nwk-avmta-1.sfbay.Sun.COM by
 nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0K2700K0LH4ZEU00@nwk-avmta-1.sfbay.Sun.COM>; Mon,
 09 Jun 2008 10:12:35 -0700 (PDT)
Received: from dm-eng-02.sfbay.sun.com ([129.146.11.32])
 by nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0K2700769H4YJMF0@nwk-avmta-1.sfbay.Sun.COM>; Mon,
 09 Jun 2008 10:12:34 -0700 (PDT)
Received: from spartan.eng.sun.com (spartan.SFBay.Sun.COM [129.146.226.64])
	by dm-eng-02.sfbay.sun.com (8.13.8+Sun/8.13.8/ENSMAIL,v2.2)
 with ESMTP id m59HCXC8040640; Mon, 09 Jun 2008 10:12:33 -0700 (PDT)
Received: from spartan.eng.sun.com (localhost [127.0.0.1])
	by spartan.eng.sun.com (8.13.7+Sun/8.13.7) with ESMTP id m59H540n002701; Mon,
 09 Jun 2008 10:05:04 -0700 (PDT)
Received: (from dwc@localhost)
	by spartan.eng.sun.com (8.13.7+Sun/8.13.7/Submit) id m59H54IB002700; Mon,
 09 Jun 2008 10:05:04 -0700 (PDT)
Date: Mon, 09 Jun 2008 10:05:04 -0700 (PDT)
From: Don Cragun <don.cragun@sun.com>
Subject: Re: Add timeradd() and timersub() to <sys/time.h>. [PSARC/2008/368
 FastTrack timeout 06/16/2008]
To: gdamore@sun.com
Cc: Dan.McDonald@sun.com, PSARC-ext@sun.com
Message-id: <200806091705.m59H54IB002700@spartan.eng.sun.com>
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
Status: RO
Content-Length: 1311

>Date: Mon, 09 Jun 2008 12:47:38 -0400
>From: Dan McDonald <danmcd@sun.com>
>
 ... ... ...
>
>> Are there any #define's to conditionally enable or disable these being
>> added to the namespace?  (I'm thinking along the lines of dialect options
>> that the C compiler exports, e.g. __STDC__, _POSIX_C_SOURCE, and
>> __EXTENSIONS__.)
>
>That's why I went to Don Cragun first.
>
>Three of the five documented were ALREADY IN sys/time.h.  The two new ones
>(timeradd/timersub) are in the same blocked areas as the first three.

Just like other non-standard functions and macros in standard headers,
these macros are invisible in standards conforming compiles unless the
application asks for a polluted namespace by #defining __EXTENSIONS__
before including <sys/time.h>.

>
>> The other question (and this is just general, not architectural in nature)
>> is, given that these functions seem to be widely useful and popular, are
>> you aware of any movement in any of the standards bodies (POSIX) to
>> standardize on these?
>
>Ask Don -- that's his department.

No requests to include any of these macros have been sent to the TOG
Base Working Group, IEEE PASC, ISO/IEC/JTC1/SC22/WG15, or The Austin
Group e-mail aliases nor through the interpretations processes at any
of these four organizations.

 - Don

>
>Dan

From bart.smaalders@sun.com Mon Jun  9 11:17:03 2008
Received: from sunmail4.singapore.sun.com (sunmail4.Singapore.Sun.COM [129.158.71.19])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id m59IH2K0013123
	for <psarc-ext@sac.sfbay.Sun.COM>; Mon, 9 Jun 2008 11:17:02 -0700 (PDT)
Received: from nwk-avmta-2.sfbay.sun.com (nwk-avmta-2.SFBay.Sun.COM [129.145.155.6])
	by sunmail4.singapore.sun.com (8.13.4+Sun/8.13.3/ENSMAIL,v2.2) with ESMTP id m59IGr15006070;
	Tue, 10 Jun 2008 02:16:57 +0800 (SGT)
Received: from pmxchannel-daemon.nwk-avmta-2.sfbay.sun.com by
 nwk-avmta-2.sfbay.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0K270001BK48YG00@nwk-avmta-2.sfbay.sun.com>; Mon,
 09 Jun 2008 11:16:56 -0700 (PDT)
Received: from zion.sfbay.sun.com ([129.146.17.75])
 by nwk-avmta-2.sfbay.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0K2700JRYK472B70@nwk-avmta-2.sfbay.sun.com>; Mon,
 09 Jun 2008 11:16:55 -0700 (PDT)
Received: from [129.146.228.109] (cyber.SFBay.Sun.COM [129.146.228.109])
	by zion.sfbay.sun.com (8.14.2+Sun/8.14.2) with ESMTP id m59IGtih028073; Mon,
 09 Jun 2008 18:16:55 +0000 (GMT)
Date: Mon, 09 Jun 2008 11:16:55 -0700
From: Bart Smaalders <bart.smaalders@sun.com>
Subject: Re: Add timeradd() and timersub() to <sys/time.h>. [PSARC/2008/368
 FastTrack timeout 06/16/2008]
In-reply-to: <18509.24360.701840.849143@gargle.gargle.HOWL>
To: James Carlson <James.D.Carlson@sun.com>
Cc: Don Cragun <don.cragun@sun.com>, PSARC-ext@sun.com, Dan.McDonald@sun.com
Message-id: <484D7397.6050808@Sun.COM>
Organization: Sun Microsystems
MIME-version: 1.0
Content-type: text/plain; charset=ISO-8859-1; format=flowed
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
References: <200806091621.m59GLft6007315@sac.sfbay.sun.com>
 <18509.24360.701840.849143@gargle.gargle.HOWL>
User-Agent: Thunderbird 2.0.0.14 (X11/20080507)
Status: RO
Content-Length: 1932

James Carlson wrote:
> Don Cragun writes:
>>      void
>>      timeradd(struct timeval *a, struct timeval *b, struct timeval *res);
> [...]
>>      int
>>      timercmp(struct timeval *a, struct timeval *b, CMP);
>>
>>      int
>>      timerisset(struct timeval *tvp);
>>
>>      void
>>      timersub(struct timeval *a, struct timeval *b, struct timeval *res);
> 
> It'd be nice to be able to make 'a', 'b', and 'tvp' const.
> 
> (Man, that "CMP" thing sure is evil ...)
> 
>>      These macros are not available in function form.  All of these macros
>>      evaulate their arguments more than once.  If parameters passed to these
>>      macros are expressions with side effects, the results are undefined.
> 
> Except for timercmp, where the issue is obvious, it's unclear to me
> why the others must be defined as function-like macros, especially as
> ones with hidden side-effect warts.
> 

#define timerclear(t) { struct timeval *a = (t); a->tv_sec = a->tv_usec 
= 0; }

seems to be a reasonable fix.

>>      lint will complain about a constant conditional for timeradd() and
>>      timersub().  Use of the /* LINTED */ comment before timeradd() or
>>      timersub() is recommended.
> 
> Ick.  Is there no way to fix that rather than just documenting it away?
> 

As above:

#define timeradd(i1, i2, o1)                            \
{ struct timeval *a = i1, *b = i2, *result = o1;        \
   result->tv_sec = a->tv_sec + b->tv_sec;               \
   result->tv_usec = a->tv_usec + b->tv_usec;            \
   if (result->tv_usec >= 1000000) {                     \
         ++result->tv_sec;                               \
         result->tv_usec -= 1000000;                      \
   }                                                     \
}

- Bart

-- 
Bart Smaalders			Solaris Kernel Performance
barts@cyber.eng.sun.com		http://blogs.sun.com/barts
"You will contribute more with mercurial than with thunderbird."

From danmcd@sun.com Mon Jun  9 11:20:04 2008
Received: from sunmail5.uk.sun.com (sunmail5.UK.Sun.COM [129.156.85.165])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id m59IK30D013289
	for <psarc-ext@sac.sfbay.sun.com>; Mon, 9 Jun 2008 11:20:04 -0700 (PDT)
Received: from brm-avmta-1.central.sun.com (brm-avmta-1.Central.Sun.COM [129.147.4.11])
	by sunmail5.uk.sun.com (8.13.8+Sun/8.13.8/ENSMAIL,v2.2) with ESMTP id m59IJr1g025494;
	Mon, 9 Jun 2008 19:19:58 +0100 (BST)
Received: from pmxchannel-daemon.brm-avmta-1.central.sun.com by
 brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0K270070HK967T00@brm-avmta-1.central.sun.com>; Mon,
 09 Jun 2008 12:19:54 -0600 (MDT)
Received: from brmea-mail-4.sun.com ([192.18.98.36])
 by brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0K270017VK96L980@brm-avmta-1.central.sun.com>; Mon,
 09 Jun 2008 12:19:54 -0600 (MDT)
Received: from relay18i.sun.com
 (ip128.net129179-4.block1.us.syntegra.com [129.179.4.128])
	by brmea-mail-4.sun.com (8.13.6+Sun/8.12.9) with ESMTP id m59IHAHF028895; Mon,
 09 Jun 2008 18:19:54 +0000 (GMT)
Received: from mmp12es.mmp.us.syntegra.com ([160.41.208.12] [160.41.208.12])
 by relay18i.sun.com with ESMTP id BT-MMP-509896; Mon,
 09 Jun 2008 18:19:54 +0000 (Z)
Received: from relay13i.sun.com (relay13i.sun.com [129.179.4.123])
 by mmp12es.mmp.us.syntegra.com with ESMTP id BT-MMP-23355871; Mon,
 09 Jun 2008 18:19:53 +0000 (Z)
Received: from mactavish.localhost ([75.147.51.138] [75.147.51.138])
 by relay1i.sun.com with ESMTP id BT-MMP-7496714; Mon,
 09 Jun 2008 18:19:48 +0000 (Z)
Received: by mactavish.localhost (Postfix, from userid 501)
	id C10BB160A65; Mon, 09 Jun 2008 14:19:23 -0400 (EDT)
Date: Mon, 09 Jun 2008 14:19:23 -0400
From: Dan McDonald <danmcd@sun.com>
Subject: Re: Add timeradd() and timersub() to <sys/time.h>. [PSARC/2008/368
	FastTrack timeout 06/16/2008]
In-reply-to: <484D7397.6050808@Sun.COM>
To: Bart Smaalders <bart.smaalders@sun.com>
Cc: James Carlson <James.D.Carlson@sun.com>, Don Cragun <don.cragun@sun.com>,
        PSARC-ext@sun.com, Dan.McDonald@sun.com
Message-id: <20080609181923.GB18973@mactavish>
Organization: Sun Microsystems, Inc. - Solaris Networking & Security
MIME-version: 1.0
Content-type: text/plain; charset=us-ascii
Content-transfer-encoding: 7BIT
Content-disposition: inline
X-PMX-Version: 5.4.1.325704
X-Brightmail-Tracker: AAAAAA==
X-Antispam: No, score=0.0/5.0, scanned in 0.051sec at (localhost [127.0.0.1])
	by smf-spamd v1.3.1 - http://smfs.sf.net/
References: <200806091621.m59GLft6007315@sac.sfbay.sun.com>
 <18509.24360.701840.849143@gargle.gargle.HOWL> <484D7397.6050808@Sun.COM>
User-Agent: Mutt/1.5.17 (2007-11-01)
Status: RO
Content-Length: 1000

On Mon, Jun 09, 2008 at 11:16:55AM -0700, Bart Smaalders wrote:
> #define timerclear(t) { struct timeval *a = (t); a->tv_sec = a->tv_usec = 0; 
> }
>
> seems to be a reasonable fix.

Until you do something like:

	if (foo)
		timerclear(&t);  /* XXX KEBE SAYS SYNTAX ERROR */
	else
		something_else();

I thought we were trying to not be different than the rest of the world now?

> As above:
>
> #define timeradd(i1, i2, o1)                            \
> { struct timeval *a = i1, *b = i2, *result = o1;        \
>   result->tv_sec = a->tv_sec + b->tv_sec;               \
>   result->tv_usec = a->tv_usec + b->tv_usec;            \
>   if (result->tv_usec >= 1000000) {                     \
>         ++result->tv_sec;                               \
>         result->tv_usec -= 1000000;                      \
>   }                                                     \
> }

Again, I'm trying to be bug-for-bug-compatible with the world so we don't
violate the principle of least-surprise.

Dan

From johnlev@barman.uk.sun.com Mon Jun  9 11:30:52 2008
Received: from newsunmail1brm.central.sun.com (newsunmail1brm.Central.Sun.COM [129.147.62.245])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id m59IUqW6013994
	for <psarc-ext@sac.sfbay.sun.com>; Mon, 9 Jun 2008 11:30:52 -0700 (PDT)
Received: from nwk-avmta-1.SFBay.Sun.COM (nwk-avmta-1.SFBay.Sun.COM [129.146.11.74])
	by newsunmail1brm.central.sun.com (8.13.7+Sun/8.13.7/ENSMAIL,v2.2) with ESMTP id m59IUoYJ037644;
	Mon, 9 Jun 2008 12:30:51 -0600 (MDT)
Received: from pmxchannel-daemon.nwk-avmta-1.sfbay.Sun.COM by
 nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0K270051BKRE2W00@nwk-avmta-1.sfbay.Sun.COM>; Mon,
 09 Jun 2008 11:30:50 -0700 (PDT)
Received: from dm-uk-01.uk.sun.com ([129.156.101.115])
 by nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0K27000RBKRDU820@nwk-avmta-1.sfbay.Sun.COM>; Mon,
 09 Jun 2008 11:30:50 -0700 (PDT)
Received: from barman.uk.sun.com (barman.UK.Sun.COM [129.156.132.12])
	by dm-uk-01.uk.sun.com (8.13.7+Sun/8.13.7/ENSMAIL,v2.2)
 with ESMTP id m59IUhkQ004886; Mon, 09 Jun 2008 19:30:43 +0100 (BST)
Received: from johnlev by barman.uk.sun.com with local (Exim 4.42)
	id 1K5m9p-0006hG-3W; Mon, 09 Jun 2008 19:31:53 +0100
X-URL: http://jurassic.eng/~johnlev/
Date: Mon, 09 Jun 2008 19:31:52 +0100
From: John Levon <john.levon@sun.com>
Subject: Re: Add timeradd() and timersub() to <sys/time.h>. [PSARC/2008/368
 FastTrack timeout 06/16/2008]
In-reply-to: <20080609181923.GB18973@mactavish>
Sender: John Levon <johnlev@barman.uk.sun.com>
To: Dan McDonald <danmcd@sun.com>
Cc: Bart Smaalders <bart.smaalders@sun.com>,
        James Carlson <james.d.carlson@sun.com>,
        Don Cragun <don.cragun@sun.com>, PSARC-ext@sun.com,
        Dan.McDonald@sun.com
Message-id: <20080609183152.GH18415@barman.uk.sun.com>
MIME-version: 1.0
Content-type: text/plain; charset=us-ascii
Content-transfer-encoding: 7BIT
Content-disposition: inline
X-PMX-Version: 5.4.1.325704
References: <200806091621.m59GLft6007315@sac.sfbay.sun.com>
 <18509.24360.701840.849143@gargle.gargle.HOWL> <484D7397.6050808@Sun.COM>
 <20080609181923.GB18973@mactavish>
User-Agent: Mutt/1.5.6i
Status: RO
Content-Length: 514

On Mon, Jun 09, 2008 at 02:19:23PM -0400, Dan McDonald wrote:

> Until you do something like:
> 
> 	if (foo)
> 		timerclear(&t);  /* XXX KEBE SAYS SYNTAX ERROR */
> 	else
> 		something_else();
> 
> I thought we were trying to not be different than the rest of the world now?

Lint should be fixed to understand do {} while (0). We already have a
workaround (__lintzero) in kernelspace for this. The relevant bug:

4821302 lint should not complain about the safest way to construct complicated macros

regards
john

From bart.smaalders@sun.com Mon Jun  9 11:34:55 2008
Received: from sunmail5.uk.sun.com (sunmail5.UK.Sun.COM [129.156.85.165])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id m59IYsB7014378
	for <psarc-ext@sac.sfbay.sun.com>; Mon, 9 Jun 2008 11:34:55 -0700 (PDT)
Received: from nwk-avmta-1.SFBay.Sun.COM (nwk-avmta-1.SFBay.Sun.COM [129.146.11.74])
	by sunmail5.uk.sun.com (8.13.8+Sun/8.13.8/ENSMAIL,v2.2) with ESMTP id m59IYhOT001774;
	Mon, 9 Jun 2008 19:34:52 +0100 (BST)
Received: from pmxchannel-daemon.nwk-avmta-1.sfbay.Sun.COM by
 nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0K270050HKY3H000@nwk-avmta-1.sfbay.Sun.COM>; Mon,
 09 Jun 2008 11:34:51 -0700 (PDT)
Received: from zion.sfbay.sun.com ([129.146.17.75])
 by nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0K27000CFKY3U830@nwk-avmta-1.sfbay.Sun.COM>; Mon,
 09 Jun 2008 11:34:51 -0700 (PDT)
Received: from [129.146.228.109] (cyber.SFBay.Sun.COM [129.146.228.109])
	by zion.sfbay.sun.com (8.14.2+Sun/8.14.2) with ESMTP id m59IYpE7028572; Mon,
 09 Jun 2008 18:34:51 +0000 (GMT)
Date: Mon, 09 Jun 2008 11:34:50 -0700
From: Bart Smaalders <bart.smaalders@sun.com>
Subject: Re: Add timeradd() and timersub() to <sys/time.h>. [PSARC/2008/368
 FastTrack timeout 06/16/2008]
In-reply-to: <20080609181923.GB18973@mactavish>
To: Dan McDonald <danmcd@sun.com>
Cc: James Carlson <James.D.Carlson@sun.com>, Don Cragun <don.cragun@sun.com>,
        PSARC-ext@sun.com, Dan.McDonald@sun.com
Message-id: <484D77CA.6000207@Sun.COM>
Organization: Sun Microsystems
MIME-version: 1.0
Content-type: text/plain; charset=ISO-8859-1; format=flowed
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
References: <200806091621.m59GLft6007315@sac.sfbay.sun.com>
 <18509.24360.701840.849143@gargle.gargle.HOWL> <484D7397.6050808@Sun.COM>
 <20080609181923.GB18973@mactavish>
User-Agent: Thunderbird 2.0.0.14 (X11/20080507)
Status: RO
Content-Length: 845

Dan McDonald wrote:
> On Mon, Jun 09, 2008 at 11:16:55AM -0700, Bart Smaalders wrote:
>> #define timerclear(t) { struct timeval *a = (t); a->tv_sec = a->tv_usec = 0; 
>> }
>>
>> seems to be a reasonable fix.
> 
> Until you do something like:
> 
> 	if (foo)
> 		timerclear(&t);  /* XXX KEBE SAYS SYNTAX ERROR */
> 	else
> 		something_else();
> 
> I thought we were trying to not be different than the rest of the world now?
> 

There just isn't any good way around this w/ std C, so we'll have to live
w/ the accidental side effects problems.

If the lint fix is critical, you can change the definition of the macro when
using lint to use a non-constant conditional...

- Bart




-- 
Bart Smaalders			Solaris Kernel Performance
barts@cyber.eng.sun.com		http://blogs.sun.com/barts
"You will contribute more with mercurial than with thunderbird."

From gdamore@sun.com Mon Jun  9 11:42:13 2008
Received: from sunmail5.uk.sun.com (sunmail5.UK.Sun.COM [129.156.85.165])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id m59IgCcI014831
	for <psarc-ext@sac.sfbay.sun.com>; Mon, 9 Jun 2008 11:42:13 -0700 (PDT)
Received: from brm-avmta-1.central.sun.com (brm-avmta-1.Central.Sun.COM [129.147.4.11])
	by sunmail5.uk.sun.com (8.13.8+Sun/8.13.8/ENSMAIL,v2.2) with ESMTP id m59Ig8Qx005123;
	Mon, 9 Jun 2008 19:42:10 +0100 (BST)
Received: from pmxchannel-daemon.brm-avmta-1.central.sun.com by
 brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0K270081FLA8UT00@brm-avmta-1.central.sun.com>; Mon,
 09 Jun 2008 12:42:08 -0600 (MDT)
Received: from sca-es-mail-1.sun.com ([192.18.43.132])
 by brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0K27001J9LA7L6C0@brm-avmta-1.central.sun.com>; Mon,
 09 Jun 2008 12:42:07 -0600 (MDT)
Received: from fe-sfbay-10.sun.com ([192.18.43.129])
	by sca-es-mail-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id m59Ig6hl010909;
 Mon, 09 Jun 2008 11:42:06 -0700 (PDT)
Received: from conversion-daemon.fe-sfbay-10.sun.com by fe-sfbay-10.sun.com
 (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007))
 id <0K2700E01KNDPI00@fe-sfbay-10.sun.com> (original mail from gdamore@sun.com)
 ; Mon, 09 Jun 2008 11:42:06 -0700 (PDT)
Received: from [192.168.251.106] ([76.174.83.55])
 by fe-sfbay-10.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb
 28 2007)) with ESMTPSA id <0K2700AJFL9WLT10@fe-sfbay-10.sun.com>; Mon,
 09 Jun 2008 11:41:57 -0700 (PDT)
Date: Mon, 09 Jun 2008 11:41:09 -0700
From: "Garrett D'Amore" <gdamore@sun.com>
Subject: Re: Add timeradd() and timersub() to <sys/time.h>. [PSARC/2008/368
 FastTrack timeout 06/16/2008]
In-reply-to: <20080609183152.GH18415@barman.uk.sun.com>
Sender: Garrett.Damore@sun.com
To: John Levon <john.levon@sun.com>
Cc: Dan McDonald <danmcd@sun.com>, Bart Smaalders <Bart.Smaalders@sun.com>,
        James Carlson <James.D.Carlson@sun.com>,
        Don Cragun <don.cragun@sun.com>, PSARC-ext@sun.com,
        Dan.McDonald@sun.com
Message-id: <484D7945.6000509@sun.com>
MIME-version: 1.0
Content-type: text/plain; format=flowed; charset=ISO-8859-1
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
References: <200806091621.m59GLft6007315@sac.sfbay.sun.com>
 <18509.24360.701840.849143@gargle.gargle.HOWL> <484D7397.6050808@Sun.COM>
 <20080609181923.GB18973@mactavish> <20080609183152.GH18415@barman.uk.sun.com>
User-Agent: Thunderbird 2.0.0.6 (X11/20071023)
Status: RO
Content-Length: 1488

John Levon wrote:
> On Mon, Jun 09, 2008 at 02:19:23PM -0400, Dan McDonald wrote:
>
>   
>> Until you do something like:
>>
>> 	if (foo)
>> 		timerclear(&t);  /* XXX KEBE SAYS SYNTAX ERROR */
>> 	else
>> 		something_else();
>>
>> I thought we were trying to not be different than the rest of the world now?
>>     
>
> Lint should be fixed to understand do {} while (0). We already have a
> workaround (__lintzero) in kernelspace for this. The relevant bug:
>
> 4821302 lint should not complain about the safest way to construct complicated macros
>
> regards
> john
>   

Is it reasonable to expect that the bug in lint will be fixed in time 
for this case to integrate?

(Based on the included man page in this case, and the bug state of that 
CR, I don't think so.)  So, rather than add yet another reason to use 
/*LINTED*/ while we wait for lint to be fixed (the CR is a P4, so I'm 
not holding my breath), can we at least stick a workaround (perhaps with 
a comment requesting it be removed, and a cross-linked CR -- via SEE 
ALSO) in the implementation for this case?

Having to put /*LINTED*/ (or other suppression directives) above or 
around standard usage of system supplied macros and functions is, IMO, 
one of the biggest disincentives to using lint in the first place.  I'd 
like to see the need to use such reduced, rather than increased.  (And 
yes, IMO, changes that impact the compatibility/usefulness of standard 
tools like lint *is* architectural.)

    -- Garrett


From jek3@sun.com Mon Jun  9 11:52:49 2008
Received: from sunmail5.uk.sun.com (sunmail5.UK.Sun.COM [129.156.85.165])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id m59IqmS3015816
	for <psarc-ext@sac.sfbay.sun.com>; Mon, 9 Jun 2008 11:52:49 -0700 (PDT)
Received: from brm-avmta-1.central.sun.com (brm-avmta-1.Central.Sun.COM [129.147.4.11])
	by sunmail5.uk.sun.com (8.13.8+Sun/8.13.8/ENSMAIL,v2.2) with ESMTP id m59IqdXw009953;
	Mon, 9 Jun 2008 19:52:43 +0100 (BST)
Received: from pmxchannel-daemon.brm-avmta-1.central.sun.com by
 brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0K2700903LRTNE00@brm-avmta-1.central.sun.com>; Mon,
 09 Jun 2008 12:52:41 -0600 (MDT)
Received: from jurassic-x4600.sfbay.sun.com ([129.146.17.63])
 by brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0K270018PLRSLC90@brm-avmta-1.central.sun.com>; Mon,
 09 Jun 2008 12:52:40 -0600 (MDT)
Received: from [129.150.13.200]
 (vpn-129-150-13-200.SFBay.Sun.COM [129.150.13.200])
	by jurassic-x4600.sfbay.sun.com (8.14.3+Sun/8.14.3)
 with ESMTP id m59Iqdg6365425; Mon, 09 Jun 2008 11:52:39 -0700 (PDT)
Date: Mon, 09 Jun 2008 08:55:16 -1000
From: Joseph Kowalski <jek3@sun.com>
Subject: Re: Add timeradd() and timersub() to <sys/time.h>. [PSARC/2008/368
 FastTrack timeout 06/16/2008]
In-reply-to: <484D7945.6000509@sun.com>
To: "Garrett D'Amore" <gdamore@sun.com>
Cc: John Levon <john.levon@sun.com>, Dan McDonald <danmcd@sun.com>,
        Bart Smaalders <Bart.Smaalders@sun.com>,
        James Carlson <James.D.Carlson@sun.com>,
        Don Cragun <don.cragun@sun.com>, PSARC-ext@sun.com,
        Dan.McDonald@sun.com
Message-id: <484D7C94.8090206@sun.com>
MIME-version: 1.0
Content-type: text/plain; charset=ISO-8859-1; format=flowed
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
References: <200806091621.m59GLft6007315@sac.sfbay.sun.com>
 <18509.24360.701840.849143@gargle.gargle.HOWL> <484D7397.6050808@Sun.COM>
 <20080609181923.GB18973@mactavish> <20080609183152.GH18415@barman.uk.sun.com>
 <484D7945.6000509@sun.com>
User-Agent: Thunderbird 2.0.0.9 (X11/20080225)
Status: RO
Content-Length: 71


Maybe this code review discussion should be taken elsewhere?

- jek3


From carlsonj@phorcys.east.sun.com Mon Jun  9 12:06:30 2008
Received: from newsunmail1brm.central.sun.com (newsunmail1brm.Central.Sun.COM [129.147.62.245])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id m59J6TTS018071
	for <psarc-ext@sac.sfbay.sun.com>; Mon, 9 Jun 2008 12:06:29 -0700 (PDT)
Received: from nwk-avmta-1.SFBay.Sun.COM (nwk-avmta-1.SFBay.Sun.COM [129.146.11.74])
	by newsunmail1brm.central.sun.com (8.13.7+Sun/8.13.7/ENSMAIL,v2.2) with ESMTP id m59J67gK050144;
	Mon, 9 Jun 2008 13:06:28 -0600 (MDT)
Received: from pmxchannel-daemon.nwk-avmta-1.sfbay.Sun.COM by
 nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0K270081PMEQNU00@nwk-avmta-1.sfbay.Sun.COM>; Mon,
 09 Jun 2008 12:06:26 -0700 (PDT)
Received: from phorcys.east.sun.com ([129.148.174.143])
 by nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0K27000E4MEFU560@nwk-avmta-1.sfbay.Sun.COM>; Mon,
 09 Jun 2008 12:06:15 -0700 (PDT)
Received: from phorcys.east.sun.com (localhost [127.0.0.1])
	by phorcys.east.sun.com (8.14.3+Sun/8.14.3) with ESMTP id m59J6FUE021922; Mon,
 09 Jun 2008 15:06:15 -0400 (EDT)
Received: (from carlsonj@localhost)
	by phorcys.east.sun.com (8.14.3+Sun/8.14.3/Submit) id m59J6EOC021919; Mon,
 09 Jun 2008 15:06:14 -0400 (EDT)
Date: Mon, 09 Jun 2008 15:06:14 -0400
From: James Carlson <james.d.carlson@sun.com>
Subject: Re: Add timeradd() and timersub() to <sys/time.h>. [PSARC/2008/368
	FastTrack timeout 06/16/2008]
In-reply-to: <484D7C94.8090206@sun.com>
To: Joseph Kowalski <jek3@sun.com>
Cc: "Garrett D'Amore" <gdamore@sun.com>, Dan McDonald <danmcd@sun.com>,
        Don Cragun <don.cragun@sun.com>, PSARC-ext@sun.com,
        Bart Smaalders <Bart.Smaalders@sun.com>, Dan.McDonald@sun.com
Message-id: <18509.32550.967950.185965@gargle.gargle.HOWL>
MIME-version: 1.0
X-Mailer: VM 7.01 under Emacs 21.3.1
Content-type: text/plain; charset=us-ascii
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
References: <200806091621.m59GLft6007315@sac.sfbay.sun.com>
 <18509.24360.701840.849143@gargle.gargle.HOWL> <484D7397.6050808@Sun.COM>
 <20080609181923.GB18973@mactavish> <20080609183152.GH18415@barman.uk.sun.com>
 <484D7945.6000509@sun.com> <484D7C94.8090206@sun.com>
Status: RO
Content-Length: 623

Joseph Kowalski writes:
> 
> Maybe this code review discussion should be taken elsewhere?

Indeed.  The architectural bit was just the suggestion that if the
implementation can be fixed so that it doesn't make lint whine, it
probably should be.  If it can't be fixed right now, then I'm less
certain what ought to be in the man page.  (Is that really the right
place to document bugs in lint ... ?)

-- 
James Carlson, Solaris Networking              <james.d.carlson@sun.com>
Sun Microsystems / 35 Network Drive        71.232W   Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757   42.496N   Fax +1 781 442 1677

From dwc@spartan.eng.sun.com Mon Jun  9 15:25:53 2008
Received: from sunmail4.singapore.sun.com (sunmail4.Singapore.Sun.COM [129.158.71.19])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id m59MPqmj028557
	for <psarc-ext@sac.sfbay.Sun.COM>; Mon, 9 Jun 2008 15:25:53 -0700 (PDT)
Received: from brm-avmta-1.central.sun.com (brm-avmta-1.Central.Sun.COM [129.147.4.11])
	by sunmail4.singapore.sun.com (8.13.4+Sun/8.13.3/ENSMAIL,v2.2) with ESMTP id m59MPmPa008061
	for <@sunmail2sca.sfbay.sun.com:PSARC-ext@sun.com>; Tue, 10 Jun 2008 06:25:51 +0800 (SGT)
Received: from pmxchannel-daemon.brm-avmta-1.central.sun.com by
 brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0K2700205VN1T500@brm-avmta-1.central.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Mon, 09 Jun 2008 16:25:49 -0600 (MDT)
Received: from dm-eng-02.sfbay.sun.com ([129.146.11.32])
 by brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0K2700H24VN0GXD0@brm-avmta-1.central.sun.com> for
 PSARC-ext@sun.com (ORCPT PSARC-ext@sun.com); Mon,
 09 Jun 2008 16:25:48 -0600 (MDT)
Received: from spartan.eng.sun.com (spartan.SFBay.Sun.COM [129.146.226.64])
	by dm-eng-02.sfbay.sun.com (8.13.8+Sun/8.13.8/ENSMAIL,v2.2)
 with ESMTP id m59MPlZc058003; Mon, 09 Jun 2008 15:25:47 -0700 (PDT)
Received: from spartan.eng.sun.com (localhost [127.0.0.1])
	by spartan.eng.sun.com (8.13.7+Sun/8.13.7) with ESMTP id m59MIIbE003058; Mon,
 09 Jun 2008 15:18:18 -0700 (PDT)
Received: (from dwc@localhost)
	by spartan.eng.sun.com (8.13.7+Sun/8.13.7/Submit) id m59MIIFK003057; Mon,
 09 Jun 2008 15:18:18 -0700 (PDT)
Date: Mon, 09 Jun 2008 15:18:18 -0700 (PDT)
From: Don Cragun <don.cragun@sun.com>
Subject: Re: Add timeradd() and timersub() to <sys/time.h>. [PSARC/2008/368
 FastTrack timeout 06/16/2008]
To: PSARC-ext@sun.com
Cc: Dan.McDonald@sun.com
Message-id: <200806092218.m59MIIFK003057@spartan.eng.sun.com>
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
Status: RO
Content-Length: 1359

>Date: Mon, 09 Jun 2008 15:06:14 -0400
>From: James Carlson <james.d.carlson@sun.com>
>
>Joseph Kowalski writes:
>> 
>> Maybe this code review discussion should be taken elsewhere?
>
>Indeed.  The architectural bit was just the suggestion that if the
>implementation can be fixed so that it doesn't make lint whine, it
>probably should be.  If it can't be fixed right now, then I'm less
>certain what ought to be in the man page.  (Is that really the right
>place to document bugs in lint ... ?)

Dan has agreed to use an #ifdef __lint (to preserve standards namespace
it is __lint; not lint) to get rid of the lint issue, and has asked me
to remove the warning paragraph about lint from the man page.  I have
updated the man page in the materials directory as requested.

For the record, Dan and I discussed changing these macros to avoid the
side effects issue.  I insisted that we document that there is an
issue, but did not (and still do not) believe that the side effect
issue is a problem because all known implementations of these macros on
other OSes have the same issue.  Note that although undocumented,
timerclear(), timercmp(), and timerisset() have been present in our
<sys/time.h> header with the side effects for more than 14 years.  This
case is not changing those macros in the header at all; it is just
documenting their existence.

 - Don

From don.cragun@sun.com Wed Jun 11 11:04:27 2008
Received: from sunmail3mpk.sfbay.sun.com (sunmail3mpk.SFBay.Sun.COM [129.146.11.52])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id m5BI4Rwq018934
	for <psarc-ext@sac.sfbay.sun.com>; Wed, 11 Jun 2008 11:04:27 -0700 (PDT)
Received: from nwk-avmta-1.SFBay.Sun.COM (nwk-avmta-1.SFBay.Sun.COM [129.146.11.74])
	by sunmail3mpk.sfbay.sun.com (8.13.7+Sun/8.13.7/ENSMAIL,v2.2) with ESMTP id m5BI4PZP019570
	for <@sunmail2sca.sfbay.sun.com:PSARC-ext@Sun.COM>; Wed, 11 Jun 2008 11:04:26 -0700 (PDT)
Received: from pmxchannel-daemon.nwk-avmta-1.sfbay.Sun.COM by
 nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0K2B00J0R8VDNQ00@nwk-avmta-1.sfbay.Sun.COM> for PSARC-ext@Sun.COM
 (ORCPT PSARC-ext@Sun.COM); Wed, 11 Jun 2008 11:04:25 -0700 (PDT)
Received: from dm-eng-02.sfbay.sun.com ([129.146.11.32])
 by nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0K2B00JPY8VC3W00@nwk-avmta-1.sfbay.Sun.COM> for
 PSARC-ext@Sun.COM (ORCPT PSARC-ext@Sun.COM); Wed,
 11 Jun 2008 11:04:24 -0700 (PDT)
Received: from spartan.eng.sun.com (spartan.SFBay.Sun.COM [129.146.226.64])
	by dm-eng-02.sfbay.sun.com (8.13.8+Sun/8.13.8/ENSMAIL,v2.2)
 with ESMTP id m5BI4NbA013933; Wed, 11 Jun 2008 11:04:23 -0700 (PDT)
Received: from spartan (spartan [129.146.226.64])
	by spartan.eng.sun.com (8.13.7+Sun/8.13.7) with SMTP id m5BHusOK005902; Wed,
 11 Jun 2008 10:56:54 -0700 (PDT)
Date: Wed, 11 Jun 2008 10:56:54 -0700 (PDT)
From: Don Cragun <don.cragun@sun.com>
Subject: Re: Add timeradd() and timersub() to <sys/time.h>. [PSARC/2008/368
 FastTrack timeout 06/16/2008]
To: PSARC-ext@sun.com
Cc: Dan.McDonald@sun.com
Reply-to: Don Cragun <don.cragun@sun.com>
Message-id: <200806111756.m5BHusOK005902@spartan.eng.sun.com>
MIME-version: 1.0
X-Mailer: dtmail 1.3.0 @(#)CDE Version 1.6.2 SunOS 5.10 sun4u sparc
Content-type: TEXT/plain; charset=us-ascii
Content-transfer-encoding: 7BIT
Content-MD5: TD3FtzXqQesf+RLYdCnLkg==
X-PMX-Version: 5.4.1.325704
Status: RO
Content-Length: 62

This case was approved during today's PSARC meeting.

 - Don


