5
Last change
on this file since 04da96c7 was
40ecd11,
checked in by Sebastian Huber <sebastian.huber@…>, on 03/09/15 at 14:23:20
|
sysconf: Add _SC_NPROCESSORS_(CONF|ONLN)
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Get Configurable System Variables |
---|
5 | * @ingroup POSIXAPI |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * COPYRIGHT (c) 1989-2007. |
---|
10 | * On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.org/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #if HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #include <time.h> |
---|
22 | #include <unistd.h> |
---|
23 | #include <errno.h> |
---|
24 | |
---|
25 | #include <rtems.h> |
---|
26 | #include <rtems/seterr.h> |
---|
27 | #include <rtems/libio_.h> |
---|
28 | |
---|
29 | #include <sys/param.h> |
---|
30 | |
---|
31 | /* |
---|
32 | * 4.8.1 Get Configurable System Variables, P1003.1b-1993, p. 95 |
---|
33 | */ |
---|
34 | |
---|
35 | long sysconf( |
---|
36 | int name |
---|
37 | ) |
---|
38 | { |
---|
39 | switch ( name ) { |
---|
40 | case _SC_CLK_TCK: |
---|
41 | return (long) rtems_clock_get_ticks_per_second(); |
---|
42 | case _SC_OPEN_MAX: |
---|
43 | return rtems_libio_number_iops; |
---|
44 | case _SC_GETPW_R_SIZE_MAX: |
---|
45 | return 1024; |
---|
46 | case _SC_PAGESIZE: |
---|
47 | return PAGE_SIZE; |
---|
48 | case _SC_SYMLOOP_MAX: |
---|
49 | return RTEMS_FILESYSTEM_SYMLOOP_MAX; |
---|
50 | case _SC_NPROCESSORS_CONF: |
---|
51 | return (long) rtems_configuration_get_maximum_processors(); |
---|
52 | case _SC_NPROCESSORS_ONLN: |
---|
53 | return (long) rtems_get_processor_count(); |
---|
54 | #if defined(__sparc__) |
---|
55 | case 515: /* Solaris _SC_STACK_PROT */ |
---|
56 | return 0; |
---|
57 | #endif |
---|
58 | default: |
---|
59 | rtems_set_errno_and_return_minus_one( EINVAL ); |
---|
60 | } |
---|
61 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.