Exemplo n.º 1
0
static RList *xnu_desc_list (int pid) {
#if TARGET_OS_IPHONE
	return NULL;
#else
#define xwr2rwx(x) ((x&1)<<2) | (x&2) | ((x&4)>>2)
	RDebugDesc *desc;
	RList *ret = r_list_new();
	struct vnode_fdinfowithpath vi;
	int i, nb, type = 0;
	int maxfd = getMaxFiles();

	for (i=0 ; i<maxfd; i++) {
		nb = proc_pidfdinfo (pid, i, PROC_PIDFDVNODEPATHINFO, &vi, sizeof (vi));
		if (nb<1) {
			continue;
		}
		if (nb < sizeof (vi)) {
			perror ("too few bytes");
			break;
		}
		//printf ("FD %d RWX %x ", i, vi.pfi.fi_openflags);
		//printf ("PATH %s\n", vi.pvip.vip_path);
		desc = r_debug_desc_new (i,
				vi.pvip.vip_path,
				xwr2rwx(vi.pfi.fi_openflags),
				type, 0);
		r_list_append (ret, desc);
	}
	return ret;
#endif
}
Exemplo n.º 2
0
    Logger()
    {
        // Create the 1st appender.
        static plog::ColorConsoleAppender<plog::FuncMessageFormatter> consoleAppender;
        plog::init(plog::debug, &consoleAppender);
        plog::get()->setMaxSeverity(getLevel());

        // Create the 2nd appender.
        static plog::RollingFileAppender<plog::FuncMessageFormatter>
        fileAppender(getLogPath().c_str(), getMaxFileSize(), getMaxFiles());
        plog::get()->addAppender(&fileAppender);

        // Create the 3nd appender.
        static plog::OutputDebugStringAppender<plog::FuncMessageFormatter> OutputDebugStringAppender; // Create our custom appender.
        plog::get()->addAppender(&OutputDebugStringAppender);
    }