Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build on android, and with LOGGING_LEVEL = 0 #143

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion include/llfio/v2.0/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ Distributed under the Boost Software License, Version 1.0.
#endif
#endif

#if LLFIO_LOGGING_LEVEL == 0
#define LLFIO_DISABLE_PATHS_IN_FAILURE_INFO 1
#endif

#ifndef LLFIO_LOG_TO_OSTREAM
#if !defined(NDEBUG) && !defined(LLFIO_DISABLE_LOG_TO_OSTREAM)
#include <iostream> // for std::cerr
Expand Down Expand Up @@ -239,8 +243,8 @@ LLFIO_V2_NAMESPACE_END
#include "quickcpplib/config.hpp"
#if LLFIO_LOGGING_LEVEL
#include "quickcpplib/ringbuffer_log.hpp"
#include "quickcpplib/utils/thread.hpp"
#endif
#include "quickcpplib/utils/thread.hpp"
// Bring in filesystem
#if defined(__has_include)
// clang-format off
Expand Down
1 change: 1 addition & 0 deletions include/llfio/v2.0/detail/impl/path_discovery.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Distributed under the Boost Software License, Version 1.0.
#include <mutex>
#include <new>
#include <regex>
#include <sstream>
#include <vector>

LLFIO_V2_NAMESPACE_EXPORT_BEGIN
Expand Down
7 changes: 2 additions & 5 deletions include/llfio/v2.0/detail/impl/posix/process_handle.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ Distributed under the Boost Software License, Version 1.0.

#ifdef __FreeBSD__
#include <sys/sysctl.h>
extern "C" char **environ;
#endif
#ifdef __APPLE__
#include <mach-o/dyld.h> // for _NSGetExecutablePath
extern "C" char **environ;
#endif

extern "C" char **environ;

LLFIO_V2_NAMESPACE_BEGIN

LLFIO_HEADERS_ONLY_MEMFUNC_SPEC bool process_handle::is_running() const noexcept
Expand Down Expand Up @@ -122,9 +122,6 @@ LLFIO_HEADERS_ONLY_MEMFUNC_SPEC std::unique_ptr<span<path_view_component>, proce
// Laziness ...
return {};
}
#ifdef __linux__
char **environ = __environ;
#endif
size_t bytesneeded = sizeof(span<path_view_component>);
size_t count = 0;
char **e;
Expand Down
13 changes: 12 additions & 1 deletion include/llfio/v2.0/logging.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,24 @@ namespace detail

LLFIO_V2_NAMESPACE_END

#else // LLFIO_LOGGING_LEVEL
enum class log_level
{
fatal
};
struct log_level_guard
{
log_level_guard(log_level) {}
};
#define LLFIO_LOG_INST_TO_TLS(inst)
#endif // LLFIO_LOGGING_LEVEL

#ifndef LLFIO_LOG_FATAL_TO_CERR
#include <cstdio>
#define LLFIO_LOG_FATAL_TO_CERR(expr) \
fprintf(stderr, "%s\n", (expr)); \
fflush(stderr)
#endif
#endif // LLFIO_LOGGING_LEVEL

#if LLFIO_LOGGING_LEVEL >= 1
#define LLFIO_LOG_FATAL(inst, message) \
Expand Down
3 changes: 1 addition & 2 deletions include/llfio/v2.0/status_code.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,10 +426,9 @@ struct error_info
uint16_t _tls_path_id1{static_cast<uint16_t>(-1)}, _tls_path_id2{static_cast<uint16_t>(-1)};
// The id of the relevant log entry in the LLFIO log (if logging enabled)
size_t _log_id{static_cast<size_t>(-1)};

public:
#endif

public:
//! Default constructor
error_info() = default;
// Explicit construction from an error code
Expand Down
Loading