From owner-freebsd-arch@FreeBSD.ORG Tue Dec 2 16:13:23 2014 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 031FA82D for ; Tue, 2 Dec 2014 16:13:23 +0000 (UTC) Received: from mail-pa0-x22b.google.com (mail-pa0-x22b.google.com [IPv6:2607:f8b0:400e:c03::22b]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BDADFD77 for ; Tue, 2 Dec 2014 16:13:22 +0000 (UTC) Received: by mail-pa0-f43.google.com with SMTP id kx10so13756287pab.2 for ; Tue, 02 Dec 2014 08:13:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :message-id:references:to; bh=R/F1vdgEuDIEEImgwVyLqOd27TjdFSB3FRjjI3nDgkg=; b=JfwSgdH0bY+6OmiDcinJvulaaWPrX7BLqa/waVaJj+t2srvvkhNjMd7iBQSUcYroQ5 4S4DaMtDEo42i3DrjuzvyZu2u8lTdxgronRm956n7W9mfubT4DH3bVrof4dJVKIeQbJc TcIly9qI+b0gJpkervXw2wV3F4k3gLT0SO3wMC1BRhWqKWt+jgj+C+mujZMJ3eAhn/iH Bkt1clkCcwjqEYZKJ8hA43fnIGA95Da3T9M8dYS6HHhED6qBOSxOZBHqdcaigTFYF9dD Uq9lCbMCBnryw3pvyAhuT2rzvJ2hfa+A5goHLNZeVcPVCb6gYWAftteEXCXjuR6LcjuD WNSQ== X-Received: by 10.66.232.168 with SMTP id tp8mr111215720pac.132.1417536802192; Tue, 02 Dec 2014 08:13:22 -0800 (PST) Received: from ?IPv6:2601:8:ab80:7d6:e55f:8148:485b:490e? ([2601:8:ab80:7d6:e55f:8148:485b:490e]) by mx.google.com with ESMTPSA id i11sm20818818pat.3.2014.12.02.08.13.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 02 Dec 2014 08:13:20 -0800 (PST) Content-Type: multipart/signed; boundary="Apple-Mail=_840E1575-1977-4E94-94D1-4EE49FC7B7BA"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: Disparity between /etc/services and /var/db/services.db From: Garrett Cooper In-Reply-To: Date: Tue, 2 Dec 2014 08:13:19 -0800 Message-Id: <556364B6-EB7C-421F-B2FB-64A170611A56@gmail.com> References: <6F3959BB-3B71-4515-B7BD-C1A640E8327A@gmail.com> To: Benjamin Kaduk X-Mailer: Apple Mail (2.1878.6) Cc: "freebsd-arch@freebsd.org" X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Dec 2014 16:13:23 -0000 --Apple-Mail=_840E1575-1977-4E94-94D1-4EE49FC7B7BA Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 On Dec 1, 2014, at 11:28, Benjamin Kaduk wrote: > On Mon, 1 Dec 2014, Garrett Cooper wrote: >=20 >> $ ls -l /scratch/2/etc/services /scratch/2/var/db/services.db >> -rw-r--r-- 1 ngie wheel 86802 Nov 27 02:23 = /scratch/2/etc/services >> -rw-r--r-- 1 ngie wheel 2097920 Nov 27 02:23 = /scratch/2/var/db/services.db >=20 > One's a text file and the other a Berkeley DB file ... I wouldn't = expect > them to be the same size. Shoot. I didn=92t mean for this message to get sent out without a lot of = context. For that I apologize... Basically what I was going to comment on was the fact that the .db file = was so large, and by adjusting the number of entries I was able to = reduce the size of the file by 4 (it=92s bloated by a couple thousand): =46rom usr.sbin/services_mkdb/services_mkdb.c: 70 HASHINFO hinfo =3D { 71 .bsize =3D 256, 72 .ffactor =3D 4, 73 .nelem =3D 32768, 74 .cachesize =3D 1024, 75 .hash =3D NULL, 76 .lorder =3D 0 77 }; There are a lot less items in the /etc/services file than 32k: $ cat count_servents.c #include #include int main(void) { int i; for (i =3D 0; getservent() !=3D NULL; i++) ; printf("Number of entries: %d\n", i); return 0; } $ ~/count_servents=20 Number of entries: 2358 $ In the upstream [IANA] /etc/services file, there=92s only 1k more or so. I would understand if the database was trying to fill the service number = range, but 32k !=3D INT_MAX: struct servent { char *s_name; /* official name of service = */ char **s_aliases; /* alias list */ int s_port; /* port service resides at */ char *s_proto; /* protocol to use */ }; Is there a reason why this? =93Upstream=94 (NetBSD) doesn=92t seem to = comment much on this either=85 Thanks! PS I just found this thread by bapt from last year that comments about = this issue from a different bend: = https://lists.freebsd.org/pipermail/freebsd-hackers/2013-October/043661.ht= ml --Apple-Mail=_840E1575-1977-4E94-94D1-4EE49FC7B7BA Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQEcBAEBCgAGBQJUfeUfAAoJEMZr5QU6S73eCPcIAJH0uawSZaPHDX+mUY+yRT+S 83KX9oYlY3raDPw0Oy7Zih2CsfAj7TXAmVf7WaKnWusLQ8kW8Flilk22fZ32dOxO 60jdbaGM99pO0Fl3BorEg3hzXj/MCa4mb/qNtFM5unu+C+ZXjz7FN5kP+2WmOumB eaXIh0vtQsqWz5GXzi+pLPbOsn3ixXJN+fl8BY2cBh1ZeMosJzk/rweVduswHox2 7ItBqP8cBNaiOgbhMGLXx6iY2+YjQ2dOAQZj/2FpFD1/Mlk6q1sETcEI/yKqYNky ucocpotAjufGXLdYba+Y69RLcewacegIVDXRsOkjCFxLqSiMX/V0uc7g8YnRgts= =vgRZ -----END PGP SIGNATURE----- --Apple-Mail=_840E1575-1977-4E94-94D1-4EE49FC7B7BA--