⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 piplat.h

📁 mini http server,可以集成嵌入到程序中,实现简单的web功能
💻 H
📖 第 1 页 / 共 2 页
字号:
	PIPlatform_pollNetFD(). On other systems PIPlatform_pollFD() may not
	be implemented, see below under 'Errors'.

 Return Values:
	On success PIPlatform_pollFD() returns a value formed by OR'ing
	some of the values PIPLATFORM_POLL_READ and PIPLATFORM_POLL_WRITE together
	indicating which operations may be performed on file description fd
	without blocking.
	If the specified timeout period expires, PIPlatform_pollFD() returns
	a value of zero.

 Errors:
	On failure PIPlatform_pollNetFD() returns a negative value.

	More specific error information can be retreived using 
	PIPlatform_getLastError().

	On some systems PIPlatform_pollFD() is not yet implemented, in this
	case a value of PIAPI_ERROR will be returned and PIPlatform_getLastError()
	will return a value of PIAPI_NOTSUPPORTED.

 See Also:
	PIPlatform_pollNetFD(), PIPlatform_pollPipeFD(), PIPlatform_sleep().
\*____________________________________________________________________________*/
PUBLIC_PIAPI int PIPlatform_pollFD( PIPLATFORM_FD fd, int iFlags,
	int iTimeout );

/*____________________________________________________________________________*\
 *
 Name:
	PIPlatform_sleep

 Synopsis:
	int PIPlatform_sleep( int iMilliseconds )
	
 Description:
	Causes the current thread to sleep for at least iMilliseconds
	thousandths of a second. The current thread may sleep for longer
	than the specified time period. This is particularly true where
	user context threads are in use.

 Notes:
	If user context threads are being used and no other threads are
	runnable PIPlatform_sleep() will cause the process to enter a 
	'tight loop'. This may be expensive on CPU utilization with some
	programs.

 Return Values:
	On success PIPlatform_sleep() returns a value of 0. 

 Errors:
	On failure PIPlatform_sleep() returns a negative value.
	
	PIPlatform_getLastError() returns more specific error information.

 See Also:
	PIPlatform_pollNetFD(), PIPlatform_pollFD().
\*____________________________________________________________________________*/
PUBLIC_PIAPI int PIPlatform_sleep( int iMilliseconds );

/*____________________________________________________________________________*\
 *
 Name:
	PIPlatform_getLastError

 Synopsis:
	int PIPlatform_getLastError()
	
 Description:
	Returns the last error code for the current thread.

 Notes:
	Error codes are only set on error. Except where noted they are
	not cleared on success.

 Return Values:
	PIPlatform_getLastError() always returns the last error code.

 Errors:
	This function does not generate an error.

 See Also:
	PIPlatform_setLastError(), Errors.
\*____________________________________________________________________________*/
PUBLIC_PIAPI int PIPlatform_getLastError();

/*____________________________________________________________________________*\
 *
 Name:
	PIPlatform_setLastError

 Synopsis:
	void PIPlatform_setLastError( int iErrorCode )
	
 Description:
	Set the error code for this thread. Subsequent calls to 
	PIPlatform_getLastError() will return this error code.

 Notes:

 Return Values:
	PIPlatform_setLastError() does not return a value.

 Errors:
	This function does not generate an error.

 See Also:
	PIPlatform_getLastError(), Errors
\*____________________________________________________________________________*/
PUBLIC_PIAPI void PIPlatform_setLastError( int iErrorCode );

/*____________________________________________________________________________*\
 *
 Name:
	PIPlatform_catchExceptions

 Synopsis:
	void PIPlatform_catchExceptions( void (*)(void *)pFn, void *pArg )
	
 Description:
	This function does execute the function pFN with argument pArg
	using low level error handling in the Pi3 platform.

 Notes:
 	The function is used internally by PIProgram_enter.

 Return Values:
 Errors:
 	This function does not generate an error.

 See Also:
\*____________________________________________________________________________*/
PUBLIC_PIAPI void PIPlatform_catchExceptions(
	void (*)(void *), void * );

/*____________________________________________________________________________*\
 *
 Name:
	PIPlatform_beforeUnsafeBlock

 Synopsis:
	int PIPlatform_beforeUnsafeBlock()
	
 Description:
	Protects reentrance into non-thread safe blocks by blocking on a 
	semaphore.

 Notes:
	Calls to PIPlatform_beforeUnsafeBlock() must be matched by calls to
	PIPlatform_afterUnsafeBlock().

 Return Values:
	Returns 0 on success.
	
 Errors:
	On error a non-zero value is returned, the function
	PIPlatform_getLastError() can be used to get more specific error
	information.

 See Also:
	PIPlatform_afterUnsafeBlock
\*____________________________________________________________________________*/
PUBLIC_PIAPI int PIPlatform_beforeUnsafeBlock();

/*____________________________________________________________________________*\
 *
 Name:
	PIPlatform_afterUnsafeBlock

 Synopsis:
	int PIPlatform_afterUnsafeBlock()
	
 Description:
	Ends a block protected by reentrance with PIPlatform_beforeUnsafeBlock().

 Notes:

 Return Values:
	Returns 0 on success.

 Errors:
	On error a non-zero value is returned, the function
	PIPlatform_getLastError() can be used to get more specific error
	information.

 See Also:
	PIPlatform_beforeUnsafeBlock
\*____________________________________________________________________________*/
PUBLIC_PIAPI int PIPlatform_afterUnsafeBlock();

/*____________________________________________________________________________*\
 *
 Name:
	PIPlatform_getCurrentDirectory

 Synopsis:
	int PIPlatform_getCurrentDirectory( char *pBuffer, int iMaxLen )
	
 Description:
	Retrieve the current directory for the process and write it
	into the buffer pBuffer up to iMaxLen characters.

 Notes:
	The buffer pBuffer may not be null terminated if the length
	of the current directory is greater than or equal to iMaxLen.

 Return Values:
	Returns the length of the current directory. Although no more
	than iMaxLen characters will be written into pBuffer, 
	PIPlatform_getCurrentDirectory() may return a length greater
	than iMaxLen.

 Errors:
	On error PIPlatform_getCurrentDirectory() returns 0.
	PIPlatform_getLastError() can be used to get more specific error
	information.

 See Also:
\*____________________________________________________________________________*/
PUBLIC_PIAPI int PIPlatform_getCurrentDirectory( char *pBuffer, int iMaxLen );


/*____________________________________________________________________________*\
 *
 Name:
	PIPlatform_getDirectorySeparator

 Synopsis:
	char PIPlatform_getDirectorySeparator()
	
 Description:
	Retrieve the directory separator character for this platform.
	
 Notes:

 Return Values:
	Returns the operating system dependant directory separator
	character.

 Errors:
	On error PIPlatform_getDirectorySeparator() returns 0.

 See Also:
\*____________________________________________________________________________*/
PUBLIC_PIAPI char PIPlatform_getDirectorySeparator();

/*____________________________________________________________________________*\
 *
 Name:
	PIPlatform_getProcess

 Synopsis:
	int PIPlatform_getProcess()
	
 Description:
	Retrieve the platform specific identifier or handle for the current
	process.
	
 Notes:

 Return Values:
	Idenifier or handle of Current process.
	  
 Errors:
	PIPlatform_getProcess() does not generate errors.

 See Also:
	PIPlatform_getProcessId().
\*____________________________________________________________________________*/
PUBLIC_PIAPI int PIPlatform_getProcess();

/*____________________________________________________________________________*\
 *
 Name:
	PIPlatform_getProcessId

 Synopsis:
	int PIPlatform_getProcessId()
	
 Description:
	Retrieve the platform specific identifier for the current
	process.
	
 Notes:
	PIPlatform_getProcessId() differs from PIPlatform_getProcess() in that
	PIPlatform_getProcessId() always returns an integer process index that
	can be used to reference a specific process across all processes. 
	PIPlatform_getProcess() returns the native reference to a process and
	may only be valid within the process space of the current process.

 Return Values:
	Identifier for the Current process.
	  
 Errors:
	PIPlatform_getProcessId() does not generate errors.

 See Also:
	PIPlatform_getProcess().
\*____________________________________________________________________________*/
PUBLIC_PIAPI int PIPlatform_getProcessId();

/*____________________________________________________________________________*\
 *
 Name:
	PIPlatform_waitForProcess

 Synopsis:
	int PIPlatform_waitForProcess( int tProcess, int iFlags, int
		iTimeout )
	
 Description:
	Cause the current thread to sleep until the process specified by the
	operating system specific identifier or handle (tProcess) has 
	terminated. iFlags is reserved for future use and should always be 0.
	iTimeout specifies the maximum time to wait, measured in seconds.
	
 Notes:
	The parameter iFlags must be passed the value 0.

 Return Values:
	Returns PIAPI_COMPLETED on success, PIAPI_TIMEOUT on timeout,
	otherwise PIAPI_ERROR.
	  
 Errors:
	On error PIAPI_ERROR is returned. The function PIPlatform_getLastError()
	can be used to retreive more specific error information.

 See Also:
\*____________________________________________________________________________*/
PUBLIC_PIAPI int PIPlatform_waitForProcess( int tProcess, int iFlags,
	int iTimeout );

/*____________________________________________________________________________*\
 *
 Name:
	PIPlatform_advisaryLockFd

 Synopsis:
	PIPlatform_advisaryLockFd( PIPLATFORM_FD tFD )

 Description:
	Place an advisary lock on a file descriptor, blocking until the
	the lock can be obtained. The blocking is performed in an
	efficient manner for the process and thread model beng used.
	
 Notes:

 Return Values:
	On success PIPlatform_advisaryLockFd() returns zero (PIAPI_COMPLETED).

 Errors:
	On error, the function PIPlatform_getLastError() can be used to get 
	more specific error information.
		
 See Also:
	PIPlatform_advisaryUnlockFd()
\*____________________________________________________________________________*/
PUBLIC_PIAPI int PIPlatform_advisaryLockFd( PIPLATFORM_FD tFD );

/*____________________________________________________________________________*\
 *
 Name:
	PIPlatform_advisaryUnlockFd

 Synopsis:
	PIPlatform_advisaryUnlockFd( PIPLATFORM_FD tFD )

 Description:
	Release an advisary lock from a file descriptor, previously placed
	with PIPlatform_advisaryLockFd().
	
 Notes:

 Return Values:
	On success PIPlatform_advisaryUnlockFd() returns zero (PIAPI_COMPLETED).

 Errors:
	On error, the function PIPlatform_getLastError() can be used to get 
	more specific error information.
		
 See Also:
	PIPlatform_advisaryLockFd()
\*____________________________________________________________________________*/
PUBLIC_PIAPI int PIPlatform_advisaryUnlockFd( PIPLATFORM_FD tFD );

#endif	/* PIPLAT_H_ */

⌨️ 快捷键说明

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