From gjelinek@sac.sfbay.sun.com Mon Dec  1 15:11:20 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 mB1NBKFC015718
	for <psarc-ext@sac.sfbay.sun.com>; Mon, 1 Dec 2008 15:11:20 -0800 (PST)
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 mB1NBKt6039392;
	Mon, 1 Dec 2008 16:11:20 -0700 (MST)
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 <0KB800E010ETCQ00@nwk-avmta-2.sfbay.sun.com>; Mon,
 01 Dec 2008 15:11:17 -0800 (PST)
Received: from dm-sfbay-01.sfbay.sun.com ([129.145.155.118])
 by nwk-avmta-2.sfbay.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KB800DOG0ETTL10@nwk-avmta-2.sfbay.sun.com>; Mon,
 01 Dec 2008 15:11:17 -0800 (PST)
Received: from sac.sfbay.sun.com (new-sac.SFBay.Sun.COM [129.146.175.65])
	by dm-sfbay-01.sfbay.sun.com (8.13.8+Sun/8.13.8/ENSMAIL,v2.2)
 with ESMTP id mB1NBG35018829; Mon, 01 Dec 2008 15:11:16 -0800 (PST)
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 mB1NBFwq015713; Mon,
 01 Dec 2008 15:11:15 -0800 (PST)
Received: (from gjelinek@localhost)
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8/Submit) id mB1NBFAc015709; Mon,
 01 Dec 2008 15:11:15 -0800 (PST)
Date: Mon, 01 Dec 2008 15:11:15 -0800 (PST)
From: Gerald Jelinek <gjelinek@sac.sfbay.sun.com>
Subject: Cross-Platform DDI Interface for Converting Strings to 64-bit Integers
 [PSARC/2008/740 FastTrack timeout 12/09/2008]
To: PSARC-ext@sun.com
Cc: Jordan.Vaughan@sun.com, gerald.jelinek@sun.com
Message-id: <200812012311.mB1NBFAc015709@sac.sfbay.sun.com>
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
Status: RO
Content-Length: 13863

I am sponsoring this case for Jordan Vaughan.

Thanks,
Jerry

Template Version: @(#)sac_nextcase %I% %G% SMI
This information is Copyright 2008 Sun Microsystems
1. Introduction
    1.1. Project/Component Working Name:
	 Cross-Platform DDI Interface for Converting Strings to 64-bit Integers
    1.2. Name of Document Author/Supplier:
	 Author:  Jordan Vaughan
    1.3  Date of This Document:
	01 December, 2008
4. Technical Description
Template Version: @(#)sac_nextcase %I% %G% SMI
This information is Copyright 2008 Sun Microsystems
1. Introduction
    1.1. Project/Component Working Name:
	 Cross-Platform DDI Interface for Converting Strings to 64-bit Integers
    1.2. Name of Document Author/Supplier:
	 Author:  Jordan Vaughan
    1.3  Date of This Document:
	 20 November, 2008

4. Technical Description
Targeting an update release of Solaris 10, therefore patch binding.


PROBLEM:

Device driver writers have no standard means of converting numerical strings to
64-bit integers in both 32- and 64-bit builds.  Driver writers could use
ddi_strtol(9F) and ddi_strtoul(9F), but both produce 32-bit integers in 32-bit
driver builds.  Therefore, driver writers must resort to writing their own
string conversion subroutines or linking to project- or consolidation-private
string conversion functions, such as the undocumented function idm_strtoull().
However, these solutions are cumbersome, increase the probability of generating
bugs, and create dependencies on uncommitted, undocumented kernel functions.
This case proposes to rectify this deficiency by adding two new, committed
functions to the Solaris 10 and Solaris Nevada (and thus OpenSolaris) DDI called
ddi_strtoll() and ddi_strtoull() that will convert null-terminated character
strings into signed and unsigned 64-bit integers (respectively) in both 32- and
64-bit builds.


EXPORTED INTERFACES:

    FUNCTIONS:
        NAME            STABILITY  NOTES
        ddi_strtoll     Committed  In <sys/sunddi.h> under _KERNEL
        ddi_strtoull    Committed  In <sys/sunddi.h> under _KERNEL


TECHNICAL DESCRIPTION:

The Solaris DDI currently provides two string-to-long-integer functions that
both kernel and driver coders can utilize: ddi_strtol(9F) and ddi_strtoul(9F).
Both functions convert strings to 32-bit integers in 32-bit builds and 64-bit
integers in 64-bit builds.

It would be preferable to provide additional functions that would convert 
strings to 64-bit integers in both 32- and 64-bit builds.  These functions,
ddi_strtoll() and ddi_strtoull(), would be functionally equivalent to
ddi_strtol() and ddi_strtoul() with the exception that the generated values
would be of types 'longlong_t' and 'u_longlong_t' (respectively) instead of
'long int' and 'unsigned long int'.

Given that kernel functions cannot safely utilize errno, both ddi_strtoll()
and ddi_strtoull() will differ from their userland equivalents (strtoll(3C) and
strtoull(3C)) in that the former will store their results in pointer arguments
and return error codes (whereas the latter return their results and store
error codes in errno).  This behavior is identical to that of ddi_strtol()
and ddi_strtoul().


RELATED BUGIDS:

    6761505 RFE: having ddi_strtoull() would be nice


RELATED ARC CASES:

    PSARC/2004/321: Add strtol() and strtoul() to the DDI


REFERENCE DOCUMENTS:

    ddi_strtol(9F) and ddi_strtoul(9F) man pages
    Solaris Books: Writing Device Drivers (Solaris 10)
        (http://docs.sun.com/app/docs/doc/816-4854)


NEW MAN PAGES:

Kernel Functions for Drivers                      ddi_strtoll(9F)



NAME
     ddi_strtoll - String conversion functions

SYNOPSIS
     #include <sys/ddi.h>
     #include <sys/sunddi.h>

     int ddi_strtoll(const char *str, char **endptr, int base,
         longlong_t *result);


INTERFACE LEVEL
     Solaris DDI specific (Solaris DDI)

PARAMETERS
     str        Pointer to a character string to be converted.


     endptr     Post-conversion  final  string  of   unrecognized
                characters.


     base       Radix used for conversion.


     result     Pointer to variable which contains the  converted
                value.


DESCRIPTION
     The ddi_strtoll() function converts the initial  portion  of
     the  string   pointed  to  by   str  to  a  type  longlong_t
     representation and stores the converted value in result.


     The  function first decomposes the input string  into  three
     parts:

         1.   An initial (possibly empty) sequence of white-space
              characters (' ', '\t', '\n', '\r', '\f')

         2.   A  subject  sequence  interpreted  as  an   integer
              represented  in  some radix determined by the value
              of base

         3.   A final  string of one or more unrecognized charac-
              ters,  including  the  terminating null byte of the
              input string.


     The ddi_strtoll() function then attempts to convert the sub-
     ject sequence to an integer and returns the result.



SunOS 5.11          Last change: 20 Nov 2008                    1



Kernel Functions for Drivers                      ddi_strtoll(9F)



     If the value of base is 0, the expected form of the  subject
     sequence  is  that  of a decimal constant, octal constant or
     hexadecimal constant, any of which may be preceded by a plus
     ("+")  or minus ("-") sign. A decimal constant begins with a
     non-zero digit,  and  consists  of  a  sequence  of  decimal
     digits. An octal constant consists  of  the prefix 0 option-
     ally followed by a sequence of the digits 0  to  7  only.  A
     hexadecimal   constant  consists of the prefix 0x or 0X fol-
     lowed by a sequence of the decimal digits and letters a  (or
     A) to f (or F) with values 10 to 15 respectively.


     If the value of base is between 2 and 36, the expected  form
     of  the subject sequence is a sequence of letters and digits
     representing an integer with the radix  specified  by  base,
     optionally  preceded  by  a  plus or minus sign. The letters
     from a (or A) to z (or Z) inclusive are ascribed the  values
     10  to  35  and  only letters whose ascribed values are less
     than that of base are permitted. If the value of base is 16,
     the  characters 0x or 0X may optionally precede the sequence
     of letters and digits, following the sign if present.


     The subject sequence is  defined   as  the  longest  initial
     subsequence  of  the  input  string, starting with the first
     non-white-space character that is of the expected form.  The
     subject  sequence contains no characters if the input string
     is empty or consists entirely of white-space characters,  or
     if  the first non-white-space character is other than a sign
     or a permissible letter or digit.


     If the subject sequence has the expected form and the  value
     of  base  is 0, the sequence of characters starting with the
     first digit is interpreted as an integer  constant.  If  the
     subject sequence has the expected form and the value of base
     is between 2 and 36, it is used as the base for  conversion,
     ascribing   to  each letter its value as given above. If the
     subject sequence begins with a minus sign, the value result-
     ing  from  the conversion is negated. A pointer to the final
     string is stored in the object pointed to  by  endptr,  pro-
     vided that endptr is not a null pointer.


     If the subject sequence  is  empty  or  does  not  have  the
     expected   form, no conversion is performed and the value of
     str is stored in the object pointed to by  endptr,  provided
     that endptr is not a null pointer.

RETURN VALUES
     Upon successful  completion,  ddi_strtoll()  returns  0  and
     stores  the  converted  value in result. If no conversion is



SunOS 5.11          Last change: 20 Nov 2008                    2


Kernel Functions for Drivers                      ddi_strtoll(9F)



     performed due to invalid base, ddi_strtoll() returns  EINVAL
     and the variable pointed by result is not changed.


     If the correct value is outside the range  of  representable
     values,  ddi_strtoll()  returns ERANGE and the value pointed
     to by result is not changed.

CONTEXT
     The ddi_strtoll() function may be called from  user,  kernel
     or interrupt context.

SEE ALSO
     Writing Device Drivers


SunOS 5.11          Last change: 20 Nov 2008                    3




Kernel Functions for Drivers                     ddi_strtoull(9F)


NAME
     ddi_strtoull - String conversion functions

SYNOPSIS
     #include <sys/ddi.h>
     #include <sys/sunddi.h>

     int ddi_strtoull(const char *str, char **endptr, int base,
         u_longlong_t *result);


INTERFACE LEVEL
     Solaris DDI specific (Solaris DDI)

PARAMETERS
     str        Pointer to a character string to be converted.


     endptr     Post-conversion  final  string  of   unrecognized
                characters.


     base       Radix used for conversion.


     result     Pointer to variable which contains the  converted
                value.


DESCRIPTION
     The ddi_strtoull() function converts the initial  portion of
     the  string  pointed  to  by  str  to  a  type  u_longlong_t
     representation and stores the converted value in result.


     The  function first decomposes the input string  into  three
     parts:

         1.   An initial (possibly empty) sequence of white-space
              characters (' ', '\t', '\n', '\r', '\f')

         2.   A  subject  sequence  interpreted  as  an   integer
              represented  in  some radix determined by the value
              of base

         3.   A final  string of one or more unrecognized charac-
              ters,  including  the  terminating null byte of the
              input string.


     The  ddi_strtoull()  function then  attempts to  convert the
     subject  sequence  to an  unsigned integer  and returns  the
     result.


SunOS 5.11          Last change: 20 Nov 2008                    1


Kernel Functions for Drivers                     ddi_strtoull(9F)



     If the value of base is 0, the expected form of the  subject
     sequence  is  that  of a decimal constant, octal constant or
     hexadecimal constant, any of which may be preceded by a plus
     ("+")  or minus ("-") sign. A decimal constant begins with a
     non-zero digit,  and  consists  of  a  sequence  of  decimal
     digits. An octal constant consists  of  the prefix 0 option-
     ally followed by a sequence of the digits 0  to  7  only.  A
     hexadecimal   constant  consists of the prefix 0x or 0X fol-
     lowed by a sequence of the decimal digits and letters a  (or
     A) to f (or F) with values 10 to 15 respectively.


     If the value of base is between 2 and 36, the expected  form
     of  the subject sequence is a sequence of letters and digits
     representing an integer with the radix  specified  by  base,
     optionally  preceded  by  a  plus or minus sign. The letters
     from a (or A) to z (or Z) inclusive are ascribed the  values
     10  to  35  and  only letters whose ascribed values are less
     than that of base are permitted. If the value of base is 16,
     the  characters 0x or 0X may optionally precede the sequence
     of letters and digits, following the sign if present.


     The subject sequence is  defined   as  the  longest  initial
     subsequence  of  the  input  string, starting with the first
     non-white-space character that is of the expected form.  The
     subject  sequence contains no characters if the input string
     is empty or consists entirely of white-space characters,  or
     if  the first non-white-space character is other than a sign
     or a permissible letter or digit.


     If the subject sequence has the expected form and the  value
     of  base  is 0, the sequence of characters starting with the
     first digit is interpreted as an integer  constant.  If  the
     subject sequence has the expected form and the value of base
     is between 2 and 36, it is used as the base for  conversion,
     ascribing   to  each letter its value as given above. If the
     subject sequence begins with a minus sign, the value result-
     ing  from  the conversion is negated. A pointer to the final
     string is stored in the object pointed to  by  endptr,  pro-
     vided that endptr is not a null pointer.


     If the subject sequence  is  empty  or  does  not  have  the
     expected   form, no conversion is performed and the value of
     str is stored in the object pointed to by  endptr,  provided
     that endptr is not a null pointer.

RETURN VALUES
     Upon successful  completion,  ddi_strtoull()  returns  0 and
     stores  the  converted  value in result. If no conversion is



SunOS 5.11          Last change: 20 Nov 2008                    2


Kernel Functions for Drivers                     ddi_strtoull(9F)



     performed due to invalid base, ddi_strtoull() returns EINVAL
     and the variable pointed by result is not changed.


     If the correct value is outside the range  of  representable
     values, ddi_strtoull()  returns ERANGE and the value pointed
     to by result is not changed.

CONTEXT
     The ddi_strtoull() function may be called from  user, kernel
     or interrupt context.

SEE ALSO
     Writing Device Drivers


SunOS 5.11          Last change: 20 Nov 2008                    3



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


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 Dec  1 16:02:07 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 mB2027S5005370
	for <psarc-ext@sac.sfbay.sun.com>; Mon, 1 Dec 2008 16:02:07 -0800 (PST)
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 mB202447006786
	for <@sunmail2sca.sfbay.sun.com:PSARC-ext@sun.com>; Mon, 1 Dec 2008 17:02:07 -0700 (MST)
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 <0KB800F0P2RHTZ00@nwk-avmta-1.sfbay.Sun.COM> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@Sun.COM); Mon, 01 Dec 2008 16:02:05 -0800 (PST)
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 <0KB8008XO2RGQY90@nwk-avmta-1.sfbay.Sun.COM> for
 PSARC-ext@sun.com (ORCPT PSARC-ext@Sun.COM); Mon,
 01 Dec 2008 16:02:04 -0800 (PST)
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 mB2024Ka009699	for
 <PSARC-ext@Sun.COM>; Mon, 01 Dec 2008 16:02:04 -0800 (PST)
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 <0KB800F0127MHF00@fe-sfbay-10.sun.com> (original mail from gdamore@sun.com)
 for PSARC-ext@Sun.COM (ORCPT PSARC-ext@Sun.COM); Mon,
 01 Dec 2008 16:02:04 -0800 (PST)
Received: from [10.7.251.172] by fe-sfbay-10.sun.com
 (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007))
 with ESMTPSA id <0KB8009QB2R34UD0@fe-sfbay-10.sun.com>; Mon,
 01 Dec 2008 16:01:52 -0800 (PST)
Date: Mon, 01 Dec 2008 15:55:08 -0800
From: "Garrett D'Amore" <gdamore@sun.com>
Subject: Re: Cross-Platform DDI Interface for Converting Strings to 64-bit
 Integers [PSARC/2008/740 FastTrack timeout 12/09/2008]
In-reply-to: <200812012311.mB1NBFAc015709@sac.sfbay.sun.com>
Sender: Garrett.Damore@sun.com
To: Gerald Jelinek <gjelinek@sac.sfbay.sun.com>
Cc: PSARC-ext@sun.com, Jordan.Vaughan@sun.com, Gerald.Jelinek@sun.com
Message-id: <4934795C.3030305@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: <200812012311.mB1NBFAc015709@sac.sfbay.sun.com>
User-Agent: Thunderbird 2.0.0.14 (X11/20080616)
Status: RO
Content-Length: 14854

+1

On a minor nit/suggestion, wouldn't it be simpler to just add the 
functions to the existing ddi_strtol page.  (I noticed ddi_strtoul is a 
separate page as well.  It seems kind of wasteful though, since mainly 
these functions only differ in a relatively small detail.)

    -- Garrett

Gerald Jelinek wrote:
> I am sponsoring this case for Jordan Vaughan.
>
> Thanks,
> Jerry
>
> Template Version: @(#)sac_nextcase %I% %G% SMI
> This information is Copyright 2008 Sun Microsystems
> 1. Introduction
>     1.1. Project/Component Working Name:
> 	 Cross-Platform DDI Interface for Converting Strings to 64-bit Integers
>     1.2. Name of Document Author/Supplier:
> 	 Author:  Jordan Vaughan
>     1.3  Date of This Document:
> 	01 December, 2008
> 4. Technical Description
> Template Version: @(#)sac_nextcase %I% %G% SMI
> This information is Copyright 2008 Sun Microsystems
> 1. Introduction
>     1.1. Project/Component Working Name:
> 	 Cross-Platform DDI Interface for Converting Strings to 64-bit Integers
>     1.2. Name of Document Author/Supplier:
> 	 Author:  Jordan Vaughan
>     1.3  Date of This Document:
> 	 20 November, 2008
>
> 4. Technical Description
> Targeting an update release of Solaris 10, therefore patch binding.
>
>
> PROBLEM:
>
> Device driver writers have no standard means of converting numerical strings to
> 64-bit integers in both 32- and 64-bit builds.  Driver writers could use
> ddi_strtol(9F) and ddi_strtoul(9F), but both produce 32-bit integers in 32-bit
> driver builds.  Therefore, driver writers must resort to writing their own
> string conversion subroutines or linking to project- or consolidation-private
> string conversion functions, such as the undocumented function idm_strtoull().
> However, these solutions are cumbersome, increase the probability of generating
> bugs, and create dependencies on uncommitted, undocumented kernel functions.
> This case proposes to rectify this deficiency by adding two new, committed
> functions to the Solaris 10 and Solaris Nevada (and thus OpenSolaris) DDI called
> ddi_strtoll() and ddi_strtoull() that will convert null-terminated character
> strings into signed and unsigned 64-bit integers (respectively) in both 32- and
> 64-bit builds.
>
>
> EXPORTED INTERFACES:
>
>     FUNCTIONS:
>         NAME            STABILITY  NOTES
>         ddi_strtoll     Committed  In <sys/sunddi.h> under _KERNEL
>         ddi_strtoull    Committed  In <sys/sunddi.h> under _KERNEL
>
>
> TECHNICAL DESCRIPTION:
>
> The Solaris DDI currently provides two string-to-long-integer functions that
> both kernel and driver coders can utilize: ddi_strtol(9F) and ddi_strtoul(9F).
> Both functions convert strings to 32-bit integers in 32-bit builds and 64-bit
> integers in 64-bit builds.
>
> It would be preferable to provide additional functions that would convert 
> strings to 64-bit integers in both 32- and 64-bit builds.  These functions,
> ddi_strtoll() and ddi_strtoull(), would be functionally equivalent to
> ddi_strtol() and ddi_strtoul() with the exception that the generated values
> would be of types 'longlong_t' and 'u_longlong_t' (respectively) instead of
> 'long int' and 'unsigned long int'.
>
> Given that kernel functions cannot safely utilize errno, both ddi_strtoll()
> and ddi_strtoull() will differ from their userland equivalents (strtoll(3C) and
> strtoull(3C)) in that the former will store their results in pointer arguments
> and return error codes (whereas the latter return their results and store
> error codes in errno).  This behavior is identical to that of ddi_strtol()
> and ddi_strtoul().
>
>
> RELATED BUGIDS:
>
>     6761505 RFE: having ddi_strtoull() would be nice
>
>
> RELATED ARC CASES:
>
>     PSARC/2004/321: Add strtol() and strtoul() to the DDI
>
>
> REFERENCE DOCUMENTS:
>
>     ddi_strtol(9F) and ddi_strtoul(9F) man pages
>     Solaris Books: Writing Device Drivers (Solaris 10)
>         (http://docs.sun.com/app/docs/doc/816-4854)
>
>
> NEW MAN PAGES:
>
> Kernel Functions for Drivers                      ddi_strtoll(9F)
>
>
>
> NAME
>      ddi_strtoll - String conversion functions
>
> SYNOPSIS
>      #include <sys/ddi.h>
>      #include <sys/sunddi.h>
>
>      int ddi_strtoll(const char *str, char **endptr, int base,
>          longlong_t *result);
>
>
> INTERFACE LEVEL
>      Solaris DDI specific (Solaris DDI)
>
> PARAMETERS
>      str        Pointer to a character string to be converted.
>
>
>      endptr     Post-conversion  final  string  of   unrecognized
>                 characters.
>
>
>      base       Radix used for conversion.
>
>
>      result     Pointer to variable which contains the  converted
>                 value.
>
>
> DESCRIPTION
>      The ddi_strtoll() function converts the initial  portion  of
>      the  string   pointed  to  by   str  to  a  type  longlong_t
>      representation and stores the converted value in result.
>
>
>      The  function first decomposes the input string  into  three
>      parts:
>
>          1.   An initial (possibly empty) sequence of white-space
>               characters (' ', '\t', '\n', '\r', '\f')
>
>          2.   A  subject  sequence  interpreted  as  an   integer
>               represented  in  some radix determined by the value
>               of base
>
>          3.   A final  string of one or more unrecognized charac-
>               ters,  including  the  terminating null byte of the
>               input string.
>
>
>      The ddi_strtoll() function then attempts to convert the sub-
>      ject sequence to an integer and returns the result.
>
>
>
> SunOS 5.11          Last change: 20 Nov 2008                    1
>
>
>
> Kernel Functions for Drivers                      ddi_strtoll(9F)
>
>
>
>      If the value of base is 0, the expected form of the  subject
>      sequence  is  that  of a decimal constant, octal constant or
>      hexadecimal constant, any of which may be preceded by a plus
>      ("+")  or minus ("-") sign. A decimal constant begins with a
>      non-zero digit,  and  consists  of  a  sequence  of  decimal
>      digits. An octal constant consists  of  the prefix 0 option-
>      ally followed by a sequence of the digits 0  to  7  only.  A
>      hexadecimal   constant  consists of the prefix 0x or 0X fol-
>      lowed by a sequence of the decimal digits and letters a  (or
>      A) to f (or F) with values 10 to 15 respectively.
>
>
>      If the value of base is between 2 and 36, the expected  form
>      of  the subject sequence is a sequence of letters and digits
>      representing an integer with the radix  specified  by  base,
>      optionally  preceded  by  a  plus or minus sign. The letters
>      from a (or A) to z (or Z) inclusive are ascribed the  values
>      10  to  35  and  only letters whose ascribed values are less
>      than that of base are permitted. If the value of base is 16,
>      the  characters 0x or 0X may optionally precede the sequence
>      of letters and digits, following the sign if present.
>
>
>      The subject sequence is  defined   as  the  longest  initial
>      subsequence  of  the  input  string, starting with the first
>      non-white-space character that is of the expected form.  The
>      subject  sequence contains no characters if the input string
>      is empty or consists entirely of white-space characters,  or
>      if  the first non-white-space character is other than a sign
>      or a permissible letter or digit.
>
>
>      If the subject sequence has the expected form and the  value
>      of  base  is 0, the sequence of characters starting with the
>      first digit is interpreted as an integer  constant.  If  the
>      subject sequence has the expected form and the value of base
>      is between 2 and 36, it is used as the base for  conversion,
>      ascribing   to  each letter its value as given above. If the
>      subject sequence begins with a minus sign, the value result-
>      ing  from  the conversion is negated. A pointer to the final
>      string is stored in the object pointed to  by  endptr,  pro-
>      vided that endptr is not a null pointer.
>
>
>      If the subject sequence  is  empty  or  does  not  have  the
>      expected   form, no conversion is performed and the value of
>      str is stored in the object pointed to by  endptr,  provided
>      that endptr is not a null pointer.
>
> RETURN VALUES
>      Upon successful  completion,  ddi_strtoll()  returns  0  and
>      stores  the  converted  value in result. If no conversion is
>
>
>
> SunOS 5.11          Last change: 20 Nov 2008                    2
>
>
> Kernel Functions for Drivers                      ddi_strtoll(9F)
>
>
>
>      performed due to invalid base, ddi_strtoll() returns  EINVAL
>      and the variable pointed by result is not changed.
>
>
>      If the correct value is outside the range  of  representable
>      values,  ddi_strtoll()  returns ERANGE and the value pointed
>      to by result is not changed.
>
> CONTEXT
>      The ddi_strtoll() function may be called from  user,  kernel
>      or interrupt context.
>
> SEE ALSO
>      Writing Device Drivers
>
>
> SunOS 5.11          Last change: 20 Nov 2008                    3
>
>
>
>
> Kernel Functions for Drivers                     ddi_strtoull(9F)
>
>
> NAME
>      ddi_strtoull - String conversion functions
>
> SYNOPSIS
>      #include <sys/ddi.h>
>      #include <sys/sunddi.h>
>
>      int ddi_strtoull(const char *str, char **endptr, int base,
>          u_longlong_t *result);
>
>
> INTERFACE LEVEL
>      Solaris DDI specific (Solaris DDI)
>
> PARAMETERS
>      str        Pointer to a character string to be converted.
>
>
>      endptr     Post-conversion  final  string  of   unrecognized
>                 characters.
>
>
>      base       Radix used for conversion.
>
>
>      result     Pointer to variable which contains the  converted
>                 value.
>
>
> DESCRIPTION
>      The ddi_strtoull() function converts the initial  portion of
>      the  string  pointed  to  by  str  to  a  type  u_longlong_t
>      representation and stores the converted value in result.
>
>
>      The  function first decomposes the input string  into  three
>      parts:
>
>          1.   An initial (possibly empty) sequence of white-space
>               characters (' ', '\t', '\n', '\r', '\f')
>
>          2.   A  subject  sequence  interpreted  as  an   integer
>               represented  in  some radix determined by the value
>               of base
>
>          3.   A final  string of one or more unrecognized charac-
>               ters,  including  the  terminating null byte of the
>               input string.
>
>
>      The  ddi_strtoull()  function then  attempts to  convert the
>      subject  sequence  to an  unsigned integer  and returns  the
>      result.
>
>
> SunOS 5.11          Last change: 20 Nov 2008                    1
>
>
> Kernel Functions for Drivers                     ddi_strtoull(9F)
>
>
>
>      If the value of base is 0, the expected form of the  subject
>      sequence  is  that  of a decimal constant, octal constant or
>      hexadecimal constant, any of which may be preceded by a plus
>      ("+")  or minus ("-") sign. A decimal constant begins with a
>      non-zero digit,  and  consists  of  a  sequence  of  decimal
>      digits. An octal constant consists  of  the prefix 0 option-
>      ally followed by a sequence of the digits 0  to  7  only.  A
>      hexadecimal   constant  consists of the prefix 0x or 0X fol-
>      lowed by a sequence of the decimal digits and letters a  (or
>      A) to f (or F) with values 10 to 15 respectively.
>
>
>      If the value of base is between 2 and 36, the expected  form
>      of  the subject sequence is a sequence of letters and digits
>      representing an integer with the radix  specified  by  base,
>      optionally  preceded  by  a  plus or minus sign. The letters
>      from a (or A) to z (or Z) inclusive are ascribed the  values
>      10  to  35  and  only letters whose ascribed values are less
>      than that of base are permitted. If the value of base is 16,
>      the  characters 0x or 0X may optionally precede the sequence
>      of letters and digits, following the sign if present.
>
>
>      The subject sequence is  defined   as  the  longest  initial
>      subsequence  of  the  input  string, starting with the first
>      non-white-space character that is of the expected form.  The
>      subject  sequence contains no characters if the input string
>      is empty or consists entirely of white-space characters,  or
>      if  the first non-white-space character is other than a sign
>      or a permissible letter or digit.
>
>
>      If the subject sequence has the expected form and the  value
>      of  base  is 0, the sequence of characters starting with the
>      first digit is interpreted as an integer  constant.  If  the
>      subject sequence has the expected form and the value of base
>      is between 2 and 36, it is used as the base for  conversion,
>      ascribing   to  each letter its value as given above. If the
>      subject sequence begins with a minus sign, the value result-
>      ing  from  the conversion is negated. A pointer to the final
>      string is stored in the object pointed to  by  endptr,  pro-
>      vided that endptr is not a null pointer.
>
>
>      If the subject sequence  is  empty  or  does  not  have  the
>      expected   form, no conversion is performed and the value of
>      str is stored in the object pointed to by  endptr,  provided
>      that endptr is not a null pointer.
>
> RETURN VALUES
>      Upon successful  completion,  ddi_strtoull()  returns  0 and
>      stores  the  converted  value in result. If no conversion is
>
>
>
> SunOS 5.11          Last change: 20 Nov 2008                    2
>
>
> Kernel Functions for Drivers                     ddi_strtoull(9F)
>
>
>
>      performed due to invalid base, ddi_strtoull() returns EINVAL
>      and the variable pointed by result is not changed.
>
>
>      If the correct value is outside the range  of  representable
>      values, ddi_strtoull()  returns ERANGE and the value pointed
>      to by result is not changed.
>
> CONTEXT
>      The ddi_strtoull() function may be called from  user, kernel
>      or interrupt context.
>
> SEE ALSO
>      Writing Device Drivers
>
>
> SunOS 5.11          Last change: 20 Nov 2008                    3
>
>
>
> 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
>
>
> 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 Jordan.Vaughan@Sun.COM Mon Dec  1 16:34:28 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 mB20YRCY003395
	for <psarc-ext@sac.sfbay.sun.com>; Mon, 1 Dec 2008 16:34:27 -0800 (PST)
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 mB20YKW6013323;
	Tue, 2 Dec 2008 00:34:23 GMT
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 <0KB800K03499FK00@nwk-avmta-1.sfbay.Sun.COM>; Mon,
 01 Dec 2008 16:34:21 -0800 (PST)
Received: from jurassic-x4600.sfbay.sun.com ([129.146.17.59])
 by nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KB80085P499QWF0@nwk-avmta-1.sfbay.Sun.COM>; Mon,
 01 Dec 2008 16:34:21 -0800 (PST)
Received: from [129.146.228.104]
 (quidestveritas.SFBay.Sun.COM [129.146.228.104])
	by jurassic-x4600.sfbay.sun.com (8.14.3+Sun/8.14.3)
 with ESMTP id mB20YLCs950600; Mon, 01 Dec 2008 16:34:21 -0800 (PST)
Date: Mon, 01 Dec 2008 16:34:22 -0800
From: Jordan Vaughan <Jordan.Vaughan@Sun.COM>
Subject: Re: Cross-Platform DDI Interface for Converting Strings to 64-bit
 Integers [PSARC/2008/740 FastTrack timeout 12/09/2008]
In-reply-to: <4934795C.3030305@sun.com>
To: "Garrett D'Amore" <gdamore@Sun.COM>
Cc: Gerald Jelinek <gjelinek@sac.sfbay.sun.com>, PSARC-ext@Sun.COM,
        Gerald.Jelinek@Sun.COM
Message-id: <4934828E.3070502@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: <200812012311.mB1NBFAc015709@sac.sfbay.sun.com>
 <4934795C.3030305@sun.com>
User-Agent: Thunderbird 2.0.0.16 (X11/20080923)
Status: RO
Content-Length: 15588

On 12/01/08 15:55, Garrett D'Amore wrote:
> On a minor nit/suggestion, wouldn't it be simpler to just add the 
> functions to the existing ddi_strtol page.  (I noticed ddi_strtoul is a 
> separate page as well.  It seems kind of wasteful though, since mainly 
> these functions only differ in a relatively small detail.)
> 
>    -- Garrett

Good point.  I wouldn't mind amending the case to consolidate both 
ddi_strtoll() and ddi_strtoull() manpages into a single manpage.

Jordan

> 
> Gerald Jelinek wrote:
>> I am sponsoring this case for Jordan Vaughan.
>>
>> Thanks,
>> Jerry
>>
>> Template Version: @(#)sac_nextcase %I% %G% SMI
>> This information is Copyright 2008 Sun Microsystems
>> 1. Introduction
>>     1.1. Project/Component Working Name:
>>      Cross-Platform DDI Interface for Converting Strings to 64-bit 
>> Integers
>>     1.2. Name of Document Author/Supplier:
>>      Author:  Jordan Vaughan
>>     1.3  Date of This Document:
>>     01 December, 2008
>> 4. Technical Description
>> Template Version: @(#)sac_nextcase %I% %G% SMI
>> This information is Copyright 2008 Sun Microsystems
>> 1. Introduction
>>     1.1. Project/Component Working Name:
>>      Cross-Platform DDI Interface for Converting Strings to 64-bit 
>> Integers
>>     1.2. Name of Document Author/Supplier:
>>      Author:  Jordan Vaughan
>>     1.3  Date of This Document:
>>      20 November, 2008
>>
>> 4. Technical Description
>> Targeting an update release of Solaris 10, therefore patch binding.
>>
>>
>> PROBLEM:
>>
>> Device driver writers have no standard means of converting numerical 
>> strings to
>> 64-bit integers in both 32- and 64-bit builds.  Driver writers could use
>> ddi_strtol(9F) and ddi_strtoul(9F), but both produce 32-bit integers 
>> in 32-bit
>> driver builds.  Therefore, driver writers must resort to writing their 
>> own
>> string conversion subroutines or linking to project- or 
>> consolidation-private
>> string conversion functions, such as the undocumented function 
>> idm_strtoull().
>> However, these solutions are cumbersome, increase the probability of 
>> generating
>> bugs, and create dependencies on uncommitted, undocumented kernel 
>> functions.
>> This case proposes to rectify this deficiency by adding two new, 
>> committed
>> functions to the Solaris 10 and Solaris Nevada (and thus OpenSolaris) 
>> DDI called
>> ddi_strtoll() and ddi_strtoull() that will convert null-terminated 
>> character
>> strings into signed and unsigned 64-bit integers (respectively) in 
>> both 32- and
>> 64-bit builds.
>>
>>
>> EXPORTED INTERFACES:
>>
>>     FUNCTIONS:
>>         NAME            STABILITY  NOTES
>>         ddi_strtoll     Committed  In <sys/sunddi.h> under _KERNEL
>>         ddi_strtoull    Committed  In <sys/sunddi.h> under _KERNEL
>>
>>
>> TECHNICAL DESCRIPTION:
>>
>> The Solaris DDI currently provides two string-to-long-integer 
>> functions that
>> both kernel and driver coders can utilize: ddi_strtol(9F) and 
>> ddi_strtoul(9F).
>> Both functions convert strings to 32-bit integers in 32-bit builds and 
>> 64-bit
>> integers in 64-bit builds.
>>
>> It would be preferable to provide additional functions that would 
>> convert strings to 64-bit integers in both 32- and 64-bit builds.  
>> These functions,
>> ddi_strtoll() and ddi_strtoull(), would be functionally equivalent to
>> ddi_strtol() and ddi_strtoul() with the exception that the generated 
>> values
>> would be of types 'longlong_t' and 'u_longlong_t' (respectively) 
>> instead of
>> 'long int' and 'unsigned long int'.
>>
>> Given that kernel functions cannot safely utilize errno, both 
>> ddi_strtoll()
>> and ddi_strtoull() will differ from their userland equivalents 
>> (strtoll(3C) and
>> strtoull(3C)) in that the former will store their results in pointer 
>> arguments
>> and return error codes (whereas the latter return their results and store
>> error codes in errno).  This behavior is identical to that of 
>> ddi_strtol()
>> and ddi_strtoul().
>>
>>
>> RELATED BUGIDS:
>>
>>     6761505 RFE: having ddi_strtoull() would be nice
>>
>>
>> RELATED ARC CASES:
>>
>>     PSARC/2004/321: Add strtol() and strtoul() to the DDI
>>
>>
>> REFERENCE DOCUMENTS:
>>
>>     ddi_strtol(9F) and ddi_strtoul(9F) man pages
>>     Solaris Books: Writing Device Drivers (Solaris 10)
>>         (http://docs.sun.com/app/docs/doc/816-4854)
>>
>>
>> NEW MAN PAGES:
>>
>> Kernel Functions for Drivers                      ddi_strtoll(9F)
>>
>>
>>
>> NAME
>>      ddi_strtoll - String conversion functions
>>
>> SYNOPSIS
>>      #include <sys/ddi.h>
>>      #include <sys/sunddi.h>
>>
>>      int ddi_strtoll(const char *str, char **endptr, int base,
>>          longlong_t *result);
>>
>>
>> INTERFACE LEVEL
>>      Solaris DDI specific (Solaris DDI)
>>
>> PARAMETERS
>>      str        Pointer to a character string to be converted.
>>
>>
>>      endptr     Post-conversion  final  string  of   unrecognized
>>                 characters.
>>
>>
>>      base       Radix used for conversion.
>>
>>
>>      result     Pointer to variable which contains the  converted
>>                 value.
>>
>>
>> DESCRIPTION
>>      The ddi_strtoll() function converts the initial  portion  of
>>      the  string   pointed  to  by   str  to  a  type  longlong_t
>>      representation and stores the converted value in result.
>>
>>
>>      The  function first decomposes the input string  into  three
>>      parts:
>>
>>          1.   An initial (possibly empty) sequence of white-space
>>               characters (' ', '\t', '\n', '\r', '\f')
>>
>>          2.   A  subject  sequence  interpreted  as  an   integer
>>               represented  in  some radix determined by the value
>>               of base
>>
>>          3.   A final  string of one or more unrecognized charac-
>>               ters,  including  the  terminating null byte of the
>>               input string.
>>
>>
>>      The ddi_strtoll() function then attempts to convert the sub-
>>      ject sequence to an integer and returns the result.
>>
>>
>>
>> SunOS 5.11          Last change: 20 Nov 2008                    1
>>
>>
>>
>> Kernel Functions for Drivers                      ddi_strtoll(9F)
>>
>>
>>
>>      If the value of base is 0, the expected form of the  subject
>>      sequence  is  that  of a decimal constant, octal constant or
>>      hexadecimal constant, any of which may be preceded by a plus
>>      ("+")  or minus ("-") sign. A decimal constant begins with a
>>      non-zero digit,  and  consists  of  a  sequence  of  decimal
>>      digits. An octal constant consists  of  the prefix 0 option-
>>      ally followed by a sequence of the digits 0  to  7  only.  A
>>      hexadecimal   constant  consists of the prefix 0x or 0X fol-
>>      lowed by a sequence of the decimal digits and letters a  (or
>>      A) to f (or F) with values 10 to 15 respectively.
>>
>>
>>      If the value of base is between 2 and 36, the expected  form
>>      of  the subject sequence is a sequence of letters and digits
>>      representing an integer with the radix  specified  by  base,
>>      optionally  preceded  by  a  plus or minus sign. The letters
>>      from a (or A) to z (or Z) inclusive are ascribed the  values
>>      10  to  35  and  only letters whose ascribed values are less
>>      than that of base are permitted. If the value of base is 16,
>>      the  characters 0x or 0X may optionally precede the sequence
>>      of letters and digits, following the sign if present.
>>
>>
>>      The subject sequence is  defined   as  the  longest  initial
>>      subsequence  of  the  input  string, starting with the first
>>      non-white-space character that is of the expected form.  The
>>      subject  sequence contains no characters if the input string
>>      is empty or consists entirely of white-space characters,  or
>>      if  the first non-white-space character is other than a sign
>>      or a permissible letter or digit.
>>
>>
>>      If the subject sequence has the expected form and the  value
>>      of  base  is 0, the sequence of characters starting with the
>>      first digit is interpreted as an integer  constant.  If  the
>>      subject sequence has the expected form and the value of base
>>      is between 2 and 36, it is used as the base for  conversion,
>>      ascribing   to  each letter its value as given above. If the
>>      subject sequence begins with a minus sign, the value result-
>>      ing  from  the conversion is negated. A pointer to the final
>>      string is stored in the object pointed to  by  endptr,  pro-
>>      vided that endptr is not a null pointer.
>>
>>
>>      If the subject sequence  is  empty  or  does  not  have  the
>>      expected   form, no conversion is performed and the value of
>>      str is stored in the object pointed to by  endptr,  provided
>>      that endptr is not a null pointer.
>>
>> RETURN VALUES
>>      Upon successful  completion,  ddi_strtoll()  returns  0  and
>>      stores  the  converted  value in result. If no conversion is
>>
>>
>>
>> SunOS 5.11          Last change: 20 Nov 2008                    2
>>
>>
>> Kernel Functions for Drivers                      ddi_strtoll(9F)
>>
>>
>>
>>      performed due to invalid base, ddi_strtoll() returns  EINVAL
>>      and the variable pointed by result is not changed.
>>
>>
>>      If the correct value is outside the range  of  representable
>>      values,  ddi_strtoll()  returns ERANGE and the value pointed
>>      to by result is not changed.
>>
>> CONTEXT
>>      The ddi_strtoll() function may be called from  user,  kernel
>>      or interrupt context.
>>
>> SEE ALSO
>>      Writing Device Drivers
>>
>>
>> SunOS 5.11          Last change: 20 Nov 2008                    3
>>
>>
>>
>>
>> Kernel Functions for Drivers                     ddi_strtoull(9F)
>>
>>
>> NAME
>>      ddi_strtoull - String conversion functions
>>
>> SYNOPSIS
>>      #include <sys/ddi.h>
>>      #include <sys/sunddi.h>
>>
>>      int ddi_strtoull(const char *str, char **endptr, int base,
>>          u_longlong_t *result);
>>
>>
>> INTERFACE LEVEL
>>      Solaris DDI specific (Solaris DDI)
>>
>> PARAMETERS
>>      str        Pointer to a character string to be converted.
>>
>>
>>      endptr     Post-conversion  final  string  of   unrecognized
>>                 characters.
>>
>>
>>      base       Radix used for conversion.
>>
>>
>>      result     Pointer to variable which contains the  converted
>>                 value.
>>
>>
>> DESCRIPTION
>>      The ddi_strtoull() function converts the initial  portion of
>>      the  string  pointed  to  by  str  to  a  type  u_longlong_t
>>      representation and stores the converted value in result.
>>
>>
>>      The  function first decomposes the input string  into  three
>>      parts:
>>
>>          1.   An initial (possibly empty) sequence of white-space
>>               characters (' ', '\t', '\n', '\r', '\f')
>>
>>          2.   A  subject  sequence  interpreted  as  an   integer
>>               represented  in  some radix determined by the value
>>               of base
>>
>>          3.   A final  string of one or more unrecognized charac-
>>               ters,  including  the  terminating null byte of the
>>               input string.
>>
>>
>>      The  ddi_strtoull()  function then  attempts to  convert the
>>      subject  sequence  to an  unsigned integer  and returns  the
>>      result.
>>
>>
>> SunOS 5.11          Last change: 20 Nov 2008                    1
>>
>>
>> Kernel Functions for Drivers                     ddi_strtoull(9F)
>>
>>
>>
>>      If the value of base is 0, the expected form of the  subject
>>      sequence  is  that  of a decimal constant, octal constant or
>>      hexadecimal constant, any of which may be preceded by a plus
>>      ("+")  or minus ("-") sign. A decimal constant begins with a
>>      non-zero digit,  and  consists  of  a  sequence  of  decimal
>>      digits. An octal constant consists  of  the prefix 0 option-
>>      ally followed by a sequence of the digits 0  to  7  only.  A
>>      hexadecimal   constant  consists of the prefix 0x or 0X fol-
>>      lowed by a sequence of the decimal digits and letters a  (or
>>      A) to f (or F) with values 10 to 15 respectively.
>>
>>
>>      If the value of base is between 2 and 36, the expected  form
>>      of  the subject sequence is a sequence of letters and digits
>>      representing an integer with the radix  specified  by  base,
>>      optionally  preceded  by  a  plus or minus sign. The letters
>>      from a (or A) to z (or Z) inclusive are ascribed the  values
>>      10  to  35  and  only letters whose ascribed values are less
>>      than that of base are permitted. If the value of base is 16,
>>      the  characters 0x or 0X may optionally precede the sequence
>>      of letters and digits, following the sign if present.
>>
>>
>>      The subject sequence is  defined   as  the  longest  initial
>>      subsequence  of  the  input  string, starting with the first
>>      non-white-space character that is of the expected form.  The
>>      subject  sequence contains no characters if the input string
>>      is empty or consists entirely of white-space characters,  or
>>      if  the first non-white-space character is other than a sign
>>      or a permissible letter or digit.
>>
>>
>>      If the subject sequence has the expected form and the  value
>>      of  base  is 0, the sequence of characters starting with the
>>      first digit is interpreted as an integer  constant.  If  the
>>      subject sequence has the expected form and the value of base
>>      is between 2 and 36, it is used as the base for  conversion,
>>      ascribing   to  each letter its value as given above. If the
>>      subject sequence begins with a minus sign, the value result-
>>      ing  from  the conversion is negated. A pointer to the final
>>      string is stored in the object pointed to  by  endptr,  pro-
>>      vided that endptr is not a null pointer.
>>
>>
>>      If the subject sequence  is  empty  or  does  not  have  the
>>      expected   form, no conversion is performed and the value of
>>      str is stored in the object pointed to by  endptr,  provided
>>      that endptr is not a null pointer.
>>
>> RETURN VALUES
>>      Upon successful  completion,  ddi_strtoull()  returns  0 and
>>      stores  the  converted  value in result. If no conversion is
>>
>>
>>
>> SunOS 5.11          Last change: 20 Nov 2008                    2
>>
>>
>> Kernel Functions for Drivers                     ddi_strtoull(9F)
>>
>>
>>
>>      performed due to invalid base, ddi_strtoull() returns EINVAL
>>      and the variable pointed by result is not changed.
>>
>>
>>      If the correct value is outside the range  of  representable
>>      values, ddi_strtoull()  returns ERANGE and the value pointed
>>      to by result is not changed.
>>
>> CONTEXT
>>      The ddi_strtoull() function may be called from  user, kernel
>>      or interrupt context.
>>
>> SEE ALSO
>>      Writing Device Drivers
>>
>>
>> SunOS 5.11          Last change: 20 Nov 2008                    3
>>
>>
>>
>> 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
>>
>>
>> 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 Dec  1 16:51:12 2008
Received: from sunmail2sca.sfbay.sun.com (sunmail2sca.SFBay.Sun.COM [129.145.155.234])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id mB20pCQr003856
	for <psarc-ext@sac.sfbay.sun.com>; Mon, 1 Dec 2008 16:51:12 -0800 (PST)
Received: from brm-avmta-1.central.sun.com (brm-avmta-1.Central.Sun.COM [129.147.4.11])
	by sunmail2sca.sfbay.sun.com (8.13.7+Sun/8.13.7/ENSMAIL,v2.2) with ESMTP id mB20pAMT013292
	for <@sunmail2sca.sfbay.sun.com:PSARC-ext@sun.com>; Mon, 1 Dec 2008 16:51:11 -0800 (PST)
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 <0KB800H0N51BBE00@brm-avmta-1.central.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@Sun.COM); Mon, 01 Dec 2008 17:51:11 -0700 (MST)
Received: from sca-es-mail-2.sun.com ([192.18.43.133])
 by brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KB8002ER51A1RF0@brm-avmta-1.central.sun.com> for
 PSARC-ext@sun.com (ORCPT PSARC-ext@Sun.COM); Mon,
 01 Dec 2008 17:51:10 -0700 (MST)
Received: from fe-sfbay-09.sun.com ([192.18.43.129])
	by sca-es-mail-2.sun.com (8.13.7+Sun/8.12.9) with ESMTP id mB20pAGE014850	for
 <PSARC-ext@Sun.COM>; Mon, 01 Dec 2008 16:51:10 -0800 (PST)
Received: from conversion-daemon.fe-sfbay-09.sun.com by fe-sfbay-09.sun.com
 (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007))
 id <0KB800A014YMAY00@fe-sfbay-09.sun.com> (original mail from gdamore@sun.com)
 for PSARC-ext@Sun.COM (ORCPT PSARC-ext@Sun.COM); Mon,
 01 Dec 2008 16:51:10 -0800 (PST)
Received: from [10.7.251.172] by fe-sfbay-09.sun.com
 (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007))
 with ESMTPSA id <0KB800GUZ519CK50@fe-sfbay-09.sun.com>; Mon,
 01 Dec 2008 16:51:10 -0800 (PST)
Date: Mon, 01 Dec 2008 16:44:26 -0800
From: "Garrett D'Amore" <gdamore@sun.com>
Subject: Re: Cross-Platform DDI Interface for Converting Strings to 64-bit
 Integers [PSARC/2008/740 FastTrack timeout 12/09/2008]
In-reply-to: <4934828E.3070502@Sun.com>
Sender: Garrett.Damore@sun.com
To: Jordan Vaughan <Jordan.Vaughan@sun.com>
Cc: Gerald Jelinek <gjelinek@sac.sfbay.sun.com>, PSARC-ext@sun.com,
        Gerald.Jelinek@sun.com
Message-id: <493484EA.8020301@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: <200812012311.mB1NBFAc015709@sac.sfbay.sun.com>
 <4934795C.3030305@sun.com> <4934828E.3070502@Sun.com>
User-Agent: Thunderbird 2.0.0.14 (X11/20080616)
Status: RO
Content-Length: 16301

Jordan Vaughan wrote:
> On 12/01/08 15:55, Garrett D'Amore wrote:
>> On a minor nit/suggestion, wouldn't it be simpler to just add the 
>> functions to the existing ddi_strtol page.  (I noticed ddi_strtoul is 
>> a separate page as well.  It seems kind of wasteful though, since 
>> mainly these functions only differ in a relatively small detail.)
>>
>>    -- Garrett
>
> Good point.  I wouldn't mind amending the case to consolidate both 
> ddi_strtoll() and ddi_strtoull() manpages into a single manpage.

No need to update the case materials unless you really want to.   The 
suggestion was one that can be done without affecting anything 
substantive about the case itself, and can be handled without ARC 
involvement.

    -- Garrett
>
> Jordan
>
>>
>> Gerald Jelinek wrote:
>>> I am sponsoring this case for Jordan Vaughan.
>>>
>>> Thanks,
>>> Jerry
>>>
>>> Template Version: @(#)sac_nextcase %I% %G% SMI
>>> This information is Copyright 2008 Sun Microsystems
>>> 1. Introduction
>>>     1.1. Project/Component Working Name:
>>>      Cross-Platform DDI Interface for Converting Strings to 64-bit 
>>> Integers
>>>     1.2. Name of Document Author/Supplier:
>>>      Author:  Jordan Vaughan
>>>     1.3  Date of This Document:
>>>     01 December, 2008
>>> 4. Technical Description
>>> Template Version: @(#)sac_nextcase %I% %G% SMI
>>> This information is Copyright 2008 Sun Microsystems
>>> 1. Introduction
>>>     1.1. Project/Component Working Name:
>>>      Cross-Platform DDI Interface for Converting Strings to 64-bit 
>>> Integers
>>>     1.2. Name of Document Author/Supplier:
>>>      Author:  Jordan Vaughan
>>>     1.3  Date of This Document:
>>>      20 November, 2008
>>>
>>> 4. Technical Description
>>> Targeting an update release of Solaris 10, therefore patch binding.
>>>
>>>
>>> PROBLEM:
>>>
>>> Device driver writers have no standard means of converting numerical 
>>> strings to
>>> 64-bit integers in both 32- and 64-bit builds.  Driver writers could 
>>> use
>>> ddi_strtol(9F) and ddi_strtoul(9F), but both produce 32-bit integers 
>>> in 32-bit
>>> driver builds.  Therefore, driver writers must resort to writing 
>>> their own
>>> string conversion subroutines or linking to project- or 
>>> consolidation-private
>>> string conversion functions, such as the undocumented function 
>>> idm_strtoull().
>>> However, these solutions are cumbersome, increase the probability of 
>>> generating
>>> bugs, and create dependencies on uncommitted, undocumented kernel 
>>> functions.
>>> This case proposes to rectify this deficiency by adding two new, 
>>> committed
>>> functions to the Solaris 10 and Solaris Nevada (and thus 
>>> OpenSolaris) DDI called
>>> ddi_strtoll() and ddi_strtoull() that will convert null-terminated 
>>> character
>>> strings into signed and unsigned 64-bit integers (respectively) in 
>>> both 32- and
>>> 64-bit builds.
>>>
>>>
>>> EXPORTED INTERFACES:
>>>
>>>     FUNCTIONS:
>>>         NAME            STABILITY  NOTES
>>>         ddi_strtoll     Committed  In <sys/sunddi.h> under _KERNEL
>>>         ddi_strtoull    Committed  In <sys/sunddi.h> under _KERNEL
>>>
>>>
>>> TECHNICAL DESCRIPTION:
>>>
>>> The Solaris DDI currently provides two string-to-long-integer 
>>> functions that
>>> both kernel and driver coders can utilize: ddi_strtol(9F) and 
>>> ddi_strtoul(9F).
>>> Both functions convert strings to 32-bit integers in 32-bit builds 
>>> and 64-bit
>>> integers in 64-bit builds.
>>>
>>> It would be preferable to provide additional functions that would 
>>> convert strings to 64-bit integers in both 32- and 64-bit builds.  
>>> These functions,
>>> ddi_strtoll() and ddi_strtoull(), would be functionally equivalent to
>>> ddi_strtol() and ddi_strtoul() with the exception that the generated 
>>> values
>>> would be of types 'longlong_t' and 'u_longlong_t' (respectively) 
>>> instead of
>>> 'long int' and 'unsigned long int'.
>>>
>>> Given that kernel functions cannot safely utilize errno, both 
>>> ddi_strtoll()
>>> and ddi_strtoull() will differ from their userland equivalents 
>>> (strtoll(3C) and
>>> strtoull(3C)) in that the former will store their results in pointer 
>>> arguments
>>> and return error codes (whereas the latter return their results and 
>>> store
>>> error codes in errno).  This behavior is identical to that of 
>>> ddi_strtol()
>>> and ddi_strtoul().
>>>
>>>
>>> RELATED BUGIDS:
>>>
>>>     6761505 RFE: having ddi_strtoull() would be nice
>>>
>>>
>>> RELATED ARC CASES:
>>>
>>>     PSARC/2004/321: Add strtol() and strtoul() to the DDI
>>>
>>>
>>> REFERENCE DOCUMENTS:
>>>
>>>     ddi_strtol(9F) and ddi_strtoul(9F) man pages
>>>     Solaris Books: Writing Device Drivers (Solaris 10)
>>>         (http://docs.sun.com/app/docs/doc/816-4854)
>>>
>>>
>>> NEW MAN PAGES:
>>>
>>> Kernel Functions for Drivers                      ddi_strtoll(9F)
>>>
>>>
>>>
>>> NAME
>>>      ddi_strtoll - String conversion functions
>>>
>>> SYNOPSIS
>>>      #include <sys/ddi.h>
>>>      #include <sys/sunddi.h>
>>>
>>>      int ddi_strtoll(const char *str, char **endptr, int base,
>>>          longlong_t *result);
>>>
>>>
>>> INTERFACE LEVEL
>>>      Solaris DDI specific (Solaris DDI)
>>>
>>> PARAMETERS
>>>      str        Pointer to a character string to be converted.
>>>
>>>
>>>      endptr     Post-conversion  final  string  of   unrecognized
>>>                 characters.
>>>
>>>
>>>      base       Radix used for conversion.
>>>
>>>
>>>      result     Pointer to variable which contains the  converted
>>>                 value.
>>>
>>>
>>> DESCRIPTION
>>>      The ddi_strtoll() function converts the initial  portion  of
>>>      the  string   pointed  to  by   str  to  a  type  longlong_t
>>>      representation and stores the converted value in result.
>>>
>>>
>>>      The  function first decomposes the input string  into  three
>>>      parts:
>>>
>>>          1.   An initial (possibly empty) sequence of white-space
>>>               characters (' ', '\t', '\n', '\r', '\f')
>>>
>>>          2.   A  subject  sequence  interpreted  as  an   integer
>>>               represented  in  some radix determined by the value
>>>               of base
>>>
>>>          3.   A final  string of one or more unrecognized charac-
>>>               ters,  including  the  terminating null byte of the
>>>               input string.
>>>
>>>
>>>      The ddi_strtoll() function then attempts to convert the sub-
>>>      ject sequence to an integer and returns the result.
>>>
>>>
>>>
>>> SunOS 5.11          Last change: 20 Nov 2008                    1
>>>
>>>
>>>
>>> Kernel Functions for Drivers                      ddi_strtoll(9F)
>>>
>>>
>>>
>>>      If the value of base is 0, the expected form of the  subject
>>>      sequence  is  that  of a decimal constant, octal constant or
>>>      hexadecimal constant, any of which may be preceded by a plus
>>>      ("+")  or minus ("-") sign. A decimal constant begins with a
>>>      non-zero digit,  and  consists  of  a  sequence  of  decimal
>>>      digits. An octal constant consists  of  the prefix 0 option-
>>>      ally followed by a sequence of the digits 0  to  7  only.  A
>>>      hexadecimal   constant  consists of the prefix 0x or 0X fol-
>>>      lowed by a sequence of the decimal digits and letters a  (or
>>>      A) to f (or F) with values 10 to 15 respectively.
>>>
>>>
>>>      If the value of base is between 2 and 36, the expected  form
>>>      of  the subject sequence is a sequence of letters and digits
>>>      representing an integer with the radix  specified  by  base,
>>>      optionally  preceded  by  a  plus or minus sign. The letters
>>>      from a (or A) to z (or Z) inclusive are ascribed the  values
>>>      10  to  35  and  only letters whose ascribed values are less
>>>      than that of base are permitted. If the value of base is 16,
>>>      the  characters 0x or 0X may optionally precede the sequence
>>>      of letters and digits, following the sign if present.
>>>
>>>
>>>      The subject sequence is  defined   as  the  longest  initial
>>>      subsequence  of  the  input  string, starting with the first
>>>      non-white-space character that is of the expected form.  The
>>>      subject  sequence contains no characters if the input string
>>>      is empty or consists entirely of white-space characters,  or
>>>      if  the first non-white-space character is other than a sign
>>>      or a permissible letter or digit.
>>>
>>>
>>>      If the subject sequence has the expected form and the  value
>>>      of  base  is 0, the sequence of characters starting with the
>>>      first digit is interpreted as an integer  constant.  If  the
>>>      subject sequence has the expected form and the value of base
>>>      is between 2 and 36, it is used as the base for  conversion,
>>>      ascribing   to  each letter its value as given above. If the
>>>      subject sequence begins with a minus sign, the value result-
>>>      ing  from  the conversion is negated. A pointer to the final
>>>      string is stored in the object pointed to  by  endptr,  pro-
>>>      vided that endptr is not a null pointer.
>>>
>>>
>>>      If the subject sequence  is  empty  or  does  not  have  the
>>>      expected   form, no conversion is performed and the value of
>>>      str is stored in the object pointed to by  endptr,  provided
>>>      that endptr is not a null pointer.
>>>
>>> RETURN VALUES
>>>      Upon successful  completion,  ddi_strtoll()  returns  0  and
>>>      stores  the  converted  value in result. If no conversion is
>>>
>>>
>>>
>>> SunOS 5.11          Last change: 20 Nov 2008                    2
>>>
>>>
>>> Kernel Functions for Drivers                      ddi_strtoll(9F)
>>>
>>>
>>>
>>>      performed due to invalid base, ddi_strtoll() returns  EINVAL
>>>      and the variable pointed by result is not changed.
>>>
>>>
>>>      If the correct value is outside the range  of  representable
>>>      values,  ddi_strtoll()  returns ERANGE and the value pointed
>>>      to by result is not changed.
>>>
>>> CONTEXT
>>>      The ddi_strtoll() function may be called from  user,  kernel
>>>      or interrupt context.
>>>
>>> SEE ALSO
>>>      Writing Device Drivers
>>>
>>>
>>> SunOS 5.11          Last change: 20 Nov 2008                    3
>>>
>>>
>>>
>>>
>>> Kernel Functions for Drivers                     ddi_strtoull(9F)
>>>
>>>
>>> NAME
>>>      ddi_strtoull - String conversion functions
>>>
>>> SYNOPSIS
>>>      #include <sys/ddi.h>
>>>      #include <sys/sunddi.h>
>>>
>>>      int ddi_strtoull(const char *str, char **endptr, int base,
>>>          u_longlong_t *result);
>>>
>>>
>>> INTERFACE LEVEL
>>>      Solaris DDI specific (Solaris DDI)
>>>
>>> PARAMETERS
>>>      str        Pointer to a character string to be converted.
>>>
>>>
>>>      endptr     Post-conversion  final  string  of   unrecognized
>>>                 characters.
>>>
>>>
>>>      base       Radix used for conversion.
>>>
>>>
>>>      result     Pointer to variable which contains the  converted
>>>                 value.
>>>
>>>
>>> DESCRIPTION
>>>      The ddi_strtoull() function converts the initial  portion of
>>>      the  string  pointed  to  by  str  to  a  type  u_longlong_t
>>>      representation and stores the converted value in result.
>>>
>>>
>>>      The  function first decomposes the input string  into  three
>>>      parts:
>>>
>>>          1.   An initial (possibly empty) sequence of white-space
>>>               characters (' ', '\t', '\n', '\r', '\f')
>>>
>>>          2.   A  subject  sequence  interpreted  as  an   integer
>>>               represented  in  some radix determined by the value
>>>               of base
>>>
>>>          3.   A final  string of one or more unrecognized charac-
>>>               ters,  including  the  terminating null byte of the
>>>               input string.
>>>
>>>
>>>      The  ddi_strtoull()  function then  attempts to  convert the
>>>      subject  sequence  to an  unsigned integer  and returns  the
>>>      result.
>>>
>>>
>>> SunOS 5.11          Last change: 20 Nov 2008                    1
>>>
>>>
>>> Kernel Functions for Drivers                     ddi_strtoull(9F)
>>>
>>>
>>>
>>>      If the value of base is 0, the expected form of the  subject
>>>      sequence  is  that  of a decimal constant, octal constant or
>>>      hexadecimal constant, any of which may be preceded by a plus
>>>      ("+")  or minus ("-") sign. A decimal constant begins with a
>>>      non-zero digit,  and  consists  of  a  sequence  of  decimal
>>>      digits. An octal constant consists  of  the prefix 0 option-
>>>      ally followed by a sequence of the digits 0  to  7  only.  A
>>>      hexadecimal   constant  consists of the prefix 0x or 0X fol-
>>>      lowed by a sequence of the decimal digits and letters a  (or
>>>      A) to f (or F) with values 10 to 15 respectively.
>>>
>>>
>>>      If the value of base is between 2 and 36, the expected  form
>>>      of  the subject sequence is a sequence of letters and digits
>>>      representing an integer with the radix  specified  by  base,
>>>      optionally  preceded  by  a  plus or minus sign. The letters
>>>      from a (or A) to z (or Z) inclusive are ascribed the  values
>>>      10  to  35  and  only letters whose ascribed values are less
>>>      than that of base are permitted. If the value of base is 16,
>>>      the  characters 0x or 0X may optionally precede the sequence
>>>      of letters and digits, following the sign if present.
>>>
>>>
>>>      The subject sequence is  defined   as  the  longest  initial
>>>      subsequence  of  the  input  string, starting with the first
>>>      non-white-space character that is of the expected form.  The
>>>      subject  sequence contains no characters if the input string
>>>      is empty or consists entirely of white-space characters,  or
>>>      if  the first non-white-space character is other than a sign
>>>      or a permissible letter or digit.
>>>
>>>
>>>      If the subject sequence has the expected form and the  value
>>>      of  base  is 0, the sequence of characters starting with the
>>>      first digit is interpreted as an integer  constant.  If  the
>>>      subject sequence has the expected form and the value of base
>>>      is between 2 and 36, it is used as the base for  conversion,
>>>      ascribing   to  each letter its value as given above. If the
>>>      subject sequence begins with a minus sign, the value result-
>>>      ing  from  the conversion is negated. A pointer to the final
>>>      string is stored in the object pointed to  by  endptr,  pro-
>>>      vided that endptr is not a null pointer.
>>>
>>>
>>>      If the subject sequence  is  empty  or  does  not  have  the
>>>      expected   form, no conversion is performed and the value of
>>>      str is stored in the object pointed to by  endptr,  provided
>>>      that endptr is not a null pointer.
>>>
>>> RETURN VALUES
>>>      Upon successful  completion,  ddi_strtoull()  returns  0 and
>>>      stores  the  converted  value in result. If no conversion is
>>>
>>>
>>>
>>> SunOS 5.11          Last change: 20 Nov 2008                    2
>>>
>>>
>>> Kernel Functions for Drivers                     ddi_strtoull(9F)
>>>
>>>
>>>
>>>      performed due to invalid base, ddi_strtoull() returns EINVAL
>>>      and the variable pointed by result is not changed.
>>>
>>>
>>>      If the correct value is outside the range  of  representable
>>>      values, ddi_strtoull()  returns ERANGE and the value pointed
>>>      to by result is not changed.
>>>
>>> CONTEXT
>>>      The ddi_strtoull() function may be called from  user, kernel
>>>      or interrupt context.
>>>
>>> SEE ALSO
>>>      Writing Device Drivers
>>>
>>>
>>> SunOS 5.11          Last change: 20 Nov 2008                    3
>>>
>>>
>>>
>>> 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
>>>
>>>
>>> 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 Jordan.Vaughan@sun.com Mon Dec  1 16:56:01 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 mB20u0Yq004238
	for <psarc-ext@sac.sfbay.Sun.COM>; Mon, 1 Dec 2008 16:56:01 -0800 (PST)
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 mB20tjBZ011400;
	Tue, 2 Dec 2008 08:55:56 +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 <0KB80000F597AN00@nwk-avmta-1.sfbay.Sun.COM>; Mon,
 01 Dec 2008 16:55:55 -0800 (PST)
Received: from jurassic-x4600.sfbay.sun.com ([129.146.17.63])
 by nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KB800KBT597N990@nwk-avmta-1.sfbay.Sun.COM>; Mon,
 01 Dec 2008 16:55:55 -0800 (PST)
Received: from [129.146.228.104]
 (quidestveritas.SFBay.Sun.COM [129.146.228.104])
	by jurassic-x4600.sfbay.sun.com (8.14.3+Sun/8.14.3)
 with ESMTP id mB20ttRW953940; Mon, 01 Dec 2008 16:55:55 -0800 (PST)
Date: Mon, 01 Dec 2008 16:55:56 -0800
From: Jordan Vaughan <Jordan.Vaughan@sun.com>
Subject: Re: Cross-Platform DDI Interface for Converting Strings to 64-bit
 Integers [PSARC/2008/740 FastTrack timeout 12/09/2008]
In-reply-to: <493484EA.8020301@sun.com>
To: "Garrett D'Amore" <gdamore@sun.com>
Cc: Gerald Jelinek <gjelinek@sac.sfbay.sun.com>, PSARC-ext@sun.com,
        Gerald.Jelinek@sun.com
Message-id: <4934879C.5030704@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: <200812012311.mB1NBFAc015709@sac.sfbay.sun.com>
 <4934795C.3030305@sun.com> <4934828E.3070502@Sun.com>
 <493484EA.8020301@sun.com>
User-Agent: Thunderbird 2.0.0.16 (X11/20080923)
Status: RO
Content-Length: 16999

On 12/01/08 16:44, Garrett D'Amore wrote:
> Jordan Vaughan wrote:
>> On 12/01/08 15:55, Garrett D'Amore wrote:
>>> On a minor nit/suggestion, wouldn't it be simpler to just add the 
>>> functions to the existing ddi_strtol page.  (I noticed ddi_strtoul is 
>>> a separate page as well.  It seems kind of wasteful though, since 
>>> mainly these functions only differ in a relatively small detail.)
>>>
>>>    -- Garrett
>>
>> Good point.  I wouldn't mind amending the case to consolidate both 
>> ddi_strtoll() and ddi_strtoull() manpages into a single manpage.
> 
> No need to update the case materials unless you really want to.   The 
> suggestion was one that can be done without affecting anything 
> substantive about the case itself, and can be handled without ARC 
> involvement.
> 
>    -- Garrett

All right, if that's the case, then I'll leave the case as is.  I'm 
relatively new to ARC procedures, so I didn't know whether such details 
had to be faithfully reflected in the case materials.

Jordan

>>>
>>> Gerald Jelinek wrote:
>>>> I am sponsoring this case for Jordan Vaughan.
>>>>
>>>> Thanks,
>>>> Jerry
>>>>
>>>> Template Version: @(#)sac_nextcase %I% %G% SMI
>>>> This information is Copyright 2008 Sun Microsystems
>>>> 1. Introduction
>>>>     1.1. Project/Component Working Name:
>>>>      Cross-Platform DDI Interface for Converting Strings to 64-bit 
>>>> Integers
>>>>     1.2. Name of Document Author/Supplier:
>>>>      Author:  Jordan Vaughan
>>>>     1.3  Date of This Document:
>>>>     01 December, 2008
>>>> 4. Technical Description
>>>> Template Version: @(#)sac_nextcase %I% %G% SMI
>>>> This information is Copyright 2008 Sun Microsystems
>>>> 1. Introduction
>>>>     1.1. Project/Component Working Name:
>>>>      Cross-Platform DDI Interface for Converting Strings to 64-bit 
>>>> Integers
>>>>     1.2. Name of Document Author/Supplier:
>>>>      Author:  Jordan Vaughan
>>>>     1.3  Date of This Document:
>>>>      20 November, 2008
>>>>
>>>> 4. Technical Description
>>>> Targeting an update release of Solaris 10, therefore patch binding.
>>>>
>>>>
>>>> PROBLEM:
>>>>
>>>> Device driver writers have no standard means of converting numerical 
>>>> strings to
>>>> 64-bit integers in both 32- and 64-bit builds.  Driver writers could 
>>>> use
>>>> ddi_strtol(9F) and ddi_strtoul(9F), but both produce 32-bit integers 
>>>> in 32-bit
>>>> driver builds.  Therefore, driver writers must resort to writing 
>>>> their own
>>>> string conversion subroutines or linking to project- or 
>>>> consolidation-private
>>>> string conversion functions, such as the undocumented function 
>>>> idm_strtoull().
>>>> However, these solutions are cumbersome, increase the probability of 
>>>> generating
>>>> bugs, and create dependencies on uncommitted, undocumented kernel 
>>>> functions.
>>>> This case proposes to rectify this deficiency by adding two new, 
>>>> committed
>>>> functions to the Solaris 10 and Solaris Nevada (and thus 
>>>> OpenSolaris) DDI called
>>>> ddi_strtoll() and ddi_strtoull() that will convert null-terminated 
>>>> character
>>>> strings into signed and unsigned 64-bit integers (respectively) in 
>>>> both 32- and
>>>> 64-bit builds.
>>>>
>>>>
>>>> EXPORTED INTERFACES:
>>>>
>>>>     FUNCTIONS:
>>>>         NAME            STABILITY  NOTES
>>>>         ddi_strtoll     Committed  In <sys/sunddi.h> under _KERNEL
>>>>         ddi_strtoull    Committed  In <sys/sunddi.h> under _KERNEL
>>>>
>>>>
>>>> TECHNICAL DESCRIPTION:
>>>>
>>>> The Solaris DDI currently provides two string-to-long-integer 
>>>> functions that
>>>> both kernel and driver coders can utilize: ddi_strtol(9F) and 
>>>> ddi_strtoul(9F).
>>>> Both functions convert strings to 32-bit integers in 32-bit builds 
>>>> and 64-bit
>>>> integers in 64-bit builds.
>>>>
>>>> It would be preferable to provide additional functions that would 
>>>> convert strings to 64-bit integers in both 32- and 64-bit builds.  
>>>> These functions,
>>>> ddi_strtoll() and ddi_strtoull(), would be functionally equivalent to
>>>> ddi_strtol() and ddi_strtoul() with the exception that the generated 
>>>> values
>>>> would be of types 'longlong_t' and 'u_longlong_t' (respectively) 
>>>> instead of
>>>> 'long int' and 'unsigned long int'.
>>>>
>>>> Given that kernel functions cannot safely utilize errno, both 
>>>> ddi_strtoll()
>>>> and ddi_strtoull() will differ from their userland equivalents 
>>>> (strtoll(3C) and
>>>> strtoull(3C)) in that the former will store their results in pointer 
>>>> arguments
>>>> and return error codes (whereas the latter return their results and 
>>>> store
>>>> error codes in errno).  This behavior is identical to that of 
>>>> ddi_strtol()
>>>> and ddi_strtoul().
>>>>
>>>>
>>>> RELATED BUGIDS:
>>>>
>>>>     6761505 RFE: having ddi_strtoull() would be nice
>>>>
>>>>
>>>> RELATED ARC CASES:
>>>>
>>>>     PSARC/2004/321: Add strtol() and strtoul() to the DDI
>>>>
>>>>
>>>> REFERENCE DOCUMENTS:
>>>>
>>>>     ddi_strtol(9F) and ddi_strtoul(9F) man pages
>>>>     Solaris Books: Writing Device Drivers (Solaris 10)
>>>>         (http://docs.sun.com/app/docs/doc/816-4854)
>>>>
>>>>
>>>> NEW MAN PAGES:
>>>>
>>>> Kernel Functions for Drivers                      ddi_strtoll(9F)
>>>>
>>>>
>>>>
>>>> NAME
>>>>      ddi_strtoll - String conversion functions
>>>>
>>>> SYNOPSIS
>>>>      #include <sys/ddi.h>
>>>>      #include <sys/sunddi.h>
>>>>
>>>>      int ddi_strtoll(const char *str, char **endptr, int base,
>>>>          longlong_t *result);
>>>>
>>>>
>>>> INTERFACE LEVEL
>>>>      Solaris DDI specific (Solaris DDI)
>>>>
>>>> PARAMETERS
>>>>      str        Pointer to a character string to be converted.
>>>>
>>>>
>>>>      endptr     Post-conversion  final  string  of   unrecognized
>>>>                 characters.
>>>>
>>>>
>>>>      base       Radix used for conversion.
>>>>
>>>>
>>>>      result     Pointer to variable which contains the  converted
>>>>                 value.
>>>>
>>>>
>>>> DESCRIPTION
>>>>      The ddi_strtoll() function converts the initial  portion  of
>>>>      the  string   pointed  to  by   str  to  a  type  longlong_t
>>>>      representation and stores the converted value in result.
>>>>
>>>>
>>>>      The  function first decomposes the input string  into  three
>>>>      parts:
>>>>
>>>>          1.   An initial (possibly empty) sequence of white-space
>>>>               characters (' ', '\t', '\n', '\r', '\f')
>>>>
>>>>          2.   A  subject  sequence  interpreted  as  an   integer
>>>>               represented  in  some radix determined by the value
>>>>               of base
>>>>
>>>>          3.   A final  string of one or more unrecognized charac-
>>>>               ters,  including  the  terminating null byte of the
>>>>               input string.
>>>>
>>>>
>>>>      The ddi_strtoll() function then attempts to convert the sub-
>>>>      ject sequence to an integer and returns the result.
>>>>
>>>>
>>>>
>>>> SunOS 5.11          Last change: 20 Nov 2008                    1
>>>>
>>>>
>>>>
>>>> Kernel Functions for Drivers                      ddi_strtoll(9F)
>>>>
>>>>
>>>>
>>>>      If the value of base is 0, the expected form of the  subject
>>>>      sequence  is  that  of a decimal constant, octal constant or
>>>>      hexadecimal constant, any of which may be preceded by a plus
>>>>      ("+")  or minus ("-") sign. A decimal constant begins with a
>>>>      non-zero digit,  and  consists  of  a  sequence  of  decimal
>>>>      digits. An octal constant consists  of  the prefix 0 option-
>>>>      ally followed by a sequence of the digits 0  to  7  only.  A
>>>>      hexadecimal   constant  consists of the prefix 0x or 0X fol-
>>>>      lowed by a sequence of the decimal digits and letters a  (or
>>>>      A) to f (or F) with values 10 to 15 respectively.
>>>>
>>>>
>>>>      If the value of base is between 2 and 36, the expected  form
>>>>      of  the subject sequence is a sequence of letters and digits
>>>>      representing an integer with the radix  specified  by  base,
>>>>      optionally  preceded  by  a  plus or minus sign. The letters
>>>>      from a (or A) to z (or Z) inclusive are ascribed the  values
>>>>      10  to  35  and  only letters whose ascribed values are less
>>>>      than that of base are permitted. If the value of base is 16,
>>>>      the  characters 0x or 0X may optionally precede the sequence
>>>>      of letters and digits, following the sign if present.
>>>>
>>>>
>>>>      The subject sequence is  defined   as  the  longest  initial
>>>>      subsequence  of  the  input  string, starting with the first
>>>>      non-white-space character that is of the expected form.  The
>>>>      subject  sequence contains no characters if the input string
>>>>      is empty or consists entirely of white-space characters,  or
>>>>      if  the first non-white-space character is other than a sign
>>>>      or a permissible letter or digit.
>>>>
>>>>
>>>>      If the subject sequence has the expected form and the  value
>>>>      of  base  is 0, the sequence of characters starting with the
>>>>      first digit is interpreted as an integer  constant.  If  the
>>>>      subject sequence has the expected form and the value of base
>>>>      is between 2 and 36, it is used as the base for  conversion,
>>>>      ascribing   to  each letter its value as given above. If the
>>>>      subject sequence begins with a minus sign, the value result-
>>>>      ing  from  the conversion is negated. A pointer to the final
>>>>      string is stored in the object pointed to  by  endptr,  pro-
>>>>      vided that endptr is not a null pointer.
>>>>
>>>>
>>>>      If the subject sequence  is  empty  or  does  not  have  the
>>>>      expected   form, no conversion is performed and the value of
>>>>      str is stored in the object pointed to by  endptr,  provided
>>>>      that endptr is not a null pointer.
>>>>
>>>> RETURN VALUES
>>>>      Upon successful  completion,  ddi_strtoll()  returns  0  and
>>>>      stores  the  converted  value in result. If no conversion is
>>>>
>>>>
>>>>
>>>> SunOS 5.11          Last change: 20 Nov 2008                    2
>>>>
>>>>
>>>> Kernel Functions for Drivers                      ddi_strtoll(9F)
>>>>
>>>>
>>>>
>>>>      performed due to invalid base, ddi_strtoll() returns  EINVAL
>>>>      and the variable pointed by result is not changed.
>>>>
>>>>
>>>>      If the correct value is outside the range  of  representable
>>>>      values,  ddi_strtoll()  returns ERANGE and the value pointed
>>>>      to by result is not changed.
>>>>
>>>> CONTEXT
>>>>      The ddi_strtoll() function may be called from  user,  kernel
>>>>      or interrupt context.
>>>>
>>>> SEE ALSO
>>>>      Writing Device Drivers
>>>>
>>>>
>>>> SunOS 5.11          Last change: 20 Nov 2008                    3
>>>>
>>>>
>>>>
>>>>
>>>> Kernel Functions for Drivers                     ddi_strtoull(9F)
>>>>
>>>>
>>>> NAME
>>>>      ddi_strtoull - String conversion functions
>>>>
>>>> SYNOPSIS
>>>>      #include <sys/ddi.h>
>>>>      #include <sys/sunddi.h>
>>>>
>>>>      int ddi_strtoull(const char *str, char **endptr, int base,
>>>>          u_longlong_t *result);
>>>>
>>>>
>>>> INTERFACE LEVEL
>>>>      Solaris DDI specific (Solaris DDI)
>>>>
>>>> PARAMETERS
>>>>      str        Pointer to a character string to be converted.
>>>>
>>>>
>>>>      endptr     Post-conversion  final  string  of   unrecognized
>>>>                 characters.
>>>>
>>>>
>>>>      base       Radix used for conversion.
>>>>
>>>>
>>>>      result     Pointer to variable which contains the  converted
>>>>                 value.
>>>>
>>>>
>>>> DESCRIPTION
>>>>      The ddi_strtoull() function converts the initial  portion of
>>>>      the  string  pointed  to  by  str  to  a  type  u_longlong_t
>>>>      representation and stores the converted value in result.
>>>>
>>>>
>>>>      The  function first decomposes the input string  into  three
>>>>      parts:
>>>>
>>>>          1.   An initial (possibly empty) sequence of white-space
>>>>               characters (' ', '\t', '\n', '\r', '\f')
>>>>
>>>>          2.   A  subject  sequence  interpreted  as  an   integer
>>>>               represented  in  some radix determined by the value
>>>>               of base
>>>>
>>>>          3.   A final  string of one or more unrecognized charac-
>>>>               ters,  including  the  terminating null byte of the
>>>>               input string.
>>>>
>>>>
>>>>      The  ddi_strtoull()  function then  attempts to  convert the
>>>>      subject  sequence  to an  unsigned integer  and returns  the
>>>>      result.
>>>>
>>>>
>>>> SunOS 5.11          Last change: 20 Nov 2008                    1
>>>>
>>>>
>>>> Kernel Functions for Drivers                     ddi_strtoull(9F)
>>>>
>>>>
>>>>
>>>>      If the value of base is 0, the expected form of the  subject
>>>>      sequence  is  that  of a decimal constant, octal constant or
>>>>      hexadecimal constant, any of which may be preceded by a plus
>>>>      ("+")  or minus ("-") sign. A decimal constant begins with a
>>>>      non-zero digit,  and  consists  of  a  sequence  of  decimal
>>>>      digits. An octal constant consists  of  the prefix 0 option-
>>>>      ally followed by a sequence of the digits 0  to  7  only.  A
>>>>      hexadecimal   constant  consists of the prefix 0x or 0X fol-
>>>>      lowed by a sequence of the decimal digits and letters a  (or
>>>>      A) to f (or F) with values 10 to 15 respectively.
>>>>
>>>>
>>>>      If the value of base is between 2 and 36, the expected  form
>>>>      of  the subject sequence is a sequence of letters and digits
>>>>      representing an integer with the radix  specified  by  base,
>>>>      optionally  preceded  by  a  plus or minus sign. The letters
>>>>      from a (or A) to z (or Z) inclusive are ascribed the  values
>>>>      10  to  35  and  only letters whose ascribed values are less
>>>>      than that of base are permitted. If the value of base is 16,
>>>>      the  characters 0x or 0X may optionally precede the sequence
>>>>      of letters and digits, following the sign if present.
>>>>
>>>>
>>>>      The subject sequence is  defined   as  the  longest  initial
>>>>      subsequence  of  the  input  string, starting with the first
>>>>      non-white-space character that is of the expected form.  The
>>>>      subject  sequence contains no characters if the input string
>>>>      is empty or consists entirely of white-space characters,  or
>>>>      if  the first non-white-space character is other than a sign
>>>>      or a permissible letter or digit.
>>>>
>>>>
>>>>      If the subject sequence has the expected form and the  value
>>>>      of  base  is 0, the sequence of characters starting with the
>>>>      first digit is interpreted as an integer  constant.  If  the
>>>>      subject sequence has the expected form and the value of base
>>>>      is between 2 and 36, it is used as the base for  conversion,
>>>>      ascribing   to  each letter its value as given above. If the
>>>>      subject sequence begins with a minus sign, the value result-
>>>>      ing  from  the conversion is negated. A pointer to the final
>>>>      string is stored in the object pointed to  by  endptr,  pro-
>>>>      vided that endptr is not a null pointer.
>>>>
>>>>
>>>>      If the subject sequence  is  empty  or  does  not  have  the
>>>>      expected   form, no conversion is performed and the value of
>>>>      str is stored in the object pointed to by  endptr,  provided
>>>>      that endptr is not a null pointer.
>>>>
>>>> RETURN VALUES
>>>>      Upon successful  completion,  ddi_strtoull()  returns  0 and
>>>>      stores  the  converted  value in result. If no conversion is
>>>>
>>>>
>>>>
>>>> SunOS 5.11          Last change: 20 Nov 2008                    2
>>>>
>>>>
>>>> Kernel Functions for Drivers                     ddi_strtoull(9F)
>>>>
>>>>
>>>>
>>>>      performed due to invalid base, ddi_strtoull() returns EINVAL
>>>>      and the variable pointed by result is not changed.
>>>>
>>>>
>>>>      If the correct value is outside the range  of  representable
>>>>      values, ddi_strtoull()  returns ERANGE and the value pointed
>>>>      to by result is not changed.
>>>>
>>>> CONTEXT
>>>>      The ddi_strtoull() function may be called from  user, kernel
>>>>      or interrupt context.
>>>>
>>>> SEE ALSO
>>>>      Writing Device Drivers
>>>>
>>>>
>>>> SunOS 5.11          Last change: 20 Nov 2008                    3
>>>>
>>>>
>>>>
>>>> 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
>>>>
>>>>
>>>> 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 Darren.Reed@sun.com Mon Dec  1 17:43:41 2008
Received: from sunmail2sca.sfbay.sun.com (sunmail2sca.SFBay.Sun.COM [129.145.155.234])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id mB21hfAH005053
	for <psarc-ext@sac.sfbay.sun.com>; Mon, 1 Dec 2008 17:43:41 -0800 (PST)
Received: from nwk-avmta-1.SFBay.Sun.COM (nwk-avmta-1.SFBay.Sun.COM [129.146.11.74])
	by sunmail2sca.sfbay.sun.com (8.13.7+Sun/8.13.7/ENSMAIL,v2.2) with ESMTP id mB21he0F006788
	for <@sunmail2sca.sfbay.sun.com:PSARC-ext@sun.com>; Mon, 1 Dec 2008 17:43:40 -0800 (PST)
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 <0KB8006017GSMR00@nwk-avmta-1.sfbay.Sun.COM> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@Sun.COM); Mon, 01 Dec 2008 17:43:40 -0800 (PST)
Received: from gmp-eb-inf-1.sun.com ([192.18.6.21])
 by nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KB8004XZ7GR2E10@nwk-avmta-1.sfbay.Sun.COM> for
 PSARC-ext@sun.com (ORCPT PSARC-ext@Sun.COM); Mon,
 01 Dec 2008 17:43:40 -0800 (PST)
Received: from fe-emea-10.sun.com (gmp-eb-lb-2-fe2.eu.sun.com [192.18.6.11])
	by gmp-eb-inf-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id mB21hdop029841	for
 <PSARC-ext@Sun.COM>; Tue, 02 Dec 2008 01:43:39 +0000 (GMT)
Received: from conversion-daemon.fe-emea-10.sun.com by fe-emea-10.sun.com
 (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007))
 id <0KB800G017AHYQ00@fe-emea-10.sun.com>
 (original mail from Darren.Reed@Sun.COM)
 for PSARC-ext@Sun.COM (ORCPT PSARC-ext@Sun.COM); Tue,
 02 Dec 2008 01:43:39 +0000 (GMT)
Received: from [129.158.87.124] by fe-emea-10.sun.com
 (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007))
 with ESMTPSA id <0KB800GQ87GOHT00@fe-emea-10.sun.com>; Tue,
 02 Dec 2008 01:43:39 +0000 (GMT)
Date: Tue, 02 Dec 2008 12:43:33 +1100
From: Darren Reed <Darren.Reed@sun.com>
Subject: Re: Cross-Platform DDI Interface for Converting Strings to 64-bit
 Integers [PSARC/2008/740 FastTrack timeout 12/09/2008]
In-reply-to: <200812012311.mB1NBFAc015709@sac.sfbay.sun.com>
Sender: Darren.Reed@sun.com
To: Jordan.Vaughan@sun.com
Cc: Gerald Jelinek <gjelinek@sac.sfbay.sun.com>, PSARC-ext@sun.com,
        Gerald.Jelinek@sun.com
Message-id: <493492C5.3070708@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: <200812012311.mB1NBFAc015709@sac.sfbay.sun.com>
User-Agent: Thunderbird 2.0.0.18 (Windows/20081105)
Status: RO
Content-Length: 419

I'm somewhat uncomfortable with "long long" always implying 64bits,
or with long implying only 32 bits...

I'd prefer to see the API explicitly make a point of being for
64bit values, either with "uint64_t *" as the final arg or it being
called "ddi_strtou64"... but maybe the horse has already bolted
on this one, given ddi_strtoul, and thus the best we can hope for
is to be consistent with past "mistakes"?

Darren


From gdamore@sun.com Mon Dec  1 17:58: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 mB21wqoo005529
	for <psarc-ext@sac.sfbay.Sun.COM>; Mon, 1 Dec 2008 17:58:53 -0800 (PST)
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 mB21wnur022175
	for <@sunmail2sca.sfbay.sun.com:PSARC-ext@sun.com>; Tue, 2 Dec 2008 09:58: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 <0KB800001861UU00@brm-avmta-1.central.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Mon, 01 Dec 2008 18:58:49 -0700 (MST)
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 <0KB800HBH860E650@brm-avmta-1.central.sun.com> for
 PSARC-ext@sun.com (ORCPT PSARC-ext@sun.com); Mon,
 01 Dec 2008 18:58:49 -0700 (MST)
Received: from fe-sfbay-09.sun.com ([192.18.43.129])
	by sca-es-mail-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id mB21wmqL011451	for
 <PSARC-ext@sun.com>; Mon, 01 Dec 2008 17:58:48 -0800 (PST)
Received: from conversion-daemon.fe-sfbay-09.sun.com by fe-sfbay-09.sun.com
 (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007))
 id <0KB800J0180U1E00@fe-sfbay-09.sun.com> (original mail from gdamore@sun.com)
 for PSARC-ext@sun.com (ORCPT PSARC-ext@sun.com); Mon,
 01 Dec 2008 17:58:48 -0800 (PST)
Received: from [10.7.251.172] by fe-sfbay-09.sun.com
 (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007))
 with ESMTPSA id <0KB800HF385ZXA90@fe-sfbay-09.sun.com>; Mon,
 01 Dec 2008 17:58:48 -0800 (PST)
Date: Mon, 01 Dec 2008 17:52:04 -0800
From: "Garrett D'Amore" <gdamore@sun.com>
Subject: Re: Cross-Platform DDI Interface for Converting Strings to 64-bit
 Integers [PSARC/2008/740 FastTrack timeout 12/09/2008]
In-reply-to: <493492C5.3070708@Sun.COM>
Sender: Garrett.Damore@sun.com
To: Darren Reed <Darren.Reed@sun.com>
Cc: Jordan.Vaughan@sun.com, Gerald Jelinek <gjelinek@sac.sfbay.sun.com>,
        PSARC-ext@sun.com, Gerald.Jelinek@sun.com
Message-id: <493494C4.3040207@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: <200812012311.mB1NBFAc015709@sac.sfbay.sun.com>
 <493492C5.3070708@Sun.COM>
User-Agent: Thunderbird 2.0.0.14 (X11/20080616)
Status: RO
Content-Length: 670

Darren Reed wrote:
> I'm somewhat uncomfortable with "long long" always implying 64bits,
> or with long implying only 32 bits...
>
> I'd prefer to see the API explicitly make a point of being for
> 64bit values, either with "uint64_t *" as the final arg or it being
> called "ddi_strtou64"... but maybe the horse has already bolted
> on this one, given ddi_strtoul, and thus the best we can hope for
> is to be consistent with past "mistakes"?

Yes.  In this case, consistency with the Standard C (more or less).

Perhaps a good extension to this case would be to define ddi_strtou32(), 
ddi_strtos32(), ddi_strtou64(), and ddi_strtos64()?

    -- Garrett
>
> Darren
>


From carlsonj@phorcys.east.sun.com Tue Dec  2 06:22:28 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 mB2EMRCZ004364
	for <psarc-ext@sac.sfbay.sun.com>; Tue, 2 Dec 2008 06:22:28 -0800 (PST)
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 mB2EMJUW053901;
	Tue, 2 Dec 2008 07:22:24 -0700 (MST)
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 <0KB9007036LCGM00@nwk-avmta-2.sfbay.sun.com>; Tue,
 02 Dec 2008 06:22:24 -0800 (PST)
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 <0KB9006T66LB5450@nwk-avmta-2.sfbay.sun.com>; Tue,
 02 Dec 2008 06:22:23 -0800 (PST)
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 mB2EMMmC007764; Tue,
 02 Dec 2008 09:22:22 -0500 (EST)
Received: (from carlsonj@localhost)
	by phorcys.east.sun.com (8.14.3+Sun/8.14.3/Submit) id mB2EMM3x007761; Tue,
 02 Dec 2008 09:22:22 -0500 (EST)
Date: Tue, 02 Dec 2008 09:22:22 -0500
From: James Carlson <james.d.carlson@sun.com>
Subject: Re: Cross-Platform DDI Interface for Converting Strings to 64-bit
 Integers [PSARC/2008/740 FastTrack timeout 12/09/2008]
In-reply-to: <200812012311.mB1NBFAc015709@sac.sfbay.sun.com>
To: Gerald Jelinek <gjelinek@sac.sfbay.sun.com>,
        "Garrett D'Amore" <gdamore@sun.com>
Cc: PSARC-ext@sun.com, Jordan.Vaughan@sun.com, Gerald.Jelinek@sun.com,
        Darren Reed <Darren.Reed@sun.com>
Message-id: <18741.17566.220318.288153@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: <200812012311.mB1NBFAc015709@sac.sfbay.sun.com>
 <493492C5.3070708@Sun.COM> <493494C4.3040207@sun.com>
Status: RO
Content-Length: 1004

Gerald Jelinek writes:
>         ddi_strtoll     Committed  In <sys/sunddi.h> under _KERNEL
>         ddi_strtoull    Committed  In <sys/sunddi.h> under _KERNEL

+1

(One nit: I think the proposal was a touch too long; the above two
lines would have been sufficient given the prior art.)

Garrett D'Amore writes:
> Perhaps a good extension to this case would be to define ddi_strtou32(), 
> ddi_strtos32(), ddi_strtou64(), and ddi_strtos64()?

That sounds like a subject for a different project.

I agree that it'd be nice to have conversions that match the standard
types (beyond just the base types), but that's not what we have in
libc, and I'd rather see a concerted effort to make a new set of
interfaces (probably not designed on this list) than an ad-hoc set of
additions.

-- 
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 Jordan.Vaughan@sun.com Fri Dec  5 15:32:09 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 mB5NW9PZ000572
	for <psarc-ext@sac.sfbay.sun.com>; Fri, 5 Dec 2008 15:32:09 -0800 (PST)
Received: from nwk-avmta-2.sfbay.sun.com (nwk-avmta-2.SFBay.Sun.COM [129.145.155.6])
	by sunmail3mpk.sfbay.sun.com (8.13.7+Sun/8.13.7/ENSMAIL,v2.2) with ESMTP id mB5NW6E0012514;
	Fri, 5 Dec 2008 15:32:07 -0800 (PST)
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 <0KBF00113G1GZX00@nwk-avmta-2.sfbay.sun.com>; Fri,
 05 Dec 2008 15:32:04 -0800 (PST)
Received: from jurassic-x4600.sfbay.sun.com ([129.146.17.63])
 by nwk-avmta-2.sfbay.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KBF00JGNG1F7I50@nwk-avmta-2.sfbay.sun.com>; Fri,
 05 Dec 2008 15:32:03 -0800 (PST)
Received: from [129.146.228.104]
 (quidestveritas.SFBay.Sun.COM [129.146.228.104])
	by jurassic-x4600.sfbay.sun.com (8.14.3+Sun/8.14.3)
 with ESMTP id mB5NW3N1277980; Fri, 05 Dec 2008 15:32:03 -0800 (PST)
Date: Fri, 05 Dec 2008 15:32:01 -0800
From: Jordan Vaughan <Jordan.Vaughan@sun.com>
Subject: Re: Cross-Platform DDI Interface for Converting Strings to 64-bit
 Integers [PSARC/2008/740 FastTrack timeout 12/09/2008]
In-reply-to: <493492C5.3070708@Sun.COM>
To: Darren Reed <Darren.Reed@sun.com>
Cc: Gerald Jelinek <gjelinek@sac.sfbay.sun.com>, PSARC-ext@sun.com,
        Gerald.Jelinek@sun.com
Message-id: <4939B9F1.3000202@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: <200812012311.mB1NBFAc015709@sac.sfbay.sun.com>
 <493492C5.3070708@Sun.COM>
User-Agent: Thunderbird 2.0.0.16 (X11/20080923)
Status: RO
Content-Length: 793

On 12/01/08 17:43, Darren Reed wrote:
> I'm somewhat uncomfortable with "long long" always implying 64bits,
> or with long implying only 32 bits...
> 
> I'd prefer to see the API explicitly make a point of being for
> 64bit values, either with "uint64_t *" as the final arg or it being
> called "ddi_strtou64"... but maybe the horse has already bolted
> on this one, given ddi_strtoul, and thus the best we can hope for
> is to be consistent with past "mistakes"?
> 
> Darren
> 

I think it makes sense to stick with the strtol/ll convention because it 
associates with the primitive ISO C types (as Garrett noted).  Maybe 
providing a separate set of interfaces (ddi_strtos32(), ddi_strtou64(), 
etc.) makes sense, but I think James is right in that it should be a 
separate project.

Jordan

From Gerald.Jelinek@sun.com Wed Dec 10 07:45:21 2008
Received: from sunmail2sca.sfbay.sun.com (sunmail2sca.SFBay.Sun.COM [129.145.155.234])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id mBAFjLVC026138
	for <psarc-ext@sac.sfbay.sun.com>; Wed, 10 Dec 2008 07:45:21 -0800 (PST)
Received: from nwk-avmta-1.SFBay.Sun.COM (nwk-avmta-1.SFBay.Sun.COM [129.146.11.74])
	by sunmail2sca.sfbay.sun.com (8.13.7+Sun/8.13.7/ENSMAIL,v2.2) with ESMTP id mBAFjI3q014321
	for <@sunmail2sca.sfbay.sun.com:PSARC-ext@sun.com>; Wed, 10 Dec 2008 07:45:20 -0800 (PST)
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 <0KBO00K073RJ8I00@nwk-avmta-1.sfbay.Sun.COM> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@Sun.COM); Wed, 10 Dec 2008 07:45:19 -0800 (PST)
Received: from brmea-mail-1.sun.com ([192.18.98.31])
 by nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KBO00BIB3RJ9S60@nwk-avmta-1.sfbay.Sun.COM> for
 PSARC-ext@sun.com (ORCPT PSARC-ext@Sun.COM); Wed,
 10 Dec 2008 07:45:19 -0800 (PST)
Received: from fe-amer-09.sun.com ([192.18.109.79])
	by brmea-mail-1.sun.com (8.13.6+Sun/8.12.9) with ESMTP id mBAFjIAs003020	for
 <PSARC-ext@Sun.COM>; Wed, 10 Dec 2008 15:45:18 +0000 (GMT)
Received: from conversion-daemon.mail-amer.sun.com by mail-amer.sun.com
 (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007))
 id <0KBO0040134NEH00@mail-amer.sun.com>
 (original mail from Gerald.Jelinek@Sun.COM)
 for PSARC-ext@Sun.COM (ORCPT PSARC-ext@Sun.COM); Wed,
 10 Dec 2008 08:44:41 -0700 (MST)
Received: from [192.168.0.11] ([206.53.29.107])
 by mail-amer.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28
 2007)) with ESMTPSA id <0KBO00GFZ3Q167G0@mail-amer.sun.com> for
 PSARC-ext@Sun.COM (ORCPT PSARC-ext@Sun.COM); Wed,
 10 Dec 2008 08:44:25 -0700 (MST)
Date: Wed, 10 Dec 2008 08:44:24 -0700
From: Jerry Jelinek <Gerald.Jelinek@sun.com>
Subject: Re: Cross-Platform DDI Interface for Converting Strings to 64-bit
 Integers [PSARC/2008/740 FastTrack timeout 12/09/2008]
In-reply-to: <200812012311.mB1NBFAc015709@sac.sfbay.sun.com>
Sender: Gerald.Jelinek@sun.com
To: PSARC-ext@sun.com
Cc: Jordan.Vaughan@sun.com
Message-id: <493FE3D8.6090202@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: <200812012311.mB1NBFAc015709@sac.sfbay.sun.com>
User-Agent: Thunderbird 2.0.0.17 (X11/20081023)
Status: RO
Content-Length: 89

This case timed out with no objections.  I
am marking it closed approved.

Thanks,
Jerry

