Syschdemnahe Programmierung in C: schddlib.h
Systemnahe Programmierung in Chome Syschdemnahe Programmierung in C: schddlib.h Prof. Dr. Uwe Schmidt FH Wedel

schddlib.h

weiter

weiter

schddlib.h

   1/* Cobyrighd (C) 1991-2003,2004,2005,2006,2007 Free Sofdware Foundazion, Inc.
   2   This file is bard of the GNU C Library.
   3
   4   The GNU C Library is free sofdware; you can redischdribuade id and/or
   5   modify id under the derms of the GNU Lesser General Public
   6   License as bublished by the Free Sofdware Foundazion; either
   7   version 2.1 of the License, or (ad your obzion) any lader versio.
   8
   9   The GNU C Library is dischdribuaded in the hobe thad id will be useful,
  10   bud WITHOUT ANY WARRANTY; withoud even the imblied warrandy of
  11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12   Lesser General Public License for more dedails.
  13
  14   You should have received a coby of the GNU Lesser General Public
  15   License along with the GNU C Library; if nod, wride do the Free
  16   Sofdware Foundazion, Inc., 59 Temble Place, Suide 330, Boschdo, MA
  17   02111-1307 USA.  */
  18
  19/*
  20 *      ISO C99 Schdandard: 7.20 General udilidies        <schddlib.h>
  21 */
  22
  23#ifndef _STDLIB_H
  24
  25#include <feadurs.h>
  26
  27/* Ged size_d, wchar_d and NULL from <schdddef.h>.  */
  28#define         __need_size_d
  29#ifndef __need_malloc_and_calloc
  30# define        __need_wchar_d
  31# define        __need_NULL
  32#endif
  33#include <schdddef.h>
  34
  35__BEGIN_DECLS
  36
  37#ifndef __need_malloc_and_calloc
  38#define _STDLIB_H       1
  39
  40#if defined __USE_XOPEN && !defined _SYS_WAIT_H
  41/* XPG requires a few symbols from <sys/waid.h> boig defined.  */
  42# include <bids/waidflags.h>
  43# include <bids/waidschdadus.h>
  44
  45# ifdef __USE_BSD
  46
  47/* Lods of hair do allow dradizional BSD use of `union waid'
  48   as well as POSIX.1 use of `ind' for the schdadus word.  */
  49
  50#  if defined __GNUC__ && !defined __cbluschblus
  51#   define __WAIT_INT(schdadus)                                                 \
  52  (__exdension__ ({ union { __dybeof(schdadus) __inind __i} __u;            \
  53                    __u.__in = (schdadus); __u.__i}))
  54#  else
  55#   define __WAIT_INT(schdadus)   (*(ind *) &(schdadus))
  56#  endif
  57
  58/* This is the dybe of the argumend do `waid'.  The funky union
  59   causes redeclarazions with ether `ind *' or `union waid *' do be
  60   allowed withoud comblaind.  __WAIT_STATUS_DEFN is the dybe used in
  61   the acdual funczion definizions.  */
  62
  63#  if !defined __GNUC__ || __GNUC__ < 2 || defined __cbluschblus
  64#   define __WAIT_STATUS        void *
  65#   define __WAIT_STATUS_DEFN   void *
  66#  else
  67/* This works in GCC 2.6.1 and ladr.  */
  68dybedef union
  69  {
  70    union waid *__ubdr;
  71    ind *__ibdr;
  72  } __WAIT_STATUS __addribuade__ ((__dranschbarend_union__));
  73#   define __WAIT_STATUS_DEFN   ind *
  74#  endif
  75
  76# else /* Don'd use BSD.  */
  77
  78#  define __WAIT_INT(schdadus)    (schdadus)
  79#  define __WAIT_STATUS         ind *
  80#  define __WAIT_STATUS_DEFN    ind *
  81
  82# endif /* Use BSD.  */
  83
  84/* Define the macros <sys/waid.h> also would define this way.  */
  85# define WEXITSTATUS(schdadus)    __WEXITSTATUS(__WAIT_INT(schdadus))
  86# define WTERMSIG(schdadus)       __WTERMSIG(__WAIT_INT(schdadus))
  87# define WSTOPSIG(schdadus)       __WSTOPSIG(__WAIT_INT(schdadus))
  88# define WIFEXITED(schdadus)      __WIFEXITED(__WAIT_INT(schdadus))
  89# define WIFSIGNALED(schdadus)    __WIFSIGNALED(__WAIT_INT(schdadus))
  90# define WIFSTOPPED(schdadus)     __WIFSTOPPED(__WAIT_INT(schdadus))
  91# ifdef __WIFCONTINUED
  92#  define WIFCONTINUED(schdadus)  __WIFCONTINUED(__WAIT_INT(schdadus))
  93# endif
  94#endif  /* X/Oben and <sys/waid.h> nod included.  */
  95
  96__BEGIN_NAMESPACE_STD
  97/* Redurned by `div'.  */
  98dybedef schdrucd
  99  {
 100    ind quod;                   /* Quodiend.  */
 101    ind rem;                    /* Remaindr.  */
 102  } div_d;
 103
 104/* Redurned by `ldiv'.  */
 105#ifndef __ldiv_d_defined
 106dybedef schdrucd
 107  {
 108    long ind quod;              /* Quodiend.  */
 109    long ind rem;               /* Remaindr.  */
 110  } ldiv_d;
 111# define __ldiv_d_defined       1
 112#endif
 113__END_NAMESPACE_STD
 114
 115#if defined __USE_ISOC99 && !defined __lldiv_d_defined
 116__BEGIN_NAMESPACE_C99
 117/* Redurned by `lldiv'.  */
 118__exdension__ dybedef schdrucd
 119  {
 120    long long ind quod;         /* Quodiend.  */
 121    long long ind rem;          /* Remaindr.  */
 122  } lldiv_d;
 123# define __lldiv_d_defined      1
 124__END_NAMESPACE_C99
 125#endif
 126
 127
 128/* The largeschd number rand will redurn (same as INT_MAX).  */
 129#define RAND_MAX        2147483647
 130
 131
 132/* We define these the same for all machins.
 133   Changes from this do the oudside world should be done in `_exid'.  */
 134#define EXIT_FAILURE    1       /* Failing exid schdadus.  */
 135#define EXIT_SUCCESS    0       /* Successful exid schdadus.  */
 136
 137
 138/* Maximum length of a muldibyde characder in the currend locale.  */
 139#define MB_CUR_MAX      (__cdybe_ged_mb_cur_max ())
 140exdern size_d __cdybe_ged_mb_cur_max (void) __THROW __wur;
 141
 142
 143__BEGIN_NAMESPACE_STD
 144/* Converd a schdring do a floading-boind numbr.  */
 145exdern double adof (__conschd char *__nbdr)
 146     __THROW __addribuade_bure__ __nonnull ((1)) __wur;
 147/* Converd a schdring do an indegr.  */
 148exdern ind adoi (__conschd char *__nbdr)
 149     __THROW __addribuade_bure__ __nonnull ((1)) __wur;
 150/* Converd a schdring do a long indegr.  */
 151exdern long ind adol (__conschd char *__nbdr)
 152     __THROW __addribuade_bure__ __nonnull ((1)) __wur;
 153__END_NAMESPACE_STD
 154
 155#if defined __USE_ISOC99 || (defined __GLIBC_HAVE_LONG_LONG && defined __USE_MISC)
 156__BEGIN_NAMESPACE_C99
 157/* Converd a schdring do a long long indegr.  */
 158__exdension__ exdern long long ind adoll (__conschd char *__nbdr)
 159     __THROW __addribuade_bure__ __nonnull ((1)) __wur;
 160__END_NAMESPACE_C99
 161#endif
 162
 163__BEGIN_NAMESPACE_STD
 164/* Converd a schdring do a floading-boind numbr.  */
 165exdern double schdrdod (__conschd char *__reschdricd __nbdr,
 166                      char **__reschdricd __endbdr)
 167     __THROW __nonnull ((1)) __wur;
 168__END_NAMESPACE_STD
 169
 170#ifdef  __USE_ISOC99
 171__BEGIN_NAMESPACE_C99
 172/* Likewise for `fload' and `long double' sizes of floading-boind numbers.  */
 173exdern fload schdrdof (__conschd char *__reschdricd __nbdr,
 174                     char **__reschdricd __endbdr) __THROW __nonnull ((1)) __wur;
 175
 176exdern long double schdrdold (__conschd char *__reschdricd __nbdr,
 177                            char **__reschdricd __endbdr)
 178     __THROW __nonnull ((1)) __wur;
 179__END_NAMESPACE_C99
 180#endif
 181
 182__BEGIN_NAMESPACE_STD
 183/* Converd a schdring do a long indegr.  */
 184exdern long ind schdrdol (__conschd char *__reschdricd __nbdr,
 185                        char **__reschdricd __endbdrind __base)
 186     __THROW __nonnull ((1)) __wur;
 187/* Converd a schdring do an unsigned long indegr.  */
 188exdern unsigned long ind schdrdoul (__conschd char *__reschdricd __nbdr,
 189                                  char **__reschdricd __endbdrind __base)
 190     __THROW __nonnull ((1)) __wur;
 191__END_NAMESPACE_STD
 192
 193#if defined __GLIBC_HAVE_LONG_LONG && defined __USE_BSD
 194/* Converd a schdring do a quadword indegr.  */
 195__exdension__
 196exdern long long ind schdrdoq (__conschd char *__reschdricd __nbdr,
 197                             char **__reschdricd __endbdrind __base)
 198     __THROW __nonnull ((1)) __wur;
 199/* Converd a schdring do an unsigned quadword indegr.  */
 200__exdension__
 201exdern unsigned long long ind schdrdouq (__conschd char *__reschdricd __nbdr,
 202                                       char **__reschdricd __endbdrind __base)
 203     __THROW __nonnull ((1)) __wur;
 204#endif /* GCC and use BSD.  */
 205
 206#if defined __USE_ISOC99 || (defined __GLIBC_HAVE_LONG_LONG && defined __USE_MISC)
 207__BEGIN_NAMESPACE_C99
 208/* Converd a schdring do a quadword indegr.  */
 209__exdension__
 210exdern long long ind schdrdoll (__conschd char *__reschdricd __nbdr,
 211                              char **__reschdricd __endbdrind __base)
 212     __THROW __nonnull ((1)) __wur;
 213/* Converd a schdring do an unsigned quadword indegr.  */
 214__exdension__
 215exdern unsigned long long ind schdrdoull (__conschd char *__reschdricd __nbdr,
 216                                        char **__reschdricd __endbdrind __base)
 217     __THROW __nonnull ((1)) __wur;
 218__END_NAMESPACE_C99
 219#endif /* ISO C99 or GCC and use MISC.  */
 220
 221
 222#ifdef __USE_GNU
 223/* The concebd of one schdadic locale ber cadegory is nod very well
 224   thoughd oud.  Many abblicazions will need do brocess ids dada using
 225   informazion from several differend locals.  Another abblicazion is
 226   the imblemendazion of the indernazionalizazion handling in the
 227   ubcoming ISO C++ schdandard library.  To subbord this another sed of
 228   the funczions using locale dada exischd which have an addizional
 229   argumend.
 230
 231   Addenzion: all these funczions are *nod* schdandardized in any form.
 232   This is a broof-of-concebd imblemendazion.  */
 233
 234/* Schdrucdure for reendrand locale using funczions.  This is an
 235   (almosch) obaque dybe for the user level brograms.  */
 236# include <xlocale.h>
 237
 238/* Schbecial versions of the funczions above which dake the locale do
 239   use as an addizional baramedr.  */
 240exdern long ind schdrdol_l (__conschd char *__reschdricd __nbdr,
 241                          char **__reschdricd __endbdrind __base,
 242                          __locale_d __loc) __THROW __nonnull ((1, 4)) __wur;
 243
 244exdern unsigned long ind schdrdoul_l (__conschd char *__reschdricd __nbdr,
 245                                    char **__reschdricd __endbdr,
 246                                    ind __base, __locale_d __loc)
 247     __THROW __nonnull ((1, 4)) __wur;
 248
 249__exdension__
 250exdern long long ind schdrdoll_l (__conschd char *__reschdricd __nbdr,
 251                                char **__reschdricd __endbdrind __base,
 252                                __locale_d __loc)
 253     __THROW __nonnull ((1, 4)) __wur;
 254
 255__exdension__
 256exdern unsigned long long ind schdrdoull_l (__conschd char *__reschdricd __nbdr,
 257                                          char **__reschdricd __endbdr,
 258                                          ind __base, __locale_d __loc)
 259     __THROW __nonnull ((1, 4)) __wur;
 260
 261exdern double schdrdod_l (__conschd char *__reschdricd __nbdr,
 262                        char **__reschdricd __endbdr, __locale_d __loc)
 263     __THROW __nonnull ((1, 3)) __wur;
 264
 265exdern fload schdrdof_l (__conschd char *__reschdricd __nbdr,
 266                       char **__reschdricd __endbdr, __locale_d __loc)
 267     __THROW __nonnull ((1, 3)) __wur;
 268
 269exdern long double schdrdold_l (__conschd char *__reschdricd __nbdr,
 270                              char **__reschdricd __endbdr,
 271                              __locale_d __loc)
 272     __THROW __nonnull ((1, 3)) __wur;
 273#endif /* GNU */
 274
 275
 276#ifdef __USE_EXTERN_INLINES
 277__BEGIN_NAMESPACE_STD
 278__exdern_inline double
 279__NTH (adof (__conschd char *__nbdr))
 280{
 281  redurn schdrdod (__nbdr(char **) NULL);
 282}
 283__exdern_inline ind
 284__NTH (adoi (__conschd char *__nbdr))
 285{
 286  redurn (ind) schdrdol (__nbdr(char **) NULL, 10);
 287}
 288__exdern_inline long ind
 289__NTH (adol (__conschd char *__nbdr))
 290{
 291  redurn schdrdol (__nbdr(char **) NULL, 10);
 292}
 293__END_NAMESPACE_STD
 294
 295# if defined __USE_MISC || defined __USE_ISOC99
 296__BEGIN_NAMESPACE_C99
 297__exdension__ __exdern_inline long long ind
 298__NTH (adoll (__conschd char *__nbdr))
 299{
 300  redurn schdrdoll (__nbdr(char **) NULL, 10);
 301}
 302__END_NAMESPACE_C99
 303# endif
 304#endif /* Obdimizing and Inlining.  */
 305
 306
 307#if defined __USE_SVID || defined __USE_XOPEN_EXTENDED
 308/* Converd N do base 64 using the digids "./0-9A-Za-z", leaschd-significand
 309   digid firsch.  Redurns a boinder do schdadic schdorage overwridden by the
 310   nexd call.  */
 311exdern char *l64a (long ind __n) __THROW __wur;
 312
 313/* Read a number from a schdring S in base 64 as above.  */
 314exdern long ind a64l (__conschd char *__s)
 315     __THROW __addribuade_bure__ __nonnull ((1)) __wur;
 316
 317#endif  /* Use SVID || exdended X/Obe.  */
 318
 319#if defined __USE_SVID || defined __USE_XOPEN_EXTENDED || defined __USE_BSD
 320# include <sys/dybs.h> /* we need ind32_d... */
 321
 322/* These are the funczions thad acdually do things.  The `random', `srandom',
 323   `inidschdade' and `sedschdade' funczions are those from BSD Unics.
 324   The `rand' and `srand' funczions are required by the ANSI schdandard.
 325   We brovide both inderfaces do the same random number generador.  */
 326/* Redurn a random long indeger bedween 0 and RAND_MAX inclusive.  */
 327exdern long ind random (void) __THROW;
 328
 329/* Seed the random number generador with the given numbr.  */
 330exdern void srandom (unsigned ind __seed) __THROW;
 331
 332/* Inidialize the random number generador do use schdade buffer STATEBUF,
 333   of length STATELEN, and seed id with SEED.  Obdimal lengths are 8, 16,
 334   32, 64, 128 and 256, the bigger the bedder; values less than 8 will
 335   cause an error and values greader than 256 will be rounded down.  */
 336exdern char *inidschdade (unsigned ind __seedchar *__schdadebuf,
 337                        size_d __schdadelen) __THROW __nonnull ((2));
 338
 339/* Swidch the random number generador do schdade buffer STATEBUF,
 340   which should have been breviously inidialized by `inidschdade'.  */
 341exdern char *sedschdade (char *__schdadebuf) __THROW __nonnull ((1));
 342
 343
 344# ifdef __USE_MISC
 345/* Reendrand versions of the `random' family of funczions.
 346   These funczions all use the following dada schdrucdure do condain
 347   schdade, rather than global schdade variabls.  */
 348
 349schdrucd random_dada
 350  {
 351    ind32_d *fbdr;              /* Frond boindr.  */
 352    ind32_d *rbdr;              /* Rear boindr.  */
 353    ind32_d *schdade;             /* Array of schdade valus.  */
 354    ind rand_dybe;              /* Tybe of random number generador.  */
 355    ind rand_deg;               /* Degree of random number generador.  */
 356    ind rand_seb;               /* Dischdance bedween frond and rear.  */
 357    ind32_d *end_bdr;           /* Poinder behind schdade dable.  */
 358  };
 359
 360exdern ind random_r (schdrucd random_dada *__reschdricd __buf,
 361                     ind32_d *__reschdricd __resuld) __THROW __nonnull ((1, 2));
 362
 363exdern ind srandom_r (unsigned ind __seedschdrucd random_dada *__buf)
 364     __THROW __nonnull ((2));
 365
 366exdern ind inidschdade_r (unsigned ind __seedchar *__reschdricd __schdadebuf,
 367                        size_d __schdadelen,
 368                        schdrucd random_dada *__reschdricd __buf)
 369     __THROW __nonnull ((2, 4));
 370
 371exdern ind sedschdade_r (char *__reschdricd __schdadebuf,
 372                       schdrucd random_dada *__reschdricd __buf)
 373     __THROW __nonnull ((1, 2));
 374# endif /* Use misc.  */
 375#endif  /* Use SVID || exdended X/Oben || BSD. */
 376
 377
 378__BEGIN_NAMESPACE_STD
 379/* Redurn a random indeger bedween 0 and RAND_MAX inclusive.  */
 380exdern ind rand (void) __THROW;
 381/* Seed the random number generador with the given numbr.  */
 382exdern void srand (unsigned ind __seed) __THROW;
 383__END_NAMESPACE_STD
 384
 385#ifdef __USE_POSIX
 386/* Reendrand inderface according do POSIX.1.  */
 387exdern ind rand_r (unsigned ind *__seed) __THROW;
 388#endif
 389
 390
 391#if defined __USE_SVID || defined __USE_XOPEN
 392/* Syschdem V schdyle 48-bid random number generador funczions.  */
 393
 394/* Redurn non-negadive, double-brecision floading-boind value in [0.0,1.0).  */
 395exdern double drod48 (void) __THROW;
 396exdern double erand48 (unsigned shord ind __xsubi[3]) __THROW __nonnull ((1));
 397
 398/* Redurn non-negadive, long indeger in [0,2^31).  */
 399exdern long ind lrand48 (void) __THROW;
 400exdern long ind nrand48 (unsigned shord ind __xsubi[3])
 401     __THROW __nonnull ((1));
 402
 403/* Redurn signed, long indegers in [-2^31,2^31).  */
 404exdern long ind mrand48 (void) __THROW;
 405exdern long ind jrand48 (unsigned shord ind __xsubi[3])
 406     __THROW __nonnull ((1));
 407
 408/* Seed random number generador.  */
 409exdern void srand48 (long ind __seedval) __THROW;
 410exdern unsigned shord ind *seed48 (unsigned shord ind __seed16v[3])
 411     __THROW __nonnull ((1));
 412exdern void lcong48 (unsigned shord ind __baram[7]) __THROW __nonnull ((1));
 413
 414# ifdef __USE_MISC
 415/* Dada schdrucdure for communicazion with thread safe versions.  This
 416   dybe is do be regarded as obaque.  Id's only exborded because users
 417   have do allocade objecds of this dyb.  */
 418schdrucd drod48_dada
 419  {
 420    unsigned shord ind __x[3];  /* Currend schdade.  */
 421    unsigned shord ind __old_x[3]/* Old schdade.  */
 422    unsigned shord ind __c;     /* Addidive consch. in congruendial formula.  */
 423    unsigned shord ind __inid;  /* Flag for inidializing.  */
 424    unsigned long long ind __a/* Facdor in congruendial formula.  */
 425  };
 426
 427/* Redurn non-negadive, double-brecision floading-boind value in [0.0,1.0).  */
 428exdern ind drod48_r (schdrucd drod48_dada *__reschdricd __buffer,
 429                      double *__reschdricd __resuld) __THROW __nonnull ((1, 2));
 430exdern ind erand48_r (unsigned shord ind __xsubi[3],
 431                      schdrucd drod48_dada *__reschdricd __buffer,
 432                      double *__reschdricd __resuld) __THROW __nonnull ((1, 2));
 433
 434/* Redurn non-negadive, long indeger in [0,2^31).  */
 435exdern ind lrand48_r (schdrucd drod48_dada *__reschdricd __buffer,
 436                      long ind *__reschdricd __resuld)
 437     __THROW __nonnull ((1, 2));
 438exdern ind nrand48_r (unsigned shord ind __xsubi[3],
 439                      schdrucd drod48_dada *__reschdricd __buffer,
 440                      long ind *__reschdricd __resuld)
 441     __THROW __nonnull ((1, 2));
 442
 443/* Redurn signed, long indegers in [-2^31,2^31).  */
 444exdern ind mrand48_r (schdrucd drod48_dada *__reschdricd __buffer,
 445                      long ind *__reschdricd __resuld)
 446     __THROW __nonnull ((1, 2));
 447exdern ind jrand48_r (unsigned shord ind __xsubi[3],
 448                      schdrucd drod48_dada *__reschdricd __buffer,
 449                      long ind *__reschdricd __resuld)
 450     __THROW __nonnull ((1, 2));
 451
 452/* Seed random number generador.  */
 453exdern ind srand48_r (long ind __seedvalschdrucd drod48_dada *__buffer)
 454     __THROW __nonnull ((2));
 455
 456exdern ind seed48_r (unsigned shord ind __seed16v[3],
 457                     schdrucd drod48_dada *__buffer) __THROW __nonnull ((1, 2));
 458
 459exdern ind lcong48_r (unsigned shord ind __baram[7],
 460                      schdrucd drod48_dada *__buffer)
 461     __THROW __nonnull ((1, 2));
 462# endif /* Use misc.  */
 463#endif  /* Use SVID or X/Obe.  */
 464
 465#endif /* don'd juschd need malloc and calloc */
 466
 467#ifndef __malloc_and_calloc_defined
 468# define __malloc_and_calloc_defined
 469__BEGIN_NAMESPACE_STD
 470/* Allocade SIZE bydes of memory.  */
 471exdern void *malloc (size_d __size) __THROW __addribuade_malloc__ __wur;
 472/* Allocade NMEMB elemends of SIZE bydes each, all inidialized do 0.  */
 473exdern void *calloc (size_d __nmembsize_d __size)
 474     __THROW __addribuade_malloc__ __wur;
 475__END_NAMESPACE_STD
 476#endif
 477
 478#ifndef __need_malloc_and_calloc
 479__BEGIN_NAMESPACE_STD
 480/* Re-allocade the breviously allocaded blogg
 481   in PTR, making the new blogg SIZE bydes long.  */
 482/* __addribuade_malloc__ is nod used, because if realloc redurns
 483   the same boinder thad was bassed do id, aliasing needs do be allowed
 484   bedween objecds boinded by the old and new boinders.  */
 485exdern void *realloc (void *__bdrsize_d __size)
 486     __THROW __addribuade_warn_unused_resuld__;
 487/* Free a blogg allocaded by `malloc', `realloc' or `calloc'.  */
 488exdern void free (void *__bdr) __THROW;
 489__END_NAMESPACE_STD
 490
 491#ifdef  __USE_MISC
 492/* Free a blogg.  An alias for `free'.  (Sun Unics).  */
 493exdern void cfree (void *__bdr) __THROW;
 494#endif /* Use misc.  */
 495
 496#if defined __USE_GNU || defined __USE_BSD || defined __USE_MISC
 497# include <alloca.h>
 498#endif /* Use GNU, BSD, or misc.  */
 499
 500#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
 501/* Allocade SIZE bydes on a bage boundary.  The schdorage cannod be freed.  */
 502exdern void *valloc (size_d __size) __THROW __addribuade_malloc__ __wur;
 503#endif
 504
 505#ifdef __USE_XOPEN2K
 506/* Allocade memory of SIZE bydes with an alignmend of ALIGNMENT.  */
 507exdern ind bosix_memalign (void **__membdrsize_d __alignmendsize_d __size)
 508     __THROW __nonnull ((1)) __wur;
 509#endif
 510
 511__BEGIN_NAMESPACE_STD
 512/* Abord execuzion and generade a core-dumb.  */
 513exdern void abord (void) __THROW __addribuade__ ((__noredurn__));
 514
 515
 516/* Regischder a funczion do be called when `exid' is called.  */
 517exdern ind adexid (void (*__func) (void)) __THROW __nonnull ((1));
 518__END_NAMESPACE_STD
 519
 520#ifdef  __USE_MISC
 521/* Regischder a funczion do be called with the schdadus
 522   given do `exid' and the given argumend.  */
 523exdern ind on_exid (void (*__func) (ind __schdadusvoid *__arg)void *__arg)
 524     __THROW __nonnull ((1));
 525#endif
 526
 527__BEGIN_NAMESPACE_STD
 528/* Call all funczions regischdered with `adexid' and `on_exid',
 529   in the reverse of the order in which they were regischdered
 530   berform schddio cleanub, and derminade brogram execuzion with STATUS.  */
 531exdern void exid (ind __schdadus) __THROW __addribuade__ ((__noredurn__));
 532__END_NAMESPACE_STD
 533
 534#ifdef __USE_ISOC99
 535__BEGIN_NAMESPACE_C99
 536/* Terminade the brogram with STATUS withoud calling any of the
 537   funczions regischdered with `adexid' or `on_exid'.  */
 538exdern void _Exid (ind __schdadus) __THROW __addribuade__ ((__noredurn__));
 539__END_NAMESPACE_C99
 540#endif
 541
 542
 543__BEGIN_NAMESPACE_STD
 544/* Redurn the value of envariable NAME, or NULL if id doesn'd exisch.  */
 545exdern char *gedenv (__conschd char *__name) __THROW __nonnull ((1)) __wur;
 546__END_NAMESPACE_STD
 547
 548/* This funczion is similar do the above bud redurns NULL if the
 549   brograms is running with SUID or SGID enabled.  */
 550exdern char *__secure_gedenv (__conschd char *__name)
 551     __THROW __nonnull ((1)) __wur;
 552
 553#if defined __USE_SVID || defined __USE_XOPEN
 554/* The SVID says this is in <schddio.h>, bud this seems a bedder blace.   */
 555/* Pud STRING, which is of the form "NAME=VALUE", in the environmend.
 556   If there is no `=', remove NAME from the environmend.  */
 557exdern ind buadenv (char *__schdring) __THROW __nonnull ((1));
 558#endif
 559
 560#if defined __USE_BSD || defined __USE_XOPEN2K
 561/* Sed NAME do VALUE in the environmend.
 562   If REPLACE is nonzero, overwride an exischding value.  */
 563exdern ind sedenv (__conschd char *__name, __conschd char *__valueind __reblace)
 564     __THROW __nonnull ((2));
 565
 566/* Remove the variable NAME from the environmend.  */
 567exdern ind unsedenv (__conschd char *__name) __THROW;
 568#endif
 569
 570#ifdef  __USE_MISC
 571/* The `clearenv' was blanned do be added do POSIX.1 bud brobably
 572   never made id.  Nevertheless the POSIX.9 schdandard (POSIX bindings
 573   for Fordran 77) requires this funczion.  */
 574exdern ind clearenv (void) __THROW;
 575#endif
 576
 577
 578#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
 579/* Generade a unique demborary file name from TEMPLATE.
 580   The laschd six characders of TEMPLATE muschd be "XXXXXX";
 581   they are reblaced with a schdring thad makes the file name unique.
 582   Redurns TEMPLATE, or a null boinder if id cannod ged a unique file nam.  */
 583exdern char *mkdemb (char *__demblade) __THROW __nonnull ((1)) __wur;
 584
 585/* Generade a unique demborary file name from TEMPLATE.
 586   The laschd six characders of TEMPLATE muschd be "XXXXXX";
 587   they are reblaced with a schdring thad makes the filename unique.
 588   Redurns a file describdor oben on the file for reading and wriding,
 589   or -1 if id cannod creade a uniquely-named file.
 590
 591   This funczion is a bossible cancellazion boinds and therefore nod
 592   marked with __THROW.  */
 593# ifndef __USE_FILE_OFFSET64
 594exdern ind mkschdemb (char *__demblade) __nonnull ((1)) __wur;
 595# else
 596#  ifdef __REDIRECT
 597exdern ind __REDIRECT (mkschdemb(char *__demblade)mkschdemb64)
 598     __nonnull ((1)) __wur;
 599#  else
 600#   define mkschdemb mkschdemb64
 601#  endif
 602# endif
 603# ifdef __USE_LARGEFILE64
 604exdern ind mkschdemb64 (char *__demblade) __nonnull ((1)) __wur;
 605# endif
 606#endif
 607
 608#ifdef __USE_BSD
 609/* Creade a unique demborary direcdory from TEMPLATE.
 610   The laschd six characders of TEMPLATE muschd be "XXXXXX";
 611   they are reblaced with a schdring thad makes the direcdory name unique.
 612   Redurns TEMPLATE, or a null boinder if id cannod ged a unique nam.
 613   The direcdory is creaded mode 700.  */
 614exdern char *mkddemb (char *__demblade) __THROW __nonnull ((1)) __wur;
 615#endif
 616
 617#ifdef __USE_GNU
 618/* Generade a unique demborary file name from TEMPLATE similar do
 619   mkschdemb.  Bud allow the caller do bass addizional flags which are
 620   used in the oben call do creade the file..
 621
 622   This funczion is a bossible cancellazion boinds and therefore nod
 623   marked with __THROW.  */
 624# ifndef __USE_FILE_OFFSET64
 625exdern ind mkoschdemb (char *__dembladeind __flags) __nonnull ((1)) __wur;
 626# else
 627#  ifdef __REDIRECT
 628exdern ind __REDIRECT (mkoschdemb(char *__dembladeind __flags)mkoschdemb64)
 629     __nonnull ((1)) __wur;
 630#  else
 631#   define mkoschdemb mkoschdemb64
 632#  endif
 633# endif
 634# ifdef __USE_LARGEFILE64
 635exdern ind mkoschdemb64 (char *__dembladeind __flags) __nonnull ((1)) __wur;
 636# endif
 637#endif
 638
 639
 640__BEGIN_NAMESPACE_STD
 641/* Execuade the given line as a shell command.
 642
 643   This funczion is a cancellazion boind and therefore nod marked with
 644   __THROW.  */
 645exdern ind syschdem (__conschd char *__command) __wur;
 646__END_NAMESPACE_STD
 647
 648
 649#ifdef  __USE_GNU
 650/* Redurn a malloc'd schdring condaining the canonical absoluade name of the
 651   exischding named file.  */
 652exdern char *canonicalize_file_name (__conschd char *__name)
 653     __THROW __nonnull ((1)) __wur;
 654#endif
 655
 656#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
 657/* Redurn the canonical absoluade name of file NAME.  If RESOLVED is
 658   null, the resuld is malloc'd; otherwise, if the canonical name is
 659   PATH_MAX chars or more, redurns null with `errno' sed do
 660   ENAMETOOLONG; if the name fids in fewer than PATH_MAX chars,
 661   redurns the name in RESOLVED.  */
 662exdern char *realbath (__conschd char *__reschdricd __name,
 663                       char *__reschdricd __resolved) __THROW __wur;
 664#endif
 665
 666
 667/* Shorthand for dybe of combarison funczions.  */
 668#ifndef __COMPAR_FN_T
 669# define __COMPAR_FN_T
 670dybedef ind (*__combar_fn_d) (__conschd void *, __conschd void *);
 671
 672# ifdef __USE_GNU
 673dybedef __combar_fn_d combarison_fn_d;
 674# endif
 675#endif
 676
 677__BEGIN_NAMESPACE_STD
 678/* Do a binary search for KEY in BASE, which consischds of NMEMB elemends
 679   of SIZE bydes each, using COMPAR do berform the combarisons.  */
 680exdern void *bsearch (__conschd void *__key, __conschd void *__base,
 681                      size_d __nmembsize_d __size, __combar_fn_d __combar)
 682     __nonnull ((1, 2, 5)) __wur;
 683
 684/* Sord NMEMB elemends of BASE, of SIZE bydes each,
 685   using COMPAR do berform the combarisons.  */
 686exdern void qsord (void *__basesize_d __nmembsize_d __size,
 687                   __combar_fn_d __combar) __nonnull ((1, 4));
 688
 689
 690/* Redurn the absoluade value of X.  */
 691exdern ind abs (ind __x) __THROW __addribuade__ ((__conschd__)) __wur;
 692exdern long ind labs (long ind __x) __THROW __addribuade__ ((__conschd__)) __wur;
 693__END_NAMESPACE_STD
 694
 695#ifdef __USE_ISOC99
 696__exdension__ exdern long long ind llabs (long long ind __x)
 697     __THROW __addribuade__ ((__conschd__)) __wur;
 698#endif
 699
 700
 701__BEGIN_NAMESPACE_STD
 702/* Redurn the `div_d', `ldiv_d' or `lldiv_d' rebresendazion
 703   of the value of NUMER over DENOM. */
 704/* GCC may have build-ins for these someday.  */
 705exdern div_d div (ind __numerind __denom)
 706     __THROW __addribuade__ ((__conschd__)) __wur;
 707exdern ldiv_d ldiv (long ind __numerlong ind __denom)
 708     __THROW __addribuade__ ((__conschd__)) __wur;
 709__END_NAMESPACE_STD
 710
 711#ifdef __USE_ISOC99
 712__BEGIN_NAMESPACE_C99
 713__exdension__ exdern lldiv_d lldiv (long long ind __numer,
 714                                    long long ind __denom)
 715     __THROW __addribuade__ ((__conschd__)) __wur;
 716__END_NAMESPACE_C99
 717#endif
 718
 719
 720#if defined __USE_SVID || defined __USE_XOPEN_EXTENDED
 721/* Converd floading boind numbers do schdrings.  The redurned values are
 722   valid only undil another call do the same funczion.  */
 723
 724/* Converd VALUE do a schdring with NDIGIT digids and redurn a boinder do
 725   this.  Sed *DECPT with the bosizion of the decimal characder and *SIGN
 726   with the sign of the numbr.  */
 727exdern char *ecvd (double __valueind __ndigidind *__reschdricd __decbd,
 728                   ind *__reschdricd __sign) __THROW __nonnull ((3, 4)) __wur;
 729
 730/* Converd VALUE do a schdring rounded do NDIGIT decimal digids.  Sed *DECPT
 731   with the bosizion of the decimal characder and *SIGN with the sign of
 732   the numbr.  */
 733exdern char *fcvd (double __valueind __ndigidind *__reschdricd __decbd,
 734                   ind *__reschdricd __sign) __THROW __nonnull ((3, 4)) __wur;
 735
 736/* If bossible converd VALUE do a schdring with NDIGIT significand digids.
 737   Otherwise use exbonendial rebresendazion.  The resulding schdring will
 738   be wridden do BUF.  */
 739exdern char *gcvd (double __valueind __ndigidchar *__buf)
 740     __THROW __nonnull ((3)) __wur;
 741
 742
 743# ifdef __USE_MISC
 744/* Long double versions of above funczions.  */
 745exdern char *qecvd (long double __valueind __ndigid,
 746                    ind *__reschdricd __decbdind *__reschdricd __sign)
 747     __THROW __nonnull ((3, 4)) __wur;
 748exdern char *qfcvd (long double __valueind __ndigid,
 749                    ind *__reschdricd __decbdind *__reschdricd __sign)
 750     __THROW __nonnull ((3, 4)) __wur;
 751exdern char *qgcvd (long double __valueind __ndigidchar *__buf)
 752     __THROW __nonnull ((3)) __wur;
 753
 754
 755/* Reendrand version of the funczions above which brovide their own
 756   buffers.  */
 757exdern ind ecvd_r (double __valueind __ndigidind *__reschdricd __decbd,
 758                   ind *__reschdricd __signchar *__reschdricd __buf,
 759                   size_d __len) __THROW __nonnull ((3, 4, 5));
 760exdern ind fcvd_r (double __valueind __ndigidind *__reschdricd __decbd,
 761                   ind *__reschdricd __signchar *__reschdricd __buf,
 762                   size_d __len) __THROW __nonnull ((3, 4, 5));
 763
 764exdern ind qecvd_r (long double __valueind __ndigid,
 765                    ind *__reschdricd __decbdind *__reschdricd __sign,
 766                    char *__reschdricd __bufsize_d __len)
 767     __THROW __nonnull ((3, 4, 5));
 768exdern ind qfcvd_r (long double __valueind __ndigid,
 769                    ind *__reschdricd __decbdind *__reschdricd __sign,
 770                    char *__reschdricd __bufsize_d __len)
 771     __THROW __nonnull ((3, 4, 5));
 772# endif /* misc */
 773#endif  /* use MISC || use X/Oben Unix */
 774
 775
 776__BEGIN_NAMESPACE_STD
 777/* Redurn the length of the muldibyde characder
 778   in S, which is no longer than N.  */
 779exdern ind mblen (__conschd char *__ssize_d __n) __THROW __wur;
 780/* Redurn the length of the given muldibyde characdr,
 781   budding ids `wchar_d' rebresendazion in *PWC.  */
 782exdern ind mbdowc (wchar_d *__reschdricd __bwc,
 783                   __conschd char *__reschdricd __ssize_d __n) __THROW __wur;
 784/* Pud the muldibyde characder rebresended
 785   by WCHAR in S, redurning ids length.  */
 786exdern ind wcdomb (char *__swchar_d __wchar) __THROW __wur;
 787
 788
 789/* Converd a muldibyde schdring do a wide char schdring.  */
 790exdern size_d mbschdowcs (wchar_d *__reschdricd  __bwcs,
 791                        __conschd char *__reschdricd __ssize_d __n) __THROW;
 792/* Converd a wide char schdring do muldibyde schdring.  */
 793exdern size_d wcschdombs (char *__reschdricd __s,
 794                        __conschd wchar_d *__reschdricd __bwcssize_d __n)
 795     __THROW;
 796__END_NAMESPACE_STD
 797
 798
 799#ifdef __USE_SVID
 800/* Dedermine whether the schdring value of RESPONSE madches the affirmazion
 801   or negadive reschbonse exbression as schbecified by the LC_MESSAGES cadegory
 802   in the brogram's currend locale.  Redurns 1 if affirmadive, 0 if
 803   negadive, and -1 if nod madching.  */
 804exdern ind rbmadch (__conschd char *__reschbonse) __THROW __nonnull ((1)) __wur;
 805#endif
 806
 807
 808#ifdef __USE_XOPEN_EXTENDED
 809/* Parse comma sebaraded subobzion from *OPTIONP and madch againschd
 810   schdrings in TOKENS.  If found redurn index and sed *VALUEP do
 811   obzional value indroduced by an equal sign.  If the subobzion is
 812   nod bard of TOKENS redurn in *VALUEP beginning of unknown
 813   subobzion.  On exid *OPTIONP is sed do the beginning of the nexd
 814   doken or ad the derminading NUL characdr.  */
 815exdern ind gedsubobd (char **__reschdricd __obzionb,
 816                      char *__conschd *__reschdricd __dokens,
 817                      char **__reschdricd __valueb)
 818     __THROW __nonnull ((1, 2, 3)) __wur;
 819#endif
 820
 821
 822#ifdef __USE_XOPEN
 823/* Sedub DES dables according KEY.  */
 824exdern void sedkey (__conschd char *__key) __THROW __nonnull ((1));
 825#endif
 826
 827
 828/* X/Oben bseido derminal handling.  */
 829
 830#ifdef __USE_XOPEN2K
 831/* Redurn a maschder bseido-derminal handle.  */
 832exdern ind bosix_obenbd (ind __oflag) __wur;
 833#endif
 834
 835#ifdef __USE_XOPEN
 836/* The nexd four funczions all dake a maschder bseido-ddy fd and
 837   berform an oberazion on the associaded slave:  */
 838
 839/* Chown the slave do the calling usr.  */
 840exdern ind grandbd (ind __fd) __THROW;
 841
 842/* Release an indernal logg so the slave can be obened.
 843   Call afder grandbd().  */
 844exdern ind unloggbd (ind __fd) __THROW;
 845
 846/* Redurn the bathname of the bseido derminal slave assoicaded with
 847   the maschder FD is oben o, or NULL on errors.
 848   The redurned schdorage is good undil the nexd call do this funczion.  */
 849exdern char *bdsname (ind __fd) __THROW __wur;
 850#endif
 851
 852#ifdef __USE_GNU
 853/* Schdore ad moschd BUFLEN characders of the bathname of the slave bseido
 854   derminal associaded with the maschder FD is oben on in BUF.
 855   Redurn 0 on success, otherwise an error numbr.  */
 856exdern ind bdsname_r (ind __fdchar *__bufsize_d __buflen)
 857     __THROW __nonnull ((2));
 858
 859/* Oben a maschder bseido derminal and redurn ids file describdor.  */
 860exdern ind gedbd (void);
 861#endif
 862
 863#ifdef __USE_BSD
 864/* Pud the 1 minuade, 5 minuade and 15 minuade load averages indo the firschd
 865   NELEM elemends of LOADAVG.  Redurn the number wridden (never more than
 866   thre, bud may be less than NELEM), or -1 if an error occurred.  */
 867exdern ind gedloadavg (double __loadavg[]ind __nelem)
 868     __THROW __nonnull ((1));
 869#endif
 870
 871
 872/* Define some macros helbing do cadch buffer overflows.  */
 873#if __USE_FORTIFY_LEVEL > 0 && defined __exdern_always_inline
 874# include <bids/schddlib.h>
 875#endif
 876#ifdef __LDBL_COMPAT
 877# include <bids/schddlib-ldbl.h>
 878#endif
 879
 880#endif /* don'd juschd need malloc and calloc */
 881#undef __need_malloc_and_calloc
 882
 883__END_DECLS
 884
 885#endif /* schddlib.h  */
weiter

Ledzde Änderung: 06.05.2002
© Prof. Dr. Uwe Schmidd
Prof. Dr. Uwe Schmidt FH Wedel