mirror of https://github.com/schoebel/mars
client/server: add /proc/sys/mars/[cs]*_count
This commit is contained in:
parent
7f876a1a82
commit
127cbd6d86
|
@ -34,6 +34,9 @@
|
|||
#include "brick_wait.h"
|
||||
#include "mars.h"
|
||||
|
||||
atomic_t client_sender_count = ATOMIC_INIT(0);
|
||||
atomic_t client_receiver_count = ATOMIC_INIT(0);
|
||||
|
||||
///////////////////////// own type definitions ////////////////////////
|
||||
|
||||
#include "mars_client.h"
|
||||
|
@ -180,6 +183,7 @@ int _setup_channel(struct client_bundle *bundle, int ch_nr)
|
|||
goto done;
|
||||
}
|
||||
ch->is_used = true;
|
||||
atomic_inc(&client_receiver_count);
|
||||
|
||||
done:
|
||||
if (status < 0) {
|
||||
|
@ -375,6 +379,8 @@ int _setup_bundle(struct client_bundle *bundle, const char *str)
|
|||
goto done;
|
||||
}
|
||||
|
||||
atomic_inc(&client_sender_count);
|
||||
|
||||
status = 0;
|
||||
|
||||
done:
|
||||
|
@ -741,6 +747,7 @@ int receiver_thread(void *data)
|
|||
|
||||
mars_shutdown_socket(&ch->socket);
|
||||
atomic_dec(&brick->receiver_count);
|
||||
atomic_dec(&client_receiver_count);
|
||||
mars_trigger();
|
||||
return status;
|
||||
}
|
||||
|
@ -1019,6 +1026,7 @@ static int sender_thread(void *data)
|
|||
brick_wake_smp(&output->bundle.sender_event);
|
||||
MARS_DBG("sender terminated\n");
|
||||
atomic_dec(&brick->sender_count);
|
||||
atomic_dec(&client_sender_count);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,9 @@ extern int mars_client_abort;
|
|||
extern int max_client_channels;
|
||||
extern int max_client_bulk;
|
||||
|
||||
extern atomic_t client_sender_count;
|
||||
extern atomic_t client_receiver_count;
|
||||
|
||||
#define MAX_CLIENT_CHANNELS 4
|
||||
|
||||
struct client_mref_aspect {
|
||||
|
|
|
@ -65,6 +65,9 @@ static struct server_cookie server_cookie[MARS_TRAFFIC_MAX] = {
|
|||
|
||||
static struct task_struct *server_thread[MARS_TRAFFIC_MAX] = {};
|
||||
|
||||
atomic_t server_callback_count = ATOMIC_INIT(0);
|
||||
EXPORT_SYMBOL_GPL(server_callback_count);
|
||||
|
||||
atomic_t server_handler_count = ATOMIC_INIT(0);
|
||||
EXPORT_SYMBOL_GPL(server_handler_count);
|
||||
|
||||
|
@ -107,6 +110,8 @@ int cb_thread(void *data)
|
|||
bool ok = mars_get_socket(sock);
|
||||
int status = -EINVAL;
|
||||
|
||||
atomic_inc(&server_callback_count);
|
||||
|
||||
MARS_DBG("--------------- cb_thread starting on socket #%d, ok = %d\n", sock->s_debug_nr, ok);
|
||||
if (!ok)
|
||||
goto done;
|
||||
|
@ -230,6 +235,7 @@ int cb_thread(void *data)
|
|||
done:
|
||||
MARS_DBG("---------- cb_thread terminating, status = %d\n", status);
|
||||
brick_wake_smp(&brick->startup_event);
|
||||
atomic_dec(&server_callback_count);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ extern int dent_limit;
|
|||
extern int dent_retry;
|
||||
extern int handler_limit;
|
||||
|
||||
extern atomic_t server_callback_count;
|
||||
extern atomic_t server_handler_count;
|
||||
|
||||
struct server_mref_aspect {
|
||||
|
|
|
@ -688,6 +688,10 @@ struct ctl_table mars_table[] = {
|
|||
INT_ENTRY("handler_dent_limit", dent_limit, 0600),
|
||||
INT_ENTRY("handler_dent_retry", dent_retry, 0600),
|
||||
INT_ENTRY("handler_limit", handler_limit, 0600),
|
||||
INT_ENTRY("client_sender_count", client_sender_count, 0400),
|
||||
INT_ENTRY("client_receiver_count", client_receiver_count, 0400),
|
||||
INT_ENTRY("server_callback_count", server_callback_count, 0400),
|
||||
INT_ENTRY("server_handler_count", server_handler_count, 0400),
|
||||
INT_ENTRY("mars_emergency_mode", mars_emergency_mode, 0600),
|
||||
INT_ENTRY("mars_reset_emergency", mars_reset_emergency, 0600),
|
||||
INT_ENTRY("mars_keep_msg_s", mars_keep_msg, 0600),
|
||||
|
|
Loading…
Reference in New Issue