#undef KERNEL_VERSION
#define KERNEL_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c))
-extern int read_int_from_file(const char *, int *);
+extern int read_int_from_file(struct tcb *, const char *, int *);
extern void set_sortby(const char *);
extern void set_overhead(int);
}
static unsigned int
-get_optmem_max(void)
+get_optmem_max(struct tcb *tcp)
{
static int optmem_max;
if (!optmem_max) {
- if (read_int_from_file("/proc/sys/net/core/optmem_max",
+ if (read_int_from_file(tcp, "/proc/sys/net/core/optmem_max",
&optmem_max) || optmem_max <= 0) {
optmem_max = sizeof(long long) * (2 * IOV_MAX + 512);
} else {
#endif
sizeof(struct cmsghdr);
- unsigned int control_len = in_control_len > get_optmem_max()
- ? get_optmem_max() : in_control_len;
+ unsigned int control_len = in_control_len > get_optmem_max(tcp)
+ ? get_optmem_max(tcp) : in_control_len;
unsigned int buf_len = control_len;
char *buf = buf_len < cmsg_size ? NULL : malloc(buf_len);
if (!buf || umoven(tcp, addr, buf_len, buf) < 0) {
#endif
int
-read_int_from_file(const char *const fname, int *const pvalue)
+read_int_from_file(struct tcb *tcp, const char *const fname, int *const pvalue)
{
const int fd = open_file(fname, O_RDONLY);
if (fd < 0)