00001 /* begin_generated_IBM_copyright_prolog */ 00002 /* */ 00003 /* This is an automatically generated copyright prolog. */ 00004 /* After initializing, DO NOT MODIFY OR MOVE */ 00005 /* ================================================================ */ 00006 /* IBM Confidential */ 00007 /* */ 00008 /* Licensed Machine Code Source Materials */ 00009 /* */ 00010 /* Product(s): */ 00011 /* Blue Gene/Q Licensed Machine Code */ 00012 /* */ 00013 /* (C) Copyright IBM Corp. 2011, 2011 */ 00014 /* */ 00015 /* The Source code for this program is not published or otherwise */ 00016 /* divested of its trade secrets, irrespective of what has been */ 00017 /* deposited with the U.S. Copyright Office. */ 00018 /* ================================================================ */ 00019 /* */ 00020 /* end_generated_IBM_copyright_prolog */ 00021 00022 //! \file MessageHeader.h 00023 //! \brief Declaration for bgcios::MessageHeader class. 00024 00025 #ifndef MESSAGEHEADER_H 00026 #define MESSAGEHEADER_H 00027 00028 // Includes 00029 #include <inttypes.h> 00030 #include <string.h> 00031 00032 namespace bgcios 00033 { 00034 00035 //! Header describing a I/O service message. 00036 00037 struct MessageHeader 00038 { 00039 uint8_t service; //!< Service to process message. 00040 uint8_t version; //!< Protocol version number. 00041 uint16_t type; //!< Content of message. 00042 uint32_t rank; //!< Rank message is associated with. 00043 uint32_t sequenceId; //!< Correlate requests and acknowledgements. 00044 uint32_t returnCode; //!< Result of previous request. 00045 uint32_t errorCode; //!< Error detail (typically errno value). 00046 uint32_t length; //!< Amount of data in message (including this header). 00047 uint64_t jobId; //!< Job message is associated with. 00048 }; 00049 00050 //! Values for service field of MessageHeader. 00051 00052 const uint8_t IosctlService = 1; //!< I/O control service. 00053 const uint8_t JobctlService = 2; //!< Job control service. 00054 const uint8_t StdioService = 3; //!< Standard I/O service. 00055 const uint8_t SysioService = 4; //!< System I/O service. 00056 const uint8_t ToolctlService = 5; //!< Tool control service. 00057 00058 //! Values for return code field of MessageHeader. 00059 00060 enum ReturnCode { 00061 Success = 0, //!< Success (no error). 00062 WrongService, //!< Service value in message header is not valid. 00063 UnsupportedType, //!< Type value in message header is not supported. 00064 JobIdError, //!< Job id value is not valid. 00065 ProcessIdError, //!< Rank value is not valid. 00066 RequestFailed, //!< Requested operation failed. 00067 SubBlockJobError, //!< Sub-block job specifications are not valid. 00068 SendError, //!< Sending a message failed. 00069 RecvError, //!< Receiving a message failed. 00070 VersionMismatch, //!< Protocol versions do not match. 00071 NodeNotReady, //!< Compute node is not ready for requested operation. 00072 SecondaryGroupIdError, //!< Setting secondary group id failed. 00073 PrimaryGroupIdError, //!< Setting primary group id failed. 00074 UserIdError, //!< Setting user id failed. 00075 WorkingDirError, //!< Changing to working directory failed. 00076 AppOpenError, //!< Opening application executable failed. 00077 AppAuthorityError, //!< No authority to application executable. 00078 AppReadError, //!< Reading data from application executable failed. 00079 AppElfHeaderSize, //!< Application executable ELF header is wrong size. 00080 AppElfHeaderError, //!< Application executable ELF header contains invalid value. 00081 AppNoCodeSection, //!< Application executable contains no code sections. 00082 AppCodeSectionSize, //!< Application executable code section is too big. 00083 AppSegmentAlignment, //!< Application executable segment has wrong alignment. 00084 AppTooManySegments, //!< Application executable has too many segments. 00085 AppStaticTLBError, //!< Generating static TLB map for application failed. 00086 AppMemoryError, //!< Initializing memory for process failed. 00087 ArgumentListSize, //!< Argument list has too many items. 00088 ToolStartError, //!< Starting tool process failed. 00089 ToolAuthorityError, //!< No authority to tool executable. 00090 ToolIdError, //!< Tool id is not valid. 00091 ToolTimeoutExpired, //!< Timeout expired ending a tool. 00092 ToolPriorityConflict, //!< Tool priority conflict. 00093 ToolMaxAttachedExceeded, //!< Tool maximum number of tools exceeded. 00094 ToolIdConflict, //!< Tool id conflict. 00095 JobsDirError, //!< Creating /jobs directory failed. 00096 JobsObjectError, //!< Creating object in /jobs directory failed. 00097 ToolPriorityError, //!< Tool priority level is not valid. 00098 ToolRankNotFound, //!< Tool request could not find requested target process. 00099 CornerCoreError, //!< Corner core number is not valid. 00100 NumCoresInProcessError, //!< Number of cores allocated to a process is not valid. 00101 ProcessActive, //!< Process is currently active on a hardware thread. 00102 NumProcessesError, //!< Number of processes on node is not valid. 00103 RanksInJobError, //!< Number of active ranks in job is not valid. 00104 ClassRouteDataError, //!< Class route data is not valid. 00105 ToolNumberOfCmdsExceeded, //!< Tool number of commands is not valid. 00106 RequestIncomplete, //!< Requested operation was partially successful. 00107 PrologPgmStartError, //!< Starting job prolog program process failed. 00108 PrologPgmError, //!< Job prolog program failed. 00109 EpilogPgmStartError, //!< Starting job epilog program process failed. 00110 EpilogPgmError, //!< Job epilog program failed. 00111 RequestInProgress, //!< Requested operation is currently in progress. 00112 ToolControlConflict, //!< Control authority conflict with another tool. 00113 NodesInJobError, //!< No compute nodes matched job specifications. 00114 ToolConflictingCmds, //!< An invalid combination of commands was specifed in the command list. 00115 ReturnCodeListEnd //!< End of the return code enumerations. 00116 }; 00117 00118 //! Default size for small message memory regions (match Linux page size). 00119 const uint32_t SmallMessageRegionSize = 65536; 00120 00121 //! Maximum size of data in a small message. 00122 const uint32_t SmallMessageDataSize = 65472; 00123 00124 //! Size of an immediate message (fits in one packet). 00125 const uint32_t ImmediateMessageSize = 512; 00126 00127 //! \brief Initialize message header. 00128 //! \param header Pointer to message header. 00129 //! \return Nothing. 00130 00131 inline void initHeader(struct MessageHeader *header) { memset(header, 0x00, sizeof(struct MessageHeader)); } 00132 00133 //! \brief Get the length of the data in a message (can be zero). 00134 //! \param header Pointer to message header. 00135 //! \return Length of data in message. 00136 00137 inline uint32_t dataLength(struct MessageHeader *header) { return header->length - sizeof(struct MessageHeader); } 00138 00139 } // namespace bgcios 00140 00141 #endif // MESSAGEHEADER_H 00142
1.6.1