This commit is contained in:
maliakal_d 2021-09-03 08:15:36 +02:00
parent c4caacd2ed
commit 82f022d46b

View File

@ -3726,6 +3726,30 @@ int program_fpga(int file_des) {
LOG(logINFOBLUE, ("Program size is: %lld\n",
(long long unsigned int)filesize));
int rc;
u_int page_size;
struct vmtotal vmt;
size_t vmt_size, uint_size;
vmt_size = sizeof(vmt);
uint_size = sizeof(page_size);
rc = sysctlbyname("vm.vmtotal", &vmt, &vmt_size, NULL, 0);
if (rc < 0) {
perror("sysctlbyname");
return 1;
}
rc = sysctlbyname("vm.stats.vm.v_page_size", &page_size, &uint_size,
NULL, 0);
if (rc < 0) {
perror("sysctlbyname");
return 1;
}
printf("Free memory : %ld\n", vmt.t_free * (u_int64_t)page_size);
printf("Available memory : %ld\n", vmt.t_avm * (u_int64_t)page_size);
/*
// delete old /var/tmp/file
char cmd[MAX_STR_LENGTH] = {0};
@ -3746,7 +3770,8 @@ int program_fpga(int file_des) {
if (success == FAIL) {
ret = FAIL;
strcpy(mess, retvals);
// LOG(logERROR, (mess)); already printed in executecommand
// LOG(logERROR, (mess)); already printed in
executecommand
}
}
Server_SendResult(file_des, INT32, NULL, 0);