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

C++ printfd函数代码示例

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

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



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

示例1: get_cmdline_by_pid

void get_cmdline_by_pid(struct procinfo *pi)
{
	char cmd_path[128];
	char cmd[256];
	char resolved[256];

	FILE *fp;

	memset(cmd_path, 0, 128);
	memset(cmd, 0, 256);
	sprintf(cmd_path, "/proc/%d/cmdline", pi->pi_pid);
	fp = fopen(cmd_path, "r");
	fgets(cmd, 256, fp);

	/*resolve all symlinks */
	check_target_path((u_char *) cmd, pi->pi_perm);
	memset(cmd, 0, 256);
	memcpy(cmd, pi->pi_perm->p_full_path,
	       strlen((const char *)pi->pi_perm->p_full_path));

	strcpy((char *)pi->pi_perm->p_full_path, realpath(cmd, resolved));
#if 0
	printfd(2, DEBUG "cmdline path : %s\n", cmd_path);
	printfd(2, DEBUG "cmd is : %s\n", pi->pi_perm->p_full_path);
#endif
}
开发者ID:0x36,项目名称:BinTrace,代码行数:26,代码来源:proc.c


示例2: sys_epoll_ctl

int
sys_epoll_ctl(struct tcb *tcp)
{
	if (entering(tcp)) {
		printfd(tcp, tcp->u_arg[0]);
		tprints(", ");
		printxval(epollctls, tcp->u_arg[1], "EPOLL_CTL_???");
		tprints(", ");
		printfd(tcp, tcp->u_arg[2]);
		tprints(", ");
		if (tcp->u_arg[3] == 0)
			tprints("NULL");
		else {
#ifdef HAVE_SYS_EPOLL_H
			struct epoll_event ev;
			if (
#ifdef EPOLL_CTL_DEL
			    (tcp->u_arg[1] != EPOLL_CTL_DEL) &&
#endif
			    umove(tcp, tcp->u_arg[3], &ev) == 0)
				print_epoll_event(&ev);
			else
#endif
				tprintf("%lx", tcp->u_arg[3]);
		}
	}
	return 0;
}
开发者ID:3125788,项目名称:android_aosp_external_strace,代码行数:28,代码来源:desc.c


示例3: sys_sendfile

int
sys_sendfile(struct tcb *tcp)
{
	if (entering(tcp)) {
		off_t offset;

		printfd(tcp, tcp->u_arg[0]);
		tprints(", ");
		printfd(tcp, tcp->u_arg[1]);
		tprints(", ");
		if (!tcp->u_arg[2])
			tprints("NULL");
//FIXME: obviously bogus.
//Probably should use explicit long.
//Arches with long long offset param should use
//sys_sendfile64, not this fn.
		else if (umove(tcp, tcp->u_arg[2], &offset) < 0)
			tprintf("%#lx", tcp->u_arg[2]);
		else
#ifdef HAVE_LONG_LONG_OFF_T
			tprintf("[%llu]", offset);
#else
			tprintf("[%lu]", offset);
#endif
		tprintf(", %lu", tcp->u_arg[3]);
	}
	return 0;
}
开发者ID:GeoffGats,项目名称:strace,代码行数:28,代码来源:io.c


示例4: printpair_fd

static void
printpair_fd(struct tcb *tcp, const int i0, const int i1)
{
	tprints("[");
	printfd(tcp, i0);
	tprints(", ");
	printfd(tcp, i1);
	tprints("]");
}
开发者ID:3125788,项目名称:platform_external_strace,代码行数:9,代码来源:net.c


示例5: lock

//-----------------------------------------------------------------------------
void USER_IMPL::Run()
{
STG_LOCKER lock(&mutex);

if (stgTime > static_cast<time_t>(lastWriteStat + settings->GetStatWritePeriod()))
    {
    printfd(__FILE__, "USER::WriteStat user=%s\n", GetLogin().c_str());
    WriteStat();
    }
if (creditExpire.ConstData() && creditExpire.ConstData() < stgTime)
    {
    WriteServLog("User: %s. Credit expired.", login.c_str());
    credit = 0;
    creditExpire = 0;
    WriteConf();
    }

if (passive.ConstData()
    && (stgTime % 30 == 0)
    && (passiveTime.ModificationTime() != stgTime))
    {
    passiveTime = passiveTime + (stgTime - passiveTime.ModificationTime());
    printfd(__FILE__, "===== %s: passiveTime=%d =====\n", login.c_str(), passiveTime.ConstData());
    }

if (!authorizedBy.empty())
    {
    if (connected)
        property.Stat().lastActivityTime = stgTime;

    if (!connected && IsInetable())
        Connect();

    if (connected && !IsInetable())
        {
        if (disabled)
            Disconnect(false, "disabled");
        else if (passive)
            Disconnect(false, "passive");
        else
            Disconnect(false, "no cash");
        }

    if (stgTime - lastScanMessages > 10)
        {
        ScanMessage();
        lastScanMessages = stgTime;
        }
    }
else
    {
    if (connected)
        Disconnect(false, "not authorized");
    }

}
开发者ID:madf,项目名称:stg,代码行数:57,代码来源:user_impl.cpp


示例6: it

//-----------------------------------------------------------------------------
void USER_IMPL::ScanMessage()
{
// No lock `cause we are already locked from caller
// We need not check for the authorizedBy `cause it has already checked by caller

std::list<STG_MSG>::iterator it(messages.begin());
while (it != messages.end())
    {
    if (settings->GetMessageTimeout() > 0 &&
        difftime(stgTime, it->header.creationTime) > settings->GetMessageTimeout())
        {
        // Timeout exceeded
        if (store->DelMessage(it->header.id, login))
            {
            WriteServLog("Error deleting message: '%s'", store->GetStrError().c_str());
            printfd(__FILE__, "Error deleting message: '%s'\n", store->GetStrError().c_str());
            }
        messages.erase(it++);
        continue;
        }
    if (it->GetNextSendTime() <= stgTime)
        {
        if (SendMessage(*it))
            {
            // We need to check all messages in queue for timeout
            ++it;
            continue;
            }
        if (it->header.repeat < 0)
            {
            if (store->DelMessage(it->header.id, login))
                {
                WriteServLog("Error deleting message: '%s'", store->GetStrError().c_str());
                printfd(__FILE__, "Error deleting message: '%s'\n", store->GetStrError().c_str());
                }
            messages.erase(it++);
            }
        else
            {
            if (store->EditMessage(*it, login))
                {
                WriteServLog("Error modifying message: '%s'", store->GetStrError().c_str());
                printfd(__FILE__, "Error modifying message: '%s'\n", store->GetStrError().c_str());
                }
            ++it;
            }
        }
    else
        {
        ++it;
        }
    }
}
开发者ID:madf,项目名称:stg,代码行数:54,代码来源:user_impl.cpp


示例7: do_dup2

static int
do_dup2(struct tcb *tcp, int flags_arg)
{
	printfd(tcp, tcp->u_arg[0]);
	tprints(", ");
	printfd(tcp, tcp->u_arg[1]);
	if (flags_arg >= 0) {
		tprints(", ");
		printflags(open_mode_flags, tcp->u_arg[flags_arg], "O_???");
	}

	return RVAL_DECODED | RVAL_FD;
}
开发者ID:Fox-Heracles,项目名称:platform_external_strace,代码行数:13,代码来源:desc.c


示例8: sys_sendfile64

int
sys_sendfile64(struct tcb *tcp)
{
	if (entering(tcp)) {
		printfd(tcp, tcp->u_arg[0]);
		tprints(", ");
		printfd(tcp, tcp->u_arg[1]);
		tprints(", ");
		print_loff_t(tcp, tcp->u_arg[2]);
		tprintf(", %lu", tcp->u_arg[3]);
	}
	return 0;
}
开发者ID:effaremment,项目名称:alice,代码行数:13,代码来源:io.c


示例9: do_dup2

static int
do_dup2(struct tcb *tcp, int flags_arg)
{
	if (entering(tcp)) {
		printfd(tcp, tcp->u_arg[0]);
		tprints(", ");
		printfd(tcp, tcp->u_arg[1]);
		if (flags_arg >= 0) {
			tprints(", ");
			printflags(open_mode_flags, tcp->u_arg[flags_arg], "O_???");
		}
	}
	return 0;
}
开发者ID:frankieklerer,项目名称:strace-plus,代码行数:14,代码来源:desc.c


示例10: print_mmap

static int
print_mmap(struct tcb *tcp, long *u_arg, unsigned long long offset)
{
	if (entering(tcp)) {
		/* addr */
		if (!u_arg[0])
			tprints("NULL, ");
		else
			tprintf("%#lx, ", u_arg[0]);
		/* len */
		tprintf("%lu, ", u_arg[1]);
		/* prot */
		printflags(mmap_prot, u_arg[2], "PROT_???");
		tprints(", ");
		/* flags */
#ifdef MAP_TYPE
		printxval(mmap_flags, u_arg[3] & MAP_TYPE, "MAP_???");
		addflags(mmap_flags, u_arg[3] & ~MAP_TYPE);
#else
		printflags(mmap_flags, u_arg[3], "MAP_???");
#endif
		tprints(", ");
		/* fd */
		printfd(tcp, u_arg[4]);
		/* offset */
		tprintf(", %#llx", offset);
	}
	return RVAL_HEX;
}
开发者ID:tizenorg,项目名称:platform.upstream.strace,代码行数:29,代码来源:mem.c


示例11: decode_sockname

static int
decode_sockname(struct tcb *tcp)
{
	int ulen, rlen;

	if (entering(tcp)) {
		printfd(tcp, tcp->u_arg[0]);
		tprints(", ");
		if (fetch_socklen(tcp, &ulen, tcp->u_arg[1], tcp->u_arg[2])) {
			set_tcb_priv_ulong(tcp, ulen);
			return 0;
		} else {
			printaddr(tcp->u_arg[1]);
			tprints(", ");
			printaddr(tcp->u_arg[2]);
			return RVAL_DECODED;
		}
	}

	ulen = get_tcb_priv_ulong(tcp);

	if (syserror(tcp) || umove(tcp, tcp->u_arg[2], &rlen) < 0) {
		printaddr(tcp->u_arg[1]);
		tprintf(", [%d]", ulen);
	} else {
		decode_sockaddr(tcp, tcp->u_arg[1], ulen > rlen ? rlen : ulen);
		if (ulen != rlen)
			tprintf(", [%d->%d]", ulen, rlen);
		else
			tprintf(", [%d]", rlen);
	}

	return RVAL_DECODED;
}
开发者ID:yunchih,项目名称:strace,代码行数:34,代码来源:net.c


示例12: do_accept

static int
do_accept(struct tcb *tcp, int flags_arg)
{
	if (entering(tcp)) {
		printfd(tcp, tcp->u_arg[0]);
		tprints(", ");
		return 0;
	}
	if (!tcp->u_arg[2])
		tprintf("%#lx, NULL", tcp->u_arg[1]);
	else {
		int len;
		if (tcp->u_arg[1] == 0 || syserror(tcp)
		    || umove(tcp, tcp->u_arg[2], &len) < 0) {
			tprintf("%#lx", tcp->u_arg[1]);
		} else {
			printsock(tcp, tcp->u_arg[1], len);
		}
		tprints(", ");
		printnum_int(tcp, tcp->u_arg[2], "%u");
	}
	if (flags_arg >= 0) {
		tprints(", ");
		printflags(sock_type_flags, tcp->u_arg[flags_arg],
			   "SOCK_???");
	}
	return 0;
}
开发者ID:3125788,项目名称:android_aosp_external_strace,代码行数:28,代码来源:net.c


示例13: socksserver_disconnect_client

// forced == 1
static void socksserver_disconnect_client(socksserver* srv, int fd, int forced) {
    fdinfo* client = &srv->clients[fdindex(fd)];
    int fdflag = 0;
    if(CONFIG_LOG && srv->log) {
        logstart();
        printfd(fd);
        LOGPUT(1, VARISL(" disconnect, forced: "), VARII(forced), NULL);
    }

    if(forced) rocksockserver_disconnect_client(&srv->serva, fd);
    client->state = SS_DISCONNECTED;
    if(client->data) {
        client->data->state = BS_UNUSED;
        client->data->start = 0;
        client->data->used = 0;
    }

    if(client->target_fd != -1) fdflag = 1;
    fd = client->target_fd;
    client->target_fd = -1;

    if(fdflag) {
        srv->clients[fdindex(fd)].target_fd = -1;
        socksserver_disconnect_client(srv, fd, 1);
    }
}
开发者ID:rofl0r,项目名称:rocksocks5,代码行数:27,代码来源:socksserver.c


示例14: sys_read

int
sys_read(struct tcb *tcp)
{
  struct socket_info sockinfo;
  if (entering(tcp)) {
    json_object_object_add(tcp->json, "fd", json_object_new_int((int)tcp->u_arg[0]));
    printfd(tcp, tcp->u_arg[0]);
    tprintf(", ");
    if (output_json) {
      if (get_socket_info(tcp->pid, (int) tcp->u_arg[0], &sockinfo) == 0) {
        append_to_json(tcp->json, &sockinfo);
      } else {
        json_object_object_add(tcp->json, "pid", json_object_new_int(tcp->pid));
      }
    }
  } else {
    /* exiting... */
    if (syserror(tcp)) {
      	tprintf("%#lx", tcp->u_arg[1]);
    } else {
      /* no error */
      if (output_json) {
        json_object_object_add(tcp->json, "content",
            json_object_new_string(readstr(tcp, tcp->u_arg[1], tcp->u_arg[2])));
        json_object_object_add(tcp->json, "length", json_object_new_int(tcp->u_arg[2]));
      } else {
        printstr(tcp, tcp->u_arg[1], tcp->u_rval);
      }
    }
    tprintf(", %lu", tcp->u_arg[2]);
  }
  return 0;
}
开发者ID:yarinb,项目名称:netstrace,代码行数:33,代码来源:io.c


示例15: clone_circles

static struct ia_circles *_core_mutate(struct ia_circles *circles, int idx)
{
	struct ia_circles *mutated_circles = clone_circles(circles);
	int max_tries = 0;
	//const int ult_max_tries = circles->num_circles * 2;
	const int ult_max_tries = 30;
	while(max_tries < ult_max_tries) {
		printfd("Mutating circle %d/%d\n",
			idx,
			circles->num_circles);
		struct ia_circles *circles_prev = clone_circles(mutated_circles);
		_ia_random_action(&mutated_circles->circles[idx], true);
		refresh_circles(mutated_circles);
		refresh_circles(circles_prev);
		struct img_bitmap *_img = mutated_circles->img;
		struct img_bitmap *_img_prev = circles_prev->img;
		if((_img->score - _img_prev->score) > 0) {
			max_tries++;
			memcpy(&mutated_circles->circles[idx],
			    &circles_prev->circles[idx],
			    sizeof(struct ia_circle));
			refresh_circles(mutated_circles);
		} else {
			max_tries = ult_max_tries;
		}
		free_circles(circles_prev);
		free(circles_prev);
	}
	refresh_circles(mutated_circles);
	return mutated_circles;
}
开发者ID:Nazgolze,项目名称:image-approximator,代码行数:31,代码来源:ga.c


示例16: sys_ioctl

int
sys_ioctl(struct tcb *tcp)
{
	const struct_ioctlent *iop;

	if (entering(tcp)) {
		printfd(tcp, tcp->u_arg[0]);
		tprints(", ");
		iop = ioctl_lookup(tcp->u_arg[1]);
		if (iop) {
			tprints(iop->symbol);
			while ((iop = ioctl_next_match(iop)))
				tprintf(" or %s", iop->symbol);
		} else
			tprintf("%#lx", tcp->u_arg[1]);
		ioctl_decode(tcp, tcp->u_arg[1], tcp->u_arg[2]);
	}
	else {
		int ret = ioctl_decode(tcp, tcp->u_arg[1], tcp->u_arg[2]);
		if (!ret)
			tprintf(", %#lx", tcp->u_arg[2]);
		else
			return ret - 1;
	}
	return 0;
}
开发者ID:effaremment,项目名称:alice,代码行数:26,代码来源:io.c


示例17: nbd_ioctl

int
nbd_ioctl(struct tcb *const tcp, const unsigned int code,
	  const kernel_ulong_t arg)
{
	switch (code) {
	case NBD_DISCONNECT:
	case NBD_CLEAR_SOCK:
	case NBD_DO_IT:
	case NBD_CLEAR_QUE:
	case NBD_PRINT_DEBUG:
		return RVAL_IOCTL_DECODED;

	case NBD_SET_SOCK:
		tprints(", ");
		printfd(tcp, arg);
		return RVAL_IOCTL_DECODED;

	case NBD_SET_BLKSIZE:
	case NBD_SET_SIZE:
	case NBD_SET_SIZE_BLOCKS:
	case NBD_SET_TIMEOUT:
		tprints(", ");
		tprintf("%" PRI_klu, arg);
		return RVAL_IOCTL_DECODED;

	case NBD_SET_FLAGS:
		tprints(", ");
		printflags(nbd_ioctl_flags, arg, "NBD_IOC_FLAG_???");
		return RVAL_IOCTL_DECODED;

	default:
		return RVAL_DECODED;
	}
}
开发者ID:android,项目名称:platform_external_strace,代码行数:34,代码来源:nbd_ioctl.c


示例18: sys_fanotify_mark

int
sys_fanotify_mark(struct tcb *tcp)
{
	unsigned long long mask = 0;
	int argn;

	if (exiting(tcp))
		return 0;

	printfd(tcp, tcp->u_arg[0]);
	tprints(", ");
	printflags(fan_mark_flags, (unsigned) tcp->u_arg[1], "FAN_MARK_???");
	tprints(", ");
	/*
	 * the mask argument is defined as 64-bit,
	 * but kernel uses the lower 32 bits only.
	 */
	argn = getllval(tcp, &mask, 2);
	printflags(fan_event_flags, mask, "FAN_???");
	tprints(", ");
	if ((int) tcp->u_arg[argn] == FAN_NOFD)
		tprints("FAN_NOFD, ");
	else
		print_dirfd(tcp, tcp->u_arg[argn]);
	printpath(tcp, tcp->u_arg[argn + 1]);

	return 0;
}
开发者ID:MoroJr,项目名称:strace,代码行数:28,代码来源:fanotify.c


示例19: print_file_dedupe_range_info

static bool
print_file_dedupe_range_info(struct tcb *tcp, void *elem_buf,
			     size_t elem_size, void *data)
{
	const struct file_dedupe_range_info *info = elem_buf;
	unsigned int *count = data;

	if (count) {
		if (*count == 0) {
			tprints("...");
			return false;
		}
		--*count;
	}

	if (entering(tcp)) {
		tprints("{dest_fd=");
		printfd(tcp, info->dest_fd);
		tprintf(", dest_offset=%" PRIu64 "}",
			(uint64_t) info->dest_offset);
	} else {
		tprintf("{bytes_deduped=%" PRIu64 ", status=%d}",
			(uint64_t) info->bytes_deduped, info->status);
	}

	return true;
}
开发者ID:android,项目名称:platform_external_strace,代码行数:27,代码来源:file_ioctl.c


示例20: do_sockname

static int
do_sockname(struct tcb *tcp, int flags_arg)
{
	if (entering(tcp)) {
		printfd(tcp, tcp->u_arg[0]);
		tprints(", ");
		return 0;
	}

	int len;
	if (!tcp->u_arg[2] || !verbose(tcp) || syserror(tcp) ||
	    umove(tcp, tcp->u_arg[2], &len) < 0) {
		printaddr(tcp->u_arg[1]);
		tprints(", ");
		printaddr(tcp->u_arg[2]);
	} else {
		printsock(tcp, tcp->u_arg[1], len);
		tprintf(", [%d]", len);
	}

	if (flags_arg >= 0) {
		tprints(", ");
		printflags(sock_type_flags, tcp->u_arg[flags_arg],
			   "SOCK_???");
	}
	return 0;
}
开发者ID:3125788,项目名称:platform_external_strace,代码行数:27,代码来源:net.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ printformat函数代码示例发布时间:2022-05-30
下一篇:
C++ printf_stderr_common函数代码示例发布时间: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