Jump to content

DosSetProcessorStatus: Difference between revisions

From EDM2
Created page with "==Description== DosSetProcessorStatus sets the ONLINE or OFFLINE status of a processor on an SMP system. The processor status may be queried using DosGetProcessorStatus. ONLIN..."
 
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 DosSetProcessorStatus
     APIRET DosSetProcessorStatus
Line 12: Line 12:
</PRE>
</PRE>
==Parameters==
==Parameters==
; procid (ULONG) input : Processor ID numbered from 1 through n, where there are n processors in total.  
;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
; status (ULONG) input : 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
DosSetProcessorStatus returns one of the following values
DosSetProcessorStatus 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 61: Line 52:
}
}
</PRE>
</PRE>
==Related Functions==
==Related Functions==
* [[OS2 API:CPI:DosGetProcessorStatus|DosGetProcessorStatus]]
*[[DosGetProcessorStatus]]
 


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

Revision as of 23:34, 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