Back to index

glibc  2.9
Defines | Functions | Variables
stdio2.h File Reference

Go to the source code of this file.

Defines

#define sprintf(str,...)

Functions

int __sprintf_chk (char *__restrict __s, int __flag, size_t __slen, __const char *__restrict __format,...) __THROW
int __vsprintf_chk (char *__restrict __s, int __flag, size_t __slen, __const char *__restrict __format, _G_va_list __ap) __THROW
__extern_always_inline int __NTH (vsprintf(char *__restrict __s, __const char *__restrict __fmt, _G_va_list __ap))
char * __gets_chk (char *__str, size_t) __wur
char * __REDIRECT (__gets_warn,(char *__str), gets) __wur __warnattr("please use fgets or getline instead
__extern_always_inline __wur char * gets (char *__str)
char * __fgets_chk (char *__restrict __s, size_t __size, int __n, FILE *__restrict __stream) __wur
char * __REDIRECT (__fgets_alias,(char *__restrict __s, int __n, FILE *__restrict __stream), fgets) __wur
char * __REDIRECT (__fgets_chk_warn,(char *__restrict __s, size_t __size, int __n, FILE *__restrict __stream), __fgets_chk) __wur __warnattr("fgets called with bigger size than length ""of destination buffer")
__extern_always_inline __wur char * fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
size_t __fread_chk (void *__restrict __ptr, size_t __ptrlen, size_t __size, size_t __n, FILE *__restrict __stream) __wur
size_t __REDIRECT (__fread_alias,(void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __stream), fread) __wur
size_t __REDIRECT (__fread_chk_warn,(void *__restrict __ptr, size_t __ptrlen, size_t __size, size_t __n, FILE *__restrict __stream), __fread_chk) __wur __warnattr("fread called with bigger size * nmemb than length ""of destination buffer")
__extern_always_inline __wur size_t fread (void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __stream)

Variables

char gets can t specify buffer size

Define Documentation

#define sprintf (   str,
  ... 
)
Value:
__builtin___sprintf_chk (str, __USE_FORTIFY_LEVEL - 1, __bos (str), \
                        __VA_ARGS__)

Definition at line 38 of file stdio2.h.


Function Documentation

char* __fgets_chk ( char *__restrict  __s,
size_t  __size,
int  __n,
FILE *__restrict  __stream 
)
size_t __fread_chk ( void *__restrict  __ptr,
size_t  __ptrlen,
size_t  __size,
size_t  __n,
FILE *__restrict  __stream 
)

Definition at line 33 of file fread_chk.c.

{
  size_t bytes_requested = size * n;
  if (__builtin_expect ((n | size)
                     >= (((size_t) 1) << (8 * sizeof (size_t) / 2)), 0))
    {
      if (size != 0 && bytes_requested / size != n)
       __chk_fail ();
    }

  if (__builtin_expect (bytes_requested > ptrlen, 0))
    __chk_fail ();

  CHECK_FILE (stream, 0);
  if (bytes_requested == 0)
    return 0;

  size_t bytes_read;
  _IO_acquire_lock (stream);
  bytes_read = INTUSE(_IO_sgetn) (stream, (char *) ptr, bytes_requested);
  _IO_release_lock (stream);
  return bytes_requested == bytes_read ? n : bytes_read / size;
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* __gets_chk ( char *  __str,
size_t   
)

Definition at line 33 of file gets_chk.c.

{
  _IO_size_t count;
  int ch;
  char *retval;

  if (size == 0)
    __chk_fail ();

  _IO_acquire_lock (_IO_stdin);
  ch = _IO_getc_unlocked (_IO_stdin);
  if (ch == EOF)
    {
      retval = NULL;
      goto unlock_return;
    }
  if (ch == '\n')
    count = 0;
  else
    {
      /* This is very tricky since a file descriptor may be in the
        non-blocking mode. The error flag doesn't mean much in this
        case. We return an error only when there is a new error. */
      int old_error = _IO_stdin->_IO_file_flags & _IO_ERR_SEEN;
      _IO_stdin->_IO_file_flags &= ~_IO_ERR_SEEN;
      buf[0] = (char) ch;
      count = INTUSE(_IO_getline) (_IO_stdin, buf + 1, size - 1, '\n', 0) + 1;
      if (_IO_stdin->_IO_file_flags & _IO_ERR_SEEN)
       {
         retval = NULL;
         goto unlock_return;
       }
      else
       _IO_stdin->_IO_file_flags |= old_error;
    }
  if (count >= size)
    __chk_fail ();
  buf[count] = 0;
  retval = buf;
unlock_return:
  _IO_release_lock (_IO_stdin);
  return retval;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 44 of file stdio2.h.

{
  return __builtin___vsprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
                               __bos (__s), __fmt, __ap);
}
char* __REDIRECT ( __gets_warn  ,
(char *__str)  ,
gets   
)
char* __REDIRECT ( __fgets_alias  ,
(char *__restrict __s, int __n, FILE *__restrict __stream)  ,
fgets   
)
char* __REDIRECT ( __fgets_chk_warn  ,
(char *__restrict __s, size_t __size, int __n, FILE *__restrict __stream)  ,
__fgets_chk   
)
size_t __REDIRECT ( __fread_alias  ,
(void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __stream)  ,
fread   
)
size_t __REDIRECT ( __fread_chk_warn  ,
(void *__restrict __ptr, size_t __ptrlen, size_t __size, size_t __n, FILE *__restrict __stream)  ,
__fread_chk   
)
int __sprintf_chk ( char *__restrict  __s,
int  __flag,
size_t  __slen,
__const char *__restrict  __format,
  ... 
)
int __vsprintf_chk ( char *__restrict  __s,
int  __flag,
size_t  __slen,
__const char *__restrict  __format,
_G_va_list  __ap 
)
__extern_always_inline __wur char* fgets ( char *__restrict  __s,
int  __n,
FILE *__restrict  __stream 
)

Definition at line 245 of file stdio2.h.

{
  if (__bos (__s) != (size_t) -1)
    {
      if (!__builtin_constant_p (__n) || __n <= 0)
       return __fgets_chk (__s, __bos (__s), __n, __stream);

      if ((size_t) __n > __bos (__s))
       return __fgets_chk_warn (__s, __bos (__s), __n, __stream);
    }
  return __fgets_alias (__s, __n, __stream);
}

Here is the call graph for this function:

Here is the caller graph for this function:

__extern_always_inline __wur size_t fread ( void *__restrict  __ptr,
size_t  __size,
size_t  __n,
FILE *__restrict  __stream 
)

Definition at line 274 of file stdio2.h.

{
  if (__bos0 (__ptr) != (size_t) -1)
    {
      if (!__builtin_constant_p (__size)
         || !__builtin_constant_p (__n)
         || (__size | __n) >= (((size_t) 1) << (8 * sizeof (size_t) / 2)))
       return __fread_chk (__ptr, __bos0 (__ptr), __size, __n, __stream);

      if (__size * __n > __bos0 (__ptr))
       return __fread_chk_warn (__ptr, __bos0 (__ptr), __size, __n, __stream);
    }
  return __fread_alias (__ptr, __size, __n, __stream);
}

Here is the call graph for this function:

__extern_always_inline __wur char* gets ( char *  __str)

Definition at line 226 of file stdio2.h.

{
  if (__bos (__str) != (size_t) -1)
    return __gets_chk (__str, __bos (__str));
  return __gets_warn (__str);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

char gets can t specify buffer size

Definition at line 223 of file stdio2.h.