This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 1/9][BZ 16892] Add linux-generic lowlevellock.h
- From: Chris Metcalf <cmetcalf at tilera dot com>
- To: Bernard Ogden <bernie dot ogden at linaro dot org>, <libc-alpha at sourceware dot org>
- Date: Tue, 10 Jun 2014 11:23:26 -0400
- Subject: Re: [PATCH 1/9][BZ 16892] Add linux-generic lowlevellock.h
- Authentication-results: sourceware.org; auth=none
- References: <E10DC0AF-A48B-4EC7-8EA4-0A3D3EF6BDD7 at linaro dot org>
On 6/9/2014 4:24 PM, Bernard Ogden wrote:
+#define lll_futex_timed_wait(futexp, val, timespec, private) \
+ ({ \
+ INTERNAL_SYSCALL_DECL (__err); \
+ long int __ret; \
+ __ret = INTERNAL_SYSCALL (futex, __err, 4, (futexp), \
+ __lll_private_flag (FUTEX_WAIT, private), \
+ (val), (timespec)); \
+ if(INTERNAL_SYSCALL_ERROR_P (__ret, __err)) \
+ __ret = -(INTERNAL_SYSCALL_ERRNO (__ret, __err)); \
+ __ret; \
+ })
Style note: space after "if". And might as well use __glibc_unlikely().
Maybe use an abstraction like INLINE_FUTEX_SYSCALL to capture the INTERNAL_SYSCALL pieces, e.g.
#define INLINE_FUTEX_SYSCALL(name, nr, args...) \
({ \
INTERNAL_SYSCALL_DECL (__err); \
long int __ret = INTERNAL_SYSCALL (name, err, nr, args); \
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (__ret, __err))) \
__ret = -(INTERNAL_SYSCALL_ERRNO (__ret, __err)); \
__ret; \
})
Then you could use that throughout, e.g. lll_futex_timed_wait() is just a #define for INLINE_FUTEX_SYSCALL(futex, 4, (futexp), __lll_private_flag (FUTEX_WAIT, private), (val), (timespec)) and all the rest of the mechanism stays in INLINE_FUTEX_SYSCALL().
Otherwise, not tested, but both his and the tile-specific changes look OK to me.
--
Chris Metcalf, Tilera Corp.
http://www.tilera.com