misc/73496: Wanted: A more flexible version of mkstemp()
Ronald F.Guilmette
rfg at monkeys.com
Wed Nov 3 11:50:23 PST 2004
>Number: 73496
>Category: misc
>Synopsis: Wanted: A more flexible version of mkstemp()
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>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:
>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 at 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:
>Unformatted:
More information about the freebsd-bugs
mailing list