Commit ecf893aa authored by Laurent OpenCells's avatar Laurent OpenCells

fix obsolete system call

parent fc0449ff
...@@ -218,11 +218,6 @@ int ethernet_tune(openair0_device *device, ...@@ -218,11 +218,6 @@ int ethernet_tune(openair0_device *device,
struct timeval timeout; struct timeval timeout;
struct ifreq ifr; struct ifreq ifr;
char system_cmd[256]; char system_cmd[256];
int rname[] = { CTL_NET, NET_CORE, NET_CORE_RMEM_MAX };
int wname[] = { CTL_NET, NET_CORE, NET_CORE_WMEM_MAX };
int namelen=3;
int newval[1];
int newlen=sizeof(newval);
int ret=0; int ret=0;
// int i=0; // int i=0;
...@@ -362,28 +357,36 @@ int ethernet_tune(openair0_device *device, ...@@ -362,28 +357,36 @@ int ethernet_tune(openair0_device *device,
} }
break; break;
case KERNEL_RCV_BUF_MAX_SIZE: case KERNEL_RCV_BUF_MAX_SIZE:
newval[0] = value; ret=snprintf(system_cmd,sizeof(system_cmd),"sysctl -w net.core.rmem_max=%d",value);
ret=sysctl(rname, namelen, NULL, 0, newval, newlen); if (ret > 0) {
if (ret) { ret=system(system_cmd);
fprintf(stderr,"[ETHERNET] Error using sysctl():%s\n",strerror(errno)); if (ret == -1) {
} else { fprintf (stderr,"[ETHERNET] Can't start shell to execute %s %s",system_cmd, strerror(errno));
printf("[ETHERNET] Kernel network receive buffer max size is set to %u\n",(unsigned int)newval[0]); } else {
} printf ("[ETHERNET] status of %s is %d\n", system_cmd, WEXITSTATUS(ret));
break; }
printf("[ETHERNET] net core rmem %s\n",system_cmd);
} else {
perror("[ETHERNET] Can't set net core rmem\n");
}
break;
case KERNEL_SND_BUF_MAX_SIZE: case KERNEL_SND_BUF_MAX_SIZE:
newval[0] = value; ret=snprintf(system_cmd,sizeof(system_cmd),"sysctl -w net.core.wmem_max=%d",value);
ret=sysctl(wname, namelen, NULL, 0, newval, newlen); if (ret > 0) {
if (ret) { ret=system(system_cmd);
fprintf(stderr,"[ETHERNET] Error using sysctl():%s\n",strerror(errno)); if (ret == -1) {
} else { fprintf (stderr,"[ETHERNET] Can't start shell to execute %s %s",system_cmd, strerror(errno));
printf("[ETHERNET] Kernel network send buffer max size is set to %u\n",(unsigned int)newval[0]); } else {
} printf ("[ETHERNET] status of %s is %d\n", system_cmd, WEXITSTATUS(ret));
break; }
printf("[ETHERNET] net core wmem %s\n",system_cmd);
} else {
perror("[ETHERNET] Can't set net core wmem\n");
}
break;
default: default:
break; break;
} }
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment