Skip to content
Snippets Groups Projects
Commit 427ca8a0 authored by Basile Desloges's avatar Basile Desloges Committed by Andre Maroneze
Browse files

[libc] Add mkostemp and mkostemps

parent 00a5b4c6
No related branches found
No related tags found
No related merge requests found
...@@ -823,6 +823,19 @@ extern int posix_memalign(void **memptr, size_t alignment, size_t size); ...@@ -823,6 +823,19 @@ extern int posix_memalign(void **memptr, size_t alignment, size_t size);
*/ */
extern int mkstemp(char *templat); extern int mkstemp(char *templat);
/*@
// missing: requires 'last 6 characters of template must be XXXXXX'
// missing: assigns \result, templat[0..] \from 'filesystem', 'RNG';
// missing: flags == O_APPEND || O_CLOEXEC || O_SYNC
requires valid_template: valid_string(templat);
requires template_len: strlen(templat) >= 6;
assigns templat[0..] \from \nothing;
assigns \result \from \nothing;
ensures result_error_or_valid_fd: \result == -1 ||
0 <= \result < __FC_FOPEN_MAX;
*/
extern int mkostemp(char *templat, int flags);
/*@ /*@
// missing: requires 'last (6+suffixlen) characters of template must be X's' // missing: requires 'last (6+suffixlen) characters of template must be X's'
// missing: assigns \result, templat[0..] \from 'filesystem', 'RNG'; // missing: assigns \result, templat[0..] \from 'filesystem', 'RNG';
...@@ -836,6 +849,20 @@ extern int mkstemp(char *templat); ...@@ -836,6 +849,20 @@ extern int mkstemp(char *templat);
*/ */
extern int mkstemps(char *templat, int suffixlen); extern int mkstemps(char *templat, int suffixlen);
/*@
// missing: requires 'last (6+suffixlen) characters of template must be X's'
// missing: assigns \result, templat[0..] \from 'filesystem', 'RNG';
// missing: flags == O_APPEND || O_CLOEXEC || O_SYNC
requires valid_template: valid_string(templat);
requires template_len: strlen(templat) >= 6 + suffixlen;
requires non_negative_suffixlen: suffixlen >= 0;
assigns templat[0..] \from \nothing;
assigns \result \from \nothing;
ensures result_error_or_valid_fd: \result == -1 ||
0 <= \result < __FC_FOPEN_MAX;
*/
extern int mkostemps(char *templat, int suffixlen, int flags);
// 'realpath' may allocate memory for the result, which is not supported by // 'realpath' may allocate memory for the result, which is not supported by
// some plugins such as Eva. In such cases, it is preferable to use the stub // some plugins such as Eva. In such cases, it is preferable to use the stub
// provided in stdlib.c. // provided in stdlib.c.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment