Sha256: 078d69fbe29b3c42b81ee36000f364fd165d5b565848826f7474a1d8bc15c798

Contents?: true

Size: 943 Bytes

Versions: 9

Compression:

Stored size: 943 Bytes

Contents

#include <internal/util/posix/utmpx_file.hpp>
#include <leatherman/locale/locale.hpp>
#include <leatherman/logging/logging.hpp>

// Mark string for translation (alias for leatherman::locale::format)
using leatherman::locale::_;

using namespace std;

namespace facter { namespace util { namespace posix {

    bool utmpx_file::instance_exists = false;

    utmpx_file::utmpx_file() {
      if (utmpx_file::instance_exists) {
        throw logic_error(_("only one utmpx_file instance can exist at a time!"));
      }

      utmpx_file::instance_exists = true;
      reset();
    }

    utmpx_file::~utmpx_file() {
        endutxent();
        utmpx_file::instance_exists = false;
    }

    const utmpx* utmpx_file::query(utmpx const& query) const {
        LOG_DEBUG(_("Reading the utmpx file ..."));
        return getutxid(&query);
    }

    void utmpx_file::reset() const {
        setutxent();
    }
}}}  // namespace facter::util::posix

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
facter-3.12.2.cfacter.20181217 ext/facter/facter/lib/src/util/posix/utmpx_file.cc
facter-3.12.1.cfacter.20181031 ext/facter/facter/lib/src/util/posix/utmpx_file.cc
facter-3.11.6.cfacter.20181031 ext/facter/facter/lib/src/util/posix/utmpx_file.cc
facter-3.12.1.cfacter.20181023 ext/facter/facter/lib/src/util/posix/utmpx_file.cc
facter-3.11.5.cfacter.20181022 ext/facter/facter/lib/src/util/posix/utmpx_file.cc
facter-3.12.0.cfacter.20181004 ext/facter/facter/lib/src/util/posix/utmpx_file.cc
facter-3.12.0.cfacter.20181001 ext/facter/facter/lib/src/util/posix/utmpx_file.cc
facter-3.12.0.cfacter.20180918 ext/facter/facter/lib/src/util/posix/utmpx_file.cc
facter-3.11.4.cfacter.20180821 ext/facter/facter/lib/src/util/posix/utmpx_file.cc