Monday, November 10, 2008

C and C++ Programming: More Linux POSIX Testing

The machine on which a program may run will have different capabilities depending to its setup and how the kernel was compiled. To test the POSIX capability of the machine at runtime to support POSIX use the following procedures:

  1. long sysconf(int name);
  2. long pathconf(const char *pathname, int name);
  3. long fpathconf(int fd, int name);

See the sysconf(3), pathconf(3), and fpathconf(3) man pages for information on the values supported by the function.

System POSIX Options

POSIX.1 Option values

  • _SC_JOB_CONTROL
  • _SC_SAVED_JOBS
  • _SC_VERSION
  • _SC_ARG_MAX
  • _SC_CHILD_MAX
  • _SC_CLK_TCK
  • _SC_NGROUPS_MAX
  • _SC_OPEN_MAX
  • _SC_STREAM_MAX
  • _SC_TZNAME_MAX

POSIX.4 Option Values

  • _SC_ASYNCHRONOUS_IO
  • _SC_MAPPED_FILES
  • _SC_MEMLOCK
  • _SC_MEMLOCK_RANGE
  • _SC_MEMORY_PROTECTION
  • _SC_MESSAGE_PASSING
  • _SC_PRIORITIZED_IO
  • _SC_PRIORITY_SCHEDULING
  • _SC_REALTIME_SIGNALS
  • _SC_SEMAPHORES
  • _SC_FSYNC
  • _SC_SHARED_MEMORY_OBJECTS
  • _SC_SYNCHRONIZED_IO
  • _SC_TIMERS
  • _SC_AIO_LIST_IO_MAX
  • _SC_AIO_MAX
  • _SC_AIO_PRIO_DELTA_MAX
  • _SC_DELAYTIMER_MAX
  • _SC_MQ_OPEN_MAX
  • _SC_MQ_PRIO_MAX
  • _SC_PAGESIZE
  • _SC_RTSIG_MAX
  • _SC_SEM_NSEMS_MAX
  • _SC_SEM_VALUE_MAX
  • _SC_SIGQUEUE_MAX
  • _SC_TIMER_MAX

File and Directory Related POSIX Options

POSIX.1 Option Values

  • _PC_CHOWN_RESTRICTED
  • _PC_NO_TRUNC
  • _PC_VDISABLE
  • _PC_LINK_MAX
  • _PC_MAX_CANNON
  • _PC_MAX_INPUT
  • _PC_NAME_INPUT
  • _PC_PATH_MAX
  • _PC_PIPE_BUF

POSIX.4 Option Values

  • _PC_ASYNC_IO
  • _PC_PRIO_IO
  • _PC_SYNC_IO

0 comments:

Send SMS for Free