source: rtems/cpukit/posix/src/sysconf.c @ 77fbbd6

5
Last change on this file since 77fbbd6 was ef362818, checked in by Joel Sherrill <joel@…>, on 12/06/16 at 03:06:40

Add support for posix_devctl()

  • 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
35long 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    case _SC_POSIX_26_VERSION:
55      return (long) _POSIX_26_VERSION;
56#if defined(__sparc__)
57    case 515: /* Solaris _SC_STACK_PROT */
58      return 0;
59#endif
60    default:
61      rtems_set_errno_and_return_minus_one( EINVAL );
62  }
63}
Note: See TracBrowser for help on using the repository browser.