From owner-freebsd-bugs@FreeBSD.ORG Wed Nov 3 19:50:23 2004 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 03C5916A4CE for ; Wed, 3 Nov 2004 19:50:23 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id DC38D43D5E for ; Wed, 3 Nov 2004 19:50:22 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.11/8.12.11) with ESMTP id iA3JoMDT041594 for ; Wed, 3 Nov 2004 19:50:22 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id iA3JoM2v041593; Wed, 3 Nov 2004 19:50:22 GMT (envelope-from gnats) Resent-Date: Wed, 3 Nov 2004 19:50:22 GMT Resent-Message-Id: <200411031950.iA3JoM2v041593@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "Ronald F.Guilmette" Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2CD0616A4CF for ; 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 ; 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" To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 cc: rfg@monkeys.com Subject: misc/73496: Wanted: A more flexible version of mkstemp() X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: "Ronald F.Guilmette" List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Nov 2004 19:50:23 -0000 >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@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: