From owner-freebsd-hackers Thu Dec 9 0:38: 3 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from canonware.com (canonware.com [207.20.242.18]) by hub.freebsd.org (Postfix) with SMTP id 87859152AD for ; Thu, 9 Dec 1999 00:38:01 -0800 (PST) (envelope-from jasone@canonware.com) Received: (qmail 76105 invoked by uid 1001); 9 Dec 1999 08:35:17 -0000 Date: Thu, 9 Dec 1999 00:35:17 -0800 From: Jason Evans To: freebsd-hackers@freebsd.org Subject: Possible libc changes to support LinuxThreads Message-ID: <19991209003517.E73529@sturm.canonware.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I've got a port of the most recent LinuxThreads (glibc-linuxthreads-2.1.2) running, but ran into a couple of minor problems integrating with our libc. LinuxThreads redefines a number of functions in order to make them either support thread cancellation or work correctly. The following functions need an alternative name, just as, for example, write() is actually _write(): lseek() pause() system() tcdrain() wait() waitpid() recv() send() This would allow implementing cancellation points for these functions. All in all, I won't lose much sleep over this, but if it's easy to do and doesn't violate some rule of symbol naming, it would be nice. The other issue has to do with longjmp() and siglongjmp(), and is of a similar nature, except that _longjmp() already exists as a separate interface. So, at least in the case of longjmp(), it needs to have a different alias, perhaps __longjmp(). Below is a *very* simplistic patch to libc that works, but it may make some people's skin crawl. Feedback is welcome. If there is no correct way to create aliases to function entry points, then we can do without them, but it will mean that the *jmp() functions cannot be used in conjunction with thread cleanup handlers when using LinuxThreads. Jason Index: i386/gen/setjmp.S =================================================================== RCS file: /home/ncvs/src/lib/libc/i386/gen/setjmp.S,v retrieving revision 1.11 diff -u -r1.11 setjmp.S --- setjmp.S 1999/10/10 08:38:33 1.11 +++ setjmp.S 1999/12/09 02:07:45 @@ -54,6 +54,7 @@ #include "DEFS.h" #include "SYS.h" +ENTRY(__setjmp) ENTRY(setjmp) movl 4(%esp),%ecx PIC_PROLOGUE @@ -80,6 +81,7 @@ xorl %eax,%eax ret +ENTRY(__longjmp) ENTRY(longjmp) movl 4(%esp),%edx PIC_PROLOGUE Index: i386/gen/sigsetjmp.S =================================================================== RCS file: /home/ncvs/src/lib/libc/i386/gen/sigsetjmp.S,v retrieving revision 1.13 diff -u -r1.13 sigsetjmp.S --- sigsetjmp.S 1999/09/29 15:18:35 1.13 +++ sigsetjmp.S 1999/12/09 02:07:45 @@ -59,6 +59,7 @@ * use sigreturn() if sigreturn() works. */ +ENTRY(__sigsetjmp) ENTRY(sigsetjmp) movl 8(%esp),%eax movl 4(%esp),%ecx @@ -89,6 +90,7 @@ xorl %eax,%eax ret +ENTRY(__siglongjmp) ENTRY(siglongjmp) movl 4(%esp),%edx cmpl $0,44(%edx) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message