Skip to content

qoretechnologies/module-sysconf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Qore sysconf Module
===================

The sysconf module provides Qore with access to runtime system configuration
information from the underlying operating system. The functionality wraps
standard C library system configuration functions.

Functions provided:
- sysconf(): Get system-wide runtime parameters (CPU count, memory limits, etc.)
- confstr(): Get string-valued configuration parameters (paths, versions, etc.)
- pathconf(): Query file system limits for specific paths

Quick Start
-----------

    %requires sysconf

    # Get the number of online CPUs
    printf("CPUs online: %d\n", sysconf(Sysconf::SC_NPROCESSORS_ONLN));

    # Get system page size
    printf("Page size: %d bytes\n", sysconf(Sysconf::SC_PAGESIZE));

    # Get maximum filename length for a path
    printf("Max filename length: %d\n", pathconf("/tmp", Pathconf::PC_NAME_MAX));

    # Get the default PATH
    printf("Default PATH: %s\n", confstr(Confstr::CS_PATH));

Build Instructions
------------------

Requirements:
 - Qore 1.12.4+ development environment (lib and headers)
 - CMake 2.8.12+
 - C++11 compatible compiler
 - (optional) Doxygen for documentation

Use "out of source" build:

    mkdir build
    cd build
    cmake -DCMAKE_INSTALL_PREFIX=/path/to/install ..
    make
    make install

If -DCMAKE_INSTALL_PREFIX is not specified, the Qore module directory is used.

Running Tests
-------------

After building:

    cd build
    make test

Or run the test directly:

    qore test/sysconf.qtest

Documentation
-------------

Full API documentation is generated with Doxygen:

    cd build
    make docs

License
-------

This module is released under the LGPL 2.1 license.
See the COPYING file for the full license text.

Repository
----------

https://github.com/qoretechnologies/module-sysconf

About

Qore sysconf module

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 5