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

feat(uring): compat kernel without __kernel_timespec. Thanks to Lawliet828 #98

Merged
merged 1 commit into from
Nov 21, 2023
Merged
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
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
Loading