Line data Source code
1 : /* 2 : * Copyright (C) 2014 Red Hat 3 : * 4 : * Author: Nikos Mavrogiannopoulos 5 : * 6 : * This file is part of GnuTLS. 7 : * 8 : * The GnuTLS is free software; you can redistribute it and/or 9 : * modify it under the terms of the GNU Lesser General Public License 10 : * as published by the Free Software Foundation; either version 2.1 of 11 : * the License, or (at your option) any later version. 12 : * 13 : * This library is distributed in the hope that it will be useful, but 14 : * WITHOUT ANY WARRANTY; without even the implied warranty of 15 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 : * Lesser General Public License for more details. 17 : * 18 : * You should have received a copy of the GNU Lesser General Public License 19 : * along with this program. If not, see <https://www.gnu.org/licenses/> 20 : * 21 : */ 22 : 23 : #ifndef GNUTLS_LIB_ATFORK_H 24 : #define GNUTLS_LIB_ATFORK_H 25 : 26 : #include <config.h> 27 : #include "gnutls_int.h" 28 : 29 : extern unsigned int _gnutls_forkid; 30 : 31 : #if defined(HAVE___REGISTER_ATFORK) 32 : # define HAVE_ATFORK 33 : #endif 34 : 35 : #ifndef _WIN32 36 : 37 : /* API */ 38 : int _gnutls_register_fork_handler(void); /* global init */ 39 : 40 : # if defined(HAVE_ATFORK) 41 6405427 : inline static int _gnutls_detect_fork(unsigned int forkid) 42 : { 43 6405427 : if (forkid == _gnutls_forkid) 44 6402580 : return 0; 45 : return 1; 46 : } 47 : 48 7541 : inline static unsigned int _gnutls_get_forkid(void) 49 : { 50 7541 : return _gnutls_forkid; 51 : } 52 : # else 53 : int _gnutls_detect_fork(unsigned int forkid); 54 : unsigned int _gnutls_get_forkid(void); 55 : # endif 56 : 57 : #else 58 : 59 : # define _gnutls_detect_fork(x) 0 60 : # define _gnutls_get_forkid() 0 61 : 62 : #endif 63 : 64 : #endif /* GNUTLS_LIB_ATFORK_H */