![]() |
|
|||
0001 /** 0002 * @brief Test case verifies that failed tplogsetreqfile() redirects logger 0003 * to stderr, and that it can correctly use it. 0004 * 0005 * @file atmiclt31_inv.c 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 #include <string.h> 0036 #include <stdio.h> 0037 #include <stdlib.h> 0038 #include <memory.h> 0039 #include <math.h> 0040 #include <unistd.h> 0041 0042 #include <atmi.h> 0043 #include <ubf.h> 0044 #include <ndebug.h> 0045 #include <ndebugcmn.h> 0046 #include <test.fd.h> 0047 #include <ndrstandard.h> 0048 #include <nstdutil.h> 0049 #include <exassert.h> 0050 #include <nstd_int.h> 0051 /*---------------------------Externs------------------------------------*/ 0052 /*---------------------------Macros-------------------------------------*/ 0053 /*---------------------------Enums--------------------------------------*/ 0054 /*---------------------------Typedefs-----------------------------------*/ 0055 /*---------------------------Globals------------------------------------*/ 0056 /*---------------------------Statics------------------------------------*/ 0057 /*---------------------------Prototypes---------------------------------*/ 0058 0059 0060 /** 0061 * Bug #755 the bug did close stderr, 0062 * on Aix that caused segmentation fault. 0063 */ 0064 void do_thread_work ( void *ptr ) 0065 { 0066 int i; 0067 0068 for (i=0; i<10000; i++) 0069 { 0070 NDRX_LOG(log_error, "HELLO"); 0071 tplogsetreqfile(NULL, "/no/such/file/right", NULL); 0072 NDRX_LOG(log_error, "HELLO2"); 0073 tplogclosereqfile(); 0074 } 0075 0076 /* tplogsetreqfile() does full client init */ 0077 tpterm(); 0078 0079 } 0080 0081 /* 0082 * Do the test call to the server 0083 */ 0084 int main(int argc, char** argv) 0085 { 0086 int ret = EXSUCCEED; 0087 pthread_t thread1, thread2; /* thread variables */ 0088 0089 /* run off two threads... (each will have it's own log file) */ 0090 pthread_create (&thread1, NULL, (void *) &do_thread_work, NULL); 0091 pthread_create (&thread2, NULL, (void *) &do_thread_work, NULL); 0092 0093 pthread_join(thread1, NULL); 0094 pthread_join(thread2, NULL); 0095 0096 0097 out: 0098 0099 return ret; 0100 } 0101 0102 /* 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 |
![]() ![]() |