Hello all,
I am struggling with this for days now. Who can explain me why fork() fails
once CreateAviReadFile is called?
Compile smalltest.cpp and littletest.c. Execute smalltest without parameters,
and you get this output:
eddkrpe@linux:~/hlavista-baby/hlavista > smalltest
<Init> : Avifile CVS-020529-09:45-2.95.3
<Init> : Available CPU flags: fpu vme de pse tsc msr pae mce cx8 sep mtrr pge
mca cmov pat pse36 mmx fxsr sse
<Init> : 596.93 MHz Pentium III (Coppermine) processor detected
<LDT_Keeper> : Installed fs segment: 0x40018000
smalltest.cpp - forking...
smalltest.cpp - executing external program...
littletest - uid=500 gid=100
littletest - argc=3, *argv[1]=1
littletest - argv[0]=littletest
littletest - success?: Success
smalltest.cpp - exiting...
Issue "ps f" in another window, and then execute smalltest and pass open as
parameter. You get:
eddkrpe@linux:~/hlavista-baby/hlavista > smalltest open
<Init> : Avifile CVS-020529-09:45-2.95.3
<Init> : Available CPU flags: fpu vme de pse tsc msr pae mce cx8 sep mtrr pge
mca cmov pat pse36 mmx fxsr sse
<Init> : 596.93 MHz Pentium III (Coppermine) processor detected
<LDT_Keeper> : Installed fs segment: 0x40018000
smalltest.cpp - opening AVI for reading
<AVI reader> : Checking: pepsi.avi
<AVI reader> : AVIMainHeader: MicroSecPerFrame=33366 MaxBytesPerSec=0
PaddingGranularity=0 Flags=[ HAS_INDEX TRUST_CKTYPE ] TotalFrames=864
InitialFrames=0 Streams=2 SuggestedBufferSize=0 WxH=160x120
Scale=33366 Rate=1000000 Start=0 Length=0
<AVI reader> : AVIStreamHeader: FccType=vids FccHandler=IV41 Flags=[ ]
InitialFrames=0 Scale=33366 Rate=1000000 Start=0 Length=864
SuggestedBufferSize=0 Quality=8500 SampleSize=0 Rect l,r,t,b=0,160,0,120
<AVI reader> : AVIStreamHeader: FccType=auds FccHandler=0x55 Flags=[ ]
InitialFrames=0 Scale=1 Rate=8000 Start=0 Length=234092
SuggestedBufferSize=0 Quality=0 SampleSize=1 Rect l,r,t,b=0,0,0,0
<AVI reader> : Reading index from 3156134
<AVI reader> : Stream 0 vids : 0x31345649 (IV41) 864 chunks (13.50KB)
<AVI reader> : Cache: Adding stream, 864 chunks
<AVI reader> : Stream 1 auds : 0x55 (MPEG Layer-3) 130 chunks (2.03KB)
<AVI reader> : Cache: Adding stream, 130 chunks
<AVI reader> : Cache: Creating cache for file descriptor: 4
<AVI reader> : Initialized video stream 0 (chunk tblsz: 864, fmtsz: 40)
<AVI reader> : Initialized audio stream 0 (chunk tblsz: 234092, fmtsz: 30)
<AVI reader> : Successfully opened pepsi.avi
smalltest.cpp - forking...
smalltest.cpp - executing external program...
and it blocks here. execl did not go through. Check what "ps f" says! Weird
huh!
Who knows what is happening and how to solve this?
Best regards,
Kresimir
Here is an example that causes problems.
-----------------smalltest.cpp--------------------
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <avifile.h>
int main( int argc, char **argv ) {
if( argc>1 && strcmp( argv[1], "open" ) == 0 ) {
printf ( "smalltest.cpp - opening AVI for reading\n" );
IAviReadFile *aviFile = CreateIAviReadFile( "pepsi.avi" );
}
printf ( "smalltest.cpp - forking...\n" );
int pid = fork();
if( pid == -1 ) {
perror( "smalltest.cpp - fork() failed") ;
return 0;
}
if( pid == 0 ) {
printf ( "smalltest.cpp - executing external program...\n" );
int shmID = 1;
char argv[80];
sprintf( argv, "%d", shmID );
int success = execl( "./littletest", "./littletest", argv, argv, NULL );
if( success == -1 ) {
perror( "smalltest.cpp - external program execution failed" );
}
printf ( "smalltest.cpp - premature exit of child program...\n" );
exit( 3 );
}
int status = -1;
wait( &status );
printf("smalltest.cpp - exiting...\n");
return 0;
}
----------------- littletest.c ----------------------------------
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <sys/shm.h>
#include <errno.h>
int main( int argc, char **argv ) {
if(argc < 2 ) {
printf("littletest - no arguments passed. Exiting!\n");
exit(-1);
}
printf("littletest - uid=%d gid=%d\n", geteuid(), getegid() );
printf("littletest - argc=%d, *argv[1]=%s\n", argc, argv[1] );
perror("littletest - success?");
}
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
_______________________________________________
Avifile mailing list
[EMAIL PROTECTED]
http://prak.org/mailman/listinfo/avifile