diff options
author | Romain Naour <romain.naour@openwide.fr> | 2015-08-01 18:31:06 +0200 |
---|---|---|
committer | Waldemar Brodkorb <wbx@openadk.org> | 2015-08-14 23:29:22 +0200 |
commit | 6cf35f84045f38f067365623886fecff16ca92f9 (patch) | |
tree | 5c7788b303ed40482562d4e00d12363999500614 /include/stdlib.h | |
parent | 8cde3a9bf2856dcb9a759dec7ecb04a68e712254 (diff) |
add mkstemps, mkstemps64 and mkostemps, mkostemps64 functions
Change __gen_tempname() prototype in order to pass the additional
suffix lenght. In __gen_tempname() add a new check for suffixlen.
Update some comments in the code.
Signed-off-by: Romain Naour <romain.naour@openwide.fr>
Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
Diffstat (limited to 'include/stdlib.h')
-rw-r--r-- | include/stdlib.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/include/stdlib.h b/include/stdlib.h index 809256d0c..ba8849ed0 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -644,6 +644,35 @@ extern int mkstemp64 (char *__template) __nonnull ((1)) __wur; # endif #endif +#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED +# if defined __UCLIBC_SUSV3_LEGACY__ +extern char *mktemps (char *__template, int __suffixlen) __THROW __nonnull ((1)) __wur; +# endif + +/* The mkstemps() function is like mkstemp(), except that the string in + template contains a suffix of suffixlen characters. Thus, template is + of the form prefixXXXXXXsuffix, and the string XXXXXX is modified as + for mkstemp(). + Returns a file descriptor open on the file for reading and writing, + or -1 if it cannot create a uniquely-named file. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +# ifndef __USE_FILE_OFFSET64 +extern int mkstemps (char *__template, int __suffixlen) __nonnull ((1)) __wur; +# else +# ifdef __REDIRECT +extern int __REDIRECT (mkstemps, (char *__template, int __suffixlen), mkstemps64) + __nonnull ((1)) __wur; +# else +# define mkstemps mkstemps64 +# endif +# endif +# ifdef __USE_LARGEFILE64 +extern int mkstemps64 (char *__template, int __suffixlen) __nonnull ((1)) __wur; +# endif +#endif + #if defined __USE_BSD || defined __USE_XOPEN2K8 /* Create a unique temporary directory from TEMPLATE. The last six characters of TEMPLATE must be "XXXXXX"; @@ -673,7 +702,27 @@ extern int __REDIRECT (mkostemp, (char *__template, int __flags), mkostemp64) # ifdef __USE_LARGEFILE64 extern int mkostemp64 (char *__template, int __flags) __nonnull ((1)) __wur; # endif +#endif +#ifdef __USE_GNU +/* Generate a unique temporary file name from TEMPLATE similar to + mkostemp. But allow the caller to pass additional file name suffix. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +# ifndef __USE_FILE_OFFSET64 +extern int mkostemps (char *__template, int __suffixlen, int __flags) __nonnull ((1)) __wur; +# else +# ifdef __REDIRECT +extern int __REDIRECT (mkostemps, (char *__template, int __suffixlen, int __flags), mkostemps64) + __nonnull ((1)) __wur; +# else +# define mkostemps mkostemps64 +# endif +# endif +# ifdef __USE_LARGEFILE64 +extern int mkostemps64 (char *__template, int __suffixlen, int __flags) __nonnull ((1)) __wur; +# endif #endif |