From owner-freebsd-hackers Sun Aug 11 0:37: 9 2002
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
by hub.freebsd.org (Postfix) with ESMTP id 87D1337B400
for ; Sun, 11 Aug 2002 00:37:08 -0700 (PDT)
Received: from cse.cs.huji.ac.il (cse.cs.huji.ac.il [132.65.16.30])
by mx1.FreeBSD.org (Postfix) with ESMTP id 234F243E70
for ; Sun, 11 Aug 2002 00:37:08 -0700 (PDT)
(envelope-from danny@cs.huji.ac.il)
Received: from pampa.cs.huji.ac.il ([132.65.80.32] ident=danny)
by cse.cs.huji.ac.il with esmtp
id 17dnHe-0003hg-00
for freebsd-hackers@freebsd.org; Sun, 11 Aug 2002 10:37:06 +0300
X-Mailer: exmh version 2.5 07/13/2001 with nmh-1.0.4
To: freebsd-hackers@freebsd.org
Subject: /usr/local & cc
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Date: Sun, 11 Aug 2002 10:37:06 +0300
From: Danny Braniss
Message-Id:
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
List-ID:
List-Archive: (Web Archive)
List-Help: (List Instructions)
List-Subscribe:
List-Unsubscribe:
X-Loop: FreeBSD.ORG
is it me going senile, or some setup screwup on my part, but i see that
cpp does not have /usr/local/include in its path nor /usr/local/lib in gcc/ld.
i checked solaris/bsdi/linux and they all search /usr/local/[include,lib]
thanks,
danny
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
From owner-freebsd-hackers Sun Aug 11 1:17:53 2002
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
by hub.freebsd.org (Postfix) with ESMTP id B76BF37B400
for ; Sun, 11 Aug 2002 01:17:50 -0700 (PDT)
Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66])
by mx1.FreeBSD.org (Postfix) with ESMTP id 20F7E43E3B
for ; Sun, 11 Aug 2002 01:17:34 -0700 (PDT)
(envelope-from imp@bsdimp.com)
Received: from localhost (warner@rover2.village.org [10.0.0.1])
by harmony.village.org (8.12.5/8.12.3) with ESMTP id g7B8H59R002287;
Sun, 11 Aug 2002 02:17:06 -0600 (MDT)
(envelope-from imp@bsdimp.com)
Date: Sun, 11 Aug 2002 02:16:45 -0600 (MDT)
Message-Id: <20020811.021645.131703847.imp@bsdimp.com>
To: danny@cs.huji.ac.il
Cc: freebsd-hackers@FreeBSD.ORG
Subject: Re: /usr/local & cc
From: "M. Warner Losh"
In-Reply-To:
References:
X-Mailer: Mew version 2.1 on Emacs 21.2 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
List-ID:
List-Archive: (Web Archive)
List-Help: (List Instructions)
List-Subscribe:
List-Unsubscribe:
X-Loop: FreeBSD.ORG
In message:
Danny Braniss writes:
: is it me going senile, or some setup screwup on my part, but i see
: that cpp does not have /usr/local/include in its path nor
: /usr/local/lib in gcc/ld. i checked solaris/bsdi/linux and they all
: search /usr/local/[include,lib]
Are you sure about solaris and bsdi? This is a linux-ism. Last time
this came up, that was the conclusion on the thread.
Warner
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
From owner-freebsd-hackers Sun Aug 11 2:30:16 2002
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
by hub.freebsd.org (Postfix) with ESMTP id A6AF937B400
for ; Sun, 11 Aug 2002 02:30:08 -0700 (PDT)
Received: from cse.cs.huji.ac.il (cse.cs.huji.ac.il [132.65.16.30])
by mx1.FreeBSD.org (Postfix) with ESMTP id E344E43E4A
for ; Sun, 11 Aug 2002 02:30:07 -0700 (PDT)
(envelope-from danny@cs.huji.ac.il)
Received: from pampa.cs.huji.ac.il ([132.65.80.32] ident=danny)
by cse.cs.huji.ac.il with esmtp
id 17dp30-0000If-00; Sun, 11 Aug 2002 12:30:06 +0300
X-Mailer: exmh version 2.5 07/13/2001 with nmh-1.0.4
To: "M. Warner Losh"
Cc: freebsd-hackers@FreeBSD.ORG
Subject: Re: /usr/local & cc
In-reply-to: Your message of Sun, 11 Aug 2002 02:16:45 -0600 (MDT) .
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Date: Sun, 11 Aug 2002 12:30:06 +0300
From: Danny Braniss
Message-Id:
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
List-ID:
List-Archive: (Web Archive)
List-Help: (List Instructions)
List-Subscribe:
List-Unsubscribe:
X-Loop: FreeBSD.ORG
> In message:
> Danny Braniss writes:
> : is it me going senile, or some setup screwup on my part, but i see
> : that cpp does not have /usr/local/include in its path nor
> : /usr/local/lib in gcc/ld. i checked solaris/bsdi/linux and they all
> : search /usr/local/[include,lib]
>
> Are you sure about solaris and bsdi? This is a linux-ism. Last time
> this came up, that was the conclusion on the thread.
>
> Warner
well, as far as i can check they are using /usr/local,
im including some output:
BSDI BSD/OS 4.1:
facundo> cc -v c.c
Using builtin specs.
gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
/usr/libexec/egcs-1.1.2/i386-unknown-bsdielf4.1/egcs-2.91.66/cpp -lang-c -v
-un
def -D__GNUC__=2 -D__GNUC_MINOR__=91 -Dunix -D__i386__ -Di386 -D__bsdi__
-Dbsdi
-D__ELF__ -D__unix__ -D__i386__ -D__i386__ -D__bsdi__ -D__bsdi__ -D__ELF__
-D__u
nix -D__i386 -D__bsdi -Asystem(unix) -Asystem(bsd) -Acpu(i386) -Amachine(i386)
-
Asystem(unix) -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ c.c
/var/tm
p/cca0vzGa.i
GNU CPP version egcs-2.91.66 19990314 (egcs-1.1.2 release) (i386 ELF BSD/OS)
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/include
/usr/include
End of search list.
/usr/libexec/egcs-1.1.2/i386-unknown-bsdielf4.1/egcs-2.91.66/cc1
/var/tmp/cca0v
zGa.i -quiet -dumpbase c.c -version -o /var/tmp/cclXeQqj.s
GNU C version egcs-2.91.66 19990314 (egcs-1.1.2 release)
(i386-unknown-bsdielf4.
1) compiled by GNU C version egcs-2.91.66 19990314 (egcs-1.1.2 release).
as -V -Qy -o /var/tmp/ccgiQKJi.o /var/tmp/cclXeQqj.s
GNU assembler version 2.9.1 (bsdielf), using BFD version 2.9.1
ld -m elf_i386 -dynamic-linker /shlib/ld-bsdi.so /usr/lib/crt1.o
/usr/lib/crti.
o /usr/lib/crtbegin.o -L/usr/libexec/egcs-1.1.2/i386-unknown-bsdielf4.1/egcs-2.
9
1.66 /var/tmp/ccgiQKJi.o -lgcc -lc -lgcc /usr/lib/crtend.o /usr/lib/crtn.o
-------------------------------------------------------------------------------
-
BSDI BSD/OS 4.0.1:
shuldig> cc -v c.c
gcc version 2.7.2.1
/usr/libexec/gcc2/cpp -lang-c -v -undef -D__GNUC__=2 -D__GNUC_MINOR__=7
-Dunix -D__i386__ -Di386 -D__bsdi__ -Dbsdi -D__ELF__ -D__unix__ -D__i386__
-D__i386__ -D__bsdi__ -D__bsdi__ -D__ELF__ -D__unix -D__i386 -D__bsdi
-Asystem(unix) -Asystem(bsd) -Acpu(i386) -Amachine(i386) c.c /tmp/cc012835.i
GNU CPP version 2.7.2.1 (i386 ELF BSD/OS)
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/include
/usr/include
/usr/include
End of search list.
/usr/libexec/gcc2/cc1 /tmp/cc012835.i -quiet -dumpbase c.c -version -o
/tmp/cc012835.s
GNU C version 2.7.2.1 (i386 ELF BSD/OS) compiled by GNU C version 2.7.2.1.
as -V -Qy -o /tmp/cc0128351.o /tmp/cc012835.s
GNU assembler version 2.8.1 (bsd/os), using BFD version 2.8.1
ld -m elf_i386 -dynamic-linker /shlib/ld-bsdi.so /usr/lib/crt1.o
/usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/local/lib /tmp/cc0128351.o -lgcc
-lc -lgcc /usr/lib/crtend.o /usr/lib/crtn.o
and
cpp -v
Reading specs from /usr/local/lib/gcc-lib/i386-pc-bsdi4.0/2.95/specs
gcc version 2.95 19990728 (release)
/usr/local/lib/gcc-lib/i386-pc-bsdi4.0/2.95/cpp -lang-c -v -Dunix -D__i386__
-Di386 -D__bsdi__ -Dbsdi -D__ELF__ -D__unix__ -D__i386__ -D__i386__ -D__bsdi__
-D__bsdi__ -D__ELF__ -D__unix -D__i386 -D__bsdi -Asystem(unix) -Asystem(bsd)
-Acpu(i386) -Amachine(i386) -Acpu(i386) -Amachine(i386) -Di386 -D__i386
-D__i386__ -
GNU CPP version 2.95 19990728 (release) (i386 ELF BSD/OS)
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/local/lib/gcc-lib/i386-pc-bsdi4.0/2.95/../../../../i386-pc-bsdi4.0/includ
e
/usr/local/lib/gcc-lib/i386-pc-bsdi4.0/2.95/include
/usr/include
End of search list.
The following default directories have been omitted from the search path:
/usr/local/lib/gcc-lib/i386-pc-bsdi4.0/2.95/../../../../include/g++-3
End of omitted list.
-------------------------------------------------------------------------------
SunOS sol4 5.8 Generic sun4u sparc SUNW,UltraAX-MP:
Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/specs
gcc version 2.95.2 19991024 (release)
/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/cpp -lang-c -v -Dsparc
-Dsun -Dunix -D__svr4__ -D__SVR4 -D__sparc__ -D__sun__ -D__unix__ -D__svr4__
-D__SVR4 -D__sparc -D__sun -D__unix -Asystem(unix) -Asystem(svr4)
-D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc) -
GNU CPP version 2.95.2 19991024 (release) (sparc)
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/../../../../sparc-sun-solar
is2.6/include
/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/include
/usr/include
End of search list.
The following default directories have been omitted from the search path:
/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/../../../../include/g++-3
End of omitted list.
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
From owner-freebsd-hackers Sun Aug 11 9: 2:20 2002
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
by hub.freebsd.org (Postfix) with ESMTP id 6F31D37B400
for ; Sun, 11 Aug 2002 09:02:15 -0700 (PDT)
Received: from boreas.isi.edu (boreas.isi.edu [128.9.160.161])
by mx1.FreeBSD.org (Postfix) with ESMTP id D0E7243E72
for ; Sun, 11 Aug 2002 09:02:14 -0700 (PDT)
(envelope-from larse@ISI.EDU)
Received: from isi.edu (c1-vpn1.isi.edu [128.9.176.27])
by boreas.isi.edu (8.11.6/8.11.2) with ESMTP id g7BG28r06683;
Sun, 11 Aug 2002 09:02:08 -0700 (PDT)
Message-ID: <3D568A6B.4000100@isi.edu>
Date: Sun, 11 Aug 2002 09:01:47 -0700
From: Lars Eggert
Organization: USC Information Sciences Institute
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.1b) Gecko/20020721
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: Doug White
Cc: hackers@freebsd.org
Subject: Re: SMP P4 Xeons out there?
References: <20020810160643.I38678-100000@carver.gumbysoft.com>
Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg=sha1; boundary="------------ms000001040201090903070404"
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
List-ID:
List-Archive: (Web Archive)
List-Help: (List Instructions)
List-Subscribe:
List-Unsubscribe:
X-Loop: FreeBSD.ORG
This is a cryptographically signed message in MIME format.
--------------ms000001040201090903070404
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Doug White wrote:
> Hey folks,
>
> Anyone other there with multiprocessor P4 Xeon systems with Hyperthreading
> enabled that are seeing 4 CPUs show up on boot?
Not yet, but we're expecting some Dell Precision 530s later this week -
I'll let you know.
Lars
--
Lars Eggert USC Information Sciences Institute
--------------ms000001040201090903070404
Content-Type: application/x-pkcs7-signature; name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7s"
Content-Description: S/MIME Cryptographic Signature
MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIIrjCC
ArUwggIeoAMCAQICAwWBRzANBgkqhkiG9w0BAQIFADCBkjELMAkGA1UEBhMCWkExFTATBgNV
BAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMQ8wDQYDVQQKEwZUaGF3dGUx
HTAbBgNVBAsTFENlcnRpZmljYXRlIFNlcnZpY2VzMSgwJgYDVQQDEx9QZXJzb25hbCBGcmVl
bWFpbCBSU0EgMjAwMC44LjMwMB4XDTAxMDgyNDE2NDAwMFoXDTAyMDgyNDE2NDAwMFowVDEP
MA0GA1UEBBMGRWdnZXJ0MQ0wCwYDVQQqEwRMYXJzMRQwEgYDVQQDEwtMYXJzIEVnZ2VydDEc
MBoGCSqGSIb3DQEJARYNbGFyc2VAaXNpLmVkdTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC
gYEA0AvLBsD78nxcUHeHkaMgl3b4qYPnfgbf8Lh+HQP8RgGMRG/Yb+vTpkGezlwt9pkJxiD1
1uZDy4CNNJUu3gKxKSb+zRV70O+lkwwftuHoLHoH4xwo3LcQ2LGDpd+I95tUN4dfJ3TmeEcU
SF50dC/SuUI4w8AlhXQ8IxrhgdayTpECAwEAAaNWMFQwKgYFK2UBBAEEITAfAgEAMBowGAIB
BAQTTDJ1TXlmZkJOVWJOSkpjZFoyczAYBgNVHREEETAPgQ1sYXJzZUBpc2kuZWR1MAwGA1Ud
EwEB/wQCMAAwDQYJKoZIhvcNAQECBQADgYEAheZhn0pQA8zI7U2K1ZIAl11j0a1DKxnp3GtT
vOUrGRB3WvYxidvdZ1kizhEsWeXU81TkNDH0DaRqtOEeu6Q2OhB+jeKEqY7IDAJE4/fI0e+d
6PnG1hd+vEvYmsKHkmzBhPc94XUOKNWO+qVNP2NGyNI3QIDy5wX4fdcOo1S34r4wggK1MIIC
HqADAgECAgMFgUcwDQYJKoZIhvcNAQECBQAwgZIxCzAJBgNVBAYTAlpBMRUwEwYDVQQIEwxX
ZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEPMA0GA1UEChMGVGhhd3RlMR0wGwYD
VQQLExRDZXJ0aWZpY2F0ZSBTZXJ2aWNlczEoMCYGA1UEAxMfUGVyc29uYWwgRnJlZW1haWwg
UlNBIDIwMDAuOC4zMDAeFw0wMTA4MjQxNjQwMDBaFw0wMjA4MjQxNjQwMDBaMFQxDzANBgNV
BAQTBkVnZ2VydDENMAsGA1UEKhMETGFyczEUMBIGA1UEAxMLTGFycyBFZ2dlcnQxHDAaBgkq
hkiG9w0BCQEWDWxhcnNlQGlzaS5lZHUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANAL
ywbA+/J8XFB3h5GjIJd2+KmD534G3/C4fh0D/EYBjERv2G/r06ZBns5cLfaZCcYg9dbmQ8uA
jTSVLt4CsSkm/s0Ve9DvpZMMH7bh6Cx6B+McKNy3ENixg6XfiPebVDeHXyd05nhHFEhedHQv
0rlCOMPAJYV0PCMa4YHWsk6RAgMBAAGjVjBUMCoGBStlAQQBBCEwHwIBADAaMBgCAQQEE0wy
dU15ZmZCTlViTkpKY2RaMnMwGAYDVR0RBBEwD4ENbGFyc2VAaXNpLmVkdTAMBgNVHRMBAf8E
AjAAMA0GCSqGSIb3DQEBAgUAA4GBAIXmYZ9KUAPMyO1NitWSAJddY9GtQysZ6dxrU7zlKxkQ
d1r2MYnb3WdZIs4RLFnl1PNU5DQx9A2karThHrukNjoQfo3ihKmOyAwCROP3yNHvnej5xtYX
frxL2JrCh5JswYT3PeF1DijVjvqlTT9jRsjSN0CA8ucF+H3XDqNUt+K+MIIDODCCAqGgAwIB
AgIQZkVyt8x09c9jdkWE0C6RATANBgkqhkiG9w0BAQQFADCB0TELMAkGA1UEBhMCWkExFTAT
BgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMRowGAYDVQQKExFUaGF3
dGUgQ29uc3VsdGluZzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lv
bjEkMCIGA1UEAxMbVGhhd3RlIFBlcnNvbmFsIEZyZWVtYWlsIENBMSswKQYJKoZIhvcNAQkB
FhxwZXJzb25hbC1mcmVlbWFpbEB0aGF3dGUuY29tMB4XDTAwMDgzMDAwMDAwMFoXDTA0MDgy
NzIzNTk1OVowgZIxCzAJBgNVBAYTAlpBMRUwEwYDVQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNV
BAcTCUNhcGUgVG93bjEPMA0GA1UEChMGVGhhd3RlMR0wGwYDVQQLExRDZXJ0aWZpY2F0ZSBT
ZXJ2aWNlczEoMCYGA1UEAxMfUGVyc29uYWwgRnJlZW1haWwgUlNBIDIwMDAuOC4zMDCBnzAN
BgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA3jMypmPHCSVFPtJueCdngcXaiBmClw7jRCmKYzUq
bXA8+tyu9+50bzC8M5B/+TRxoKNtmPHDT6Jl2w36S/HW3WGl+YXNVZo1Gp2Sdagnrthy+boC
9tewkd4c6avgGAOofENCUFGHgzzwObSbVIoTh/+zm51JZgAtCYnslGvpoWkCAwEAAaNOMEww
KQYDVR0RBCIwIKQeMBwxGjAYBgNVBAMTEVByaXZhdGVMYWJlbDEtMjk3MBIGA1UdEwEB/wQI
MAYBAf8CAQAwCwYDVR0PBAQDAgEGMA0GCSqGSIb3DQEBBAUAA4GBADGxS0dd+QFx5fVTbF15
1j2YwCYTYoEipxL4IpXoG0m3J3sEObr85vIk65H6vewNKjj3UFWobPcNrUwbvAP0teuiR59s
ogxYjTFCCRFssBpp0SsSskBdavl50OouJd2K5PzbDR+dAvNa28o89kTqJmmHf0iezqWf54TY
yWJirQXGMYICpjCCAqICAQEwgZowgZIxCzAJBgNVBAYTAlpBMRUwEwYDVQQIEwxXZXN0ZXJu
IENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEPMA0GA1UEChMGVGhhd3RlMR0wGwYDVQQLExRD
ZXJ0aWZpY2F0ZSBTZXJ2aWNlczEoMCYGA1UEAxMfUGVyc29uYWwgRnJlZW1haWwgUlNBIDIw
MDAuOC4zMAIDBYFHMAkGBSsOAwIaBQCgggFhMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEw
HAYJKoZIhvcNAQkFMQ8XDTAyMDgxMTE2MDE0N1owIwYJKoZIhvcNAQkEMRYEFJussJ4BTNYR
uSCGXz4ZPy2nVTGNMFIGCSqGSIb3DQEJDzFFMEMwCgYIKoZIhvcNAwcwDgYIKoZIhvcNAwIC
AgCAMA0GCCqGSIb3DQMCAgFAMAcGBSsOAwIHMA0GCCqGSIb3DQMCAgEoMIGtBgsqhkiG9w0B
CRACCzGBnaCBmjCBkjELMAkGA1UEBhMCWkExFTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAG
A1UEBxMJQ2FwZSBUb3duMQ8wDQYDVQQKEwZUaGF3dGUxHTAbBgNVBAsTFENlcnRpZmljYXRl
IFNlcnZpY2VzMSgwJgYDVQQDEx9QZXJzb25hbCBGcmVlbWFpbCBSU0EgMjAwMC44LjMwAgMF
gUcwDQYJKoZIhvcNAQEBBQAEgYBCPB5pG+VIHJWo1BoxKKj3cNOxx9Xn8tc8lyhE/gbRZqXo
HIpJ/n2xbqXKuW5gMvbY8DYx0p7QGpiFCTx58mKaVvD4Ho7/g7KQF9IqnJElW5vdMXXWQtWQ
ujDoPNIdzstZFrenEIsoip7qXKRoT3+T89waWdt2rPj+a+1IIk88JAAAAAAAAA==
--------------ms000001040201090903070404--
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
From owner-freebsd-hackers Sun Aug 11 10:36:16 2002
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
by hub.freebsd.org (Postfix) with ESMTP
id DC26837B400; Sun, 11 Aug 2002 10:36:13 -0700 (PDT)
Received: from mail.cruzio.com (dsl3-63-249-66-210.cruzio.com [63.249.66.210])
by mx1.FreeBSD.org (Postfix) with ESMTP
id 79CE843E3B; Sun, 11 Aug 2002 10:36:13 -0700 (PDT)
(envelope-from brucem@mail.cruzio.com)
Received: (from brucem@localhost)
by mail.cruzio.com (8.11.3/8.11.3) id g7BHrbn00809;
Sun, 11 Aug 2002 10:53:37 -0700 (PDT)
(envelope-from brucem)
Date: Sun, 11 Aug 2002 10:53:37 -0700 (PDT)
From: "Bruce R. Montague"
Message-Id: <200208111753.g7BHrbn00809@mail.cruzio.com>
To: freebsd-hackers@freebsd.org
Subject: PCM Native Audio Driver for NatSemi Geode GX1
Cc: cg@freebsd.org
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
List-ID:
List-Archive: (Web Archive)
List-Help: (List Instructions)
List-Subscribe:
List-Unsubscribe:
X-Loop: FreeBSD.ORG
I have written a FreeBSD "new PCM" audio driver
for the Native Audio PCI function internal to the
National Semiconductor Geode GX1/Cx5530 CPU and
chipset, and integrated equivalents. This driver
uses the Cx5530 southbridge's internal PCI audio
hardware directly. It does not use the Soundblaster
emulator that at one time was in the Cyrix
"hypervisor".
I'm under the impression that this driver should
work on any NatSemi GX1 CPU, but don't know that
for sure.
Also included in this kit are 4 small "new PCM"
audio test programs. These test programs should
work with any FreeBSD "new PCM" audio driver.
The kit can be obtained at:
http://alumni.cse.ucsc.edu/~brucem/gx_audio
This driver is heavily commented and hopefully is
useful to anyone studying the FreeBSD PCM audio
system, or any similar PCI drivers using interfaces
built on FreeBSD kernel objects.
All features exercised by the test programs are
working. Testing has been done under FreeBSD 4.6
Stable. Suspend/Resume support is present but
not yet tested.
Please let me know if you find bugs or have any
advice at all about anything pertaining to this...
- bruce
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
From owner-freebsd-hackers Sun Aug 11 11:15:31 2002
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
by hub.freebsd.org (Postfix) with ESMTP id 6707F37B400
for ; Sun, 11 Aug 2002 11:15:29 -0700 (PDT)
Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66])
by mx1.FreeBSD.org (Postfix) with ESMTP id 8BC5443E42
for ; Sun, 11 Aug 2002 11:15:28 -0700 (PDT)
(envelope-from imp@bsdimp.com)
Received: from localhost (warner@rover2.village.org [10.0.0.1])
by harmony.village.org (8.12.5/8.12.3) with ESMTP id g7BIFJ9R004555;
Sun, 11 Aug 2002 12:15:19 -0600 (MDT)
(envelope-from imp@bsdimp.com)
Date: Sun, 11 Aug 2002 12:14:51 -0600 (MDT)
Message-Id: <20020811.121451.10751663.imp@bsdimp.com>
To: danny@cs.huji.ac.il
Cc: freebsd-hackers@FreeBSD.ORG
Subject: Re: /usr/local & cc
From: "M. Warner Losh"
In-Reply-To:
References:
X-Mailer: Mew version 2.1 on Emacs 21.2 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
List-ID:
List-Archive: (Web Archive)
List-Help: (List Instructions)
List-Subscribe:
List-Unsubscribe:
X-Loop: FreeBSD.ORG
Interesting... The /usr/local behavior is new then on Solaris (or was
configured in), because I know that it didn't used to be that way.
I'm pretty sure that the solaris native compilers don't do that. The
bsdi compiler also used to not have /usr/local included
automatically. The fact that it is included BEFORE /usr/include seems
wrong to me and that it would break things if somebody ever installed
a file with the same name system header in /usr/local....
Warner
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
From owner-freebsd-hackers Sun Aug 11 12: 8:47 2002
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
by hub.freebsd.org (Postfix) with ESMTP id 825DE37B400
for ; Sun, 11 Aug 2002 12:08:45 -0700 (PDT)
Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101])
by mx1.FreeBSD.org (Postfix) with ESMTP id 0176343E6E
for ; Sun, 11 Aug 2002 12:08:45 -0700 (PDT)
(envelope-from dan@dan.emsphone.com)
Received: (from dan@localhost)
by dan.emsphone.com (8.12.5/8.12.5) id g7BJ8EeR005333;
Sun, 11 Aug 2002 14:08:14 -0500 (CDT)
(envelope-from dan)
Date: Sun, 11 Aug 2002 14:08:14 -0500
From: Dan Nelson
To: Danny Braniss
Cc: "M. Warner Losh" , freebsd-hackers@FreeBSD.ORG
Subject: Re: /usr/local & cc
Message-ID: <20020811190814.GG7599@dan.emsphone.com>
References:
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To:
X-OS: FreeBSD 5.0-CURRENT
X-message-flag: Outlook Error
User-Agent: Mutt/1.5.1i
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
List-ID:
List-Archive: (Web Archive)
List-Help: (List Instructions)
List-Subscribe:
List-Unsubscribe:
X-Loop: FreeBSD.ORG
In the last episode (Aug 11), Danny Braniss said:
> > In message:
> > Danny Braniss writes:
> > : is it me going senile, or some setup screwup on my part, but i see
> > : that cpp does not have /usr/local/include in its path nor
> > : /usr/local/lib in gcc/ld. i checked solaris/bsdi/linux and they all
> > : search /usr/local/[include,lib]
> >
> > Are you sure about solaris and bsdi? This is a linux-ism. Last time
> > this came up, that was the conclusion on the thread.
> >
> > Warner
>
> well, as far as i can check they are using /usr/local,
> im including some output:
>
> BSDI BSD/OS 4.0.1:
> Reading specs from /usr/local/lib/gcc-lib/i386-pc-bsdi4.0/2.95/specs
> gcc version 2.95 19990728 (release)
> #include <...> search starts here:
> /usr/local/include
> /usr/local/lib/gcc-lib/i386-pc-bsdi4.0/2.95/../../../../i386-pc-bsdi4.0/include
>
> -------------------------------------------------------------------------------
> SunOS sol4 5.8 Generic sun4u sparc SUNW,UltraAX-MP:
> Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/specs
> gcc version 2.95.2 19991024 (release)
> #include <...> search starts here:
> /usr/local/include
> /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/../../../../sparc-sun-solaris2.6/include
These two you compiled yourself, so you can't use them them in your
examples. If you were to try with the native Solaris cc, it would not
include /usr/local. Same for the bundled cc on Tru64. It's probably a
bug that BSD/OS didn't remove /usr/include when they imported gcc into
the base system.
--
Dan Nelson
dnelson@allantgroup.com
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
From owner-freebsd-hackers Sun Aug 11 12:47:59 2002
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
by hub.freebsd.org (Postfix) with ESMTP id 1706D37B400
for ; Sun, 11 Aug 2002 12:47:57 -0700 (PDT)
Received: from insomnia.spc.org (insomnia.spc.org [195.224.94.183])
by mx1.FreeBSD.org (Postfix) with SMTP id D9BCD43E72
for ; Sun, 11 Aug 2002 12:47:56 -0700 (PDT)
(envelope-from bms@insomnia.spc.org)
Received: (qmail 28149 invoked by uid 1031); 8 Aug 2002 15:48:14 -0000
Date: Thu, 8 Aug 2002 15:48:14 +0000
From: Bruce M Simpson
To: freebsd-hackers@freebsd.org
Subject: Building ports into packages, outside of /usr/ports
Message-ID: <20020808154814.GD18301@spc.org>
Mail-Followup-To: Bruce M Simpson ,
freebsd-hackers@freebsd.org
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.3.28i
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
List-ID:
List-Archive: (Web Archive)
List-Help: (List Instructions)
List-Subscribe:
List-Unsubscribe:
X-Loop: FreeBSD.ORG
Hi,
Has anybody thought about hacking the above to support building packages
outside of the ports tree, and without installing them? Strikes me as
something that could be neatly solved with judicious use of chroot(1).
This is something which was raised at the FreeBSD UK Users Group meeting
last night, so it's bugging me.
BMS
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
From owner-freebsd-hackers Sun Aug 11 13:22:37 2002
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
by hub.freebsd.org (Postfix) with ESMTP id 9ED2337B400
for ; Sun, 11 Aug 2002 13:22:35 -0700 (PDT)
Received: from gidgate.gid.co.uk (gid.co.uk [194.32.164.225])
by mx1.FreeBSD.org (Postfix) with ESMTP id 6BDFE43E65
for ; Sun, 11 Aug 2002 13:22:34 -0700 (PDT)
(envelope-from rb@gid.co.uk)
Received: (from rb@localhost)
by gidgate.gid.co.uk (8.11.6/8.11.6) id g7BKMEF97258;
Sun, 11 Aug 2002 21:22:14 +0100 (BST)
(envelope-from rb)
Message-Id: <4.3.2.7.2.20020811210636.02068bf0@gid.co.uk>
X-Sender: rbmail@gid.co.uk
X-Mailer: QUALCOMM Windows Eudora Version 4.3.2
Date: Sun, 11 Aug 2002 21:22:14 +0100
To: "M. Warner Losh"
From: Bob Bishop
Subject: wi hostap mode WEP oddity
Cc: hackers@freebsd.org
In-Reply-To: <20020724.183650.38682224.imp@bsdimp.com>
References: <4.3.2.7.2.20020724222414.01f9f8f0@gid.co.uk>
<4.3.2.7.2.20020723230525.02056a48@gid.co.uk>
<20020724.142626.132443392.imp@bsdimp.com>
<4.3.2.7.2.20020724222414.01f9f8f0@gid.co.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"; format=flowed
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
List-ID:
List-Archive: (Web Archive)
List-Help: (List Instructions)
List-Subscribe:
List-Unsubscribe:
X-Loop: FreeBSD.ORG
Hi,
I'm using a 3Com AirConnect (3CRWE777A) in hostap mode on a -STABLEish
kernel, and I've observed an oddity which might explain some other reports.
I'm setting 'wepmode on', but ifconfig subsequently reports 'wepmode MIXED'
although wicontrol reports it as 'On'. I can't connect with a non-WEP
client, so I believe the card really is in WEP-only mode and ifconfig is
reporting it wrongly.
All seems to work except that client connexions drop after an indeterminate
period (perhaps related to signal quality) and won't reconnect unless I
ifconfig down then up the hostap interface. I'm going to see whether
upgrading to the latest firmware effects any improvement. [Test client is a
3CRSHPW on Win2k running latest firmware.]
--
Bob Bishop +44 (0)118 977 4017
rb@gid.co.uk fax +44 (0)118 989 4254
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
From owner-freebsd-hackers Sun Aug 11 13:55:37 2002
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
by hub.freebsd.org (Postfix) with ESMTP id 02E0237B412
for ; Sun, 11 Aug 2002 13:55:34 -0700 (PDT)
Received: from carver.gumbysoft.com (carver.gumbysoft.com [66.220.23.50])
by mx1.FreeBSD.org (Postfix) with ESMTP id 3EAD343E5E
for ; Sun, 11 Aug 2002 13:55:34 -0700 (PDT)
(envelope-from dwhite@gumbysoft.com)
Received: by carver.gumbysoft.com (Postfix, from userid 1000)
id 6FBA672FC6; Sun, 11 Aug 2002 13:52:37 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
by carver.gumbysoft.com (Postfix) with ESMTP
id 6E8F272FC5; Sun, 11 Aug 2002 13:52:37 -0700 (PDT)
Date: Sun, 11 Aug 2002 13:52:37 -0700 (PDT)
From: Doug White
To: Sean Hamilton
Cc: hackers@freebsd.org
Subject: Re: arplookup: host is not on local network
In-Reply-To: <000f01c240c8$e7247c00$f019e8d8@slugabed.org>
Message-ID: <20020811134721.A41711-100000@carver.gumbysoft.com>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
List-ID:
List-Archive: (Web Archive)
List-Help: (List Instructions)
List-Subscribe:
List-Unsubscribe:
X-Loop: FreeBSD.ORG
On Sat, 10 Aug 2002, Sean Hamilton wrote:
> Greetings,
>
> I have a FreeBSD box being colocated. Every few seconds, I get the following
> message:
>
> /kernel: arplookup 216.187.x.x failed: host is not on local network
>
> As I understand, this 216.187.x.x machine is acting as a "proxy arp". I
> think it's supposed to be completely transparent, but evidently my box is
> noticing.
Got to love broken linux boxes.
Linux has this fun habit of announcing ARPs for all interfaces on all
other interfaces. It drives BSD boxes batty since its abnormal, but it is
allowed behavior. That or someone has a seriously broken netmask.
You should check that your network configuration is correct first, then
use tcpdump to locate the offender and report them to your provider. They
can ask the owner of said machine politely to install the patches or set
/proc flags to disable that behavior. You can, of course, comment out the
printfs, or hide it behind log_arp_wrong_iface which is controlled by the
sysctl net.link.ether.inet.log_arp_wrong_iface. The file you want to
modify in that case is src/sys/netinet/if_ether.c.
--
Doug White | FreeBSD: The Power to Serve
dwhite@gumbysoft.com | www.FreeBSD.org
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
From owner-freebsd-hackers Sun Aug 11 14: 5:30 2002
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
by hub.freebsd.org (Postfix) with ESMTP id 6C09137B400
for ; Sun, 11 Aug 2002 14:05:28 -0700 (PDT)
Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66])
by mx1.FreeBSD.org (Postfix) with ESMTP id 9AE3E43E65
for ; Sun, 11 Aug 2002 14:05:27 -0700 (PDT)
(envelope-from imp@bsdimp.com)
Received: from localhost (warner@rover2.village.org [10.0.0.1])
by harmony.village.org (8.12.5/8.12.3) with ESMTP id g7BL5P9R005211;
Sun, 11 Aug 2002 15:05:26 -0600 (MDT)
(envelope-from imp@bsdimp.com)
Date: Sun, 11 Aug 2002 13:52:26 -0600 (MDT)
Message-Id: <20020811.135226.44234970.imp@bsdimp.com>
To: rb@gid.co.uk
Cc: hackers@freebsd.org
Subject: Re: wi hostap mode WEP oddity
From: "M. Warner Losh"
In-Reply-To: <4.3.2.7.2.20020811210636.02068bf0@gid.co.uk>
References: <4.3.2.7.2.20020724222414.01f9f8f0@gid.co.uk>
<20020724.183650.38682224.imp@bsdimp.com>
<4.3.2.7.2.20020811210636.02068bf0@gid.co.uk>
X-Mailer: Mew version 2.1 on Emacs 21.2 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
List-ID:
List-Archive: (Web Archive)
List-Help: (List Instructions)
List-Subscribe:
List-Unsubscribe:
X-Loop: FreeBSD.ORG
In message: <4.3.2.7.2.20020811210636.02068bf0@gid.co.uk>
Bob Bishop writes:
: I'm using a 3Com AirConnect (3CRWE777A) in hostap mode on a -STABLEish
: kernel, and I've observed an oddity which might explain some other reports.
: I'm setting 'wepmode on', but ifconfig subsequently reports 'wepmode MIXED'
: although wicontrol reports it as 'On'. I can't connect with a non-WEP
: client, so I believe the card really is in WEP-only mode and ifconfig is
: reporting it wrongly.
You maybe be correct about that. I've not played with wep much, but
have noticed when I was playing with ad-hoc demo mode that I could get
a lucent card to connect w/o wep, but maybe I'm confused and it is a
simple bug in wi that it reports mixed.
: All seems to work except that client connexions drop after an indeterminate
: period (perhaps related to signal quality) and won't reconnect unless I
: ifconfig down then up the hostap interface. I'm going to see whether
: upgrading to the latest firmware effects any improvement. [Test client is a
: 3CRSHPW on Win2k running latest firmware.]
That's very odd.
Warner
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
From owner-freebsd-hackers Sun Aug 11 15:59:23 2002
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
by hub.freebsd.org (Postfix) with ESMTP id CDA2B37B401
for ; Sun, 11 Aug 2002 15:59:20 -0700 (PDT)
Received: from priv-edtnes15-hme0.telusplanet.net (defout.telus.net [199.185.220.240])
by mx1.FreeBSD.org (Postfix) with ESMTP id 69FB243E3B
for ; Sun, 11 Aug 2002 15:59:19 -0700 (PDT)
(envelope-from sh@planetquake.com)
Received: from dbs ([216.232.25.240]) by priv-edtnes15-hme0.telusplanet.net
(InterMail vM.5.01.04.01 201-253-122-122-101-20011014) with SMTP
id <20020811225918.MJDF3365.priv-edtnes15-hme0.telusplanet.net@dbs>
for ; Sun, 11 Aug 2002 16:59:18 -0600
Message-ID: <001f01c2418a$bc174890$f019e8d8@slugabed.org>
From: "Sean Hamilton"
To:
References: <20020811134721.A41711-100000@carver.gumbysoft.com>
Subject: Re: arplookup: host is not on local network
Date: Sun, 11 Aug 2002 15:59:23 -0700
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
List-ID:
List-Archive: (Web Archive)
List-Help: (List Instructions)
List-Subscribe:
List-Unsubscribe:
X-Loop: FreeBSD.ORG
From: "Doug White"
> You should check that your network configuration is correct first, then
> use tcpdump to locate the offender and report them to your provider. They
> can ask the owner of said machine politely to install the patches or set
> /proc flags to disable that behavior. You can, of course, comment out the
Which /proc flags? Indeed it is a linux box, the firewall, which I have
access to. My coworker, the administrator of this box, has simply turned a
blind eye to this, on the grounds that it's not actually causing problems,
just noise... but if it's a simple tweak, I'm sure he could be bribed with
caffeine or somesuch.
> printfs, or hide it behind log_arp_wrong_iface which is controlled by the
> sysctl net.link.ether.inet.log_arp_wrong_iface. The file you want to
> modify in that case is src/sys/netinet/if_ether.c.
Thanks, looks like that sysctl is what I've been looking for. Though you
seem to indicate I would have to modify the kernel to achieve this, it seems
to be that way already -- perhaps a recent thing? Regardless, I find it
somewhat surprising my googling didn't point me in this direction.
sh
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
From owner-freebsd-hackers Sun Aug 11 16:33:46 2002
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
by hub.freebsd.org (Postfix) with ESMTP
id F110C37B400; Sun, 11 Aug 2002 16:33:37 -0700 (PDT)
Received: from genius.tao.org.uk (genius.tao.org.uk [212.135.162.51])
by mx1.FreeBSD.org (Postfix) with ESMTP
id 1280643E81; Sun, 11 Aug 2002 16:33:36 -0700 (PDT)
(envelope-from joe@genius.tao.org.uk)
Received: by genius.tao.org.uk (Postfix, from userid 100)
id C72B247D; Mon, 12 Aug 2002 00:33:28 +0100 (BST)
Date: Mon, 12 Aug 2002 00:33:28 +0100
From: Josef Karthauser
To: Takanori Watanabe
Cc: hackers@freebsd.org, cvs-committers@FreeBSD.org,
cvs-all@FreeBSD.org
Subject: Re: cvs commit: src/sys/dev/usb usbdevs
Message-ID: <20020811233328.GA33280@genius.tao.org.uk>
References: <200207251415.g6PEFoB3069395@freefall.freebsd.org> <200207251423.XAA12554@axe-inc.co.jp>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
protocol="application/pgp-signature"; boundary="fdj2RfSjLxBAspz7"
Content-Disposition: inline
In-Reply-To: <200207251423.XAA12554@axe-inc.co.jp>
User-Agent: Mutt/1.5.1i
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
List-ID:
List-Archive: (Web Archive)
List-Help: (List Instructions)
List-Subscribe:
List-Unsubscribe:
X-Loop: FreeBSD.ORG
--fdj2RfSjLxBAspz7
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Thu, Jul 25, 2002 at 11:23:55PM +0900, Takanori Watanabe wrote:
> > Log:
> > MFNetBSD: FTDI USB-serial converter chips description.
>=20
> I ported a FTDI USB serial converter driver from NetBSD.
> http://people.freebsd.org/uftdi.tar.gz
I've committed this. Thanks :).
Joe
--=20
"As far as the laws of mathematics refer to reality, they are not certain;
and as far as they are certain, they do not refer to reality." - Albert
Einstein, 1921
--fdj2RfSjLxBAspz7
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)
iEYEARECAAYFAj1W9EgACgkQXVIcjOaxUBYX4wCfad2Oa+tIJhsMsuy0cERADIaG
7nIAnjp2oAbAzvmV8PyOsH3aCnDNanxm
=ozBL
-----END PGP SIGNATURE-----
--fdj2RfSjLxBAspz7--
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
From owner-freebsd-hackers Sun Aug 11 17:55:19 2002
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
by hub.freebsd.org (Postfix) with ESMTP id DC2A537B400
for ; Sun, 11 Aug 2002 17:55:17 -0700 (PDT)
Received: from localhost.com (ppp-62-11-40-254.dialup.tiscali.it [62.11.40.254])
by mx1.FreeBSD.org (Postfix) with SMTP id 3108A43E65
for ; Sun, 11 Aug 2002 17:55:16 -0700 (PDT)
(envelope-from eee.uio@libero.it)
From: "pretty"
To: freebsd-hackers@FreeBSD.org
Date: Mon, 12 Aug 2002 02.53.57 +0200
Subject: secret
X-Mailer: MailXSender 1.06
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Message-Id: <20020812005516.3108A43E65@mx1.FreeBSD.org>
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
List-ID:
List-Archive: (Web Archive)
List-Help: (List Instructions)
List-Subscribe:
List-Unsubscribe:
X-Loop: FreeBSD.ORG
http=3A=2F=2Fragazzepericolose=2Eda=2Eru
veramente=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E
http=3A=2F=2Fragazzepericolose=2Eda=2Eru
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
From owner-freebsd-hackers Mon Aug 12 1:32:44 2002
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
by hub.freebsd.org (Postfix) with ESMTP id 86C1637B400
for ; Mon, 12 Aug 2002 01:32:40 -0700 (PDT)
Received: from hotmail.com (oe97.pav0.hotmail.com [64.4.33.239])
by mx1.FreeBSD.org (Postfix) with ESMTP id 233D743E42
for ; Mon, 12 Aug 2002 01:32:40 -0700 (PDT)
(envelope-from oykai@msn.com)
Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC;
Mon, 12 Aug 2002 01:32:40 -0700
X-Originating-IP: [210.12.61.105]
From: "ouyang kai"
To:
Date: Mon, 12 Aug 2002 16:32:27 +0800
MIME-Version: 1.0
X-Mailer: MSN Explorer 6.10.0016.1624
Content-Type: multipart/alternative; boundary="----=_NextPart_001_0000_01C2421D.D87200F0"
Message-ID:
X-OriginalArrivalTime: 12 Aug 2002 08:32:40.0039 (UTC) FILETIME=[D1EC3770:01C241DA]
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
List-ID:
List-Archive: (Web Archive)
List-Help: (List Instructions)
List-Subscribe:
List-Unsubscribe:
X-Loop: FreeBSD.ORG
------=_NextPart_001_0000_01C2421D.D87200F0
Content-Type: text/plain; charset="gb2312"
Content-Transfer-Encoding: quoted-printable
Hi Everybody,
I am a jackaroo to FreeBSD kernel. I have a question about how the kern=
el add all devices. =20
For example, in NetBSD, I can find the code in /sys/kern/init_main.c:
/* Attach pseudo-devices. */
for (pdev =3D pdevinit; pdev->pdev_attach !=3D NULL; pdev++)
(*pdev->pdev_attach)(pdev->pdev_count);
I know the NetBSD kernel add devices(such as storage device and network d=
evice) by them.
But in FreeBSD, I can not locate the place.
which part code should I read?
Thank you.
=20
Best Regards
Ouyang KaiGet more from the Web. FREE MSN Explorer download : http://e=
xplorer.msn.com
------=_NextPart_001_0000_01C2421D.D87200F0
Content-Type: text/html; charset="gb2312"
Content-Transfer-Encoding: quoted-printable
Hi Everybody,
I am a jackaroo to FreeBSD kernel. I have a question about how the kerne=
l add all devices.
For example=
, in NetBSD, I can find the code in /sys/kern/init_main.c:<=
/SPAN>
/* Attach pseudo-devices. */<=
/FONT>
for (pdev =3D pdevinit; pdev->pdev_attach !=3D NULL; pdev++)
<=
/SPAN>(*pdev->pdev_attach)(pdev->pdev_count);<=
/P>
I know the NetBSD kernel add dev=
ices(such as storage device and network device) by them.
<=
FONT face=3D"Times New Roman" size=3D3>But in FreeBSD, I can not locate t=
he place.
which pa=
rt code should I read?
Thank you.
Ouyang Kai
Get more fr=
om the Web. FREE MSN Explorer download : http://explorer.msn.com
------=_NextPart_001_0000_01C2421D.D87200F0--
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
From owner-freebsd-hackers Mon Aug 12 1:35:35 2002
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
by hub.freebsd.org (Postfix) with ESMTP id 9EFA137B400
for ; Mon, 12 Aug 2002 01:35:32 -0700 (PDT)
Received: from hotmail.com (oe60.pav0.hotmail.com [64.4.33.202])
by mx1.FreeBSD.org (Postfix) with ESMTP id 642E743E42
for ; Mon, 12 Aug 2002 01:35:32 -0700 (PDT)
(envelope-from oykai@msn.com)
Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC;
Mon, 12 Aug 2002 01:35:32 -0700
X-Originating-IP: [210.12.61.105]
From: "ouyang kai"
To:
Subject: Hi, how the kernel add the devices
Date: Mon, 12 Aug 2002 16:35:23 +0800
MIME-Version: 1.0
X-Mailer: MSN Explorer 6.10.0016.1624
Content-Type: multipart/alternative; boundary="----=_NextPart_001_0001_01C2421E.413F6140"
Message-ID:
X-OriginalArrivalTime: 12 Aug 2002 08:35:32.0231 (UTC) FILETIME=[388EA170:01C241DB]
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
List-ID:
List-Archive: (Web Archive)
List-Help: (List Instructions)
List-Subscribe:
List-Unsubscribe:
X-Loop: FreeBSD.ORG
------=_NextPart_001_0001_01C2421E.413F6140
Content-Type: text/plain; charset="gb2312"
Content-Transfer-Encoding: quoted-printable
Hi Everybody,
I am a jackaroo to FreeBSD kernel. I have a question about how the kern=
el add all devices. =20
For example, in NetBSD, I can find the code in /sys/kern/init_main.c:
/* Attach pseudo-devices. */
for (pdev =3D pdevinit; pdev->pdev_attach !=3D NULL; pdev++)
(*pdev->pdev_attach)(pdev->pdev_count);
I know the NetBSD kernel add devices(such as storage device and network d=
evice) by them.
But in FreeBSD, I can not locate the place.
which part code should I read?
Thank you.
=20
Best Regards
Ouyang KaiGet more from the Web. FREE MSN Explorer download : http://e=
xplorer.msn.com
------=_NextPart_001_0001_01C2421E.413F6140
Content-Type: text/html; charset="gb2312"
Content-Transfer-Encoding: quoted-printable
Hi Everybody,<=
BR> I am a jackaroo to FreeBSD kernel. I have a question about how =
the kernel add all devices.
For example, in NetBSD, I ca=
n find the code in /sys/kern/init_main.c:
/* Attach pseudo-devic=
es. */
for (pdev =3D pdevinit; pdev->pdev_attach !=3D NULL; pdev++)=
&nb=
sp; (*pdev->pdev_attach)(pdev->pdev_count);
I know the Net=
BSD kernel add devices(such as storage device and network device) by them=
.
But in FreeBSD, I can not locate the place.
which part code shoul=
d I read?
Thank you.
Best Regards
Ouyang Kai=
DIV>
Get more from the Web. FREE MSN Explorer download :
http://explorer.msn.com
------=_NextPart_001_0001_01C2421E.413F6140--
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
From owner-freebsd-hackers Mon Aug 12 2:16:12 2002
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
by hub.freebsd.org (Postfix) with ESMTP id 6905237B400
for
; Mon, 12 Aug 2002 02:16:11 -0700 (PDT)
Received: from flamingo.mail.pas.earthlink.net (flamingo.mail.pas.earthlink.net [207.217.120.232])
by mx1.FreeBSD.org (Postfix) with ESMTP id 1983543E3B
for ; Mon, 12 Aug 2002 02:16:11 -0700 (PDT)
(envelope-from tlambert2@mindspring.com)
Received: from pool0007.cvx21-bradley.dialup.earthlink.net ([209.179.192.7] helo=mindspring.com)
by flamingo.mail.pas.earthlink.net with esmtp (Exim 3.33 #1)
id 17eBJ3-0004lf-00; Mon, 12 Aug 2002 02:16:09 -0700
Message-ID: <3D577C37.FF7992D3@mindspring.com>
Date: Mon, 12 Aug 2002 02:13:27 -0700
From: Terry Lambert
X-Mailer: Mozilla 4.79 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
To: ouyang kai
Cc: freebsd-hackers@FreeBSD.ORG
Subject: Re: Hi, how the kernel add the devices
References:
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
List-ID:
List-Archive: (Web Archive)
List-Help: (List Instructions)
List-Subscribe:
List-Unsubscribe:
X-Loop: FreeBSD.ORG
ouyang kai wrote:
>
> Part 1.1 Type: Plain Text (text/plain)
> Encoding: quoted-printable
See /usr/src/sys/kernel.h. It is done using linker sets and
SYSINIT.
-- Terry
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
From owner-freebsd-hackers Mon Aug 12 2:50: 6 2002
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
by hub.freebsd.org (Postfix) with ESMTP id 16C4137B400
for ; Mon, 12 Aug 2002 02:49:58 -0700 (PDT)
Received: from hotmail.com (oe72.pav0.hotmail.com [64.4.33.214])
by mx1.FreeBSD.org (Postfix) with ESMTP id 9FC0C43E4A
for ; Mon, 12 Aug 2002 02:49:57 -0700 (PDT)
(envelope-from oykai@msn.com)
Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC;
Mon, 12 Aug 2002 02:49:57 -0700
X-Originating-IP: [210.12.61.105]
From: "ouyang kai"
To: "Lambert Terry" ,
Subject: Re: Hi, how the kernel add the devices
Date: Mon, 12 Aug 2002 17:49:46 +0800
MIME-Version: 1.0
X-Mailer: MSN Explorer 6.10.0016.1624
Content-Type: multipart/mixed; boundary="----=_NextPart_001_0002_01C24228.A5C40FD0"
Message-ID:
X-OriginalArrivalTime: 12 Aug 2002 09:49:57.0544 (UTC) FILETIME=[9E175280:01C241E5]
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
List-ID:
List-Archive: (Web Archive)
List-Help: (List Instructions)
List-Subscribe:
List-Unsubscribe:
X-Loop: FreeBSD.ORG
------=_NextPart_001_0002_01C24228.A5C40FD0
Content-Type: multipart/alternative; boundary="----=_NextPart_002_0003_01C24228.A5C680D0"
------=_NextPart_002_0003_01C24228.A5C680D0
Content-Type: text/plain; charset="gb2312"
Content-Transfer-Encoding: quoted-printable
Dear Terry,
>See /usr/src/sys/kernel.h. It is done using linker sets and
>SYSINIT.
Hmm=A1=AD. Thank you!
I find the mi_startup() function in /sys/kern/init_main.c, there are some=
code as follow:
for (sipp =3D sysinit; sipp < sysinit_end; sipp++) {
if ((*sipp)->subsystem =3D=3D SI_SUB_DUMMY)
continue; /* skip dummy task(s)*/
if ((*sipp)->subsystem =3D=3D SI_SUB_DONE)
continue;
/* Call function */
(*((*sipp)->func))((*sipp)->udata);
/* Check off the one we're just done */
(*sipp)->subsystem =3D SI_SUB_DONE;
/* Check if we've installed more sysinit items via KLD */
if (newsysinit !=3D NULL) {
if (sysinit !=3D SET_BEGIN(sysinit_set))
free(sysinit, M_TEMP);
sysinit =3D newsysinit;
sysinit_end =3D newsysinit_end;
newsysinit =3D NULL;
newsysinit_end =3D NULL;
goto restart;
}
}
Now, I am puzzled about the function pointer(func), which is how to work.=
=20
For example, I have a NIC =A1=AEfxp0=A1=AF, so the function pointer shoul=
d point to the fxp_attach?
If that is right, I want to know how the kernel call the mi_startup()?
Best Regards
Ouyang KaiGet more from the Web. FREE MSN Explorer download : http://ex=
plorer.msn.com
------=_NextPart_002_0003_01C24228.A5C680D0
Content-Type: text/html; charset="gb2312"
Content-Transfer-Encoding: quoted-printable
Dear Terry,
>See /usr/src/sys/kernel.h. It is done using link=
er sets and
>SYSINIT.
Hmm=A1=AD. Thank you!
I find the mi_sta=
rtup() function in /sys/kern/init_main.c, there are some code as follow:<=
BR>for (sipp =3D sysinit; sipp < sysinit_end; sipp++) {
 =
;if ((*sipp)->subsystem =3D=3D SI_SUB_DUMMY)
cont=
inue; /* skip dummy task(s)*/
if ((*sipp)->subsyst=
em =3D=3D SI_SUB_DONE)
continue;
/* C=
all function */
(*((*sipp)->func))((*sipp)->udata);<=
BR> /* Check off the one we're just done */
(*s=
ipp)->subsystem =3D SI_SUB_DONE;
/* Check if we've inst=
alled more sysinit items via KLD */
if (newsysinit !=3D NU=
LL) {
if (sysinit !=3D SET_BEGIN(sysinit_set))
&n=
bsp; free(sysinit, M_TEMP);
sysinit=
=3D newsysinit;
sysinit_end =3D newsysinit_end;
=
newsysinit =3D NULL;
newsysinit_en=
d =3D NULL;
goto restart;
}
=
}
Now, I am puzzled about the function pointer(func), which is how to =
work.
For example, I have a NIC =A1=AEfxp0=A1=AF, so the function poi=
nter should point to the fxp_attach?
If that is right, I want to know =
how the kernel call the mi_startup()?
Best R=
egards
Ouyang Kai
Get more from the Web. FREE MSN Exp=
lorer download :
http://explorer.msn.=
com
------=_NextPart_002_0003_01C24228.A5C680D0--
------=_NextPart_001_0002_01C24228.A5C40FD0
Content-Type: text/plain; name="kernel_init_problem.txt"
Content-Disposition: attachment; filename="kernel_init_problem.txt"
Content-Transfer-Encoding: quoted-printable
Dear Terry
>See /usr/src/sys/kernel.h. It is done using linker sets and
>SYSINIT.
Hmm=A1=AD. Thank you!
I find the mi_startup() function in /sys/kern/init_main.c, there are some=
code as follow:
for (sipp =3D sysinit; sipp < sysinit_end; sipp++) {
if ((*sipp)->subsystem =3D=3D SI_SUB_DUMMY)
continue; /* skip dummy task(s)*/
if ((*sipp)->subsystem =3D=3D SI_SUB_DONE)
continue;
/* Call function */
(*((*sipp)->func))((*sipp)->udata);
/* Check off the one we're just done */
(*sipp)->subsystem =3D SI_SUB_DONE;
/* Check if we've installed more sysinit items via KLD */
if (newsysinit !=3D NULL) {
if (sysinit !=3D SET_BEGIN(sysinit_set))
free(sysinit, M_TEMP);
sysinit =3D newsysinit;
sysinit_end =3D newsysinit_end;
newsysinit =3D NULL;
newsysinit_end =3D NULL;
goto restart;
}
}
Now, I am puzzled about the function pointer(func), which is how to work.=
=20
For example, I have a NIC =A1=AEfxp0=A1=AF, so the function pointer shoul=
d point to the fxp_attach?
Best Regards
Ouyang Kai
If that is right, I want to know how the kernel call the mi_startup()?
------=_NextPart_001_0002_01C24228.A5C40FD0--
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
From owner-freebsd-hackers Mon Aug 12 3:19:27 2002
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
by hub.freebsd.org (Postfix) with ESMTP
id 9875C37B400; Mon, 12 Aug 2002 03:15:26 -0700 (PDT)
Received: from alcatraz.iptelecom.net.ua (alcatraz.iptelecom.net.ua [212.9.224.15])
by mx1.FreeBSD.org (Postfix) with ESMTP
id DFECF43E3B; Mon, 12 Aug 2002 03:15:17 -0700 (PDT)
(envelope-from sobomax@FreeBSD.org)
Received: from relay.iptelecom.net.ua (alcatraz.iptelecom.net.ua [212.9.224.15])
by alcatraz.iptelecom.net.ua (8.9.3/8.9.3) with ESMTP id NAA76768;
Mon, 12 Aug 2002 13:14:39 +0300 (EEST)
(envelope-from sobomax@FreeBSD.org)
Received: from vircheck.ipcard.iptcom.net (ipcard.iptcom.net [212.9.224.5])
by relay.iptelecom.net.ua (8.12.4/8.12.4) with ESMTP id g7CAEX8Y076679;
Mon, 12 Aug 2002 13:14:34 +0300 (EEST)
Received: from vega.vega.com (h210.234.dialup.iptcom.net [212.9.234.210])
by vircheck.ipcard.iptcom.net (8.12.3/8.12.3) with ESMTP id g7CAE3oQ057457;
Mon, 12 Aug 2002 13:14:06 +0300 (EEST)
Received: from FreeBSD.org (big_brother.vega.com [192.168.1.1])
by vega.vega.com (8.12.5/8.11.3) with ESMTP id g7CAE1F2039450;
Mon, 12 Aug 2002 13:14:01 +0300 (EEST)
(envelope-from sobomax@FreeBSD.org)
Message-ID: <3D578A99.F0821712@FreeBSD.org>
Date: Mon, 12 Aug 2002 13:14:49 +0300
From: Maxim Sobolev
Organization: Vega International Capital
X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U)
X-Accept-Language: en,uk,ru
MIME-Version: 1.0
To: hackers@FreeBSD.org, audit@FreeBSD.org,
Alexander Litvin ,
Andriy Gapon
Subject: Thread-safe resolver [patches for review]
Content-Type: multipart/mixed;
boundary="------------051496A982500B2DDF1E4FCD"
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
List-ID:
List-Archive: (Web Archive)
List-Help: (List Instructions)
List-Subscribe:
List-Unsubscribe:
X-Loop: FreeBSD.ORG
This is a multi-part message in MIME format.
--------------051496A982500B2DDF1E4FCD
Content-Type: text/plain; charset=koi8-r
Content-Transfer-Encoding: 7bit
Folks,
Attched please find two patches based on bin/29581 PR to make FreeBSD
resolver thread-safe. They represent two approaches to reach this goal
- the first is to introduce reentrant versions of the standard
gethostbyXXX(3) APIs, similar to ones existing in other unices, and
the second one is to make gethostbyXXX(3) returning data placed into
per-thread storage when linked with libc_r. I like the latter approach
more, since it doesn't introduce new non-standard APIs.
I would like to hear any comments and suggestions on the proposed
patches, as well as to opinions about which path to chose.
Thanks!
-Maxim
--------------051496A982500B2DDF1E4FCD
Content-Type: text/plain; charset=koi8-r;
name="resolv_r-1.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="resolv_r-1.diff"
Index: src/include/netdb.h
===================================================================
RCS file: /home/ncvs/src/include/netdb.h,v
retrieving revision 1.24
diff -d -u -r1.24 netdb.h
--- src/include/netdb.h 26 Jun 2002 08:18:42 -0000 1.24
+++ src/include/netdb.h 10 Aug 2002 10:03:43 -0000
@@ -82,7 +82,10 @@
#define _PATH_PROTOCOLS "/etc/protocols"
#define _PATH_SERVICES "/etc/services"
-extern int h_errno;
+__BEGIN_DECLS
+int * __h_errno_accessor(void);
+__END_DECLS
+#define h_errno (* __h_errno_accessor())
/*
* Structures returned by network data base library. All addresses are
@@ -240,6 +243,15 @@
char *gai_strerror(int);
void setnetgrent(const char *);
void setservent(int);
+
+int gethostbyaddr_r(const char *, int, int, struct hostent *,
+ char *, int, int *);
+int gethostbyname_r(const char *, struct hostent *,
+ char *, int, int *);
+int gethostbyname2_r(const char *, int, struct hostent *,
+ char *, int, int *);
+struct hostent *gethostent_r(struct hostent *, char *, int);
+
/*
* PRIVATE functions specific to the FreeBSD implementation
Index: src/include/resolv.h
===================================================================
RCS file: /home/ncvs/src/include/resolv.h,v
retrieving revision 1.21
diff -d -u -r1.21 resolv.h
--- src/include/resolv.h 23 Mar 2002 17:24:53 -0000 1.21
+++ src/include/resolv.h 10 Aug 2002 10:03:43 -0000
@@ -90,11 +90,16 @@
#define MAXDFLSRCH 3 /* # default domain levels to try */
#define MAXDNSRCH 6 /* max # domains in search path */
#define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */
+#define MAXALIASES 35 /* max # of aliases to return */
+#define MAXADDRS 35 /* max # of addresses to return */
#define RES_TIMEOUT 5 /* min. seconds between retries */
#define MAXRESOLVSORT 10 /* number of net to sort on */
#define RES_MAXNDOTS 15 /* should reflect bit field size */
+#define CAST_ALIGN(ptr, type) \
+ (char*)(type)ptr < (char*)ptr ? ((type)ptr) + 1 : (type)ptr
+
struct __res_state {
int retrans; /* retransmition time interval */
int retry; /* number of times to retransmit */
@@ -198,10 +203,6 @@
char * humanname; /* Its fun name, like "mail exchanger" */
};
-extern struct __res_state _res;
-/* for INET6 */
-extern struct __res_state_ext _res_ext;
-
extern const struct res_sym __p_class_syms[];
extern const struct res_sym __p_type_syms[];
@@ -224,6 +225,7 @@
#define fp_query __fp_query
#define fp_nquery __fp_nquery
#define hostalias __hostalias
+#define hostalias_r __hostalias_r
#define putlong __putlong
#define putshort __putshort
#define p_class __p_class
@@ -273,6 +275,7 @@
void fp_query(const u_char *, FILE *);
void fp_nquery(const u_char *, int, FILE *);
const char * hostalias(const char *);
+const char * hostalias_r(const char *, char *, int);
void putlong(u_int32_t, u_char *);
void putshort(u_int16_t, u_char *);
const char * p_class(int);
@@ -315,5 +318,30 @@
void res_freeupdrec(ns_updrec *);
#endif
__END_DECLS
+
+struct __res_data {
+ int h_errno_res;
+ int s; /* socket used for communications */
+ int connected : 1; /* is the socket connected */
+ int vc : 1; /* is the socket a virtual circuit? */
+ int af; /* address family of socket */
+ res_send_qhook Qhook;
+ res_send_rhook Rhook;
+ FILE* hostf;
+ int stayopen;
+ struct __res_state *res;
+ struct __res_state_ext *res_ext;
+};
+
+__BEGIN_DECLS
+u_int16_t _getshort(const u_char *);
+u_int32_t _getlong(const u_char *);
+struct __res_data * __res_data_accessor(void);
+struct __res_state * __res_accessor(void);
+__END_DECLS
+#define _res_data (* __res_data_accessor())
+#define _res (* __res_accessor())
+/* for INET6 */
+#define _res_ext (* (__res_data_accessor()->res_ext))
#endif /* !_RESOLV_H_ */
Index: src/lib/libc/net/getaddrinfo.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/net/getaddrinfo.c,v
retrieving revision 1.28
diff -d -u -r1.28 getaddrinfo.c
--- src/lib/libc/net/getaddrinfo.c 2 Aug 2002 11:58:48 -0000 1.28
+++ src/lib/libc/net/getaddrinfo.c 10 Aug 2002 10:03:49 -0000
@@ -1673,7 +1673,6 @@
/* resolver logic */
extern const char *__hostalias(const char *);
-extern int h_errno;
/*
* Formulate a normal query, send, and await answer.
Index: src/lib/libc/net/gethostbydns.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/net/gethostbydns.c,v
retrieving revision 1.36
diff -d -u -r1.36 gethostbydns.c
--- src/lib/libc/net/gethostbydns.c 26 Jun 2002 14:18:36 -0000 1.36
+++ src/lib/libc/net/gethostbydns.c 10 Aug 2002 10:03:49 -0000
@@ -68,6 +68,7 @@
#include
#include
+#include
#include
#include
#include
@@ -82,18 +83,11 @@
#define SPRINTF(x) ((size_t)sprintf x)
-#define MAXALIASES 35
-#define MAXADDRS 35
-
static const char AskedForGot[] =
"gethostby*.gethostanswer: asked for \"%s\", got \"%s\"";
-static char *h_addr_ptrs[MAXADDRS + 1];
-
-static struct hostent host;
-static char *host_aliases[MAXALIASES];
-static char hostbuf[8*1024];
-static u_char host_addr[16]; /* IPv4 or IPv6 */
+static char hostbuf_s[8*1024];
+static u_char host_addr_s[16]; /* IPv4 or IPv6 */
#ifdef RESOLVSORT
static void addrsort(char **, int);
@@ -119,7 +113,6 @@
char ac;
} align;
-extern int h_errno;
int _dns_ttl_;
#ifdef DEBUG
@@ -157,11 +150,14 @@
} while (0)
static struct hostent *
-gethostanswer(answer, anslen, qname, qtype)
+gethostanswer(answer, anslen, qname, qtype, host, hostbuf, hostbuflen)
const querybuf *answer;
int anslen;
const char *qname;
int qtype;
+ struct hostent *host;
+ char *hostbuf;
+ int hostbuflen;
{
const HEADER *hp;
const u_char *cp;
@@ -176,7 +172,7 @@
int (*name_ok)(const char *);
tname = qname;
- host.h_name = NULL;
+ host->h_name = NULL;
eom = answer->buf + anslen;
switch (qtype) {
case T_A:
@@ -197,7 +193,7 @@
ancount = ntohs(hp->ancount);
qdcount = ntohs(hp->qdcount);
bp = hostbuf;
- ep = hostbuf + sizeof hostbuf;
+ ep = hostbuf + hostbuflen;
cp = answer->buf;
BOUNDED_INCR(HFIXEDSZ);
if (qdcount != 1) {
@@ -220,17 +216,15 @@
h_errno = NO_RECOVERY;
return (NULL);
}
- host.h_name = bp;
+ host->h_name = bp;
bp += n;
/* The qname can be abbreviated, but h_name is now absolute. */
- qname = host.h_name;
+ qname = host->h_name;
}
- ap = host_aliases;
+ ap = host->h_aliases;
*ap = NULL;
- host.h_aliases = host_aliases;
- hap = h_addr_ptrs;
+ hap = host->h_addr_list;
*hap = NULL;
- host.h_addr_list = h_addr_ptrs;
haveanswer = 0;
had_error = 0;
_dns_ttl_ = -1;
@@ -259,7 +253,7 @@
continue; /* XXX - had_error++ ? */
}
if ((qtype == T_A || qtype == T_AAAA) && type == T_CNAME) {
- if (ap >= &host_aliases[MAXALIASES-1])
+ if (ap >= &host->h_aliases[MAXALIASES-1])
continue;
n = dn_expand(answer->buf, eom, cp, tbuf, sizeof tbuf);
if ((n < 0) || !(*name_ok)(tbuf)) {
@@ -286,7 +280,7 @@
continue;
}
strcpy(bp, tbuf);
- host.h_name = bp;
+ host->h_name = bp;
bp += n;
continue;
}
@@ -341,8 +335,8 @@
return (NULL);
}
if (!haveanswer)
- host.h_name = bp;
- else if (ap < &host_aliases[MAXALIASES-1])
+ host->h_name = bp;
+ else if (ap < &host->h_aliases[MAXALIASES-1])
*ap++ = bp;
else
n = -1;
@@ -356,7 +350,7 @@
}
break;
#else
- host.h_name = bp;
+ host->h_name = bp;
if (_res.options & RES_USE_INET6) {
n = strlen(bp) + 1; /* for the \0 */
if (n >= MAXHOSTNAMELEN) {
@@ -364,27 +358,27 @@
break;
}
bp += n;
- _map_v4v6_hostent(&host, &bp, &ep);
+ _map_v4v6_hostent(host, &bp, &ep);
}
h_errno = NETDB_SUCCESS;
- return (&host);
+ return (host);
#endif
case T_A:
case T_AAAA:
- if (strcasecmp(host.h_name, bp) != 0) {
+ if (strcasecmp(host->h_name, bp) != 0) {
syslog(LOG_NOTICE|LOG_AUTH,
- AskedForGot, host.h_name, bp);
+ AskedForGot, host->h_name, bp);
cp += n;
continue; /* XXX - had_error++ ? */
}
- if (n != host.h_length) {
+ if (n != host->h_length) {
cp += n;
continue;
}
if (!haveanswer) {
int nn;
- host.h_name = bp;
+ host->h_name = bp;
nn = strlen(bp) + 1; /* for the \0 */
bp += nn;
}
@@ -396,7 +390,7 @@
had_error++;
continue;
}
- if (hap >= &h_addr_ptrs[MAXADDRS-1]) {
+ if (hap >= &host->h_addr_list[MAXADDRS-1]) {
if (!toobig++)
dprintf("Too many addresses (%d)\n",
MAXADDRS);
@@ -430,62 +424,82 @@
* address in that case, not some random one
*/
if (_res.nsort && haveanswer > 1 && qtype == T_A)
- addrsort(h_addr_ptrs, haveanswer);
+ addrsort(host->h_addr_list, haveanswer);
# endif /*RESOLVSORT*/
- if (!host.h_name) {
+ if (!host->h_name) {
n = strlen(qname) + 1; /* for the \0 */
if (n > ep - bp || n >= MAXHOSTNAMELEN)
goto no_recovery;
strcpy(bp, qname);
- host.h_name = bp;
+ host->h_name = bp;
bp += n;
}
if (_res.options & RES_USE_INET6)
- _map_v4v6_hostent(&host, &bp, &ep);
+ _map_v4v6_hostent(host, &bp, &ep);
h_errno = NETDB_SUCCESS;
- return (&host);
+ return (host);
}
no_recovery:
h_errno = NO_RECOVERY;
return (NULL);
}
-struct hostent *
-__dns_getanswer(answer, anslen, qname, qtype)
- const char *answer;
- int anslen;
- const char *qname;
- int qtype;
-{
- switch(qtype) {
- case T_AAAA:
- host.h_addrtype = AF_INET6;
- host.h_length = IN6ADDRSZ;
- break;
- case T_A:
- default:
- host.h_addrtype = AF_INET;
- host.h_length = INADDRSZ;
- break;
- }
-
- return(gethostanswer((const querybuf *)answer, anslen, qname, qtype));
-}
-
int
_dns_gethostbyname(void *rval, void *cb_data, va_list ap)
{
const char *name;
int af;
+ struct hostent *host;
+ char *hostbuf;
+ int hostbuflen;
+ u_char *host_addr;
querybuf buf;
const char *cp;
char *bp, *ep;
int n, size, type, len;
+ char abuf[MAXDNAME];
name = va_arg(ap, const char *);
af = va_arg(ap, int);
+ host = va_arg(ap, struct hostent *);
+ hostbuf = va_arg(ap, char *);
+ hostbuflen = va_arg(ap, int);
*(struct hostent **)rval = NULL;
+ if(hostbuflen != 0 && hostbuf != NULL) {
+ host->h_aliases = CAST_ALIGN(hostbuf, char **);
+ bp = (char *)host->h_aliases + sizeof(char *[MAXALIASES]);
+ hostbuflen -= (bp - hostbuf);
+ hostbuf = bp;
+ if(hostbuflen < 0) {
+ h_errno = NO_RECOVERY;
+ errno = ERANGE;
+ return (NS_UNAVAIL);
+ }
+ host->h_addr_list = CAST_ALIGN(hostbuf, char **);
+ bp = (char *)host->h_addr_list + sizeof(char *[MAXADDRS + 1]);
+ hostbuflen -= (bp - hostbuf);
+ hostbuf = bp;
+ if(hostbuflen < 0) {
+ h_errno = NO_RECOVERY;
+ errno = ERANGE;
+ return (NS_UNAVAIL);
+ }
+ host_addr = hostbuf;
+ bp = (char *)host_addr + sizeof(u_char[16]);
+ hostbuflen -= (bp - hostbuf);
+ hostbuf = bp;
+ if(hostbuflen < MAXDNAME+1) {
+ h_errno = NO_RECOVERY;
+ errno = ERANGE;
+ return (NS_UNAVAIL);
+ }
+ } else {
+ hostbuf = hostbuf_s;
+ hostbuflen = sizeof hostbuf_s;
+ host_addr = host_addr_s;
+ }
+
if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
h_errno = NETDB_INTERNAL;
return NS_UNAVAIL;
@@ -506,15 +520,15 @@
return NS_UNAVAIL;
}
- host.h_addrtype = af;
- host.h_length = size;
+ host->h_addrtype = af;
+ host->h_length = size;
/*
* if there aren't any dots, it could be a user-level alias.
* this is also done in res_query() since we are not the only
* function that looks up host names.
*/
- if (!strchr(name, '.') && (cp = __hostalias(name)))
+ if (!strchr(name, '.') && (cp = __hostalias_r(name, abuf, sizeof abuf)))
name = cp;
/*
@@ -538,17 +552,15 @@
strncpy(hostbuf, name, MAXDNAME);
hostbuf[MAXDNAME] = '\0';
bp = hostbuf + MAXDNAME;
- ep = hostbuf + sizeof hostbuf;
- host.h_name = hostbuf;
- host.h_aliases = host_aliases;
- host_aliases[0] = NULL;
- h_addr_ptrs[0] = (char *)host_addr;
- h_addr_ptrs[1] = NULL;
- host.h_addr_list = h_addr_ptrs;
+ ep = hostbuf + hostbuflen;
+ host->h_name = hostbuf;
+ host->h_aliases[0] = NULL;
+ host->h_addr_list[0] = (char *)host_addr;
+ host->h_addr_list[1] = NULL;
if (_res.options & RES_USE_INET6)
- _map_v4v6_hostent(&host, &bp, &ep);
+ _map_v4v6_hostent(host, &bp, &ep);
h_errno = NETDB_SUCCESS;
- *(struct hostent **)rval = &host;
+ *(struct hostent **)rval = host;
return NS_SUCCESS;
}
if (!isdigit((unsigned char)*cp) && *cp != '.')
@@ -572,15 +584,13 @@
strncpy(hostbuf, name, MAXDNAME);
hostbuf[MAXDNAME] = '\0';
bp = hostbuf + MAXDNAME;
- len = sizeof hostbuf - MAXDNAME;
- host.h_name = hostbuf;
- host.h_aliases = host_aliases;
- host_aliases[0] = NULL;
- h_addr_ptrs[0] = (char *)host_addr;
- h_addr_ptrs[1] = NULL;
- host.h_addr_list = h_addr_ptrs;
+ len = hostbuflen - MAXDNAME;
+ host->h_name = hostbuf;
+ host->h_aliases[0] = NULL;
+ host->h_addr_list[0] = (char *)host_addr;
+ host->h_addr_list[1] = NULL;
h_errno = NETDB_SUCCESS;
- *(struct hostent **)rval = &host;
+ *(struct hostent **)rval = host;
return NS_SUCCESS;
}
if (!isxdigit((unsigned char)*cp) && *cp != ':' && *cp != '.')
@@ -591,7 +601,8 @@
dprintf("res_search failed (%d)\n", n);
return NS_UNAVAIL;
}
- *(struct hostent **)rval = gethostanswer(&buf, n, name, type);
+ *(struct hostent **)rval = gethostanswer(&buf, n, name, type,
+ host, hostbuf, hostbuflen);
return (*(struct hostent **)rval != NULL) ? NS_SUCCESS : NS_NOTFOUND;
}
@@ -600,6 +611,10 @@
{
const char *addr; /* XXX should have been def'd as u_char! */
int len, af;
+ struct hostent *host;
+ char *hostbuf;
+ int hostbuflen;
+ char *bp;
const u_char *uaddr;
static const u_char mapped[] = { 0,0, 0,0, 0,0, 0,0, 0,0, 0xff,0xff };
static const u_char tunnelled[] = { 0,0, 0,0, 0,0, 0,0, 0,0, 0,0 };
@@ -607,6 +622,7 @@
querybuf buf;
struct hostent *hp;
char qbuf[MAXDNAME+1], *qp;
+ u_char *host_addr;
#ifdef SUNSECURITY
struct hostent *rhp;
char **haddr;
@@ -618,9 +634,45 @@
uaddr = (const u_char *)addr;
len = va_arg(ap, int);
af = va_arg(ap, int);
-
+ host = va_arg(ap, struct hostent *);
+ hostbuf = va_arg(ap, char*);
+ hostbuflen = va_arg(ap, int);
*(struct hostent **)rval = NULL;
+ if(hostbuflen != 0 && hostbuf != NULL) {
+ host->h_aliases = CAST_ALIGN(hostbuf, char **);
+ bp = (char *)host->h_aliases + sizeof(char *[MAXALIASES]);
+ hostbuflen -= (bp - hostbuf);
+ hostbuf = bp;
+ if(hostbuflen < 0) {
+ h_errno = NO_RECOVERY;
+ errno = ERANGE;
+ return (NS_UNAVAIL);
+ }
+ host->h_addr_list = CAST_ALIGN(hostbuf, char **);
+ bp = (char *)host->h_addr_list + sizeof(char *[MAXADDRS + 1]);
+ hostbuflen -= (bp - hostbuf);
+ hostbuf = bp;
+ if(hostbuflen < 0) {
+ h_errno = NO_RECOVERY;
+ errno = ERANGE;
+ return (NS_UNAVAIL);
+ }
+ host_addr = hostbuf;
+ bp = (char *)host_addr + sizeof(u_char[16]);
+ hostbuflen -= (bp - hostbuf);
+ hostbuf = bp;
+ if(hostbuflen < MAXDNAME+1) {
+ h_errno = NO_RECOVERY;
+ errno = ERANGE;
+ return (NS_UNAVAIL);
+ }
+ } else {
+ hostbuf = hostbuf_s;
+ hostbuflen = sizeof hostbuf_s;
+ host_addr = host_addr_s;
+ }
+
if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
h_errno = NETDB_INTERNAL;
return NS_UNAVAIL;
@@ -680,7 +732,7 @@
dprintf("static buffer is too small (%d)\n", n);
return NS_UNAVAIL;
}
- if (!(hp = gethostanswer(&buf, n, qbuf, T_PTR)))
+ if (!(hp = gethostanswer(&buf, n, qbuf, T_PTR, host, hostbuf, hostbuflen)))
return NS_NOTFOUND; /* h_errno was set by gethostanswer() */
#ifdef SUNSECURITY
if (af == AF_INET) {
@@ -717,8 +769,8 @@
hp->h_addrtype = af;
hp->h_length = len;
bcopy(addr, host_addr, len);
- h_addr_ptrs[0] = (char *)host_addr;
- h_addr_ptrs[1] = NULL;
+ host->h_addr_list[0] = (char *)host_addr;
+ host->h_addr_list[1] = NULL;
if (af == AF_INET && (_res.options & RES_USE_INET6)) {
_map_v4v6_address((char*)host_addr, (char*)host_addr);
hp->h_addrtype = AF_INET6;
Index: src/lib/libc/net/gethostbyht.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/net/gethostbyht.c,v
retrieving revision 1.16
diff -d -u -r1.16 gethostbyht.c
--- src/lib/libc/net/gethostbyht.c 22 Mar 2002 21:52:29 -0000 1.16
+++ src/lib/libc/net/gethostbyht.c 10 Aug 2002 10:03:52 -0000
@@ -62,6 +62,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -70,49 +71,53 @@
#include /* XXX */
#include /* XXX */
-#define MAXALIASES 35
-
-static struct hostent host;
-static char *host_aliases[MAXALIASES];
-static char hostbuf[BUFSIZ+1];
-static FILE *hostf = NULL;
-static u_int32_t host_addr[4]; /* IPv4 or IPv6 */
static char *h_addr_ptrs[2];
-static int stayopen = 0;
+static char *host_aliases[MAXALIASES];
+static struct hostent host_s = { NULL, host_aliases, 0, 0, h_addr_ptrs };
+
+static char hostbuf_s[BUFSIZ+1];
+static u_int32_t host_addr_s[4]; /* IPv4 or IPv6 */
void
_sethosthtent(f)
int f;
{
- if (!hostf)
- hostf = fopen(_PATH_HOSTS, "r" );
+ if (!_res_data.hostf)
+ _res_data.hostf = fopen(_PATH_HOSTS, "r" );
else
- rewind(hostf);
- stayopen = f;
+ rewind(_res_data.hostf);
+ _res_data.stayopen = f;
}
void
_endhosthtent()
{
- if (hostf && !stayopen) {
- (void) fclose(hostf);
- hostf = NULL;
+ if (_res_data.hostf && !_res_data.stayopen) {
+ (void) fclose(_res_data.hostf);
+ _res_data.hostf = NULL;
}
}
struct hostent *
gethostent()
{
+
+ return (gethostent_r(&host_s, hostbuf_s, sizeof hostbuf_s));
+}
+
+struct hostent *
+gethostent_r(struct hostent *host, char *hostbuf, int hostbuflen)
+{
char *p;
char *cp, **q;
int af, len;
- if (!hostf && !(hostf = fopen(_PATH_HOSTS, "r" ))) {
+ if (!_res_data.hostf && !(_res_data.hostf = fopen(_PATH_HOSTS, "r" ))) {
h_errno = NETDB_INTERNAL;
return (NULL);
}
again:
- if (!(p = fgets(hostbuf, sizeof hostbuf, hostf))) {
+ if (!(p = fgets(hostbuf, hostbuflen, _res_data.hostf))) {
h_errno = HOST_NOT_FOUND;
return (NULL);
}
@@ -124,12 +129,12 @@
if (!(cp = strpbrk(p, " \t")))
goto again;
*cp++ = '\0';
- if (inet_pton(AF_INET6, p, host_addr) > 0) {
+ if (inet_pton(AF_INET6, p, host->h_addr_list[0]) > 0) {
af = AF_INET6;
len = IN6ADDRSZ;
- } else if (inet_pton(AF_INET, p, host_addr) > 0) {
+ } else if (inet_pton(AF_INET, p, host->h_addr_list[0]) > 0) {
if (_res.options & RES_USE_INET6) {
- _map_v4v6_address((char*)host_addr, (char*)host_addr);
+ _map_v4v6_address(host->h_addr_list[0], host->h_addr_list[0]);
af = AF_INET6;
len = IN6ADDRSZ;
} else {
@@ -139,15 +144,12 @@
} else {
goto again;
}
- h_addr_ptrs[0] = (char *)host_addr;
- h_addr_ptrs[1] = NULL;
- host.h_addr_list = h_addr_ptrs;
- host.h_length = len;
- host.h_addrtype = af;
+ host->h_length = len;
+ host->h_addrtype = af;
while (*cp == ' ' || *cp == '\t')
cp++;
- host.h_name = cp;
- q = host.h_aliases = host_aliases;
+ host->h_name = cp;
+ q = host->h_aliases;
if ((cp = strpbrk(cp, " \t")) != NULL)
*cp++ = '\0';
while (cp && *cp) {
@@ -155,14 +157,14 @@
cp++;
continue;
}
- if (q < &host_aliases[MAXALIASES - 1])
+ if (q < &host->h_aliases[MAXALIASES - 1])
*q++ = cp;
if ((cp = strpbrk(cp, " \t")) != NULL)
*cp++ = '\0';
}
*q = NULL;
h_errno = NETDB_SUCCESS;
- return (&host);
+ return (host);
}
int
@@ -170,14 +172,58 @@
{
const char *name;
int af;
+ struct hostent *host;
+ char *hostbuf, *bp;
+ int hostbuflen;
+ u_int32_t *host_addr;
struct hostent *p;
char **cp;
name = va_arg(ap, const char *);
af = va_arg(ap, int);
+ host = va_arg(ap, struct hostent *);
+ hostbuf = va_arg(ap, char*);
+ hostbuflen = va_arg(ap, int);
+ if(hostbuflen != 0 && hostbuf != NULL) {
+ host->h_aliases = CAST_ALIGN(hostbuf, char **);
+ bp = (char *)host->h_aliases + sizeof(char *[MAXALIASES]);
+ hostbuflen -= (bp - hostbuf);
+ hostbuf = bp;
+ if(hostbuflen < 0) {
+ h_errno = NO_RECOVERY;
+ errno = ERANGE;
+ return (NS_UNAVAIL);
+ }
+ host->h_addr_list = CAST_ALIGN(hostbuf, char **);
+ bp = (char *)host->h_addr_list + sizeof(char *[2]);
+ hostbuflen -= (bp - hostbuf);
+ hostbuf = bp;
+ if(hostbuflen < 0) {
+ h_errno = NO_RECOVERY;
+ errno = ERANGE;
+ return (NS_UNAVAIL);
+ }
+ host_addr = CAST_ALIGN(hostbuf, u_int32_t *);
+ bp = (char *)host_addr + sizeof(u_int32_t[4]);
+ hostbuflen -= (bp - hostbuf);
+ hostbuf = bp;
+ if(hostbuflen < BUFSIZ+1) {
+ h_errno = NO_RECOVERY;
+ errno = ERANGE;
+ return (NS_UNAVAIL);
+ }
+ } else {
+ hostbuf = hostbuf_s;
+ hostbuflen = sizeof hostbuf_s;
+ host_addr = host_addr_s;
+ }
+
+ host->h_addr_list[0] = (char *)host_addr;
+ host->h_addr_list[1] = NULL;
+
sethostent(0);
- while ((p = gethostent()) != NULL) {
+ while ((p = gethostent_r(host, hostbuf, hostbuflen)) != NULL) {
if (p->h_addrtype != af)
continue;
if (strcasecmp(p->h_name, name) == 0)
@@ -198,14 +244,58 @@
{
const char *addr;
int len, af;
+ struct hostent *host;
+ char *hostbuf, *bp;
+ int hostbuflen;
+ u_int32_t *host_addr;
struct hostent *p;
addr = va_arg(ap, const char *);
len = va_arg(ap, int);
af = va_arg(ap, int);
+ host = va_arg(ap, struct hostent *);
+ hostbuf = va_arg(ap, char*);
+ hostbuflen = va_arg(ap, int);
+
+ if(hostbuflen != 0 && hostbuf != NULL) {
+ host->h_aliases = CAST_ALIGN(hostbuf, char **);
+ bp = (char *)host->h_aliases + sizeof(char *[MAXALIASES]);
+ hostbuflen -= (bp - hostbuf);
+ hostbuf = bp;
+ if(hostbuflen < 0) {
+ h_errno = NO_RECOVERY;
+ errno = ERANGE;
+ return (NS_UNAVAIL);
+ }
+ host->h_addr_list = CAST_ALIGN(hostbuf, char **);
+ bp = (char *)host->h_addr_list + sizeof(char *[2]);
+ hostbuflen -= (bp - hostbuf);
+ hostbuf = bp;
+ if(hostbuflen < 0) {
+ h_errno = NO_RECOVERY;
+ errno = ERANGE;
+ return (NS_UNAVAIL);
+ }
+ host_addr = CAST_ALIGN(hostbuf, u_int32_t *);
+ bp = (char *)host_addr + sizeof(u_int32_t[4]);
+ hostbuflen -= (bp - hostbuf);
+ hostbuf = bp;
+ if(hostbuflen < BUFSIZ+1) {
+ h_errno = NO_RECOVERY;
+ errno = ERANGE;
+ return (NS_UNAVAIL);
+ }
+ } else {
+ hostbuf = hostbuf_s;
+ hostbuflen = sizeof hostbuf_s;
+ host_addr = host_addr_s;
+ }
+
+ host->h_addr_list[0] = (char *)host_addr;
+ host->h_addr_list[1] = NULL;
sethostent(0);
- while ((p = gethostent()) != NULL)
+ while ((p = gethostent_r(host, hostbuf, hostbuflen)) != NULL)
if (p->h_addrtype == af && !bcmp(p->h_addr, addr, len))
break;
endhostent();
Index: src/lib/libc/net/gethostbynis.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/net/gethostbynis.c,v
retrieving revision 1.15
diff -d -u -r1.15 gethostbynis.c
--- src/lib/libc/net/gethostbynis.c 22 Mar 2002 21:52:29 -0000 1.15
+++ src/lib/libc/net/gethostbynis.c 10 Aug 2002 10:03:52 -0000
@@ -44,29 +44,63 @@
#include
#include
#endif
-
-#define MAXALIASES 35
-#define MAXADDRS 35
-
-extern int h_errno;
+#include
#ifdef YP
+static char hostbuf_s[8*1024];
+static u_char host_addr_s[16];
+
+static char *h_addr_ptrs[2];
static char *host_aliases[MAXALIASES];
-static char hostaddr[MAXADDRS];
-static char *host_addrs[2];
+static struct hostent host_s = { NULL, host_aliases, 0, 0, h_addr_ptrs };
static struct hostent *
-_gethostbynis(name, map, af)
+_gethostbynis(name, map, af, host, hostbuf, hostbuflen)
const char *name;
char *map;
int af;
+ struct hostent *host;
+ char *hostbuf;
+ int hostbuflen;
{
- char *cp, **q;
+ char *bp, *cp, **q;
char *result;
int resultlen,size;
- static struct hostent h;
static char *domain = (char *)NULL;
- static char ypbuf[YPMAXRECORD + 2];
+
+ if(hostbuflen != 0 && hostbuf != NULL) {
+ host->h_aliases = CAST_ALIGN(hostbuf, char **);
+ bp = (char *)host->h_aliases + sizeof(char *[MAXALIASES]);
+ hostbuflen -= (bp - hostbuf);
+ hostbuf = bp;
+ if(hostbuflen < 0) {
+ h_errno = NO_RECOVERY;
+ errno = ERANGE;
+ return (NULL);
+ }
+ host->h_addr_list = CAST_ALIGN(hostbuf, char **);
+ bp = (char *)host->h_addr_list + sizeof(char *[2]);
+ hostbuflen -= (bp - hostbuf);
+ hostbuf = bp;
+ if(hostbuflen < 0) {
+ h_errno = NO_RECOVERY;
+ errno = ERANGE;
+ return (NULL);
+ }
+ host->h_addr_list[0] = hostbuf;
+ bp = (char *)host->h_addr_list[0] + sizeof(u_char[16]);
+ hostbuflen -= (bp - hostbuf);
+ hostbuf = bp;
+ if(hostbuflen < 0) {
+ h_errno = NO_RECOVERY;
+ errno = ERANGE;
+ return (NULL);
+ }
+ } else {
+ hostbuf = hostbuf_s;
+ hostbuflen = sizeof hostbuf_s;
+ host->h_addr_list[0] = host_addr_s;
+ }
switch(af) {
case AF_INET:
@@ -90,27 +124,29 @@
h_errno = HOST_NOT_FOUND;
return ((struct hostent *)NULL);
}
-
- /* avoid potential memory leak */
- bcopy((char *)result, (char *)&ypbuf, resultlen);
- ypbuf[resultlen] = '\0';
+ if (resultlen > hostbuflen) {
+ h_errno = NO_RECOVERY;
+ errno = ERANGE;
+ return (NULL);
+ }
+ result[resultlen] = '\0';
+ bcopy((char *)result, hostbuf, resultlen);
free(result);
- result = (char *)&ypbuf;
+ result = hostbuf;
if ((cp = index(result, '\n')))
*cp = '\0';
cp = strpbrk(result, " \t");
*cp++ = '\0';
- h.h_addr_list = host_addrs;
- h.h_addr = hostaddr;
- *((u_long *)h.h_addr) = inet_addr(result);
- h.h_length = size;
- h.h_addrtype = AF_INET;
+ *((u_long *)host->h_addr_list[0]) = inet_addr(result);
+ host->h_addr_list[1] = NULL;
+ host->h_length = size;
+ host->h_addrtype = AF_INET;
while (*cp == ' ' || *cp == '\t')
cp++;
- h.h_name = cp;
- q = h.h_aliases = host_aliases;
+ host->h_name = cp;
+ q = host->h_aliases;
cp = strpbrk(cp, " \t");
if (cp != NULL)
*cp++ = '\0';
@@ -119,14 +155,14 @@
cp++;
continue;
}
- if (q < &host_aliases[MAXALIASES - 1])
+ if (q < &host->h_aliases[MAXALIASES - 1])
*q++ = cp;
cp = strpbrk(cp, " \t");
if (cp != NULL)
*cp++ = '\0';
}
*q = NULL;
- return (&h);
+ return (host);
}
#endif /* YP */
@@ -135,7 +171,7 @@
_gethostbynisname(const char *name, int af)
{
#ifdef YP
- return _gethostbynis(name, "hosts.byname", af);
+ return _gethostbynis(name, "hosts.byname", af, &host_s, NULL, 0);
#else
return NULL;
#endif
@@ -146,7 +182,7 @@
{
#ifdef YP
return _gethostbynis(inet_ntoa(*(struct in_addr *)addr),
- "hosts.byaddr", af);
+ "hosts.byaddr", af, &host_s, NULL, 0);
#else
return NULL;
#endif
@@ -159,11 +195,18 @@
#ifdef YP
const char *name;
int af;
+ struct hostent *host;
+ char *hostbuf;
+ int hostbuflen;
name = va_arg(ap, const char *);
af = va_arg(ap, int);
+ host = va_arg(ap, struct hostent *);
+ hostbuf = va_arg(ap, char *);
+ hostbuflen = va_arg(ap, int);
- *(struct hostent **)rval = _gethostbynis(name, "hosts.byname", af);
+ *(struct hostent **)rval = _gethostbynis(name, "hosts.byname", af,
+ host, hostbuf, hostbuflen);
return (*(struct hostent **)rval != NULL) ? NS_SUCCESS : NS_NOTFOUND;
#else
return NS_UNAVAIL;
@@ -177,12 +220,19 @@
const char *addr;
int len;
int af;
+ struct hostent *host;
+ char *hostbuf;
+ int hostbuflen;
addr = va_arg(ap, const char *);
len = va_arg(ap, int);
af = va_arg(ap, int);
-
- *(struct hostent **)rval =_gethostbynis(inet_ntoa(*(struct in_addr *)addr),"hosts.byaddr", af);
+ host = va_arg(ap, struct hostent *);
+ hostbuf = va_arg(ap, char *);
+ hostbuflen = va_arg(ap, int);
+
+ *(struct hostent **)rval =_gethostbynis(inet_ntoa(*(struct in_addr *)addr),
+ "hosts.byaddr", af, host, hostbuf, hostbuflen);
return (*(struct hostent **)rval != NULL) ? NS_SUCCESS : NS_NOTFOUND;
#else
return NS_UNAVAIL;
Index: src/lib/libc/net/gethostnamadr.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/net/gethostnamadr.c,v
retrieving revision 1.20
diff -d -u -r1.20 gethostnamadr.c
--- src/lib/libc/net/gethostnamadr.c 22 Mar 2002 21:52:29 -0000 1.20
+++ src/lib/libc/net/gethostnamadr.c 10 Aug 2002 10:03:52 -0000
@@ -31,6 +31,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -46,6 +47,10 @@
extern int _dns_gethostbyaddr(void *, void *, va_list);
extern int _nis_gethostbyaddr(void *, void *, va_list);
+static char *h_addr_ptrs[MAXADDRS + 1];
+static char *host_aliases[MAXALIASES];
+static struct hostent host_s = { NULL, host_aliases, 0, 0, h_addr_ptrs };
+
/* Host lookup order if nsswitch.conf is broken or nonexistant */
static const ns_src default_src[] = {
{ NSSRC_FILES, NS_SUCCESS },
@@ -53,25 +58,38 @@
{ 0 }
};
-struct hostent *
-gethostbyname(const char *name)
+int
+gethostbyname_r(const char *name, struct hostent *resp,
+ char *buffer, int buflen, int *h_errnop)
{
- struct hostent *hp;
+ int rval;
if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
- h_errno = NETDB_INTERNAL;
- return (NULL);
+ *h_errnop = NO_RECOVERY;
+ return (NETDB_INTERNAL);
}
if (_res.options & RES_USE_INET6) { /* XXX */
- hp = gethostbyname2(name, AF_INET6); /* XXX */
- if (hp) /* XXX */
- return (hp); /* XXX */
+ rval = gethostbyname2_r(name, AF_INET6, resp,
+ buffer, buflen, h_errnop); /* XXX */
+ if (rval == 0) /* XXX */
+ return (0); /* XXX */
} /* XXX */
- return (gethostbyname2(name, AF_INET));
+ return (gethostbyname2_r(name, AF_INET, resp,
+ buffer, buflen, h_errnop));
}
struct hostent *
-gethostbyname2(const char *name, int type)
+gethostbyname(const char *name)
+{
+ int rval;
+
+ rval = gethostbyname_r(name, &host_s, NULL, 0, &h_errno);
+ return (rval == 0 ? &host_s : NULL);
+}
+
+int
+gethostbyname2_r(const char *name, int type, struct hostent *resp,
+ char *buffer, int buflen, int *h_errnop)
{
struct hostent *hp = 0;
int rval;
@@ -82,18 +100,29 @@
NS_NIS_CB(_nis_gethostbyname, NULL) /* force -DHESIOD */
{ 0 }
};
-
+
rval = nsdispatch((void *)&hp, dtab, NSDB_HOSTS, "gethostbyname",
- default_src, name, type);
+ default_src, name, type, resp, buffer, buflen);
+ *h_errnop = h_errno;
if (rval != NS_SUCCESS)
- return NULL;
+ return ((errno == 0) ? -1 : errno); /* Be paranoid */
else
- return hp;
+ return (0);
}
struct hostent *
-gethostbyaddr(const char *addr, int len, int type)
+gethostbyname2(const char *name, int type)
+{
+ int rval;
+
+ rval = gethostbyname2_r(name, type, &host_s, NULL, 0, &h_errno);
+ return (rval == 0 ? &host_s : NULL);
+}
+
+int
+gethostbyaddr_r(const char *addr, int len, int type, struct hostent *resp,
+ char *buffer, int buflen, int *h_errnop)
{
struct hostent *hp = 0;
int rval;
@@ -106,37 +135,28 @@
};
rval = nsdispatch((void *)&hp, dtab, NSDB_HOSTS, "gethostbyaddr",
- default_src, addr, len, type);
+ default_src, addr, len, type, resp, buffer, buflen);
+ *h_errnop = h_errno;
if (rval != NS_SUCCESS)
- return NULL;
+ return ((errno == 0) ? -1 : errno); /* Be paranoid */
else
- return hp;
+ return (0);
}
-struct hostent_data;
-
-/*
- * Temporary function (not thread safe)
- */
-int gethostbyaddr_r(const char *addr, int len, int type,
- struct hostent *result, struct hostent_data *buffer)
+struct hostent *
+gethostbyaddr(const char *addr, int len, int type)
{
- struct hostent *hp;
- int ret;
- if ((hp = gethostbyaddr(addr, len, type)) == NULL) {
- ret = -1;
- } else {
- memcpy(result, hp, sizeof(struct hostent));
- ret = 0;
- }
- return(ret);
+ int rval;
+
+ rval = gethostbyaddr_r(addr, len, type, NULL, NULL, 0, &h_errno);
+ return (rval == 0 ? &host_s : NULL);
}
void
-sethostent(stayopen)
- int stayopen;
+sethostent(int stayopen)
{
+
_sethosthtent(stayopen);
_sethostdnsent(stayopen);
}
@@ -144,6 +164,7 @@
void
endhostent()
{
+
_endhosthtent();
_endhostdnsent();
}
Index: src/lib/libc/net/getnetbydns.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/net/getnetbydns.c,v
retrieving revision 1.21
diff -d -u -r1.21 getnetbydns.c
--- src/lib/libc/net/getnetbydns.c 26 Jun 2002 14:18:36 -0000 1.21
+++ src/lib/libc/net/getnetbydns.c 10 Aug 2002 10:03:52 -0000
@@ -82,11 +82,8 @@
#include "res_config.h"
-extern int h_errno;
-
#define BYADDR 0
#define BYNAME 1
-#define MAXALIASES 35
#if PACKETSZ > 1024
#define MAXPACKET PACKETSZ
Index: src/lib/libc/net/getnetbyht.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/net/getnetbyht.c,v
retrieving revision 1.10
diff -d -u -r1.10 getnetbyht.c
--- src/lib/libc/net/getnetbyht.c 22 Mar 2002 21:52:29 -0000 1.10
+++ src/lib/libc/net/getnetbyht.c 10 Aug 2002 10:03:52 -0000
@@ -58,8 +58,7 @@
#include
#include
#include
-
-#define MAXALIASES 35
+#include
static FILE *netf;
static char line[BUFSIZ+1];
Index: src/lib/libc/net/getnetbynis.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/net/getnetbynis.c,v
retrieving revision 1.15
diff -d -u -r1.15 getnetbynis.c
--- src/lib/libc/net/getnetbynis.c 22 Mar 2002 21:52:29 -0000 1.15
+++ src/lib/libc/net/getnetbynis.c 10 Aug 2002 10:03:52 -0000
@@ -44,9 +44,7 @@
#include
#include
#endif
-
-#define MAXALIASES 35
-#define MAXADDRS 35
+#include
#ifdef YP
static char *host_aliases[MAXALIASES];
Index: src/lib/libc/net/herror.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/net/herror.c,v
retrieving revision 1.11
diff -d -u -r1.11 herror.c
--- src/lib/libc/net/herror.c 22 Mar 2002 21:52:29 -0000 1.11
+++ src/lib/libc/net/herror.c 10 Aug 2002 10:03:52 -0000
@@ -71,8 +71,6 @@
};
int h_nerr = { sizeof h_errlist / sizeof h_errlist[0] };
-int h_errno;
-
/*
* herror --
* print the error indicated by the h_errno value.
@@ -110,3 +108,19 @@
return (h_errlist[err]);
return ("Unknown resolver error");
}
+
+#undef h_errno
+int h_errno;
+
+/*
+ * Declare a weak reference in case the application is not linked
+ * with libpthread.
+ */
+__weak_reference(__h_errno_accessor_unthreaded, __h_errno_accessor);
+
+int *
+__h_errno_accessor_unthreaded()
+{
+ return &h_errno;
+}
+
Index: src/lib/libc/net/res_init.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/net/res_init.c,v
retrieving revision 1.29
diff -d -u -r1.29 res_init.c
--- src/lib/libc/net/res_init.c 22 Mar 2002 21:52:30 -0000 1.29
+++ src/lib/libc/net/res_init.c 10 Aug 2002 10:03:55 -0000
@@ -104,17 +104,6 @@
# define isascii(c) (!(c & 0200))
#endif
-/*
- * Resolver state default settings.
- */
-
-struct __res_state _res
-# if defined(__BIND_RES_TEXT)
- = { RES_TIMEOUT, } /* Motorola, et al. */
-# endif
- ;
-
-struct __res_state_ext _res_ext;
/*
* Set up default settings. If the configuration file exist, the values
@@ -154,6 +143,9 @@
#ifndef RFC1535
int dots;
#endif
+
+ if(&_res_data==NULL)
+ return -1;
/*
* These three fields used to be statically initialized. This made
@@ -582,3 +574,43 @@
*/
#undef res_init
__weak_reference(__res_init, res_init);
+
+/*
+ * Resolver state default settings.
+ */
+
+#undef _res
+#undef _res_ext
+#undef _res_data
+
+struct __res_state _res
+# if defined(__BIND_RES_TEXT)
+ = { RES_TIMEOUT, } /* Motorola, et al. */
+# endif
+ ;
+
+struct __res_state_ext _res_ext;
+
+struct __res_data _res_data = { 0, -1, 0, 0, 0, NULL, NULL, NULL, 0, &_res,
+ &_res_ext };
+
+/*
+ * Declare a weak reference in case the application is not linked
+ * with libpthread.
+ */
+__weak_reference(__res_data_accessor_unthreaded, __res_data_accessor);
+__weak_reference(__res_accessor_unthreaded, __res_accessor);
+
+struct __res_data *
+__res_data_accessor_unthreaded()
+{
+
+ return &_res_data;
+}
+
+struct __res_state *
+__res_accessor_unthreaded()
+{
+
+ return _res_data.res;
+}
Index: src/lib/libc/net/res_query.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/net/res_query.c,v
retrieving revision 1.23
diff -d -u -r1.23 res_query.c
--- src/lib/libc/net/res_query.c 7 Jul 2002 11:28:28 -0000 1.23
+++ src/lib/libc/net/res_query.c 10 Aug 2002 10:03:55 -0000
@@ -87,6 +87,7 @@
#include
#include
#include
+#include
#include "res_config.h"
@@ -374,11 +375,20 @@
hostalias(name)
const char *name;
{
+ static char abuf[MAXDNAME];
+ return (hostalias_r(name, abuf, sizeof abuf));
+}
+
+const char *
+hostalias_r(name, abuf, len)
+ const char *name;
+ char *abuf;
+ int len;
+{
char *cp1, *cp2;
FILE *fp;
char *file;
char buf[BUFSIZ];
- static char abuf[MAXDNAME];
if (_res.options & RES_NOALIASES)
return (NULL);
@@ -402,8 +412,8 @@
break;
for (cp2 = cp1 + 1; *cp2 && !isspace((unsigned char)*cp2); ++cp2)
;
- abuf[sizeof(abuf) - 1] = *cp2 = '\0';
- strncpy(abuf, cp1, sizeof(abuf) - 1);
+ abuf[len - 1] = *cp2 = '\0';
+ strncpy(abuf, cp1, len - 1);
fclose(fp);
return (abuf);
}
Index: src/lib/libc/net/res_send.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/net/res_send.c,v
retrieving revision 1.45
diff -d -u -r1.45 res_send.c
--- src/lib/libc/net/res_send.c 1 Apr 2002 16:09:45 -0000 1.45
+++ src/lib/libc/net/res_send.c 10 Aug 2002 10:03:56 -0000
@@ -102,13 +102,6 @@
#include "res_config.h"
-static int s = -1; /* socket used for communications */
-static int connected = 0; /* is the socket connected */
-static int vc = 0; /* is the socket a virtual circuit? */
-static int af = 0; /* address family of socket */
-static res_send_qhook Qhook = NULL;
-static res_send_rhook Rhook = NULL;
-
#define CAN_RECONNECT 1
@@ -170,7 +163,7 @@
res_send_qhook hook;
{
- Qhook = hook;
+ _res_data.Qhook = hook;
}
void
@@ -178,7 +171,7 @@
res_send_rhook hook;
{
- Rhook = hook;
+ _res_data.Rhook = hook;
}
static struct sockaddr * get_nsaddr(size_t);
@@ -406,13 +399,13 @@
goto next_ns;
}
- if (Qhook) {
+ if (_res_data.Qhook) {
int done = 0, loops = 0;
do {
res_sendhookact act;
- act = (*Qhook)((struct sockaddr_in **)&nsap,
+ act = (*_res_data.Qhook)((struct sockaddr_in **)&nsap,
&buf, &buflen,
ans, anssiz, &resplen);
switch (act) {
@@ -457,14 +450,14 @@
*/
try = _res.retry;
truncated = 0;
- if (s < 0 || !vc || hp->opcode == ns_o_update ||
- af != nsap->sa_family) {
- if (s >= 0)
+ if (_res_data.s < 0 || !_res_data.vc || hp->opcode == ns_o_update ||
+ _res_data.af != nsap->sa_family) {
+ if (_res_data.s >= 0)
res_close();
- af = nsap->sa_family;
- s = _socket(af, SOCK_STREAM, 0);
- if (s < 0) {
+ _res_data.af = nsap->sa_family;
+ _res_data.s = _socket(_res_data.af, SOCK_STREAM, 0);
+ if (_res_data.s < 0) {
terrno = errno;
Perror(stderr, "socket(vc)", errno);
badns |= (1 << ns);
@@ -472,7 +465,7 @@
goto next_ns;
}
errno = 0;
- if (_connect(s, nsap, salen) < 0) {
+ if (_connect(_res_data.s, nsap, salen) < 0) {
terrno = errno;
Aerror(stderr, "connect/vc",
errno, nsap);
@@ -480,7 +473,7 @@
res_close();
goto next_ns;
}
- vc = 1;
+ _res_data.vc = 1;
}
/*
* Send length & message
@@ -490,7 +483,7 @@
iov[0].iov_len = INT16SZ;
iov[1].iov_base = (caddr_t)buf;
iov[1].iov_len = buflen;
- if (_writev(s, iov, 2) != (INT16SZ + buflen)) {
+ if (_writev(_res_data.s, iov, 2) != (INT16SZ + buflen)) {
terrno = errno;
Perror(stderr, "write failed", errno);
badns |= (1 << ns);
@@ -503,7 +496,7 @@
read_len:
cp = ans;
len = INT16SZ;
- while ((n = _read(s, (char *)cp, (int)len)) > 0) {
+ while ((n = _read(_res_data.s, (char *)cp, (int)len)) > 0) {
cp += n;
if ((len -= n) <= 0)
break;
@@ -551,7 +544,7 @@
}
cp = ans;
while (len != 0 &&
- (n = _read(s, (char *)cp, (int)len)) > 0) {
+ (n = _read(_res_data.s, (char *)cp, (int)len)) > 0) {
cp += n;
len -= n;
}
@@ -574,7 +567,7 @@
n = (len > sizeof(junk)
? sizeof(junk)
: len);
- if ((n = _read(s, junk, n)) > 0)
+ if ((n = _read(_res_data.s, junk, n)) > 0)
len -= n;
else
break;
@@ -604,12 +597,13 @@
struct sockaddr_storage from;
int fromlen;
- if (s < 0 || vc || af != nsap->sa_family) {
- if (vc)
+ if (_res_data.s < 0 || _res_data.vc ||
+ _res_data.af != nsap->sa_family) {
+ if (_res_data.vc)
res_close();
- af = nsap->sa_family;
- s = _socket(af, SOCK_DGRAM, 0);
- if (s < 0) {
+ _res_data.af = nsap->sa_family;
+ _res_data.s = _socket(_res_data.af, SOCK_DGRAM, 0);
+ if (_res_data.s < 0) {
#ifndef CAN_RECONNECT
bad_dg_sock:
#endif
@@ -619,7 +613,7 @@
res_close();
goto next_ns;
}
- connected = 0;
+ _res_data.connected = 0;
}
#ifndef CANNOT_CONNECT_DGRAM
/*
@@ -650,8 +644,8 @@
* Connect only if we are sure we won't
* receive a response from another server.
*/
- if (!connected) {
- if (_connect(s, nsap, salen) < 0) {
+ if (!_res_data.connected) {
+ if (_connect(_res_data.s, nsap, salen) < 0) {
Aerror(stderr,
"connect(dg)",
errno, nsap);
@@ -659,9 +653,9 @@
res_close();
goto next_ns;
}
- connected = 1;
+ _res_data.connected = 1;
}
- if (send(s, (char*)buf, buflen, 0) != buflen) {
+ if (send(_res_data.s, (char*)buf, buflen, 0) != buflen) {
Perror(stderr, "send", errno);
badns |= (1 << ns);
res_close();
@@ -672,7 +666,7 @@
* Disconnect if we want to listen
* for responses from more than one server.
*/
- if (connected) {
+ if (_res_data.connected) {
#ifdef CAN_RECONNECT
/* XXX: any errornous address */
struct sockaddr_in no_addr;
@@ -680,24 +674,24 @@
no_addr.sin_family = AF_INET;
no_addr.sin_addr.s_addr = INADDR_ANY;
no_addr.sin_port = 0;
- (void) _connect(s,
+ (void) _connect(_res_data.s,
(struct sockaddr *)
&no_addr,
sizeof no_addr);
#else
- int s1 = _socket(af, SOCK_DGRAM,0);
+ int s1 = _socket(_res_data.af, SOCK_DGRAM,0);
if (s1 < 0)
goto bad_dg_sock;
- (void)_dup2(s1, s);
+ (void)_dup2(s1, _res_data.s);
(void)_close(s1);
Dprint(_res.options & RES_DEBUG,
(stdout, ";; new DG socket\n"))
#endif /* CAN_RECONNECT */
- connected = 0;
+ _res_data.connected = 0;
errno = 0;
}
#endif /* !CANNOT_CONNECT_DGRAM */
- if (_sendto(s, (char*)buf, buflen, 0,
+ if (_sendto(_res_data.s, (char*)buf, buflen, 0,
nsap, salen) != buflen) {
Aerror(stderr, "sendto", errno, nsap);
badns |= (1 << ns);
@@ -722,13 +716,13 @@
(void) gettimeofday(&ctv, NULL);
timeradd(&timeout, &ctv, &timeout);
wait:
- if (s < 0) {
+ if (_res_data.s < 0) {
Perror(stderr, "s out-of-bounds", EMFILE);
res_close();
goto next_ns;
}
- EV_SET(&kv, s, EVFILT_READ, EV_ADD | EV_ONESHOT, 0,0,0);
+ EV_SET(&kv, _res_data.s, EVFILT_READ, EV_ADD | EV_ONESHOT, 0,0,0);
n = _kevent(kq, &kv, 1, &kv, 1, &ts);
if (n < 0) {
@@ -757,7 +751,7 @@
}
errno = 0;
fromlen = sizeof(from);
- resplen = _recvfrom(s, (char*)ans, anssiz, 0,
+ resplen = _recvfrom(_res_data.s, (char*)ans, anssiz, 0,
(struct sockaddr *)&from, &fromlen);
if (resplen <= 0) {
Perror(stderr, "recvfrom", errno);
@@ -862,13 +856,13 @@
!(_res.options & RES_STAYOPEN)) {
res_close();
}
- if (Rhook) {
+ if (_res_data.Rhook) {
int done = 0, loops = 0;
do {
res_sendhookact act;
- act = (*Rhook)((struct sockaddr_in *)nsap,
+ act = (*_res_data.Rhook)((struct sockaddr_in *)nsap,
buf, buflen,
ans, anssiz, &resplen);
switch (act) {
@@ -920,12 +914,12 @@
void
res_close()
{
- if (s >= 0) {
- (void)_close(s);
- s = -1;
- connected = 0;
- vc = 0;
- af = 0;
+ if (_res_data.s >= 0) {
+ (void)_close(_res_data.s);
+ _res_data.s = -1;
+ _res_data.connected = 0;
+ _res_data.vc = 0;
+ _res_data.af = 0;
}
}
Index: src/lib/libc_r/sys/Makefile.inc
===================================================================
RCS file: /home/ncvs/src/lib/libc_r/sys/Makefile.inc,v
retrieving revision 1.10
diff -d -u -r1.10 Makefile.inc
--- src/lib/libc_r/sys/Makefile.inc 28 Aug 1999 00:03:13 -0000 1.10
+++ src/lib/libc_r/sys/Makefile.inc 10 Aug 2002 10:03:56 -0000
@@ -2,5 +2,5 @@
.PATH: ${.CURDIR}/sys ${.CURDIR}/arch/${MACHINE_ARCH}
-SRCS+= uthread_error.c _atomic_lock.S
+SRCS+= uthread_error.c uthread_resolv.c _atomic_lock.S
Index: src/lib/libc_r/sys/uthread_resolv.c
===================================================================
RCS file: src/lib/libc_r/sys/uthread_resolv.c
diff -N src/lib/libc_r/sys/uthread_resolv.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/lib/libc_r/sys/uthread_resolv.c 10 Aug 2002 10:03:56 -0000
@@ -0,0 +1,151 @@
+/*-
+ * Copyright (c) 2001 Alexandr Litvin
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "pthread_private.h"
+
+#undef h_errno
+#undef _res
+#undef _res_ext
+#undef _res_data
+
+extern int h_errno;
+extern struct __res_data _res_data;
+
+static pthread_once_t once = PTHREAD_ONCE_INIT;
+static pthread_key_t key;
+
+
+static void
+__res_data_destroy(void *p)
+{
+ struct __res_data *_res_datap = (struct __res_data *)p;
+
+ if(_res_datap->res)
+ free(_res_datap->res);
+ if(_res_datap->res_ext)
+ free(_res_datap->res_ext);
+ if(_res_datap->s >= 0)
+ close(_res_datap->s);
+ if(_res_datap->hostf)
+ fclose(_res_datap->hostf);
+ free(_res_datap);
+}
+
+static void
+__res_data_init()
+{
+
+ pthread_key_create(&key, __res_data_destroy);
+}
+
+struct __res_data *
+__res_data_accessor()
+{
+ struct __res_data *_res_datap;
+
+ if (_thread_run == _thread_initial) {
+ _res_datap = &_res_data;
+ } else {
+ pthread_once(&once, __res_data_init);
+ _res_datap = (struct __res_data *)pthread_getspecific(key);
+ if(_res_datap==NULL) {
+ _res_datap = malloc(sizeof(struct __res_data));
+ if(_res_datap==NULL)
+ return (NULL);
+ bzero(_res_datap, sizeof(struct __res_data));
+ _res_datap->res = malloc(sizeof(struct __res_state));
+ if(_res_datap->res == NULL) {
+ free(_res_datap);
+ return (NULL);
+ }
+ bzero(_res_datap->res, sizeof(struct __res_state));
+ _res_datap->res_ext =
+ malloc(sizeof(struct __res_state_ext));
+ if(_res_datap->res_ext == NULL) {
+ free(_res_datap->res);
+ free(_res_datap);
+ return (NULL);
+ }
+ bzero(_res_datap->res_ext,
+ sizeof(struct __res_state_ext));
+ _res_datap->s = -1;
+ pthread_setspecific(key, _res_datap);
+ }
+ }
+ return (_res_datap);
+}
+
+static struct __res_state dummy_res;
+static int dummy_h_errno;
+
+struct __res_state *
+__res_accessor()
+{
+ struct __res_state *resp;
+ struct __res_data *_res_datap;
+
+ if (_thread_run == _thread_initial) {
+ resp = _res_data.res;
+ } else {
+ _res_datap = __res_data_accessor();
+ if(_res_datap) {
+ resp = _res_datap->res;
+ } else {
+ dummy_res.options = RES_DEFAULT;
+ resp = &dummy_res;
+ }
+ }
+ return (resp);
+}
+
+int *
+__h_errno_accessor()
+{
+ int *h_errnop;
+ struct __res_data *_res_datap;
+
+ if (_thread_run == _thread_initial) {
+ h_errnop = &h_errno;
+ } else {
+ _res_datap = __res_data_accessor();
+ if(_res_datap) {
+ h_errnop = &_res_datap->h_errno_res;
+ } else {
+ dummy_h_errno = NETDB_INTERNAL;
+ h_errnop = &dummy_h_errno;
+ }
+ }
+ return (h_errnop);
+}
--------------051496A982500B2DDF1E4FCD
Content-Type: text/plain; charset=koi8-r;
name="resolv_r-2.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="resolv_r-2.diff"
Index: src/include/netdb.h
===================================================================
RCS file: /home/ncvs/src/include/netdb.h,v
retrieving revision 1.24
diff -d -u -r1.24 netdb.h
--- src/include/netdb.h 26 Jun 2002 08:18:42 -0000 1.24
+++ src/include/netdb.h 12 Aug 2002 09:48:11 -0000
@@ -82,7 +82,10 @@
#define _PATH_PROTOCOLS "/etc/protocols"
#define _PATH_SERVICES "/etc/services"
-extern int h_errno;
+__BEGIN_DECLS
+int * __h_errno_accessor(void);
+__END_DECLS
+#define h_errno (* __h_errno_accessor())
/*
* Structures returned by network data base library. All addresses are
Index: src/include/resolv.h
===================================================================
RCS file: /home/ncvs/src/include/resolv.h,v
retrieving revision 1.21
diff -d -u -r1.21 resolv.h
--- src/include/resolv.h 23 Mar 2002 17:24:53 -0000 1.21
+++ src/include/resolv.h 12 Aug 2002 09:48:11 -0000
@@ -62,6 +62,7 @@
#include
#include
#include
+#include
/*
* Revision information. This is the release date in YYYYMMDD format.
@@ -90,6 +91,8 @@
#define MAXDFLSRCH 3 /* # default domain levels to try */
#define MAXDNSRCH 6 /* max # domains in search path */
#define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */
+#define MAXALIASES 35 /* max # of aliases to return */
+#define MAXADDRS 35 /* max # of addresses to return */
#define RES_TIMEOUT 5 /* min. seconds between retries */
#define MAXRESOLVSORT 10 /* number of net to sort on */
@@ -198,10 +201,6 @@
char * humanname; /* Its fun name, like "mail exchanger" */
};
-extern struct __res_state _res;
-/* for INET6 */
-extern struct __res_state_ext _res_ext;
-
extern const struct res_sym __p_class_syms[];
extern const struct res_sym __p_type_syms[];
@@ -224,6 +223,7 @@
#define fp_query __fp_query
#define fp_nquery __fp_nquery
#define hostalias __hostalias
+#define hostalias_r __hostalias_r
#define putlong __putlong
#define putshort __putshort
#define p_class __p_class
@@ -273,6 +273,7 @@
void fp_query(const u_char *, FILE *);
void fp_nquery(const u_char *, int, FILE *);
const char * hostalias(const char *);
+const char * hostalias_r(const char *, char *, int);
void putlong(u_int32_t, u_char *);
void putshort(u_int16_t, u_char *);
const char * p_class(int);
@@ -315,5 +316,35 @@
void res_freeupdrec(ns_updrec *);
#endif
__END_DECLS
+
+struct __res_data {
+ int h_errno_res;
+ int s; /* socket used for communications */
+ int connected : 1; /* is the socket connected */
+ int vc : 1; /* is the socket a virtual circuit? */
+ int af; /* address family of socket */
+ res_send_qhook Qhook;
+ res_send_rhook Rhook;
+ FILE* hostf;
+ int stayopen;
+ struct hostent host;
+ char *hostbuf;
+ int hostbuflen;
+ u_char *host_addr;
+ int host_addrlen;
+ struct __res_state *res;
+ struct __res_state_ext *res_ext;
+};
+
+__BEGIN_DECLS
+u_int16_t _getshort(const u_char *);
+u_int32_t _getlong(const u_char *);
+struct __res_data * __res_data_accessor(void);
+struct __res_state * __res_accessor(void);
+__END_DECLS
+#define _res_data (* __res_data_accessor())
+#define _res (* __res_accessor())
+/* for INET6 */
+#define _res_ext (* (__res_data_accessor()->res_ext))
#endif /* !_RESOLV_H_ */
Index: src/lib/libc/net/getaddrinfo.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/net/getaddrinfo.c,v
retrieving revision 1.28
diff -d -u -r1.28 getaddrinfo.c
--- src/lib/libc/net/getaddrinfo.c 2 Aug 2002 11:58:48 -0000 1.28
+++ src/lib/libc/net/getaddrinfo.c 12 Aug 2002 09:48:17 -0000
@@ -1673,7 +1673,6 @@
/* resolver logic */
extern const char *__hostalias(const char *);
-extern int h_errno;
/*
* Formulate a normal query, send, and await answer.
Index: src/lib/libc/net/gethostbydns.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/net/gethostbydns.c,v
retrieving revision 1.36
diff -d -u -r1.36 gethostbydns.c
--- src/lib/libc/net/gethostbydns.c 26 Jun 2002 14:18:36 -0000 1.36
+++ src/lib/libc/net/gethostbydns.c 12 Aug 2002 09:48:17 -0000
@@ -68,6 +68,7 @@
#include
#include
+#include
#include
#include
#include
@@ -82,19 +83,9 @@
#define SPRINTF(x) ((size_t)sprintf x)
-#define MAXALIASES 35
-#define MAXADDRS 35
-
static const char AskedForGot[] =
"gethostby*.gethostanswer: asked for \"%s\", got \"%s\"";
-static char *h_addr_ptrs[MAXADDRS + 1];
-
-static struct hostent host;
-static char *host_aliases[MAXALIASES];
-static char hostbuf[8*1024];
-static u_char host_addr[16]; /* IPv4 or IPv6 */
-
#ifdef RESOLVSORT
static void addrsort(char **, int);
#endif
@@ -119,7 +110,6 @@
char ac;
} align;
-extern int h_errno;
int _dns_ttl_;
#ifdef DEBUG
@@ -157,11 +147,14 @@
} while (0)
static struct hostent *
-gethostanswer(answer, anslen, qname, qtype)
+gethostanswer(answer, anslen, qname, qtype, host, hostbuf, hostbuflen)
const querybuf *answer;
int anslen;
const char *qname;
int qtype;
+ struct hostent *host;
+ char *hostbuf;
+ int hostbuflen;
{
const HEADER *hp;
const u_char *cp;
@@ -176,7 +169,7 @@
int (*name_ok)(const char *);
tname = qname;
- host.h_name = NULL;
+ host->h_name = NULL;
eom = answer->buf + anslen;
switch (qtype) {
case T_A:
@@ -197,7 +190,7 @@
ancount = ntohs(hp->ancount);
qdcount = ntohs(hp->qdcount);
bp = hostbuf;
- ep = hostbuf + sizeof hostbuf;
+ ep = hostbuf + hostbuflen;
cp = answer->buf;
BOUNDED_INCR(HFIXEDSZ);
if (qdcount != 1) {
@@ -220,17 +213,15 @@
h_errno = NO_RECOVERY;
return (NULL);
}
- host.h_name = bp;
+ host->h_name = bp;
bp += n;
/* The qname can be abbreviated, but h_name is now absolute. */
- qname = host.h_name;
+ qname = host->h_name;
}
- ap = host_aliases;
+ ap = host->h_aliases;
*ap = NULL;
- host.h_aliases = host_aliases;
- hap = h_addr_ptrs;
+ hap = host->h_addr_list;
*hap = NULL;
- host.h_addr_list = h_addr_ptrs;
haveanswer = 0;
had_error = 0;
_dns_ttl_ = -1;
@@ -259,7 +250,7 @@
continue; /* XXX - had_error++ ? */
}
if ((qtype == T_A || qtype == T_AAAA) && type == T_CNAME) {
- if (ap >= &host_aliases[MAXALIASES-1])
+ if (ap >= &host->h_aliases[MAXALIASES-1])
continue;
n = dn_expand(answer->buf, eom, cp, tbuf, sizeof tbuf);
if ((n < 0) || !(*name_ok)(tbuf)) {
@@ -286,7 +277,7 @@
continue;
}
strcpy(bp, tbuf);
- host.h_name = bp;
+ host->h_name = bp;
bp += n;
continue;
}
@@ -341,8 +332,8 @@
return (NULL);
}
if (!haveanswer)
- host.h_name = bp;
- else if (ap < &host_aliases[MAXALIASES-1])
+ host->h_name = bp;
+ else if (ap < &host->h_aliases[MAXALIASES-1])
*ap++ = bp;
else
n = -1;
@@ -356,7 +347,7 @@
}
break;
#else
- host.h_name = bp;
+ host->h_name = bp;
if (_res.options & RES_USE_INET6) {
n = strlen(bp) + 1; /* for the \0 */
if (n >= MAXHOSTNAMELEN) {
@@ -364,27 +355,27 @@
break;
}
bp += n;
- _map_v4v6_hostent(&host, &bp, &ep);
+ _map_v4v6_hostent(host, &bp, &ep);
}
h_errno = NETDB_SUCCESS;
- return (&host);
+ return (host);
#endif
case T_A:
case T_AAAA:
- if (strcasecmp(host.h_name, bp) != 0) {
+ if (strcasecmp(host->h_name, bp) != 0) {
syslog(LOG_NOTICE|LOG_AUTH,
- AskedForGot, host.h_name, bp);
+ AskedForGot, host->h_name, bp);
cp += n;
continue; /* XXX - had_error++ ? */
}
- if (n != host.h_length) {
+ if (n != host->h_length) {
cp += n;
continue;
}
if (!haveanswer) {
int nn;
- host.h_name = bp;
+ host->h_name = bp;
nn = strlen(bp) + 1; /* for the \0 */
bp += nn;
}
@@ -396,7 +387,7 @@
had_error++;
continue;
}
- if (hap >= &h_addr_ptrs[MAXADDRS-1]) {
+ if (hap >= &host->h_addr_list[MAXADDRS-1]) {
if (!toobig++)
dprintf("Too many addresses (%d)\n",
MAXADDRS);
@@ -430,57 +421,40 @@
* address in that case, not some random one
*/
if (_res.nsort && haveanswer > 1 && qtype == T_A)
- addrsort(h_addr_ptrs, haveanswer);
+ addrsort(host->h_addr_list, haveanswer);
# endif /*RESOLVSORT*/
- if (!host.h_name) {
+ if (!host->h_name) {
n = strlen(qname) + 1; /* for the \0 */
if (n > ep - bp || n >= MAXHOSTNAMELEN)
goto no_recovery;
strcpy(bp, qname);
- host.h_name = bp;
+ host->h_name = bp;
bp += n;
}
if (_res.options & RES_USE_INET6)
- _map_v4v6_hostent(&host, &bp, &ep);
+ _map_v4v6_hostent(host, &bp, &ep);
h_errno = NETDB_SUCCESS;
- return (&host);
+ return (host);
}
no_recovery:
h_errno = NO_RECOVERY;
return (NULL);
}
-struct hostent *
-__dns_getanswer(answer, anslen, qname, qtype)
- const char *answer;
- int anslen;
- const char *qname;
- int qtype;
-{
- switch(qtype) {
- case T_AAAA:
- host.h_addrtype = AF_INET6;
- host.h_length = IN6ADDRSZ;
- break;
- case T_A:
- default:
- host.h_addrtype = AF_INET;
- host.h_length = INADDRSZ;
- break;
- }
-
- return(gethostanswer((const querybuf *)answer, anslen, qname, qtype));
-}
-
int
_dns_gethostbyname(void *rval, void *cb_data, va_list ap)
{
const char *name;
int af;
+ struct hostent *host;
+ char *hostbuf;
+ int hostbuflen;
+ u_char *host_addr;
querybuf buf;
const char *cp;
char *bp, *ep;
int n, size, type, len;
+ char abuf[MAXDNAME];
name = va_arg(ap, const char *);
af = va_arg(ap, int);
@@ -491,6 +465,11 @@
return NS_UNAVAIL;
}
+ host = &_res_data.host;
+ hostbuf = _res_data.hostbuf;
+ hostbuflen = _res_data.hostbuflen;
+ host_addr = _res_data.host_addr;
+
switch (af) {
case AF_INET:
size = INADDRSZ;
@@ -506,15 +485,15 @@
return NS_UNAVAIL;
}
- host.h_addrtype = af;
- host.h_length = size;
+ host->h_addrtype = af;
+ host->h_length = size;
/*
* if there aren't any dots, it could be a user-level alias.
* this is also done in res_query() since we are not the only
* function that looks up host names.
*/
- if (!strchr(name, '.') && (cp = __hostalias(name)))
+ if (!strchr(name, '.') && (cp = __hostalias_r(name, abuf, sizeof abuf)))
name = cp;
/*
@@ -538,17 +517,15 @@
strncpy(hostbuf, name, MAXDNAME);
hostbuf[MAXDNAME] = '\0';
bp = hostbuf + MAXDNAME;
- ep = hostbuf + sizeof hostbuf;
- host.h_name = hostbuf;
- host.h_aliases = host_aliases;
- host_aliases[0] = NULL;
- h_addr_ptrs[0] = (char *)host_addr;
- h_addr_ptrs[1] = NULL;
- host.h_addr_list = h_addr_ptrs;
+ ep = hostbuf + hostbuflen;
+ host->h_name = hostbuf;
+ host->h_aliases[0] = NULL;
+ host->h_addr_list[0] = (char *)host_addr;
+ host->h_addr_list[1] = NULL;
if (_res.options & RES_USE_INET6)
- _map_v4v6_hostent(&host, &bp, &ep);
+ _map_v4v6_hostent(host, &bp, &ep);
h_errno = NETDB_SUCCESS;
- *(struct hostent **)rval = &host;
+ *(struct hostent **)rval = host;
return NS_SUCCESS;
}
if (!isdigit((unsigned char)*cp) && *cp != '.')
@@ -572,15 +549,13 @@
strncpy(hostbuf, name, MAXDNAME);
hostbuf[MAXDNAME] = '\0';
bp = hostbuf + MAXDNAME;
- len = sizeof hostbuf - MAXDNAME;
- host.h_name = hostbuf;
- host.h_aliases = host_aliases;
- host_aliases[0] = NULL;
- h_addr_ptrs[0] = (char *)host_addr;
- h_addr_ptrs[1] = NULL;
- host.h_addr_list = h_addr_ptrs;
+ len = hostbuflen - MAXDNAME;
+ host->h_name = hostbuf;
+ host->h_aliases[0] = NULL;
+ host->h_addr_list[0] = (char *)host_addr;
+ host->h_addr_list[1] = NULL;
h_errno = NETDB_SUCCESS;
- *(struct hostent **)rval = &host;
+ *(struct hostent **)rval = host;
return NS_SUCCESS;
}
if (!isxdigit((unsigned char)*cp) && *cp != ':' && *cp != '.')
@@ -591,7 +566,8 @@
dprintf("res_search failed (%d)\n", n);
return NS_UNAVAIL;
}
- *(struct hostent **)rval = gethostanswer(&buf, n, name, type);
+ *(struct hostent **)rval = gethostanswer(&buf, n, name, type,
+ host, hostbuf, hostbuflen);
return (*(struct hostent **)rval != NULL) ? NS_SUCCESS : NS_NOTFOUND;
}
@@ -600,6 +576,9 @@
{
const char *addr; /* XXX should have been def'd as u_char! */
int len, af;
+ struct hostent *host;
+ char *hostbuf;
+ int hostbuflen;
const u_char *uaddr;
static const u_char mapped[] = { 0,0, 0,0, 0,0, 0,0, 0,0, 0xff,0xff };
static const u_char tunnelled[] = { 0,0, 0,0, 0,0, 0,0, 0,0, 0,0 };
@@ -607,6 +586,7 @@
querybuf buf;
struct hostent *hp;
char qbuf[MAXDNAME+1], *qp;
+ u_char *host_addr;
#ifdef SUNSECURITY
struct hostent *rhp;
char **haddr;
@@ -618,13 +598,19 @@
uaddr = (const u_char *)addr;
len = va_arg(ap, int);
af = va_arg(ap, int);
-
+
*(struct hostent **)rval = NULL;
if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
h_errno = NETDB_INTERNAL;
return NS_UNAVAIL;
}
+
+ host = &_res_data.host;
+ hostbuf = _res_data.hostbuf;
+ hostbuflen = _res_data.hostbuflen;
+ host_addr = _res_data.host_addr;
+
if (af == AF_INET6 && len == IN6ADDRSZ &&
(!bcmp(uaddr, mapped, sizeof mapped) ||
!bcmp(uaddr, tunnelled, sizeof tunnelled))) {
@@ -680,7 +666,8 @@
dprintf("static buffer is too small (%d)\n", n);
return NS_UNAVAIL;
}
- if (!(hp = gethostanswer(&buf, n, qbuf, T_PTR)))
+ if (!(hp = gethostanswer(&buf, n, qbuf, T_PTR, host, hostbuf,
+ hostbuflen)))
return NS_NOTFOUND; /* h_errno was set by gethostanswer() */
#ifdef SUNSECURITY
if (af == AF_INET) {
@@ -717,8 +704,8 @@
hp->h_addrtype = af;
hp->h_length = len;
bcopy(addr, host_addr, len);
- h_addr_ptrs[0] = (char *)host_addr;
- h_addr_ptrs[1] = NULL;
+ host->h_addr_list[0] = (char *)host_addr;
+ host->h_addr_list[1] = NULL;
if (af == AF_INET && (_res.options & RES_USE_INET6)) {
_map_v4v6_address((char*)host_addr, (char*)host_addr);
hp->h_addrtype = AF_INET6;
Index: src/lib/libc/net/gethostbyht.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/net/gethostbyht.c,v
retrieving revision 1.16
diff -d -u -r1.16 gethostbyht.c
--- src/lib/libc/net/gethostbyht.c 22 Mar 2002 21:52:29 -0000 1.16
+++ src/lib/libc/net/gethostbyht.c 12 Aug 2002 09:48:20 -0000
@@ -62,6 +62,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -70,33 +71,35 @@
#include /* XXX */
#include /* XXX */
-#define MAXALIASES 35
-
-static struct hostent host;
-static char *host_aliases[MAXALIASES];
-static char hostbuf[BUFSIZ+1];
-static FILE *hostf = NULL;
-static u_int32_t host_addr[4]; /* IPv4 or IPv6 */
-static char *h_addr_ptrs[2];
-static int stayopen = 0;
-
void
_sethosthtent(f)
int f;
{
- if (!hostf)
- hostf = fopen(_PATH_HOSTS, "r" );
+
+ if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+ h_errno = NETDB_INTERNAL;
+ return;
+ }
+
+ if (!_res_data.hostf)
+ _res_data.hostf = fopen(_PATH_HOSTS, "r" );
else
- rewind(hostf);
- stayopen = f;
+ rewind(_res_data.hostf);
+ _res_data.stayopen = f;
}
void
_endhosthtent()
{
- if (hostf && !stayopen) {
- (void) fclose(hostf);
- hostf = NULL;
+
+ if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+ h_errno = NETDB_INTERNAL;
+ return;
+ }
+
+ if (_res_data.hostf && !_res_data.stayopen) {
+ (void) fclose(_res_data.hostf);
+ _res_data.hostf = NULL;
}
}
@@ -106,13 +109,27 @@
char *p;
char *cp, **q;
int af, len;
+ struct hostent *host;
+ char *hostbuf;
+ int hostbuflen;
- if (!hostf && !(hostf = fopen(_PATH_HOSTS, "r" ))) {
+ if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+ h_errno = NETDB_INTERNAL;
+ return NULL;
+ }
+
+ host = &_res_data.host;
+ hostbuf = _res_data.hostbuf;
+ hostbuflen = _res_data.hostbuflen;
+ host->h_addr_list[0] = _res_data.host_addr;
+ host->h_addr_list[1] = NULL;
+
+ if (!_res_data.hostf && !(_res_data.hostf = fopen(_PATH_HOSTS, "r" ))) {
h_errno = NETDB_INTERNAL;
return (NULL);
}
again:
- if (!(p = fgets(hostbuf, sizeof hostbuf, hostf))) {
+ if (!(p = fgets(hostbuf, hostbuflen, _res_data.hostf))) {
h_errno = HOST_NOT_FOUND;
return (NULL);
}
@@ -124,12 +141,12 @@
if (!(cp = strpbrk(p, " \t")))
goto again;
*cp++ = '\0';
- if (inet_pton(AF_INET6, p, host_addr) > 0) {
+ if (inet_pton(AF_INET6, p, host->h_addr_list[0]) > 0) {
af = AF_INET6;
len = IN6ADDRSZ;
- } else if (inet_pton(AF_INET, p, host_addr) > 0) {
+ } else if (inet_pton(AF_INET, p, host->h_addr_list[0]) > 0) {
if (_res.options & RES_USE_INET6) {
- _map_v4v6_address((char*)host_addr, (char*)host_addr);
+ _map_v4v6_address(host->h_addr_list[0], host->h_addr_list[0]);
af = AF_INET6;
len = IN6ADDRSZ;
} else {
@@ -139,15 +156,12 @@
} else {
goto again;
}
- h_addr_ptrs[0] = (char *)host_addr;
- h_addr_ptrs[1] = NULL;
- host.h_addr_list = h_addr_ptrs;
- host.h_length = len;
- host.h_addrtype = af;
+ host->h_length = len;
+ host->h_addrtype = af;
while (*cp == ' ' || *cp == '\t')
cp++;
- host.h_name = cp;
- q = host.h_aliases = host_aliases;
+ host->h_name = cp;
+ q = host->h_aliases;
if ((cp = strpbrk(cp, " \t")) != NULL)
*cp++ = '\0';
while (cp && *cp) {
@@ -155,14 +169,14 @@
cp++;
continue;
}
- if (q < &host_aliases[MAXALIASES - 1])
+ if (q < &host->h_aliases[MAXALIASES - 1])
*q++ = cp;
if ((cp = strpbrk(cp, " \t")) != NULL)
*cp++ = '\0';
}
*q = NULL;
h_errno = NETDB_SUCCESS;
- return (&host);
+ return (host);
}
int
@@ -175,7 +189,7 @@
name = va_arg(ap, const char *);
af = va_arg(ap, int);
-
+
sethostent(0);
while ((p = gethostent()) != NULL) {
if (p->h_addrtype != af)
Index: src/lib/libc/net/gethostbynis.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/net/gethostbynis.c,v
retrieving revision 1.15
diff -d -u -r1.15 gethostbynis.c
--- src/lib/libc/net/gethostbynis.c 22 Mar 2002 21:52:29 -0000 1.15
+++ src/lib/libc/net/gethostbynis.c 12 Aug 2002 09:48:20 -0000
@@ -44,16 +44,9 @@
#include
#include
#endif
-
-#define MAXALIASES 35
-#define MAXADDRS 35
-
-extern int h_errno;
+#include
#ifdef YP
-static char *host_aliases[MAXALIASES];
-static char hostaddr[MAXADDRS];
-static char *host_addrs[2];
static struct hostent *
_gethostbynis(name, map, af)
@@ -64,9 +57,20 @@
char *cp, **q;
char *result;
int resultlen,size;
- static struct hostent h;
static char *domain = (char *)NULL;
- static char ypbuf[YPMAXRECORD + 2];
+ struct hostent *host;
+ char *hostbuf;
+ int hostbuflen;
+
+ if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+ h_errno = NETDB_INTERNAL;
+ return NULL;
+ }
+
+ host = &_res_data.host;
+ hostbuf = _res_data.hostbuf;
+ hostbuflen = _res_data.hostbuflen;
+ host->h_addr_list[0] = _res_data.host_addr;
switch(af) {
case AF_INET:
@@ -90,27 +94,29 @@
h_errno = HOST_NOT_FOUND;
return ((struct hostent *)NULL);
}
-
- /* avoid potential memory leak */
- bcopy((char *)result, (char *)&ypbuf, resultlen);
- ypbuf[resultlen] = '\0';
+ if (resultlen > hostbuflen) {
+ h_errno = NETDB_INTERNAL;
+ errno = ERANGE;
+ return (NULL);
+ }
+ result[resultlen] = '\0';
+ bcopy((char *)result, hostbuf, resultlen);
free(result);
- result = (char *)&ypbuf;
+ result = hostbuf;
if ((cp = index(result, '\n')))
*cp = '\0';
cp = strpbrk(result, " \t");
*cp++ = '\0';
- h.h_addr_list = host_addrs;
- h.h_addr = hostaddr;
- *((u_long *)h.h_addr) = inet_addr(result);
- h.h_length = size;
- h.h_addrtype = AF_INET;
+ *((u_long *)host->h_addr_list[0]) = inet_addr(result);
+ host->h_addr_list[1] = NULL;
+ host->h_length = size;
+ host->h_addrtype = AF_INET;
while (*cp == ' ' || *cp == '\t')
cp++;
- h.h_name = cp;
- q = h.h_aliases = host_aliases;
+ host->h_name = cp;
+ q = host->h_aliases;
cp = strpbrk(cp, " \t");
if (cp != NULL)
*cp++ = '\0';
@@ -119,14 +125,14 @@
cp++;
continue;
}
- if (q < &host_aliases[MAXALIASES - 1])
+ if (q < &host->h_aliases[MAXALIASES - 1])
*q++ = cp;
cp = strpbrk(cp, " \t");
if (cp != NULL)
*cp++ = '\0';
}
*q = NULL;
- return (&h);
+ return (host);
}
#endif /* YP */
@@ -163,6 +169,11 @@
name = va_arg(ap, const char *);
af = va_arg(ap, int);
+ if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+ h_errno = NETDB_INTERNAL;
+ return NS_UNAVAIL;
+ }
+
*(struct hostent **)rval = _gethostbynis(name, "hosts.byname", af);
return (*(struct hostent **)rval != NULL) ? NS_SUCCESS : NS_NOTFOUND;
#else
@@ -181,8 +192,14 @@
addr = va_arg(ap, const char *);
len = va_arg(ap, int);
af = va_arg(ap, int);
-
- *(struct hostent **)rval =_gethostbynis(inet_ntoa(*(struct in_addr *)addr),"hosts.byaddr", af);
+
+ if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+ h_errno = NETDB_INTERNAL;
+ return NS_UNAVAIL;
+ }
+
+ *(struct hostent **)rval = _gethostbynis(
+ inet_ntoa(*(struct in_addr *)addr), "hosts.byaddr", af);
return (*(struct hostent **)rval != NULL) ? NS_SUCCESS : NS_NOTFOUND;
#else
return NS_UNAVAIL;
Index: src/lib/libc/net/gethostnamadr.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/net/gethostnamadr.c,v
retrieving revision 1.20
diff -d -u -r1.20 gethostnamadr.c
--- src/lib/libc/net/gethostnamadr.c 22 Mar 2002 21:52:29 -0000 1.20
+++ src/lib/libc/net/gethostnamadr.c 12 Aug 2002 09:48:20 -0000
@@ -31,6 +31,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -82,7 +83,7 @@
NS_NIS_CB(_nis_gethostbyname, NULL) /* force -DHESIOD */
{ 0 }
};
-
+
rval = nsdispatch((void *)&hp, dtab, NSDB_HOSTS, "gethostbyname",
default_src, name, type);
@@ -114,29 +115,10 @@
return hp;
}
-struct hostent_data;
-
-/*
- * Temporary function (not thread safe)
- */
-int gethostbyaddr_r(const char *addr, int len, int type,
- struct hostent *result, struct hostent_data *buffer)
-{
- struct hostent *hp;
- int ret;
- if ((hp = gethostbyaddr(addr, len, type)) == NULL) {
- ret = -1;
- } else {
- memcpy(result, hp, sizeof(struct hostent));
- ret = 0;
- }
- return(ret);
-}
-
void
-sethostent(stayopen)
- int stayopen;
+sethostent(int stayopen)
{
+
_sethosthtent(stayopen);
_sethostdnsent(stayopen);
}
@@ -144,6 +126,7 @@
void
endhostent()
{
+
_endhosthtent();
_endhostdnsent();
}
Index: src/lib/libc/net/getnetbydns.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/net/getnetbydns.c,v
retrieving revision 1.21
diff -d -u -r1.21 getnetbydns.c
--- src/lib/libc/net/getnetbydns.c 26 Jun 2002 14:18:36 -0000 1.21
+++ src/lib/libc/net/getnetbydns.c 12 Aug 2002 09:48:20 -0000
@@ -82,11 +82,8 @@
#include "res_config.h"
-extern int h_errno;
-
#define BYADDR 0
#define BYNAME 1
-#define MAXALIASES 35
#if PACKETSZ > 1024
#define MAXPACKET PACKETSZ
Index: src/lib/libc/net/getnetbyht.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/net/getnetbyht.c,v
retrieving revision 1.10
diff -d -u -r1.10 getnetbyht.c
--- src/lib/libc/net/getnetbyht.c 22 Mar 2002 21:52:29 -0000 1.10
+++ src/lib/libc/net/getnetbyht.c 12 Aug 2002 09:48:20 -0000
@@ -58,8 +58,7 @@
#include
#include
#include
-
-#define MAXALIASES 35
+#include
static FILE *netf;
static char line[BUFSIZ+1];
Index: src/lib/libc/net/getnetbynis.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/net/getnetbynis.c,v
retrieving revision 1.15
diff -d -u -r1.15 getnetbynis.c
--- src/lib/libc/net/getnetbynis.c 22 Mar 2002 21:52:29 -0000 1.15
+++ src/lib/libc/net/getnetbynis.c 12 Aug 2002 09:48:20 -0000
@@ -44,9 +44,7 @@
#include
#include
#endif
-
-#define MAXALIASES 35
-#define MAXADDRS 35
+#include
#ifdef YP
static char *host_aliases[MAXALIASES];
Index: src/lib/libc/net/herror.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/net/herror.c,v
retrieving revision 1.11
diff -d -u -r1.11 herror.c
--- src/lib/libc/net/herror.c 22 Mar 2002 21:52:29 -0000 1.11
+++ src/lib/libc/net/herror.c 12 Aug 2002 09:48:20 -0000
@@ -71,8 +71,6 @@
};
int h_nerr = { sizeof h_errlist / sizeof h_errlist[0] };
-int h_errno;
-
/*
* herror --
* print the error indicated by the h_errno value.
@@ -104,9 +102,26 @@
hstrerror(err)
int err;
{
+
if (err < 0)
return ("Resolver internal error");
else if (err < h_nerr)
return (h_errlist[err]);
return ("Unknown resolver error");
+}
+
+#undef h_errno
+int h_errno;
+
+/*
+ * Declare a weak reference in case the application is not linked
+ * with libpthread.
+ */
+__weak_reference(__h_errno_accessor_unthreaded, __h_errno_accessor);
+
+int *
+__h_errno_accessor_unthreaded()
+{
+
+ return &h_errno;
}
Index: src/lib/libc/net/res_init.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/net/res_init.c,v
retrieving revision 1.29
diff -d -u -r1.29 res_init.c
--- src/lib/libc/net/res_init.c 22 Mar 2002 21:52:30 -0000 1.29
+++ src/lib/libc/net/res_init.c 12 Aug 2002 09:48:22 -0000
@@ -83,12 +83,12 @@
#include
#include
#include
-#include
#include
#include
#include
#include
#include
+#include
#include "res_config.h"
@@ -104,17 +104,6 @@
# define isascii(c) (!(c & 0200))
#endif
-/*
- * Resolver state default settings.
- */
-
-struct __res_state _res
-# if defined(__BIND_RES_TEXT)
- = { RES_TIMEOUT, } /* Motorola, et al. */
-# endif
- ;
-
-struct __res_state_ext _res_ext;
/*
* Set up default settings. If the configuration file exist, the values
@@ -154,6 +143,10 @@
#ifndef RFC1535
int dots;
#endif
+
+ /* Ensure that _res_data is inited in the threaded case */
+ if(&_res_data == NULL)
+ return -1;
/*
* These three fields used to be statically initialized. This made
@@ -582,3 +575,49 @@
*/
#undef res_init
__weak_reference(__res_init, res_init);
+
+/*
+ * Resolver state default settings.
+ */
+
+#undef _res
+#undef _res_ext
+#undef _res_data
+
+struct __res_state _res
+# if defined(__BIND_RES_TEXT)
+ = { RES_TIMEOUT, } /* Motorola, et al. */
+# endif
+ ;
+
+struct __res_state_ext _res_ext;
+
+static char *host_aliases[MAXALIASES];
+static char *h_addr_ptrs[MAXADDRS + 1];
+static char hostbuf[8*1024];
+static u_char host_addr[16];
+
+struct __res_data _res_data = { 0, -1, 0, 0, 0, NULL, NULL, NULL, 0,
+ { NULL, host_aliases, 0, 0, h_addr_ptrs }, hostbuf, sizeof hostbuf,
+ host_addr, sizeof host_addr, &_res, &_res_ext };
+
+/*
+ * Declare a weak reference in case the application is not linked
+ * with libpthread.
+ */
+__weak_reference(__res_data_accessor_unthreaded, __res_data_accessor);
+__weak_reference(__res_accessor_unthreaded, __res_accessor);
+
+struct __res_data *
+__res_data_accessor_unthreaded()
+{
+
+ return &_res_data;
+}
+
+struct __res_state *
+__res_accessor_unthreaded()
+{
+
+ return _res_data.res;
+}
Index: src/lib/libc/net/res_query.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/net/res_query.c,v
retrieving revision 1.23
diff -d -u -r1.23 res_query.c
--- src/lib/libc/net/res_query.c 7 Jul 2002 11:28:28 -0000 1.23
+++ src/lib/libc/net/res_query.c 12 Aug 2002 09:48:22 -0000
@@ -87,6 +87,7 @@
#include
#include
#include
+#include
#include "res_config.h"
@@ -374,11 +375,21 @@
hostalias(name)
const char *name;
{
+ static char abuf[MAXDNAME];
+
+ return (hostalias_r(name, abuf, sizeof abuf));
+}
+
+const char *
+hostalias_r(name, abuf, len)
+ const char *name;
+ char *abuf;
+ int len;
+{
char *cp1, *cp2;
FILE *fp;
char *file;
char buf[BUFSIZ];
- static char abuf[MAXDNAME];
if (_res.options & RES_NOALIASES)
return (NULL);
@@ -402,8 +413,8 @@
break;
for (cp2 = cp1 + 1; *cp2 && !isspace((unsigned char)*cp2); ++cp2)
;
- abuf[sizeof(abuf) - 1] = *cp2 = '\0';
- strncpy(abuf, cp1, sizeof(abuf) - 1);
+ abuf[len - 1] = *cp2 = '\0';
+ strncpy(abuf, cp1, len - 1);
fclose(fp);
return (abuf);
}
Index: src/lib/libc/net/res_send.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/net/res_send.c,v
retrieving revision 1.45
diff -d -u -r1.45 res_send.c
--- src/lib/libc/net/res_send.c 1 Apr 2002 16:09:45 -0000 1.45
+++ src/lib/libc/net/res_send.c 12 Aug 2002 09:48:23 -0000
@@ -102,13 +102,6 @@
#include "res_config.h"
-static int s = -1; /* socket used for communications */
-static int connected = 0; /* is the socket connected */
-static int vc = 0; /* is the socket a virtual circuit? */
-static int af = 0; /* address family of socket */
-static res_send_qhook Qhook = NULL;
-static res_send_rhook Rhook = NULL;
-
#define CAN_RECONNECT 1
@@ -170,7 +163,7 @@
res_send_qhook hook;
{
- Qhook = hook;
+ _res_data.Qhook = hook;
}
void
@@ -178,7 +171,7 @@
res_send_rhook hook;
{
- Rhook = hook;
+ _res_data.Rhook = hook;
}
static struct sockaddr * get_nsaddr(size_t);
@@ -406,13 +399,13 @@
goto next_ns;
}
- if (Qhook) {
+ if (_res_data.Qhook) {
int done = 0, loops = 0;
do {
res_sendhookact act;
- act = (*Qhook)((struct sockaddr_in **)&nsap,
+ act = (*_res_data.Qhook)((struct sockaddr_in **)&nsap,
&buf, &buflen,
ans, anssiz, &resplen);
switch (act) {
@@ -457,14 +450,16 @@
*/
try = _res.retry;
truncated = 0;
- if (s < 0 || !vc || hp->opcode == ns_o_update ||
- af != nsap->sa_family) {
- if (s >= 0)
+ if (_res_data.s < 0 || !_res_data.vc ||
+ hp->opcode == ns_o_update ||
+ _res_data.af != nsap->sa_family) {
+ if (_res_data.s >= 0)
res_close();
- af = nsap->sa_family;
- s = _socket(af, SOCK_STREAM, 0);
- if (s < 0) {
+ _res_data.af = nsap->sa_family;
+ _res_data.s = _socket(_res_data.af, SOCK_STREAM,
+ 0);
+ if (_res_data.s < 0) {
terrno = errno;
Perror(stderr, "socket(vc)", errno);
badns |= (1 << ns);
@@ -472,7 +467,7 @@
goto next_ns;
}
errno = 0;
- if (_connect(s, nsap, salen) < 0) {
+ if (_connect(_res_data.s, nsap, salen) < 0) {
terrno = errno;
Aerror(stderr, "connect/vc",
errno, nsap);
@@ -480,7 +475,7 @@
res_close();
goto next_ns;
}
- vc = 1;
+ _res_data.vc = 1;
}
/*
* Send length & message
@@ -490,7 +485,7 @@
iov[0].iov_len = INT16SZ;
iov[1].iov_base = (caddr_t)buf;
iov[1].iov_len = buflen;
- if (_writev(s, iov, 2) != (INT16SZ + buflen)) {
+ if (_writev(_res_data.s, iov, 2) != (INT16SZ + buflen)) {
terrno = errno;
Perror(stderr, "write failed", errno);
badns |= (1 << ns);
@@ -503,7 +498,7 @@
read_len:
cp = ans;
len = INT16SZ;
- while ((n = _read(s, (char *)cp, (int)len)) > 0) {
+ while ((n = _read(_res_data.s, (char *)cp, (int)len)) > 0) {
cp += n;
if ((len -= n) <= 0)
break;
@@ -551,7 +546,7 @@
}
cp = ans;
while (len != 0 &&
- (n = _read(s, (char *)cp, (int)len)) > 0) {
+ (n = _read(_res_data.s, (char *)cp, (int)len)) > 0) {
cp += n;
len -= n;
}
@@ -574,7 +569,7 @@
n = (len > sizeof(junk)
? sizeof(junk)
: len);
- if ((n = _read(s, junk, n)) > 0)
+ if ((n = _read(_res_data.s, junk, n)) > 0)
len -= n;
else
break;
@@ -604,12 +599,14 @@
struct sockaddr_storage from;
int fromlen;
- if (s < 0 || vc || af != nsap->sa_family) {
- if (vc)
+ if (_res_data.s < 0 || _res_data.vc ||
+ _res_data.af != nsap->sa_family) {
+ if (_res_data.vc)
res_close();
- af = nsap->sa_family;
- s = _socket(af, SOCK_DGRAM, 0);
- if (s < 0) {
+ _res_data.af = nsap->sa_family;
+ _res_data.s = _socket(_res_data.af, SOCK_DGRAM,
+ 0);
+ if (_res_data.s < 0) {
#ifndef CAN_RECONNECT
bad_dg_sock:
#endif
@@ -619,7 +616,7 @@
res_close();
goto next_ns;
}
- connected = 0;
+ _res_data.connected = 0;
}
#ifndef CANNOT_CONNECT_DGRAM
/*
@@ -650,8 +647,9 @@
* Connect only if we are sure we won't
* receive a response from another server.
*/
- if (!connected) {
- if (_connect(s, nsap, salen) < 0) {
+ if (!_res_data.connected) {
+ if (_connect(_res_data.s, nsap, salen) <
+ 0) {
Aerror(stderr,
"connect(dg)",
errno, nsap);
@@ -659,9 +657,10 @@
res_close();
goto next_ns;
}
- connected = 1;
+ _res_data.connected = 1;
}
- if (send(s, (char*)buf, buflen, 0) != buflen) {
+ if (send(_res_data.s, (char*)buf, buflen, 0) !=
+ buflen) {
Perror(stderr, "send", errno);
badns |= (1 << ns);
res_close();
@@ -672,7 +671,7 @@
* Disconnect if we want to listen
* for responses from more than one server.
*/
- if (connected) {
+ if (_res_data.connected) {
#ifdef CAN_RECONNECT
/* XXX: any errornous address */
struct sockaddr_in no_addr;
@@ -680,24 +679,25 @@
no_addr.sin_family = AF_INET;
no_addr.sin_addr.s_addr = INADDR_ANY;
no_addr.sin_port = 0;
- (void) _connect(s,
+ (void) _connect(_res_data.s,
(struct sockaddr *)
&no_addr,
sizeof no_addr);
#else
- int s1 = _socket(af, SOCK_DGRAM,0);
+ int s1 = _socket(_res_data.af,
+ SOCK_DGRAM,0);
if (s1 < 0)
goto bad_dg_sock;
- (void)_dup2(s1, s);
+ (void)_dup2(s1, _res_data.s);
(void)_close(s1);
Dprint(_res.options & RES_DEBUG,
(stdout, ";; new DG socket\n"))
#endif /* CAN_RECONNECT */
- connected = 0;
+ _res_data.connected = 0;
errno = 0;
}
#endif /* !CANNOT_CONNECT_DGRAM */
- if (_sendto(s, (char*)buf, buflen, 0,
+ if (_sendto(_res_data.s, (char*)buf, buflen, 0,
nsap, salen) != buflen) {
Aerror(stderr, "sendto", errno, nsap);
badns |= (1 << ns);
@@ -722,13 +722,14 @@
(void) gettimeofday(&ctv, NULL);
timeradd(&timeout, &ctv, &timeout);
wait:
- if (s < 0) {
+ if (_res_data.s < 0) {
Perror(stderr, "s out-of-bounds", EMFILE);
res_close();
goto next_ns;
}
- EV_SET(&kv, s, EVFILT_READ, EV_ADD | EV_ONESHOT, 0,0,0);
+ EV_SET(&kv, _res_data.s, EVFILT_READ,
+ EV_ADD | EV_ONESHOT, 0,0,0);
n = _kevent(kq, &kv, 1, &kv, 1, &ts);
if (n < 0) {
@@ -757,7 +758,7 @@
}
errno = 0;
fromlen = sizeof(from);
- resplen = _recvfrom(s, (char*)ans, anssiz, 0,
+ resplen = _recvfrom(_res_data.s, (char*)ans, anssiz, 0,
(struct sockaddr *)&from, &fromlen);
if (resplen <= 0) {
Perror(stderr, "recvfrom", errno);
@@ -862,15 +863,15 @@
!(_res.options & RES_STAYOPEN)) {
res_close();
}
- if (Rhook) {
+ if (_res_data.Rhook) {
int done = 0, loops = 0;
do {
res_sendhookact act;
- act = (*Rhook)((struct sockaddr_in *)nsap,
- buf, buflen,
- ans, anssiz, &resplen);
+ act = (*_res_data.Rhook)(
+ (struct sockaddr_in *)nsap, buf, buflen,
+ ans, anssiz, &resplen);
switch (act) {
case res_goahead:
case res_done:
@@ -920,12 +921,12 @@
void
res_close()
{
- if (s >= 0) {
- (void)_close(s);
- s = -1;
- connected = 0;
- vc = 0;
- af = 0;
+ if (_res_data.s >= 0) {
+ (void)_close(_res_data.s);
+ _res_data.s = -1;
+ _res_data.connected = 0;
+ _res_data.vc = 0;
+ _res_data.af = 0;
}
}
Index: src/lib/libc_r/sys/Makefile.inc
===================================================================
RCS file: /home/ncvs/src/lib/libc_r/sys/Makefile.inc,v
retrieving revision 1.10
diff -d -u -r1.10 Makefile.inc
--- src/lib/libc_r/sys/Makefile.inc 28 Aug 1999 00:03:13 -0000 1.10
+++ src/lib/libc_r/sys/Makefile.inc 12 Aug 2002 09:48:23 -0000
@@ -2,5 +2,5 @@
.PATH: ${.CURDIR}/sys ${.CURDIR}/arch/${MACHINE_ARCH}
-SRCS+= uthread_error.c _atomic_lock.S
+SRCS+= uthread_error.c uthread_resolv.c _atomic_lock.S
Index: src/lib/libc_r/sys/uthread_resolv.c
===================================================================
RCS file: src/lib/libc_r/sys/uthread_resolv.c
diff -N src/lib/libc_r/sys/uthread_resolv.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/lib/libc_r/sys/uthread_resolv.c 12 Aug 2002 09:48:23 -0000
@@ -0,0 +1,186 @@
+/*-
+ * Copyright (c) 2001 Alexandr Litvin
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "pthread_private.h"
+
+#undef h_errno
+#undef _res
+#undef _res_ext
+#undef _res_data
+
+extern int h_errno;
+extern struct __res_data _res_data;
+
+static pthread_once_t once = PTHREAD_ONCE_INIT;
+static pthread_key_t key;
+
+
+static void
+__res_data_destroy(void *p)
+{
+ struct __res_data *_res_datap = (struct __res_data *)p;
+
+ if(_res_datap->res)
+ free(_res_datap->res);
+ if(_res_datap->res_ext)
+ free(_res_datap->res_ext);
+ if (_res_datap->host.h_aliases)
+ free(_res_datap->host.h_aliases);
+ if (_res_datap->host.h_addr_list)
+ free(_res_datap->host.h_addr_list);
+ if (_res_datap->hostbuf)
+ free(_res_datap->hostbuf);
+ if (_res_datap->host_addr)
+ free(_res_datap->host_addr);
+ if(_res_datap->s >= 0)
+ close(_res_datap->s);
+ if(_res_datap->hostf)
+ fclose(_res_datap->hostf);
+ free(_res_datap);
+}
+
+static void
+__res_data_init()
+{
+
+ pthread_key_create(&key, __res_data_destroy);
+}
+
+struct __res_data *
+__res_data_accessor()
+{
+ struct __res_data *_res_datap;
+
+ if (_thread_run == _thread_initial) {
+ _res_datap = &_res_data;
+ } else {
+ pthread_once(&once, __res_data_init);
+ _res_datap = (struct __res_data *)pthread_getspecific(key);
+ if(_res_datap==NULL) {
+ _res_datap = malloc(sizeof(struct __res_data));
+ if(_res_datap==NULL)
+ return (NULL);
+ bzero(_res_datap, sizeof(struct __res_data));
+ _res_datap->res = malloc(sizeof(struct __res_state));
+ if(_res_datap->res == NULL)
+ goto e1;
+ bzero(_res_datap->res, sizeof(struct __res_state));
+ _res_datap->res_ext =
+ malloc(sizeof(struct __res_state_ext));
+ if(_res_datap->res_ext == NULL)
+ goto e2;
+ bzero(_res_datap->res_ext,
+ sizeof(struct __res_state_ext));
+ _res_datap->s = -1;
+ _res_datap->host.h_name = NULL;
+ _res_datap->host.h_aliases =
+ malloc(sizeof(char *[MAXALIASES]));
+ if (_res_datap->host.h_aliases == NULL)
+ goto e3;
+ _res_datap->host.h_addrtype = 0;
+ _res_datap->host.h_length = 0;
+ _res_datap->host.h_addr_list =
+ malloc(sizeof(char *[MAXADDRS + 1]));
+ if (_res_datap->host.h_addr_list == NULL)
+ goto e4;
+ _res_datap->hostbuflen = sizeof(*_res_datap->hostbuf) *
+ 8 * 1024;
+ _res_datap->hostbuf = malloc(_res_datap->hostbuflen);
+ if (_res_datap->hostbuf == NULL)
+ goto e5;
+ _res_datap->host_addrlen =
+ sizeof(*_res_datap->host_addr) * 16;
+ _res_datap->host_addr =
+ malloc(_res_datap->host_addrlen);
+ if (_res_datap->host_addr == NULL)
+ goto e6;
+ pthread_setspecific(key, _res_datap);
+ }
+ }
+ return (_res_datap);
+
+e6: free(_res_datap->hostbuf);
+e5: free(_res_datap->host.h_addr_list);
+e4: free(_res_datap->host.h_aliases);
+e3: free(_res_datap->res_ext);
+e2: free(_res_datap->res);
+e1: free(_res_datap);
+ return (NULL);
+}
+
+static struct __res_state dummy_res;
+static int dummy_h_errno;
+
+struct __res_state *
+__res_accessor()
+{
+ struct __res_state *resp;
+ struct __res_data *_res_datap;
+
+ if (_thread_run == _thread_initial) {
+ resp = _res_data.res;
+ } else {
+ _res_datap = __res_data_accessor();
+ if(_res_datap) {
+ resp = _res_datap->res;
+ } else {
+ dummy_res.options = RES_DEFAULT;
+ resp = &dummy_res;
+ }
+ }
+ return (resp);
+}
+
+int *
+__h_errno_accessor()
+{
+ int *h_errnop;
+ struct __res_data *_res_datap;
+
+ if (_thread_run == _thread_initial) {
+ h_errnop = &h_errno;
+ } else {
+ _res_datap = __res_data_accessor();
+ if(_res_datap) {
+ h_errnop = &_res_datap->h_errno_res;
+ } else {
+ dummy_h_errno = NETDB_INTERNAL;
+ h_errnop = &dummy_h_errno;
+ }
+ }
+ return (h_errnop);
+}
--------------051496A982500B2DDF1E4FCD--
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
From owner-freebsd-hackers Mon Aug 12 3:39:11 2002
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
by hub.freebsd.org (Postfix) with ESMTP id CB7B237B400
for ; Mon, 12 Aug 2002 03:39:08 -0700 (PDT)
Received: from chiark.greenend.org.uk (chiark.greenend.org.uk [212.135.138.206])
by mx1.FreeBSD.org (Postfix) with ESMTP id EB1A643E6A
for ; Mon, 12 Aug 2002 03:39:07 -0700 (PDT)
(envelope-from fanf@chiark.greenend.org.uk)
Received: from fanf by chiark.greenend.org.uk with local (Exim 3.12 #1)
id 17eCbL-00077B-00 (Debian); Mon, 12 Aug 2002 11:39:07 +0100
Received: from fanf by chiark.greenend.org.uk with local (Exim 3.12 #1)
id 17dHyn-00054O-00 (Debian); Fri, 09 Aug 2002 23:11:33 +0100
Date: Fri, 9 Aug 2002 23:11:33 +0100
From: Tony Finch
To: freebsd-hackers@freebsd.org
Cc: dot@dotat.at
Subject: using mtree as tripwire
Message-ID: <20020809231133.D1697@chiark.greenend.org.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
List-ID:
List-Archive: (Web Archive)
List-Help: (List Instructions)
List-Subscribe:
List-Unsubscribe:
X-Loop: FreeBSD.ORG
I've been playing around with using mtree as a lightweight replacement
for tripwire, and it seems to work quite nicely. There are a few bits and
pieces: (1) a patch to make the -X exclude-file facility slightly more
flexible and easy-to-manage; (2) a script for creating the mtree spec
file containing all of the checksums; and (3) an /etc/periodic/security
script to do the mtree checksum comparison with reality.
I've parametrized (3) with a command for obtaining the spec file, for
people who keep it on a remote machine etc. so obviously (2) should have
a corresponding option. I suppose it could get it from periodic.conf
but that's a bit ugly since it isn't a periodic script. Does anyone have
any better ideas?
I'd also like to optionally run (2) as part of the installworld process,
and maybe include it as part of the standard distribution. I'm currently
keeping the file in /var/db/; I'm not sure whether or not that's better
than /etc/mtree/ -- it's over 7MB on my machine which is probably an
important consideration.
The patch to mtree and some of the scripts can be found at
http://people.FreeBSD.org/~fanf/FreeBSD/
Tony.
--
f.a.n.finch http://dotat.at/
SOUTH FITZROY: WESTERLY VEERING NORTHWESTERLY 4 OR 5, OCCASIONALLY 6 AT FIRST.
RAIN OR DRIZZLE AT TIMES. GOOD OCCASIONALLY MODERATE.
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
From owner-freebsd-hackers Mon Aug 12 3:42: 0 2002
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
by hub.freebsd.org (Postfix) with ESMTP id 6E51C37B400
for ; Mon, 12 Aug 2002 03:41:58 -0700 (PDT)
Received: from gull.mail.pas.earthlink.net (gull.mail.pas.earthlink.net [207.217.120.84])
by mx1.FreeBSD.org (Postfix) with ESMTP id 189AD43E5E
for ; Mon, 12 Aug 2002 03:41:58 -0700 (PDT)
(envelope-from tlambert2@mindspring.com)
Received: from pool0085.cvx21-bradley.dialup.earthlink.net ([209.179.192.85] helo=mindspring.com)
by gull.mail.pas.earthlink.net with esmtp (Exim 3.33 #1)
id 17eCe4-0006ik-00; Mon, 12 Aug 2002 03:41:57 -0700
Message-ID: <3D579024.5ABE33B7@mindspring.com>
Date: Mon, 12 Aug 2002 03:38:28 -0700
From: Terry Lambert
X-Mailer: Mozilla 4.79 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
To: ouyang kai
Cc: freebsd-hackers@FreeBSD.ORG
Subject: Re: Hi, how the kernel add the devices
References:
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
List-ID:
List-Archive: (Web Archive)
List-Help: (List Instructions)
List-Subscribe:
List-Unsubscribe:
X-Loop: FreeBSD.ORG
ouyang kai wrote:
>
> Part 1.1.1 Type: Plain Text (text/plain)
> Encoding: quoted-printable
>
> Name: kernel_init_problem.txt
> kernel_init_problem.txt Type: Plain Text (text/plain)
> Encoding: quoted-printable
If you are talking about the fxp driver, then you need to look
in /usr/src/sys/dev/fxp/if_fxp.c, around line 240:
DRIVER_MODULE(if_fxp, pci, fxp_driver, fxp_devclass, 0, 0);
DRIVER_MODULE(if_fxp, cardbus, fxp_driver, fxp_devclass, 0, 0);
DRIVER_MODULE(miibus, fxp, miibus_driver, miibus_devclass, 0, 0);
The definition of DRIVER_MODULE is variant, based on whether
the code is a loadable module, or is compiled into the kernel.
The original intent of the SYSINIT code was to erase the
distinction between code statically linked into the kernel,
and code loaded later, as a loadable module.
Specifically, the DRIVER_MODULE() macro uses the DECLARE_MODULE();
see /usr/src/sys/sys/bus.h, in which it specifies SI_SUB_DRIVERS
as the init_main.c code sort order, and the sub-order within that
as SI_ORDER_MIDDLE.
The DECLARE_MODULE() macro encapsulates a SYSINIT() entry; see
/usr/src/sys/sys/module.h.
The result is that the init_main.c code calls the entry point on
startup to probe the device (see /usr/src/sys/dev/fxp/if_fxp.c).
-- Terry
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
From owner-freebsd-hackers Mon Aug 12 3:53:30 2002
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
by hub.freebsd.org (Postfix) with ESMTP
id F221637B400; Mon, 12 Aug 2002 03:53:25 -0700 (PDT)
Received: from gull.mail.pas.earthlink.net (gull.mail.pas.earthlink.net [207.217.120.84])
by mx1.FreeBSD.org (Postfix) with ESMTP
id 93E4943E72; Mon, 12 Aug 2002 03:53:25 -0700 (PDT)
(envelope-from tlambert2@mindspring.com)
Received: from pool0085.cvx21-bradley.dialup.earthlink.net ([209.179.192.85] helo=mindspring.com)
by gull.mail.pas.earthlink.net with esmtp (Exim 3.33 #1)
id 17eCp9-0005Q5-00; Mon, 12 Aug 2002 03:53:24 -0700
Message-ID: <3D5792CD.497C80F0@mindspring.com>
Date: Mon, 12 Aug 2002 03:49:49 -0700
From: Terry Lambert
X-Mailer: Mozilla 4.79 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
To: Maxim Sobolev
Cc: hackers@FreeBSD.org, audit@FreeBSD.org,
Alexander Litvin ,
Andriy Gapon
Subject: Re: Thread-safe resolver [patches for review]
References: <3D578A99.F0821712@FreeBSD.org>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
List-ID:
List-Archive: (Web Archive)
List-Help: (List Instructions)
List-Subscribe:
List-Unsubscribe:
X-Loop: FreeBSD.ORG
Maxim Sobolev wrote:
> Attched please find two patches based on bin/29581 PR to make FreeBSD
> resolver thread-safe. They represent two approaches to reach this goal
> - the first is to introduce reentrant versions of the standard
> gethostbyXXX(3) APIs, similar to ones existing in other unices, and
> the second one is to make gethostbyXXX(3) returning data placed into
> per-thread storage when linked with libc_r. I like the latter approach
> more, since it doesn't introduce new non-standard APIs.
>
> I would like to hear any comments and suggestions on the proposed
> patches, as well as to opinions about which path to chose.
1) Allocate the per thread storage as a single blob, and
set the pointers into it, instead of using seperate
allocations. This will have the side effect of letting
you free it, all at once, and will tend to make it
faster on each first use per thread, anyway. You can
do this by making a meta structure containing the list
of structures to be allocated, and then setting the
pointers to the addresses of the structure subelements.
2) Note somewhere in the man page that this makes it so
you can not pass the results off to another thread by
reference, unless you copy them once there (i.e. you
are not allowed persistant references accross threads).
It seems to me the most likely use would be to permit
a seperate thread (or threads) to be used to resolve
concurrently, and/or with other operations. The upshot
of this is that holding a reference would mean that you
could not initiate another lookup on the lookup worker
thread(s) until the reference was freed.
You may also want to consider the use of a .init and .fini
section for the code, to permit the creation of an initial
lookup context chunk; this is kind of a tradeoff, but it will
mean that a server will not have to do the recheck each time.
The .fini section would aloow auto-cleanup. This may be a
necessity for a long running program that uses a shared object
to perform the thread creation and lookup (you could leak
memory, otherwise).
-- Terry
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
From owner-freebsd-hackers Mon Aug 12 5:18:46 2002
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
by hub.freebsd.org (Postfix) with ESMTP id 88AD737B400
for ; Mon, 12 Aug 2002 05:18:42 -0700 (PDT)
Received: from hotmail.com (oe40.pav0.hotmail.com [64.4.32.120])
by mx1.FreeBSD.org (Postfix) with ESMTP id 24F2E43E65
for ; Mon, 12 Aug 2002 05:18:42 -0700 (PDT)
(envelope-from oykai@msn.com)
Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC;
Mon, 12 Aug 2002 05:18:42 -0700
X-Originating-IP: [210.12.61.105]
From: "ouyang kai"
To: "Lambert Terry" ,
Subject: How the kernel add the devices when the kernel start
Date: Mon, 12 Aug 2002 20:18:34 +0800
MIME-Version: 1.0
X-Mailer: MSN Explorer 6.10.0016.1624
Content-Type: multipart/alternative; boundary="----=_NextPart_001_0004_01C2423D.6F19DF40"
Message-ID:
X-OriginalArrivalTime: 12 Aug 2002 12:18:42.0118 (UTC) FILETIME=[658D3E60:01C241FA]
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
List-ID:
List-Archive: (Web Archive)
List-Help: (List Instructions)
List-Subscribe:
List-Unsubscribe:
X-Loop: FreeBSD.ORG
------=_NextPart_001_0004_01C2423D.6F19DF40
Content-Type: text/plain; charset="gb2312"
Content-Transfer-Encoding: quoted-printable
Dear Terry,
(*((*sipp)->func))((*sipp)->udata);
=20
I saw the corresponding code based on your hints. I have some questions.=
=20
When the kernel process this code to check the SI_SUB_DRIVERS, it would =
find =20
the registed 'fxp' device(fxp_probe), right?
If the 'fxp' device is exist, the kernel will try to attach it(fxp_atta=
ch), right?
Another, If we do not compile the 'vr' device into the kernel and we d=
o load the corresponding 'ko',
so the kernel will not check the device, that is to say, the 'vr' device =
does not registe to kernel, right?
But, I have some problem :
1. When the kernel process the specified device, the 'func' means what? =20
For example: the member 'if_ioctl' of the structure 'ifnet', when the =
kernel process the 'fxp' device, I
know it should call the function 'fxp_ioctl'. But I do not the 'func' mea=
ns what when it check SI_SUB_DRIVERS.
2. In NetBSD, I can find main() function in init_main.c, but in FreeBSD, =
I could not find it, I am puzzled about
the place of the FreeBSD main process. =20
Thank you so much!
Best Regards
Ouyang KaiGet more from the Web. FREE MSN Explorer download : http://e=
xplorer.msn.com
------=_NextPart_001_0004_01C2423D.6F19DF40
Content-Type: text/html; charset="gb2312"
Content-Transfer-Encoding: quoted-printable
Dear Terry,
(*((*sipp)->func))((*sipp)->udata);
&=
nbsp;
I saw the corresponding code based on your hints. I have s=
ome questions.
When the kernel process this c=
ode to check the SI_SUB_DRIVERS, it would find
the registed 'fxp' dev=
ice(fxp_probe), right?
If the 'fxp' device is exist, the kernel=
will try to attach it(fxp_attach), right?
Another, If we=
do not compile the 'vr' device into the kernel and we do load the corres=
ponding 'ko',
so the kernel will not check the device, that is to say,=
the 'vr' device does not registe to kernel, right?
But, I have=
some problem :
1. When the kernel process the specified device, the '=
func' means what?
For example: the member 'if_ioctl' of =
the structure 'ifnet', when the kernel process the 'fxp' device, I
kno=
w it should call the function 'fxp_ioctl'. But I do not the 'func' means =
what when it check SI_SUB_DRIVERS.
2. In NetBSD, I can find main() fun=
ction in init_main.c, but in FreeBSD, I could not find it, I am puzzled a=
bout
the place of the FreeBSD main process.
Thank y=
ou so much!
Best Regards
Ouyang Kai
<=
/BODY>
Get more from the Web. FREE MSN Explore=
r download :
http://explorer.msn.com<=
/a>
------=_NextPart_001_0004_01C2423D.6F19DF40--
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
From owner-freebsd-hackers Mon Aug 12 5:23:58 2002
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
by hub.freebsd.org (Postfix) with ESMTP
id A2E1937B400; Mon, 12 Aug 2002 05:23:54 -0700 (PDT)
Received: from mail.pcnet.com (pcnet1.pcnet.com [204.213.232.3])
by mx1.FreeBSD.org (Postfix) with ESMTP
id CFC4243E86; Mon, 12 Aug 2002 05:23:53 -0700 (PDT)
(envelope-from eischen@pcnet1.pcnet.com)
Received: from localhost (eischen@localhost)
by mail.pcnet.com (8.12.3/8.12.1) with ESMTP id g7CCNmo9021178;
Mon, 12 Aug 2002 08:23:48 -0400 (EDT)
Date: Mon, 12 Aug 2002 08:23:48 -0400 (EDT)
From: Daniel Eischen
To: Maxim Sobolev
Cc: hackers@FreeBSD.ORG, audit@FreeBSD.ORG,
Alexander Litvin ,
Andriy Gapon
Subject: Re: Thread-safe resolver [patches for review]
In-Reply-To: <3D578A99.F0821712@FreeBSD.org>
Message-ID:
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
List-ID:
List-Archive: (Web Archive)
List-Help: (List Instructions)
List-Subscribe:
List-Unsubscribe:
X-Loop: FreeBSD.ORG
On Mon, 12 Aug 2002, Maxim Sobolev wrote:
> Folks,
>
> Attched please find two patches based on bin/29581 PR to make FreeBSD
> resolver thread-safe. They represent two approaches to reach this goal
> - the first is to introduce reentrant versions of the standard
> gethostbyXXX(3) APIs, similar to ones existing in other unices, and
> the second one is to make gethostbyXXX(3) returning data placed into
> per-thread storage when linked with libc_r. I like the latter approach
> more, since it doesn't introduce new non-standard APIs.
>
> I would like to hear any comments and suggestions on the proposed
> patches, as well as to opinions about which path to chose.
Why do you need uthread_resolv.c? You should be able to thread
calls by checking __isthreaded. Just keep everything in libc.
If there are missing stubs for some pthread_* routines (I think
everything you need is in -current's libc), then add them.
--
Dan Eischen
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
From owner-freebsd-hackers Mon Aug 12 5:28: 1 2002
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
by hub.freebsd.org (Postfix) with ESMTP
id 8F9B937B400; Mon, 12 Aug 2002 05:27:55 -0700 (PDT)
Received: from alcatraz.iptelecom.net.ua (alcatraz.iptelecom.net.ua [212.9.224.15])
by mx1.FreeBSD.org (Postfix) with ESMTP
id E533743E8A; Mon, 12 Aug 2002 05:27:50 -0700 (PDT)
(envelope-from sobomax@FreeBSD.org)
Received: from relay.iptelecom.net.ua (alcatraz.iptelecom.net.ua [212.9.224.15])
by alcatraz.iptelecom.net.ua (8.9.3/8.9.3) with ESMTP id PAA20856;
Mon, 12 Aug 2002 15:27:27 +0300 (EEST)
(envelope-from sobomax@FreeBSD.org)
Received: from vircheck.ipcard.iptcom.net (ipcard.iptcom.net [212.9.224.5])
by relay.iptelecom.net.ua (8.12.4/8.12.4) with ESMTP id g7CCRO8Y020796;
Mon, 12 Aug 2002 15:27:24 +0300 (EEST)
Received: from vega.vega.com (h210.234.dialup.iptcom.net [212.9.234.210])
by vircheck.ipcard.iptcom.net (8.12.3/8.12.3) with ESMTP id g7CCRIoQ021025;
Mon, 12 Aug 2002 15:27:21 +0300 (EEST)
Received: from FreeBSD.org (big_brother.vega.com [192.168.1.1])
by vega.vega.com (8.12.5/8.11.3) with ESMTP id g7CCRHF2039805;
Mon, 12 Aug 2002 15:27:17 +0300 (EEST)
(envelope-from sobomax@FreeBSD.org)
Message-ID: <3D57A9D4.DAA043EF@FreeBSD.org>
Date: Mon, 12 Aug 2002 15:28:04 +0300
From: Maxim Sobolev
Organization: Vega International Capital
X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U)
X-Accept-Language: en,uk,ru
MIME-Version: 1.0
To: Terry Lambert
Cc: hackers@FreeBSD.ORG, audit@FreeBSD.ORG,
Alexander Litvin ,
Andriy Gapon
Subject: Re: Thread-safe resolver [patches for review]
References: <3D578A99.F0821712@FreeBSD.org> <3D5792CD.497C80F0@mindspring.com>
Content-Type: text/plain; charset=koi8-r
Content-Transfer-Encoding: 7bit
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
List-ID:
List-Archive: (Web Archive)
List-Help: (List Instructions)
List-Subscribe:
List-Unsubscribe:
X-Loop: FreeBSD.ORG
Terry Lambert wrote:
>
> Maxim Sobolev wrote:
> > Attched please find two patches based on bin/29581 PR to make FreeBSD
> > resolver thread-safe. They represent two approaches to reach this goal
> > - the first is to introduce reentrant versions of the standard
> > gethostbyXXX(3) APIs, similar to ones existing in other unices, and
> > the second one is to make gethostbyXXX(3) returning data placed into
> > per-thread storage when linked with libc_r. I like the latter approach
> > more, since it doesn't introduce new non-standard APIs.
> >
> > I would like to hear any comments and suggestions on the proposed
> > patches, as well as to opinions about which path to chose.
>
> 1) Allocate the per thread storage as a single blob, and
> set the pointers into it, instead of using seperate
> allocations. This will have the side effect of letting
> you free it, all at once, and will tend to make it
> faster on each first use per thread, anyway. You can
> do this by making a meta structure containing the list
> of structures to be allocated, and then setting the
> pointers to the addresses of the structure subelements.
Ok, I'll do it.
> 2) Note somewhere in the man page that this makes it so
> you can not pass the results off to another thread by
> reference, unless you copy them once there (i.e. you
> are not allowed persistant references accross threads).
> It seems to me the most likely use would be to permit
> a seperate thread (or threads) to be used to resolve
> concurrently, and/or with other operations. The upshot
> of this is that holding a reference would mean that you
> could not initiate another lookup on the lookup worker
> thread(s) until the reference was freed.
Yuip, I'll do it as well.
> You may also want to consider the use of a .init and .fini
> section for the code, to permit the creation of an initial
> lookup context chunk; this is kind of a tradeoff, but it will
> mean that a server will not have to do the recheck each time.
> The .fini section would aloow auto-cleanup. This may be a
> necessity for a long running program that uses a shared object
> to perform the thread creation and lookup (you could leak
> memory, otherwise).
Could you please elaborate how exactly memory could be leaked in this
case, if the program does correctly shut down all its threads?
I also would like to hear from you whether or not you think that we
need all those gethostbyXXX_r(3) functions.
-Maxim
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
From owner-freebsd-hackers Mon Aug 12 5:33:55 2002
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
by hub.freebsd.org (Postfix) with ESMTP
id F283E37B400; Mon, 12 Aug 2002 05:33:50 -0700 (PDT)
Received: from alcatraz.iptelecom.net.ua (alcatraz.iptelecom.net.ua [212.9.224.15])
by mx1.FreeBSD.org (Postfix) with ESMTP
id 52BD243E3B; Mon, 12 Aug 2002 05:33:46 -0700 (PDT)
(envelope-from sobomax@FreeBSD.org)
Received: from relay.iptelecom.net.ua (alcatraz.iptelecom.net.ua [212.9.224.15])
by alcatraz.iptelecom.net.ua (8.9.3/8.9.3) with ESMTP id PAA29342;
Mon, 12 Aug 2002 15:33:26 +0300 (EEST)
(envelope-from sobomax@FreeBSD.org)
Received: from vircheck.ipcard.iptcom.net (ipcard.iptcom.net [212.9.224.5])
by relay.iptelecom.net.ua (8.12.4/8.12.4) with ESMTP id g7CCXM8Y029267;
Mon, 12 Aug 2002 15:33:23 +0300 (EEST)
Received: from vega.vega.com (h210.234.dialup.iptcom.net [212.9.234.210])
by vircheck.ipcard.iptcom.net (8.12.3/8.12.3) with ESMTP id g7CCXIoQ023526;
Mon, 12 Aug 2002 15:33:19 +0300 (EEST)
Received: from FreeBSD.org (big_brother.vega.com [192.168.1.1])
by vega.vega.com (8.12.5/8.11.3) with ESMTP id g7CCXIF2039813;
Mon, 12 Aug 2002 15:33:18 +0300 (EEST)
(envelope-from sobomax@FreeBSD.org)
Message-ID: <3D57AB3D.17737AD7@FreeBSD.org>
Date: Mon, 12 Aug 2002 15:34:05 +0300
From: Maxim Sobolev
Organization: Vega International Capital
X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U)
X-Accept-Language: en,uk,ru
MIME-Version: 1.0
To: Daniel Eischen
Cc: hackers@FreeBSD.ORG, audit@FreeBSD.ORG,
Alexander Litvin ,
Andriy Gapon
Subject: Re: Thread-safe resolver [patches for review]
References:
Content-Type: text/plain; charset=koi8-r
Content-Transfer-Encoding: 7bit
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
List-ID:
List-Archive: (Web Archive)
List-Help: (List Instructions)
List-Subscribe:
List-Unsubscribe:
X-Loop: FreeBSD.ORG
Daniel Eischen wrote:
>
> On Mon, 12 Aug 2002, Maxim Sobolev wrote:
> > Folks,
> >
> > Attched please find two patches based on bin/29581 PR to make FreeBSD
> > resolver thread-safe. They represent two approaches to reach this goal
> > - the first is to introduce reentrant versions of the standard
> > gethostbyXXX(3) APIs, similar to ones existing in other unices, and
> > the second one is to make gethostbyXXX(3) returning data placed into
> > per-thread storage when linked with libc_r. I like the latter approach
> > more, since it doesn't introduce new non-standard APIs.
> >
> > I would like to hear any comments and suggestions on the proposed
> > patches, as well as to opinions about which path to chose.
>
> Why do you need uthread_resolv.c? You should be able to thread
> calls by checking __isthreaded. Just keep everything in libc.
> If there are missing stubs for some pthread_* routines (I think
> everything you need is in -current's libc), then add them.
Why do we have uthread_error.c then? Also it will add penalty to every
access to _res_data structure even in non-threaded case.
-Maxim
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
From owner-freebsd-hackers Mon Aug 12 6:10:28 2002
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
by hub.freebsd.org (Postfix) with ESMTP
id 78B1737B406; Mon, 12 Aug 2002 06:10:22 -0700 (PDT)
Received: from mail.pcnet.com (pcnet1.pcnet.com [204.213.232.3])
by mx1.FreeBSD.org (Postfix) with ESMTP
id EAC7E43E4A; Mon, 12 Aug 2002 06:10:21 -0700 (PDT)
(envelope-from eischen@pcnet1.pcnet.com)
Received: from localhost (eischen@localhost)
by mail.pcnet.com (8.12.3/8.12.1) with ESMTP id g7CDAKhh027052;
Mon, 12 Aug 2002 09:10:20 -0400 (EDT)
Date: Mon, 12 Aug 2002 09:10:20 -0400 (EDT)
From: Daniel Eischen
To: Maxim Sobolev
Cc: hackers@FreeBSD.ORG, audit@FreeBSD.ORG,
Alexander Litvin ,
Andriy Gapon
Subject: Re: Thread-safe resolver [patches for review]
In-Reply-To: <3D57AB3D.17737AD7@FreeBSD.org>
Message-ID:
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
List-ID:
List-Archive: (Web Archive)
List-Help: (List Instructions)
List-Subscribe:
List-Unsubscribe:
X-Loop: FreeBSD.ORG
On Mon, 12 Aug 2002, Maxim Sobolev wrote:
> Daniel Eischen wrote:
> >
> > On Mon, 12 Aug 2002, Maxim Sobolev wrote:
> > > Folks,
> > >
> > > Attched please find two patches based on bin/29581 PR to make FreeBSD
> > > resolver thread-safe. They represent two approaches to reach this goal
> > > - the first is to introduce reentrant versions of the standard
> > > gethostbyXXX(3) APIs, similar to ones existing in other unices, and
> > > the second one is to make gethostbyXXX(3) returning data placed into
> > > per-thread storage when linked with libc_r. I like the latter approach
> > > more, since it doesn't introduce new non-standard APIs.
> > >
> > > I would like to hear any comments and suggestions on the proposed
> > > patches, as well as to opinions about which path to chose.
> >
> > Why do you need uthread_resolv.c? You should be able to thread
> > calls by checking __isthreaded. Just keep everything in libc.
> > If there are missing stubs for some pthread_* routines (I think
> > everything you need is in -current's libc), then add them.
>
> Why do we have uthread_error.c then? Also it will add penalty to every
> access to _res_data structure even in non-threaded case.
Take a look at everything else in libc. What about malloc? It
does the same thing and checks __isthreaded.
--
Dan Eischen
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
From owner-freebsd-hackers Mon Aug 12 6:16:29 2002
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
by hub.freebsd.org (Postfix) with ESMTP id 5440737B400
for ; Mon, 12 Aug 2002 06:16:27 -0700 (PDT)
Received: from woozle.rinet.ru (woozle.rinet.ru [195.54.192.68])
by mx1.FreeBSD.org (Postfix) with ESMTP id E010E43E42
for ; Mon, 12 Aug 2002 06:16:25 -0700 (PDT)
(envelope-from marck@rinet.ru)
Received: from localhost (marck@localhost)
by woozle.rinet.ru (8.11.6/8.11.6) with ESMTP id g7CDGKj67986;
Mon, 12 Aug 2002 17:16:20 +0400 (MSD)
(envelope-from marck@rinet.ru)
Date: Mon, 12 Aug 2002 17:16:20 +0400 (MSD)
From: Dmitry Morozovsky
To: Bruce M Simpson
Cc: freebsd-hackers@FreeBSD.ORG
Subject: Re: Building ports into packages, outside of /usr/ports
In-Reply-To: <20020808154814.GD18301@spc.org>
Message-ID: <20020812171508.V56159-100000@woozle.rinet.ru>
X-NCC-RegID: ru.rinet
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
List-ID:
List-Archive: (Web Archive)
List-Help: (List Instructions)
List-Subscribe:
List-Unsubscribe:
X-Loop: FreeBSD.ORG
On Thu, 8 Aug 2002, Bruce M Simpson wrote:
BMS> Has anybody thought about hacking the above to support building packages
BMS> outside of the ports tree, and without installing them? Strikes me as
BMS> something that could be neatly solved with judicious use of chroot(1).
BMS>
BMS> This is something which was raised at the FreeBSD UK Users Group meeting
BMS> last night, so it's bugging me.
Hmm, did you look at /usr/ports/Tools/portbuild and
/usr/ports/Tools/scripts/release ?
Sincerely,
D.Marck [DM5020, DM268-RIPE, DM3-RIPN]
------------------------------------------------------------------------
*** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck@rinet.ru ***
------------------------------------------------------------------------
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
From owner-freebsd-hackers Mon Aug 12 7:58:35 2002
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
by hub.freebsd.org (Postfix) with ESMTP id AE82937B400
for ; Mon, 12 Aug 2002 07:58:30 -0700 (PDT)
Received: from snipe.mail.pas.earthlink.net (snipe.mail.pas.earthlink.net [207.217.120.62])
by mx1.FreeBSD.org (Postfix) with ESMTP id 4DB7A43E6A
for ; Mon, 12 Aug 2002 07:58:30 -0700 (PDT)
(envelope-from tlambert2@mindspring.com)
Received: from pool0043.cvx22-bradley.dialup.earthlink.net ([209.179.198.43] helo=mindspring.com)
by snipe.mail.pas.earthlink.net with esmtp (Exim 3.33 #1)
id 17eGeB-0001F1-00; Mon, 12 Aug 2002 07:58:19 -0700
Message-ID: <3D57CCD5.B8B36F86@mindspring.com>
Date: Mon, 12 Aug 2002 07:57:25 -0700
From: Terry Lambert
X-Mailer: Mozilla 4.79 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
To: ouyang kai
Cc: freebsd-hackers@FreeBSD.ORG
Subject: Re: How the kernel add the devices when the kernel start
References:
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
List-ID:
List-Archive: (Web Archive)
List-Help: (List Instructions)
List-Subscribe:
List-Unsubscribe:
X-Loop: FreeBSD.ORG
ouyang kai wrote:
>
> Part 1.1 Type: Plain Text (text/plain)
> Encoding: quoted-printable
| When the kernel process this code to check the SI_SUB_DRIVERS,
| it would find the registed 'fxp' device(fxp_probe), right?
Not exactly. Let's expand the macros manually:
--------------------------------------------------------------------------
DRIVER_MODULE(if_fxp, pci, fxp_driver, fxp_devclass, 0, 0);
->
static driver_t *if_fxp_pci_driver_list[] = { &fxp_driver };
static struct driver_module_data if_fxp_pci_driver_mod = {
0, 0,
"pci",
if_fxp_pci_driver_list,
(sizeof if_fxp_pci_driver_list) / (sizeof if_fxp_pci_driver_list[0]),
&fxp_devclass
};
static moduledata_t if_fxp_pci_mod = {
"pci/if_fxp",
driver_module_handler,
&if_fxp_pci_driver_mod
};
DECLARE_MODULE(if_fxp_pci, if_fxp_pci_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE)
->
SYSINIT(if_fxp_pcimodule, SI_SUB_DRIVERS, SI_ORDER_MIDDLE,
module_register_init, &if_fxp_pci_mod)
->
struct sysinit if_fxp_pcimodule_sys_init {
SI_SUB_DRIVERS,
SI_ORDER_MIDDLE,
module_register_init,
&if_fxp_pci_mod
};
-> in init_main.c:
module_register_init( &if_fxp_pci_mod);
/--------------------------------------------------------------------------
So the answer is that it calls the function "module_register_init"
with the address of the moduledata_t structure whose contents are:
--------------------------------------------------------------------------
static moduledata_t if_fxp_pci_mod = {
"pci/if_fxp",
driver_module_handler,
&{
0, 0,
"pci",
if_fxp_pci_driver_list,
1,
&fxp_devclass
}
};
/--------------------------------------------------------------------------
| If the 'fxp' device is exist, the kernel will try to attach
| it(fxp_attach), right?
This *eventually* calls the probe, and, if it finds a device,
the attach, so yes, many function calls deep.
| Another, If we do not compile the 'vr' device into the kernel
| and we do not load the corresponding 'ko', so the kernel will
| not check the device, that is to say, the 'vr' device does not
| registe to kernel, right?
Yes. Unless the .ko (kernel module) version gets loaded, a
driver must be statically linked into the kernel, or it will
not be called to try and probe for devices that it matches.
| 1. When the kernel process the specified device, the 'func'
| means what? For example: the member 'if_ioctl' of the
| structure 'ifnet', when the kernel process the 'fxp' device,
| I know it should call the function 'fxp_ioctl'. But I do not
| the 'func' means what when it check SI_SUB_DRIVERS.
In this case, the macros make it mean the function named
module_register_init().
| 2. In NetBSD, I can find main() function in init_main.c, but
| in FreeBSD, I could not find it, I am puzzled about the place
| of the FreeBSD main process.
This is not well documented, and it has changed recently, as
people have gained an understanding for the boot process, and
screwed around with the code there, so any documentation is
out of date pretty quickly. That's the problem with documenting
things: there is so little documentation that as soon as something
is documented, people understand it and jump on it and change it
because they now understand it. Unfortunately people can't seem
to leave working code alone, expecially if it's the only code they
understand (understanding broken code would be too much like work,
I guess...).
The short answer is:
mi_startup().
The longer answer is:
bootstrap code (boot0, boot1+boot2)
-- this is the entry point from the BIOS
btext() (in locore.s; called locorestart() on Alpha)
-- this is the entry point from the bootstrap
identify_cpu()
create_pagetables()
begin() (in relocated address space)
mi_startup()
-- this is the entrypoint to the machine
independent startup code that will be the
same no matter what type of machine you
run FreeBSD on.
Which one is really "main()" depends on your philosophy, and
who has been rearranging the deck chairs in locore.s this week.
8-(.
-- Terry
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
From owner-freebsd-hackers Mon Aug 12 8: 9:33 2002
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
by hub.freebsd.org (Postfix) with ESMTP
id 0359D37B400; Mon, 12 Aug 2002 08:09:26 -0700 (PDT)
Received: from snipe.mail.pas.earthlink.net (snipe.mail.pas.earthlink.net [207.217.120.62])
by mx1.FreeBSD.org (Postfix) with ESMTP
id 94B7843E65; Mon, 12 Aug 2002 08:09:25 -0700 (PDT)
(envelope-from tlambert2@mindspring.com)
Received: from pool0043.cvx22-bradley.dialup.earthlink.net ([209.179.198.43] helo=mindspring.com)
by snipe.mail.pas.earthlink.net with esmtp (Exim 3.33 #1)
id 17eGou-0000Cs-00; Mon, 12 Aug 2002 08:09:24 -0700
Message-ID: <3D57CF6D.2982CE8@mindspring.com>
Date: Mon, 12 Aug 2002 08:08:29 -0700
From: Terry Lambert
X-Mailer: Mozilla 4.79 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
To: Maxim Sobolev
Cc: hackers@FreeBSD.ORG, audit@FreeBSD.ORG,
Alexander Litvin ,
Andriy Gapon
Subject: Re: Thread-safe resolver [patches for review]
References: <3D578A99.F0821712@FreeBSD.org> <3D5792CD.497C80F0@mindspring.com> <3D57A9D4.DAA043EF@FreeBSD.org>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
List-ID:
List-Archive: (Web Archive)
List-Help: (List Instructions)
List-Subscribe:
List-Unsubscribe:
X-Loop: FreeBSD.ORG
Maxim Sobolev wrote:
> > You may also want to consider the use of a .init and .fini
> > section for the code, to permit the creation of an initial
> > lookup context chunk; this is kind of a tradeoff, but it will
> > mean that a server will not have to do the recheck each time.
> > The .fini section would aloow auto-cleanup. This may be a
> > necessity for a long running program that uses a shared object
> > to perform the thread creation and lookup (you could leak
> > memory, otherwise).
>
> Could you please elaborate how exactly memory could be leaked in this
> case, if the program does correctly shut down all its threads?
Create PIC object foo.so.
Link PIC object foo.so against libc.so.
Call dlopen to load module foo.so into program "bob".
Call function in foo.so from program "bob".
Function in foo.so creates two threads, one for IPv4 lookup,
another for IPv6 lookup to cause lookups to proceed
concurrently.
Lookup completes.
Unload module foo.so.
-> leak memory in libc.so image
The assumption (which is potentially wrong) is that the program
will correctly shut down all its threads, when in fact it was a
module not under the programs control that created and used the
threads.
The leak depends on:
1) A pool of worker threads being created and left around
or the purpose of simultaneous resolution
2) The parent shutting down the module without explicitly
dealing with the threads (basically, code which would
need to live in ".fini" of the foo.so, and could not be
automatically triggered on unload of foo.so any other way).
I think that parallel IPv6/IPv4 resolution presented as a single
serial interface is a high probability implementation with the
support for threaded access to the resolver, particularly with
the Mozilla code acting the way it does.
> I also would like to hear from you whether or not you think that we
> need all those gethostbyXXX_r(3) functions.
No. I don't think any of the _r functions are needed, so long
as the results are not cached by pointer instead of a copy,
before passing them from one thread to another. It's a risk on
the clobber case of a call with a cached reference outstanding
but not processed by another thread which is not an issue with
the _r functions, which require that you pass the storage down.
Of course, if you pass down per thread storage, you could have
the same problem if you didn't copy rather than reference the
results before passing to another thread by address.
Given that, per thread allocations ("thread local storage")
makes more sense than allocate/free fights between threads
based on who's responsible for owning the memory after an
inter-thread call. 8-).
-- Terry
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
From owner-freebsd-hackers Mon Aug 12 12:22:54 2002
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
by hub.freebsd.org (Postfix) with ESMTP
id 2774B37B400; Mon, 12 Aug 2002 12:22:51 -0700 (PDT)
Received: from canning.wemm.org (canning.wemm.org [192.203.228.65])
by mx1.FreeBSD.org (Postfix) with ESMTP
id 6C4CC43E3B; Mon, 12 Aug 2002 12:22:50 -0700 (PDT)
(envelope-from peter@wemm.org)
Received: from wemm.org (localhost [127.0.0.1])
by canning.wemm.org (Postfix) with ESMTP
id 4B81B2A7D6; Mon, 12 Aug 2002 12:22:50 -0700 (PDT)
(envelope-from peter@wemm.org)
X-Mailer: exmh version 2.5 07/13/2001 with nmh-1.0.4
To: Maxim Sobolev
Cc: hackers@FreeBSD.ORG, audit@FreeBSD.ORG,
Alexander Litvin ,
Andriy Gapon
Subject: Re: Thread-safe resolver [patches for review]
In-Reply-To: <3D57A9D4.DAA043EF@FreeBSD.org>
Date: Mon, 12 Aug 2002 12:22:50 -0700
From: Peter Wemm
Message-Id: <20020812192250.4B81B2A7D6@canning.wemm.org>
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
List-ID:
List-Archive: (Web Archive)
List-Help: (List Instructions)
List-Subscribe:
List-Unsubscribe:
X-Loop: FreeBSD.ORG
Maxim Sobolev wrote:
> I also would like to hear from you whether or not you think that we
> need all those gethostbyXXX_r(3) functions.
Yes. Because autoconf looks for them and will assume non-reentrancy if
they are not present. Also, for source compatability with linux and
solaris and just about everything else that implements this stuff. The
expectation is that gethostbyXXX is non-safe and that gethostbyXXX_r is
safe. If you can make the non_r versions safe then that is a bonus I guess.
Cheers,
-Peter
--
Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com
"All of this is for nothing if we don't go to the stars" - JMS/B5
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
From owner-freebsd-hackers Mon Aug 12 13: 1:23 2002
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
by hub.freebsd.org (Postfix) with ESMTP
id 8642A37B405; Mon, 12 Aug 2002 13:01:08 -0700 (PDT)
Received: from tomts9-srv.bellnexxia.net (tomts9.bellnexxia.net [209.226.175.53])
by mx1.FreeBSD.org (Postfix) with ESMTP
id B43D343E42; Mon, 12 Aug 2002 13:01:05 -0700 (PDT)
(envelope-from hottymaria@gosympatico.ca)
Received: from [209.226.175.136] by tomts9-srv.bellnexxia.net
(InterMail vM.5.01.04.19 201-253-122-122-119-20020516) with SMTP
id <20020812200119.KDYI12452.tomts9-srv.bellnexxia.net@[209.226.175.136]>;
Mon, 12 Aug 2002 16:01:19 -0400
From:
To:
Subject: Hey, whats up?
Date: Mon, 12 Aug 2002 16:01:51 -0400
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Message-Id: <20020812200119.KDYI12452.tomts9-srv.bellnexxia.net@[209.226.175.136]>
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
List-ID:
List-Archive: (Web Archive)
List-Help: (List Instructions)
List-Subscribe:
List-Unsubscribe:
X-Loop: FreeBSD.ORG