From owner-freebsd-threads@FreeBSD.ORG Mon Jul 30 11:08:39 2007 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 474B816A41F for ; Mon, 30 Jul 2007 11:08:39 +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 3745713C461 for ; Mon, 30 Jul 2007 11:08:39 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.1/8.14.1) with ESMTP id l6UB8d1p040784 for ; Mon, 30 Jul 2007 11:08:39 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.1/8.14.1/Submit) id l6UB8bPP040780 for freebsd-threads@FreeBSD.org; Mon, 30 Jul 2007 11:08:37 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 30 Jul 2007 11:08:37 GMT Message-Id: <200707301108.l6UB8bPP040780@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 you 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, 30 Jul 2007 11:08:39 -0000 Current FreeBSD problem reports Critical problems S Tracker Resp. Description -------------------------------------------------------------------------------- s threa/76690 threads fork hang in child for -lc_r 1 problem total. Serious problems S Tracker Resp. Description -------------------------------------------------------------------------------- o kern/20016 threads pthreads: Cannot set scheduling timer/Cannot set virtu s threa/24472 threads libc_r does not honor SO_SNDTIMEO/SO_RCVTIMEO socket o s threa/24632 threads libc_r delicate deviation from libc in handling SIGCHL s bin/32295 threads pthread dont dequeue signals s threa/34536 threads accept() blocks other threads o kern/38549 threads the procces compiled whith pthread stopped in pthread_ s threa/39922 threads [threads] [patch] Threaded applications executed with s threa/48856 threads Setting SIGCHLD to SIG_IGN still leaves zombies under s threa/49087 threads Signals lost in programs linked with libc_r s kern/64313 threads FreeBSD (OpenBSD) pthread implicit set/unset O_NONBLOC o threa/70975 threads unexpected and unreliable behaviour when using SYSV se o threa/72429 threads threads blocked in stdio (fgets, etc) are not cancella o threa/72953 threads fork() unblocks blocked signals w/o PTHREAD_SCOPE_SYST o threa/75273 threads FBSD 5.3 libpthread (KSE) bug o threa/75374 threads pthread_kill() ignores SA_SIGINFO flag s threa/76694 threads fork cause hang in dup()/close() function in child (-l o threa/79683 threads svctcp_create() fails if multiple threads call at the o threa/80435 threads panic on high loads o threa/83914 threads [libc] popen() doesn't work in static threaded program s threa/84483 threads problems with devel/nspr and -lc_r on 4.x o threa/85160 threads [libthr] [patch] libobjc + libpthread/libthr crash pro o kern/91266 threads [threads] Trying sleep, but thread marked as sleeping s threa/94467 threads send(), sendto() and sendmsg() are not correct in libc s threa/100815 threads FBSD 5.5 broke nanosleep in libc_r o threa/101323 threads fork(2) in threaded programs broken. o threa/103975 threads Implicit loading/unloading of libpthread.so may crash o threa/110636 threads gdb(1): using gdb with multi thread application with l o threa/113666 threads misc/shared-mime-info doesn't install, can't find thre 28 problems total. Non-critical problems S Tracker Resp. Description -------------------------------------------------------------------------------- s kern/19247 threads uthread_sigaction.c does not do anything wrt SA_NOCLDW s kern/22190 threads A threaded read(2) from a socketpair(2) fd can sometim s threa/30464 threads pthread mutex attributes -- pshared s threa/37676 threads libc_r: msgsnd(), msgrcv(), pread(), pwrite() need wra s threa/40671 threads pthread_cancel doesn't remove thread from condition qu s threa/69020 threads pthreads library leaks _gc_mutex o threa/79887 threads [patch] freopen() isn't thread-safe o threa/80992 threads abort() sometimes not caught by gdb depending on threa o threa/81534 threads [libc_r] [patch] libc_r close() will fail on any fd ty o threa/110306 threads apache 2.0 segmentation violation when calling gethost o threa/114982 threads threads sends error messages to stdout 11 problems total. From owner-freebsd-threads@FreeBSD.ORG Thu Aug 2 21:26:50 2007 Return-Path: Delivered-To: threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9604F16A419 for ; Thu, 2 Aug 2007 21:26:50 +0000 (UTC) (envelope-from jin@george.lbl.gov) Received: from smtp121.sbc.mail.sp1.yahoo.com (smtp121.sbc.mail.sp1.yahoo.com [69.147.64.94]) by mx1.freebsd.org (Postfix) with SMTP id 86EB613C459 for ; Thu, 2 Aug 2007 21:26:50 +0000 (UTC) (envelope-from jin@george.lbl.gov) Received: (qmail 53624 invoked from network); 2 Aug 2007 21:00:10 -0000 Received: from unknown (HELO ?192.168.1.238?) (jinmtb@sbcglobal.net@67.111.218.125 with plain) by smtp121.sbc.mail.sp1.yahoo.com with SMTP; 2 Aug 2007 21:00:10 -0000 X-YMail-OSG: bA74fIwVM1mKLd9sHPGsHGKHRgnwjGOfn4DzdPh8_At1ifTb0UmvlczMOweA1J9AdTrGwCMwNg-- Message-ID: <46B245D5.1050606@george.lbl.gov> Date: Thu, 02 Aug 2007 14:00:05 -0700 From: Jin Guojun User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.13) Gecko/20061027 X-Accept-Language: zh, zh-CN, en MIME-Version: 1.0 To: threads@freebsd.org, questions@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Subject: how sys_select, sys_fork, ... are defined for thread libraries? 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: Thu, 02 Aug 2007 21:26:50 -0000 I am trying to understand how these __sys_xxx functions are defined for thread libraries. Following string search tells that all thread libraries are using these __sys_xxx functions, for example, __sys_select(). However, the search also shows that these functions are not defined anywhere in the entire source tree. /usr/src: findstring sys_select "*.[hcS]" total files= 21687 : pattern= sys_select rootdir= /usr/src regular mode: Thu Aug 2 13:31:40 PDT 2007 ./lib/libc_r/uthread/uthread_fork.c 91: * __sys_select: ./lib/libpthread/thread/thr_private.h 1264:int __sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *); ./lib/libpthread/thread/thr_select.c 61: ret = __sys_select(numfds, readfds, writefds, exceptfds, timeout); ./lib/libthr/thread/thr_private.h 805:int __sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *); ./lib/libthr/thread/thr_syscalls.c 435: ret = __sys_select(numfds, readfds, writefds, exceptfds, timeout); By searching the usr/lib objects, I found them in libc, but they are not in libc source tree. Can someone shed some light on how these system calls are built into libc and what is the different between standard syscall APIs and these __sys_syscall APIs, e.g., __sys_read() vs. read(), etc. Thanks, -Jin nm /usr/lib/libc.a | grep __sys_ 00000008 T __sys_sigreturn 00000008 T __sys_setlogin 00000008 T __sys_reboot ... snapped 00000008 T __sys_kse_release 00000008 T __sys_kse_thr_interrupt 00000008 T __sys_kse_create 00000008 T __sys_kse_wakeup ... skipped 00000008 T __sys_getdtablesize 00000008 T __sys_select 00000008 T __sys_ioctl 00000008 T __sys_close 00000008 T __sys_write 00000008 T __sys_read 00000008 T __sys___syscall From owner-freebsd-threads@FreeBSD.ORG Fri Aug 3 09:55:30 2007 Return-Path: Delivered-To: threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AABB316A420; Fri, 3 Aug 2007 09:55:30 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from relay02.kiev.sovam.com (relay02.kiev.sovam.com [62.64.120.197]) by mx1.freebsd.org (Postfix) with ESMTP id 8D21F13C48D; Fri, 3 Aug 2007 09:55:28 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from [89.162.146.170] (helo=skuns.kiev.zoral.com.ua) by relay02.kiev.sovam.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.67) (envelope-from ) id 1IGt6H-000LUx-Gh; Fri, 03 Aug 2007 12:05:46 +0300 Received: from deviant.kiev.zoral.com.ua (root@[10.1.1.148]) by skuns.kiev.zoral.com.ua (8.14.1/8.14.1) with ESMTP id l7395VoW039296 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 3 Aug 2007 12:05:31 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.1/8.14.1) with ESMTP id l7395VKv035835; Fri, 3 Aug 2007 12:05:31 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.1/8.14.1/Submit) id l7395Usa035834; Fri, 3 Aug 2007 12:05:30 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 3 Aug 2007 12:05:30 +0300 From: Kostik Belousov To: Jin Guojun Message-ID: <20070803090530.GH2738@deviant.kiev.zoral.com.ua> References: <46B245D5.1050606@george.lbl.gov> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="zq44+AAfm4giZpo5" Content-Disposition: inline In-Reply-To: <46B245D5.1050606@george.lbl.gov> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.91.1, clamav-milter version 0.91.1 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-1.4 required=5.0 tests=ALL_TRUSTED autolearn=failed version=3.2.1 X-Spam-Checker-Version: SpamAssassin 3.2.1 (2007-05-02) on skuns.kiev.zoral.com.ua X-Scanner-Signature: b46f4584ea35a5bfe65e3be67b2b2352 X-DrWeb-checked: yes X-SpamTest-Envelope-From: kostikbel@gmail.com X-SpamTest-Group-ID: 00000000 X-SpamTest-Header: Not Detected X-SpamTest-Info: Profiles 1330 [August 2 2007] X-SpamTest-Info: helo_type=3 X-SpamTest-Method: none X-SpamTest-Rate: 0 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0255], KAS30/Release Cc: threads@freebsd.org, questions@freebsd.org Subject: Re: how sys_select, sys_fork, ... are defined for thread libraries? 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: Fri, 03 Aug 2007 09:55:30 -0000 --zq44+AAfm4giZpo5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Aug 02, 2007 at 02:00:05PM -0700, Jin Guojun wrote: > I am trying to understand how these __sys_xxx functions are defined for= =20 > thread libraries. > Following string search tells that all thread libraries are using these= =20 > __sys_xxx functions, > for example, __sys_select(). However, the search also shows that these=20 > functions are not defined anywhere in the entire source tree. >=20 > /usr/src: findstring sys_select "*.[hcS]" > total files=3D 21687 : pattern=3D sys_select rootdir=3D /usr/src > regular mode: Thu Aug 2 13:31:40 PDT 2007 > ./lib/libc_r/uthread/uthread_fork.c > 91: * __sys_select: >=20 > ./lib/libpthread/thread/thr_private.h > 1264:int __sys_select(int, fd_set *, fd_set *, fd_set *, struct=20 > timeval *); >=20 > ./lib/libpthread/thread/thr_select.c > 61: ret =3D __sys_select(numfds, readfds, writefds, exceptfds= ,=20 > timeout); >=20 > ./lib/libthr/thread/thr_private.h > 805:int __sys_select(int, fd_set *, fd_set *, fd_set *, struct=20 > timeval *); >=20 > ./lib/libthr/thread/thr_syscalls.c > 435: ret =3D __sys_select(numfds, readfds, writefds, exceptfds, timeou= t); >=20 >=20 > By searching the usr/lib objects, I found them in libc, but they are not= =20 > in libc source tree. > Can someone shed some light on how these system calls are built into=20 > libc and what is the > different between standard syscall APIs and these __sys_syscall APIs, > e.g., __sys_read() vs. read(), etc. >=20 > Thanks, >=20 > -Jin >=20 >=20 > nm /usr/lib/libc.a | grep __sys_ > 00000008 T __sys_sigreturn > 00000008 T __sys_setlogin > 00000008 T __sys_reboot > ... snapped > 00000008 T __sys_kse_release > 00000008 T __sys_kse_thr_interrupt > 00000008 T __sys_kse_create > 00000008 T __sys_kse_wakeup > ... skipped > 00000008 T __sys_getdtablesize > 00000008 T __sys_select > 00000008 T __sys_ioctl > 00000008 T __sys_close > 00000008 T __sys_write > 00000008 T __sys_read > 00000008 T __sys___syscall The C standard specifies that namespace of identifiers starting with __ or _ is reserved for implementation. On the other hand, C standard allows for the programs to use any symbol not reserved by standard. The thread libraries (and libc) shall internally use the "right" implementation of syscalls, as opposed to some symbol supplied by user binary. To achieve this, for each syscall x, libc defines the normal symbol __sys_x, and two weak symbols _x and x. See, for instance, the file lib/libc/select.S from the obj directory, and lib/libc/i386/SYS.h for corresponding include file. Definition of weak symbols is provided by ELF specification. Simplyfing, weakness of the symbol mean that it is used only unless somebody provides the same normal symbol. Normal symbols from text segment are marked by "T" in nm output, and weak symbols has "t" mark. --zq44+AAfm4giZpo5 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (FreeBSD) iD8DBQFGsu/ZC3+MBN1Mb4gRAvOlAJ9DDfdILBWswe7L9ul+iIwVGWpzJQCdF6JN UWaFyV83spPuFSF9nMJqUqw= =z14i -----END PGP SIGNATURE----- --zq44+AAfm4giZpo5--