public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Alexey Kodanev <alexey.kodanev@oracle.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] syscalls/fcntl: add new test for open file description locks
Date: Thu, 7 Apr 2016 10:46:18 +0300	[thread overview]
Message-ID: <5706104A.70307@oracle.com> (raw)
In-Reply-To: <20160406160733.GC10599@rei.suse.cz>

Hi,
On 04/06/2016 07:07 PM, Cyril Hrubis wrote:
> Hi!
>> +#ifndef F_OFD_GETLK
>> +	intptr_t i;
>> +
>> +	tst_resm(TINFO, "spawning '%d' threads", size);
>> +	for (i = 0; i < size; ++i) {
>> +		if (pthread_create(id + i, NULL, thread_fn, (void *)i)) {
>> +			tst_brkm(TBROK | TERRNO, cleanup,
>> +				 "pthread_create() failed");
> Using TERRNO is wrong here. The error value is returned by the
> pthread_create() instead.
>
> You should do:
>
> 	ret = pthread_create(...);
> 	if (ret) {
> 		tst_brkm(TBROK, cleanup, "pthread_create(): %s",
> 		         tst_strerrno(ret));
> 	}

Oh, that wasn't obvious, I should have read man-page more carefully. Thanks.

>> +		++res[(int)buf[0]];
>                           ^
> 			Do we really need to cast it to int here?


Otherwise gcc would complain  "warning: array subscript has type ‘char’"

>> +
>> +	cleanup();
>> +	tst_exit();
>> +}
> Otherwise it looks good.
>
> I would be happier if the code would get converted to the new test
> library but given that I've managed to ignore it for quite some time I'm
> in no position to force it.

I'll send a new patch with new API usage and the one for safe_pthread.

Thanks,
Alexey



  reply	other threads:[~2016-04-07  7:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-15  9:26 [LTP] [PATCH] syscalls/fcntl: add new test for open file description locks Alexey Kodanev
2016-04-06 15:07 ` Alexey Kodanev
2016-04-06 15:20   ` Cyril Hrubis
2016-04-06 16:07 ` Cyril Hrubis
2016-04-07  7:46   ` Alexey Kodanev [this message]
2016-04-07  8:26     ` Cyril Hrubis
2016-04-07 10:43       ` Alexey Kodanev

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=5706104A.70307@oracle.com \
    --to=alexey.kodanev@oracle.com \
    --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