public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] fcntl37: test posix lock across execve
Date: Mon, 26 Mar 2018 16:42:03 +0200	[thread overview]
Message-ID: <20180326144203.GA16692@rei> (raw)
In-Reply-To: <20180326143313.GE27423@rei>

Hi!
> > +	pthread_t th;
> > +	SAFE_PTHREAD_CREATE(&th, NULL, thread_fn, (void *)&fd);
>                                                     ^
> 						    Here as well, we
> 						    have to cast the fd
> 						    to intptr_t first.

Scratch that, you are passing the fd by pointer not by value, which is
questionable practice for a value on the function stack.

What is usually done when you need to pass integers to threads as
paramters is to cast the integer to a type with the same width as a
pointer then casting it to a void*, which is (void*)(intptr_t)fd in this
case.

-- 
Cyril Hrubis
chrubis@suse.cz

  reply	other threads:[~2018-03-26 14:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-26 13:28 [LTP] [PATCH] fcntl37: test posix lock across execve Xiong Zhou
2018-03-26 13:52 ` Daniel P. =?unknown-8bit?q?Berrang=C3=A9?=
2018-03-26 14:33 ` Cyril Hrubis
2018-03-26 14:42   ` Cyril Hrubis [this message]
2018-03-27  8:50   ` Xiong Zhou
2018-03-27 10:19     ` Cyril Hrubis
2018-03-27 12:12       ` Xiong Zhou
2018-03-29 14:09   ` Xiong Zhou
2018-03-30  5:23   ` Xiong Zhou
2018-04-03 14:28     ` Cyril Hrubis
2018-03-27 13:38 ` [LTP] [PATCH v2] " Xiong Zhou
2018-03-27 14:47   ` Cyril Hrubis

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=20180326144203.GA16692@rei \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox