60 #ifdef OPENSSL_SYS_OS2
62 #define INCL_DOSPROCESS
63 #define INCL_DOSPROFILE
65 #define INCL_DOSMODULEMGR
68 #define CMD_KI_RDCNT (0x63)
70 typedef struct _CPUUTIL {
82 APIRET APIENTRY(*DosPerfSysCall) (ULONG ulCommand, ULONG ulParm1, ULONG ulParm2, ULONG ulParm3) = NULL;
83 APIRET APIENTRY(*DosQuerySysState) (ULONG
func, ULONG arg1, ULONG pid, ULONG _res_, PVOID buf, ULONG bufsz) = NULL;
85 HMODULE hDoscalls = 0;
89 char failed_module[20];
91 ULONG SysVars[QSV_FOREGROUND_PROCESS];
94 ULONG rc = DosLoadModule(failed_module,
sizeof(failed_module),
"DOSCALLS", &hDoscalls);
98 rc = DosQueryProcAddr(hDoscalls, 976, NULL, (PFN *)&DosPerfSysCall);
101 DosPerfSysCall = NULL;
103 rc = DosQueryProcAddr(hDoscalls, 368, NULL, (PFN *)&DosQuerySysState);
106 DosQuerySysState = NULL;
112 DosTmrQueryTime(&qwTime);
113 RAND_add(&qwTime,
sizeof(qwTime), 2);
116 DosQuerySysInfo(1, QSV_FOREGROUND_PROCESS, SysVars,
sizeof(SysVars));
117 RAND_add(SysVars,
sizeof(SysVars), 4);
122 if (DosPerfSysCall) {
125 if (DosPerfSysCall(CMD_KI_RDCNT, (ULONG)&util, 0, 0) == 0) {
130 DosPerfSysCall = NULL;
136 if (DosQuerySysState) {
139 if (DosQuerySysState(0x1F, 0, 0, 0, buffer, 256 * 1024) == 0) {
143 RAND_add(buffer, 256 * 1024, **(ULONG **)buffer);