Skip to content

Instantly share code, notes, and snippets.

Created December 31, 2010 13:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/760993 to your computer and use it in GitHub Desktop.
Save anonymous/760993 to your computer and use it in GitHub Desktop.
C++でLinuxカーネルモジュール、ヘッダファイル
#pragma once
extern "C" {
#define alignof alignof_REPLACED
#define bool bool_REPLACED
#define catch catch_REPLACED
#define char16_t char16_t_REPLACED
#define char32_t char32_t_REPLACED
#define class class_REPLACED
#define const_cast const_cast_REPLACED
#define constexpr constexpr_REPLACED
#define decltype decltype_REPLACED
#define delete delete_REPLACED
#define dynamic_cast dynamic_cast_REPLACED
#define explicit explicit_REPLACED
#define export export_REPLACED
#define false false_REPLACED
#define friend friend_REPLACED
#define namespace namespace_REPLACED
#define new new_REPLACED
#define nullptr nullptr_REPLACED
#define operator operator_REPLACED
#define private private_REPLACED
#define protected protected_REPLACED
#define public public_REPLACED
#define reinterpret_cast reinterpret_cast_REPLACED
#define static_assert static_assert_REPLACED
#define static_cast static_cast_REPLACED
#define this this_REPLACED
#define thread_local thread_local_REPLACED
#define throw throw_REPLACED
#define true true_REPLACED
#define try try_REPLACED
#define typeid typeid_REPLACED
#define typename typename_REPLACED
#define using using_REPLACED
#define virtual virtual_REPLACED
#define wchar_t wchar_t_REPLACED
#include <linux/linkage.h>
#undef notrace
#undef asmlinkage
#define notrace
#define asmlinkage
#define typeof __typeof__
typedef int _Bool;
#include <linux/kernel.h>
/*
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); }))
*/
#undef BUILD_BUG_ON_ZERO
#undef BUILD_BUG_ON_NULL
#define BUILD_BUG_ON_ZERO(e) ((size_t)0)
#define BUILD_BUG_ON_NULL(e) ((void*)NULL)
#include <linux/preempt.h>
#include <linux/smp.h>
#include <linux/cpumask.h>
#include <linux/pfn.h>
#include <linux/init.h>
#include <asm/percpu.h>
#ifndef CONFIG_SMP
static inline void __init setup_per_cpu_areas(void);
#endif
#undef no_instrument_function
#define no_instrument_function
#include <linux/percpu.h>
#include <linux/rcupdate.h>
#undef no_instrument_function
#include <linux/limits.h>
#include <linux/errno.h>
#include <linux/version.h>
#include <linux/param.h>
#include <linux/stddef.h>
#include <linux/types.h>
#include <linux/linkage.h>
/* ktime.h */
//#include <linux/interrupt.h>
//#include <linux/serial_core.h>
#include <linux/module.h>
#include <linux/rtc.h>
/* kobject.h */
//#include <linux/tty.h>
/* semaphore.h */
//#include <linux/semaphore.h>
#include <linux/console.h>
#include <linux/serial.h>
#include <asm/io.h>
#include <linux/platform_device.h>
#undef alignof
#undef bool
#undef catch
#undef char16_t
#undef char32_t
#undef class
#undef const_cast
#undef constexpr
#undef decltype
#undef delete
#undef dynamic_cast
#undef explicit
#undef export
#undef false
#undef friend
#undef namespace
#undef new
#undef nullptr
#undef operator
#undef private
#undef protected
#undef public
#undef reinterpret_cast
#undef static_assert
#undef static_cast
#undef this
#undef thread_local
#undef throw
#undef true
#undef try
#undef typeid
#undef typename
#undef using
#undef virtual
#undef wchar_t
static int hellocxx_init(void);
static void hellocxx_exit(void);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment