mirror of
https://github.com/thepigeongenerator/cpusetcores.git
synced 2025-12-18 14:35:45 +01:00
update formatting
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
char const* const cpu_path = "/sys/devices/system/cpu/cpu%i/online";
|
const char *const cpu_path = "/sys/devices/system/cpu/cpu%i/online";
|
||||||
|
|
||||||
bool getcpu(uint32_t id) {
|
bool getcpu(uint32_t id) {
|
||||||
// get the file path
|
// get the file path
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdnoreturn.h>
|
#include <stdnoreturn.h>
|
||||||
|
|
||||||
noreturn void fatal(char const* fmt, ...) {
|
noreturn void fatal(const char *fmt, ...) {
|
||||||
char buf[128];
|
char buf[128];
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
|
|||||||
@@ -4,4 +4,4 @@
|
|||||||
#include <stdnoreturn.h>
|
#include <stdnoreturn.h>
|
||||||
|
|
||||||
// prints an error message and aborts execution
|
// prints an error message and aborts execution
|
||||||
noreturn void fatal(char const*, ...);
|
noreturn void fatal(const char *, ...);
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ int32_t main(int32_t argc, char** argv) {
|
|||||||
if (ncpus > mcpus) fatal("%i exeeds the maximum numbers of cpus available (%i)", ncpus, mcpus);
|
if (ncpus > mcpus) fatal("%i exeeds the maximum numbers of cpus available (%i)", ncpus, mcpus);
|
||||||
if (ncpus < 1) fatal("may not keep less than 1 cpu enabled, requested to enable %i", ncpus);
|
if (ncpus < 1) fatal("may not keep less than 1 cpu enabled, requested to enable %i", ncpus);
|
||||||
|
|
||||||
char const* const cpu_set_log = "set cpu %i to %hi\n";
|
const char *const cpu_set_log = "set cpu %i to %hi\n";
|
||||||
for (int32_t id = 1; id < mcpus; id++) { // start at CPU 1, as CPU 0 is not writeable
|
for (int32_t id = 1; id < mcpus; id++) { // start at CPU 1, as CPU 0 is not writeable
|
||||||
// whilst the id is less then the amount of cpus to enable
|
// whilst the id is less then the amount of cpus to enable
|
||||||
if (id < ncpus) {
|
if (id < ncpus) {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ uint8_t getoptions(int32_t argc, char* const* argv, int32_t* ncpus) {
|
|||||||
uint8_t opts = 0;
|
uint8_t opts = 0;
|
||||||
char opt;
|
char opt;
|
||||||
|
|
||||||
char const* const msg = "-%c has already been set";
|
const char *const msg = "-%c has already been set";
|
||||||
while ((opt = getopt(argc, argv, "lavi")) != -1) {
|
while ((opt = getopt(argc, argv, "lavi")) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'l':
|
case 'l':
|
||||||
|
|||||||
Reference in New Issue
Block a user