From nobody@FreeBSD.org  Sun Jan  9 16:10:30 2005
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 972F216A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  9 Jan 2005 16:10:30 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 851DF43D4C
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  9 Jan 2005 16:10:30 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id j09GATXR080382
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 9 Jan 2005 16:10:29 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id j09GATSb080381;
	Sun, 9 Jan 2005 16:10:29 GMT
	(envelope-from nobody)
Message-Id: <200501091610.j09GATSb080381@www.freebsd.org>
Date: Sun, 9 Jan 2005 16:10:29 GMT
From: Tarc <tarc@po.cs.msu.su>
To: freebsd-gnats-submit@FreeBSD.org
Subject: hcreate documentation(?) bug
X-Send-Pr-Version: www-2.3

>Number:         75995
>Category:       docs
>Synopsis:       hcreate(3) documentation(?) bug
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    danger
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jan 09 16:20:21 GMT 2005
>Closed-Date:    Fri Jul 11 09:38:05 UTC 2008
>Last-Modified:  Fri Jul 11 09:40:04 UTC 2008
>Originator:     Tarc
>Release:        5.3
>Organization:
MSU
>Environment:
FreeBSD tarc.po.cs.msu.su 5.3-STABLE FreeBSD 5.3-STABLE #0: Wed Dec 29 18:08:32 MSK 2004     root@tarc.po.cs.msu.su:/usr/src/sys/i386/compile/Kernel  i386
>Description:
I read the man hcreate(3) and, for better understanding, how hash table addressed, /usr/src/lib/libc/stdlib/hcreate.c
Mam says, that if error occur, hcreate(3) returns 0, but if no memory, it will set errno to ENOMEM.
But I see, that if hachtable is already created, hcreate returns 0 AND SETS errno to EINVAL.
T think, it's true way, but undocumented
>How-To-Repeat:
up to date system sources & read:
cd /usr/src/lib/libc/stdlib
more hcreate.c
man 3 hcreate

>Fix:
Add description about EINVAL to man, or don't set errno.
>Release-Note:
>Audit-Trail:

From: "Ben Kaduk" <minimarmot@gmail.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: docs/75995: hcreate(3) documentation(?) bug
Date: Wed, 2 Jul 2008 00:03:45 -0400

 It definitely looks like a documentation bug.
 
 I've put a patch up at
 http://stuff.mit.edu/afs/sipb.mit.edu/user/kaduk/freebsd/patches/htcreate.diff.2008.07.01
 in case gmail mangles the whitespace.
 
 Thanks to sbahra on #bsddocs for pointing out that we should mention that
 errno gets set.
 
 -Ben Kaduk
 
 --- hcreate.3.0 2008-07-01 23:29:00.000000000 -0400
 +++ hcreate.3   2008-07-01 23:53:17.000000000 -0400
 @@ -1,6 +1,6 @@
  .\" $FreeBSD: src/lib/libc/stdlib/hcreate.3,v 1.5 2005/01/20 09:17:04 ru Exp $
  .\"
 -.Dd May 8, 2001
 +.Dd July 1, 2008
  .Os
  .Dt HCREATE 3
  .Sh NAME
 @@ -23,6 +23,7 @@
  and
  .Fn hsearch
  functions manage hash search tables.
 +Only one hash table per process may be active at any given time.
  .Pp
  The
  .Fn hcreate
 @@ -111,7 +112,7 @@
  .Sh RETURN VALUES
  The
  .Fn hcreate
 -function returns 0 if it cannot allocate sufficient space for the table;
 +function returns 0 if the table creation failed;
  otherwise, it returns non-zero.
  .Pp
  The
 @@ -199,6 +200,8 @@
  .Bl -tag -width Er
  .It Bq Er ENOMEM
  Insufficient storage space is available.
 +.It Bq Er EINVAL
 +A table already exists.
  .El
  .Sh SEE ALSO
  .Xr bsearch 3 ,
Responsible-Changed-From-To: freebsd-doc->danger 
Responsible-Changed-By: danger 
Responsible-Changed-When: Sun Jul 6 12:18:15 UTC 2008 
Responsible-Changed-Why:  
Take 

http://www.freebsd.org/cgi/query-pr.cgi?pr=75995 
State-Changed-From-To: open->patched 
State-Changed-By: danger 
State-Changed-When: Sun Jul 6 12:18:28 UTC 2008 
State-Changed-Why:  
- Fixed in HEAD, awaiting for MFC 

http://www.freebsd.org/cgi/query-pr.cgi?pr=75995 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: docs/75995: commit references a PR
Date: Sun,  6 Jul 2008 12:18:20 +0000 (UTC)

 danger      2008-07-06 12:17:53 UTC
 
   FreeBSD src repository
 
   Modified files:
     lib/libc/stdlib      hcreate.3 
   Log:
   SVN rev 180325 on 2008-07-06 12:17:53Z by danger
   
   - Add description about a missing return value
   
   PR:             docs/75995
   Submitted by:   Tarc <tarc@po.cs.msu.su>
   MFC after:      3 days
   
   Revision  Changes    Path
   1.6       +6 -2      src/lib/libc/stdlib/hcreate.3
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: danger 
State-Changed-When: Fri Jul 11 09:37:37 UTC 2008 
State-Changed-Why:  
I have merged my changes back to RELENG_[76]. Close this one. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=75995 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: docs/75995: commit references a PR
Date: Fri, 11 Jul 2008 09:35:42 +0000 (UTC)

 danger      2008-07-11 09:35:20 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_7)
     lib/libc/stdlib      hcreate.3 
   Log:
   SVN rev 180441 on 2008-07-11 09:35:20Z by danger
   
   MFC r180325 and r180329:
   
   - This code was intially obtained from NetBSD, but it's missing licence
     statement. Add the one from the current NetBSD version.
   - Add description about a missing return value [1]
   
   PR:             docs/75995
   Submitted by:   Tarc <tarc@po.cs.msu.su>
   
   Revision  Changes    Path
   1.5.10.1  +35 -3     src/lib/libc/stdlib/hcreate.3
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: docs/75995: commit references a PR
Date: Fri, 11 Jul 2008 09:37:44 +0000 (UTC)

 danger      2008-07-11 09:37:24 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_6)
     lib/libc/stdlib      hcreate.3 
   Log:
   SVN rev 180442 on 2008-07-11 09:37:24Z by danger
   
   MFC r180325 and r180329:
   
   - This code was intially obtained from NetBSD, but it's missing licence
     statement. Add the one from the current NetBSD version.
     - Add description about a missing return value [1]
   
   PR:             docs/75995
   Submitted by:   Tarc <tarc@po.cs.msu.su>
   
   Revision  Changes    Path
   1.5.2.1   +35 -3     src/lib/libc/stdlib/hcreate.3
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
