#ifndef __LinuxERROR_H__
#define __LinuxERROR_H__

#include <string>


struct Exception {
	Exception( const std::string& w, int c )
		: where( w ), code( c ) {}

	std::string where;
	int code;
};


inline bool IsErrorResult( int* res ) {
	return *res <0;
}
inline bool IsErrorResult( FILE** res ) {
	return res == 0;
}

inline bool IsErrorResult( void** res ) {
	return res == 0;
}

// Translate a Linux error code into a readable text message
inline std::string GetErrorText( int code ) {
	return strerror(code);
}

pointcut  Linux() = ""
		    || "% open(...)"
				|| "% close(...)"
		    ||  "% fork(...)"
				|| "% waitpid(...)"
				|| "% read(...)"
				|| "% write(...)"
				|| "% fopen(...)"
				|| "% malloc(...)"
				;

#endif // __LinuxERROR_H__

