From rfg@monkeys.com  Wed Nov  3 19:40:15 2004
Return-Path: <rfg@monkeys.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 2CD0616A4CF
	for <FreeBSD-gnats-submit@freebsd.org>; Wed,  3 Nov 2004 19:40:15 +0000 (GMT)
Received: from segfault-outgoing-helo.monkeys.com (segfault.monkeys.com [66.60.159.24])
	by mx1.FreeBSD.org (Postfix) with ESMTP id CC0FA43D49
	for <FreeBSD-gnats-submit@freebsd.org>; Wed,  3 Nov 2004 19:40:14 +0000 (GMT)
	(envelope-from rfg@monkeys.com)
Received: by segfault.monkeys.com (Postfix, from userid 1237)
	id AAC4854AA; Wed,  3 Nov 2004 11:40:14 -0800 (PST)
Message-Id: <20041103194014.AAC4854AA@segfault.monkeys.com>
Date: Wed,  3 Nov 2004 11:40:14 -0800 (PST)
From: Ronald F.Guilmette <rfg@monkeys.com>
Reply-To: Ronald F.Guilmette <rfg@monkeys.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc: rfg@monkeys.com
Subject: Wanted: A more flexible version of mkstemp()
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         73496
>Category:       kern
>Synopsis:       [request] A more flexible version of mkstemp()
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    jilles
>State:          patched
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Nov 03 19:50:22 GMT 2004
>Closed-Date:    
>Last-Modified:  Sun Apr 06 21:01:13 UTC 2014
>Originator:     Ronald F. Guilmette
>Release:        FreeBSD 4.10-RELEASE i386
>Organization:
Infinite Monkeys & Co.
>Environment:
System: FreeBSD segfault.monkeys.com 4.10-RELEASE FreeBSD 4.10-RELEASE #0: Wed Oct 27 13:02:03 PDT 2004 rfg@segfault.monkeys.com:/usr/src/sys/compile/rfg20041027 i386

>Description:
	Request For Enhancment (C Library):

	It would be Nice if the C library contained a version of the mkstemp()
	function thart woul allow the user to specify various special purpose
	flags that would be thence be included in the set of flags that the
	mkstemp() library function passes to open(2).  For example, a new
	library function with the following name and signature could be easily
	and productively added to the C library:

	extern int mkftemp (char *template, int flags);

	Ca ll to this new function would have an effect identical to calling
	the existing mkstemp() function except that the value passed into the
	`flags' parameter of mkftemp() would be bitwise OR'd into the set
	of flags that would otherwise be passed to open(2).

	Such a new function would permit the caller to specify additional
	open(2) flags, for example O_EXLOCK.  (Another possibility might be
	the hypothetical O_UNLINK flag that I proposed recently in a separate
	PR.)

>How-To-Repeat:
	Nothing to repeat.  This is an Enhancement Request.

>Fix:
	Implementation of the proposed mkftemp() function in the C library
	should be both trivial and straightforward.  Essentially, one would
	just clone the existing code for mkstemp() and makes a few minor
	adjustments/changes.  After that, the mkstemp() itself could be
	trivially re-implemented (as a degenerate special case) in terms
	of mkftemp() as follows:

		int
		mkstemp (char *template)
		{
		  return mkftemp (template, 0);
		}

	(In effect, the proposed mkftemp() function is a ``more primitive
	primitive'' than mkstemp(), and one which would provide more flexi-
	bility and more functionality.)
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->suspended 
State-Changed-By: linimon 
State-Changed-When: Mon Jan 28 09:05:30 UTC 2008 
State-Changed-Why:  
Mark suspended awaiting patches. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=73496 
State-Changed-From-To: suspended->patched 
State-Changed-By: jilles 
State-Changed-When: Sun Apr 6 20:59:53 UTC 2014 
State-Changed-Why:  
This mkstemp() variant is available in 10.0 as mkostemp(). 


Responsible-Changed-From-To: freebsd-bugs->jilles 
Responsible-Changed-By: jilles 
Responsible-Changed-When: Sun Apr 6 20:59:53 UTC 2014 
Responsible-Changed-Why:  
I added mkostemp(). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=73496 
>Unformatted:
