summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authornatano <natano@openbsd.org>2017-03-02 10:38:09 +0000
committernatano <natano@openbsd.org>2017-03-02 10:38:09 +0000
commit2d357aeded0106833319c29a54d2bb4b14c40d90 (patch)
tree65a308eef3237aa2a4cbc2d2c3e20c7e67104495 /sbin
parent8168 support jumbo frames; (diff)
downloadwireguard-openbsd-2d357aeded0106833319c29a54d2bb4b14c40d90.tar.xz
wireguard-openbsd-2d357aeded0106833319c29a54d2bb4b14c40d90.zip
Add a new sysctl machdep.lidaction. The sysctl works as follows:
machdep.lidaction=0 # do nothing machdep.lidaction=1 # suspend machdep.lidaction=2 # hibernate lidsuspend is just an alias for lidaction, so if you change one, the other one will have the same value. The plan is to remove machdep.lidsuspend eventually when people have upgraded their /ets/sysctl.conf. discussed with deraadt, who came up with the new MIB name no objections mlarkin ok stsp halex jcs
Diffstat (limited to 'sbin')
-rw-r--r--sbin/init/init.c12
-rw-r--r--sbin/reboot/reboot.c12
2 files changed, 11 insertions, 13 deletions
diff --git a/sbin/init/init.c b/sbin/init/init.c
index 208db53d438..a2dff9bfafa 100644
--- a/sbin/init/init.c
+++ b/sbin/init/init.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init.c,v 1.62 2016/09/05 10:20:40 gsoares Exp $ */
+/* $OpenBSD: init.c,v 1.63 2017/03/02 10:38:09 natano Exp $ */
/* $NetBSD: init.c,v 1.22 1996/05/15 23:29:33 jtc Exp $ */
/*-
@@ -1325,13 +1325,13 @@ f_nice_death(void)
int status;
#ifdef CPU_LIDSUSPEND
- int lidsuspend_mib[] = {CTL_MACHDEP, CPU_LIDSUSPEND};
- int dontsuspend = 0;
+ int mib[] = {CTL_MACHDEP, CPU_LIDACTION};
+ int lidaction = 0;
if ((death_howto & RB_POWERDOWN) &&
- (sysctl(lidsuspend_mib, 2, NULL, NULL, &dontsuspend,
- sizeof(dontsuspend)) == -1) && (errno != EOPNOTSUPP))
- warning("cannot disable lid suspend");
+ (sysctl(mib, 2, NULL, NULL, &lidaction,
+ sizeof(lidaction)) == -1) && (errno != EOPNOTSUPP))
+ warning("cannot disable lid action");
#endif
for (sp = sessions; sp; sp = sp->se_next) {
diff --git a/sbin/reboot/reboot.c b/sbin/reboot/reboot.c
index 266e6df9927..8f1f524d72c 100644
--- a/sbin/reboot/reboot.c
+++ b/sbin/reboot/reboot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: reboot.c,v 1.35 2016/08/27 01:56:07 guenther Exp $ */
+/* $OpenBSD: reboot.c,v 1.36 2017/03/02 10:38:09 natano Exp $ */
/* $NetBSD: reboot.c,v 1.8 1995/10/05 05:36:22 mycroft Exp $ */
/*
@@ -115,13 +115,11 @@ main(int argc, char *argv[])
#ifdef CPU_LIDSUSPEND
if (howto & RB_POWERDOWN) {
/* Disable suspending on laptop lid close */
- int mib[2];
- int lidsuspend = 0;
+ int mib[] = {CTL_MACHDEP, CPU_LIDACTION};
+ int lidaction = 0;
- mib[0] = CTL_MACHDEP;
- mib[1] = CPU_LIDSUSPEND;
- if (sysctl(mib, 2, NULL, NULL, &lidsuspend,
- sizeof(lidsuspend)) == -1 && errno != EOPNOTSUPP)
+ if (sysctl(mib, 2, NULL, NULL, &lidaction,
+ sizeof(lidaction)) == -1 && errno != EOPNOTSUPP)
warn("sysctl");
}
#endif /* CPU_LIDSUSPEND */