From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10748 Path: news.gmane.org!.POSTED!not-for-mail From: Sebastian Kemper Newsgroups: gmane.linux.lib.musl.general Subject: Re: Robust shared mutexes? Date: Sun, 27 Nov 2016 11:54:34 +0100 Message-ID: <20161127105425.GA14788@hotdamn.lan> References: <20161126214943.GA2635@hotdamn.lan> <20161126222443.GV1555@brightrain.aerifal.cx> <20161126225104.GA2151@hotdamn.lan> <20161126225617.GW1555@brightrain.aerifal.cx> <20161126230110.GX5749@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1480244095 31785 195.159.176.226 (27 Nov 2016 10:54:55 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 27 Nov 2016 10:54:55 +0000 (UTC) Cc: Szabolcs Nagy To: musl@lists.openwall.com Original-X-From: musl-return-10761-gllmg-musl=m.gmane.org@lists.openwall.com Sun Nov 27 11:54:50 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1cAx6f-00074q-Ex for gllmg-musl@m.gmane.org; Sun, 27 Nov 2016 11:54:49 +0100 Original-Received: (qmail 3999 invoked by uid 550); 27 Nov 2016 10:54:50 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 3972 invoked from network); 27 Nov 2016 10:54:49 -0000 Content-Disposition: inline In-Reply-To: <20161126230110.GX5749@port70.net> X-Provags-ID: V03:K0:ctAdDF3rnRXWGHPg5sC93Ta+3zl+PMipXy1aCfL5jR+eIZsh43Q o21g7PjPji9lQ1r+nXS4c5dTDbL0kYAFUDxsS0jfDoUiTeJA2obJLof087AXp+aS50Zsk4s R6HMN1AR2541N6N9V+/OBuiizgqm9JMJbYQrsZ/1mfgUjm0zVzNoKX2zAYJan63qoDAQGhY IN3Zoh8bdvDlKikD2SSdQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:Vuv5bzFJppU=:RdHwz2qAy/zTnnKJiTv1j2 eT4aQ1nLqsagtOHu+ljexw3AdSdrfD+kfq252fgd9GxQNF7L7mqBqJ4lr5BAdqqUbpJM06kw6 YLoCIADUVlml+4Ldfyp4DYiZhUDKEnDl8jt3B6IeiqmQnZwZAU3qb0znMqqy5rVq+CFJOkeKJ y4ydEQDXO6/pqBvnT911i/yeriAWFWo550PioCD9MJ83XWtwie2jwujWrTzkjRp1DSPzecxIe YmUH8+jFCo8Xv3ZoqvojrYHq096ppdzh3lIAp98hcr3VAy/hmv+aT9HEpE7broDKvQ7HfJBSP pApvO6m2nnTAWwQ37jJGeawH37HdrvVUNk4swc+/fsYUiFAbWD1pVZGJe/un8VbV1vxMA3JLf 5JRONg94OQDDdTpXoN2bG6vn6ce8mJmDLNkpNlkS1Aqtj9K+aiB2kXOkTd4sD+8WWQdqcI0ta fN01IwdAvp9KC661I+u9QYMFgDaKNQuKhFzg7Pt+rv9K0W+y5vzsZ8DZdJz4JnXkmAr4GdScf b25K2oWwLtLPZWSgJ2TA+YGmGwEqUoE/JfLjFFtfHnioXwYQUVF1WThywglA70Mn0DCa2cX3Q cQTJFsE0zNaBNbxskQ5pF/cQXALxF1oPddNqjgbuocvoid/T1rpP8hjcnUN9pIvTmgx4nc6Pf gyWUqWVceRZLyIOBaDk4BCqYQw30VYMSxwSvSNFssKKj4nm5fTlmisJqfhv7gC6FiHiwFuQCl xs8iZKr0MReJRkP0TS4m9qFkYEkOMVlbGe8qrbaRhqzKT4BwIl62WPO74pM= Xref: news.gmane.org gmane.linux.lib.musl.general:10748 Archived-At: On Sun, Nov 27, 2016 at 12:01:10AM +0100, Szabolcs Nagy wrote: > * Rich Felker [2016-11-26 17:56:18 -0500]: > > On Sat, Nov 26, 2016 at 11:51:05PM +0100, Sebastian Kemper wrote: > > > > > > http://lists.openembedded.org/pipermail/openembedded-core/2016-March/119214.html > > > > > > It says musl doesn't have process shared mutexes so one should set > > > apr_cv_process_shared_works=no. I take it that is correct? > > > > No, it's incorrect and I have no idea where that idea came from. I'll > > ask Khem. > > > > apr might care about sharing mutexes across i386 vs x86_64 ? > > that does not work (glibc ditto) Hello Szabolcs, list, I installed a Gentoo musl-1.1.15 x86_64 chroot on my computer. Then I ran ./configure in apr-1.5.2 in the musl chroot and also outside the chroot in a glibc-2.22 environment. The outcome was the same except for apr_cv_mutex_robust_shared: ac_cv_func_setpgrp_void musl yes glibc yes ac_cv_file__dev_zero musl yes glibc yes apr_cv_tcp_nodelay_with_cork musl yes glibc yes apr_cv_mutex_recursive musl yes glibc yes ac_cv_func_pthread_rwlock_init musl yes glibc yes apr_cv_type_rwlock_t=yes musl yes glibc yes apr_cv_process_shared_works musl yes glibc yes apr_cv_mutex_robust_shared musl no glibc yes I've posted the corresponding part from config.log below. It fails because musl doesn't define PTHREAD_MUTEX_ROBUST_NP (glibc does). And apr uses PTHREAD_MUTEX_ROBUST_NP. It means that I should set apr_cv_mutex_robust_shared=no when cross-compiling this apr, I suppose :) configure:25459: checking for robust cross-process mutex support configure:25500: gcc -o conftest -g -O2 -DLINUX -D_REENTRANT -D_GNU_SOURCE conftest.c -lpthread >&5 conftest.c: In function 'main': conftest.c:197:47: error: 'PTHREAD_MUTEX_ROBUST_NP' undeclared (first use in this function) if (pthread_mutexattr_setrobust_np(&attr, PTHREAD_MUTEX_ROBUST_NP)) ^ conftest.c:197:47: note: each undeclared identifier is reported only once for each function it appears in configure:25500: $? = 1 configure: program exited with status 1 configure: failed program was: | /* confdefs.h */ | #define PACKAGE_NAME "" | #define PACKAGE_TARNAME "" | #define PACKAGE_VERSION "" | #define PACKAGE_STRING "" | #define PACKAGE_BUGREPORT "" | #define PACKAGE_URL "" | #define STDC_HEADERS 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_UNISTD_H 1 | #define __EXTENSIONS__ 1 | #define _ALL_SOURCE 1 | #define _GNU_SOURCE 1 | #define _POSIX_PTHREAD_SEMANTICS 1 | #define _TANDEM_SOURCE 1 | #define HAVE_DLFCN_H 1 | #define LT_OBJDIR ".libs/" | #define HAVE_ATOMIC_BUILTINS 1 | #define HAVE_PTHREAD_H 1 | #define HAVE_PTHREAD_H 1 | #define HAVE_PTHREAD_MUTEX_RECURSIVE 1 | #define HAVE_PTHREAD_KEY_DELETE 1 | #define HAVE_PTHREAD_RWLOCK_INIT 1 | #define HAVE_PTHREAD_ATTR_SETGUARDSIZE 1 | #define HAVE_PTHREAD_RWLOCKS 1 | #define HAVE_SCHED_H 1 | #define HAVE_SCHED_YIELD 1 | #define HAVE_GETHOSTBYNAME_R 1 | #define HAVE_GETHOSTBYADDR_R 1 | #define HAVE_GETSERVBYNAME_R 1 | #define HAVE_SIGSUSPEND 1 | #define HAVE_SIGWAIT 1 | #define HAVE_POLL 1 | #define HAVE_EPOLL 1 | #define HAVE_EPOLL_CREATE1 1 | #define HAVE_DUP3 1 | #define HAVE_ACCEPT4 1 | #define HAVE_SOCK_CLOEXEC 1 | #define HAVE_FDATASYNC 1 | #define HAVE_EPOLL_CREATE1 1 | #define HAVE_DUP3 1 | #define HAVE_ACCEPT4 1 | #define HAVE_SOCK_CLOEXEC 1 | #define HAVE_GETPWNAM_R 1 | #define HAVE_GETPWUID_R 1 | #define HAVE_GETGRNAM_R 1 | #define HAVE_GETGRGID_R 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_MMAN_H 1 | #define HAVE_SYS_IPC_H 1 | #define HAVE_SYS_SHM_H 1 | #define HAVE_SYS_FILE_H 1 | #define HAVE_MMAP 1 | #define HAVE_MUNMAP 1 | #define HAVE_SHM_OPEN 1 | #define HAVE_SHM_UNLINK 1 | #define HAVE_SHMGET 1 | #define HAVE_SHMAT 1 | #define HAVE_SHMDT 1 | #define HAVE_SHMCTL 1 | #define HAVE_MAP_ANON 1 | #define anonymous shared memory allocation method 1 | #define USE_SHMEM_MMAP_ANON 1 | #define namebased memory allocation method 1 | #define USE_SHMEM_SHMGET 1 | #define HAVE_ALLOCA_H 1 | #define HAVE_ALLOCA 1 | #define HAVE_CALLOC 1 | #define HAVE_SETSID 1 | #define HAVE_GETENV 1 | #define HAVE_PUTENV 1 | #define HAVE_SETENV 1 | #define HAVE_UNSETENV 1 | #define HAVE_WRITEV 1 | #define HAVE_GETIFADDRS 1 | #define HAVE_UTIME 1 | #define HAVE_UTIMES 1 | #define HAVE_SETRLIMIT 1 | #define HAVE_GETRLIMIT 1 | #define HAVE_SENDFILE 1 | #define HAVE_SIGACTION 1 | #define HAVE_DECL_SYS_SIGLIST 0 | #define HAVE_FORK 1 | #define HAVE_STRERROR_R 1 | #define STRERROR_R_RC_INT 1 | #define HAVE_MMAP 1 | #define HAVE_MEMMOVE 1 | #define HAVE_GETPASS 1 | #define HAVE_GMTIME_R 1 | #define HAVE_LOCALTIME_R 1 | #define HAVE_MKSTEMP 1 | #define STDC_HEADERS 1 | #define HAVE_CRYPT_H 1 | #define HAVE_CTYPE_H 1 | #define HAVE_DIRENT_H 1 | #define HAVE_DLFCN_H 1 | #define HAVE_ERRNO_H 1 | #define HAVE_FCNTL_H 1 | #define HAVE_GRP_H 1 | #define HAVE_LIMITS_H 1 | #define HAVE_MALLOC_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_NETDB_H 1 | #define HAVE_POLL_H 1 | #define HAVE_PWD_H 1 | #define HAVE_SEMAPHORE_H 1 | #define HAVE_SIGNAL_H 1 | #define HAVE_STDARG_H 1 | #define HAVE_STDDEF_H 1 | #define HAVE_STDIO_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_TERMIOS_H 1 | #define HAVE_TIME_H 1 | #define HAVE_UNISTD_H 1 | #define HAVE_ARPA_INET_H 1 | #define HAVE_NETINET_IN_H 1 | #define HAVE_SYS_FILE_H 1 | #define HAVE_SYS_IOCTL_H 1 | #define HAVE_SYS_MMAN_H 1 | #define HAVE_SYS_PARAM_H 1 | #define HAVE_SYS_POLL_H 1 | #define HAVE_SYS_RESOURCE_H 1 | #define HAVE_SYS_SELECT_H 1 | #define HAVE_SYS_SEM_H 1 | #define HAVE_SYS_SENDFILE_H 1 | #define HAVE_SYS_SIGNAL_H 1 | #define HAVE_SYS_SOCKET_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_SYS_TIME_H 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_UIO_H 1 | #define HAVE_SYS_UN_H 1 | #define HAVE_SYS_WAIT_H 1 | #define HAVE_NETINET_TCP_H 1 | #define SETPGRP_VOID 1 | #define HAVE_SOCKLEN_T 1 | #define SIZEOF_VOIDP 8 | #define SIZEOF_CHAR 1 | #define SIZEOF_INT 4 | #define SIZEOF_LONG 8 | #define SIZEOF_SHORT 2 | #define SIZEOF_LONG_LONG 8 | #define SIZEOF_PID_T 4 | #define SIZEOF_SSIZE_T 8 | #define SIZEOF_SIZE_T 8 | #define SIZEOF_OFF_T 8 | #define SIZEOF_INO_T 8 | #define SIZEOF_STRUCT_IOVEC 16 | #define HAVE_STRNCASECMP 1 | #define HAVE_STRCASECMP 1 | #define HAVE_STRDUP 1 | #define HAVE_STRSTR 1 | #define HAVE_MEMCHR 1 | #define APR_INT64_STRFN strtol | #define APR_OFF_T_STRFN strtol | #define DSO_USE_DLFCN 1 | #define HAVE_WAITPID 1 | #define HAVE_VLA 1 | #define HAVE_SEMGET 1 | #define HAVE_SEMCTL 1 | #define HAVE_FLOCK 1 | #define HAVE_SEMAPHORE_H 1 | #define HAVE_SEM_CLOSE 1 | #define HAVE_SEM_UNLINK 1 | #define HAVE_SEM_POST 1 | #define HAVE_SEM_WAIT 1 | #define HAVE_LOCK_EX 1 | #define HAVE_F_SETLK 1 | #define HAVE_SEM_UNDO 1 | #define HAVE_POLLIN 1 | #define HAVE_PTHREAD_PROCESS_SHARED 1 | #define HAVE_PTHREAD_MUTEXATTR_SETPSHARED 1 | /* end confdefs.h. */ | | #include | #include | #include | | int main(int argc, char **argv) | { | pthread_mutex_t mutex; | pthread_mutexattr_t attr; | | if (pthread_mutexattr_init(&attr)) | exit(1); | if (pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED)) | exit(2); | if (pthread_mutexattr_setrobust_np(&attr, PTHREAD_MUTEX_ROBUST_NP)) | exit(3); | if (pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT)) | exit(4); | if (pthread_mutex_init(&mutex, &attr)) | exit(5); | if (pthread_mutexattr_destroy(&attr)) | exit(6); | if (pthread_mutex_destroy(&mutex)) | exit(7); | | exit(0); | } configure:25510: result: no configure:25895: result: decision on apr_lock implementation method... SysV IPC semget()