Skip to content

Commit

Permalink
feat(uring): compat kernel without __kernel_timespec. Thanks to Law…
Browse files Browse the repository at this point in the history
…liet828 !
  • Loading branch information
Codesire-Deng committed Nov 21, 2023
1 parent c111145 commit e23c973
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
5 changes: 3 additions & 2 deletions include/co_context/config.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include <uring/compat.hpp>
#include <uring/io_uring.h>
#include <uring/uring_define.hpp>
#include <uring/utility/kernel_version.hpp>
Expand Down Expand Up @@ -137,9 +138,9 @@ namespace config {
enum class level : uint8_t { verbose, debug, info, warning, error, no_log };

// inline constexpr level log_level = level::verbose;
// inline constexpr level log_level = level::debug;
inline constexpr level log_level = level::debug;
// inline constexpr level log_level = level::info;
inline constexpr level log_level = level::warning;
// inline constexpr level log_level = level::warning;
// inline constexpr level log_level = level::error;
// inline constexpr level log_level = level::no_log;

Expand Down
1 change: 0 additions & 1 deletion include/co_context/utility/time_cast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <co_context/config.hpp>

#include <chrono>
#include <linux/time_types.h>

namespace co_context {

Expand Down
14 changes: 14 additions & 0 deletions include/uring/compat.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
#pragma once

#if __has_include(<linux/time_types.h>)
#include <linux/time_types.h>
/* <linux/time_types.h> is included above and not needed again */
#define UAPI_LINUX_IO_URING_H_SKIP_LINUX_TIME_TYPES_H 1
#else
#include <cstdint>

struct __kernel_timespec {
int64_t tv_sec;
long long tv_nsec;
};

/* <linux/time_types.h> is not available, so it can't be included */
#define UAPI_LINUX_IO_URING_H_SKIP_LINUX_TIME_TYPES_H 1
#endif

#if __has_include(<linux/openat2.h>)
#include <linux/openat2.h>
Expand Down

0 comments on commit e23c973

Please sign in to comment.