1 /* Copyright (C) 1991, 1996, 1997, 2000-2002, 2003, 2004
2 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
25 #define CS_PATH "/bin:/usr/bin"
27 /* If BUF is not NULL and LEN > 0, fill in at most LEN - 1 bytes
28 of BUF with the value corresponding to NAME and zero-terminate BUF.
29 Return the number of bytes required to hold NAME's entire value. */
30 size_t confstr (int name
, char *buf
, size_t len
)
39 static const char cs_path
[] = CS_PATH
;
41 string_len
= sizeof (cs_path
);
44 #ifdef __UCLIBC_HAS_THREADS__
45 case _CS_GNU_LIBPTHREAD_VERSION
:
46 # if defined __UCLIBC_HAS_LINUXTHREADS__
47 string
= "linuxthreads-0.01";
48 string_len
= sizeof("linuxthreads-x.xx");
49 # elif defined __UCLIBC_HAS_THREADS_NATIVE__
50 # define __NPTL_VERSION ("NPTL " \
51 __stringify(__UCLIBC_MAJOR__) "." \
52 __stringify(__UCLIBC_MINOR__) "." \
53 __stringify(__UCLIBC_SUBLEVEL__))
54 string
= __NPTL_VERSION
;
55 string_len
= sizeof(__NPTL_VERSION
);
57 # error unable to determine thread impl
66 if (len
> 0 && buf
!= NULL
)
68 if (string_len
<= len
)
69 memcpy (buf
, string
, string_len
);
72 memcpy (buf
, string
, len
- 1);