• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ LEN_AND_LIT函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: times_usec

STATICFNDEF void times_usec(ext_tms *curr)
{
	int		res;
	struct rusage	usage;
        struct timespec	elp_time;

	res = getrusage(RUSAGE_SELF, &usage);
	if (res == -1)
		MPROF_RTS_ERROR((VARLSTCNT(8) ERR_SYSCALL, 5, LEN_AND_LIT("getrusage"), CALLFROM, errno));
	curr->tms_utime = (usage.ru_utime.tv_sec * (gtm_uint64_t)1000000) + usage.ru_utime.tv_usec;
	curr->tms_stime = (usage.ru_stime.tv_sec * (gtm_uint64_t)1000000) + usage.ru_stime.tv_usec;
	/* also start recording the elapsed time */
	while (TRUE)
	{
		res = clock_gettime(use_realtime_flag ? CLOCK_REALTIME : CLOCK_MONOTONIC, &elp_time);
		if (res == -1)
		{
			if ((EINVAL == errno) && !use_realtime_flag)
			{
				use_realtime_flag = TRUE;
				continue;
			} else
				MPROF_RTS_ERROR((VARLSTCNT(8) ERR_SYSCALL, 5, LEN_AND_LIT("clock_gettime"), CALLFROM, errno));
		}
		break;
	}
	curr->tms_etime = (elp_time.tv_sec * (gtm_uint64_t)1000000) + (elp_time.tv_nsec / 1000);
	return;
}
开发者ID:duck57,项目名称:fis-gtm-freebsd,代码行数:29,代码来源:mprof_funcs.c


示例2: times_usec

STATICFNDEF void times_usec(ext_tms *curr)
{
	int		res;
	struct rusage	usage;
        struct timespec	elp_time;

	res = getrusage(RUSAGE_SELF, &usage);
	if (-1 == res)
		MPROF_RTS_ERROR((CSA_ARG(NULL) VARLSTCNT(8) ERR_SYSCALL, 5, LEN_AND_LIT("getrusage"), CALLFROM, errno));
#	ifdef __osf__
	/* On Tru64 getrusage sometimes fails to increment the seconds value when the microseconds wrap around at 1M. If we detect
	 * this, we make a second call to getrusage if so. A more complete check would be to also verify whether the new seconds
	 * value is less than the previous one, but we anyway have an assert in UPDATE_TIME that would catch that, and our testing
	 * on Tru64 has not shown that type of faulty behavior.
	 */
	if (((usage.ru_utime.tv_sec == last_usage.ru_utime.tv_sec) && (usage.ru_utime.tv_usec < last_usage.ru_utime.tv_usec))
	    || ((usage.ru_stime.tv_sec == last_usage.ru_stime.tv_sec) && (usage.ru_stime.tv_usec < last_usage.ru_stime.tv_usec)))
	{
		DEBUG_ONLY(last_usage = usage);
		res = getrusage(RUSAGE_SELF, &usage);
		if (-1 == res)
			MPROF_RTS_ERROR((CSA_ARG(NULL) VARLSTCNT(8) ERR_SYSCALL, 5, LEN_AND_LIT("getrusage"), CALLFROM, errno));
		/* In debug also ensure that a subsequent call to getrusage restored the seconds value. */
		assert((usage.ru_utime.tv_sec > last_usage.ru_utime.tv_sec)
			|| (usage.ru_stime.tv_sec > last_usage.ru_stime.tv_sec));
	}
	last_usage = usage;
#	endif
	curr->tms_utime = (usage.ru_utime.tv_sec * (gtm_uint64_t)1000000) + usage.ru_utime.tv_usec;
	curr->tms_stime = (usage.ru_stime.tv_sec * (gtm_uint64_t)1000000) + usage.ru_stime.tv_usec;
	/* Also start recording the elapsed time. */
	while (TRUE)
	{
		res = clock_gettime(use_realtime_flag ? CLOCK_REALTIME : CLOCK_MONOTONIC, &elp_time);
		if (res == -1)
		{
			if ((EINVAL == errno) && !use_realtime_flag)
			{
				use_realtime_flag = TRUE;
				continue;
			} else
				MPROF_RTS_ERROR((CSA_ARG(NULL) VARLSTCNT(8) ERR_SYSCALL, 5,
					LEN_AND_LIT("clock_gettime"), CALLFROM, errno));
		}
		break;
	}
	curr->tms_etime = (elp_time.tv_sec * (gtm_uint64_t)1000000) + (elp_time.tv_nsec / 1000);
	return;
}
开发者ID:mihawk,项目名称:fis-gtm,代码行数:49,代码来源:mprof_funcs.c


示例3: gtcm_open_cmerrlog

void gtcm_open_cmerrlog(void)
{
	int		len;
	mstr		lfn1, lfn2;
	char		lfn_path[MAX_TRANS_NAME_LEN + 1];
	char		new_lfn_path[MAX_TRANS_NAME_LEN + 1];
	int		new_len;
	uint4 		ustatus;
	int4 		rval;
	FILE 		*new_file;
	error_def(ERR_TEXT);

	if (0 != (len = STRLEN(gtcm_gnp_server_log)))
	{
		lfn1.addr = gtcm_gnp_server_log;
		lfn1.len = len;
	} else
	{
		lfn1.addr = GTCM_GNP_CMERR_FN;
		lfn1.len = sizeof(GTCM_GNP_CMERR_FN) - 1;
	}
	rval = TRANS_LOG_NAME(&lfn1, &lfn2, lfn_path, sizeof(lfn_path), do_sendmsg_on_log2long);
	if (rval == SS_NORMAL || rval == SS_NOLOGNAM)
	{
		lfn_path[lfn2.len] = 0;
		rename_file_if_exists(lfn_path, lfn2.len, new_lfn_path, &new_len, &ustatus);
		new_file = Fopen(lfn_path, "a");
		if (NULL != new_file)
		{
			gtcm_errfile = TRUE;
			if (gtcm_errfs)
				fclose(gtcm_errfs);
			gtcm_errfs = new_file;
			if (dup2(fileno(gtcm_errfs), 1) < 0)
			{
				rts_error(VARLSTCNT(5) ERR_TEXT, 2, LEN_AND_LIT("Error on dup2 of stdout"), errno);
			}
			if (dup2(fileno(gtcm_errfs), 2) < 0)
			{
				rts_error(VARLSTCNT(5) ERR_TEXT, 2, LEN_AND_LIT("Error on dup2 of stderr"), errno);
			}
		}
		else
			fprintf(stderr, "Unable to open %s : %s\n", lfn_path, STRERROR(errno));
	} else
		fprintf(stderr, "Unable to resolve %s : return value = %d\n", GTCM_GNP_CMERR_FN, rval);
	gtcm_firsterr = FALSE;
}
开发者ID:5HT,项目名称:mumps,代码行数:48,代码来源:gtcm_open_cmerrlog.c


示例4: gvcmx_increment

/* returns FALSE if gv_currkey is undefined in the server end and undef_inhibit is turned OFF */
void	gvcmx_increment(mval *increment, mval *result)
{
	unsigned char	buff[MAX_ZWR_KEY_SZ], *end;
	mval		tmpmval;

	error_def(ERR_UNIMPLOP);
	error_def(ERR_TEXT);
	error_def(ERR_GVIS);

	if (!((link_info *)gv_cur_region->dyn.addr->cm_blk->usr)->server_supports_dollar_incr)
	{
		assert(dba_cm == gv_cur_region->dyn.addr->acc_meth); /* we should've covered all other access methods elsewhere */
		end = format_targ_key(buff, MAX_ZWR_KEY_SZ, gv_currkey, TRUE);
		rts_error(VARLSTCNT(14) ERR_UNIMPLOP, 0,
					ERR_TEXT, 2, LEN_AND_LIT("GT.CM server does not support $INCREMENT operation"),
					ERR_GVIS, 2, end - buff, buff,
					ERR_TEXT, 2, REG_LEN_STR(gv_cur_region));
	}
	/* gvcmz_doop() currently accepts only one argument.
	 * It serves as an input argument for SET.
	 * It serves as an output argument for GET etc.
	 * $INCR is unique in that it needs to pass the increment as input and expects the post-increment as output.
	 *
	 * In order to accomplish this without changing the gvcmz_doop() interface, we overload the one argument to
	 *	serve two purposes. It will be an input argument until the send of the message to the server and will
	 *	then serve as an output argument after the response from the server. ("result" is used for this purpose)
	 * i.e.
	 *	to serve as increment            for client --> server message
	 *	to serve as post-increment value for server --> client message
	 */
	assert(MV_IS_NUMERIC(increment));	/* op_gvincr would have forced it to be a NUMERIC */
	MV_FORCE_STR(increment);		/* convert it to a string before sending it to gvcmz_doop */
	*result = *increment;
	gvcmz_doop(CMMS_Q_INCREMENT, CMMS_R_INCREMENT, result);
}
开发者ID:5HT,项目名称:mumps,代码行数:36,代码来源:gvcmx_increment.c


示例5: dollar_system_init

void dollar_system_init(struct startup_vector *svec)
{
	uint4		status;
	mstr		val, tn;
	char		buf[MAX_TRANS_NAME_LEN];
	error_def(ERR_TRNLOGFAIL);

	dollar_system.mvtype = MV_STR;
	dollar_system.str.addr = (char *)stringpool.free;
	dollar_system.str.len = STR_LIT_LEN("47,");
	memcpy(stringpool.free, "47,", dollar_system.str.len);
	stringpool.free += dollar_system.str.len;
	val.addr = SYSID;
	val.len = STR_LIT_LEN(SYSID);
	if (SS_NORMAL == (status = trans_log_name(&val, &tn, buf)))
	{
		dollar_system.str.len += tn.len;
		memcpy(stringpool.free, tn.addr, tn.len);
		stringpool.free += tn.len;
	} else if (SS_NOLOGNAM == status)
	{
		dollar_system.str.len += svec->sysid_ptr->len;
		memcpy(stringpool.free, svec->sysid_ptr->addr, svec->sysid_ptr->len);
		stringpool.free += dollar_system.str.len;
	} else
		rts_error(VARLSTCNT(5) ERR_TRNLOGFAIL, 2, LEN_AND_LIT(SYSID), status);
	assert(stringpool.free < stringpool.top);	/* it's process initialization after all */
	return;
}
开发者ID:h4ck3rm1k3,项目名称:FIS-GT.M,代码行数:29,代码来源:dollar_system_init.c


示例6: fgn_getrtn

/* Lookup an external function. Return function address if success, NULL otherwise.
 * package_handle - DLL handle returned by fgn_getpak
 * entry_name - symbol name to be looked up
 * msgtype - message severity of the errors reported if any.
 * Note: If msgtype is SUCCESS, errors are not issued. It is useful if the callers are not
 * interested in message report and not willing to have condition handler overhead (eg. zro_search).
 */
fgnfnc fgn_getrtn(void_ptr_t package_handle, mstr *entry_name, int msgtype)
{
	void_ptr_t	sym_addr;
	char_ptr_t	dummy_err_str;
	void		*short_sym_addr;
	char		err_str[MAX_ERRSTR_LEN]; /* needed as util_out_print doesn't handle 64bit pointers */
	error_def(ERR_DLLNORTN);
	error_def(ERR_TEXT);

	if (!(sym_addr = dlsym(package_handle, entry_name->addr)))
	{
		if (SUCCESS != msgtype)
		{
			assert(!(msgtype & ~SEV_MSK));
			COPY_DLLERR_MSG;
			rts_error(VARLSTCNT(8) MAKE_MSG_TYPE(ERR_DLLNORTN, msgtype), 2, LEN_AND_STR(entry_name->addr),
				ERR_TEXT, 2, LEN_AND_STR(err_str));
		}
	} else
	{  /* Tru64 - dlsym() is bound to return short pointer because of ld -taso flag used for GT.M */
#ifdef	__osf__
		short_sym_addr = sym_addr;
		if (short_sym_addr != sym_addr)
		{
			sym_addr = NULL;
			/* always report an error irrespective of msgtype - since this code should never
			 * have executed and/or the DLL might need to be rebuilt with 32-bit options */
			rts_error(VARLSTCNT(8) ERR_DLLNORTN, 2, LEN_AND_STR(entry_name->addr),
				ERR_TEXT, 2, LEN_AND_LIT("Symbol is loaded above the lower 31-bit address space"));
		}
#endif
	}
	return (fgnfnc)sym_addr;
}
开发者ID:h4ck3rm1k3,项目名称:FIS-GT.M,代码行数:41,代码来源:fgn_getinfo.c


示例7: gtmrecv_statslog

int gtmrecv_statslog(void)
{
#ifdef VMS
    rts_error(VARLSTCNT(6) ERR_UNIMPLOP, 0, ERR_TEXT, 2, LEN_AND_LIT("Statistics logging not supported on VMS"));
#endif
    /* Grab the recvpool option write lock */
    if (0 > grab_sem(RECV, RECV_SERV_OPTIONS_SEM))
    {
        util_out_print("Error grabbing recvpool option write lock. Could not initiate stats log", TRUE);
        return (ABNORMAL_SHUTDOWN);
    }

    if (gtmrecv_options.statslog == recvpool.gtmrecv_local->statslog)
    {
        util_out_print("STATSLOG is already !AD. Not initiating change in stats log", TRUE, gtmrecv_options.statslog ?
                       strlen("ON") : strlen("OFF"), gtmrecv_options.statslog ? "ON" : "OFF");
        rel_sem_immediate(RECV, RECV_SERV_OPTIONS_SEM);
        return (ABNORMAL_SHUTDOWN);
    }

    if (!gtmrecv_options.statslog)
    {
        recvpool.gtmrecv_local->statslog = FALSE;
        util_out_print("STATSLOG turned OFF", TRUE);
        rel_sem_immediate(RECV, RECV_SERV_OPTIONS_SEM);
        return (NORMAL_SHUTDOWN);
    }

    recvpool.gtmrecv_local->statslog = TRUE;
    util_out_print("Stats log turned on", TRUE);
    rel_sem_immediate(RECV, RECV_SERV_OPTIONS_SEM);
    return (NORMAL_SHUTDOWN);
}
开发者ID:whitten,项目名称:fis-gtm-1,代码行数:33,代码来源:gtmrecv_statslog.c


示例8: update_trigger_name_value

STATICFNDEF int4 update_trigger_name_value(char *trig_name, int trig_name_len, int new_trig_index)
{
	int			len;
	char			name_and_index[MAX_MIDENT_LEN + 1 + MAX_DIGITS_IN_INT];
	int			num_len;
	char			*ptr;
	int4			result;
	mval			trig_gbl;
	DCL_THREADGBL_ACCESS;

	SETUP_THREADGBL_ACCESS;
	assert(!gv_cur_region->read_only);		/* caller should have already checked this */
	assert(cs_addrs->hasht_tree == gv_target);	/* should have been set up by caller */
	assert(gv_target->root);			/* should have been ensured by caller */
	/* $get(^#t("#TNAME",^#t(GVN,index,"#TRIGNAME"))) */
	BUILD_HASHT_SUB_SUB_CURRKEY(LITERAL_HASHTNAME, STRLEN(LITERAL_HASHTNAME), trig_name, trig_name_len - 1);
	if (!gvcst_get(&trig_gbl))
	{	/* There has to be a #TNAME entry */
		if (CDB_STAGNATE > t_tries)
			t_retry(cdb_sc_triggermod);
		assert(WBTEST_HELPOUT_TRIGDEFBAD == gtm_white_box_test_case_number);
		rts_error_csa(CSA_ARG(NULL) VARLSTCNT(6) ERR_TRIGNAMBAD, 4, LEN_AND_LIT("\"#TNAME\""),
			trig_name_len - 1, trig_name);
	}
	ptr = trig_gbl.str.addr;
	len = MIN(trig_gbl.str.len, MAX_MIDENT_LEN);
	STRNLEN(ptr, len, len);
	ptr += len;
	if ((trig_gbl.str.len == len) || ('\0' != *ptr))
	{
		if (CDB_STAGNATE > t_tries)
			t_retry(cdb_sc_triggermod);
		assert(WBTEST_HELPOUT_TRIGDEFBAD == gtm_white_box_test_case_number);
		rts_error_csa(CSA_ARG(NULL) VARLSTCNT(6) ERR_TRIGNAMBAD, 4, LEN_AND_LIT("\"#TNAME\""),
			trig_name_len - 1, trig_name);
	}
	memcpy(name_and_index, trig_gbl.str.addr, ++len); /* inline increment intended */
	ptr = name_and_index + len;
	num_len = 0;
	I2A(ptr, num_len, new_trig_index);
	len += num_len;
	/* set ^#t("#TNAME",<trigname>)=gblname_$C(0)_new_trig_index */
	SET_TRIGGER_GLOBAL_SUB_SUB_STR(LITERAL_HASHTNAME, STRLEN(LITERAL_HASHTNAME), trig_name, trig_name_len - 1,
		name_and_index, len, result);
	return result;
}
开发者ID:whitten,项目名称:fis-gtm-1,代码行数:46,代码来源:trigger_delete.c


示例9: gvcmy_open

void gvcmy_open(gd_region *reg, parse_blk *nb)
{
	error_def(ERR_UNIMPLOP);
	error_def(ERR_TEXT);

	rts_error(VARLSTCNT(6) ERR_UNIMPLOP, 0, ERR_TEXT,
		2, LEN_AND_LIT("This utility does not support remote database operations"));
}
开发者ID:5HT,项目名称:mumps,代码行数:8,代码来源:gtcmstub.c


示例10: mupfndfil

/* mupfndfil.c
 * Description:
 *	For a region find if the corresponding database is present.
 * Arguments:
 *	reg: Region's pointer
 *	filestr: Sent as allocated memory, if returned full path is needed in this mstr
 *	Returns: TRUE if region's database file is found
 *		 FALSE, otherwise
 * Side Effects:
 *	reg->dyn.addr->fname_len and reg->dyn.addr->fname are updated
 */
boolean_t mupfndfil(gd_region *reg, mstr *filestr)
{
	char 	filename[MAX_FN_LEN];
	mstr 	file, def, ret, *retptr;
	uint4	ustatus;

	switch(reg->dyn.addr->acc_meth)
	{
	case dba_mm:
	case dba_bg:
		break;
#	ifdef VMS
	case dba_usr:
		gtm_putmsg_csa(CSA_ARG(NULL) VARLSTCNT(6) ERR_NOUSERDB, 4, LEN_AND_LIT("specified function"), REG_LEN_STR(reg));
		return FALSE;		/* This is currently a VMS only possibility and has no corresponding test case */
#	endif
	default:
		util_out_print("REGION !AD has an unrecognized access method.", TRUE, REG_LEN_STR(reg));
		return FALSE;
	}
	file.addr = (char *)reg->dyn.addr->fname;
	file.len = reg->dyn.addr->fname_len;
#if defined(UNIX)
	file.addr[file.len] = 0;
	if (is_raw_dev(file.addr))
	{
		def.addr = DEF_NODBEXT;
		def.len = SIZEOF(DEF_NODBEXT) - 1;
	} else
	{
		def.addr = DEF_DBEXT;	/* UNIX need to pass "*.dat" but reg->dyn.addr->defext has "DAT" */
		def.len = SIZEOF(DEF_DBEXT) - 1;
	}
#elif defined(VMS)
	def.addr = (char *)reg->dyn.addr->defext;
	def.len = SIZEOF(reg->dyn.addr->defext);
#endif
	if (NULL == filestr)
	{
		ret.len = SIZEOF(filename);
		ret.addr = filename;
		retptr = &ret;
	} else
		retptr = filestr;
	if (FILE_PRESENT != gtm_file_stat(&file, &def, retptr, FALSE, &ustatus))
	{
		if (!jgbl.mupip_journal)
		{	/* Do not print error messages in case of call from mur_open_files().
			 * Currently we use "jgbl.mupip_journal" to identify a call from mupip_recover code */
			util_out_print("REGION !AD's file !AD cannot be found.", TRUE, REG_LEN_STR(reg), LEN_AND_STR(file.addr));
			gtm_putmsg_csa(CSA_ARG(NULL) VARLSTCNT(1) ustatus);
		}
		return FALSE;
	}
	reg->dyn.addr->fname_len = retptr->len;
	memcpy(reg->dyn.addr->fname, retptr->addr, retptr->len + 1);
	return TRUE;
}
开发者ID:ChristopherEdwards,项目名称:fis-gtm,代码行数:69,代码来源:mupfndfil.c


示例11: times_usec

STATICFNDEF void times_usec(struct tms *curr)
{
	int res;
	struct rusage usage;

	res = getrusage(RUSAGE_SELF, &usage);
	if (res == -1)
		rts_error(VARLSTCNT(8) ERR_SYSCALL, 5, LEN_AND_LIT("getrusage"), CALLFROM, errno);
	curr->tms_utime = (usage.ru_utime.tv_sec * 1000000) + usage.ru_utime.tv_usec;
	curr->tms_stime = (usage.ru_stime.tv_sec * 1000000) + usage.ru_stime.tv_usec;
	return;
}
开发者ID:h4ck3rm1k3,项目名称:fis-gtm,代码行数:12,代码来源:mprof_funcs.c


示例12: update_trigger_name_value

STATICFNDEF int4 update_trigger_name_value(int trigvn_len, char *trig_name, int trig_name_len, int new_trig_index)
{
	sgmnt_addrs		*csa;
	mname_entry		gvent;
	gv_namehead		*hasht_tree;
	int			len;
	char			name_and_index[MAX_MIDENT_LEN + 1 + MAX_DIGITS_IN_INT];
	char			new_trig_name[MAX_TRIGNAME_LEN + 1];
	int			num_len;
	char			*ptr;
	int4			result;
	char			save_currkey[SIZEOF(gv_key) + DBKEYSIZE(MAX_KEY_SZ)];
	gv_key			*save_gv_currkey;
	gd_region		*save_gv_cur_region;
	gv_namehead		*save_gv_target;
	sgm_info		*save_sgm_info_ptr;
	mval			trig_gbl;
	DCL_THREADGBL_ACCESS;

	SETUP_THREADGBL_ACCESS;
	if (MAX_AUTO_TRIGNAME_LEN < trigvn_len)
		return PUT_SUCCESS;
	SAVE_TRIGGER_REGION_INFO;
	SWITCH_TO_DEFAULT_REGION;
	if (gv_cur_region->read_only)
		rts_error_csa(CSA_ARG(csa) VARLSTCNT(4) ERR_TRIGMODREGNOTRW, 2, REG_LEN_STR(gv_cur_region));
	assert(0 != gv_target->root);
	/* $get(^#t("#TNAME",^#t(GVN,index,"#TRIGNAME")) */
	BUILD_HASHT_SUB_SUB_CURRKEY(LITERAL_HASHTNAME, STRLEN(LITERAL_HASHTNAME), trig_name, trig_name_len - 1);
	if (!gvcst_get(&trig_gbl))
	{	/* There has to be a #TNAME entry */
		if (CDB_STAGNATE > t_tries)
			t_retry(cdb_sc_triggermod);
		else
		{
			assert(WBTEST_HELPOUT_TRIGDEFBAD == gtm_white_box_test_case_number);
			rts_error_csa(CSA_ARG(NULL) VARLSTCNT(6) ERR_TRIGNAMBAD, 4, LEN_AND_LIT("\"#TNAME\""), trig_name_len - 1,
					trig_name);
		}
	}
	len = STRLEN(trig_gbl.str.addr) + 1;
	assert(MAX_MIDENT_LEN >= len);
	memcpy(name_and_index, trig_gbl.str.addr, len);
	ptr = name_and_index + len;
	num_len = 0;
	I2A(ptr, num_len, new_trig_index);
	len += num_len;
	/* set ^#t(GVN,index,"#TRIGNAME")=trig_name $C(0) new_trig_index */
	SET_TRIGGER_GLOBAL_SUB_SUB_STR(LITERAL_HASHTNAME, STRLEN(LITERAL_HASHTNAME), trig_name, trig_name_len - 1,
		name_and_index, len, result);
	RESTORE_TRIGGER_REGION_INFO;
	return result;
}
开发者ID:ChristyV,项目名称:fis-gtm,代码行数:53,代码来源:trigger_delete.c


示例13: get_cputime

STATICFNDEF void get_cputime (struct tms *curr)
{
	int4	cpu_time_used;
	int	status;
	int	jpi_code = JPI$_CPUTIM;

	if ((status = lib$getjpi(&jpi_code, &process_id, 0, &cpu_time_used, 0, 0)) != SS$_NORMAL)
		rts_error(VARLSTCNT(8) ERR_SYSCALL, 5, LEN_AND_LIT("LIB$GETJPI"), CALLFROM, status);
	curr->tms_utime = cpu_time_used;
	curr->tms_stime = 0;
	return;
}
开发者ID:h4ck3rm1k3,项目名称:fis-gtm,代码行数:12,代码来源:mprof_funcs.c


示例14: get_cputime

STATICFNDEF void get_cputime (ext_tms *curr)
{
	int4	cpu_time_used;
	int	status;
	int	jpi_code = JPI$_CPUTIM;

	if ((status = lib$getjpi(&jpi_code, &process_id, 0, &cpu_time_used, 0, 0)) != SS$_NORMAL)
		MPROF_RTS_ERROR((CSA_ARG(NULL) VARLSTCNT(8) ERR_SYSCALL, 5, LEN_AND_LIT("LIB$GETJPI"), CALLFROM, status));
	curr->tms_utime = cpu_time_used;
	curr->tms_stime = 0;
	return;
}
开发者ID:mihawk,项目名称:fis-gtm,代码行数:12,代码来源:mprof_funcs.c


示例15: child_times_usec

STATICFNDEF void child_times_usec(void)
{
	int		res;
	struct rusage	usage;

	res = getrusage(RUSAGE_CHILDREN, &usage);
	if (res == -1)
		MPROF_RTS_ERROR((CSA_ARG(NULL) VARLSTCNT(8) ERR_SYSCALL, 5, LEN_AND_LIT("getrusage"), CALLFROM, errno));
	child_user = (usage.ru_utime.tv_sec * (gtm_uint64_t)1000000) + usage.ru_utime.tv_usec;
	child_system = (usage.ru_stime.tv_sec * (gtm_uint64_t)1000000) + usage.ru_stime.tv_usec;
	return;
}
开发者ID:mihawk,项目名称:fis-gtm,代码行数:12,代码来源:mprof_funcs.c


示例16: mur_jctl_from_next_gen

/* Returns 0 (SS_NORMAL) on success. Non-zero on failure */
uint4	mur_jctl_from_next_gen(reg_ctl_list *rctl)
{
    jnl_ctl_list	*jctl, *temp_jctl;
    uint4		status;

    status = gtm_pthread_init_key(rctl->gd);
    if (0 != status)
        return status;
    if (!rctl->jfh_recov_interrupted)
        return SS_NORMAL;
    assert(rctl->jctl_apply_pblk == rctl->jctl_head);
    jctl = rctl->jctl_apply_pblk;	/* journal file that has the turn around point of interrupted recovery */
    assert(rctl->jctl == jctl);
    assert(NULL != rctl->jctl_alt_head);	/* should have been set in mur_apply_pblk */
    assert(NULL != jctl->jfh);
    assert(!jctl->jfh->recover_interrupted);
    for ( ; NULL != jctl->next_gen; jctl = jctl->next_gen)
        assert(!jctl->next_gen->jfh->recover_interrupted);
    while (0 != jctl->jfh->next_jnl_file_name_length)
    {   /* create the linked list of journal files created by GT.M originally */
        if (multi_thread_in_use)
        {   /* exit thread if master process got signal (e.g. SIGTERM) to request exit */
            PTHREAD_EXIT_IF_FORCED_EXIT;
        }
        temp_jctl = (jnl_ctl_list *)malloc(SIZEOF(jnl_ctl_list));	/* gtm_malloc is now thread safe */
        memset(temp_jctl, 0, SIZEOF(jnl_ctl_list));
        temp_jctl->jnl_fn_len = jctl->jfh->next_jnl_file_name_length;
        memcpy(temp_jctl->jnl_fn, jctl->jfh->next_jnl_file_name, jctl->jfh->next_jnl_file_name_length);
        if (SS_NORMAL != (status = mur_fopen(temp_jctl, rctl)))
        {
            free(temp_jctl);
            return status;
        }
        if (SS_NORMAL != (jctl->status = mur_fread_eof(temp_jctl, rctl)))
        {
            gtm_putmsg_csa(CSA_ARG(rctl->csa) VARLSTCNT(9) ERR_JNLBADRECFMT, 3,
                           temp_jctl->jnl_fn_len, temp_jctl->jnl_fn, temp_jctl->rec_offset,
                           ERR_TEXT, 2, LEN_AND_LIT("mur_jctl_from_next_gen"));
            free(temp_jctl);
            return ERR_JNLBADRECFMT;
        }
        temp_jctl->prev_gen = jctl;
        temp_jctl->next_gen = NULL;
        jctl->next_gen = temp_jctl;
        jctl = temp_jctl;
    }
    rctl->jctl = jctl;
    assert(jctl->reg_ctl == rctl);
    return SS_NORMAL;
}
开发者ID:shabiel,项目名称:fis-gtm,代码行数:51,代码来源:mur_jctl_from_next_gen.c


示例17: add_inter

int4	add_inter(int val, sm_int_ptr_t addr, sm_global_latch_ptr_t latch)
{
	int4			cntrval, newcntrval, spins, maxspins, retries;
	boolean_t		cswpsuccess;
	sm_int_ptr_t volatile	cntrval_p;

	++fast_lock_count;
	maxspins = num_additional_processors ? MAX_LOCK_SPINS(LOCK_SPINS, num_additional_processors) : 1;
	cntrval_p = addr;	/* Need volatile context especially on Itanium */
        for (retries = LOCK_TRIES - 1; 0 < retries; retries--)  /* - 1 so do rel_quant 3 times first */
        {	/* seems like a legitinate spin which could take advantage of transactional memory */
		for (spins = maxspins; 0 < spins; spins--)
		{
			cntrval = *cntrval_p;
			newcntrval = cntrval + val;
			/* This is (currently as of 08/2007) the only non-locking usage of compswap in GT.M. We
			   are not passing compswap an actual sm_global_latch_ptr_t addr like its function would
			   normally dictate. However, since the address of the field we want to deal with is the
			   first int in the global_latch_t, we just pass our int address properly cast to the
			   type that compswap is expecting. The assert below verifies that this assumption has
			   not changed (SE 08/2007)
			*/
			assert(0 == OFFSETOF(global_latch_t, u.parts.latch_pid));
			IA64_ONLY(cswpsuccess = compswap_unlock(RECAST(sm_global_latch_ptr_t)cntrval_p, cntrval, newcntrval));
			NON_IA64_ONLY(cswpsuccess = compswap((sm_global_latch_ptr_t)cntrval_p, cntrval, newcntrval));
			if (cswpsuccess)
			{
				--fast_lock_count;
				assert(0 <= fast_lock_count);
				return newcntrval;
			}
		}
		if (retries & 0x3)
			/* On all but every 4th pass, do a simple rel_quant */
			rel_quant();	/* Release processor to holder of lock (hopefully) */
		else
		{
			/* On every 4th pass, we bide for awhile */
			wcs_sleep(LOCK_SLEEP);
			assert(0 == (LOCK_TRIES % 4)); /* assures there are 3 rel_quants prior to first wcs_sleep() */
		}
	}
	--fast_lock_count;
	assert(FALSE);
	rts_error_csa(CSA_ARG(NULL) VARLSTCNT(9) ERR_DBCCERR, 2, LEN_AND_LIT("*unknown*"), ERR_ERRCALL, 3, CALLFROM);
	return 0; /* To keep the compiler quiet */
}
开发者ID:mihawk,项目名称:fis-gtm,代码行数:47,代码来源:add_inter.c


示例18: gtmsource_seqno_init

void gtmsource_seqno_init(void)
{
	/* Find the start_jnl_seqno */

	gd_region		*reg, *region_top;
	seq_num			local_read_jsn, local_jsn;
	sgmnt_addrs		*csa;
	sgmnt_data_ptr_t	csd;
	sm_uc_ptr_t		gld_fn;

	/* Unix and VMS have different field names for now, but will both be soon changed to instname instead of gtmgbldir */
	gld_fn = (sm_uc_ptr_t)jnlpool.jnlpool_ctl->jnlpool_id.gtmgbldir;
	QWASSIGN(jnlpool.jnlpool_ctl->start_jnl_seqno, seq_num_zero);
	QWASSIGN(local_read_jsn, seq_num_zero);
	QWASSIGN(local_jsn, seq_num_zero);
	region_top = gd_header->regions + gd_header->n_regions;
	for (reg = gd_header->regions; reg < region_top; reg++)
	{
		assert(reg->open);
		csa = &FILE_INFO(reg)->s_addrs;
		csd = csa->hdr;
		if (REPL_ALLOWED(csd))
		{
			if (QWLT(local_read_jsn, csd->resync_seqno))
				QWASSIGN(local_read_jsn, csd->resync_seqno);
			if (QWLT(local_jsn, csd->reg_seqno))
				QWASSIGN(local_jsn, csd->reg_seqno);
			/* Copy gtmgbldir into the database shared memory.
			 * Used later to avoid updates from a different gtmgbldir to this database.
			 */
			assert(SIZEOF(csa->nl->replinstfilename) == SIZEOF(jnlpool.jnlpool_ctl->jnlpool_id.gtmgbldir));
			memcpy(csa->nl->replinstfilename, gld_fn, SIZEOF(csa->nl->replinstfilename));
		}
	}
	if (QWEQ(local_jsn, seq_num_zero))
	{
		/* No replicated region, or databases created with older version of GTM */
		gtm_putmsg(VARLSTCNT(5) ERR_NOREPLCTDREG, 3, LEN_AND_LIT("global directory"), gld_fn);
		/* Error, has to shutdown all regions 'cos mupip needs exclusive access to turn replication on */
		gtmsource_autoshutdown();
	}
	QWASSIGN(jnlpool.jnlpool_ctl->start_jnl_seqno, local_jsn);
	QWASSIGN(jnlpool.jnlpool_ctl->jnl_seqno, local_jsn);
	QWASSIGN(jnlpool.gtmsource_local->read_jnl_seqno, local_read_jsn);
}
开发者ID:ChristyV,项目名称:fis-gtm,代码行数:45,代码来源:gtmsource_seqno_init.c


示例19: init_callin_functable

void init_callin_functable(void)
{
	unsigned char 	*env_top, *address_top;
	uint4 		address_len;
	int		save_errno;

	address_top = GTM64_ONLY(i2ascl)NON_GTM64_ONLY(i2asc)(gtmvectortable_address, (UINTPTR_T)(&callintogtm_vectortable[0]));
	*address_top = '\0';
	address_len = (uint4)(address_top - &gtmvectortable_address[0]);
	env_top = &gtmvectortable_env[0];
	MEMCPY_LIT(env_top, GTM_CALLIN_START_ENV);
	memcpy((env_top + strlen(GTM_CALLIN_START_ENV)), gtmvectortable_address, address_len);
	*(env_top + strlen(GTM_CALLIN_START_ENV) + address_len) = '\0';
	if (PUTENV((char *)gtmvectortable_env))
	{
		save_errno = errno;
		rts_error(VARLSTCNT(8) ERR_SYSCALL, 5, LEN_AND_LIT("putenv"), CALLFROM, save_errno);
	}
}
开发者ID:ChristyV,项目名称:fis-gtm,代码行数:19,代码来源:callintogtmxfer.c


示例20: repl_inst_ftok_counter_halted

/* This function sets the "ftok_counter_halted" field to TRUE in the instance file header and flushes it to disk.
 * Caller could be attached to the journal pool or not. If not, update file header directly. If yes, go through locks.
 */
void	repl_inst_ftok_counter_halted(unix_db_info *udi, char *file_type, repl_inst_hdr *repl_instance)
{
	assert(udi->grabbed_ftok_sem);	/* this ensures we have a lock before we modify the instance file header */
	if (NULL != jnlpool.repl_inst_filehdr)
	{
		assert(!jnlpool.repl_inst_filehdr->ftok_counter_halted);
		jnlpool.repl_inst_filehdr->ftok_counter_halted = TRUE;
		grab_lock(jnlpool.jnlpool_dummy_reg, TRUE, ASSERT_NO_ONLINE_ROLLBACK);
		repl_inst_flush_filehdr();
		rel_lock(jnlpool.jnlpool_dummy_reg);
	} else
	{
		assert(!repl_instance->ftok_counter_halted);
		repl_instance->ftok_counter_halted = TRUE;
		repl_inst_write(udi->fn, (off_t)0, (sm_uc_ptr_t)repl_instance, SIZEOF(repl_inst_hdr));
	}
	/* Ignore any errors while flushing the "halted" value to the file header. The only consequence is other processes
	 * will incur a performance overhead trying to unnecessarily bump the semaphore counter when it is already ERANGE.
	 */
	send_msg_csa(CSA_ARG(NULL) VARLSTCNT(7) ERR_NOMORESEMCNT, 5, LEN_AND_LIT("ftok"), file_type, LEN_AND_STR(udi->fn));
}
开发者ID:mihawk,项目名称:fis-gtm,代码行数:24,代码来源:repl_inst_ftok_counter_halted.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ LEN_AND_STR函数代码示例发布时间:2022-05-30
下一篇:
C++ LENGTHOF函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap