public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Douglas Gilbert <dgilbert@interlog.com>
To: Bart Van Assche <Bart.VanAssche@wdc.com>,
	"beanhuo@micron.com" <beanhuo@micron.com>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>
Cc: "hare@suse.de" <hare@suse.de>
Subject: Re: [RFC] sg3_utils: sgp_dd: work around on pthread_cancel for android
Date: Fri, 22 Dec 2017 19:43:38 -0500	[thread overview]
Message-ID: <b5e85d2f-e7d6-517b-a9b1-7fa482d5c5f0@interlog.com> (raw)
In-Reply-To: <1513967090.2579.13.camel@sandisk.com>

On 2017-12-22 01:24 PM, Bart Van Assche wrote:
> On Fri, 2017-12-22 at 17:00 +0000, Bean Huo (beanhuo) wrote:
>>   case "${host}" in
>> +        *-*-android*)
>> +		AC_DEFINE_UNQUOTED(SG_ON_ANDROID, 1, [sg3_utils on android])
>> +		AC_DEFINE_UNQUOTED(SG_LIB_LINUX, 1, [sg3_utils on linux])
>> +                AC_SUBST([os_cflags], [''])
>> +                AC_SUBST([os_libs], ['']) ;;
>>           *-*-linux-gnu*)
>>   		AC_DEFINE_UNQUOTED(SG_LIB_LINUX, 1, [sg3_utils on linux])
>>                   AC_SUBST([os_cflags], [''])
>> @@ -79,6 +84,7 @@ AM_CONDITIONAL(OS_OSF, [echo $host_os | grep '^osf' > /dev/null])
>>   AM_CONDITIONAL(OS_SOLARIS, [echo $host_os | grep '^solaris' > /dev/null])
>>   AM_CONDITIONAL(OS_WIN32_MINGW, [echo $host_os | grep '^mingw' > /dev/null])
>>   AM_CONDITIONAL(OS_WIN32_CYGWIN, [echo $host_os | grep '^cygwin' > /dev/null])
>> +AM_CONDITIONAL(OS_ANDROID, [echo $host_os | grep 'android' > /dev/null])
> 
> Hello Bean,
> 
> Please consider to use AC_CHECK_FUNC([pthread_cancel]) or similar to check the
> availability of pthread_cancel(). Explicit distro checks are much harder to maintain
> than checks for individual functions.

That macro doesn't work in Linux. It doesn't work in the sense that
Linux (Ubuntu 17.10) does have pthread_cancel but needs -lpthread
in the link. So AC_CHECK_FUNC([pthread_cancel]) does not place
'#define HAVE_PTHREAD_CANCEL 1' in config.h .

This seems to work in Linux but may not work in Android:
AC_SEARCH_LIBS([pthread_cancel], [pthread], [AC_DEFINE(HAVE_PTHREAD_CANCEL, 1, 
[Found pthread_cancel])], [])

Bean, could you check?

Anyway, I like having an OS type for Android (which I have renamed from
Bean's patch to SG_LIB_ANDROID to be consistent with my other OS
naming). Overall the patch works in Linux.

Doug Gilbert

  reply	other threads:[~2017-12-23  0:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-22 17:00 [RFC] sg3_utils: sgp_dd: work around on pthread_cancel for android Bean Huo (beanhuo)
2017-12-22 18:24 ` Bart Van Assche
2017-12-23  0:43   ` Douglas Gilbert [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-12-23 10:19 Bean Huo (beanhuo)
2017-12-23 13:29 ` Bart Van Assche
2017-12-26 22:21 Bean Huo (beanhuo)
2018-01-02 16:40 ` Bart Van Assche

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=b5e85d2f-e7d6-517b-a9b1-7fa482d5c5f0@interlog.com \
    --to=dgilbert@interlog.com \
    --cc=Bart.VanAssche@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=hare@suse.de \
    --cc=linux-scsi@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox