From patchwork Sat Mar 9 17:16:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Stefan_Fr=C3=B6berg?= X-Patchwork-Id: 226348 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ozlabs.org (Postfix) with ESMTP id 964102C0349 for ; Sun, 10 Mar 2013 04:17:46 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 05D068C2E2; Sat, 9 Mar 2013 17:17:45 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hT5PXINqJJyY; Sat, 9 Mar 2013 17:17:29 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 0832F8BEB5; Sat, 9 Mar 2013 17:17:28 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 52A088F74B for ; Sat, 9 Mar 2013 17:17:28 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id AA5AF8BC31 for ; Sat, 9 Mar 2013 17:17:20 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kjYQWVrX5ebT for ; Sat, 9 Mar 2013 17:17:16 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.petroprogram.com (mail.petroprogram.com [194.89.34.74]) by whitealder.osuosl.org (Postfix) with ESMTPS id 807808B9AD for ; Sat, 9 Mar 2013 17:17:16 +0000 (UTC) Received: from localhost.localdomain.localdomain (212-226-43-90-nat.elisa-mobile.fi [212.226.43.90]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: stefan.froberg@petroprogram.com) by mail.petroprogram.com (Postfix) with ESMTPSA id 89C5A4DC51; Sat, 9 Mar 2013 19:08:59 +0200 (EET) From: =?UTF-8?q?Stefan=20Fr=C3=B6berg?= To: buildroot@busybox.net Date: Sat, 9 Mar 2013 19:16:19 +0200 Message-Id: <1362849379-32035-2-git-send-email-stefan.froberg@petroprogram.com> X-Mailer: git-send-email 1.7.7.6 In-Reply-To: <1362849379-32035-1-git-send-email-stefan.froberg@petroprogram.com> References: <1362849379-32035-1-git-send-email-stefan.froberg@petroprogram.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH] uClibc: add mkostemp() X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net add mkostemp() function to uClibc 0.9.33.2 URL: http://git.uclibc.org/uClibc/patch/?id=42d1b23fc0f3748b8f474e456d6c44aa7e563fd Signed-off-by: Stefan Fröberg --- .../uClibc-0.9.33.2-add-mkostemp-helpers.patch | 146 ++++++++++++++++++++ 1 files changed, 146 insertions(+), 0 deletions(-) create mode 100755 toolchain/uClibc/uClibc-0.9.33.2-add-mkostemp-helpers.patch diff --git a/toolchain/uClibc/uClibc-0.9.33.2-add-mkostemp-helpers.patch b/toolchain/uClibc/uClibc-0.9.33.2-add-mkostemp-helpers.patch new file mode 100755 index 0000000..02ad644 --- /dev/null +++ b/toolchain/uClibc/uClibc-0.9.33.2-add-mkostemp-helpers.patch @@ -0,0 +1,146 @@ +From 42d1b23fc0f3748b8bf474e456d6c44aa7e563fd Mon Sep 17 00:00:00 2001 +From: Mike Frysinger +Date: Wed, 14 Nov 2012 05:30:54 +0000 +Subject: libc/stdlib: add mkostemp helpers + +Some projects (like udev) are starting to use this. + +Imported from glibc. + +Signed-off-by: Mike Frysinger +--- +diff --git a/include/stdlib.h b/include/stdlib.h +index 354fc66..79ccc55 100644 +--- a/include/stdlib.h ++++ b/include/stdlib.h +@@ -652,6 +652,29 @@ extern int mkstemp64 (char *__template) __nonnull ((1)) __wur; + extern char *mkdtemp (char *__template) __THROW __nonnull ((1)) __wur; + #endif + ++#ifdef __USE_GNU ++/* Generate a unique temporary file name from TEMPLATE similar to ++ mkstemp. But allow the caller to pass additional flags which are ++ used in the open call to create the file.. ++ ++ This function is a possible cancellation point and therefore not ++ marked with __THROW. */ ++# ifndef __USE_FILE_OFFSET64 ++extern int mkostemp (char *__template, int __flags) __nonnull ((1)) __wur; ++# else ++# ifdef __REDIRECT ++extern int __REDIRECT (mkostemp, (char *__template, int __flags), mkostemp64) ++ __nonnull ((1)) __wur; ++# else ++# define mkostemp mkostemp64 ++# endif ++# endif ++# ifdef __USE_LARGEFILE64 ++extern int mkostemp64 (char *__template, int __flags) __nonnull ((1)) __wur; ++# endif ++ ++#endif ++ + + __BEGIN_NAMESPACE_STD + /* Execute the given line as a shell command. +diff --git a/libc/stdlib/Makefile.in b/libc/stdlib/Makefile.in +index 3166b8e..b92f7ce 100644 +--- a/libc/stdlib/Makefile.in ++++ b/libc/stdlib/Makefile.in +@@ -12,7 +12,7 @@ include $(top_srcdir)libc/stdlib/malloc-simple/Makefile.in + include $(top_srcdir)libc/stdlib/malloc-standard/Makefile.in + + CSRC-y := \ +- abort.c getenv.c mkdtemp.c realpath.c canonicalize.c mkstemp.c \ ++ abort.c getenv.c mkdtemp.c realpath.c canonicalize.c mkstemp.c mkostemp.c \ + rand.c random.c random_r.c setenv.c div.c ldiv.c lldiv.c \ + getpt.c drand48-iter.c jrand48.c \ + jrand48_r.c lcong48.c lrand48.c lrand48_r.c mrand48.c mrand48_r.c nrand48.c \ +@@ -21,7 +21,7 @@ CSRC-y := \ + CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_memalign.c + CSRC-$(UCLIBC_HAS_PTY) += grantpt.c unlockpt.c ptsname.c + CSRC-$(UCLIBC_HAS_ARC4RANDOM) += arc4random.c +-CSRC-$(UCLIBC_HAS_LFS) += mkstemp64.c ++CSRC-$(UCLIBC_HAS_LFS) += mkstemp64.c mkostemp64.c + CSRC-$(UCLIBC_HAS_FLOATS) += drand48.c drand48_r.c erand48.c erand48_r.c + CSRC-$(if $(findstring yy,$(UCLIBC_HAS_FLOATS)$(UCLIBC_SUSV3_LEGACY)),y) += \ + gcvt.c +diff --git a/libc/stdlib/mkostemp.c b/libc/stdlib/mkostemp.c +new file mode 100644 +index 0000000..93b50fc +--- /dev/null ++++ b/libc/stdlib/mkostemp.c +@@ -0,0 +1,32 @@ ++/* Copyright (C) 1998-2012 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++#include "../misc/internals/tempname.h" ++ ++/* Generate a unique temporary file name from TEMPLATE. ++ The last six characters of TEMPLATE must be "XXXXXX"; ++ they are replaced with a string that makes the filename unique. ++ Then open the file and return a fd. */ ++int ++mkostemp (template, flags) ++ char *template; ++ int flags; ++{ ++ return __gen_tempname (template, __GT_FILE, flags); ++} +diff --git a/libc/stdlib/mkostemp64.c b/libc/stdlib/mkostemp64.c +new file mode 100644 +index 0000000..5509d8c +--- /dev/null ++++ b/libc/stdlib/mkostemp64.c +@@ -0,0 +1,33 @@ ++/* Copyright (C) 2000-2012 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++#include ++#include "../misc/internals/tempname.h" ++ ++/* Generate a unique temporary file name from TEMPLATE. ++ The last six characters of TEMPLATE must be "XXXXXX"; ++ they are replaced with a string that makes the filename unique. ++ Then open the file and return a fd. */ ++int ++mkostemp64 (template, flags) ++ char *template; ++ int flags; ++{ ++ return __gen_tempname (template, __GT_BIGFILE, flags | O_LARGEFILE); ++} +-- +cgit v0.9.1