Make starter actually start on the roboRIO
Some of the commands run need to actually run as root. Make sure you
are root for those.
We also were missing channels, and some channels needed to be bigger.
Change-Id: I33b474bc51be01558cc4675a0b1c4510beb2c0a3
diff --git a/frc971/wpilib/wpilib_robot_base.h b/frc971/wpilib/wpilib_robot_base.h
index e34e3ad..33a17bc 100644
--- a/frc971/wpilib/wpilib_robot_base.h
+++ b/frc971/wpilib/wpilib_robot_base.h
@@ -48,18 +48,19 @@
class WPILibAdapterRobot : public frc::RobotBase {
public:
void StartCompetition() override {
+ PCHECK(setuid(0) == 0) << ": Failed to change user to root";
// Just allow overcommit memory like usual. Various processes map memory
// they will never use, and the roboRIO doesn't have enough RAM to handle
// it. This is in here instead of starter.sh because starter.sh doesn't run
// with permissions on a roboRIO.
- AOS_CHECK(system("echo 0 > /proc/sys/vm/overcommit_memory") == 0);
+ PCHECK(system("echo 0 > /proc/sys/vm/overcommit_memory") == 0);
// Configure throttling so we reserve 5% of the CPU for non-rt work.
// This makes things significantly more stable when work explodes.
// This is in here instead of starter.sh for the same reasons, starter is
// suid and runs as admin, so this actually works.
- AOS_CHECK(system("/sbin/sysctl -w kernel.sched_rt_period_us=1000000") == 0);
- AOS_CHECK(system("/sbin/sysctl -w kernel.sched_rt_runtime_us=950000") == 0);
+ PCHECK(system("/sbin/sysctl -w kernel.sched_rt_period_us=1000000") == 0);
+ PCHECK(system("/sbin/sysctl -w kernel.sched_rt_runtime_us=950000") == 0);
robot_.Run();
}