unlockreporter.c (907B)
1 /************************************************************************* 2 * This file is part of Crosroads 1.23, a load balancer and fail over 3 * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. 4 * Visit http://crossroads.e-tunity.com for information. 5 *************************************************************************/ 6 #include "crossroads.h" 7 8 void unlock_reporter() { 9 static int warning_issued = 0; 10 11 struct sembuf buf = { 12 0, /* semaphore number */ 13 -1, /* subtract 1 */ 14 0, /* no special flags */ 15 }; 16 17 /* msg ("UnLocking reporter memory"); */ 18 if ( (! warning_issued++) && (semop (semid, &buf, 1) < 0) ) { 19 warning ("Failed to unlock reporter memory (stage %s): %s", 20 stage_to_string (program_stage), strerror(errno)); 21 if (program_stage != stage_serving) 22 exit (1); 23 else 24 warning (".. but continuing serving this TCP connection"); 25 } 26 }