LCOV - code coverage report
Current view: top level - include - poll.h (source / functions) Hit Total Coverage
Test: cleaned-coverage.info Lines: 4 6 66.7 %
Date: 2024-10-21 13:06:23 Functions: 0 0 -

          Line data    Source code
       1             : /*
       2             :  * Copyright (C) 2015-2016 Dimitris Papastamos <sin@2f30.org>
       3             :  * Copyright (C) 2022 q66 <q66@chimera-linux.org>
       4             :  *
       5             :  * Permission to use, copy, modify, and/or distribute this software for any
       6             :  * purpose with or without fee is hereby granted.
       7             :  *
       8             :  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
       9             :  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
      10             :  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
      11             :  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
      12             :  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
      13             :  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
      14             :  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
      15             :  */
      16             : 
      17             : #ifndef _FORTIFY_POLL_H
      18             : #define _FORTIFY_POLL_H
      19             : 
      20             : #if !defined(__cplusplus) && !defined(__clang__)
      21             : __extension__
      22             : #endif
      23             : #include_next <poll.h>
      24             : 
      25             : #if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0
      26             : #include "fortify-headers.h"
      27             : 
      28             : #ifdef __cplusplus
      29             : extern "C" {
      30             : #endif
      31             : 
      32             : #undef poll
      33             : 
      34             : #if __has_builtin(__builtin_poll)
      35             : __diagnose_as_builtin(__builtin_poll, 1, 2, 3)
      36             : #endif
      37             : _FORTIFY_FN(poll) int poll(struct pollfd * _FORTIFY_POS0 __f, nfds_t __n, int __s)
      38             : {
      39             :         __fh_size_t __b = __fh_bos(__f, 0);
      40             : 
      41           1 :         if (__n > __b / sizeof(struct pollfd))
      42           2 :                 __builtin_trap();
      43           0 :         return __orig_poll(__f, __n, __s);
      44             : }
      45             : 
      46             : #if defined(_GNU_SOURCE) && !_REDIR_TIME64
      47             : #undef ppoll
      48             : #if __has_builtin(__builtin_ppoll)
      49             : __diagnose_as_builtin(__builtin_ppoll, 1, 2, 3, 4)
      50             : #endif
      51             : _FORTIFY_FN(ppoll) int ppoll(struct pollfd * _FORTIFY_POS0 __f, nfds_t __n,
      52             :                              const struct timespec *__s, const sigset_t *__m)
      53             : {
      54             :         __fh_size_t __b = __fh_bos(__f, 0);
      55             : 
      56           1 :         if (__n > __b / sizeof(struct pollfd))
      57           2 :                 __builtin_trap();
      58           0 :         return __orig_ppoll(__f, __n, __s, __m);
      59             : }
      60             : #endif
      61             : 
      62             : #ifdef __cplusplus
      63             : }
      64             : #endif
      65             : 
      66             : #endif
      67             : 
      68             : #endif

Generated by: LCOV version 1.14