All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Florian Bezdeka <florian.bezdeka@siemens.com>
Cc: xenomai@xenomai.org, jan.kiszka@siemens.com, chensong_2000@189.cn
Subject: Re: [PATCH 2/2] cobalt/posix/mutex: Harmonize pthread_mutex_timedlock() and sem_timedwait()
Date: Thu, 29 Jul 2021 16:47:52 +0200	[thread overview]
Message-ID: <87mtq55g87.fsf@xenomai.org> (raw)
In-Reply-To: <20210729144025.56162-1-florian.bezdeka@siemens.com>


Florian Bezdeka <florian.bezdeka@siemens.com> writes:

> According to the POSIX spec the value of the timeout parameter needs
> not to be validated if the mutex/semaphore could be taken immediately.
>
> While the implementation of the semaphore timedwait (sem_timedwait())
> allowed an invalid timeout pthread_mutex_timedlock() was failing with
> -EFAULT in case the mutex could be taken immediately.
>
> Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
> ---
>
> This was detected while preparing y2038 stuff. Not sure if that should
> go into 3.2. Comments welcome...
>
> CCed Philippe because he was already involved some (long) time ago.
>

I do agree wholeheartedly with the fundamental whitespace cleanup!

> Regards,
> Florian
>
>  testsuite/smokey/posix-mutex/posix-mutex.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/testsuite/smokey/posix-mutex/posix-mutex.c b/testsuite/smokey/posix-mutex/posix-mutex.c
> index 0f4dbe739..4aad24964 100644
> --- a/testsuite/smokey/posix-mutex/posix-mutex.c
> +++ b/testsuite/smokey/posix-mutex/posix-mutex.c
> @@ -1007,7 +1007,7 @@ static void *mutex_timed_locker_inv_timeout(void *arg)
>  	struct locker_context *p = arg;
>  	int ret;
>  
> -	if (__F(ret, pthread_mutex_timedlock(p->mutex, (void*) 0xdeadbeef)) &&
> +	if (__F(ret, pthread_mutex_timedlock(p->mutex, (void *) 0xdeadbeef)) &&
>  	    __Tassert(ret == -EFAULT))
>  		return (void *)1;
>  
> @@ -1032,7 +1032,7 @@ static int check_timedlock_abstime_validation(void)
>  	 * The second parameter of phtread_mutex_timedlock() is flagged as
>  	 * __nonnull so we take an invalid address instead of NULL.
>  	 */
> -	if (!__T(ret, pthread_mutex_timedlock(&mutex, (void*) 0xdeadbeef)))
> +	if (!__T(ret, pthread_mutex_timedlock(&mutex, (void *) 0xdeadbeef)))
>  		return ret;
>  
>  	/*

-- 
Philippe.


      parent reply	other threads:[~2021-07-29 14:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-29 14:40 [PATCH 2/2] cobalt/posix/mutex: Harmonize pthread_mutex_timedlock() and sem_timedwait() Florian Bezdeka
2021-07-29 14:42 ` Bezdeka, Florian
2021-07-29 14:47 ` Philippe Gerum [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mtq55g87.fsf@xenomai.org \
    --to=rpm@xenomai.org \
    --cc=chensong_2000@189.cn \
    --cc=florian.bezdeka@siemens.com \
    --cc=jan.kiszka@siemens.com \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.