X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=wrapper%2Fcompiler.h;h=e4533d4955c9cb03f4ed702c44bd66b8953d4f5c;hb=a8f2d0c75c9cc179fc9e7f7ca17ea3b3b3b5af41;hp=0c016327da5dd27a7e5f06cbffe8379269aa5870;hpb=95ff37b66a64ae00bfff59fa1f2c81ac31e48b8a;p=lttng-modules.git diff --git a/wrapper/compiler.h b/wrapper/compiler.h index 0c016327..e4533d49 100644 --- a/wrapper/compiler.h +++ b/wrapper/compiler.h @@ -39,4 +39,17 @@ # endif #endif +/* + * READ/WRITE_ONCE were introduced in kernel 3.19 and ACCESS_ONCE + * was removed in 4.15. Prefer READ/WRITE but fallback to ACCESS + * when they are not available. + */ +#ifndef READ_ONCE +# define READ_ONCE(x) ACCESS_ONCE(x) +#endif + +#ifndef WRITE_ONCE +# define WRITE_ONCE(x, val) ({ ACCESS_ONCE(x) = val; }) +#endif + #endif /* _LTTNG_WRAPPER_COMPILER_H */