Ask a Question related to Sun Solaris, Design and Development.
-
newdaily #1
64 bit binary and 32 bit binary have different result. Is it library bug or compiler bug?
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <dirent.h>
#include <assert.h>
int main(int argc, char *argv[])
{
DIR *s_pDIR;
struct dirent *s_pDirEnt;
struct dirent *s_pResDirEnt;
char s_backupDir[1024];
int s_rc;
s_pDirEnt = NULL;
s_pDirEnt = (struct dirent*)malloc(sizeof(struct dirent) + 1024);
if(s_pDirEnt == NULL)
{
printf("malloc error\n");
exit(1);
}
strcpy(s_backupDir, argv[1]);
s_pDIR = opendir(s_backupDir);
s_pResDirEnt = NULL;
s_rc = readdir_r(s_pDIR, s_pDirEnt, &s_pResDirEnt);
while(s_pResDirEnt != NULL)
{
s_pResDirEnt = NULL;
s_rc = readdir_r(s_pDIR, s_pDirEnt, &s_pResDirEnt);
assert(s_rc == 0);
}//while
closedir(s_pDIR);
free(s_pDirEnt);
return 0;
}
OS: Solaris 2.8
first, I compile this source with 32 bit.
CC -D_POSIX_PTHREAD_SEMANTICS readdir.cpp -mt -xarch=v8plusa -o
readdir
and test like this.
echo "y" | testindex ./
It runs well. but It fails when I compile this source with 64 bit like
this and test.
CC -D_POSIX_PTHREAD_SEMANTICS readdir.cpp -mt -xarch=v9 -o readdir
echo "y" | testindex ./
Assertion failed: s_rc == 0, file testindex.cpp, line 36.
So, I remove "echo "y"" and test like this
testindex ./
It runs well.
How can I fix this bug? Is it compile bug?
newdaily Guest
-
Binary file IO
Hi, What I would like to do is load a file's contents from a file on the server and put the contents into a record in a database. For this I... -
binary data
Greets, Register globals are to OFF - however the files will not upload. Thanking all in advance. TR ............... <? if ($submit) { -
binary perl
Is it possible to make a perl script/program a binary file? I have a few scripts some one wants but I don't want them to have the source. I tried... -
CGI php Binary
Hi; I appologize in advance to purists who think the question is an appache one, or a mysql question. I have a virtual domain hosted by... -
awk, sed etc on binary files
Can I use commands like sed, awk, tr etc on binary files? The file contains a string e.g. TESTSTRING=6 which I need to change to TESTSTRING=10 JL -
Alan Coopersmith #2
Re: 64 bit binary and 32 bit binary have different result. Is it library bug or compiler bug?
[email]newdaily@altibase.com[/email] (newdaily) writes in comp.unix.solaris:
| s_rc = readdir_r(s_pDIR, s_pDirEnt, &s_pResDirEnt);
| assert(s_rc == 0);
The man page states:
The POSIX readdir_r() returns 0 if successful or
an error number to indicate failure.
Have you looked to see what error number you are getting?
It seems to work fine for me, but obviously you haven't provided the
whole test case, since you show running a "testindex" program that
takes input, which this program does not, and isn't the name you claim
you compiled as. I would assume the bug is somewhere in testindex.
--
__________________________________________________ ______________________
Alan Coopersmith [email]alanc@alum.calberkeley.org[/email]
[url]http://www.CSUA.Berkeley.EDU/~alanc/[/url] aka: [email]Alan.Coopersmith@Sun.COM[/email]
Working for, but definitely not speaking for, Sun Microsystems, Inc.
Alan Coopersmith Guest
-
Rich Teer #3
Re: 64 bit binary and 32 bit binary have different result. Is itlibrary bug or compiler bug?
On 24 Jun 2003, newdaily wrote:
[...]
We answered this question a week or two ago. The answer is
the same now as it was then. :-)
--
Rich Teer, SCNA, SCSA
President,
Rite Online Inc.
Voice: +1 (250) 979-1638
URL: [url]http://www.rite-online.net[/url]
Rich Teer Guest
-
Wayne Rasmussen #4
Re: 64 bit binary and 32 bit binary have different result. Is itlibrarybug or compiler bug?
How long is he suppose to wait for this to change? :)
Rich Teer wrote:
> On 24 Jun 2003, newdaily wrote:
>
> [...]
>
> We answered this question a week or two ago. The answer is
> the same now as it was then. :-)
>
> --
> Rich Teer, SCNA, SCSA
>
> President,
> Rite Online Inc.
>
> Voice: +1 (250) 979-1638
> URL: [url]http://www.rite-online.net[/url]Wayne Rasmussen Guest
-
Rich Teer #5
Re: 64 bit binary and 32 bit binary have different result. Isitlibrary bug or compiler bug?
On 25 Jun 2003, Wayne Rasmussen wrote:
At least until the time_t's rolls over. And on a 64-bit OS,> How long is he suppose to wait for this to change? :)
that will be some time... :-)
--
Rich Teer, SCNA, SCSA
President,
Rite Online Inc.
Voice: +1 (250) 979-1638
URL: [url]http://www.rite-online.net[/url]
Rich Teer Guest
-
newdaily #6
Re: 64 bit binary and 32 bit binary have different result. Is it library bug or compiler bug?
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <dirent.h>
#include <assert.h>
int main(int argc, char *argv[])
{
DIR *s_pDIR;
struct dirent *s_pDirEnt;
struct dirent *s_pResDirEnt;
char s_backupDir[1024];
int s_rc;
s_pDirEnt = NULL;
s_pDirEnt = (struct dirent*)malloc(sizeof(struct dirent) + 1024);
if(s_pDirEnt == NULL)
{
printf("malloc error\n");
exit(1);
}
strcpy(s_backupDir, argv[1]);
/* I omit a fflush */
fflush(NULL); <<-------------------- The Problem
s_pDIR = opendir(s_backupDir);
s_pResDirEnt = NULL;
s_rc = readdir_r(s_pDIR, s_pDirEnt, &s_pResDirEnt);
while(s_pResDirEnt != NULL)
{
s_pResDirEnt = NULL;
s_rc = readdir_r(s_pDIR, s_pDirEnt, &s_pResDirEnt);
assert(s_rc == 0);
}//while
closedir(s_pDIR);
free(s_pDirEnt);
return 0;
}
I am sorry that i omit a "fflush".
CC -D_POSIX_PTHREAD_SEMANTICS testindex.cpp -mt -xarch=v9 -o
testindex.
echo "y" | ./testindex ./
if I remove fflush, this test case runs well. but If I insert a
fflush, this case fails.
why does fflush influence a testindex?
newdaily Guest



Reply With Quote

