Jump to content

DosGetProcessorStatus: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
Line 6: Line 6:
#define INCL_DOS
#define INCL_DOS
#define INCL_DOSSPINLOCK
#define INCL_DOSSPINLOCK
#include os2.h>
#include <os2.h>


     APIRET APRIENTRY DosGetProcessorStatus
     APIRET APRIENTRY DosGetProcessorStatus
Line 12: Line 12:
</PRE>
</PRE>
==Parameters==
==Parameters==
; procid (ULONG) input : Procesor ID numbered 1 through n, where there are n processors in total  
;procid (ULONG) input : Procesor ID numbered 1 through n, where there are n processors in total
 
;status (PULONG) output : Status is defined as follows
; status (PULONG) output : Status is defined as follows
::PROC_OFFLINE 0x00000000 Processor is offline  
 
::PROC_ONLINE 0x00000001 Processor is online
    PROC_OFFLINE 0x00000000
        Processor is offline  
    PROC_ONLINE 0x00000001
        Processor is online


==Return Code==
==Return Code==
  ulrc (APIRET) returns
  ulrc (APIRET) returns
DosGetProcessorStatus returns one of the following values
DosGetProcessorStatus returns one of the following values
 
* 0 NO_ERROR
* 0         NO_ERROR
* 87 ERROR_INVALID_PARAMETER
* 87       ERROR_INVALID_PARAMETER
 
==Remarks==
 


==Example Code==
==Example Code==
Line 63: Line 53:
}
}
</PRE>
</PRE>
==Related Functions==
==Related Functions==
* [[OS2 API:CPI:DosSetProcessorStatus|DosSetProcessorStatus]]
* [[DosSetProcessorStatus]]
 


[[Category:The OS/2 API Project]]
[[Category:Dos]]

Revision as of 23:36, 23 November 2016

Description

DosGetProcessorStatus returns the ONLINE or OFFLINE status of each processor of an SMP system. The processor status may be set using DosSetProcessorStatus. ONLINE status imples the processor is available for running work. OFFLINE status implies the processor is not available for running work.

Syntax

#define INCL_DOS
#define INCL_DOSSPINLOCK
#include <os2.h>

    APIRET APRIENTRY DosGetProcessorStatus
        (ULONG procid, PULONG status)

Parameters

procid (ULONG) input
Procesor ID numbered 1 through n, where there are n processors in total
status (PULONG) output
Status is defined as follows
PROC_OFFLINE 0x00000000 Processor is offline
PROC_ONLINE 0x00000001 Processor is online

Return Code

ulrc (APIRET) returns

DosGetProcessorStatus returns one of the following values

  • 0 NO_ERROR
  • 87 ERROR_INVALID_PARAMETER

Example Code

int main(int argc, char *argv[], char *envp[]){
   APIRET rc=0;
   ULONG procid;
   ULONG status;
   int i;

   if (argc == 1) {
      for (procid=1; rc==0 ;++procid) {
         rc = DosGetProcessorStatus(procid,  status);
         if (rc==0) {
            if (status == PROC_OFFLINE) printf("Processor %u offline\n", procid);
            else printf("Processor %u online\n", procid);
         } /* endif */
      } /* endfor */

   } else for (i=1; i argc ; ++i) {
      procid = atol(argv[i]);
      rc = DosGetProcessorStatus(procid,  status);
      if (rc) printf("DosGetProcesorStatus returned %u\n",rc);
      else {
         if (status == PROC_OFFLINE) printf("Processor %u offline\n", procid);
         else printf("Processor %u online\n", procid);
      } /* endif */
   } /* endfor */

   return rc;
}

Related Functions