The cirros image was rebuilt against the 3.13.0-83 kernel, drivers e1000e, igbvf...
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / uclibc / 0.9.33.2 / 0012-libc-stdlib-add-mkostemp-helpers.patch
1 From 42d1b23fc0f3748b8bf474e456d6c44aa7e563fd Mon Sep 17 00:00:00 2001
2 From: Mike Frysinger <vapier@gentoo.org>
3 Date: Wed, 14 Nov 2012 00:30:54 -0500
4 Subject: [PATCH] libc/stdlib: add mkostemp helpers
5
6 Some projects (like udev) are starting to use this.
7
8 Imported from glibc.
9
10 Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 ---
12  include/stdlib.h         | 23 +++++++++++++++++++++++
13  libc/stdlib/Makefile.in  |  4 ++--
14  libc/stdlib/mkostemp.c   | 32 ++++++++++++++++++++++++++++++++
15  libc/stdlib/mkostemp64.c | 33 +++++++++++++++++++++++++++++++++
16  4 files changed, 90 insertions(+), 2 deletions(-)
17  create mode 100644 libc/stdlib/mkostemp.c
18  create mode 100644 libc/stdlib/mkostemp64.c
19
20 diff --git a/include/stdlib.h b/include/stdlib.h
21 index 354fc66..79ccc55 100644
22 --- a/include/stdlib.h
23 +++ b/include/stdlib.h
24 @@ -652,6 +652,29 @@ extern int mkstemp64 (char *__template) __nonnull ((1)) __wur;
25  extern char *mkdtemp (char *__template) __THROW __nonnull ((1)) __wur;
26  #endif
27  
28 +#ifdef __USE_GNU
29 +/* Generate a unique temporary file name from TEMPLATE similar to
30 +   mkstemp.  But allow the caller to pass additional flags which are
31 +   used in the open call to create the file..
32 +
33 +   This function is a possible cancellation point and therefore not
34 +   marked with __THROW.  */
35 +# ifndef __USE_FILE_OFFSET64
36 +extern int mkostemp (char *__template, int __flags) __nonnull ((1)) __wur;
37 +# else
38 +#  ifdef __REDIRECT
39 +extern int __REDIRECT (mkostemp, (char *__template, int __flags), mkostemp64)
40 +     __nonnull ((1)) __wur;
41 +#  else
42 +#   define mkostemp mkostemp64
43 +#  endif
44 +# endif
45 +# ifdef __USE_LARGEFILE64
46 +extern int mkostemp64 (char *__template, int __flags) __nonnull ((1)) __wur;
47 +# endif
48 +
49 +#endif
50 +
51  
52  __BEGIN_NAMESPACE_STD
53  /* Execute the given line as a shell command.
54 diff --git a/libc/stdlib/Makefile.in b/libc/stdlib/Makefile.in
55 index 3166b8e..b92f7ce 100644
56 --- a/libc/stdlib/Makefile.in
57 +++ b/libc/stdlib/Makefile.in
58 @@ -12,7 +12,7 @@ include $(top_srcdir)libc/stdlib/malloc-simple/Makefile.in
59  include $(top_srcdir)libc/stdlib/malloc-standard/Makefile.in
60  
61  CSRC-y := \
62 -       abort.c getenv.c mkdtemp.c realpath.c canonicalize.c mkstemp.c \
63 +       abort.c getenv.c mkdtemp.c realpath.c canonicalize.c mkstemp.c mkostemp.c \
64         rand.c random.c random_r.c setenv.c div.c ldiv.c lldiv.c \
65         getpt.c drand48-iter.c jrand48.c \
66         jrand48_r.c lcong48.c lrand48.c lrand48_r.c mrand48.c mrand48_r.c nrand48.c \
67 @@ -21,7 +21,7 @@ CSRC-y := \
68  CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_memalign.c
69  CSRC-$(UCLIBC_HAS_PTY) += grantpt.c unlockpt.c ptsname.c
70  CSRC-$(UCLIBC_HAS_ARC4RANDOM) += arc4random.c
71 -CSRC-$(UCLIBC_HAS_LFS) += mkstemp64.c
72 +CSRC-$(UCLIBC_HAS_LFS) += mkstemp64.c mkostemp64.c
73  CSRC-$(UCLIBC_HAS_FLOATS) += drand48.c drand48_r.c erand48.c erand48_r.c
74  CSRC-$(if $(findstring yy,$(UCLIBC_HAS_FLOATS)$(UCLIBC_SUSV3_LEGACY)),y) += \
75         gcvt.c
76 diff --git a/libc/stdlib/mkostemp.c b/libc/stdlib/mkostemp.c
77 new file mode 100644
78 index 0000000..93b50fc
79 --- /dev/null
80 +++ b/libc/stdlib/mkostemp.c
81 @@ -0,0 +1,32 @@
82 +/* Copyright (C) 1998-2012 Free Software Foundation, Inc.
83 +   This file is part of the GNU C Library.
84 +
85 +   The GNU C Library is free software; you can redistribute it and/or
86 +   modify it under the terms of the GNU Lesser General Public
87 +   License as published by the Free Software Foundation; either
88 +   version 2.1 of the License, or (at your option) any later version.
89 +
90 +   The GNU C Library is distributed in the hope that it will be useful,
91 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
92 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
93 +   Lesser General Public License for more details.
94 +
95 +   You should have received a copy of the GNU Lesser General Public
96 +   License along with the GNU C Library; if not, see
97 +   <http://www.gnu.org/licenses/>.  */
98 +
99 +#include <stdio.h>
100 +#include <stdlib.h>
101 +#include "../misc/internals/tempname.h"
102 +
103 +/* Generate a unique temporary file name from TEMPLATE.
104 +   The last six characters of TEMPLATE must be "XXXXXX";
105 +   they are replaced with a string that makes the filename unique.
106 +   Then open the file and return a fd. */
107 +int
108 +mkostemp (template, flags)
109 +     char *template;
110 +     int flags;
111 +{
112 +  return __gen_tempname (template, __GT_FILE, flags);
113 +}
114 diff --git a/libc/stdlib/mkostemp64.c b/libc/stdlib/mkostemp64.c
115 new file mode 100644
116 index 0000000..5509d8c
117 --- /dev/null
118 +++ b/libc/stdlib/mkostemp64.c
119 @@ -0,0 +1,33 @@
120 +/* Copyright (C) 2000-2012 Free Software Foundation, Inc.
121 +   This file is part of the GNU C Library.
122 +
123 +   The GNU C Library is free software; you can redistribute it and/or
124 +   modify it under the terms of the GNU Lesser General Public
125 +   License as published by the Free Software Foundation; either
126 +   version 2.1 of the License, or (at your option) any later version.
127 +
128 +   The GNU C Library is distributed in the hope that it will be useful,
129 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
130 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
131 +   Lesser General Public License for more details.
132 +
133 +   You should have received a copy of the GNU Lesser General Public
134 +   License along with the GNU C Library; if not, see
135 +   <http://www.gnu.org/licenses/>.  */
136 +
137 +#include <fcntl.h>
138 +#include <stdio.h>
139 +#include <stdlib.h>
140 +#include "../misc/internals/tempname.h"
141 +
142 +/* Generate a unique temporary file name from TEMPLATE.
143 +   The last six characters of TEMPLATE must be "XXXXXX";
144 +   they are replaced with a string that makes the filename unique.
145 +   Then open the file and return a fd. */
146 +int
147 +mkostemp64 (template, flags)
148 +     char *template;
149 +     int flags;
150 +{
151 +  return __gen_tempname (template, __GT_BIGFILE, flags | O_LARGEFILE);
152 +}
153 -- 
154 1.8.1.5
155