亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? gmain.c

?? 基于LINUX內(nèi)核驅(qū)動(dòng)的開發(fā)
?? C
?? 第 1 頁 / 共 2 頁
字號(hào):
#include <stdio.h>#include <errno.h>#include <fcntl.h>#include <unistd.h>#include <stdlib.h>#include <stdarg.h>#include <malloc.h>#include <string.h>#include <limits.h>#include <sys/time.h>#include <time.h>#include <sys/types.h>#include <sys/wait.h>#include <fcntl.h>#include <sys/stat.h>#include <sys/mman.h>#include <sys/file.h>#include <ctype.h>#include <dlfcn.h>#include <gmain.h>struct timeout {	guint id;	guint interval;	struct timeval expiration;	gpointer data;	GSourceFunc function;};struct _GIOChannel {	int fd;	int ref_count;	gboolean closed;	gboolean close_on_unref;};struct child_watch {	guint id;	GPid pid;	GChildWatchFunc function;	gpointer user_data;};struct _GMainContext {	guint next_id;	glong next_timeout;	GSList *timeouts;	GSList *proc_timeouts;	gboolean timeout_lock;	GSList *io_watches;	GSList *proc_io_watches;	gboolean io_lock;	GSList *child_watches;	GSList *proc_child_watches;	gboolean child_lock;};struct _GMainLoop {	gboolean is_running;	GMainContext *context;};GIOError g_io_channel_read(GIOChannel *channel, gchar *buf, gsize count,				gsize *bytes_read){	int fd = channel->fd;	gssize result;	if (channel->closed)		return G_IO_STATUS_ERROR;	/* At least according to the Debian manpage for read */	if (count > SSIZE_MAX)		count = SSIZE_MAX;retry:	result = read (fd, buf, count);	if (result < 0) {		*bytes_read = 0;		switch (errno) {#ifdef EINTR		case EINTR:			goto retry;#endif#ifdef EAGAIN		case EAGAIN:			return G_IO_STATUS_AGAIN;#endif		default:			return G_IO_STATUS_ERROR;		}	}	*bytes_read = result;	return (result > 0) ? G_IO_STATUS_NORMAL : G_IO_STATUS_EOF;}GIOError g_io_channel_write(GIOChannel *channel, const gchar *buf, gsize count,				gsize *bytes_written){	int fd = channel->fd;	gssize result;	if (channel->closed)		return G_IO_STATUS_ERROR;	/* At least according to the Debian manpage for read */	if (count > SSIZE_MAX)		count = SSIZE_MAX;retry:	result = write(fd, buf, count);	if (result < 0) {		*bytes_written = 0;		switch (errno) {#ifdef EINTR		case EINTR:			goto retry;#endif#ifdef EAGAIN		case EAGAIN:			return G_IO_STATUS_AGAIN;#endif		default:			return G_IO_STATUS_ERROR;		}	}	*bytes_written = result;	return (result > 0) ? G_IO_STATUS_NORMAL : G_IO_STATUS_EOF;}void g_io_channel_close(GIOChannel *channel){	if (!channel || channel->closed)		return;	close(channel->fd);	channel->closed = TRUE;}void g_io_channel_unref(GIOChannel *channel){	if (!channel)		return;	if (--channel->ref_count > 0)		return;	if (channel->close_on_unref && channel->fd >= 0)		g_io_channel_close(channel);	g_free(channel);}GIOChannel *g_io_channel_ref(GIOChannel *channel){	channel->ref_count++;	return channel;}GIOChannel *g_io_channel_unix_new(int fd){	GIOChannel *channel;	channel = g_new0(GIOChannel, 1);	channel->fd = fd;	channel->ref_count = 1;	return channel;}void g_io_channel_set_close_on_unref(GIOChannel *channel, gboolean do_close){	channel->close_on_unref = do_close;}gint g_io_channel_unix_get_fd(GIOChannel *channel){	if (channel->closed)		return -1;	return channel->fd;}struct io_watch {	guint id;	GIOChannel *channel;	gint priority;	GIOCondition condition;	short *revents;	GIOFunc func;	gpointer user_data;	GDestroyNotify destroy;};static GMainContext *default_context = NULL;static void watch_free(struct io_watch *watch){	if (watch->destroy)		watch->destroy(watch->user_data);	g_io_channel_unref(watch->channel);	g_free(watch);}static GMainContext *g_main_context_default(){	if (default_context)		return default_context;	default_context = g_new0(GMainContext, 1);	default_context->next_timeout = -1;	default_context->next_id = 1;	return default_context;}static gboolean g_io_remove_watch(GMainContext *context, guint id){	GSList *l;	struct io_watch *w;	for (l = context->io_watches; l != NULL; l = l->next) {		w = l->data;			if (w->id != id)			continue;		context->io_watches = g_slist_remove(context->io_watches, w);		watch_free(w);		return TRUE;	}	for (l = context->proc_io_watches; l != NULL; l = l->next) {		w = l->data;			if (w->id != id)			continue;		context->proc_io_watches = g_slist_remove(context->proc_io_watches, w);		watch_free(w);		return TRUE;	}	return FALSE;}static gboolean g_timeout_remove(GMainContext *context, const guint id){	GSList *l;	struct timeout *t;	l = context->timeouts;	while (l) {		t = l->data;		l = l->next;		if (t->id != id)			continue;		context->timeouts = g_slist_remove(context->timeouts, t);		g_free(t);		return TRUE;	}	l = context->proc_timeouts;	while (l) {		t = l->data;		l = l->next;		if (t->id != id)			continue;		context->proc_timeouts = g_slist_remove(context->proc_timeouts, t);		g_free(t);		return TRUE;	}	return FALSE;}int watch_prio_cmp(struct io_watch *w1, struct io_watch *w2){	return w1->priority - w2->priority;}#define watch_list_add(l, w) g_slist_insert_sorted((l), (w), (GCompareFunc) watch_prio_cmp)guint g_io_add_watch_full(GIOChannel *channel, gint priority,				GIOCondition condition, GIOFunc func,				gpointer user_data, GDestroyNotify notify){	struct io_watch *watch;	GMainContext *context = g_main_context_default();	watch = g_new(struct io_watch, 1);	watch->id = context->next_id++;	watch->channel = g_io_channel_ref(channel);	watch->priority = priority;	watch->condition = condition;	watch->func = func;	watch->user_data = user_data;	watch->destroy = notify;	if (context->io_lock)		context->proc_io_watches = watch_list_add(context->proc_io_watches, watch);	else		context->io_watches = watch_list_add(context->io_watches, watch);	return watch->id;}guint g_io_add_watch(GIOChannel *channel, GIOCondition condition,					GIOFunc func, gpointer user_data){	return g_io_add_watch_full(channel, 0, condition,						func, user_data, NULL);}GMainLoop *g_main_loop_new(GMainContext *context, gboolean is_running){	GMainLoop *ml;	if (!context)		context = g_main_context_default();	ml = g_new0(GMainLoop, 1);	ml->context = context;	ml->is_running = is_running;	return ml;}static void timeout_handlers_prepare(GMainContext *context){	GSList *l;	struct timeval tv;	glong msec, timeout = LONG_MAX;	gettimeofday(&tv, NULL);	for (l = context->timeouts; l != NULL; l = l->next) {		struct timeout *t = l->data;		/* calculate the remainning time */		msec = (t->expiration.tv_sec - tv.tv_sec) * 1000 +				(t->expiration.tv_usec - tv.tv_usec) / 1000;		if (msec < 0)			msec = 0;		timeout = MIN_TIMEOUT(timeout, msec);	}	/* set to min value found or NO timeout */	context->next_timeout = (timeout != LONG_MAX ? timeout : -1);}static int ptr_cmp(const void *t1, const void *t2){	return t1 - t2;}static void timeout_handlers_check(GMainContext *context){	struct timeval tv;	gettimeofday(&tv, NULL);	context->timeout_lock = TRUE;	while (context->timeouts) {		struct timeout *t = context->timeouts->data;		glong secs, msecs;		gboolean ret;		if (timercmp(&tv, &t->expiration, <)) {			context->timeouts = g_slist_remove(context->timeouts, t);			context->proc_timeouts = g_slist_append(context->proc_timeouts, t);			continue;		}		ret = t->function(t->data);		/* Check if the handler was removed/freed by the callback		 * function */		if (!g_slist_find_custom(context->timeouts, t, ptr_cmp))			continue;		context->timeouts = g_slist_remove(context->timeouts, t);		if (!ret) {			g_free(t);			continue;		}		/* update the next expiration time */		secs = t->interval / 1000;		msecs = t->interval - secs * 1000;		t->expiration.tv_sec = tv.tv_sec + secs;		t->expiration.tv_usec = tv.tv_usec + msecs * 1000;		if (t->expiration.tv_usec >= 1000000) {			t->expiration.tv_usec -= 1000000;			t->expiration.tv_sec++;		}		context->proc_timeouts = g_slist_append(context->proc_timeouts, t);	}	context->timeouts = context->proc_timeouts;	context->proc_timeouts = NULL;	context->timeout_lock = FALSE;}void g_main_loop_run(GMainLoop *loop){	int open_max = sysconf(_SC_OPEN_MAX);	struct pollfd *ufds;	GMainContext *context = loop->context;	ufds = g_new(struct pollfd, open_max);	loop->is_running = TRUE;	while (loop->is_running) {		int nfds;		GSList *l;		struct io_watch *w;		for (nfds = 0, l = context->io_watches; l != NULL; l = l->next, nfds++) {			w = l->data;			ufds[nfds].fd = w->channel->fd;			ufds[nfds].events = w->condition;			ufds[nfds].revents = 0;			w->revents = &ufds[nfds].revents;		}		/* calculate the next timeout */		timeout_handlers_prepare(context);		if (poll(ufds, nfds, context->next_timeout) < 0)			continue;		context->io_lock = TRUE;		while (context->io_watches) {			gboolean ret;			w = context->io_watches->data;			if (!*w->revents) {				context->io_watches = g_slist_remove(context->io_watches, w);				context->proc_io_watches = watch_list_add(context->proc_io_watches, w);				continue;			}			ret = w->func(w->channel, *w->revents, w->user_data);			/* Check if the watch was removed/freed by the callback			 * function */			if (!g_slist_find_custom(context->io_watches, w, ptr_cmp))				continue;			context->io_watches = g_slist_remove(context->io_watches, w);			if (!ret) {				watch_free(w);				continue;			}			context->proc_io_watches = watch_list_add(context->proc_io_watches, w);		}		context->io_watches = context->proc_io_watches;		context->proc_io_watches = NULL;		context->io_lock = FALSE;		/* check expired timers */		timeout_handlers_check(loop->context);	}	g_free(ufds);}void g_main_loop_quit(GMainLoop *loop){	loop->is_running = FALSE;}void g_main_loop_unref(GMainLoop *loop){	if (!loop->context)		return;	g_slist_foreach(loop->context->io_watches, (GFunc)watch_free, NULL);	g_slist_free(loop->context->io_watches);	g_slist_foreach(loop->context->timeouts, (GFunc)g_free, NULL);	g_slist_free(loop->context->timeouts);	g_free(loop->context);	loop->context = NULL;}guint g_timeout_add(guint interval, GSourceFunc function, gpointer data){	GMainContext *context = g_main_context_default();	struct timeval tv;	guint secs;	guint msecs;	struct timeout *t;	t = g_new0(struct timeout, 1);	t->interval = interval;	t->function = function;	t->data = data;	gettimeofday(&tv, NULL);	secs = interval /1000;	msecs = interval - secs * 1000;	t->expiration.tv_sec = tv.tv_sec + secs;	t->expiration.tv_usec = tv.tv_usec + msecs * 1000;	if (t->expiration.tv_usec >= 1000000) {		t->expiration.tv_usec -= 1000000;		t->expiration.tv_sec++;	}	/* attach the timeout the default context */	t->id = context->next_id++;	if (context->timeout_lock)		context->proc_timeouts = g_slist_prepend(context->proc_timeouts, t);	else		context->timeouts = g_slist_prepend(context->timeouts, t);	return t->id;}guint g_idle_add(GSourceFunc function, gpointer data){	return g_timeout_add(1, function, data);}/* GError */GError* g_error_new_literal(GQuark domain, gint code, const gchar *message){	GError *err;	err = g_new(GError, 1);	err->domain = domain;	err->code = code;	err->message = g_strdup(message);	return err;}void g_set_error(GError **err, GQuark domain, gint code,			const gchar *format, ...){	gchar msg[1024];	va_list ap;	if (!err)		return;	va_start(ap, format);	vsnprintf(msg, sizeof(msg) - 1, format, ap);	va_end(ap);	*err = g_error_new_literal(domain, code, msg);}void g_error_free(GError *err){	g_free(err->message);	g_free(err);}/* Spawning related functions */static int child_watch_pipe[2] = { -1, -1 };static void sigchld_handler(int signal){	int ret;	ret = write(child_watch_pipe[1], "B", 1);}static gboolean child_watch_remove(GMainContext *context, guint id){	GSList *l;	struct child_watch *w;	for (l = context->child_watches; l != NULL; l = l->next) {		w = l->data;		if (w->id != id)			continue;		context->child_watches =			g_slist_remove(context->child_watches, w);		g_free(w);		return TRUE;	}	for (l = context->proc_child_watches; l != NULL; l = l->next) {		w = l->data;		if (w->id != id)			continue;		context->proc_child_watches =			g_slist_remove(context->proc_child_watches, w);		g_free(w);		return TRUE;	}	return FALSE;}static gboolean child_watch(GIOChannel *io, GIOCondition cond, gpointer user_data){	int ret;	char b[20];	GMainContext *context = g_main_context_default();	ret = read(child_watch_pipe[0], b, 20);	context->child_lock = TRUE;	while (context->child_watches) {		gint status;		struct child_watch *w = context->child_watches->data;		if (waitpid(w->pid, &status, WNOHANG) <= 0) {			context->child_watches =				g_slist_remove(context->child_watches, w);			context->proc_child_watches =				watch_list_add(context->proc_child_watches, w);			continue;		}		w->function(w->pid, status, w->user_data);		/* Check if the callback already removed us */		if (!g_slist_find(context->child_watches, w))			continue;		context->child_watches = g_slist_remove(context->child_watches, w);		g_free(w);	}	context->child_watches = context->proc_child_watches;	context->proc_child_watches = NULL;	context->child_lock = FALSE;	return TRUE;}static void init_child_pipe(void){  	struct sigaction action;	GIOChannel *io;	if (pipe(child_watch_pipe) < 0) {		fprintf(stderr, "Unable to initialize child watch pipe: %s (%d)\n",				strerror(errno), errno);		abort();	}	fcntl(child_watch_pipe[1], F_SETFL,			O_NONBLOCK | fcntl(child_watch_pipe[1], F_GETFL));	action.sa_handler = sigchld_handler;	sigemptyset(&action.sa_mask);	action.sa_flags = SA_NOCLDSTOP;	sigaction(SIGCHLD, &action, NULL);	io = g_io_channel_unix_new(child_watch_pipe[0]);	g_io_add_watch(io, G_IO_IN, child_watch, NULL);	g_io_channel_unref(io);}static void exec_child(const gchar *working_directory,			gchar **argv, gchar **envp,			GSpawnFlags flags,			GSpawnChildSetupFunc child_setup,			gpointer user_data){	int null;	if (working_directory && chdir(working_directory) < 0)		_exit(EXIT_FAILURE);	if (!(flags & G_SPAWN_LEAVE_DESCRIPTORS_OPEN)) {		int open_max, fd, ret;		ret = 0;		open_max = sysconf(_SC_OPEN_MAX);		for (fd = 3; fd < open_max && ret == 0; fd++)			ret = fcntl(fd, F_SETFD, FD_CLOEXEC);	}	null = open("/dev/null", O_RDWR);	if (!(flags & G_SPAWN_CHILD_INHERITS_STDIN))		dup2(null, STDIN_FILENO);	if (flags & G_SPAWN_STDOUT_TO_DEV_NULL)		dup2(null, STDOUT_FILENO);	if (flags & G_SPAWN_STDERR_TO_DEV_NULL)		dup2(null, STDERR_FILENO);	if (null > 2)		close(null);	if (child_setup)		child_setup(user_data);	if (envp)		execve(argv[0], argv, envp);	else		execv(argv[0], argv);	/* exec failed if we get here */	_exit(EXIT_FAILURE);}gboolean g_spawn_async(const gchar *working_directory,			gchar **argv, gchar **envp,			GSpawnFlags flags,			GSpawnChildSetupFunc child_setup,			gpointer user_data,			GPid *child_pid,			GError **error){	GPid pid;	if (access(argv[0], X_OK) < 0) {		g_set_error(error, 0, 0, "%s is not executable", argv[0]);		return FALSE;	}	if (child_watch_pipe[0] < 0)		init_child_pipe();	/* Flush output streams so child doesn't get them */	fflush(NULL);	switch (pid = fork()) {	case -1:		g_set_error(error, 0, 0, "fork failed: %s", strerror(errno));		return FALSE;	case 0:			exec_child(working_directory, argv, envp, flags,				child_setup, user_data);		break;	default:		if (child_pid)			*child_pid = pid;		return TRUE;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91国内精品野花午夜精品| 久久综合色8888| 在线中文字幕一区二区| 99久久伊人久久99| 成人深夜福利app| 成人美女视频在线观看| 国产成人亚洲综合色影视| 国产精品亚洲成人| 国产ts人妖一区二区| 国产精品77777竹菊影视小说| 精久久久久久久久久久| 国产一区二区电影| 粉嫩高潮美女一区二区三区| 成人午夜免费av| 丁香婷婷综合激情五月色| 丁香六月久久综合狠狠色| 国产成人99久久亚洲综合精品| 国产一区二区三区黄视频 | 一区二区中文视频| 最近日韩中文字幕| 亚洲国产成人av好男人在线观看| 丝袜美腿高跟呻吟高潮一区| 三级欧美在线一区| 国产呦精品一区二区三区网站| 国产成人啪免费观看软件| www.欧美日韩| 欧美日韩精品一区二区| 日韩欧美亚洲一区二区| 中文字幕av一区二区三区高| 日韩伦理av电影| 日韩二区在线观看| 国产大片一区二区| 欧美做爰猛烈大尺度电影无法无天| 欧美福利视频导航| 国产丝袜在线精品| 一区二区三区在线影院| 无码av中文一区二区三区桃花岛| 久久国内精品视频| a4yy欧美一区二区三区| 884aa四虎影成人精品一区| 精品久久国产老人久久综合| 国产精品国模大尺度视频| 亚洲电影视频在线| 国产一区二区0| 色素色在线综合| 26uuu亚洲婷婷狠狠天堂| 国产精品视频yy9299一区| 亚洲妇女屁股眼交7| 国产精品一区久久久久| 欧美午夜在线一二页| 26uuu亚洲综合色| 亚洲精品videosex极品| 国产乱码精品1区2区3区| 91国在线观看| 欧美国产一区在线| 蜜臀精品一区二区三区在线观看| 99视频有精品| xvideos.蜜桃一区二区| 亚洲一区二区综合| 国产999精品久久| 欧美一区二区三区四区五区| 中文字幕字幕中文在线中不卡视频| 美国毛片一区二区| 欧美亚洲国产一区二区三区va| 国产欧美视频一区二区| 蜜臀av一区二区在线免费观看| 91日韩一区二区三区| 久久人人97超碰com| 三级在线观看一区二区| 91丨porny丨中文| 国产视频一区二区在线| 日韩1区2区日韩1区2区| 欧美自拍偷拍午夜视频| 欧美国产精品专区| 久久99国产精品麻豆| 欧美日韩精品一二三区| 最新不卡av在线| 粉嫩av亚洲一区二区图片| 日韩欧美一二区| 日本欧美一区二区| 欧美私人免费视频| 亚洲丝袜另类动漫二区| 成人免费视频视频| 国产日韩欧美亚洲| 久久er99精品| 日韩欧美aaaaaa| 美日韩一区二区三区| 色屁屁一区二区| 亚洲三级小视频| 懂色一区二区三区免费观看 | 中文文精品字幕一区二区| 蜜桃视频在线一区| 91精品国产91久久综合桃花| 亚洲综合在线五月| 在线视频国内自拍亚洲视频| 亚洲少妇30p| 91亚洲精华国产精华精华液| 欧美激情一区三区| 国产成人综合视频| 久久精品一区二区三区四区| 久久99精品久久久久久久久久久久| 777奇米四色成人影色区| 午夜日韩在线电影| 欧美日本在线播放| 日本欧美久久久久免费播放网| 欧美日韩精品是欧美日韩精品| 亚洲超丰满肉感bbw| 精品视频色一区| 天堂资源在线中文精品| 欧美人与z0zoxxxx视频| 日韩专区一卡二卡| 欧美成人女星排名| 国产乱码精品一区二区三区五月婷| 久久久高清一区二区三区| 国产精品影视网| 国产精品久久久久久久裸模| 93久久精品日日躁夜夜躁欧美| 一区二区三区成人| 这里是久久伊人| 精品一区二区国语对白| 国产午夜一区二区三区| av亚洲精华国产精华| 亚洲香肠在线观看| 日韩午夜小视频| 国产真实乱子伦精品视频| 国产精品99久久久| 国产精品一区专区| av在线不卡网| 色先锋资源久久综合| jlzzjlzz亚洲日本少妇| 美女高潮久久久| 青青草原综合久久大伊人精品| 精品粉嫩超白一线天av| 欧美三级中文字幕| 欧美中文字幕一区二区三区| 欧美大片一区二区| 国产一区二区三区免费播放| 国产精品午夜久久| 欧美性淫爽ww久久久久无| 亚洲成av人片一区二区三区| 欧美一区二区三区播放老司机| 经典一区二区三区| 亚洲品质自拍视频网站| 欧美一区二区三区免费视频| 国产成人精品三级麻豆| 洋洋av久久久久久久一区| 日韩欧美一区二区在线视频| 国产成人在线免费| 亚洲午夜电影在线| 久久婷婷国产综合精品青草| 97国产一区二区| 蜜桃av一区二区三区| 国产精品不卡一区二区三区| 欧美日韩国产天堂| 豆国产96在线|亚洲| 午夜在线成人av| 国产欧美一区在线| 9191久久久久久久久久久| 成人性视频免费网站| 日韩1区2区日韩1区2区| 国产精品久久久爽爽爽麻豆色哟哟| 欧美日韩国产高清一区二区三区| 国产不卡一区视频| 日本不卡123| 亚洲精选视频免费看| 26uuu亚洲综合色| 欧美卡1卡2卡| 色偷偷一区二区三区| 国产成人午夜精品影院观看视频 | 制服.丝袜.亚洲.中文.综合| 夫妻av一区二区| 日韩av午夜在线观看| 亚洲欧洲中文日韩久久av乱码| 久久综合999| 在线不卡中文字幕播放| 91麻豆国产自产在线观看| 国产又粗又猛又爽又黄91精品| 午夜亚洲国产au精品一区二区| 国产精品久久久久久久裸模| 精品成人私密视频| 欧美三级视频在线观看| 91视频免费观看| 国产在线国偷精品产拍免费yy| 欧美日韩电影在线| 夜夜精品浪潮av一区二区三区| 国产成人超碰人人澡人人澡| 国产一区二区看久久| 亚洲高清久久久| 亚洲欧洲精品一区二区精品久久久| 欧美mv和日韩mv国产网站| 欧美午夜宅男影院| 94-欧美-setu| a4yy欧美一区二区三区| 国产成人精品免费在线| 激情偷乱视频一区二区三区| 秋霞电影一区二区| 日日嗨av一区二区三区四区| 亚洲一二三四在线| 亚洲柠檬福利资源导航| 成人欧美一区二区三区视频网页 |