LCOV - differential code coverage report
Current view: top level - src/interfaces/libpq - legacy-pqsignal.c (source / functions) Coverage Total Hit UBC
Current: Differential Code Coverage HEAD vs 15 Lines: 0.0 % 11 0 11
Current Date: 2023-04-08 15:15:32 Functions: 0.0 % 1 0 1
Baseline: 15
Baseline Date: 2023-04-08 15:09:40
Legend: Lines: hit not hit

           TLA  Line data    Source code
       1                 : /*-------------------------------------------------------------------------
       2                 :  *
       3                 :  * legacy-pqsignal.c
       4                 :  *    reliable BSD-style signal(2) routine stolen from RWW who stole it
       5                 :  *    from Stevens...
       6                 :  *
       7                 :  * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
       8                 :  * Portions Copyright (c) 1994, Regents of the University of California
       9                 :  *
      10                 :  *
      11                 :  * IDENTIFICATION
      12                 :  *    src/interfaces/libpq/legacy-pqsignal.c
      13                 :  *
      14                 :  *-------------------------------------------------------------------------
      15                 :  */
      16                 : #include "postgres_fe.h"
      17                 : 
      18                 : #include <signal.h>
      19                 : 
      20                 : 
      21                 : /*
      22                 :  * This version of pqsignal() exists only because pre-9.3 releases
      23                 :  * of libpq exported pqsignal(), and some old client programs still
      24                 :  * depend on that.  (Since 9.3, clients are supposed to get it from
      25                 :  * libpgport instead.)
      26                 :  *
      27                 :  * Because it is only intended for backwards compatibility, we freeze it
      28                 :  * with the semantics it had in 9.2; in particular, this has different
      29                 :  * behavior for SIGALRM than the version in src/port/pqsignal.c.
      30                 :  *
      31                 :  * libpq itself uses this only for SIGPIPE (and even then, only in
      32                 :  * non-ENABLE_THREAD_SAFETY builds), so the incompatibility isn't
      33                 :  * troublesome for internal references.
      34                 :  */
      35                 : pqsigfunc
      36 UBC           0 : pqsignal(int signo, pqsigfunc func)
      37                 : {
      38                 : #ifndef WIN32
      39                 :     struct sigaction act,
      40                 :                 oact;
      41                 : 
      42               0 :     act.sa_handler = func;
      43               0 :     sigemptyset(&act.sa_mask);
      44               0 :     act.sa_flags = 0;
      45               0 :     if (signo != SIGALRM)
      46               0 :         act.sa_flags |= SA_RESTART;
      47                 : #ifdef SA_NOCLDSTOP
      48               0 :     if (signo == SIGCHLD)
      49               0 :         act.sa_flags |= SA_NOCLDSTOP;
      50                 : #endif
      51               0 :     if (sigaction(signo, &act, &oact) < 0)
      52               0 :         return SIG_ERR;
      53               0 :     return oact.sa_handler;
      54                 : #else                           /* WIN32 */
      55                 :     return signal(signo, func);
      56                 : #endif
      57                 : }
        

Generated by: LCOV version v1.16-55-g56c0a2a