📄 utility.h
字号:
#ifndef UTILITY_H_
#define UTILITY_H_
#include <time.h>
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <ctype.h>
#include <stdarg.h>
#include <syslog.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/msg.h>
#include <sys/shm.h>
#include <sys/sem.h>
#include <sys/poll.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/timeb.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/sysctl.h>
#include <sys/time.h>
#include <sys/ipc.h>
#if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)
/* union semun is defined by including <sys/sem.h> */
#else
/* according to X/OPEN we have to define it ourselves */
union semun
{
int val; /* value for SETVAL */
struct semid_ds *buf; /* buffer for IPC_STAT, IPC_SET */
unsigned short *array; /* array for GETALL, SETALL */
/* Linux specific part: */
struct seminfo *__buf; /* buffer for IPC_INFO */
};
#endif
void log_sys_err(const char *fmt, ...);
void log_info(const char *fmt, ...);
int Open (const char *pathname, int oflag, mode_t mode);
void Close (int fd);
ssize_t Read (int fd, void *ptr, size_t nbytes);
ssize_t Write (int fd, void *ptr, size_t nbytes);
void Dup2 (int fd1, int fd2);
int Fcntl (int fd, int cmd, int arg);
int Ioctl (int fd, int request, void *arg);
int Mkstemp (char *templates);
void *Mmap (void *addr, size_t len, int prot, int flags, int fd, off_t offset);
void Munmap (void *addr, size_t len);
int Mkfifo (const char *pathname, mode_t mode);
char *Strdup (const char *str);
void Fclose (FILE * fp);
FILE *Fdopen (int fd, const char *type);
char *Fgets (char *ptr, int n, FILE * stream);
FILE *Fopen (const char *filename, const char *mode);
int Fseek (FILE *fp, long offset, int whence);
void Fputs (const char *ptr, FILE * stream);
void Fstat (int fd, struct stat *ptr);
void Ftruncate (int fd, off_t length);
off_t Lseek (int fd, off_t offset, int whence);
void Stat (const char *pathname, struct stat *ptr);
void IntToC4 (unsigned char *pbuf, unsigned int num);
void C4ToInt (unsigned int *num, unsigned char *pbuf);
void IntToC2 (unsigned char *pbuf, unsigned int num);
void C2ToInt (unsigned int *num, unsigned char *pbuf);
double Atof(char *str);
long int Atol(char *str);
int Atoi(char *str);
unsigned short SwapHostToNetwork( unsigned short num );
key_t Ftok(const char *pathname, int pro_id);
int Msgget(key_t key, int oflag);
int Msgsnd(int msgqid, const void *ptr, size_t length, int flag);
ssize_t Msgrcv(int msgqid, void *ptr, size_t length, long type, int flag);
int Msgctl(int msgid, int cmd, struct msqid_ds *buf);
#endif /*UTILITY_H_*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -