aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/adapt/nstack_dmm_adpt.c2
-rw-r--r--src/nSocket/include/nstack_dmm_api.h1
-rw-r--r--src/nSocket/include/nstack_select.h2
-rw-r--r--src/nSocket/kernel/linux_kernel_module.c1
-rw-r--r--src/nSocket/nstack/event/select/nstack_select.c22
-rw-r--r--src/nSocket/nstack/nstack.c2
-rw-r--r--src/nSocket/nstack/nstack_module.c20
-rw-r--r--src/nSocket/nstack/nstack_module.h1
-rw-r--r--src/nSocket/nstack/nstack_socket.c2
-rw-r--r--src/nSocket/nstack_rd/nstack_rd.c2
11 files changed, 53 insertions, 4 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c71659c..1069e7f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -42,7 +42,7 @@ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-z,noexecstack -mcmodel=medium")
SET(COMPLE_CONFIG ${PROJECT_SOURCE_DIR}/src/framework/common/include/compile_config.h)
ADD_DEFINITIONS(-include ${COMM_CONFIG})
ADD_DEFINITIONS(-include ${COMPLE_CONFIG})
-ADD_DEFINITIONS(-D_GNU_SOURCE -DNSTACK_GETVER_VERSION="18.04")
+ADD_DEFINITIONS(-D_GNU_SOURCE -DNSTACK_GETVER_VERSION="18.07")
#LINK_DIRECTORIES(${LIB_PATH_SHARED} ${LIB_PATH_STATIC})
if(WITH_SECUREC_LIB)
diff --git a/src/adapt/nstack_dmm_adpt.c b/src/adapt/nstack_dmm_adpt.c
index 652d0e2..d497b80 100644
--- a/src/adapt/nstack_dmm_adpt.c
+++ b/src/adapt/nstack_dmm_adpt.c
@@ -98,7 +98,7 @@ nstack_event_callback (void *pdata, int events)
ep_hlist_add_tail (&ep->rdlist, &epi->rdllink);
sem_post (&ep->waitSem);
}
- epi->revents |= events;
+ epi->revents |= (epi->event.events & events);
out_unlock:
sys_sem_s_signal (&ep->lock);
}
diff --git a/src/nSocket/include/nstack_dmm_api.h b/src/nSocket/include/nstack_dmm_api.h
index dff69f3..ab06650 100644
--- a/src/nSocket/include/nstack_dmm_api.h
+++ b/src/nSocket/include/nstack_dmm_api.h
@@ -57,6 +57,7 @@ typedef enum
typedef struct __nstack_extern_ops
{
int (*module_init) (void); /*stack module init */
+ int (*module_init_child) (void); /*stack module init for child process */
int (*fork_init_child) (pid_t p, pid_t c); /*after fork, stack child process init again if needed. */
void (*fork_parent_fd) (int s, pid_t p); /*after fork, stack parent process proc again if needed. */
void (*fork_child_fd) (int s, pid_t p, pid_t c); /*after fork, child record pid for recycle if needed. */
diff --git a/src/nSocket/include/nstack_select.h b/src/nSocket/include/nstack_select.h
index 5c84846..659c477 100644
--- a/src/nSocket/include/nstack_select.h
+++ b/src/nSocket/include/nstack_select.h
@@ -141,6 +141,8 @@ extern i32 select_add_cb (struct select_entry *entry);
extern i32 select_rm_cb (struct select_entry *entry);
extern i32 select_entry_reset (struct select_entry *entry);
extern i32 select_module_init ();
+extern i32 select_module_init_child ();
+
extern struct select_module_info *get_select_module (void);
#ifdef __cplusplus
/* *INDENT-OFF* */
diff --git a/src/nSocket/kernel/linux_kernel_module.c b/src/nSocket/kernel/linux_kernel_module.c
index 6a262d0..eb3dd8d 100644
--- a/src/nSocket/kernel/linux_kernel_module.c
+++ b/src/nSocket/kernel/linux_kernel_module.c
@@ -324,6 +324,7 @@ kernel_stack_register (nstack_proc_cb * ops, nstack_event_cb * val)
ops->extern_ops.ep_ctl = kernel_ep_fd_add;
ops->extern_ops.ep_prewait_proc = kernel_prewait_proc;
ops->extern_ops.module_init = kernel_module_init;
+ ops->extern_ops.module_init_child = kernel_module_init;
ops->extern_ops.stack_alloc_fd = kernel_fd_alloc;
/* don't close file descriptor */
diff --git a/src/nSocket/nstack/event/select/nstack_select.c b/src/nSocket/nstack/event/select/nstack_select.c
index ba64cff..930f1db 100644
--- a/src/nSocket/nstack/event/select/nstack_select.c
+++ b/src/nSocket/nstack/event/select/nstack_select.c
@@ -753,4 +753,26 @@ nssct_set_index (i32 fd, i32 inx)
select_set_index (fd, inx);
}
+i32
+select_module_init_child ()
+{
+ pthread_t select_thread_id;
+ i32 retval;
+
+ if (pthread_create (&select_thread_id, NULL, nstack_select_thread, NULL))
+ {
+ goto ERR_RET;
+ }
+
+ retval = pthread_setname_np (select_thread_id, "nstack_select_child");
+ if (retval)
+ {
+ /*set thread name failed */
+ }
+ return TRUE;
+
+ERR_RET:
+ return FALSE;
+}
+
#endif /* NSTACK_SELECT_MODULE */
diff --git a/src/nSocket/nstack/nstack.c b/src/nSocket/nstack/nstack.c
index 6644e86..4198266 100644
--- a/src/nSocket/nstack/nstack.c
+++ b/src/nSocket/nstack/nstack.c
@@ -588,7 +588,7 @@ nstack_for_epoll_init ()
NSSOC_LOGINF ("fork]g_nStackInfo.pid=%u,getpid=%d", g_nStackInfo.pid,
getpid ());
- nstack_stack_module_init();
+ nstack_stack_module_init_child();
}
return 0;
}
diff --git a/src/nSocket/nstack/nstack_module.c b/src/nSocket/nstack/nstack_module.c
index bef91e5..9566ab8 100644
--- a/src/nSocket/nstack/nstack_module.c
+++ b/src/nSocket/nstack/nstack_module.c
@@ -265,3 +265,23 @@ nstack_stack_module_init ()
}
return 0;
}
+
+int
+nstack_stack_module_init_child ()
+{
+ ns_uint32 idx;
+ for (idx = 0; idx < g_module_num; idx++)
+ {
+ if (g_nstack_modules.modules[idx].mops.extern_ops.module_init_child)
+ {
+ if (0 !=
+ g_nstack_modules.modules[idx].mops.
+ extern_ops.module_init_child ())
+ {
+ NSSOC_LOGERR ("nstack[%s] modx:%d init child fail",
+ g_nstack_modules.modules[idx].modulename, idx);
+ }
+ }
+ }
+ return 0;
+}
diff --git a/src/nSocket/nstack/nstack_module.h b/src/nSocket/nstack/nstack_module.h
index e0105af..ec81ac1 100644
--- a/src/nSocket/nstack/nstack_module.h
+++ b/src/nSocket/nstack/nstack_module.h
@@ -135,6 +135,7 @@ extern nstack_module_keys g_nstack_module_desc[];
for ((modInx) = 0; ((modInx) < nstack_get_modNum() && (pMod = nstack_get_module((modInx)))); (modInx)++)
int nstack_stack_module_init ();
+int nstack_stack_module_init_child ();
int nstack_get_deploy_type ();
diff --git a/src/nSocket/nstack/nstack_socket.c b/src/nSocket/nstack/nstack_socket.c
index e3da248..cd1557b 100644
--- a/src/nSocket/nstack/nstack_socket.c
+++ b/src/nSocket/nstack/nstack_socket.c
@@ -2775,6 +2775,8 @@ nstack_fork (void)
dmm_spinlock_lock_with_pid (nstack_get_fork_share_lock (),
get_sys_pid ());
nsep_fork_child_proc (parent_pid);
+
+ (void) select_module_init_child ();
common_mem_spinlock_unlock (nstack_get_fork_share_lock ());
}
else if (pid > 0)
diff --git a/src/nSocket/nstack_rd/nstack_rd.c b/src/nSocket/nstack_rd/nstack_rd.c
index eb38bca..cdcb92d 100644
--- a/src/nSocket/nstack_rd/nstack_rd.c
+++ b/src/nSocket/nstack_rd/nstack_rd.c
@@ -189,7 +189,7 @@ nstack_rd_sys_default ()
/*get the protocol default route */
(void) MEMSET_S (&item, sizeof (item), 0, sizeof (item));
for (icnt = 0;
- icnt < sizeof (g_default_protcol) / sizeof (rd_data_defaut_ip); icnt++)
+ icnt < sizeof (g_default_protcol) / sizeof (rd_data_defaut_protocol); icnt++)
{
pprotodata = &g_default_protcol[icnt];
for (iindex = 0; iindex < g_rd_map_num; iindex++)