From owner-freebsd-threads@FreeBSD.ORG Mon Dec 28 07:18:19 2009 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DCE5F1065672; Mon, 28 Dec 2009 07:18:19 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id B164D8FC1D; Mon, 28 Dec 2009 07:18:19 +0000 (UTC) Received: from apple.my.domain (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id nBS7IHon042544; Mon, 28 Dec 2009 07:18:18 GMT (envelope-from davidxu@freebsd.org) Message-ID: <4B385BB9.3010109@freebsd.org> Date: Mon, 28 Dec 2009 15:18:17 +0800 From: David Xu User-Agent: Thunderbird 2.0.0.9 (X11/20080612) MIME-Version: 1.0 To: John Baldwin References: <4B317741.8080004@freebsd.org> <4B32CADA.4010407@freebsd.org> <20091223221219.4416cef6@kan.dnsalias.net> <200912240759.47703.jhb@freebsd.org> In-Reply-To: <200912240759.47703.jhb@freebsd.org> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Cc: Daniel Eischen , freebsd-threads@freebsd.org Subject: Re: first patch for process-shared semaphore X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2009 07:18:19 -0000 John Baldwin wrote: > On Wednesday 23 December 2009 10:12:19 pm Alexander Kabaev wrote: >> On Thu, 24 Dec 2009 09:58:50 +0800 >> David Xu wrote: >> >>> Alexander Kabaev wrote: >>>> On Thu, 24 Dec 2009 09:22:34 +0800 >>>> David Xu wrote: >>>>> libthr does not require semaphore, it implements semaphore, >>>>> it is easier than other ways to implement the process-shared. >>>>> >>>> Let me rephrase: I do not think semaphores belong in libthr. They >>>> should be either in libc or in librt. >>>> >>>> >>> OK, does others really implement semaphore in librt ? >>> unfortunately, the librt already requires libpthread to implement >>> SIGEV_THREAD. >> I retract that. It appears that there is no consistency - Solaris put >> these into libc, Linux into libpthread ans SUSv2 hints that these >> belong with realtime functions. libthr is fine. > > I vote for libc. Single-threaded processes can use sem_open() and PSHARED > sem_init() as well. Single-threaded processes can even use non-PSHARED > sem_init() by using fork() to create new "threads" that share the semaphore. > May I can move all semaphore functions into libc and remove all semaphore related symbols from libthr ? In pratical, this is not a problem, because libthr itself is not dlopen-safe, all missing semaphore functions in libthr will be found in libc by rtld. From owner-freebsd-threads@FreeBSD.ORG Mon Dec 28 11:07:09 2009 Return-Path: Delivered-To: freebsd-threads@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8AD9E106568B for ; Mon, 28 Dec 2009 11:07:09 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 7A11E8FC21 for ; Mon, 28 Dec 2009 11:07:09 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id nBSB79CJ079628 for ; Mon, 28 Dec 2009 11:07:09 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id nBSB78Rq079626 for freebsd-threads@FreeBSD.org; Mon, 28 Dec 2009 11:07:08 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 28 Dec 2009 11:07:08 GMT Message-Id: <200912281107.nBSB78Rq079626@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: gnats set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: freebsd-threads@FreeBSD.org Cc: Subject: Current problem reports assigned to freebsd-threads@FreeBSD.org X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2009 11:07:09 -0000 Note: to view an individual PR, use: http://www.freebsd.org/cgi/query-pr.cgi?pr=(number). The following is a listing of current problems submitted by FreeBSD users. These represent problem reports covering all versions including experimental development code and obsolete releases. S Tracker Resp. Description -------------------------------------------------------------------------------- o threa/141721 threads rtprio(1): (id|rt)prio priority resets when new thread o threa/141198 threads [libc] src/lib/libc/stdio does not properly initialize o threa/136345 threads Recursive read rwlocks in thread A cause deadlock with o threa/135673 threads databases/mysql50-server - MySQL query lock-ups on 7.2 p threa/135462 threads [PATCH] _thread_cleanupspecific() doesn't handle delet o threa/133734 threads 32 bit libthr failing pthread_create() o threa/128922 threads threads hang with xorg running o threa/127225 threads bug in lib/libthr/thread/thr_init.c o threa/122923 threads 'nice' does not prevent background process from steali o threa/121336 threads lang/neko threading ok on UP, broken on SMP (FreeBSD 7 o threa/118715 threads kse problem o threa/116668 threads can no longer use jdk15 with libthr on -stable SMP o threa/116181 threads /dev/io-related io access permissions are not propagat o threa/115211 threads pthread_atfork misbehaves in initial thread o threa/110636 threads [request] gdb(1): using gdb with multi thread applicat o threa/110306 threads apache 2.0 segmentation violation when calling gethost o threa/103975 threads Implicit loading/unloading of libpthread.so may crash o threa/101323 threads [patch] fork(2) in threaded programs broken. s threa/100815 threads FBSD 5.5 broke nanosleep in libc_r s threa/94467 threads send(), sendto() and sendmsg() are not correct in libc s threa/84483 threads problems with devel/nspr and -lc_r on 4.x o threa/83914 threads [libc] popen() doesn't work in static threaded program o threa/80992 threads abort() sometimes not caught by gdb depending on threa o threa/80435 threads panic on high loads o threa/79887 threads [patch] freopen() isn't thread-safe o threa/79683 threads svctcp_create() fails if multiple threads call at the s threa/76694 threads fork cause hang in dup()/close() function in child (-l s threa/76690 threads fork hang in child for -lc_r o threa/75374 threads pthread_kill() ignores SA_SIGINFO flag o threa/75273 threads FBSD 5.3 libpthread (KSE) bug o threa/72953 threads fork() unblocks blocked signals w/o PTHREAD_SCOPE_SYST o threa/70975 threads [sysvipc] unexpected and unreliable behaviour when usi s threa/69020 threads pthreads library leaks _gc_mutex s threa/49087 threads Signals lost in programs linked with libc_r s threa/48856 threads Setting SIGCHLD to SIG_IGN still leaves zombies under s threa/40671 threads pthread_cancel doesn't remove thread from condition qu s threa/39922 threads [threads] [patch] Threaded applications executed with s threa/37676 threads libc_r: msgsnd(), msgrcv(), pread(), pwrite() need wra s threa/34536 threads accept() blocks other threads s threa/32295 threads [libc_r] [patch] pthread(3) dont dequeue signals s threa/30464 threads pthread mutex attributes -- pshared s threa/24632 threads libc_r delicate deviation from libc in handling SIGCHL s threa/24472 threads libc_r does not honor SO_SNDTIMEO/SO_RCVTIMEO socket o 43 problems total. From owner-freebsd-threads@FreeBSD.ORG Mon Dec 28 16:37:07 2009 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 94B971065672; Mon, 28 Dec 2009 16:37:07 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 673F18FC1B; Mon, 28 Dec 2009 16:37:07 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 2637E46B0C; Mon, 28 Dec 2009 11:37:07 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 54BD18A01D; Mon, 28 Dec 2009 11:37:06 -0500 (EST) From: John Baldwin To: David Xu Date: Mon, 28 Dec 2009 11:19:18 -0500 User-Agent: KMail/1.12.1 (FreeBSD/7.2-CBSD-20091103; KDE/4.3.1; amd64; ; ) References: <4B317741.8080004@freebsd.org> <200912240755.11841.jhb@freebsd.org> <4B341241.9090208@freebsd.org> In-Reply-To: <4B341241.9090208@freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200912281119.18173.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Mon, 28 Dec 2009 11:37:06 -0500 (EST) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: freebsd-threads@freebsd.org Subject: Re: first patch for process-shared semaphore X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2009 16:37:07 -0000 On Thursday 24 December 2009 8:15:45 pm David Xu wrote: > John Baldwin wrote: > > > Yes, Solaris uses files in /tmp and Darwin uses special file descriptors > > similar to what we do. However, you will have to restrict the namespace if > > you go the /tmp route to be safe I think similar to what Solaris does (no path > > separators, just simple names like 'foo'). > > I will only allow names like /XXX, make sure to be compatible with > current implementation. Actually, the current implementation in 8+ allow for arbitrary pathnames. However, that is a relatively recent change and it is probably ok to restrict it again. > > You might also want to use the > > same naming convention as Solaris if you go the /tmp route (I think they use a > > path other than .semaphore under /tmp IIRC). > > What is their name convention? The patch just create all semaphore files > in directory /tmp/.semaphore and semaphore name is not changed. They actually create two files in /tmp for each semaphore, a lock file and a data file. _Solaris Internals_ doesn't really indicate why the lock file exists. The files are named /tmp/SEML and /tmp/SEMD where does not include the leading '/', a sem_open() of '/foo' opens /tmp/SEMDfoo. It is perhaps safer to not assume that a /tmp/.semaphore directory exists and to create files in /tmp directly? > > Not sure if we want to do > > anything special to ensure that those particular set of files in /tmp always > > get purged on reboot to avoid weird bugs with semaphores unexpectedly > > persisting across reboots. > > > > Yes, this is an issue, I would like to purge it on reboot. Perhaps /etc/rc.d/cleartmp should always clean semaphores, or at least have a separate rc.conf variable (similar to the one for X files) that is enabled by default? -- John Baldwin From owner-freebsd-threads@FreeBSD.ORG Mon Dec 28 16:37:08 2009 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97F1F1065679; Mon, 28 Dec 2009 16:37:08 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 676A08FC20; Mon, 28 Dec 2009 16:37:08 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id DA9B846B17; Mon, 28 Dec 2009 11:37:07 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 39B908A020; Mon, 28 Dec 2009 11:37:07 -0500 (EST) From: John Baldwin To: David Xu Date: Mon, 28 Dec 2009 11:21:30 -0500 User-Agent: KMail/1.12.1 (FreeBSD/7.2-CBSD-20091103; KDE/4.3.1; amd64; ; ) References: <4B317741.8080004@freebsd.org> <200912240759.47703.jhb@freebsd.org> <4B385BB9.3010109@freebsd.org> In-Reply-To: <4B385BB9.3010109@freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <200912281121.30939.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Mon, 28 Dec 2009 11:37:07 -0500 (EST) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: Daniel Eischen , freebsd-threads@freebsd.org Subject: Re: first patch for process-shared semaphore X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2009 16:37:08 -0000 On Monday 28 December 2009 2:18:17 am David Xu wrote: > John Baldwin wrote: > > On Wednesday 23 December 2009 10:12:19 pm Alexander Kabaev wrote: > >> On Thu, 24 Dec 2009 09:58:50 +0800 > >> David Xu wrote: > >> > >>> Alexander Kabaev wrote: > >>>> On Thu, 24 Dec 2009 09:22:34 +0800 > >>>> David Xu wrote: > >>>>> libthr does not require semaphore, it implements semaphore, > >>>>> it is easier than other ways to implement the process-shared. > >>>>> > >>>> Let me rephrase: I do not think semaphores belong in libthr. They > >>>> should be either in libc or in librt. > >>>> > >>>> > >>> OK, does others really implement semaphore in librt ? > >>> unfortunately, the librt already requires libpthread to implement > >>> SIGEV_THREAD. > >> I retract that. It appears that there is no consistency - Solaris put > >> these into libc, Linux into libpthread ans SUSv2 hints that these > >> belong with realtime functions. libthr is fine. > > > > I vote for libc. Single-threaded processes can use sem_open() and PSHARED > > sem_init() as well. Single-threaded processes can even use non-PSHARED > > sem_init() by using fork() to create new "threads" that share the semaphore. > > > May I can move all semaphore functions into libc and remove all > semaphore related symbols from libthr ? In pratical, this is not a > problem, because libthr itself is not dlopen-safe, all missing semaphore > functions in libthr will be found in libc by rtld. I would go with this approach. There is also some discussion about moving all of libthr into libc as well and having a dummy libpthread now that we are back to a single threading library and to avoid issues with dlopen() of libpthread, etc. -- John Baldwin From owner-freebsd-threads@FreeBSD.ORG Mon Dec 28 20:30:23 2009 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B54D106568D; Mon, 28 Dec 2009 20:30:23 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: from qw-out-2122.google.com (qw-out-2122.google.com [74.125.92.24]) by mx1.freebsd.org (Postfix) with ESMTP id 242F98FC08; Mon, 28 Dec 2009 20:30:22 +0000 (UTC) Received: by qw-out-2122.google.com with SMTP id 9so2282657qwb.7 for ; Mon, 28 Dec 2009 12:30:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:in-reply-to:references:x-mailer:mime-version :content-type; bh=TwR2F09iZsOw2gHztWbbRsFhugYL1nScfQLB/IKCFxI=; b=g6aQKGiAnJwY3wDHBVlvfHslgnDgElwNy361j9NdrkFepvIcyU6r+9J6jVY22qtRRE 8QKYoZYxOmMCfmzrAA6jDpzir8V0qH3awc3jMkOAXcsrZdjWDBCxyM19XqxmCOD4fm3z ehvmFP7vGvhQ8Bxpdz2bIYkkmuiISYpMUtckU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type; b=etNsNKIYUIGjPyXq2YUOSYrz2qJj5K6bXAMQx78wfFVCbSgz5LdJvf2gA27HipPUWy HemP8uFhV4e7zSDJWf6jlRlAoFaL6G4/wrBvpf7kWrO96NUxK/0Iav3jtv0FEZge2DvT p93ZAxtLLSW2TrdCgbLiRehH+jEOCiezlTvxg= Received: by 10.224.41.84 with SMTP id n20mr7691357qae.205.1262030670081; Mon, 28 Dec 2009 12:04:30 -0800 (PST) Received: from kan.dnsalias.net (c-24-91-218-112.hsd1.ma.comcast.net [24.91.218.112]) by mx.google.com with ESMTPS id 5sm32435842qwg.8.2009.12.28.12.04.28 (version=SSLv3 cipher=RC4-MD5); Mon, 28 Dec 2009 12:04:28 -0800 (PST) Date: Mon, 28 Dec 2009 15:04:23 -0500 From: Alexander Kabaev To: John Baldwin Message-ID: <20091228150423.201936b4@kan.dnsalias.net> In-Reply-To: <200912281121.30939.jhb@freebsd.org> References: <4B317741.8080004@freebsd.org> <200912240759.47703.jhb@freebsd.org> <4B385BB9.3010109@freebsd.org> <200912281121.30939.jhb@freebsd.org> X-Mailer: Claws Mail 3.7.3 (GTK+ 2.18.5; amd64-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/sKORHipieJpQpE4DcbZMhid"; protocol="application/pgp-signature" Cc: Eischen , Daniel, David Xu , freebsd-threads@freebsd.org Subject: Re: first patch for process-shared semaphore X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2009 20:30:23 -0000 --Sig_/sKORHipieJpQpE4DcbZMhid Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Mon, 28 Dec 2009 11:21:30 -0500 John Baldwin wrote: > On Monday 28 December 2009 2:18:17 am David Xu wrote: > > John Baldwin wrote: > > > On Wednesday 23 December 2009 10:12:19 pm Alexander Kabaev wrote: > > >> On Thu, 24 Dec 2009 09:58:50 +0800 > > >> David Xu wrote: > > >> > > >>> Alexander Kabaev wrote: > > >>>> On Thu, 24 Dec 2009 09:22:34 +0800 > > >>>> David Xu wrote: > > >>>>> libthr does not require semaphore, it implements semaphore, > > >>>>> it is easier than other ways to implement the process-shared. > > >>>>> > > >>>> Let me rephrase: I do not think semaphores belong in libthr. > > >>>> They should be either in libc or in librt. > > >>>> > > >>>> > > >>> OK, does others really implement semaphore in librt ? > > >>> unfortunately, the librt already requires libpthread to > > >>> implement SIGEV_THREAD. > > >> I retract that. It appears that there is no consistency - > > >> Solaris put these into libc, Linux into libpthread ans SUSv2 > > >> hints that these belong with realtime functions. libthr is fine. > > >=20 > > > I vote for libc. Single-threaded processes can use sem_open() > > > and PSHARED sem_init() as well. Single-threaded processes can > > > even use non-PSHARED sem_init() by using fork() to create new > > > "threads" that share the=20 > semaphore. > > >=20 > > May I can move all semaphore functions into libc and remove all > > semaphore related symbols from libthr ? In pratical, this is not a > > problem, because libthr itself is not dlopen-safe, all missing > > semaphore functions in libthr will be found in libc by rtld. >=20 > I would go with this approach. There is also some discussion about > moving all of libthr into libc as well and having a dummy libpthread > now that we are back to a single threading library and to avoid > issues with dlopen() of libpthread, etc. >=20 Removing symbols from library, versioned library especially, is a big=20 wrong. You should provide compat symbols for all functions that that were there before. =20 --=20 Alexander Kabaev --Sig_/sKORHipieJpQpE4DcbZMhid Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.13 (FreeBSD) iD8DBQFLOQ9LQ6z1jMm+XZYRApnrAKDK1kDOTKhtaXvotDFx/FF65w/TmACg7EAJ 7q8iXn24ZMHtwaFpZMkw4xo= =NVRk -----END PGP SIGNATURE----- --Sig_/sKORHipieJpQpE4DcbZMhid-- From owner-freebsd-threads@FreeBSD.ORG Mon Dec 28 20:55:47 2009 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4C98910656B7; Mon, 28 Dec 2009 20:55:47 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 04A728FC1C; Mon, 28 Dec 2009 20:55:47 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 9912E46B0D; Mon, 28 Dec 2009 15:55:46 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPA id BDFD68A01B; Mon, 28 Dec 2009 15:55:45 -0500 (EST) From: John Baldwin To: Alexander Kabaev Date: Mon, 28 Dec 2009 15:51:19 -0500 User-Agent: KMail/1.12.1 (FreeBSD/7.2-CBSD-20091103; KDE/4.3.1; amd64; ; ) References: <4B317741.8080004@freebsd.org> <200912281121.30939.jhb@freebsd.org> <20091228150423.201936b4@kan.dnsalias.net> In-Reply-To: <20091228150423.201936b4@kan.dnsalias.net> MIME-Version: 1.0 Message-Id: <200912281551.19942.jhb@freebsd.org> Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Mon, 28 Dec 2009 15:55:45 -0500 (EST) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: Daniel Eischen , David Xu , freebsd-threads@freebsd.org Subject: Re: first patch for process-shared semaphore X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2009 20:55:47 -0000 On Monday 28 December 2009 3:04:23 pm Alexander Kabaev wrote: > On Mon, 28 Dec 2009 11:21:30 -0500 > John Baldwin wrote: > > > On Monday 28 December 2009 2:18:17 am David Xu wrote: > > > John Baldwin wrote: > > > > On Wednesday 23 December 2009 10:12:19 pm Alexander Kabaev wrote: > > > >> On Thu, 24 Dec 2009 09:58:50 +0800 > > > >> David Xu wrote: > > > >> > > > >>> Alexander Kabaev wrote: > > > >>>> On Thu, 24 Dec 2009 09:22:34 +0800 > > > >>>> David Xu wrote: > > > >>>>> libthr does not require semaphore, it implements semaphore, > > > >>>>> it is easier than other ways to implement the process-shared. > > > >>>>> > > > >>>> Let me rephrase: I do not think semaphores belong in libthr. > > > >>>> They should be either in libc or in librt. > > > >>>> > > > >>>> > > > >>> OK, does others really implement semaphore in librt ? > > > >>> unfortunately, the librt already requires libpthread to > > > >>> implement SIGEV_THREAD. > > > >> I retract that. It appears that there is no consistency - > > > >> Solaris put these into libc, Linux into libpthread ans SUSv2 > > > >> hints that these belong with realtime functions. libthr is fine. > > > > > > > > I vote for libc. Single-threaded processes can use sem_open() > > > > and PSHARED sem_init() as well. Single-threaded processes can > > > > even use non-PSHARED sem_init() by using fork() to create new > > > > "threads" that share the > > semaphore. > > > > > > > May I can move all semaphore functions into libc and remove all > > > semaphore related symbols from libthr ? In pratical, this is not a > > > problem, because libthr itself is not dlopen-safe, all missing > > > semaphore functions in libthr will be found in libc by rtld. > > > > I would go with this approach. There is also some discussion about > > moving all of libthr into libc as well and having a dummy libpthread > > now that we are back to a single threading library and to avoid > > issues with dlopen() of libpthread, etc. > > > > Removing symbols from library, versioned library especially, is a big > wrong. You should provide compat symbols for all functions that that > were there before. So can you have a 1.1 sem_init() in libthr that calls the 1.2 sem_init() in libc? I'm ok with simple compat stubs. In this case the compat stubs might actually need to do work though since they would need to malloc() a separate cookie structure to map from the "old" semid_t that was just a pointer to the new structure. Presumably even libc would need 1.1 compat shims in this case, too. Not sure if you can have libthr's compat shims call the compat shims in libc somehow to avoid code duplication. -- John Baldwin From owner-freebsd-threads@FreeBSD.ORG Tue Dec 29 00:44:14 2009 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3BCFE1065693; Tue, 29 Dec 2009 00:44:14 +0000 (UTC) (envelope-from eischen@vigrid.com) Received: from mail.netplex.net (mail.netplex.net [204.213.176.10]) by mx1.freebsd.org (Postfix) with ESMTP id DD8028FC13; Tue, 29 Dec 2009 00:44:15 +0000 (UTC) Received: from [10.0.0.18] (ip-414b102e.ct.fixed.ntplx.com [65.75.16.46]) (authenticated bits=0) by mail.netplex.net (8.14.3/8.14.3/NETPLEX) with ESMTP id nBT0L2N3026650 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Mon, 28 Dec 2009 19:21:05 -0500 (EST) X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.netplex.net) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.2 (mail.netplex.net [204.213.176.10]); Mon, 28 Dec 2009 19:21:06 -0500 (EST) References: <4B317741.8080004@freebsd.org> <200912240759.47703.jhb@freebsd.org> <4B385BB9.3010109@freebsd.org> <200912281121.30939.jhb@freebsd.org> <20091228150423.201936b4@kan.dnsalias.net> Message-Id: From: Daniel Eischen To: Alexander Kabaev In-Reply-To: <20091228150423.201936b4@kan.dnsalias.net> Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Mailer: iPhone Mail (7D11) Mime-Version: 1.0 (iPhone Mail 7D11) Date: Mon, 28 Dec 2009 19:20:59 -0500 Cc: Eischen , "freebsd-threads@freebsd.org" , "Daniel@freebsd.org" , David Xu Subject: Re: first patch for process-shared semaphore X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Dec 2009 00:44:14 -0000 On Dec 28, 2009, at 3:04 PM, Alexander Kabaev wrote: > On Mon, 28 Dec 2009 11:21:30 -0500 > John Baldwin wrote: > >> On Monday 28 December 2009 2:18:17 am David Xu wrote: >>> John Baldwin wrote: >>>> On Wednesday 23 December 2009 10:12:19 pm Alexander Kabaev wrote: >>>>> On Thu, 24 Dec 2009 09:58:50 +0800 >>>>> David Xu wrote: >>>>> >>>>>> Alexander Kabaev wrote: >>>>>>> On Thu, 24 Dec 2009 09:22:34 +0800 >>>>>>> David Xu wrote: >>>>>>>> libthr does not require semaphore, it implements semaphore, >>>>>>>> it is easier than other ways to implement the process-shared. >>>>>>>> >>>>>>> Let me rephrase: I do not think semaphores belong in libthr. >>>>>>> They should be either in libc or in librt. >>>>>>> >>>>>>> >>>>>> OK, does others really implement semaphore in librt ? >>>>>> unfortunately, the librt already requires libpthread to >>>>>> implement SIGEV_THREAD. >>>>> I retract that. It appears that there is no consistency - >>>>> Solaris put these into libc, Linux into libpthread ans SUSv2 >>>>> hints that these belong with realtime functions. libthr is fine. >>>> >>>> I vote for libc. Single-threaded processes can use sem_open() >>>> and PSHARED sem_init() as well. Single-threaded processes can >>>> even use non-PSHARED sem_init() by using fork() to create new >>>> "threads" that share the >> semaphore. >>>> >>> May I can move all semaphore functions into libc and remove all >>> semaphore related symbols from libthr ? In pratical, this is not a >>> problem, because libthr itself is not dlopen-safe, all missing >>> semaphore functions in libthr will be found in libc by rtld. >> >> I would go with this approach. There is also some discussion about >> moving all of libthr into libc as well and having a dummy libpthread >> now that we are back to a single threading library and to avoid >> issues with dlopen() of libpthread, etc. >> > > Removing symbols from library, versioned library especially, is a big > wrong. You should provide compat symbols for all functions that that > were there before. I tend to agree. I also don't understand the desire to include libthr in libc. Other than dlopen()ing libpthread (which can be worked around other ways), I don't understand why we would need or want this. -- DE From owner-freebsd-threads@FreeBSD.ORG Tue Dec 29 09:24:37 2009 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91BEC1065672; Tue, 29 Dec 2009 09:24:37 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 7EE238FC17; Tue, 29 Dec 2009 09:24:37 +0000 (UTC) Received: from apple.my.domain (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id nBT9OZQ8051762; Tue, 29 Dec 2009 09:24:36 GMT (envelope-from davidxu@freebsd.org) Message-ID: <4B39CAD3.6090704@freebsd.org> Date: Tue, 29 Dec 2009 17:24:35 +0800 From: David Xu User-Agent: Thunderbird 2.0.0.9 (X11/20080612) MIME-Version: 1.0 To: Alexander Kabaev References: <4B317741.8080004@freebsd.org> <200912240759.47703.jhb@freebsd.org> <4B385BB9.3010109@freebsd.org> <200912281121.30939.jhb@freebsd.org> <20091228150423.201936b4@kan.dnsalias.net> In-Reply-To: <20091228150423.201936b4@kan.dnsalias.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Daniel Eischen , freebsd-threads@freebsd.org Subject: Re: first patch for process-shared semaphore X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Dec 2009 09:24:37 -0000 Alexander Kabaev wrote: >>> May I can move all semaphore functions into libc and remove all >>> semaphore related symbols from libthr ? In pratical, this is not a >>> problem, because libthr itself is not dlopen-safe, all missing >>> semaphore functions in libthr will be found in libc by rtld. >> I would go with this approach. There is also some discussion about >> moving all of libthr into libc as well and having a dummy libpthread >> now that we are back to a single threading library and to avoid >> issues with dlopen() of libpthread, etc. >> > > Removing symbols from library, versioned library especially, is a big > wrong. You should provide compat symbols for all functions that that > were there before. > I have updated the patch: http://people.freebsd.org/~davidxu/patch/shared_semaphore_2.patch this time, all semaphore code are moved into libc and libthr still has semaphore stubs. Also, now semaphore file is created in /tmp as name SEMD, this looks like Solaris does as jhb@ said, though the patch doesn't use lock file, but use the semaphore file itself.