Hello,
I have a stable working program which works on Linux (on Thecus NAS). So we plan to port it to a PC with 16 data (and one OS) HDD with FreeBSD 9.3 64bit on board. So first of all I created a VMWare image with FreeBSD, GNOME and Netbeans and made some correction to the code (use a 64-bit target, some other changes to use big 3 GB storages and so on). So it has worked well on the VM. When I try it on the PC with FreeBSD (using GCC 4.8 like in the VM, I also installed only MC, gdb, sudo and fusefs-ntfs. All that was installed on the VM except GNOME and its requirements). But on the PC the program returns an error while configuration reading (when using a debug version it says Bus Error). When I see the ktrace dump I can see that the error occurs during fscanf. But I do not understand what is wrong? The file is present and its content is similar to the one that worked (even the line ends in 0x0A like in the one that worked).
So the last lines of the ktrace dump are:
The function where the error occurs:
On a working system the penultimate line of the ktrace dump has a different value:
I have a stable working program which works on Linux (on Thecus NAS). So we plan to port it to a PC with 16 data (and one OS) HDD with FreeBSD 9.3 64bit on board. So first of all I created a VMWare image with FreeBSD, GNOME and Netbeans and made some correction to the code (use a 64-bit target, some other changes to use big 3 GB storages and so on). So it has worked well on the VM. When I try it on the PC with FreeBSD (using GCC 4.8 like in the VM, I also installed only MC, gdb, sudo and fusefs-ntfs. All that was installed on the VM except GNOME and its requirements). But on the PC the program returns an error while configuration reading (when using a debug version it says Bus Error). When I see the ktrace dump I can see that the error occurs during fscanf. But I do not understand what is wrong? The file is present and its content is similar to the one that worked (even the line ends in 0x0A like in the one that worked).
So the last lines of the ktrace dump are:
Code:
985 hashsrv.fbsd.dbg.ve CALL open(0x40b288,0<O_RDONLY>,<unused>0x1b6)
985 hashsrv.fbsd.dbg.ve NAMI "/usr/local/hashsrv/config"
985 hashsrv.fbsd.dbg.ve RET open 4
985 hashsrv.fbsd.dbg.ve CALL fstat(0x4,0x7fffffffdc10)
985 hashsrv.fbsd.dbg.ve RET fstat 0
985 hashsrv.fbsd.dbg.ve CALL read(0x4,0x801865000,0x8000)
985 hashsrv.fbsd.dbg.ve RET read 515/0x203
985 hashsrv.fbsd.dbg.ve NAMI "hashsrv.fbsd.dbg.ve.core"
Code:
int loadcfg( char* fname )
{
char s1[32],s2[5], s3[512],vname[16];
FILE* f = fopen( fname, "r" );
if( f == NULL) return -1;
maxDBFileNameLen = 0;
dbcount = 8;
while(EOF != fscanf(f, "%s", s1)) // <---- as i understand the error occurs there
{
if( EOF == fscanf(f, "%s", s2) ){ fclose(f); return -2;}
if( EOF == fscanf(f, "%s", s3) ){ fclose(f); return -2;}
// bla bla bla....
}
fclose(f);
return 0;
}
On a working system the penultimate line of the ktrace dump has a different value:
Code:
1276 hashsrv.fbsd.dbg.ve RET read 129/0x81