On Mon, Oct 13, 2025 at 12:31:25PM +0200, Stefano Brivio wrote: > On Mon, 13 Oct 2025 18:22:00 +0800 > Yumei Huang wrote: > > > On Mon, Oct 13, 2025 at 8:21 AM David Gibson > > wrote: > > > > > > On Fri, Oct 10, 2025 at 03:46:59PM +0800, Yumei Huang wrote: > > > > > > > > +/** > > > > + * get_tcp_syn_param() - Read SYN parameters from /proc/sys > > > > + * @path: Path to the sysctl file > > > > + * @fallback: Default value if file can't be read > > > > + * > > > > + * Return: Parameter value, fallback on failure > > > > +*/ > > > > +int get_tcp_syn_param(const char *path, int fallback) > > > > > > I wonder if it might be worth making a new function in util.c to read > > > a file containing a single number. > > > > I can do that. So it could be reused in the future. > > If it helps: we already have write_file(), so it might be worth adding > a read_file() symmetric to it. Maybe it's overkill though. That might be nice. Since we can't do allocations the right interface for read_file() is slightly trickier though: we need to have a preallocated buffer and report possible truncation. -- David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson