![]() |
|
|||
0001 /** 0002 * @brief Client Process Monitor interface 0003 * 0004 * @file cpm.h 0005 */ 0006 /* ----------------------------------------------------------------------------- 0007 * Enduro/X Middleware Platform for Distributed Transaction Processing 0008 * Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved. 0009 * Copyright (C) 2017-2023, Mavimax, Ltd. All Rights Reserved. 0010 * This software is released under one of the following licenses: 0011 * AGPL (with Java and Go exceptions) or Mavimax's license for commercial use. 0012 * See LICENSE file for full text. 0013 * ----------------------------------------------------------------------------- 0014 * AGPL license: 0015 * 0016 * This program is free software; you can redistribute it and/or modify it under 0017 * the terms of the GNU Affero General Public License, version 3 as published 0018 * by the Free Software Foundation; 0019 * 0020 * This program is distributed in the hope that it will be useful, but WITHOUT ANY 0021 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 0022 * PARTICULAR PURPOSE. See the GNU Affero General Public License, version 3 0023 * for more details. 0024 * 0025 * You should have received a copy of the GNU Affero General Public License along 0026 * with this program; if not, write to the Free Software Foundation, Inc., 0027 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 0028 * 0029 * ----------------------------------------------------------------------------- 0030 * A commercial use license is available from Mavimax, Ltd 0031 * contact@mavimax.com 0032 * ----------------------------------------------------------------------------- 0033 */ 0034 0035 #ifndef _CPM_H 0036 #define _CPM_H 0037 0038 #ifdef __cplusplus 0039 extern "C" { 0040 #endif 0041 0042 /*---------------------------Includes-----------------------------------*/ 0043 #include <ndrx_config.h> 0044 #include <nstd_shm.h> 0045 /*---------------------------Externs------------------------------------*/ 0046 /*---------------------------Macros-------------------------------------*/ 0047 #define CPM_CMD_PC "pc" /* Print Clients(s) */ 0048 #define CPM_CMD_BC "bc" /* Boot Client(s) */ 0049 #define CPM_CMD_SC "sc" /* Stop Client(s) */ 0050 #define CPM_CMD_RC "rc" /* Reload Client(s) (restart one by one) */ 0051 0052 #define CPM_DEF_BUFFER_SZ 1024 0053 0054 #define CPM_OUTPUT_SIZE 256 /* Output buffer size */ 0055 0056 #define CPM_TAG_LEN 128 0057 #define CPM_SUBSECT_LEN 128 0058 #define NDRX_CPM_SEP 0x1c /**< Field seperator */ 0059 #define CPM_KEY_LEN (CPM_TAG_LEN+1+CPM_SUBSECT_LEN) /* including FS in middle */ 0060 0061 #define NDRX_CPM_CMDMIN 32 /**< Min command len */ 0062 0063 #define NDRX_CPM_MAP_ISUSED NDRX_LH_FLAG_ISUSED /**< Entry used */ 0064 #define NDRX_CPM_MAP_WASUSED NDRX_LH_FLAG_WASUSED /**< Entry was used */ 0065 #define NDRX_CPM_MAP_CPMPROC 0x0004 /**< Process added by CPM */ 0066 #define NDRX_CPM_MAP_SELFMANG 0x0008 /**< Self managed process, non cpm */ 0067 0068 #define NDRX_CPMSHM_MAX_READERS 10 /**< Max concurrent readers of sh */ 0069 0070 0071 #define NDRX_CPM_INDEX(MEM, IDX) ((ndrx_clt_shm_t*)(((char*)MEM)+(int)(sizeof(ndrx_clt_shm_t)*IDX))) 0072 0073 /*---------------------------Enums--------------------------------------*/ 0074 /*---------------------------Typedefs-----------------------------------*/ 0075 0076 /** 0077 * Shared memory entry for service 0078 */ 0079 typedef struct ndrx_clt_shm ndrx_clt_shm_t; 0080 struct ndrx_clt_shm 0081 { 0082 char key[NDRX_MAX_Q_SIZE+1]; /**< tag<fs>subsection */ 0083 pid_t pid; /**< System V Queue id */ 0084 short flags; /**< See NDRX_SVQ_MAP_STAT_* */ 0085 time_t stattime; /**< Status change time */ 0086 char procname[NDRX_CPM_CMDMIN+1]; /**< process name */ 0087 long padding1; /**< ensure that struct is padded*/ 0088 }; 0089 0090 /*---------------------------Statics------------------------------------*/ 0091 /*---------------------------Prototypes---------------------------------*/ 0092 0093 extern NDRX_API void ndrx_cltshm_down(int *signals, int *p_was_any); 0094 extern NDRX_API int ndrx_cltshm_setpos(char *key, pid_t pid, short flags, 0095 char *procname); 0096 extern NDRX_API pid_t ndrx_cltshm_getpid(char *key, char *procname, 0097 size_t procnamesz, time_t *p_stattime); 0098 extern NDRX_API ndrx_sem_t* ndrx_cltshm_sem_get(void); 0099 extern NDRX_API ndrx_shm_t* ndrx_cltshm_mem_get(void); 0100 extern NDRX_API int ndrx_cltshm_remove(int force); 0101 extern NDRX_API void ndrx_cltshm_detach(void); 0102 extern NDRX_API int ndrx_cltshm_get_key(char *key, int oflag, int *pos, int *have_value); 0103 extern NDRX_API int ndrx_cltshm_init(int attach_only); 0104 0105 #ifdef __cplusplus 0106 } 0107 #endif 0108 0109 #endif /* _CPM_H */ 0110 0111 /* 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 |
![]() ![]() |