• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

コミットメタ情報

リビジョン7d88ae09dcf9a4a4d3a2dafb18be784e246c6959 (tree)
日時2014-07-31 16:34:48
作者Hiroaki Nakano <nakano.hiroaki@nttc...>
コミッターHiroaki Nakano

ログメッセージ

edit途中。
やっと親プロセスや子プロセスが死ななくなった。

- perrorをsys_errlist[errno]に変更
- 子プロセスで親プロセス用のnamed pipeを閉じるようにした。
- 子プロセスでUNIXソケットを閉じるIFを用意(現在は無効にしてる)

Signed-off-by: Hiroaki Nakano <nakano.hiroaki@nttcom.co.jp>

変更サマリ

差分

--- a/include/l7vs_config.h
+++ b/include/l7vs_config.h
@@ -269,4 +269,16 @@ extern int l7vs_config_init();
269269 */
270270 extern void l7vs_config_fini();
271271
272+/*!
273+ * l7vs_config_close()
274+ * configuration socket close function.
275+ */
276+extern void l7vs_config_close();
277+
278+/*!
279+ * l7vs_pfifo_close()
280+ * parent fifo close function.
281+ */
282+extern void l7vs_pfifo_close();
283+
272284 #endif //L7VS_CONFIG_H
--- a/include/l7vs_iom.h
+++ b/include/l7vs_iom.h
@@ -138,6 +138,14 @@ enum iomstatus{
138138 //pid_notify
139139 iomux_pfifo_read_waiting, //! notified combination of pid and ip+port for parent process from child
140140
141+ // pfifo common
142+// iomux_pfifo_init, //! pfifo before initialize
143+// iomux_pfifo_initialized, //! pfifo was initialized
144+// iomux_pfifo_command_waiting, //! command waiting
145+// iomux_pfifo_command_response_sent, //! command response sent
146+// iomux_pfifo_signal_received, //! signal received
147+ iomux_pfifo_destroyed, //! pfifo finishing process was executed
148+
141149 //lsock_initialize
142150 iomux_lsock_init, //! listening socket before initialize
143151 iomux_lsock_initalized, //! listening socket was initialized
--- a/src/config.c
+++ b/src/config.c
@@ -207,7 +207,7 @@ l7vs_config_init(void)
207207 // exist same name file.
208208 if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM) == LOG_LV_DEBUG){
209209 LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM,1,
210- "config_init: stat error 1 return -1");
210+ "config_init: stat error: %s", sys_errlist[errno]);
211211 }
212212 unlink(addr.sun_path);
213213 return -1;
@@ -218,10 +218,10 @@ l7vs_config_init(void)
218218 S_IRUSR | S_IWUSR | S_IXUSR |
219219 S_IRGRP | S_IXGRP |
220220 S_IROTH | S_IXOTH);
221- if(ret == -1){
221+ if(ret == -1 && errno != EEXIST){
222222 if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM) == LOG_LV_DEBUG){
223223 LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM,1,
224- "config_init: mkdir error 1 return -1");
224+ "config_init: mkdir error: %s", sys_errlist[errno]);
225225 }
226226 unlink(addr.sun_path);
227227 return -1;
@@ -229,7 +229,7 @@ l7vs_config_init(void)
229229 }else{
230230 if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM) == LOG_LV_DEBUG){
231231 LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM,1,
232- "config_init: stat error 2 return -1");
232+ "config_init: stat error 2: %s", sys_errlist[errno]);
233233 }
234234 unlink(addr.sun_path);
235235 return -1;
@@ -245,7 +245,7 @@ l7vs_config_init(void)
245245 if(ret < 0 && errno != EEXIST){
246246 if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM) == LOG_LV_DEBUG){
247247 LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM,1,
248- "out_fuction: mkfifo error 1 return -1");
248+ "out_fuction: mkfifo error 1: %s", sys_errlist[errno]);
249249 }
250250 unlink(addr.sun_path);
251251 return -1;
@@ -291,6 +291,59 @@ l7vs_config_init(void)
291291 }
292292
293293 /*!
294+ * Operate config parent fifo fd close
295+ * @return void
296+ */
297+void
298+l7vs_pfifo_close(void)
299+{
300+ if(logger_get_log_level(LOG_CAT_L7VSD_ENVIRONMENT) == LOG_LV_DEBUG){
301+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_ENVIRONMENT,3,
302+ "in_fuction: void l7vs_pfifo_close return void");
303+ }
304+ if (l7vs_pfifo_iomux) {
305+ l7vs_pfifo_iomux->status = iomux_pfifo_destroyed;
306+ l7vs_iomux_remove(l7vs_pfifo_iomux);
307+ if (-1 != l7vs_pfifo_iomux->fd) {
308+ close(l7vs_pfifo_iomux->fd);
309+ }
310+ l7vs_iomux_put_to_avail_list(l7vs_pfifo_iomux);
311+ l7vs_pfifo_iomux = NULL;
312+ }
313+ if(logger_get_log_level(LOG_CAT_L7VSD_ENVIRONMENT) == LOG_LV_DEBUG){
314+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_ENVIRONMENT,4,
315+ "out_fuction: void l7vs_pfifo_close return void");
316+ }
317+
318+}
319+
320+/*!
321+ * Operate config fd close
322+ * @return void
323+ */
324+void
325+l7vs_config_close(void)
326+{
327+ if(logger_get_log_level(LOG_CAT_L7VSD_ENVIRONMENT) == LOG_LV_DEBUG){
328+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_ENVIRONMENT,3,
329+ "in_fuction: void l7vs_config_close return void");
330+ }
331+ if (l7vs_config_iomux) {
332+ l7vs_config_iomux->status = iomux_config_destroyed;
333+ l7vs_iomux_remove(l7vs_config_iomux);
334+ if (-1 != l7vs_config_iomux->fd) {
335+ close(l7vs_config_iomux->fd);
336+ }
337+ l7vs_iomux_put_to_avail_list(l7vs_config_iomux);
338+ l7vs_config_iomux = NULL;
339+ }
340+ if(logger_get_log_level(LOG_CAT_L7VSD_ENVIRONMENT) == LOG_LV_DEBUG){
341+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_ENVIRONMENT,4,
342+ "out_fuction: void l7vs_config_close return void");
343+ }
344+}
345+
346+/*!
294347 * Operate config finish
295348 * @return void
296349 */
@@ -429,7 +482,7 @@ l7vs_config_callback(struct l7vs_iomux *iom )
429482 * pfifo call back
430483 * @param[in] struct l7vs_iomux l7vs_iomux pointer
431484 * @return int OK=0, NG<0
432- */
485+ */
433486 static int
434487 l7vs_pfifo_callback(struct l7vs_iomux *iom )
435488 {
--- a/src/service.c
+++ b/src/service.c
@@ -70,6 +70,7 @@ static l7vs_service_repdata * rep_mirror;
7070
7171 //static functions
7272 static void l7vs_service_put_service_arg(struct l7vs_service_arg_multi *);
73+//static int l7vs_pfifo_callback(struct l7vs_iomux *);
7374
7475 // throughput interval
7576 static int throughput_interval = 0;
@@ -80,6 +81,9 @@ static char childinfo[64];
8081 // child process fifo event
8182 static struct l7vs_iomux *l7vs_cfifo_iomux;
8283
84+// parent process fifo event
85+//static struct l7vs_iomux *l7vs_pfifo_iomux;
86+
8387 /*!
8488 * make replication data from l7vs_service structure
8589 * @param[in] num unsigned int/number of array(l7vs_service_repdata)
@@ -1101,6 +1105,150 @@ l7vs_cfifo_callback(struct l7vs_iomux *iom )
11011105 }
11021106
11031107 /*!
1108+ * create parent named pipe
1109+ */
1110+/*
1111+int
1112+create_parent_named_pipe(void)
1113+{
1114+ int ret, fd;
1115+ struct stat st;
1116+
1117+ // directory check
1118+ ret = stat(P_FIFO_PATH, &st);
1119+ if(!ret){
1120+ if(!(S_ISDIR(st.st_mode))){
1121+ // exist same name file.
1122+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM) == LOG_LV_DEBUG){
1123+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM,1,
1124+ "config_init: stat error: %s", sys_errlist[errno]);
1125+ }
1126+ return -1;
1127+ }
1128+ }else{
1129+ if(errno == ENOENT){
1130+ ret = mkdir(P_FIFO_PATH,
1131+ S_IRUSR | S_IWUSR | S_IXUSR |
1132+ S_IRGRP | S_IXGRP |
1133+ S_IROTH | S_IXOTH);
1134+ if(ret == -1 && errno != EEXIST){
1135+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM) == LOG_LV_DEBUG){
1136+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM,1,
1137+ "config_init: mkdir error: %s", sys_errlist[errno]);
1138+ }
1139+ return -1;
1140+ }
1141+ }else{
1142+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM) == LOG_LV_DEBUG){
1143+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM,1,
1144+ "config_init: stat error 2: %s", sys_errlist[errno]);
1145+ }
1146+ return -1;
1147+ }
1148+ }
1149+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
1150+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,1,
1151+ "directory_check: named pipe directory is ok.");
1152+ }
1153+
1154+ // create parent named pipe
1155+ ret = mkfifo(P_FIFO, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
1156+ if(ret < 0 && errno != EEXIST){
1157+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM) == LOG_LV_DEBUG){
1158+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM,1,
1159+ "out_fuction: mkfifo error 1: %s", sys_errlist[errno]);
1160+ }
1161+ return -1;
1162+ }
1163+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
1164+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,1,
1165+ "mkfifo: named pipe create.");
1166+ }
1167+
1168+ // open fifo
1169+
1170+ fd = open(P_FIFO, O_RDONLY|O_NONBLOCK);
1171+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
1172+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,1,
1173+ "open: named pipe open. fd = %d",fd);
1174+ }
1175+ if(fd < 0) {
1176+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM) == LOG_LV_DEBUG){
1177+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM,1,
1178+ "out_fuction: open error: %s"
1179+ ,sys_errlist[errno]);
1180+ }
1181+ return -1;
1182+ }
1183+
1184+ // set iomux for parent named pipe
1185+ l7vs_pfifo_iomux = l7vs_iomux_get_from_avail_list();
1186+ l7vs_pfifo_iomux->fd = fd;
1187+ l7vs_pfifo_iomux->data = NULL;
1188+ l7vs_pfifo_iomux->callback = l7vs_pfifo_callback;
1189+ l7vs_pfifo_iomux->status = iomux_pfifo_read_waiting;
1190+ l7vs_iomux_add( l7vs_pfifo_iomux, iom_read );
1191+
1192+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
1193+ char iomux_str[DEBUG_STR_LEN] = {0};
1194+ l7vs_iomux_c_str(iomux_str,l7vs_pfifo_iomux);
1195+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_PROGRAM,24,
1196+ "creat: l7vs_config_iomux=%s",
1197+ iomux_str);
1198+ }
1199+
1200+ return 0;
1201+}
1202+*/
1203+/*!
1204+ * pfifo call back
1205+ * @param[in] struct l7vs_iomux l7vs_iomux pointer
1206+ * @return int OK=0, NG<0
1207+ */
1208+/*
1209+static int
1210+l7vs_pfifo_callback(struct l7vs_iomux *iom )
1211+{
1212+ int ret;
1213+
1214+ if (!iom) {
1215+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_ENVIRONMENT,2,"error / iom is null");
1216+ if(logger_get_log_level(LOG_CAT_L7VSD_ENVIRONMENT) == LOG_LV_DEBUG){
1217+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_ENVIRONMENT,5,
1218+ "out_fuction: int l7vs_pfifo_callback (struct l7vs_iomux *iom) return -1");
1219+ }
1220+ return -1;
1221+ }
1222+ if (iomux_pfifo_read_waiting != iom->status) {
1223+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_EVENT,2,"error / invalid status(%d)", iom->status);
1224+ if(logger_get_log_level(LOG_CAT_L7VSD_ENVIRONMENT) == LOG_LV_DEBUG){
1225+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_ENVIRONMENT,6,
1226+ "out_fuction: int l7vs_pfifo_callback (struct l7vs_iomux *iom) return -1");
1227+ }
1228+ return -1;
1229+ }
1230+
1231+ if(logger_get_log_level(LOG_CAT_L7VSD_ENVIRONMENT) == LOG_LV_DEBUG){
1232+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_ENVIRONMENT,7,
1233+ "in_fuction: int l7vs_pfifo_callback (struct l7vs_iomux *iom) iom = %p",iom);
1234+ }
1235+
1236+
1237+ ret = l7vs_receive_child_process_info(iom->fd);
1238+ if(ret==-1){
1239+ return -1;
1240+ }
1241+
1242+ l7vs_pfifo_iomux->status = iomux_pfifo_read_waiting;
1243+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
1244+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,9,
1245+ "out_fuction: int l7vs_pfifo_callback (struct l7vs_iomux *iom) return 0");
1246+ }
1247+
1248+ return 0;
1249+}
1250+*/
1251+/*!
11041252 * create service instance. and set service value.
11051253 * @param[in] *arg l7vs_service_arg pointer
11061254 * @param[out] *err error code
@@ -1169,11 +1317,17 @@ l7vs_service_create(struct l7vs_service_arg_multi *arg, int *err)
11691317
11701318 /* IPとportが重複しない場合は子プロセスを作る */
11711319 if( srv_sock_check_flg == 0 ) {
1172- fork_num = sysconf(_SC_NPROCESSORS_ONLN);
1320+ fork_num = sysconf(_SC_NPROCESSORS_ONLN);
11731321 for( i=0; i < fork_num; i++ ){
11741322 pid_t pid = fork();
11751323 /* 子プロセスを生成したら親プロセスでIP,portとPIDの対応リストを作る */
11761324
1325+ /* 親プロセスから引き継いだUNIXドメインソケットを閉じる */
1326+ //l7vs_config_close();
1327+
1328+ /* 親プロセス用PIPEを閉じる */
1329+ l7vs_pfifo_close();
1330+
11771331 /* 子ならgetpidして親に名前付きパイプで通知 */
11781332 if( pid == 0 ){
11791333 /* ソケット作成 */
@@ -1189,38 +1343,58 @@ l7vs_service_create(struct l7vs_service_arg_multi *arg, int *err)
11891343 snprintf(fifopath, sizeof(fifopath), "/tmp/l7vsd_%s_%d", ip, port);
11901344 ret = stat(fifopath, &st);
11911345 if(!ret){
1192- if(!(S_ISDIR(st.st_mode))){
1193- // exist same name file.
1194- perror("stat");
1195- return NULL;
1196- }
1346+ if(!(S_ISDIR(st.st_mode))){
1347+ // exist same name file.
1348+ //DEBUG output
1349+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
1350+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,31,
1351+ "l7vs_service_create: stat error: %s", sys_errlist[errno] );
1352+ }
1353+ return NULL;
1354+ }
11971355 }else{
1198- if(errno == ENOENT){
1199- ret = mkdir(fifopath,
1200- S_IRUSR | S_IWUSR | S_IXUSR | S_ISVTX |
1201- S_IRGRP | S_IXGRP |
1202- S_IROTH | S_IXOTH);
1203- if(ret == -1){
1204- perror("mkdir");
1205- return NULL;
1206- }
1207- }else{
1208- perror("stat");
1209- return NULL;
1210- }
1356+ if(errno == ENOENT){
1357+ ret = mkdir(fifopath,
1358+ S_IRUSR | S_IWUSR | S_IXUSR | S_ISVTX |
1359+ S_IRGRP | S_IXGRP |
1360+ S_IROTH | S_IXOTH);
1361+ if(ret == -1 && errno != EEXIST){
1362+ //DEBUG output
1363+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
1364+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,32,
1365+ "l7vs_service_create: mkdir error: %s", sys_errlist[errno] );
1366+ }
1367+ return NULL;
1368+ }
1369+ }else{
1370+ //DEBUG output
1371+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
1372+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,33,
1373+ "l7vs_service_create: stat error: %s", sys_errlist[errno] );
1374+ }
1375+ return NULL;
1376+ }
12111377 }
12121378
12131379 snprintf(fifoname, sizeof(fifoname), "/tmp/l7vsd_%s_%d/l7vsd.%d", ip, port, pid);
12141380 ret = mkfifo(fifoname, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
12151381 if(ret == -1){
1216- perror("mkfifo");
1382+ //DEBUG output
1383+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
1384+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,34,
1385+ "l7vs_service_create: mkfifo error: %s", sys_errlist[errno] );
1386+ }
12171387 /* 各種アンロード */
12181388 return NULL;
12191389 }
12201390
12211391 /* open fifo */
12221392 if((readfifo = open(fifoname, O_RDONLY|O_NONBLOCK)) < 0) {
1223- perror("open");
1393+ //DEBUG output
1394+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
1395+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,35,
1396+ "l7vs_service_create: child pipe open error: %s", sys_errlist[errno] );
1397+ }
12241398 return NULL;
12251399 }
12261400
@@ -1233,16 +1407,26 @@ l7vs_service_create(struct l7vs_service_arg_multi *arg, int *err)
12331407 l7vs_iomux_add( l7vs_cfifo_iomux, iom_read );
12341408
12351409 /* 親PIPEを開いてPIDとIP,portを親に通知 */
1410+ /* リトライするかどうか・・・sleepいれる? */
12361411 snprintf(childinfo, sizeof(childinfo), "%s %d %d", ip, port, pid);
1412+ //sleep(2);
12371413 if((writefifo = open(P_FIFO, O_WRONLY, 0)) < 0) {
1238- perror("open");
1414+ //DEBUG output
1415+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
1416+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,36,
1417+ "l7vs_service_create: parent pipe open error: %s", sys_errlist[errno] );
1418+ }
12391419 /* 各種アンロード */
12401420 continue;
12411421 }else{
12421422 /* 名前付きパイプに情報を書き込み */
12431423 ret = write(writefifo, childinfo, sizeof(childinfo));
12441424 if(ret < 0){
1245- perror("write");
1425+ //DEBUG output
1426+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
1427+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,37,
1428+ "l7vs_service_create: write error: %s", sys_errlist[errno] );
1429+ }
12461430 /* 各種アンロード */
12471431 }
12481432 close(writefifo);
@@ -1262,14 +1446,18 @@ l7vs_service_create(struct l7vs_service_arg_multi *arg, int *err)
12621446 }else if( pid > 0 ){
12631447 /* 親プロセス処理 */
12641448
1265- /* l7vs_child_proto_grpを初期化作成してリスト登録 */
1449+ /* l7vs_child_proto_grpを初期化作成してリスト登録←複数回を考慮 */
12661450 grp = l7vs_child_proto_grp_init(arg->srv_arg.addr.sin_addr.s_addr,
12671451 arg->srv_arg.addr.sin_port,
12681452 arg->srv_arg.protomod );
12691453
12701454 }else if( pid < 0 ){
12711455 /* 子プロセス作成失敗 */
1272- perror( "fork" );
1456+ //DEBUG output
1457+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
1458+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,38,
1459+ "l7vs_service_create: fork error: %s", sys_errlist[errno] );
1460+ }
12731461 return NULL;
12741462 }
12751463 }
@@ -1292,9 +1480,21 @@ l7vs_receive_child_process_info(int fd)
12921480 struct l7vs_child_proto_grp *grp;
12931481 int ret;
12941482
1483+ //DEBUG output
1484+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
1485+ char debugstr[DEBUG_STR_LEN];
1486+ memset( debugstr, 0, DEBUG_STR_LEN );
1487+ sprintf( debugstr, "function l7vs_receive_child_process_info(int fd)" );
1488+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,43, debugstr );
1489+ }
1490+
12951491 // 読み込み
12961492 if((read(fd, childinfo, sizeof(childinfo)))==-1) {
1297- perror("read");
1493+ //DEBUG output
1494+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
1495+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,39,
1496+ "l7vs_receive_child_process_info: read error: %s", sys_errlist[errno] );
1497+ }
12981498 return -1;
12991499 }
13001500
@@ -1302,13 +1502,23 @@ l7vs_receive_child_process_info(int fd)
13021502 sscanf(childinfo, "%s %d %d", ip, port, pid);
13031503 // 取り出した情報をネットワークバイトオーダーに変換する
13041504 if(!(inet_aton(ip, &nip))){
1305- return -1;
1505+ //DEBUG output
1506+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
1507+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,41,
1508+ "l7vs_receive_child_process_info: inet_aton error: %s", sys_errlist[errno] );
1509+ }
1510+ return -1;
13061511 }
13071512 nport = htons(port);
13081513
13091514 // ipとportからl7vs_child_proto_grpを検索
13101515 grp = l7vs_child_proto_grp_search(nip, nport);
13111516 if(grp == NULL) {
1517+ //DEBUG output
1518+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
1519+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,42,
1520+ "l7vs_receive_child_process_info: l7vs_child_proto_grp_search error." );
1521+ }
13121522 return -1;
13131523 }
13141524 // pidを追加