X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=wrapper%2Fcompiler.h;h=e4533d4955c9cb03f4ed702c44bd66b8953d4f5c;hb=d4fe3450f4fec0be4ccb6cda97e7e33124b93a0e;hp=0c016327da5dd27a7e5f06cbffe8379269aa5870;hpb=fd97ec2a5d01095698b89e2200cf9f5e10d5e3ac;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 */