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


C++ D_WARN函数代码示例

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


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

示例1: handle_hotplug_event

int handle_hotplug_event()
{
	printf("\n\033[34m<<<<handle_hotplug_event, hotplug_fd:%d\033[0m\n", hotplug_fd);
	int ret = 0;
	char buf[PIPE_BUF];
	int nread;

	nread = read(hotplug_fd, buf, PIPE_BUF);

	if (nread == -1)
	{
		D_ERROR("handle_hotplug_event: Error reading from FIFO.\n");
		return -1;
	}
	else if (nread == 0)
	{
		D_WARN("handle_hotplug_event: No more writers?\n");
		return -1;
	}
	
	/* parse the message */
	if (strncmp(buf, MSG_HEADER, strlen(MSG_HEADER)))					/* check the header */
	{
		D_ERROR("handle_hotplug_event: Invalid message header %s\n", buf);
		ret = -1;
	}
	else if (strncmp(buf + strlen(MSG_HEADER), MSG_ADDED, strlen(MSG_ADDED)) == 0)			/* device was added & mounted */
	{
		D_INFO("handle_hotplug_event: USB storage added\n");
		if(read_dev_properties(EXT_STOR, &prop_e_stor) == 0)
			s_status |= ESTORAGE_ADDED;
		else
			D_WARN("Could not read properties of %s. Storage is disabled.", EXT_STOR);
	}
	else if (strncmp(buf + strlen(MSG_HEADER), MSG_REMOVED, strlen(MSG_REMOVED)) == 0)		/* device was removed */
	{
		D_INFO("handle_hotplug_event: USB storage removed\n");
		s_status &= ~ESTORAGE_ADDED;
	}
	else
	{
		D_ERROR("handle_hotplug_event: Invalid message: %s", buf);
		ret = -1;
	}
	printf("\n\033[34m<<<<[TR]handle_hotplug_event, hotplug_fd:%d\033[0m\n", hotplug_fd);
	printf("\n\033[34m<<<<[TR]handle_hotplug_event, hotplug_fd:%d\033[0m\n", hotplug_fd);
	return ret;
}
开发者ID:dangvanuy,项目名称:CLibrary,代码行数:48,代码来源:hotplug_handler.c

示例2: open_fifo

static int open_fifo()
{
	printf("\n\033[34m<<<<open_fifo\033[0m\n");
	if (mkfifo(FIFO_NAME, S_IRUSR | S_IWUSR) == -1)
	{
		if (errno == EEXIST)
		{
			D_WARN("open_fifo: FIFO already exists.\n");
		}
		else
		{
			D_ERROR("open_fifo: Could not create FIFO.\n");
			return -1;
		}
	}

	hotplug_fd = open(FIFO_NAME, O_RDWR);

	if (hotplug_fd == -1)
	{
		unlink(FIFO_NAME);
		D_ERROR("open_fifo: Could not open fifo.\n");
		return -1;
	}

	return 0;
}
开发者ID:dangvanuy,项目名称:CLibrary,代码行数:27,代码来源:hotplug_handler.c

示例3: dfb_state_set_source_mask

DFBResult
dfb_state_set_source_mask( CardState *state, CoreSurface *source_mask )
{
     D_MAGIC_ASSERT( state, CardState );

     dfb_state_lock( state );

     if (state->source_mask != source_mask) {
          if (source_mask && dfb_surface_ref( source_mask )) {
               D_WARN( "could not ref() source mask" );
               dfb_state_unlock( state );
               return DFB_DEAD;
          }

          if (state->source_mask) {
               D_ASSERT( D_FLAGS_IS_SET( state->flags, CSF_SOURCE_MASK ) );
               dfb_surface_unref( state->source_mask );
          }

          state->source_mask  = source_mask;
          state->modified    |= SMF_SOURCE_MASK;

          if (source_mask) {
               direct_serial_copy( &state->src_mask_serial, &source_mask->serial );

               D_FLAGS_SET( state->flags, CSF_SOURCE_MASK );
          }
          else
               D_FLAGS_CLEAR( state->flags, CSF_SOURCE_MASK );
     }

     dfb_state_unlock( state );

     return DFB_OK;
}
开发者ID:geekmaster,项目名称:buildroot-kindle,代码行数:35,代码来源:state.c

示例4: direct_signal_handler_add

DirectResult
direct_signal_handler_add( int                       num,
                           DirectSignalHandlerFunc   func,
                           void                     *ctx,
                           DirectSignalHandler     **ret_handler )
{
     DirectSignalHandler *handler;

     D_ASSERT( func != NULL );
     D_ASSERT( ret_handler != NULL );

     D_DEBUG_AT( Direct_Signals,
                 "Adding handler %p for signal %d with context %p...\n", func, num, ctx );

     handler = D_CALLOC( 1, sizeof(DirectSignalHandler) );
     if (!handler) {
          D_WARN( "out of memory" );
          return DR_NOLOCALMEMORY;
     }

     handler->num  = num;
     handler->func = func;
     handler->ctx  = ctx;

     D_MAGIC_SET( handler, DirectSignalHandler );

     direct_mutex_lock( &handlers_lock );
     direct_list_append( &handlers, &handler->link );
     direct_mutex_unlock( &handlers_lock );

     *ret_handler = handler;

     return DR_OK;
}
开发者ID:kuii,项目名称:dfbNEON,代码行数:34,代码来源:signals.c

示例5: direct_thread_add_init_handler

DirectThreadInitHandler *
direct_thread_add_init_handler( DirectThreadInitFunc  func,
                                void                 *arg )
{
     DirectThreadInitHandler *handler;

     handler = D_CALLOC( 1, sizeof(DirectThreadInitHandler) );
     if (!handler) {
          D_WARN( "out of memory" );
          return NULL;
     }

     handler->func = func;
     handler->arg  = arg;

     D_MAGIC_SET( handler, DirectThreadInitHandler );

     pthread_mutex_lock( &handler_lock );

     direct_list_append( &handlers, &handler->link );

     pthread_mutex_unlock( &handler_lock );

     return handler;
}
开发者ID:kizukukoto,项目名称:WDN900_GPL,代码行数:25,代码来源:thread.c

示例6: dfb_state_set_source2

DFBResult
dfb_state_set_source2( CardState *state, CoreSurface *source2 )
{
     D_MAGIC_ASSERT( state, CardState );

     dfb_state_lock( state );

     if (state->source2 != source2) {
          if (source2 && dfb_surface_ref( source2 )) {
               D_WARN( "could not ref() source2" );
               dfb_state_unlock( state );
               return DFB_DEAD;
          }

          if (state->source2) {
               D_ASSERT( D_FLAGS_IS_SET( state->flags, CSF_SOURCE2 ) );
               dfb_surface_unref( state->source2 );
          }

          state->source2   = source2;
          state->modified |= SMF_SOURCE2;

          if (source2) {
               direct_serial_copy( &state->src2_serial, &source2->serial );

               D_FLAGS_SET( state->flags, CSF_SOURCE2 );
          }
          else
               D_FLAGS_CLEAR( state->flags, CSF_SOURCE2 );
     }

     dfb_state_unlock( state );

     return DFB_OK;
}
开发者ID:geekmaster,项目名称:buildroot-kindle,代码行数:35,代码来源:state.c

示例7: fusion_call_execute

DirectResult
fusion_call_execute (FusionCall          *call,
                     FusionCallExecFlags  flags,
                     int                  call_arg,
                     void                *call_ptr,
                     int                 *ret_val)
{
     D_DEBUG_AT( Fusion_Call, "%s( %p, 0x%x, %d, %p )\n", __FUNCTION__, call, flags, call_arg, call_ptr );

     D_ASSERT( call != NULL );

     if (!call->handler)
          return DR_DESTROYED;

     D_DEBUG_AT( Fusion_Call, "  -> %s\n", direct_trace_lookup_symbol_at( call->handler ) );

     if (!(flags & FCEF_NODIRECT) && call->fusion_id == _fusion_id( call->shared )) {
          int                     ret;
          FusionCallHandlerResult result;

          result = call->handler( _fusion_id( call->shared ), call_arg, call_ptr, call->ctx, 0, &ret );

          if (result != FCHR_RETURN)
               D_WARN( "local call handler returned FCHR_RETAIN, need FCEF_NODIRECT" );

          if (ret_val)
               *ret_val = ret;
     }
     else {
          FusionCallExecute execute;

          execute.call_id  = call->call_id;
          execute.call_arg = call_arg;
          execute.call_ptr = call_ptr;
          execute.flags    = flags;

          while (ioctl( _fusion_fd( call->shared ), FUSION_CALL_EXECUTE, &execute )) {
               switch (errno) {
                    case EINTR:
                         continue;
                    case EINVAL:
//                         D_ERROR ("Fusion/Call: invalid call\n");
                         return DR_INVARG;
                    case EIDRM:
                         return DR_DESTROYED;
                    default:
                         break;
               }

               D_PERROR ("FUSION_CALL_EXECUTE");

               return DR_FAILURE;
          }

          if (ret_val)
               *ret_val = execute.ret_val;
     }

     return DR_OK;
}
开发者ID:ysei,项目名称:uclinux-2,代码行数:60,代码来源:call.c

示例8: direct_hash_remove

DirectResult
direct_hash_remove( DirectHash    *hash,
                    unsigned long  key )
{
     int pos;

     D_MAGIC_ASSERT( hash, DirectHash );

     if (!hash->Elements)
          return DR_BUFFEREMPTY;

     pos = locate_key( hash, key );
     if (pos == -1) {
          D_WARN( "key not found" );
          return DR_ITEMNOTFOUND;
     }

     hash->Elements[pos].value = DIRECT_HASH_ELEMENT_REMOVED;

     hash->count--;
     hash->removed++;

     D_DEBUG_AT( Direct_Hash, "Removed key 0x%08lx at %d, new count = %d, removed = %d, size = %d.\n",
                 key, pos, hash->count, hash->removed, hash->size );

//     direct_futex_wake( &hash->count, INT_MAX );  // FIXME: only wake if waiting

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

示例9: pool_iv_ent_refresh

static int
pool_iv_ent_refresh(d_sg_list_t *dst, d_sg_list_t *src, int ref_rc, void **priv)
{
	struct pool_iv_entry	*dst_iv = dst->sg_iovs[0].iov_buf;
	struct pool_iv_entry	*src_iv = src->sg_iovs[0].iov_buf;
	struct ds_pool		*pool;
	int			rc;

	D_ASSERT(src_iv != NULL);
	D_ASSERT(dst_iv != NULL);
	rc = pool_iv_ent_copy(dst, src);
	if (rc)
		return rc;

	/* Update pool map version or pool map */
	pool = ds_pool_lookup(src_iv->piv_pool_uuid);
	if (pool == NULL) {
		D_WARN("No pool "DF_UUID"\n", DP_UUID(src_iv->piv_pool_uuid));
		return 0;
	}

	rc = ds_pool_tgt_map_update(pool, src_iv->piv_pool_buf.pb_nr > 0 ?
				    &src_iv->piv_pool_buf : NULL,
				    src_iv->piv_pool_map_ver);
	ds_pool_put(pool);

	return rc;
}
开发者ID:daos-stack,项目名称:daos,代码行数:28,代码来源:srv_iv.c

示例10: direct_map_remove

DirectResult
direct_map_remove( DirectMap  *map,
                   const void *key )
{
     unsigned int hash;
     int          pos;

     D_DEBUG_AT( Direct_Map, "%s( key %p )\n", __func__, key );

     DIRECT_MAP_ASSERT( map );
     D_ASSERT( key != NULL );

     hash = map->hash( map, key, map->ctx );

     pos = locate_entry( map, hash, key );
     if (pos == -1) {
          D_WARN( "object to remove not found" );
          return DR_ITEMNOTFOUND;
     }

     map->entries[pos].object = REMOVED;

     map->count--;
     map->removed++;

     D_DEBUG_AT( Direct_Map, "  -> new count = %d, removed = %d, size = %d\n", map->count, map->removed, map->size );

     return DR_OK;
}
开发者ID:kuii,项目名称:dfbNEON,代码行数:29,代码来源:map.c

示例11: dfb_surfacemanager_deallocate

DFBResult dfb_surfacemanager_deallocate( SurfaceManager *manager,
                                         SurfaceBuffer  *buffer )
{
     int    loops = 0;
     Chunk *chunk = buffer->video.chunk;

     D_ASSERT( buffer->surface );

     D_MAGIC_ASSERT( manager, SurfaceManager );

     if (buffer->video.health == CSH_INVALID)
          return DFB_OK;

     buffer->video.health = CSH_INVALID;
     buffer->video.chunk = NULL;

     dfb_surface_notify_listeners( buffer->surface, CSNF_VIDEO );

     while (buffer->video.locked) {
          if (++loops > 1000)
               break;

          sched_yield();
     }

     if (buffer->video.locked)
          D_WARN( "Freeing chunk with a non-zero lock counter" );

     if (chunk)
          free_chunk( manager, chunk );

     return DFB_OK;
}
开发者ID:Kvasshtain,项目名称:uos-embedded,代码行数:33,代码来源:surfacemanager.c

示例12: Genefx_ABacc_prepare

bool
Genefx_ABacc_prepare( GenefxState *gfxs, int width )
{
     int size;

     if (!gfxs->need_accumulator)
          return true;

     size = (width + 31) & ~31;

     if (gfxs->ABsize < size) {
          void *ABstart = D_MALLOC( size * sizeof(GenefxAccumulator) * 3 + 31 );

          if (!ABstart) {
               D_WARN( "out of memory" );
               return false;
          }

          if (gfxs->ABstart)
               D_FREE( gfxs->ABstart );

          gfxs->ABstart = ABstart;
          gfxs->ABsize  = size;
          gfxs->Aacc    = (GenefxAccumulator*) (((unsigned long)ABstart+31) & ~31);
          gfxs->Bacc    = gfxs->Aacc + size;
          gfxs->Tacc    = gfxs->Aacc + size + size;
     }

     gfxs->Sacc = gfxs->Dacc = gfxs->Aacc;

     return true;
}
开发者ID:geekmaster,项目名称:buildroot-kindle,代码行数:32,代码来源:generic_util.c

示例13: tdfx_waitfifo

static inline void tdfx_waitfifo( TDFXDriverData *tdrv,
                                  TDFXDeviceData *tdev,
                                  unsigned int space )
{
    int timeout = 1000000;

    tdev->waitfifo_calls++;
    tdev->waitfifo_sum += space;

    if (tdev->fifo_space < space) {
        while (timeout--) {
            tdev->fifo_waitcycles++;

            tdev->fifo_space = (tdrv->voodoo2D->status & 0x3f);
            if (tdev->fifo_space >= space)
                break;

        }
    } else {
        tdev->fifo_cache_hits++;
    }

    tdev->fifo_space -= space;

    if (!timeout)
        D_WARN( "timeout during waitfifo!" );
}
开发者ID:uiv,项目名称:Lerdu,代码行数:27,代码来源:tdfx.c

示例14: fusion_shm_deinit

DirectResult
fusion_shm_deinit( FusionWorld *world )
{
     int              i;
     DirectResult     ret;
     FusionSHM       *shm;
     FusionSHMShared *shared;

     D_MAGIC_ASSERT( world, FusionWorld );

     shm = &world->shm;

     D_MAGIC_ASSERT( shm, FusionSHM );

     shared = shm->shared;

     D_MAGIC_ASSERT( shared, FusionSHMShared );

     ret = fusion_skirmish_prevail( &shared->lock );
     if (ret)
          return ret;

     /* Deinitialize shared data. */
     if (fusion_master( world )) {
          D_ASSUME( shared->num_pools == 0 );

          for (i=0; i<FUSION_SHM_MAX_POOLS; i++) {
               if (shared->pools[i].active) {
                    D_MAGIC_ASSERT( &shared->pools[i], FusionSHMPoolShared );
                    D_MAGIC_ASSERT( &shm->pools[i], FusionSHMPool );

                    D_WARN( "destroying remaining '%s'", shared->pools[i].name );

                    fusion_shm_pool_destroy( world, &shared->pools[i] );
               }
          }

          /* Destroy shared lock. */
          fusion_skirmish_destroy( &shared->lock );

          D_MAGIC_CLEAR( shared );
     }
     else {
          for (i=0; i<FUSION_SHM_MAX_POOLS; i++) {
               if (shared->pools[i].active) {
                    D_MAGIC_ASSERT( &shared->pools[i], FusionSHMPoolShared );
                    D_MAGIC_ASSERT( &shm->pools[i], FusionSHMPool );

                    fusion_shm_pool_detach( shm, &shared->pools[i] );
               }
          }

          fusion_skirmish_dismiss( &shared->lock );
     }

     D_MAGIC_CLEAR( shm );

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

示例15: dfb_core_deinit_check

static void
dfb_core_deinit_check( void *ctx )
{
     if (core_dfb && core_dfb->refs) {
          D_WARN( "Application exited without deinitialization of DirectFB!" );
          dfb_core_destroy( core_dfb, true );
     }
}
开发者ID:spartan263,项目名称:vizio_oss,代码行数:8,代码来源:core.c


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