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
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
==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.
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==
==Syntax==
<PRE>
  DosSetProcessorStatus (procid, status)
#define INCL_DOS
#define INCL_DOSSPINLOCK
#include os2.h>


    APIRET DosSetProcessorStatus
        (ULONG procid, ULONG status)
</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:
 
*0 NO_ERROR
DosSetProcessorStatus returns one of the following values
*87 ERROR_INVALID_PARAMETER
 
* 0         NO_ERROR
* 87       ERROR_INVALID_PARAMETER
==Remarks==
 


==Example Code==
==Example Code==
<PRE>
<PRE>
#define INCL_DOS
#define INCL_DOSSPINLOCK
#include <os2.h>
int main(int argc, char *argv[], char *envp[]){
int main(int argc, char *argv[], char *envp[]){
   APIRET rc;
   APIRET rc;
Line 61: Line 48:
}
}
</PRE>
</PRE>
==Related Functions==
==Related Functions==
* [[OS2 API:CPI:DosGetProcessorStatus|DosGetProcessorStatus]]
*[[DosGetProcessorStatus]]
 


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

Latest revision as of 02:09, 21 February 2020

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

DosSetProcessorStatus (procid, 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

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

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