OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / LDP_man-pages / draft / man3 / confstr.3
1 .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\" License.
23 .\" Modified Sat Jul 24 19:53:02 1993 by Rik Faith (faith@cs.unc.edu)
24 .\" FIXME Many more values for 'name' are supported, some of which
25 .\"     are documented under 'info confstr'.
26 .\"     See <bits/confname.h> for the rest.
27 .\"     These should all be added to this page.
28 .\"     See also the POSIX.1-2001 specification of confstr()
29 .\"
30 .\" Japanese Version Copyright (c) 1997 Hiroaki Nagoya
31 .\"         all rights reserved.
32 .\" Translated by Hiroaki Nagoya <nagoya@is.titech.ac.jp>
33 .\" Updated 2005-09-06, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
34 .\" Updated 2006-07-20, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.36
35 .\"
36 .TH CONFSTR 3  2010-02-03 "GNU" "Linux Programmer's Manual"
37 .\"O .SH NAME
38 .SH Ì¾Á°
39 .\"O confstr \- get configuration dependent string variables
40 confstr \- ¥³¥ó¥Õ¥£¥°¥ì¡¼¥·¥ç¥ó¤Ë°Í¸¤·¤¿Ê¸»úÎóÊÑ¿ô¤Î¼èÆÀ
41 .\"O .SH SYNOPSIS
42 .SH ½ñ¼°
43 .nf
44 .B #include <unistd.h>
45 .sp
46 .BI "size_t confstr(int " "name" ", char *" buf ", size_t " len );
47 .fi
48 .sp
49 .in -4n
50 .\"O Feature Test Macro Requirements for glibc (see
51 .\"O .BR feature_test_macros (7)):
52 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
53 .RB ( feature_test_macros (7)
54 »²¾È):
55 .in
56 .sp
57 .BR confstr ():
58 _POSIX_C_SOURCE\ >=\ 2 || _XOPEN_SOURCE
59 .\"O .SH DESCRIPTION
60 .SH ÀâÌÀ
61 .\"O .BR confstr ()
62 .\"O gets the value of configuration-dependent string variables.
63 .BR confstr ()
64 ¤Ï¥³¥ó¥Õ¥£¥°¥ì¡¼¥·¥ç¥ó¤Ë°Í¸¤·¤¿Ê¸»úÎóÊÑ¿ô¤ÎÃͤò¼èÆÀ¤¹¤ë¡£
65 .PP
66 .\"O The
67 .\"O .I name
68 .\"O argument is the system variable to be queried.
69 .\"O The following variables are supported:
70 °ú¤­¿ô
71 .I name
72 ¤Ï¡¢Ì䤤¹ç¤ï¤»ÆâÍƤòɽ¤¹¥·¥¹¥Æ¥àÊÑ¿ô¤Ç¤¢¤ë¡£
73 °Ê²¼¤ÎÊÑ¿ô¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¡£
74 .TP
75 .\"O .BR _CS_GNU_LIBC_VERSION " (GNU C library only; since glibc 2.3.2)"
76 .\"O A string which identifies the GNU C library version on this system
77 .\"O (e.g, "glibc 2.3.4").
78 .BR _CS_GNU_LIBC_VERSION " (GNU C library ¸ÂÄê; glibc 2.3.2 °Ê¹ß)"
79 ¤½¤Î¥·¥¹¥Æ¥à¤Î GNU C ¥é¥¤¥Ö¥é¥ê¤Î¥Ð¡¼¥¸¥ç¥ó¤ò¼¨¤¹Ê¸»úÎó
80 (Î㤨¤Ð "glibc 2.3.4")¡£
81 .TP
82 .\"O .BR _CS_GNU_LIBPTHREAD_VERSION " (GNU C library only; since glibc 2.3.2)"
83 .\"O A string which identifies the POSIX implementation supplied by this
84 .\"O C library (e.g, "NPTL 2.3.4" or "linuxthreads-0.10").
85 .BR _CS_GNU_LIBPTHREAD_VERSION " (GNU C library ¸ÂÄê; glibc 2.3.2 °Ê¹ß)"
86 ¤½¤Î C ¥é¥¤¥Ö¥é¥ê¤¬Ä󶡤·¤Æ¤¤¤ë POSIX ¼ÂÁõ¤ò¼¨¤¹Ê¸»úÎó
87 (Î㤨¤Ð "NPTL 2.3.4" ¤ä "linuxthreads-0.10")¡£
88 .TP
89 .B _CS_PATH
90 .\"O A value for the
91 .\"O .B PATH
92 .\"O variable which indicates where all the POSIX.2 standard utilities can
93 .\"O be found.
94 ¤¹¤Ù¤Æ¤Î POSIX.2 É¸½à¥æ¡¼¥Æ¥£¥ê¥Æ¥£¤¬¸«¤Ä¤«¤ë¤è¤¦¤Ê
95 .B PATH
96 ¤ÎÃÍ¡£
97 .PP
98 .\"O If
99 .\"O .I buf
100 .\"O is not NULL and
101 .\"O .I len
102 .\"O is not zero,
103 .\"O .BR confstr ()
104 .\"O copies the value of the string to
105 .\"O .I buf
106 .\"O truncated to
107 .\"O .I len \- 1
108 .\"O characters if necessary, with a null byte (\(aq\\0\(aq) as termination.
109 .I buf
110 ¤¬ NULL ¤Ç¤Ê¤¯¡¢¤«¤Ä
111 .I len
112 ¤¬ 0 ¤Ç¤Ê¤±¤ì¤Ð
113 .BR confstr ()
114 ¤Ï¼èÆÀ¤·¤¿Ê¸»úÎó¤ÎÆâÍƤò
115 .I buf
116 ¤Ë¥³¥Ô¡¼¤¹¤ë¡£É¬Íפʤé¤ÐŤµ¤Ï
117 .I len \- 1
118 ʸ»ú¤ËÀÚ¤ê¼Î¤Æ¤é¤ì¤Æ¡¢NULL ¥Ð¥¤¥È (\(aq\\0\(aq) ¤Ç½ªÃ¼¤µ¤ì¤ë¡£
119 .\"O This can be detected by comparing the return value of
120 .\"O .BR confstr ()
121 .\"O against
122 .\"O .IR len .
123 ËöÈø¤¬ÀÚ¤ê¼Î¤Æ¤é¤ì¤¿¤«¤É¤¦¤«¤òȽÄꤹ¤ë¤Ë¤Ï¡¢
124 .BR confstr ()
125 ¤ÎÊÖ¤êÃͤò
126 .I len
127 ¤ÈÈæ³Ó¤¹¤ì¤Ð¤è¤¤¡£
128 .PP
129 .\"O If
130 .\"O .I len
131 .\"O is zero and
132 .\"O .I buf
133 .\"O is NULL,
134 .\"O .BR confstr ()
135 .\"O just returns the value as defined below.
136 .I len
137 ¤¬ 0 ¤Ç
138 .I buf
139 ¤¬ NULL ¤Ê¤é¤Ð¡¢
140 .BR confstr ()
141 ¤Ï°Ê²¼¤ÇÄêµÁ¤µ¤ì¤¿ÃÍ (ÌõÃí: ÀÚ¤ê¼Î¤Æ¤ëÁ°¤Î¡¢¼èÆÀ¤·¤¿Ê¸»úÎó¤ÎŤµ) ¤òÊÖ¤¹¡£
142 .\"O .SH "RETURN VALUE"
143 .SH ÊÖ¤êÃÍ
144 .\"O If
145 .\"O .I name
146 .\"O is a valid configuration variable,
147 .\"O .BR confstr ()
148 .\"O returns the number of bytes (including the terminating null byte)
149 .\"O that would be required to hold the entire value of that variable.
150 .\"O This value may be greater than
151 .\"O .IR len ,
152 .\"O which means that the value in
153 .\"O .I buf
154 .\"O is truncated.
155 .I name
156 ¤¬Í­¸ú¤Ê¥³¥ó¥Õ¥£¥®¥å¥ì¡¼¥·¥ç¥óÊÑ¿ô¤Î¾ì¹ç¡¢
157 .BR confstr ()
158 ¤Ï¤½¤ÎÊÑ¿ô¤ÎÃÍÁ´ÂΤòÊÝ»ý¤¹¤ë¤Î¤ËɬÍפǤ¢¤Ã¤¿¥Ð¥¤¥È¿ô¤òÊÖ¤¹
159 (ʸ»úÎó½ªÃ¼¤Î¥Ì¥ë¥Ð¥¤¥È¤â´Þ¤à)¡£¤³¤ÎÃͤÏ
160 .I len
161 ¤è¤êÂ礭¤¤¤³¤È¤â¤¢¤ë¡£¤³¤Î¾ì¹ç¤Ë¤Ï¡¢
162 .I buf
163 ¤Ë³ÊǼ¤µ¤ì¤¿ÃͤÎËöÈø¤¬ÀÚ¤êµÍ¤á¤é¤ì¤¿¤³¤È¤ò°ÕÌ£¤¹¤ë¡£
164
165 .\"O If
166 .\"O .I name
167 .\"O is a valid configuration variable,
168 .\"O but that variable does not have a value, then
169 .\"O .BR confstr ()
170 .\"O returns 0.
171 .I name
172 ¤¬Í­¸ú¤Ê¥³¥ó¥Õ¥£¥®¥å¥ì¡¼¥·¥ç¥óÊÑ¿ô¤À¤¬¡¢
173 ÊÑ¿ô¤¬Ãͤò»ý¤Ã¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢
174 .BR confstr ()
175 ¤Ï 0 ¤òÊÖ¤¹¡£
176 .\"O If
177 .\"O .I name
178 .\"O does not correspond to a valid configuration variable,
179 .\"O .BR confstr ()
180 .\"O returns 0, and
181 .\"O .I errno
182 .\"O is set to
183 .\"O .BR EINVAL .
184 .I name
185 ¤¬Í­¸ú¤Ê¥³¥ó¥Õ¥£¥°¥ì¡¼¥·¥ç¥óÊÑ¿ô¤ËÂбþ¤·¤Æ¤¤¤Ê¤±¤ì¤Ð¡¢
186 .BR confstr ()
187 ¤Ï 0 ¤òÊÖ¤·¡¢
188 .I errno
189 ¤Ë
190 .B EINVAL
191 ¤òÀßÄꤹ¤ë¡£
192 .\"O .SH ERRORS
193 .SH ¥¨¥é¡¼
194 .\"O .TP
195 .\"O .B EINVAL
196 .\"O If the value of
197 .\"O .I name
198 .\"O is invalid.
199 .TP
200 .B EINVAL
201 .I name
202 ¤ÎÃͤ¬ÉÔÀµ¤Ç¤¢¤ë¡£
203 .\"O .SH "CONFORMING TO"
204 .SH ½àµò
205 POSIX.1-2001.
206 .\"O .SH EXAMPLE
207 .SH Îã
208 .\"O The following code fragment determines the path where to find
209 .\"O the POSIX.2 system utilities:
210 ¼¡¤ÎÉôʬŪ¤Ê¥³¡¼¥É¤Ï¡¢ POSIX.2 ¥·¥¹¥Æ¥à¤Î¥æ¡¼¥Æ¥£¥ê¥Æ¥£¤¬¤¢¤ë¥Ñ¥¹
211 ¤ò¼èÆÀ¤¹¤ë¤â¤Î¤Ç¤¢¤ë¡£
212 .br
213 .nf
214 .in +4n
215
216 char *pathbuf;
217 size_t n;
218
219 n = confstr(_CS_PATH,NULL,(size_t) 0);
220 pathbuf = malloc(n);
221 if (pathbuf == NULL)
222     abort();
223 confstr(_CS_PATH, pathbuf, n);
224 .in
225 .fi
226 .\"O .SH "SEE ALSO"
227 .SH ´ØÏ¢¹àÌÜ
228 .BR sh (1),
229 .BR exec (3),
230 .BR system (3)