A perf ABI fix
Posted Sep 25, 2013 19:55 UTC (Wed) by
pr1268 (subscriber, #24648)
Parent article:
A perf ABI fix
I'm reminded of this gem from some GNU humor Web page I read a few years ago:
#define struct union
I'm not sure that would fix the perf ABI mess, though. ;-)
Seriously, though, why use the bit fields at all? Why not:
__uu64 capabilities;
#define CAP_USR_TIME (1ULL<<63)
#define CAP_USR_RDPMC (1ULL<<62)
#define HAS_CAP_USR_TIME(x) (x)&CAP_USR_TIME
#define HAS_CAP_USR_RDPMC(x) (x)&CAP_USR_RDPMC
#define SET_CAP_USR_TIME(x) (x)|=CAP_USR_TIME
#define SET_CAP_USR_RDPMC(x) (x)|=CAP_USR_RDPMC
#define UNSET_CAP_USR_TIME(x) (x)&=~CAP_USR_TIME
#define UNSET_CAP_USR_RDPMC(x) (x)&=~CAP_USR_RDPMC
Now you have the full complement of query, set, and unset operations in beautiful preprocessor code.
(
Log in to post comments)