Print this page
5187 missing functions in stdlib.h : mkostemp, mkostemps & mkdtemp
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>


  77 using std::system;
  78 using std::wcstombs;
  79 using std::wctomb;
  80 #endif
  81 
  82 #ifdef  __cplusplus
  83 extern "C" {
  84 #endif
  85 
  86 #ifndef _UID_T
  87 #define _UID_T
  88 typedef unsigned int    uid_t;          /* UID type             */
  89 #endif  /* !_UID_T */
  90 
  91 /* large file compilation environment setup */
  92 #if !defined(_LP64) && _FILE_OFFSET_BITS == 64
  93 
  94 #ifdef  __PRAGMA_REDEFINE_EXTNAME
  95 #pragma redefine_extname        mkstemp         mkstemp64
  96 #pragma redefine_extname        mkstemps        mkstemps64


  97 #else   /* __PRAGMA_REDEFINE_EXTNAME */
  98 #define mkstemp                 mkstemp64
  99 #define mkstemps                mkstemps64


 100 #endif  /* __PRAGMA_REDEFINE_EXTNAME */
 101 
 102 #endif  /* _FILE_OFFSET_BITS == 64 */
 103 
 104 /* In the LP64 compilation environment, all APIs are already large file */
 105 #if defined(_LP64) && defined(_LARGEFILE64_SOURCE)
 106 
 107 #ifdef  __PRAGMA_REDEFINE_EXTNAME
 108 #pragma redefine_extname        mkstemp64       mkstemp
 109 #pragma redefine_extname        mkstemps64      mkstemps


 110 #else   /* __PRAGMA_REDEFINE_EXTNAME */
 111 #define mkstemp64               mkstemp
 112 #define mkstemps64              mkstemps


 113 #endif  /* __PRAGMA_REDEFINE_EXTNAME */
 114 
 115 #endif  /* _LP64 && _LARGEFILE64_SOURCE */
 116 
 117 #if defined(__EXTENSIONS__) || \
 118         (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
 119         (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_REENTRANT)
 120 extern int rand_r(unsigned int *);
 121 #endif
 122 
 123 extern void _exithandle(void);
 124 
 125 #if defined(__EXTENSIONS__) || \
 126         (!defined(_STRICT_STDC) && !defined(_POSIX_C_SOURCE)) || \
 127         defined(_XPG4)
 128 extern double drand48(void);
 129 extern double erand48(unsigned short *);
 130 extern long jrand48(unsigned short *);
 131 extern void lcong48(unsigned short *);
 132 extern long lrand48(void);


 160 
 161 extern void swab(const char *, char *, ssize_t);
 162 #endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */
 163 
 164 #if defined(__EXTENSIONS__) || \
 165         !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
 166         (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64)
 167 extern int      mkstemp(char *);
 168 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
 169 extern int      mkstemps(char *, int);
 170 #endif
 171 #endif /* defined(__EXTENSIONS__) ... */
 172 
 173 #if     defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
 174             !defined(__PRAGMA_REDEFINE_EXTNAME))
 175 extern int      mkstemp64(char *);
 176 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
 177 extern int      mkstemps64(char *, int);
 178 #endif
 179 #endif  /* _LARGEFILE64_SOURCE... */














 180 
 181 #if defined(__EXTENSIONS__) || \
 182         (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
 183         defined(_XPG4_2)
 184 extern long a64l(const char *);
 185 extern char *ecvt(double, int, int *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
 186 extern char *fcvt(double, int, int *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
 187 extern char *gcvt(double, int, char *);
 188 extern int getsubopt(char **, char *const *, char **);
 189 extern int  grantpt(int);
 190 extern char *initstate(unsigned, char *, size_t);
 191 extern char *l64a(long);
 192 extern char *mktemp(char *);
 193 extern char *ptsname(int);
 194 extern long random(void);
 195 extern char *realpath(const char *_RESTRICT_KYWD, char *_RESTRICT_KYWD);
 196 extern char *setstate(const char *);
 197 extern void srandom(unsigned);
 198 extern int  unlockpt(int);
 199 /* Marked LEGACY in SUSv2 and removed in SUSv3 */




  77 using std::system;
  78 using std::wcstombs;
  79 using std::wctomb;
  80 #endif
  81 
  82 #ifdef  __cplusplus
  83 extern "C" {
  84 #endif
  85 
  86 #ifndef _UID_T
  87 #define _UID_T
  88 typedef unsigned int    uid_t;          /* UID type             */
  89 #endif  /* !_UID_T */
  90 
  91 /* large file compilation environment setup */
  92 #if !defined(_LP64) && _FILE_OFFSET_BITS == 64
  93 
  94 #ifdef  __PRAGMA_REDEFINE_EXTNAME
  95 #pragma redefine_extname        mkstemp         mkstemp64
  96 #pragma redefine_extname        mkstemps        mkstemps64
  97 #pragma redefine_extname        mkostemp        mkostemp64
  98 #pragma redefine_extname        mkostemps       mkostemps64
  99 #else   /* __PRAGMA_REDEFINE_EXTNAME */
 100 #define mkstemp                 mkstemp64
 101 #define mkstemps                mkstemps64
 102 #define mkostemp                mkostemp64
 103 #define mkostemps               mkostemps64
 104 #endif  /* __PRAGMA_REDEFINE_EXTNAME */
 105 
 106 #endif  /* _FILE_OFFSET_BITS == 64 */
 107 
 108 /* In the LP64 compilation environment, all APIs are already large file */
 109 #if defined(_LP64) && defined(_LARGEFILE64_SOURCE)
 110 
 111 #ifdef  __PRAGMA_REDEFINE_EXTNAME
 112 #pragma redefine_extname        mkstemp64       mkstemp
 113 #pragma redefine_extname        mkstemps64      mkstemps
 114 #pragma redefine_extname        mkostemp64      mkostemp
 115 #pragma redefine_extname        mkostemps64     mkostemps
 116 #else   /* __PRAGMA_REDEFINE_EXTNAME */
 117 #define mkstemp64               mkstemp
 118 #define mkstemps64              mkstemps
 119 #define mkostemp64              mkostemp
 120 #define mkostemps64             mkostemps
 121 #endif  /* __PRAGMA_REDEFINE_EXTNAME */
 122 
 123 #endif  /* _LP64 && _LARGEFILE64_SOURCE */
 124 
 125 #if defined(__EXTENSIONS__) || \
 126         (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
 127         (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_REENTRANT)
 128 extern int rand_r(unsigned int *);
 129 #endif
 130 
 131 extern void _exithandle(void);
 132 
 133 #if defined(__EXTENSIONS__) || \
 134         (!defined(_STRICT_STDC) && !defined(_POSIX_C_SOURCE)) || \
 135         defined(_XPG4)
 136 extern double drand48(void);
 137 extern double erand48(unsigned short *);
 138 extern long jrand48(unsigned short *);
 139 extern void lcong48(unsigned short *);
 140 extern long lrand48(void);


 168 
 169 extern void swab(const char *, char *, ssize_t);
 170 #endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */
 171 
 172 #if defined(__EXTENSIONS__) || \
 173         !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
 174         (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64)
 175 extern int      mkstemp(char *);
 176 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
 177 extern int      mkstemps(char *, int);
 178 #endif
 179 #endif /* defined(__EXTENSIONS__) ... */
 180 
 181 #if     defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
 182             !defined(__PRAGMA_REDEFINE_EXTNAME))
 183 extern int      mkstemp64(char *);
 184 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
 185 extern int      mkstemps64(char *, int);
 186 #endif
 187 #endif  /* _LARGEFILE64_SOURCE... */
 188 
 189 #if !defined(_STRICT_SYMBOLS) || defined(_XPG7)
 190 extern char     *mkdtemp(char *);
 191 #endif  /* !defined(_STRICT_SYMBOLS) || defined(_XPG7) */
 192 
 193 #if !defined(_STRICT_SYMBOLS)
 194 extern int              mkostemp(char *, int);
 195 extern int              mkostemps(char *, int, int);
 196 #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
 197                 !defined(__PRAGMA_REDEFINE_EXTNAME))
 198 extern int              mkostemp64(char *, int);
 199 extern int              mkostemps64(char *, int, int);
 200 #endif  /* defined(_LARGEFILE64_SOURCE) || !((_FILE_OFFSET_BITS == 64) ... */
 201 #endif  /* !defined(_STRICT_SYMBOLS) */
 202 
 203 #if defined(__EXTENSIONS__) || \
 204         (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
 205         defined(_XPG4_2)
 206 extern long a64l(const char *);
 207 extern char *ecvt(double, int, int *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
 208 extern char *fcvt(double, int, int *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
 209 extern char *gcvt(double, int, char *);
 210 extern int getsubopt(char **, char *const *, char **);
 211 extern int  grantpt(int);
 212 extern char *initstate(unsigned, char *, size_t);
 213 extern char *l64a(long);
 214 extern char *mktemp(char *);
 215 extern char *ptsname(int);
 216 extern long random(void);
 217 extern char *realpath(const char *_RESTRICT_KYWD, char *_RESTRICT_KYWD);
 218 extern char *setstate(const char *);
 219 extern void srandom(unsigned);
 220 extern int  unlockpt(int);
 221 /* Marked LEGACY in SUSv2 and removed in SUSv3 */