LCOV - code coverage report
Current view: top level - kernel - errno.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 1 0.0 %
Date: 2022-08-18 11:36:24 Functions: 0 0 -
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  * Copyright (c) 2015 Wind River Systems, Inc.
       3                 :            :  *
       4                 :            :  * SPDX-License-Identifier: Apache-2.0
       5                 :            :  */
       6                 :            : 
       7                 :            : /** @file
       8                 :            :  *
       9                 :            :  * @brief Per-thread errno accessor function
      10                 :            :  *
      11                 :            :  * Allow accessing the errno for the current thread without involving the
      12                 :            :  * context switching.
      13                 :            :  */
      14                 :            : 
      15                 :            : #include <kernel.h>
      16                 :            : #include <syscall_handler.h>
      17                 :            : 
      18                 :            : /*
      19                 :            :  * Define _k_neg_eagain for use in assembly files as errno.h is
      20                 :            :  * not assembly language safe.
      21                 :            :  * FIXME: wastes 4 bytes
      22                 :            :  */
      23                 :            : const int _k_neg_eagain = -EAGAIN;
      24                 :            : 
      25                 :            : #ifdef CONFIG_ERRNO
      26                 :            : 
      27                 :            : #ifdef CONFIG_ERRNO_IN_TLS
      28                 :            : __thread int z_errno_var;
      29                 :            : #else
      30                 :            : 
      31                 :            : #ifdef CONFIG_USERSPACE
      32                 :            : int *z_impl_z_errno(void)
      33                 :            : {
      34                 :            :         /* Initialized to the lowest address in the stack so the thread can
      35                 :            :          * directly read/write it
      36                 :            :          */
      37                 :            :         return &_current->userspace_local_data->errno_var;
      38                 :            : }
      39                 :            : 
      40                 :            : static inline int *z_vrfy_z_errno(void)
      41                 :            : {
      42                 :            :         return z_impl_z_errno();
      43                 :            : }
      44                 :            : #include <syscalls/z_errno_mrsh.c>
      45                 :            : 
      46                 :            : #else
      47                 :            : int *z_impl_z_errno(void)
      48                 :            : {
      49                 :          0 :         return &_current->errno_var;
      50                 :            : }
      51                 :            : #endif /* CONFIG_USERSPACE */
      52                 :            : 
      53                 :            : #endif /* CONFIG_ERRNO_IN_TLS */
      54                 :            : 
      55                 :            : #endif /* CONFIG_ERRNO */

Generated by: LCOV version 1.14