Jump to content

DosSetProcessorStatus: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
Ak120 (talk | contribs)
(No difference)

Revision as of 23:38, 23 November 2016

Description

DosSetProcessorStatus sets the ONLINE or OFFLINE status of a processor on an SMP system. The processor status may be queried using DosGetProcessorStatus. ONLINE status implies the processor is available for running work. OFFLINE status implies the processor is not available for running work. The processor that executes DosSetProcessorStatus must be ONLINE.

Syntax

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

    APIRET DosSetProcessorStatus
        (ULONG procid, ULONG status)

Parameters

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

Return Code

ulrc (APIRET) returns

DosSetProcessorStatus 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;
   ULONG procid;
   ULONG status;
   int i;

   if (argc   3) {
      printf("Syntax  SETPROC  ON|OFF\n");
      return 0;
   } /* endif */

   if (strcmpi(argv[argc-1],"OFF")==0) status = 0;
   else if (strcmpi(argv[argc-1],"ON")==0) status = 1;
   else {
      printf("Syntax  SETPROC  ON|OFF\n");
      return 0;
   } /* endif */

   for (i=1; i argc-1; ++i ) {
      procid = atol(argv[i]);
      rc = DosSetProcessorStatus(procid, status);
      if (rc) printf("DosSetProcesorStatus returned %u\n",rc);
   } /* endfor */

   return rc;
}

Related Functions