|
|
#include <sys/ci/cilock.h> #include <sys/ci/cimpdata.h> #include <sys/ci/ciioctl.h>
These ioctl's are provided on multiprocessor configurations to allow programs to query the number of CPUs that are configured, to lock and unlock processes to specific CPUs, and to enable and disable specific CPUs.
Use these with the ioctl(S) system call. The first argument to ioctl( ) is a file descriptor, returned by an open(S) call to the /dev/at<XX> device, where <XX> is the CPU number.
int
pointed to by arg.
For example, on a 4-CPU configuration,
this ioctl yields a value of 3.
int
that contains
the pid to lock.
int
that contains
the pid to unlock.
For information about binding drivers to a CPU, see the Documentation for the Consolidated Hardware Development Kit, which can be downloaded from the Consolidated Hardware Development (HDK) Web Page. The documentation can be viewed at Documentation Web Page. Select the Open UNIX 8 or UnixWare 7 doc then click on "Hardware and Driver Development". Note especially the idistributed(D3oddi) and remap_driver_cpu(D3oddi) functions.
#include <sys/ci/cilock.h> #include <sys/ci/cimpdata.h> #include <sys/ci/ciioctl.h> #include <fcntl.h>int fd; int num_CPUs;
if ( (fd = open("/dev/at1", O_RDONLY)) < 0 ) perror("/dev/at1"); exit(1); }
if ( ioctl(fd, ACPU_GETNUM, &num_CPUs) < 0 ) { perror("ACPU_GETNUM"); exit(1); } printf("Total number of CPUs: %d\n", num_CPUs + 1);
int fd; int pid;if ( (fd = open("/dev/at2", O_RDONLY)) < 0 ) { perror("/dev/at2"); exit(1); }
pid = (int)getpid(); if ( ioctl(fd, ACPU_LOCK, &pid) < 0 ) { perror("ACPU_LOCK"); exit(1); }
printf("Process %d locked to CPU #2\n", pid);