mirror of
https://github.com/samba-team/samba.git
synced 2025-12-16 00:23:52 +03:00
Re-added code to tell the user how many open files they
have. Needed for server diagnosis purposes... Jeremy.
This commit is contained in:
@@ -351,7 +351,7 @@ char *sid_to_string(pstring sidstr_out, DOM_SID *sid);
|
|||||||
BOOL string_to_sid(DOM_SID *sidout, char *sidstr);
|
BOOL string_to_sid(DOM_SID *sidout, char *sidstr);
|
||||||
int str_checksum(const char *s);
|
int str_checksum(const char *s);
|
||||||
void zero_free(void *p, size_t size);
|
void zero_free(void *p, size_t size);
|
||||||
int set_maxfiles(void);
|
int set_maxfiles(int requested_max);
|
||||||
|
|
||||||
/*The following definitions come from libsmb/clientgen.c */
|
/*The following definitions come from libsmb/clientgen.c */
|
||||||
|
|
||||||
@@ -1189,7 +1189,7 @@ BOOL trust_password_unlock(void);
|
|||||||
BOOL trust_password_delete( char *domain, char *name );
|
BOOL trust_password_delete( char *domain, char *name );
|
||||||
BOOL get_trust_account_password( unsigned char *ret_pwd, time_t *pass_last_set_time);
|
BOOL get_trust_account_password( unsigned char *ret_pwd, time_t *pass_last_set_time);
|
||||||
BOOL set_trust_account_password( unsigned char *md4_new_pwd);
|
BOOL set_trust_account_password( unsigned char *md4_new_pwd);
|
||||||
BOOL trust_get_passwd( unsigned char trust_passwd[16], char *myname, char *domain);
|
BOOL trust_get_passwd( unsigned char trust_passwd[16], char *domain, char *myname);
|
||||||
|
|
||||||
/*The following definitions come from printing/pcap.c */
|
/*The following definitions come from printing/pcap.c */
|
||||||
|
|
||||||
|
|||||||
@@ -4849,9 +4849,9 @@ void zero_free(void *p, size_t size)
|
|||||||
|
|
||||||
|
|
||||||
/*****************************************************************
|
/*****************************************************************
|
||||||
set our open file limit to the max and return the limit
|
set our open file limit to a requested max and return the limit
|
||||||
*****************************************************************/
|
*****************************************************************/
|
||||||
int set_maxfiles(void)
|
int set_maxfiles(int requested_max)
|
||||||
{
|
{
|
||||||
#if (defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE))
|
#if (defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE))
|
||||||
struct rlimit rlp;
|
struct rlimit rlp;
|
||||||
@@ -4860,13 +4860,15 @@ int set_maxfiles(void)
|
|||||||
* account for the extra fd we need
|
* account for the extra fd we need
|
||||||
* as well as the log files and standard
|
* as well as the log files and standard
|
||||||
* handles etc. */
|
* handles etc. */
|
||||||
rlp.rlim_cur = rlp.rlim_max;
|
rlp.rlim_cur = MIN(requested_max,rlp.rlim_max);
|
||||||
setrlimit(RLIMIT_NOFILE, &rlp);
|
setrlimit(RLIMIT_NOFILE, &rlp);
|
||||||
getrlimit(RLIMIT_NOFILE, &rlp);
|
getrlimit(RLIMIT_NOFILE, &rlp);
|
||||||
return rlp.rlim_cur;
|
return rlp.rlim_cur;
|
||||||
#else
|
#else
|
||||||
/* just guess ... */
|
/*
|
||||||
return 1024;
|
* No way to know - just guess...
|
||||||
|
*/
|
||||||
|
return requested_max;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -202,12 +202,22 @@ initialise file structures
|
|||||||
|
|
||||||
void file_init(void)
|
void file_init(void)
|
||||||
{
|
{
|
||||||
int lim;
|
int request_max_open_files = lp_max_open_files();
|
||||||
|
int real_lim;
|
||||||
|
|
||||||
lim = set_maxfiles();
|
/*
|
||||||
lim = MIN(lim, lp_max_open_files());
|
* Set the max_open files to be the requested
|
||||||
|
* max plus a fudgefactor to allow for the extra
|
||||||
|
* fd's we need such as log files etc...
|
||||||
|
*/
|
||||||
|
real_lim = set_maxfiles(request_max_open_files + MAX_OPEN_FUDGEFACTOR);
|
||||||
|
|
||||||
real_max_open_files = lim - MAX_OPEN_FUDGEFACTOR;
|
real_max_open_files = real_lim - MAX_OPEN_FUDGEFACTOR;
|
||||||
|
|
||||||
|
if(real_max_open_files != request_max_open_files) {
|
||||||
|
DEBUG(1,("file_init: Information only: requested %d \
|
||||||
|
open files, %d are available.\n", request_max_open_files, real_max_open_files));
|
||||||
|
}
|
||||||
|
|
||||||
file_bmap = bitmap_allocate(real_max_open_files);
|
file_bmap = bitmap_allocate(real_max_open_files);
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ void smbw_init(void)
|
|||||||
}
|
}
|
||||||
smbw_busy--;
|
smbw_busy--;
|
||||||
|
|
||||||
set_maxfiles();
|
set_maxfiles(lp_max_open_files()+10);
|
||||||
|
|
||||||
errno = eno;
|
errno = eno;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user