/*
 * pin <pid> - pin a process to cpu0 (root helper for the DF-2896 harness).
 * int usched_set(pid_t pid, int cmd, void *data, int bytes); SYS=481
 */
#include <sys/types.h>
#include <sys/syscall.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int
main(int argc, char **argv)
{
	int cpu = 0;
	long r;

	if (argc < 2) return (1);
	r = syscall(481, (pid_t)atoi(argv[1]), 1 /*USCHED_SET_CPU*/,
	    &cpu, sizeof(cpu));
	printf("pin %s -> cpu0: %ld (%m)\n", argv[1], r);
	return (r == 0 ? 0 : 1);
}
