![]() |
|
|||
0001 /** 0002 * @brief Debug commons 0003 * TOOD: mark as internal -> do not include in distribution 0004 * 0005 * @file ndebugcmn.h 0006 */ 0007 /* ----------------------------------------------------------------------------- 0008 * Enduro/X Middleware Platform for Distributed Transaction Processing 0009 * Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved. 0010 * Copyright (C) 2017-2023, Mavimax, Ltd. All Rights Reserved. 0011 * This software is released under one of the following licenses: 0012 * AGPL (with Java and Go exceptions) or Mavimax's license for commercial use. 0013 * See LICENSE file for full text. 0014 * ----------------------------------------------------------------------------- 0015 * AGPL license: 0016 * 0017 * This program is free software; you can redistribute it and/or modify it under 0018 * the terms of the GNU Affero General Public License, version 3 as published 0019 * by the Free Software Foundation; 0020 * 0021 * This program is distributed in the hope that it will be useful, but WITHOUT ANY 0022 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 0023 * PARTICULAR PURPOSE. See the GNU Affero General Public License, version 3 0024 * for more details. 0025 * 0026 * You should have received a copy of the GNU Affero General Public License along 0027 * with this program; if not, write to the Free Software Foundation, Inc., 0028 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 0029 * 0030 * ----------------------------------------------------------------------------- 0031 * A commercial use license is available from Mavimax, Ltd 0032 * contact@mavimax.com 0033 * ----------------------------------------------------------------------------- 0034 */ 0035 #ifndef NDEBUGCMN_H 0036 #define NDEBUGCMN_H 0037 0038 #ifdef __cplusplus 0039 extern "C" { 0040 #endif 0041 /*---------------------------Includes-----------------------------------*/ 0042 #include <ndrx_config.h> 0043 #include <stdio.h> 0044 #include <limits.h> 0045 #include <stdarg.h> 0046 #include <unistd.h> 0047 #include <thlock.h> 0048 #include <exhash.h> 0049 /*---------------------------Externs------------------------------------*/ 0050 /*---------------------------Macros-------------------------------------*/ 0051 #define NDRX_LOG_MODULE_LEN 4 /**< Module name field length */ 0052 0053 #define NDRX_LOG_FPROC 0x00001 /**< This is process level logger */ 0054 #define NDRX_LOG_FOSHSTDERR 0x00004 /**< This is OS handler, stderr */ 0055 #define NDRX_LOG_FOSHSTDOUT 0x00008 /**< This is OS handler, stdout */ 0056 #define NDRX_LOG_FLOCK 0x00010 /**< Perform locking when write to file */ 0057 #define NDRX_LOG_FSYNCSTDERR 0x00020 /**< Sync stderr with fd */ 0058 #define NDRX_LOG_FSYNCSTDOUT 0x00040 /**< Sync stdout with fd */ 0059 0060 #define NDRX_LOG_OSSTDERR "/dev/stderr" /**< This OS handler, stderr*/ 0061 #define NDRX_LOG_OSSTDOUT "/dev/stdout" /**< This OS handler, stdout*/ 0062 0063 /*---------------------------Enums--------------------------------------*/ 0064 /*---------------------------Typedefs-----------------------------------*/ 0065 0066 /* 0067 * Early logs written to memory 0068 */ 0069 typedef struct ndrx_memlogger ndrx_memlogger_t; 0070 struct ndrx_memlogger 0071 { 0072 int level; 0073 char line[PATH_MAX+1]; 0074 ndrx_memlogger_t *next, *prev; 0075 }; 0076 0077 /* Create main debug structure */ 0078 typedef struct 0079 { 0080 int level; 0081 void *dbg_f_ptr; /**< Ptr to file sink, opaque */ 0082 char filename[PATH_MAX]; 0083 char filename_th_template[PATH_MAX]; /**< template for thread logging... */ 0084 pid_t pid; 0085 /** Hashed hostname */ 0086 unsigned long hostnamecrc32; 0087 int buf_lines; 0088 int buffer_size; 0089 int lines_written; 0090 char module[NDRX_LOG_MODULE_LEN+1]; /**< 4 symbols of the module */ 0091 int is_user; /**< set to 1 if we run in user log mode, 2 if request file */ 0092 char code; /**< code of the logger */ 0093 char iflags[16]; /**< integration flags */ 0094 int is_threaded; /**< are we separating logs by threads? */ 0095 int is_mkdir; /**< shall we create directory if we get ENOFILE err */ 0096 unsigned threadnr; /**< thread number to which we are logging */ 0097 long flags; /**< logger code initially */ 0098 long swait; /**< sync wait for close log files, ms */ 0099 ndrx_memlogger_t *memlog; 0100 unsigned version; /**< This is settigns version (inherit by thread/req */ 0101 } ndrx_debug_t; 0102 0103 /** 0104 * This is opaque interface for detecting current LCF command 0105 */ 0106 typedef struct 0107 { 0108 unsigned shmcfgver_lcf; /**< Current version in shared mem of the config */ 0109 } ndrx_lcf_shmcfg_ver_t; 0110 0111 /*---------------------------Globals------------------------------------*/ 0112 /*---------------------------Statics------------------------------------*/ 0113 0114 /** Current shared memory published configuration version */ 0115 extern NDRX_API volatile ndrx_lcf_shmcfg_ver_t *ndrx_G_shmcfg_ver; 0116 /** Last checked shared mem cfg version */ 0117 extern NDRX_API volatile unsigned ndrx_G_shmcfgver_chk; 0118 /*---------------------------Prototypes---------------------------------*/ 0119 0120 #ifdef __cplusplus 0121 } 0122 #endif 0123 0124 #endif /* NDEBUGCMN_H */ 0125 0126 /* vim: set ts=4 sw=4 et smartindent: */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |