This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
2023-12-12 02:59:48 -05:00

37 lines
1.0 KiB
C++

#ifndef __HELP_FUN_H__
#define __HELP_FUN_H__
#include <assert.h>
#include <ctype.h> // for isspace
#include <errno.h>
#include <fcntl.h>
#include <stdio_ext.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <unistd.h> // for read
#include <vector>
#define BUF_LEN 4096
#define WHITESPACE " \t\n\r"
#define strneq(a, b, n) (strncmp((a), (b), (n)) == 0)
#define streq(a, b) (strcmp((a), (b)) == 0)
#define TASK_RUNNING 0x0000
#define TASK_INTERRUPTIBLE 0x0001
#define TASK_UNINTERRUPTIBLE 0x0002
#define __TASK_STOPPED 0x0004
#define __TASK_TRACED 0x0008
#define TASK_PARKED 0x0040
#define TASK_DEAD 0x0080
#define TASK_WAKEKILL 0x0100
#define TASK_NOLOAD 0x0200
#define TASK_KILLABLE (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE)
#define TASK_STOPPED (TASK_WAKEKILL | __TASK_STOPPED)
#define TASK_IDLE (TASK_UNINTERRUPTIBLE | TASK_NOLOAD)
extern unsigned long run_in_host; // 0: container, 1: host
int check_in_host(void); // for run_in_host
std::string state_str(int __state); // task state to string
#endif