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]

 



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



[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