当前位置: 首页>>代码示例>>C++>>正文


C++ D_PERROR函数代码示例

本文整理汇总了C++中D_PERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ D_PERROR函数的具体用法?C++ D_PERROR怎么用?C++ D_PERROR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了D_PERROR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: vt_set_fb

static void
vt_set_fb( int vt, int fb )
{
     struct fb_con2fbmap c2m;
     struct stat         sbf;

     D_DEBUG_AT( VT, "%s( %d, %d )\n", __FUNCTION__, vt, fb );

     if (fstat( dfb_fbdev->fd, &sbf )) {
          D_PERROR( "DirectFB/FBDev/vt: Could not fstat fb device!\n" );
          return;
     }

     if (fb >= 0)
          c2m.framebuffer = fb;
     else
          c2m.framebuffer = (sbf.st_rdev & 0xFF) >> 5;

     c2m.console = vt;

     if (ioctl( dfb_fbdev->fd, FBIOPUT_CON2FBMAP, &c2m ) < 0) {
          D_PERROR( "DirectFB/FBDev/vt: "
                     "FBIOPUT_CON2FBMAP failed!\n" );
     }
}
开发者ID:kizukukoto,项目名称:WDN900_GPL,代码行数:25,代码来源:vt.c

示例2: dfb_vt_detach

DFBResult
dfb_vt_detach( bool force )
{
     D_DEBUG_AT( VT, "%s()\n", __FUNCTION__ );

     if (dfb_config->vt_switch || force) {
          int            fd;
          struct vt_stat vt_state;

          fd = open( "/dev/tty", O_RDONLY | O_NOCTTY );
          if (fd < 0) {
               if (errno == ENXIO)
                    return DFB_OK;

               D_PERROR( "DirectFB/VT: Opening /dev/tty failed!\n" );
               return errno2result( errno );
          }

          if (ioctl( fd, VT_GETSTATE, &vt_state )) {
               close( fd );
               return DFB_OK;
          }

          if (ioctl( fd, TIOCNOTTY )) {
               D_PERROR( "DirectFB/VT: TIOCNOTTY on /dev/tty failed\n" );
               close( fd );
               return errno2result( errno );
          }

          close( fd );
     }

     return DFB_OK;
}
开发者ID:kizukukoto,项目名称:WDN900_GPL,代码行数:34,代码来源:vt.c

示例3: leave_pool

static void
leave_pool( FusionSHM           *shm,
            FusionSHMPool       *pool,
            FusionSHMPoolShared *shared )
{
     FusionWorld *world;

     D_DEBUG_AT( Fusion_SHMPool, "%s( %p, %p, %p )\n", __FUNCTION__, shm, pool, shared );

     D_MAGIC_ASSERT( shm, FusionSHM );
     D_MAGIC_ASSERT( pool, FusionSHMPool );
     D_MAGIC_ASSERT( shared, FusionSHMPoolShared );

     world = shm->world;

     D_MAGIC_ASSERT( world, FusionWorld );

     if (munmap( shared->addr_base, shared->max_size ))
          D_PERROR( "Fusion/SHM: Could not munmap shared memory file '%s'!\n", pool->filename );

     if (pool->fd != -1 && close( pool->fd ))
          D_PERROR( "Fusion/SHM: Could not close shared memory file '%s'!\n", pool->filename );

     pool->attached = false;

     D_FREE( pool->filename );

     D_MAGIC_CLEAR( pool );
}
开发者ID:ysei,项目名称:uclinux-2,代码行数:29,代码来源:pool.c

示例4: MapMemAndReg

static DFBResult
MapMemAndReg( DevMemData    *data,
              unsigned long  mem_phys,
              unsigned int   mem_length,
              unsigned long  reg_phys,
              unsigned int   reg_length )
{
     int fd;

     fd = open( DEV_MEM, O_RDWR | O_SYNC );
     if (fd < 0) {
          D_PERROR( "System/DevMem: Opening '%s' failed!\n", DEV_MEM );
          return DFB_INIT;
     }

     data->mem = mmap( NULL, mem_length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, mem_phys );
     if (data->mem == MAP_FAILED) {
          D_PERROR( "System/DevMem: Mapping %d bytes at 0x%08lx via '%s' failed!\n", mem_length, mem_phys, DEV_MEM );
          return DFB_INIT;
     }

     if (reg_phys && reg_length) {
          data->reg = mmap( NULL, reg_length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, reg_phys );
          if (data->reg == MAP_FAILED) {
               D_PERROR( "System/DevMem: Mapping %d bytes at 0x%08lx via '%s' failed!\n", reg_length, reg_phys, DEV_MEM );
               munmap( data->mem, mem_length );
               close( fd );
               return DFB_INIT;
          }
     }

     close( fd );

     return DFB_OK;
}
开发者ID:batman52,项目名称:dingux-code,代码行数:35,代码来源:devmem.c

示例5: driver_close_device

static void
driver_close_device( void *driver_data )
{
    KeyboardData *data = (KeyboardData*) driver_data;

    /* stop input thread */
    direct_thread_cancel( data->thread );
    direct_thread_join( data->thread );
    direct_thread_destroy( data->thread );

    if (tcsetattr( data->vt_fd, TCSAFLUSH, &data->old_ts ) < 0)
        D_PERROR("DirectFB/keyboard: tcsetattr for original values failed!\n");

    if (dfb_system_type() == CORE_FBDEV && dfb_config->vt) {
        if (ioctl( data->vt_fd, KDSKBMODE, K_XLATE ) < 0)
            D_PERROR("DirectFB/keyboard: Could not set mode to XLATE!\n");
        if (ioctl( data->vt_fd, KDSETMODE, KD_TEXT ) < 0)
            D_PERROR("DirectFB/keyboard: Could not set terminal mode to text!\n");
    }

    close( data->vt_fd );

    /* free private data */
    D_FREE( data );
}
开发者ID:twobob,项目名称:WebKitGtkKindleDXG,代码行数:25,代码来源:keyboard.c

示例6: fusion_ref_up

DirectResult
fusion_ref_up (FusionRef *ref, bool global)
{
     D_ASSERT( ref != NULL );

     D_DEBUG_AT( Fusion_Ref, "fusion_ref_up( %p [%d]%s )\n", ref, ref->multi.id, global ? " GLOBAL" : "" );

     while (ioctl (_fusion_fd( ref->multi.shared ), global ?
                   FUSION_REF_UP_GLOBAL : FUSION_REF_UP, &ref->multi.id))
     {
          switch (errno) {
               case EINTR:
                    continue;
               case EAGAIN:
                    return DR_LOCKED;
               case EINVAL:
                    D_ERROR ("Fusion/Reference: invalid reference\n");
                    return DR_DESTROYED;
               default:
                    break;
          }

          if (global)
               D_PERROR ("FUSION_REF_UP_GLOBAL");
          else
               D_PERROR ("FUSION_REF_UP");

          return DR_FAILURE;
     }

     D_DEBUG_AT( Fusion_Ref, "  -> %d references now\n",
                 ioctl( _fusion_fd( ref->multi.shared ), FUSION_REF_STAT, &ref->multi.id ) );

     return DR_OK;
}
开发者ID:canalplus,项目名称:r7oss,代码行数:35,代码来源:ref.c

示例7: init_udp

static DirectResult
init_udp( DirectLog  *log,
          const char *hostport )
{
     DirectResult     ret;
     int              fd;
     struct addrinfo *addr;
     
     ret = parse_host_addr( hostport, &addr );
     if (ret)
          return ret;

     fd = socket( addr->ai_family, SOCK_DGRAM, 0 );
     if (fd < 0) {
          ret = errno2result( errno );
          D_PERROR( "Direct/Log: Could not create a UDP socket!\n" );
          freeaddrinfo( addr );
          return ret;
     }

     ret = connect( fd, addr->ai_addr, addr->ai_addrlen );
     freeaddrinfo( addr );
     
     if (ret) {
          ret = errno2result( errno );
          D_PERROR( "Direct/Log: Could not connect UDP socket to '%s'!\n", hostport );
          close( fd );
          return ret;
     }

     log->fd = fd;

     return DR_OK;
}
开发者ID:canalplus,项目名称:r7oss,代码行数:34,代码来源:log.c

示例8: fusion_exit

void
fusion_exit( bool emergency )
{
     int               foo;
     FusionSendMessage msg;

     D_ASSERT( fusion_refs > 0 );

     /* decrement local reference counter */
     if (--fusion_refs)
          return;

     if (!emergency) {
          /* Wake up the read loop thread. */
          msg.fusion_id = _fusion_id;
          msg.msg_id    = 0;
          msg.msg_data  = &foo;
          msg.msg_size  = sizeof(foo);

          while (ioctl( _fusion_fd, FUSION_SEND_MESSAGE, &msg ) < 0) {
               if (errno != EINTR) {
                    D_PERROR ("FUSION_SEND_MESSAGE");
                    break;
               }
          }

          /* Wait for its termination. */
          direct_thread_join( read_loop );
     }

     direct_thread_destroy( read_loop );

     direct_signal_handler_remove( signal_handler );

     /* Master has to deinitialize shared data. */
     if (_fusion_id == 1) {
          fusion_skirmish_destroy( &_fusion_shared->reactor_globals );
          fusion_skirmish_destroy( &_fusion_shared->arenas_lock );
     }

     _fusion_shared = NULL;

     /* Deinitialize or leave shared memory. */
     __shmalloc_exit( _fusion_id == 1, true );

     /* Reset local dispatch nodes. */
     _fusion_reactor_free_all();

     _fusion_id = 0;

     if (close( _fusion_fd ))
          D_PERROR( "Fusion/Exit: closing the fusion device failed!\n" );
     _fusion_fd = -1;

     direct_shutdown();
}
开发者ID:Kvasshtain,项目名称:uos-embedded,代码行数:56,代码来源:fusion.c

示例9: osdSetRegion

static DFBResult
osdSetRegion( CoreLayer                  *layer,
              void                       *driver_data,
              void                       *layer_data,
              void                       *region_data,
              CoreLayerRegionConfig      *config,
              CoreLayerRegionConfigFlags  updated,
              CoreSurface                *surface,
              CorePalette                *palette,
              CoreSurfaceBufferLock      *lock )
{
     int                  ret;
     DavinciDriverData   *ddrv = driver_data;
     DavinciDeviceData   *ddev = ddrv->ddev;
     DavinciOSDLayerData *dosd = layer_data;

     D_DEBUG_AT( Davinci_OSD, "%s()\n", __FUNCTION__ );

     D_ASSERT( ddrv != NULL );
     D_ASSERT( ddev != NULL );
     D_ASSERT( dosd != NULL );

     ret = ioctl( ddrv->fb[OSD0].fd, FBIO_ENABLE_DISABLE_WIN, 0 );
     if (ret)
          D_PERROR( "Davinci/OSD: FBIO_ENABLE_DISABLE_WIN (fb%d - %d)!\n", OSD0, 0 );

     ret = ioctl( ddrv->fb[OSD1].fd, FBIO_ENABLE_DISABLE_WIN, 0 );
     if (ret)
          D_PERROR( "Davinci/OSD: FBIO_ENABLE_DISABLE_WIN (fb%d - %d)!\n", OSD1, 0 );

     ioctl( ddrv->fb[OSD0].fd, FBIO_WAITFORVSYNC );

     /* Update blend parameters? */
     if (updated & (CLRCF_OPTIONS | CLRCF_OPACITY | CLRCF_SRCKEY | CLRCF_FORMAT)) {
          vpbe_blink_option_t        blink = {0};
          vpbe_bitmap_blend_params_t blend = {0};

          D_DEBUG_AT( Davinci_OSD, "  -> %s\n", dfb_pixelformat_name( config->format ) );

          if (config->options & DLOP_SRC_COLORKEY) {
               blend.enable_colorkeying = 1;
               blend.colorkey           = dfb_color_to_pixel( DSPF_RGB16,
                                                              config->src_key.r,
                                                              config->src_key.g,
                                                              config->src_key.b );

               D_DEBUG_AT( Davinci_OSD, "  -> color key 0x%02x (%02x %02x %02x)\n",
                           blend.colorkey, config->src_key.r, config->src_key.g, config->src_key.b );
          }
          else if (config->options & DLOP_OPACITY) {
               blend.bf = config->opacity >> 5;

               D_DEBUG_AT( Davinci_OSD, "  -> opacity %d/7\n", blend.bf );
          }
开发者ID:maxupunk,项目名称:DIR685,代码行数:54,代码来源:davinci_osd.c

示例10: osdInitLayer

static DFBResult
osdInitLayer( CoreLayer                  *layer,
              void                       *driver_data,
              void                       *layer_data,
              DFBDisplayLayerDescription *description,
              DFBDisplayLayerConfig      *config,
              DFBColorAdjustment         *adjustment )
{
     int                  ret;
     DavinciDriverData   *ddrv = driver_data;
     DavinciOSDLayerData *dosd = layer_data;

     D_DEBUG_AT( Davinci_OSD, "%s()\n", __FUNCTION__ );

     ret = ioctl( ddrv->fb[OSD0].fd, FBIOGET_VSCREENINFO, &dosd->var0 );
     if (ret) {
          D_PERROR( "Davinci/OSD: FBIOGET_VSCREENINFO (fb%d) failed!\n", OSD0 );
          return DFB_INIT;
     }

     ret = ioctl( ddrv->fb[OSD1].fd, FBIOGET_VSCREENINFO, &dosd->var1 );
     if (ret) {
          D_PERROR( "Davinci/OSD: FBIOGET_VSCREENINFO (fb%d) failed!\n", OSD1 );
          return DFB_INIT;
     }

     ret = ioctl( ddrv->fb[OSD0].fd, FBIO_ENABLE_DISABLE_WIN, 0 );
     if (ret)
          D_OSDERROR( "Davinci/OSD: FBIO_ENABLE_DISABLE_WIN (fb%d - %d)!\n", OSD0, 0 );

     ret = ioctl( ddrv->fb[OSD1].fd, FBIO_ENABLE_DISABLE_WIN, 0 );
     if (ret)
          D_OSDERROR( "Davinci/OSD: FBIO_ENABLE_DISABLE_WIN (fb%d - %d)!\n", OSD1, 0 );

     /* set capabilities and type */
     description->caps = DLCAPS_SURFACE | DLCAPS_ALPHACHANNEL | DLCAPS_OPACITY | DLCAPS_SCREEN_POSITION |
                         DLCAPS_SRC_COLORKEY;
     description->type = DLTF_GRAPHICS;

     /* set name */
     snprintf( description->name, DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, "TI Davinci OSD" );

     /* fill out the default configuration */
     config->flags       = DLCONF_WIDTH       | DLCONF_HEIGHT |
                           DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE | DLCONF_OPTIONS;
     config->width       = 640;
     config->height      = 480;
     config->pixelformat = DSPF_RGB16;
     config->buffermode  = DLBM_FRONTONLY;
     config->options     = DLOP_ALPHACHANNEL;

     return DFB_OK;
}
开发者ID:Distrotech,项目名称:DirectFB,代码行数:53,代码来源:davinci_osd.c

示例11: vt_thread

static void *
vt_thread( DirectThread *thread, void *arg )
{
     D_DEBUG_AT( VT, "%s( %p, %p )\n", __FUNCTION__, thread, arg );

     pthread_mutex_lock( &dfb_vt->lock );

     while (true) {
          direct_thread_testcancel( thread );

          D_DEBUG_AT( VT, "...%s (signal %d)\n", __FUNCTION__, dfb_vt->vt_sig);

          switch (dfb_vt->vt_sig) {
               default:
                    D_BUG( "unexpected vt_sig" );
                    /* fall through */

               case -1:
                    pthread_cond_wait( &dfb_vt->wait, &dfb_vt->lock );
                    continue;

               case SIG_SWITCH_FROM:
                    if (dfb_core_suspend( dfb_fbdev->core ) == DFB_OK) {
                         if (ioctl( dfb_vt->fd, VT_RELDISP, VT_ACKACQ ) < 0)
                              D_PERROR( "DirectFB/fbdev/vt: VT_RELDISP failed\n" );
                    }

                    break;

               case SIG_SWITCH_TO:
                    if (dfb_core_resume( dfb_fbdev->core ) == DFB_OK) {
                         if (ioctl( dfb_vt->fd, VT_RELDISP, VT_ACKACQ ) < 0)
                              D_PERROR( "DirectFB/fbdev/vt: VT_RELDISP failed\n" );

                         if (dfb_config->kd_graphics) {
                              if (ioctl( dfb_vt->fd, KDSETMODE, KD_GRAPHICS ) < 0)
                                   D_PERROR( "DirectFB/fbdev/vt: KD_GRAPHICS failed!\n" );
                         }
                    }

                    break;
          }

          dfb_vt->vt_sig = -1;

          pthread_cond_signal( &dfb_vt->wait );
     }

     return NULL;
}
开发者ID:kizukukoto,项目名称:WDN900_GPL,代码行数:50,代码来源:vt.c

示例12: voodoo_play_get_broadcast

DirectResult
voodoo_play_get_broadcast( VoodooPlayAddress **ret_addr,
                           size_t             *ret_num )
{
    DirectResult       ret = DR_OK;
    VoodooPlayAddress *addr;

    // Get local host name
    char szHostName[128] = "";

    if (gethostname(szHostName, sizeof(szHostName))) {
        ret = errno2result( errno );
        D_PERROR( "Voodoo/Win32: gethostname() failed!\n" );
        return ret;
    }

    // Get local IP addresses
    struct hostent *pHost = 0;

    pHost = gethostbyname(szHostName);
    if (!pHost) {
        ret = errno2result( errno );
        D_PERROR( "Voodoo/Win32: gethostbyname('%s') failed!\n", szHostName );
        return ret;
    }


    size_t iCnt, iTotal = 0;

    for (iCnt = 0; pHost->h_addr_list[iCnt]; ++iCnt)
        iTotal++;


    addr = D_CALLOC( iTotal, sizeof(VoodooPlayAddress) );
    if (!addr)
        return D_OOM();

    for (iCnt = 0; pHost->h_addr_list[iCnt]; ++iCnt) {
        struct sockaddr_in SocketAddress;

        memcpy(&SocketAddress.sin_addr, pHost->h_addr_list[iCnt], pHost->h_length);

        voodoo_play_from_inet_addr( &addr[iCnt], SocketAddress.sin_addr.s_addr );
    }

    *ret_addr = addr;
    *ret_num  = iTotal;

    return DR_OK;
}
开发者ID:lihp1603,项目名称:DirectFB,代码行数:50,代码来源:interfaces_unix.c

示例13: write_ppm

void
write_ppm( const char    *filename,
           unsigned long  phys,
           int            pitch,
           unsigned int   width,
           unsigned int   height )
{
     int   i;
     int   fd;
     int   size;
     void *mem;
     FILE *file;

     size = direct_page_align( pitch * height );

     fd = open( "/dev/mem", O_RDWR );
     if (fd < 0) {
          D_PERROR( "SH7722/JPEG: Could not open /dev/mem!\n" );
          return;
     }

     mem = mmap( NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, phys );
     if (mem == MAP_FAILED) {
          D_PERROR( "SH7722/JPEG: Could not map /dev/mem at 0x%08lx (length %d)!\n", phys, size );
          close( fd );
          return;
     }

     close( fd );

     file = fopen( filename, "wb" );
     if (!file) {
          D_PERROR( "SH7722/JPEG: Could not open '%s' for writing!\n", filename );
          munmap( mem, size );
          return;
     }

     fprintf( file, "P6\n%d %d\n255\n", width, height );

     for (i=0; i<height; i++) {
          fwrite( mem, 3, width, file );

          mem += pitch;
     }

     fclose( file );

     munmap( mem, size );
}
开发者ID:batman52,项目名称:dingux-code,代码行数:49,代码来源:sh7722_jpegtool.c

示例14: fusion_ref_set_name

DirectResult
fusion_ref_set_name (FusionRef  *ref,
                     const char *name)
{
     FusionEntryInfo info;

     D_ASSERT( ref != NULL );
     D_ASSERT( name != NULL );

     info.type = FT_REF;
     info.id   = ref->multi.id;

     direct_snputs( info.name, name, sizeof(info.name) );

     while (ioctl (_fusion_fd( ref->multi.shared ), FUSION_ENTRY_SET_INFO, &info)) {
          switch (errno) {
               case EINTR:
                    continue;
               case EAGAIN:
                    return DR_LOCKED;
               case EINVAL:
                    D_ERROR ("Fusion/Reference: invalid reference\n");
                    return DR_DESTROYED;
               default:
                    break;
          }

          D_PERROR ("FUSION_ENTRY_SET_NAME");

          return DR_FAILURE;
     }

     return DR_OK;
}
开发者ID:lelou6666,项目名称:DirectFB-1.6.3-ab,代码行数:34,代码来源:ref.c

示例15: fusion_ref_destroy

DirectResult
fusion_ref_destroy (FusionRef *ref)
{
     D_ASSERT( ref != NULL );

     D_DEBUG_AT( Fusion_Ref, "fusion_ref_destroy( %p [%d] )\n", ref, ref->multi.id );

     fusion_world_flush_calls( _fusion_world( ref->multi.shared ), 1 );

     while (ioctl (_fusion_fd( ref->multi.shared ), FUSION_REF_DESTROY, &ref->multi.id)) {
          switch (errno) {
               case EINTR:
                    continue;
               case EINVAL:
                    D_ERROR ("Fusion/Reference: invalid reference\n");
                    return DR_DESTROYED;
               default:
                    break;
          }

          D_PERROR ("FUSION_REF_DESTROY");

          return DR_FAILURE;
     }

     return DR_OK;
}
开发者ID:lelou6666,项目名称:DirectFB-1.6.3-ab,代码行数:27,代码来源:ref.c


注:本文中的D_PERROR函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。