From 68826376ee5f47783c644c6604f4411ec747cd7e Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Fri, 14 Nov 2025 23:52:16 +0800
Subject: [PATCH] Add UDP DNS client source code
---
project/4.mqttd/booster/proc.h | 89 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 89 insertions(+), 0 deletions(-)
diff --git a/project/4.mqttd/booster/proc.h b/project/4.mqttd/booster/proc.h
new file mode 100644
index 0000000..1a8a14e
--- /dev/null
+++ b/project/4.mqttd/booster/proc.h
@@ -0,0 +1,89 @@
+/********************************************************************************
+ * Copyright: (C) 2020 LingYun IoT System Studio
+ * All rights reserved.
+ *
+ * Filename: proc.h
+ * Description: This head file is for Linux process/thread API
+ *
+ * Version: 1.0.0(7/06/2012~)
+ * Author: Guo Wenxue <guowenxue@gmail.com>
+ * ChangeLog: 1, Release initial version on "7/06/2012 09:21:33 PM"
+ *
+ ********************************************************************************/
+
+#ifndef __PROC_H_
+#define __PROC_H_
+
+#include <signal.h>
+#include <time.h>
+
+#define PID_ASCII_SIZE 11
+
+typedef struct proc_signal_s
+{
+ int signal;
+ unsigned stop; /* 0: Not term 1: Stop */
+} proc_signal_t;
+
+typedef void *(* thread_body_t) (void *thread_arg);
+
+extern proc_signal_t g_signal;
+
+/* install default signal process functions */
+extern void install_default_signal(void);
+
+/* excute a linux command by system() */
+extern void exec_system_cmd(const char *format, ...);
+
+/* check program already running or not, if not then run it and record pid into $pidfile */
+extern int check_set_program_running(int daemon, char *pidfile);
+
+/* check program already running or not from $pid_file */
+extern int check_daemon_running(const char *pid_file);
+
+/* set program daemon running and record pid in $pid_file */
+extern int set_daemon_running(const char *pid_file);
+
+/* record proces ID into $pid_file */
+extern int record_daemon_pid(const char *pid_file);
+
+/* stop program running from $pid_file */
+extern int stop_daemon_running(const char *pid_file);
+
+/* my implementation for set program running in daemon */
+extern void daemonize(int nochdir, int noclose);
+
+/* start a new thread to run $thread_workbody point function */
+extern int thread_start(pthread_t *thread_id, thread_body_t thread_workbody, void *thread_arg);
+
+/* +---------------------+
+ * | Low level API |
+ * +---------------------+*/
+
+/* get daemon process ID from $pid_file */
+extern pid_t get_daemon_pid(const char *pid_file);
+
+/* +------------------------+
+ * | inline functions API |
+ * +------------------------+*/
+static inline void msleep(unsigned long ms)
+{
+ struct timespec cSleep;
+ unsigned long ulTmp;
+
+ cSleep.tv_sec = ms / 1000;
+ if (cSleep.tv_sec == 0)
+ {
+ ulTmp = ms * 10000;
+ cSleep.tv_nsec = ulTmp * 100;
+ }
+ else
+ {
+ cSleep.tv_nsec = 0;
+ }
+
+ nanosleep(&cSleep, 0);
+ return ;
+}
+
+#endif
--
Gitblit v1.9.1