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


C++ STAT函数代码示例

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


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

示例1: send_message_failure

/*
 * Handle a gru_mesq failure. Some of these failures are software recoverable
 * or retryable.
 */
static int send_message_failure(void *cb, struct gru_message_queue_desc *mqd,
				void *mesg, int lines)
{
	int substatus, ret = 0;

	substatus = gru_get_cb_message_queue_substatus(cb);
	switch (substatus) {
	case CBSS_NO_ERROR:
		STAT(mesq_send_unexpected_error);
		ret = MQE_UNEXPECTED_CB_ERR;
		break;
	case CBSS_LB_OVERFLOWED:
		STAT(mesq_send_lb_overflow);
		ret = MQE_CONGESTION;
		break;
	case CBSS_QLIMIT_REACHED:
		STAT(mesq_send_qlimit_reached);
		ret = send_message_queue_full(cb, mqd, mesg, lines);
		break;
	case CBSS_AMO_NACKED:
		STAT(mesq_send_amo_nacked);
		ret = MQE_CONGESTION;
		break;
	case CBSS_PUT_NACKED:
		STAT(mesq_send_put_nacked);
		ret = send_message_put_nacked(cb, mqd, mesg, lines);
		break;
	case CBSS_PAGE_OVERFLOW:
		STAT(mesq_page_overflow);
		/* fallthru */
	default:
		BUG();
	}
	return ret;
}
开发者ID:119-org,项目名称:hi3518-osdrv,代码行数:39,代码来源:grukservices.c

示例2: STAT

/*
 * Lock & load the kernel context for the specified blade.
 */
static struct gru_blade_state *gru_lock_kernel_context(int blade_id)
{
	struct gru_blade_state *bs;

	STAT(lock_kernel_context);
	bs = gru_base[blade_id];

	down_read(&bs->bs_kgts_sema);
	if (!bs->bs_kgts || !bs->bs_kgts->ts_gru)
		gru_load_kernel_context(bs, blade_id);
	return bs;

}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:16,代码来源:grukservices.c

示例3: drive_file_query_information

BOOL drive_file_query_information(DRIVE_FILE* file, UINT32 FsInformationClass, wStream* output)
{
	struct STAT st;

	if (STAT(file->fullpath, &st) != 0)
	{
		Stream_Write_UINT32(output, 0); /* Length */
		return FALSE;
	}

	switch (FsInformationClass)
	{
		case FileBasicInformation:
			/* http://msdn.microsoft.com/en-us/library/cc232094.aspx */
			Stream_Write_UINT32(output, 36); /* Length */
			Stream_EnsureRemainingCapacity(output, 36);
			Stream_Write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* CreationTime */
			Stream_Write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_atime)); /* LastAccessTime */
			Stream_Write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* LastWriteTime */
			Stream_Write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* ChangeTime */
			Stream_Write_UINT32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */
			/* Reserved(4), MUST NOT be added! */
			break;

		case FileStandardInformation:
			/*  http://msdn.microsoft.com/en-us/library/cc232088.aspx */
			Stream_Write_UINT32(output, 22); /* Length */
			Stream_EnsureRemainingCapacity(output, 22);
			Stream_Write_UINT64(output, st.st_size); /* AllocationSize */
			Stream_Write_UINT64(output, st.st_size); /* EndOfFile */
			Stream_Write_UINT32(output, st.st_nlink); /* NumberOfLinks */
			Stream_Write_UINT8(output, file->delete_pending ? 1 : 0); /* DeletePending */
			Stream_Write_UINT8(output, file->is_dir ? 1 : 0); /* Directory */
			/* Reserved(2), MUST NOT be added! */
			break;

		case FileAttributeTagInformation:
			/* http://msdn.microsoft.com/en-us/library/cc232093.aspx */
			Stream_Write_UINT32(output, 8); /* Length */
			Stream_EnsureRemainingCapacity(output, 8);
			Stream_Write_UINT32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */
			Stream_Write_UINT32(output, 0); /* ReparseTag */
			break;

		default:
			Stream_Write_UINT32(output, 0); /* Length */
			DEBUG_WARN("invalid FsInformationClass %d", FsInformationClass);
			return FALSE;
	}
	return TRUE;
}
开发者ID:pevik,项目名称:debian-freerdp,代码行数:51,代码来源:drive_file.c

示例4: disk_file_query_information

boolean disk_file_query_information(DISK_FILE* file, uint32 FsInformationClass, STREAM* output)
{
    struct STAT st;

    if (STAT(file->fullpath, &st) != 0)
    {
        stream_write_uint32(output, 0); /* Length */
        return false;
    }
    switch (FsInformationClass)
    {
    case FileBasicInformation:
        /* http://msdn.microsoft.com/en-us/library/cc232094.aspx */
        stream_write_uint32(output, 36); /* Length */
        stream_check_size(output, 36);
        stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* CreationTime */
        stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_atime)); /* LastAccessTime */
        stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* LastWriteTime */
        stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* ChangeTime */
        stream_write_uint32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */
        /* Reserved(4), MUST NOT be added! */
        break;

    case FileStandardInformation:
        /*  http://msdn.microsoft.com/en-us/library/cc232088.aspx */
        stream_write_uint32(output, 22); /* Length */
        stream_check_size(output, 22);
        stream_write_uint64(output, st.st_size); /* AllocationSize */
        stream_write_uint64(output, st.st_size); /* EndOfFile */
        stream_write_uint32(output, st.st_nlink); /* NumberOfLinks */
        stream_write_uint8(output, file->delete_pending ? 1 : 0); /* DeletePending */
        stream_write_uint8(output, file->is_dir ? 1 : 0); /* Directory */
        /* Reserved(2), MUST NOT be added! */
        break;

    case FileAttributeTagInformation:
        /* http://msdn.microsoft.com/en-us/library/cc232093.aspx */
        stream_write_uint32(output, 8); /* Length */
        stream_check_size(output, 8);
        stream_write_uint32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */
        stream_write_uint32(output, 0); /* ReparseTag */
        break;

    default:
        stream_write_uint32(output, 0); /* Length */
        DEBUG_WARN("invalid FsInformationClass %d", FsInformationClass);
        return false;
    }
    return true;
}
开发者ID:kingiol,项目名称:FreeRDP,代码行数:50,代码来源:disk_file.c

示例5: pkt_send

/*
 * Our WinPcap send function.
 * Not sure if partial writes are possible with NPF. Retry if rc != length.
 */
int pkt_send (const void *tx, int length)
{
  const ADAPTER *adapter;
  PACKET pkt;
  int    tx_cnt, rc = 0;

  ASSERT_PKT_INF (0);

  adapter = (const ADAPTER*) _pkt_inf->adapter;

  PROFILE_START ("pkt_send");

  for (tx_cnt = 1 + pkt_txretries; tx_cnt > 0; tx_cnt--)
  {
    pkt.Buffer = (void*) tx;
    pkt.Length = length;
    if (PacketSendPacket (adapter, &pkt, TRUE))
    {
      rc = length;
      break;
    }
    STAT (macstats.num_tx_retry++);
  }

  if (rc == length)
  {
    num_tx_pkt++;
    num_tx_bytes += length;
  }
  else
  {
    num_tx_errors++;  /* local copy */
    STAT (macstats.num_tx_err++);
  }
  PROFILE_STOP();
  return (rc);
}
开发者ID:ya-mouse,项目名称:dos-utils,代码行数:41,代码来源:winpcap.c

示例6: gru_send_message_gpa

/*
 * Send a message to a message queue
 * 	mqd	message queue descriptor
 * 	mesg	message. ust be vaddr within a GSEG
 * 	bytes	message size (<= 2 CL)
 */
int gru_send_message_gpa(struct gru_message_queue_desc *mqd, void *mesg,
				unsigned int bytes)
{
	struct message_header *mhdr;
	void *cb;
	void *dsr;
	int istatus, clines, ret;

	STAT(mesq_send);
	BUG_ON(bytes < sizeof(int) || bytes > 2 * GRU_CACHE_LINE_BYTES);

	clines = DIV_ROUND_UP(bytes, GRU_CACHE_LINE_BYTES);
	if (gru_get_cpu_resources(bytes, &cb, &dsr))
		return MQE_BUG_NO_RESOURCES;
	memcpy(dsr, mesg, bytes);
	mhdr = dsr;
	mhdr->present = MQS_FULL;
	mhdr->lines = clines;
	if (clines == 2) {
		mhdr->present2 = get_present2(mhdr);
		restore_present2(mhdr, MQS_FULL);
	}

	do {
		ret = MQE_OK;
		gru_mesq(cb, mqd->mq_gpa, gru_get_tri(mhdr), clines, IMA);
		istatus = gru_wait(cb);
		if (istatus != CBS_IDLE)
			ret = send_message_failure(cb, mqd, dsr, clines);
	} while (ret == MQIE_AGAIN);
	gru_free_cpu_resources(cb, dsr);

	if (ret)
		STAT(mesq_send_failed);
	return ret;
}
开发者ID:rrowicki,项目名称:Chrono_Kernel-1,代码行数:42,代码来源:grukservices.c

示例7: ffsb_get_filesize

uint64_t ffsb_get_filesize(char *name)
{
#ifndef HAVE_STAT64
 #define STAT(a, b) do { stat((a), (b)); } while (0)
	struct stat filestat;
#else
 #define STAT(a, b) do { stat64((a), (b)); } while (0)
	struct stat64 filestat;
#endif


	STAT(name, &filestat);
	return (uint64_t)filestat.st_size;
#undef STAT
}
开发者ID:YANGYongqiang,项目名称:fsbenchmarking,代码行数:15,代码来源:util.c

示例8: if

STAT Setup::getHighestAbility(std::vector<STAT> stats) {
	unsigned int max_value = 0;
	for (unsigned int i = 0; i < NUM_STAT; i++) {
		for (unsigned int j = 0; j < stats.size(); j++) {
			if (stats[j] == STAT(i)) max_value = std::max(max_value, this->getMax(stats[j]));
		}
	}
	if (max_value == getMax(STR)) return STR;
	else if (max_value == getMax(STA)) return STA;
	else if (max_value == getMax(AGI)) return AGI;
	else if (max_value == getMax(SEN)) return SEN;
	else if (max_value == getMax(INT)) return INT;
	else if (max_value == getMax(PSY)) return PSY;
	else return NUM_STAT;
}
开发者ID:lapinott,项目名称:aoith,代码行数:15,代码来源:Setup.struct.cpp

示例9: gru_copy_gpa

/*
 * Copy a block of data using the GRU resources
 */
int gru_copy_gpa(unsigned long dest_gpa, unsigned long src_gpa,
				unsigned int bytes)
{
	void *cb;
	void *dsr;
	int ret;

	STAT(copy_gpa);
	if (gru_get_cpu_resources(GRU_NUM_KERNEL_DSR_BYTES, &cb, &dsr))
		return MQE_BUG_NO_RESOURCES;
	gru_bcopy(cb, src_gpa, dest_gpa, gru_get_tri(dsr),
		  XTYPE_B, bytes, GRU_NUM_KERNEL_DSR_CL, IMA);
	ret = gru_wait(cb);
	gru_free_cpu_resources(cb, dsr);
	return ret;
}
开发者ID:rrowicki,项目名称:Chrono_Kernel-1,代码行数:19,代码来源:grukservices.c

示例10: KplFileGetFileInfo

FskErr KplFileGetFileInfo(const char *fullPath, KplFileInfo *itemInfo) {
	int err;
	STATTYPE statbuf;

	err = sCheckFullPath(fullPath, kKplPathIsAny);
	if (err) return err;

	err = STAT(fullPath, &statbuf);
	if (err == -1) return errnoToFskErr(errno);

	GetFileInfoFromStat(&statbuf, itemInfo);

	itemInfo->flags = 0;

	return kFskErrNone;
}
开发者ID:VzqzAc,项目名称:kinomajs,代码行数:16,代码来源:KplFilesLinux.c

示例11: coefficient_lcm

void coefficient_lcm(const lp_polynomial_context_t* ctx, coefficient_t* lcm, const coefficient_t* C1, const coefficient_t* C2) {
  TRACE("coefficient", "coefficient_lcm()\n");
  STAT(coefficient, lcm) ++;

  if (trace_is_enabled("coefficient")) {
    tracef("C1 = "); coefficient_print(ctx, C1, trace_out); tracef("\n");
    tracef("C2 = "); coefficient_print(ctx, C2, trace_out); tracef("\n");
  }

  assert(ctx->K == lp_Z);

  if (C1->type == COEFFICIENT_NUMERIC && C2->type == COEFFICIENT_NUMERIC) {
    // Integer LCM
    if (lcm->type == COEFFICIENT_POLYNOMIAL) {
      coefficient_destruct(lcm);
      coefficient_construct(ctx, lcm);
    }
    integer_lcm_Z(&lcm->value.num, &C1->value.num, &C2->value.num);
  } else {
    // LCM(C1, C2) = C1*C2/GCD(C1, C2)
    coefficient_t gcd;
    coefficient_construct(ctx, &gcd);
    coefficient_gcd(ctx, &gcd, C1, C2);
    if (coefficient_is_one(ctx, &gcd)) {
      coefficient_mul(ctx, lcm, C1, C2);
    } else {
      if (coefficient_cmp_type(ctx, C1, C2) <= 0) {
        coefficient_div(ctx, lcm, C1, &gcd);
        coefficient_mul(ctx, lcm, lcm, C2);
      } else {
        coefficient_div(ctx, lcm, C2, &gcd);
        coefficient_mul(ctx, lcm, lcm, C1);
      }
    }
    if (coefficient_lc_sgn(ctx, lcm) < 0) {
      coefficient_neg(ctx, lcm, lcm);
    }
    coefficient_destruct(&gcd);
  }

  if (trace_is_enabled("coefficient")) {
    tracef("coefficient_lcm() => "); coefficient_print(ctx, lcm, trace_out); tracef("\n");
  }

  assert(coefficient_is_normalized(ctx, lcm));
}
开发者ID:SRI-CSL,项目名称:libpoly,代码行数:46,代码来源:gcd.c

示例12: openloghost

static void openloghost (void)
{
  struct servent *sp;
  struct hostent *hp;

  if (logSock)
  {
    sock_close (logSock);
    logSock = NULL;
  }

  sp = getservbyname ("syslog", "udp");
  if (sp)
     syslog_port = htons (sp->s_port);

  logHost = _inet_addr (syslog_hostName);
  if (!logHost)
  {
    hp = gethostbyname (syslog_hostName);
    if (!hp)
    {
      fprintf (stderr, "syslog: Unknown host `%s'\n", syslog_hostName);
      return;
    }
    logHost = ntohl (*(DWORD*)hp->h_addr);
  }

  if (!logSock)
  {
    logSock = malloc (sizeof(udp_Socket));
    if (!logSock)
    {
      perror ("syslog");
      return;
    }
  }

  if (!udp_open ((udp_Socket*)logSock, 0, logHost, syslog_port, NULL))
  {
    errno = errno_s = EHOSTUNREACH;  /* "No route to host" (ARP failed) */
    STAT (ipstats.ips_noroute++);
    perror ("syslog");
    sock_close (logSock);
    logSock = NULL;
  }
}
开发者ID:Azarien,项目名称:open-watcom-v2,代码行数:46,代码来源:syslog.c

示例13: getb

static uint8_t getb(uint8_t *p)
{
	uint16_t addr = (uint16_t)p;
	uint8_t ah = addr >> 8;
	uint8_t c;

	if (ah == last_ah) {
		STAT(fast);
		return last_base[addr&0xff];
	}

	/* Find the right buffer */
	c = page_find(ah);
	last_ah = ah;
	last_base = page_cache[c];
	return last_base[addr & 0xff];
}
开发者ID:EtchedPixels,项目名称:L9X,代码行数:17,代码来源:l9x.c

示例14: MSTAT

// <mStat>       ->      empty | <stat>  <mStat>
APTNode* MSTAT(void)
{
	if ((strcmp(currentTok.sym, "SCANFtk") == 0) || (strcmp(currentTok.sym, "PRINTFtk") == 0) ||
		(strcmp(currentTok.sym, "IFtk") == 0) || (strcmp(currentTok.sym, "LOOPtk") == 0) ||
		(strcmp(currentTok.sym, "BEGINtk") == 0) || (strcmp(currentTok.sym, "IDtk") == 0))
	{
		//printf("MSTAT node with sym = %s and text = %s \n", currentTok.sym, currentTok.selection);
		APTNode* parentMstatNode = createNonIdAPTNode("<MSTAT>");
		APTNode* statNode = STAT();
		APTNode* childMstatNode = MSTAT();

		addChildNode(parentMstatNode, statNode);
		addChildNode(parentMstatNode, childMstatNode);

		return parentMstatNode;
	} else return NULL;
}
开发者ID:doniexun,项目名称:Compiler-32,代码行数:18,代码来源:parser.c

示例15: gru_read_gpa

/*
 * Load a DW from a global GPA. The GPA can be a memory or MMR address.
 */
int gru_read_gpa(unsigned long *value, unsigned long gpa)
{
	void *cb;
	void *dsr;
	int ret, iaa;

	STAT(read_gpa);
	if (gru_get_cpu_resources(GRU_NUM_KERNEL_DSR_BYTES, &cb, &dsr))
		return MQE_BUG_NO_RESOURCES;
	iaa = gpa >> 62;
	gru_vload_phys(cb, gpa, gru_get_tri(dsr), iaa, IMA);
	ret = gru_wait(cb);
	if (ret == CBS_IDLE)
		*value = *(unsigned long *)dsr;
	gru_free_cpu_resources(cb, dsr);
	return ret;
}
开发者ID:rrowicki,项目名称:Chrono_Kernel-1,代码行数:20,代码来源:grukservices.c


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