seisatsu / EpilogueOS

An ESP32 linux-remeniscient shell and operating system based on MicroPython, with LoRa mesh-networking as its ultimate goal.
MIT License
3 stars 0 forks source link

There is an adjustable hard limit on File Descriptors / Handles imposed by a downstream library #21

Open seisatsu opened 2 years ago

seisatsu commented 2 years ago

The ESP32 VFS Module has a downstream library that sets a maximum File Descriptor / File Handle, so I need to rewrite how I handle assigning them in DeviceFS, in order to reuse old ones. The default maximum is 64, but can be defined by the user by redefining FD_SETSIZE, in our project. However, we won't have infinite space to work with since higher descriptors are used for sockets. So, I still need to do some garbage collection on file handles.

See https://github.com/pycom/esp-idf-2.0/blob/master/components/newlib/include/sys/types.h

pmer commented 2 years ago

In which part of the code are higher descriptors used by sockets?

seisatsu commented 2 years ago

No idea, but it's documented that this happens in https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/storage/vfs.html#file-descriptors

seisatsu commented 2 years ago

Also it looks like file descriptors should be handled globally rather than by DeviceFS internally, so I will need to redo that as well once I hook DeviceFS up to the overall VFS manager.

Alternatively I might just end up writing our own simpler VFS, I have done it before and it would probably cut out some overhead. This is a big project on a tiny chip so we need to cut out as much overhead as we can; see also #20.

I can probably port the VFS from Tsunagari or Driftwood.

pmer commented 2 years ago

I see, thanks.

And sure. We can also measure how much space everything uses with nm—there is a command line argument that will have it print the space of each symbol (function, global variable, etc.) in an object file/binary file.