Hi,
Platform : SunOS 4.1,
compiler : gcc
I m writting wrapper functions for file operations ( open, close, ...) .
When the calls are in the same file where the wrapper functions are : it works well.
But when I put them in a different file, it does no longer work !!!!
In the following example, In the case
1) where the function "calls()" is in FILE1.c : it works;
2) where the function "calls()" is in FILE2.c : it doesn t work .
EXPLE :
/******************************************************************
FILE1.c
******************************************************************/
int open( const char *path, int flags, ...)
{
va_list ap;
int creat_mode = 0;
int fd;
int status;
printf("----- IN OPEN -----------\n");
if( flags & O_CREAT )
{
va_start( ap, flags );
creat_mode = va_arg( ap, int );
}
fd = syscall( SYS_open, path, flags, creat_mode );
return(fd);
/*********************************/Quote:}
int
close( int fd )
{
printf("----- IN CLOSE -----------\n");
return syscall( SYS_close, fd );
/******************************************************************Quote:}
The Calls :
******************************************************************/
int
calls()
{
int fd1, fd2;
FILE *fp1, *fp2;
int z_res;
char buf[100];
fd1 = open("zfil1" , 0, 777);
printf("fd1 = %d nbr_open = %d \n" , fd1, nbr_open);
fd2 = open("zfil2" , 0, 777);
printf("fd2 = %d nbr_open = %d \n" , fd2, nbr_open);
strcpy(buf, "" );
z_res = read(fd1, buf, 99);
printf("XXXX buf = %s XXXX \n" , buf);
close(fd1);
printf("nbr_open = %d \n" , nbr_open);
close(fd2);
printf("nbr_open = %d \n" , nbr_open);
/******************************************************************Quote:}
FILE2.c
******************************************************************/
main()
{
calls();
Thank you very much.Quote:}
---------------------------------------------------------------------------
A. LABED
Addresse : E.H.E.I. , UFR Mathematique et Informatique
Universite Rene Descartes
45, Rue des Saints Peres
Paris.
---------------------------------------------------------------------------