diff options
Diffstat (limited to 'source3/smbd/process.c')
-rw-r--r-- | source3/smbd/process.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 03b1e007ba..06cedea573 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -799,6 +799,32 @@ static int construct_reply(char *inbuf,char *outbuf,int size,int bufsize) 'hard' limit Samba overhead on resource constrained systems. ****************************************************************************/ +static BOOL process_count_update_successful = False; + +static int32 increment_smbd_process_count(void) +{ + int32 total_smbds; + + if (lp_max_smbd_processes()) { + total_smbds = 0; + if (tdb_change_int32_atomic(conn_tdb_ctx(), "INFO/total_smbds", &total_smbds, -1) == -1) + return 1; + process_count_update_successful = True; + return total_smbds + 1; + } + return 1; +} + +void decrement_smbd_process_count(void) +{ + int32 total_smbds; + + if (lp_max_smbd_processes() && process_count_update_successful) { + total_smbds = 1; + tdb_change_int32_atomic(conn_tdb_ctx(), "INFO/total_smbds", &total_smbds, -1); + } +} + static BOOL smbd_process_limit(void) { int32 total_smbds; |