Re: [RFC] sg3_utils: sgp_dd: work around on pthread_cancel for android

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, Doug and Bart
Thanks so much for your prompt response.
See below my action:

>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 .
>
Correct, pthread_cancel needs -lpthread in the link, AC_CHECK_FUNC cannot
Properly figure out that.

>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?
>
Doug, I had tried that, it works, but this is for C codes macro definition in the config.h.
How can I figure out in the /src/Makefile.ac between Android OS and non-Android?
Can you give me some suggestions? Like this:
     if OS_ANDROID
     sgp_dd_LDADD = ../lib/libsgutils2.la @os_libs@
    else
    sgp_dd_LDADD = ../lib/libsgutils2.la @os_libs@ -lpthread
    endif
>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.
>
Yes, we still need this OS type for Android, since there are several codes needed to be
Modified based on this OS type. For example, block device node folder in the Android
is /dev/block/sgx..., but for the other Linux based OS, it is /dev/sgx....

Have a great holiday!
Bean Huo





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux