# Linux compatibility FreeBSD - /proc/sys/fs/max-files



## cesar_mabel (Sep 6, 2018)

Hi all,

I'm trying to run some applications written for a Linux system for a possible platform migration. I enabled the linux compatibility (linux-c7) and almost everything I have on Linux are running OK in FreeBSD.

But one specific application give me an error: "it's not possible to open file /proc/sys/fs/file-max".

In the Linux machine (Ubuntu), the /proc/sys directory has many folders "abi  debug  dev  fs  kernel  net  vm", while in the FreeBSD machine the /compat/linux/proc/sys directory only has "kernel".

According to the provider of the application, it's necessary to read the "/proc/sys/fs/file-max" (and other pseudo files) when in a Linux machine to run the application, but I don't have it under the "linprocfs".

How can I solve it? What I forgot?


----------



## ralphbsz (Sep 7, 2018)

Find the piece of code that opens and reads it.  Modify the code to instead use the BSD sysctl variable.  Recompile and relink.  Or for now, for testing purposes, replace that whole code with returning a sensible number (on my home machine, the sysctl returns 97056 by the way), and don't bother reading anything from either sysctl or the proc file system.

In general, read the source code of the program, and see what they do with the returned value.  Most likely, they check that it is large enough for the number of files they want to open.  Given that modern OSes on reasonably-sized machines allow opening a huge number of files, the whole check may not even be necessary.


----------

