LCOV - code coverage report
Current view: directory - usr/include/bits - fcntl2.h (source / functions) Found Hit Coverage
Test: redis.info Lines: 10 4 40.0 %
Date: 2012-04-04 Functions: 0 0 -
Colors: not hit hit

       1                 : /* Checking macros for fcntl functions.
       2                 :    Copyright (C) 2007 Free Software Foundation, Inc.
       3                 :    This file is part of the GNU C Library.
       4                 : 
       5                 :    The GNU C Library is free software; you can redistribute it and/or
       6                 :    modify it under the terms of the GNU Lesser General Public
       7                 :    License as published by the Free Software Foundation; either
       8                 :    version 2.1 of the License, or (at your option) any later version.
       9                 : 
      10                 :    The GNU C Library is distributed in the hope that it will be useful,
      11                 :    but WITHOUT ANY WARRANTY; without even the implied warranty of
      12                 :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      13                 :    Lesser General Public License for more details.
      14                 : 
      15                 :    You should have received a copy of the GNU Lesser General Public
      16                 :    License along with the GNU C Library; if not, write to the Free
      17                 :    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
      18                 :    02111-1307 USA.  */
      19                 : 
      20                 : #ifndef _FCNTL_H
      21                 : # error "Never include <bits/fcntl2.h> directly; use <fcntl.h> instead."
      22                 : #endif
      23                 : 
      24                 : /* Check that calls to open and openat with O_CREAT set have an
      25                 :    appropriate third/fourth parameter.  */
      26                 : #ifndef __USE_FILE_OFFSET64
      27                 : extern int __open_2 (__const char *__path, int __oflag) __nonnull ((1));
      28                 : extern int __REDIRECT (__open_alias, (__const char *__path, int __oflag, ...),
      29                 :                        open) __nonnull ((1));
      30                 : #else
      31                 : extern int __REDIRECT (__open_2, (__const char *__path, int __oflag),
      32                 :                        __open64_2) __nonnull ((1));
      33                 : extern int __REDIRECT (__open_alias, (__const char *__path, int __oflag, ...),
      34                 :                        open64) __nonnull ((1));
      35                 : #endif
      36                 : __errordecl (__open_too_many_args,
      37                 :              "open can be called either with 2 or 3 arguments, not more");
      38                 : __errordecl (__open_missing_mode,
      39                 :              "open with O_CREAT in second argument needs 3 arguments");
      40                 : 
      41                 : __extern_always_inline int
      42                 : open (__const char *__path, int __oflag, ...)
      43                 : {
      44           18398 :   if (__va_arg_pack_len () > 1)
      45               0 :     __open_too_many_args ();
      46                 : 
      47           18398 :   if (__builtin_constant_p (__oflag))
      48                 :     {
      49           18398 :       if ((__oflag & O_CREAT) != 0 && __va_arg_pack_len () < 1)
      50                 :         {
      51               0 :           __open_missing_mode ();
      52               0 :           return __open_2 (__path, __oflag);
      53                 :         }
      54           18398 :       return __open_alias (__path, __oflag, __va_arg_pack ());
      55                 :     }
      56                 : 
      57               0 :   if (__va_arg_pack_len () < 1)
      58               0 :     return __open_2 (__path, __oflag);
      59                 : 
      60               0 :   return __open_alias (__path, __oflag, __va_arg_pack ());
      61                 : }
      62                 : 
      63                 : 
      64                 : #ifdef __USE_LARGEFILE64
      65                 : extern int __open64_2 (__const char *__path, int __oflag) __nonnull ((1));
      66                 : extern int __REDIRECT (__open64_alias, (__const char *__path, int __oflag,
      67                 :                                         ...), open64) __nonnull ((1));
      68                 : __errordecl (__open64_too_many_args,
      69                 :              "open64 can be called either with 2 or 3 arguments, not more");
      70                 : __errordecl (__open64_missing_mode,
      71                 :              "open64 with O_CREAT in second argument needs 3 arguments");
      72                 : 
      73                 : __extern_always_inline int
      74                 : open64 (__const char *__path, int __oflag, ...)
      75                 : {
      76                 :   if (__va_arg_pack_len () > 1)
      77                 :     __open64_too_many_args ();
      78                 : 
      79                 :   if (__builtin_constant_p (__oflag))
      80                 :     {
      81                 :       if ((__oflag & O_CREAT) != 0 && __va_arg_pack_len () < 1)
      82                 :         {
      83                 :           __open64_missing_mode ();
      84                 :           return __open64_2 (__path, __oflag);
      85                 :         }
      86                 :       return __open64_alias (__path, __oflag, __va_arg_pack ());
      87                 :     }
      88                 : 
      89                 :   if (__va_arg_pack_len () < 1)
      90                 :     return __open64_2 (__path, __oflag);
      91                 : 
      92                 :   return __open64_alias (__path, __oflag, __va_arg_pack ());
      93                 : }
      94                 : #endif
      95                 : 
      96                 : 
      97                 : #ifdef __USE_ATFILE
      98                 : # ifndef __USE_FILE_OFFSET64
      99                 : extern int __openat_2 (int __fd, __const char *__path, int __oflag)
     100                 :      __nonnull ((2));
     101                 : extern int __REDIRECT (__openat_alias, (int __fd, __const char *__path,
     102                 :                                         int __oflag, ...), openat)
     103                 :      __nonnull ((2));
     104                 : # else
     105                 : extern int __REDIRECT (__openat_2, (int __fd, __const char *__path,
     106                 :                                     int __oflag), __openat64_2)
     107                 :      __nonnull ((2));
     108                 : extern int __REDIRECT (__openat_alias, (int __fd, __const char *__path,
     109                 :                                         int __oflag, ...), openat64)
     110                 :      __nonnull ((2));
     111                 : # endif
     112                 : __errordecl (__openat_too_many_args,
     113                 :              "openat can be called either with 3 or 4 arguments, not more");
     114                 : __errordecl (__openat_missing_mode,
     115                 :              "openat with O_CREAT in third argument needs 4 arguments");
     116                 : 
     117                 : __extern_always_inline int
     118                 : openat (int __fd, __const char *__path, int __oflag, ...)
     119                 : {
     120                 :   if (__va_arg_pack_len () > 1)
     121                 :     __openat_too_many_args ();
     122                 : 
     123                 :   if (__builtin_constant_p (__oflag))
     124                 :     {
     125                 :       if ((__oflag & O_CREAT) != 0 && __va_arg_pack_len () < 1)
     126                 :         {
     127                 :           __openat_missing_mode ();
     128                 :           return __openat_2 (__fd, __path, __oflag);
     129                 :         }
     130                 :       return __openat_alias (__fd, __path, __oflag, __va_arg_pack ());
     131                 :     }
     132                 : 
     133                 :   if (__va_arg_pack_len () < 1)
     134                 :     return __openat_2 (__fd, __path, __oflag);
     135                 : 
     136                 :   return __openat_alias (__fd, __path, __oflag, __va_arg_pack ());
     137                 : }
     138                 : 
     139                 : 
     140                 : # ifdef __USE_LARGEFILE64
     141                 : extern int __openat64_2 (int __fd, __const char *__path, int __oflag)
     142                 :      __nonnull ((2));
     143                 : extern int __REDIRECT (__openat64_alias, (int __fd, __const char *__path,
     144                 :                                           int __oflag, ...), openat64)
     145                 :      __nonnull ((2));
     146                 : __errordecl (__openat64_too_many_args,
     147                 :              "openat64 can be called either with 3 or 4 arguments, not more");
     148                 : __errordecl (__openat64_missing_mode,
     149                 :              "openat64 with O_CREAT in third argument needs 4 arguments");
     150                 : 
     151                 : __extern_always_inline int
     152                 : openat64 (int __fd, __const char *__path, int __oflag, ...)
     153                 : {
     154                 :   if (__va_arg_pack_len () > 1)
     155                 :     __openat64_too_many_args ();
     156                 : 
     157                 :   if (__builtin_constant_p (__oflag))
     158                 :     {
     159                 :       if ((__oflag & O_CREAT) != 0 && __va_arg_pack_len () < 1)
     160                 :         {
     161                 :           __openat64_missing_mode ();
     162                 :           return __openat64_2 (__fd, __path, __oflag);
     163                 :         }
     164                 :       return __openat64_alias (__fd, __path, __oflag, __va_arg_pack ());
     165                 :     }
     166                 : 
     167                 :   if (__va_arg_pack_len () < 1)
     168                 :     return __openat64_2 (__fd, __path, __oflag);
     169                 : 
     170                 :   return __openat64_alias (__fd, __path, __oflag, __va_arg_pack ());
     171                 : }
     172                 : # endif
     173                 : #endif

Generated by: LCOV version 1.7