1ddi_strtoll(9F)          Kernel Functions for Drivers          ddi_strtoll(9F)
2
3
4

NAME

6       ddi_strtoll, ddi_strtoull - string conversion functions
7

SYNOPSIS

9       #include <sys/ddi.h>
10       #include <sys/sunddi.h>
11
12       int ddi_strtoll(const char *str, char **endptr, int base,
13            longlong_t *result);
14
15
16       int ddi_strtoull(const char *str, char **endptr, int base,
17            u_longlong_t *result);
18
19

PARAMETERS

21       str       pointer to a character string to be converted
22
23
24       endptr    post-conversion final string of unrecognized characters
25
26
27       base      radix used for conversion
28
29
30       result    pointer to variable which contains the converted value
31
32

INTERFACE LEVEL

34       Solaris DDI specific (Solaris DDI)
35

DESCRIPTION

37       The  ddi_strtoll()  function converts the initial portion of the string
38       pointed to by str to a type longlong_t representation  and  stores  the
39       converted value in result.
40
41
42       The  ddi_strtoull() function converts the initial portion of the string
43       pointed to by str to a type u_longlong_t representation and stores  the
44       converted value in result.
45
46
47       These functions first decomposes the input string into three parts:
48
49           1.     An  initial (possibly empty) sequence of white-space charac‐
50                  ters (" ", "\t", "\n", "\r", "\f")
51
52           2.     A subject sequence interpreted as an integer represented  in
53                  some radix determined by the value of base
54
55           3.     A  final  string  of  one  or  more unrecognized characters,
56                  including the terminating null byte of the input string.
57
58
59       The  ddi_strtoll()  function  then  attempts  to  convert  the  subject
60       sequence to an integer and returns the result. The ddi_strtoull() func‐
61       tion attempts to convert the subject sequence to  an  unsigned  integer
62       and returns the result.
63
64
65       If the value of base is 0, the expected form of the subject sequence is
66       that of a decimal constant, octal constant or hexadecimal constant, any
67       of which may be preceded by a plus ("+") or minus ("-") sign. A decimal
68       constant begins with a non-zero digit, and consists of  a  sequence  of
69       decimal  digits.  An octal constant consists of the prefix 0 optionally
70       followed by a sequence of the digits 0 to 7 only.  A  hexadecimal  con‐
71       stant  consists  of  the  prefix 0x or 0X followed by a sequence of the
72       decimal digits and letters a (or A) to f (or F) with values  10  to  15
73       respectively.
74
75
76       If the value of base is between 2 and 36, the expected form of the sub‐
77       ject sequence is a sequence of letters and digits representing an inte‐
78       ger  with the radix specified by base, optionally preceded by a plus or
79       minus sign. The letters from a  (or  A)  to  z  (or  Z)  inclusive  are
80       ascribed the values 10 to 35 and only letters whose ascribed values are
81       less than that of base are permitted. If the value of base is  16,  the
82       characters  0x or 0X may optionally precede the sequence of letters and
83       digits, following the sign if present.
84
85
86       The subject sequence is defined as the longest initial  subsequence  of
87       the  input  string,  starting  with the first non-white-space character
88       that is of the expected form. The subject sequence contains no  charac‐
89       ters  if  the input string is empty or consists entirely of white-space
90       characters, or if the first non-white-space character is other  than  a
91       sign or a permissible letter or digit.
92
93
94       If  the subject sequence has the expected form and the value of base is
95       0, the sequence of characters starting with the first digit  is  inter‐
96       preted as an integer constant. If the subject sequence has the expected
97       form and the value of base is between 2 and 36, it is used as the  base
98       for  conversion,  ascribing to each letter its value as given above. If
99       the subject sequence begins with a minus sign, the value resulting from
100       the  conversion  is negated. A pointer to the final string is stored in
101       the object pointed to by endptr, provided that endptr  is  not  a  null
102       pointer.
103
104
105       If the subject sequence is empty or does not have the expected form, no
106       conversion is performed and the value of str is stored  in  the  object
107       pointed to by endptr, provided that endptr is not a null pointer.
108

RETURN VALUES

110       Upon successful completion, these functions return 0 and store the con‐
111       verted value in result. If no conversion is performed due to an invalid
112       base,  these functions return EINVAL and the variable pointed by result
113       is not changed.
114

CONTEXT

116       These functions may be called from user, kernel or interrupt context.
117

ATTRIBUTES

119       See attributes(5) for descriptions of the following attributes:
120
121
122
123
124       ┌─────────────────────────────┬─────────────────────────────┐
125       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
126       ├─────────────────────────────┼─────────────────────────────┤
127       │Interface Stability          │Committed                    │
128       └─────────────────────────────┴─────────────────────────────┘
129

SEE ALSO

131       Writing Device Drivers
132
133
134
135SunOS 5.11                        25 Feb 2009                  ddi_strtoll(9F)
Impressum