systemapi.cpp

来自「天之炼狱1服务器端源文件游戏服务端不完整」· C++ 代码 · 共 48 行

CPP
48
字号
//--------------------------------------------------------------------------------//// Filename   : SystemAPI.cpp// Written By : by Reiot////--------------------------------------------------------------------------------// include files#include "Types.h"#include "SystemAPI.h"#include <errno.h>#if __LINUX__	#include <unistd.h>		// fork()	extern int errno;#endif//--------------------------------------------------------------------------------//// exception version of fork()////--------------------------------------------------------------------------------int SystemAPI::fork_ex ()     throw ( Error ){	__BEGIN_TRY#if __LINUX__	int fd = fork();		if ( fd < 0 ) {		switch ( errno ) {			case EAGAIN : 				throw Error("fork  cannot  allocate  sufficient memory to copy the parent's page tables and allocate a task structure for the child.");			case ENOMEM : 				throw Error("fork failed to allocate the necessary kernel structures because memory is tight.");			default :				throw UnknownError(strerror(errno),errno);		}	}		return fd;#elif __WINDOWS__	throw UnsupportedError();#endif	__END_CATCH}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?