Changing Files[MAX_OPEN_FILES] to dynamically allocated

Richard Sharpe sharpe at ns.aus.com
Mon Jul 20 05:28:52 GMT 1998


Hi,

I have been looking at changing the way the files_struct
Files[MAX_OPEN_FILES] structure is handled to being dynamically allocated.

I notice that SWAT includes it own definition of the Files array as well.

What use does it make of the Files array?

So far, I am working away from the CVS tree, and if all goes will, I plan
to introduce some changes that turn Files into:

files_struct *Files;

and on startup, we will do

max_open_files = 0;

load_params();

if (max_open_files == 0)
   max_open_files = MAX_OPEN_FILES;

if !(Files = (files_struct *)malloc(max_open_files * sizeof(files_struct))) {
  
   Error(could not allocat Files Struct);
   exit(999);

}

Regards
-------
Richard Sharpe, sharpe at ns.aus.com, NIC-Handle:RJS96
NS Computer Software and Services P/L, 
Ph: +61-8-8281-0063, FAX: +61-8-8250-2080, 
Samba, Linux, Apache, Digital UNIX, AIX, Netscape, Stronghold, C, ...


More information about the samba-technical mailing list