Back to home page

Enduro/X

 
 

    


0001 /**
0002  * @brief Message queue abstractions
0003  *
0004  * @file sys_mqueue.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 #ifndef _SYS_MQUEUE_H
0035 #define _SYS_MQUEUE_H
0036 
0037 #ifdef  __cplusplus
0038 extern "C" {
0039 #endif
0040 /*---------------------------Includes-----------------------------------*/
0041 #include <ndrx_config.h>
0042 
0043 #if defined(EX_USE_SYSVQ) || defined(EX_USE_SVAPOLL)
0044 #include <sys_svq.h>
0045 #elif defined(EX_USE_EMQ)
0046 /* use queue emulation: */
0047 #include <sys_emqueue.h>
0048 #else
0049 #include <mqueue.h>
0050 #endif
0051 
0052 /*---------------------------Externs------------------------------------*/
0053 /*---------------------------Macros-------------------------------------*/
0054 
0055 #if 1==EX_USE_SYSVQ ||1==EX_USE_SVAPOLL
0056     
0057 /* Feature #281 */
0058 #define  ndrx_mq_timedreceive ndrx_svq_timedreceive
0059 #define  ndrx_mq_timedsend    ndrx_svq_timedsend
0060 #define  ndrx_mq_close        ndrx_svq_close
0061 #define  ndrx_mq_getattr      ndrx_svq_getattr
0062 #define  ndrx_mq_notify       ndrx_svq_notify
0063 #define  ndrx_mq_receive      ndrx_svq_receive
0064 #define  ndrx_mq_send         ndrx_svq_send
0065 #define  ndrx_mq_setattr      ndrx_svq_setattr
0066     
0067 #elif 1==EX_USE_EMQ
0068 
0069 #define  ndrx_mq_timedreceive emq_timedreceive
0070 #define  ndrx_mq_timedsend    emq_timedsend
0071 #define  ndrx_mq_close        emq_close
0072 #define  ndrx_mq_getattr      emq_getattr
0073 #define  ndrx_mq_notify       emq_notify
0074 #define  ndrx_mq_receive      emq_receive
0075 #define  ndrx_mq_send         emq_send
0076 #define  ndrx_mq_setattr      emq_setattr
0077     
0078 #elif 2==EX_OS_SUNOS
0079     
0080 /* Only selected functions which appears
0081  * to return EBUSY- 16
0082  */
0083 #define  ndrx_mq_timedreceive sol_mq_timedreceive
0084 #define  ndrx_mq_timedsend    sol_mq_timedsend
0085 #define  ndrx_mq_receive      sol_mq_receive
0086 #define  ndrx_mq_send         sol_mq_send
0087 #define  ndrx_mq_close        sol_mq_close
0088 #define  ndrx_mq_getattr      sol_mq_getattr
0089 /*#define  ndrx_mq_notify       sol_mq_notify */
0090 #define  ndrx_mq_notify       mq_notify /* use base version as it may return EBUSY normally */
0091 #define  ndrx_mq_receive      sol_mq_receive
0092 #define  ndrx_mq_send         sol_mq_send
0093 #define  ndrx_mq_setattr      sol_mq_setattr
0094 
0095 #else
0096 
0097 #define  ndrx_mq_timedreceive mq_timedreceive
0098 #define  ndrx_mq_timedsend    mq_timedsend
0099 #define  ndrx_mq_close        mq_close
0100 #define  ndrx_mq_getattr      mq_getattr
0101 #define  ndrx_mq_notify       mq_notify
0102 #define  ndrx_mq_receive      mq_receive
0103 #define  ndrx_mq_send         mq_send
0104 #define  ndrx_mq_setattr      mq_setattr
0105 
0106 #endif
0107     
0108 #if 1==EX_USE_SYSVQ || 1==EX_USE_SVAPOLL
0109 
0110 /* Feature #281 */
0111 #define  ndrx_mq_open         ndrx_svq_open
0112 #define  ndrx_mq_unlink       ndrx_svq_unlink
0113 
0114 #elif 1==USE_FS_REGISTRY
0115 
0116 extern mqd_t ndrx_mq_open_with_registry(char *name, int oflag, mode_t mode, struct mq_attr *attr);
0117 extern int ndrx_mq_unlink_with_registry (char *name);
0118 
0119 #define  ndrx_mq_open         ndrx_mq_open_with_registry
0120 #define  ndrx_mq_unlink       ndrx_mq_unlink_with_registry
0121 
0122 #else
0123 
0124 #if 1==EX_USE_EMQ
0125 
0126 #define  ndrx_mq_open         emq_open
0127 #define  ndrx_mq_unlink       emq_unlink
0128 
0129 #elif 2==EX_OS_SUNOS
0130 
0131 #define  ndrx_mq_open         sol_mq_open
0132 /*#define  ndrx_mq_open         mq_open*/
0133 /* #define  ndrx_mq_unlink       sol_mq_unlink -gets infinite ebusy */
0134 #define  ndrx_mq_unlink       mq_unlink
0135 
0136 #else
0137 
0138 #define  ndrx_mq_open         mq_open
0139 #define  ndrx_mq_unlink       mq_unlink
0140 
0141 #endif
0142     
0143     
0144 #endif
0145     
0146 
0147 /*---------------------------Enums--------------------------------------*/
0148 /*---------------------------Typedefs-----------------------------------*/
0149 /*---------------------------Globals------------------------------------*/
0150 /*---------------------------Statics------------------------------------*/
0151 /*---------------------------Prototypes---------------------------------*/
0152     
0153 #ifdef  __cplusplus
0154 }
0155 #endif
0156 
0157 #endif  /* _SYS_MQUEUE_H */
0158 
0159 /* vim: set ts=4 sw=4 et smartindent: */