本文转自
1、通过源码分析出错原因在:
void wsCreateImage( wsTWindow * win,int Width,int Height )
{
int CompletionType = -1;
if ( wsUseXShm )
{
CompletionType=XShmGetEventBase( wsDisplay ) + ShmCompletion;
win->xImage=XShmCreateImage( wsDisplay,win->VisualInfo.visual,
win->VisualInfo.depth,ZPixmap,NULL,&win->Shminfo,Width,Height );
if ( win->xImage == NULL )
{
mp_msg( MSGT_GPLAYER,MSGL_FATAL,"[ws] shared memory extension error1.\n" );
exit( 0 );
}
//函数shmget引起的错误
win->Shminfo.shmid=shmget( IPC_PRIVATE,win->xImage->bytes_per_line * win->xImage->height,IPC_CREAT|0777 );
if ( win->Shminfo.shmid < 0 )
{
XDestroyImage( win->xImage );
mp_msg( MSGT_GPLAYER,MSGL_FATAL,"[ws] shared memory extension error2.\n" );
exit( 0 );
}
win->Shminfo.shmaddr=(char *)shmat( win->Shminfo.shmid,0,0 );
if ( win->Shminfo.shmaddr == ((char *) -1) )
{
XDestroyImage( win->xImage );
if ( win->Shminfo.shmaddr != ((char *) -1) ) shmdt( win->Shminfo.shmaddr );
mp_msg( MSGT_GPLAYER,MSGL_FATAL,"[ws] shared memory extension error3.\n" );
exit( 0 );
}
2、查找函数shmget发现其使用了System V IPC。原来我在编译内核
的时候把System V IPC去掉。重新编译内核加进System V IPC后,
一切正常。
在此提醒各位编译内核时要小心啊!!!!!
阅读(917) | 评论(0) | 转发(0) |