📄 plibc.h
字号:
/* This file is part of PlibC. (C) 2005, 2006, 2007 Nils Durner (and other contributing authors) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA*//** * @file include/plibc.h * @brief PlibC header * @attention This file is usually not installed under Unix, * so ship it with your application * @version $Revision: 1.37 $ */#ifndef _PLIBC_H_#define _PLIBC_H_#ifndef SIGALRM#define SIGALRM 14#endif#ifdef __cplusplusextern "C"{#endif#ifdef Q_OS_WIN32#define WINDOWS 1#endif#ifdef WINDOWS#if ENABLE_NLS#include "langinfo.h"#endif#include <windows.h>#include <Ws2tcpip.h>#include <time.h>#include <stdio.h>#include <sys/types.h>#include <sys/stat.h>#include <dirent.h>#include <errno.h>#include <stdarg.h>#define __BYTE_ORDER BYTE_ORDER#define __BIG_ENDIAN BIG_ENDIAN/* Conflicts with our definitions */#define __G_WIN32_H__/* Convert LARGE_INTEGER to double */#define Li2Double(x) ((double)((x).HighPart) * 4.294967296E9 + \ (double)((x).LowPart))#define socklen_t int#define ssize_t int#ifndef HAVE_FTRUNCATE#define ftruncate chsize#endif#define off_t int#define int64_t long long#define int32_t long struct stat64 { _dev_t st_dev; _ino_t st_ino; _mode_t st_mode; short st_nlink; short st_uid; short st_gid; _dev_t st_rdev; __int64 st_size; __time64_t st_atime; __time64_t st_mtime; __time64_t st_ctime; };#ifndef pid_t#define pid_t int#endif#ifndef WEXITSTATUS#define WEXITSTATUS(status) (((status) & 0xff00) >> 8)#endif/* Thanks to the Cygwin project */#define ENOCSI 43 /* No CSI structure available */#define EL2HLT 44 /* Level 2 halted */#ifndef EDEADLK#define EDEADLK 45 /* Deadlock condition */#endif#ifndef ENOLCK#define ENOLCK 46 /* No record locks available */#endif#define EBADE 50 /* Invalid exchange */#define EBADR 51 /* Invalid request descriptor */#define EXFULL 52 /* Exchange full */#define ENOANO 53 /* No anode */#define EBADRQC 54 /* Invalid request code */#define EBADSLT 55 /* Invalid slot */#ifndef EDEADLOCK#define EDEADLOCK EDEADLK /* File locking deadlock error */#endif#define EBFONT 57 /* Bad font file fmt */#define ENOSTR 60 /* Device not a stream */#define ENODATA 61 /* No data (for no delay io) */#define ETIME 62 /* Timer expired */#define ENOSR 63 /* Out of streams resources */#define ENONET 64 /* Machine is not on the network */#define ENOPKG 65 /* Package not installed */#define EREMOTE 66 /* The object is remote */#define ENOLINK 67 /* The link has been severed */#define EADV 68 /* Advertise error */#define ESRMNT 69 /* Srmount error */#define ECOMM 70 /* Communication error on send */#define EPROTO 71 /* Protocol error */#define EMULTIHOP 74 /* Multihop attempted */#define ELBIN 75 /* Inode is remote (not really error) */#define EDOTDOT 76 /* Cross mount point (not really error) */#define EBADMSG 77 /* Trying to read unreadable message */#define ENOTUNIQ 80 /* Given log. name not unique */#define EBADFD 81 /* f.d. invalid for this operation */#define EREMCHG 82 /* Remote address changed */#define ELIBACC 83 /* Can't access a needed shared lib */#define ELIBBAD 84 /* Accessing a corrupted shared lib */#define ELIBSCN 85 /* .lib section in a.out corrupted */#define ELIBMAX 86 /* Attempting to link in too many libs */#define ELIBEXEC 87 /* Attempting to exec a shared library */#ifndef ENOSYS#define ENOSYS 88 /* Function not implemented */#endif#define ENMFILE 89 /* No more files */#ifndef ENOTEMPTY#define ENOTEMPTY 90 /* Directory not empty */#endif#ifndef ENAMETOOLONG#define ENAMETOOLONG 91 /* File or path name too long */#endif#define ELOOP 92 /* Too many symbolic links */#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */#define EPFNOSUPPORT 96 /* Protocol family not supported */#define ECONNRESET 104 /* Connection reset by peer */#define ENOBUFS 105 /* No buffer space available */#define EAFNOSUPPORT 106 /* Address family not supported by protocol family */#define EPROTOTYPE 107 /* Protocol wrong type for socket */#define ENOTSOCK 108 /* Socket operation on non-socket */#define ENOPROTOOPT 109 /* Protocol not available */#define ESHUTDOWN 110 /* Can't send after socket shutdown */#define ECONNREFUSED 111 /* Connection refused */#define EADDRINUSE 112 /* Address already in use */#define ECONNABORTED 113 /* Connection aborted */#define ENETUNREACH 114 /* Network is unreachable */#define ENETDOWN 115 /* Network interface is not configured */#ifndef ETIMEDOUT#define ETIMEDOUT 116 /* Connection timed out */#endif#define EHOSTDOWN 117 /* Host is down */#define EHOSTUNREACH 118 /* Host is unreachable */#define EINPROGRESS 119 /* Connection already in progress */#define EALREADY 120 /* Socket already connected */#define EDESTADDRREQ 121 /* Destination address required */#define EMSGSIZE 122 /* Message too long */#define EPROTONOSUPPORT 123 /* Unknown protocol */#define ESOCKTNOSUPPORT 124 /* Socket type not supported */#define EADDRNOTAVAIL 125 /* Address not available */#define ENETRESET 126 /* Connection aborted by network */#define EISCONN 127 /* Socket is already connected */#define ENOTCONN 128 /* Socket is not connected */#define ETOOMANYREFS 129 /* Too many references: cannot splice */#define EPROCLIM 130 /* Too many processes */#define EUSERS 131 /* Too many users */#define EDQUOT 132 /* Disk quota exceeded */#define ESTALE 133 /* Unknown error */#ifndef ENOTSUP#define ENOTSUP 134 /* Not supported */#endif#define ENOMEDIUM 135 /* No medium (in tape drive) */#define ENOSHARE 136 /* No such host or network path */#define ECASECLASH 137 /* Filename exists with different case */#define EWOULDBLOCK EAGAIN /* Operation would block */#define EOVERFLOW 139 /* Value too large for defined data type */#undef HOST_NOT_FOUND#define HOST_NOT_FOUND 1#undef TRY_AGAIN#define TRY_AGAIN 2#undef NO_RECOVERY#define NO_RECOVERY 3#undef NO_ADDRESS#define NO_ADDRESS 4#define PROT_READ 0x1#define PROT_WRITE 0x2#define MAP_SHARED 0x1#define MAP_PRIVATE 0x2 /* unsupported */#define MAP_FIXED 0x10#define MAP_FAILED ((void *)-1) struct statfs { long f_type; /* type of filesystem (see below) */ long f_bsize; /* optimal transfer block size */ long f_blocks; /* total data blocks in file system */ long f_bfree; /* free blocks in fs */ long f_bavail; /* free blocks avail to non-superuser */ long f_files; /* total file nodes in file system */ long f_ffree; /* free file nodes in fs */ long f_fsid; /* file system id */ long f_namelen; /* maximum length of filenames */ long f_spare[6]; /* spare for later */ };/* Taken from the Wine project <http://www.winehq.org> /wine/include/winternl.h */ enum SYSTEM_INFORMATION_CLASS { SystemBasicInformation = 0, Unknown1, SystemPerformanceInformation = 2, SystemTimeOfDayInformation = 3, /* was SystemTimeInformation */ Unknown4, SystemProcessInformation = 5, Unknown6, Unknown7, SystemProcessorPerformanceInformation = 8, Unknown9, Unknown10, SystemDriverInformation, Unknown12, Unknown13, Unknown14, Unknown15, SystemHandleList, Unknown17, Unknown18, Unknown19, Unknown20, SystemCacheInformation, Unknown22, SystemInterruptInformation = 23, SystemExceptionInformation = 33, SystemRegistryQuotaInformation = 37, SystemLookasideInformation = 45 }; typedef struct { LARGE_INTEGER IdleTime; LARGE_INTEGER KernelTime; LARGE_INTEGER UserTime; LARGE_INTEGER Reserved1[2]; ULONG Reserved2; } SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION;#define sleep(secs) (Sleep(secs * 1000))/*********************** statfs *****************************//* fake block size */#define FAKED_BLOCK_SIZE 512/* linux-compatible values for fs type */#define MSDOS_SUPER_MAGIC 0x4d44#define NTFS_SUPER_MAGIC 0x5346544E/*********************** End of statfs ***********************/#define SHUT_RDWR SD_BOTH/* Operations for flock() */#define LOCK_SH 1 /* shared lock */#define LOCK_EX 2 /* exclusive lock */#define LOCK_NB 4 /* or'd with one of the above to prevent blocking */#define LOCK_UN 8 /* remove lock *//* Not supported under MinGW */#define S_IRGRP 0#define S_IWGRP 0#define S_IROTH 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -