Bug 251619 - sysutils/battmond: battmond dies after first suspend
Summary: sysutils/battmond: battmond dies after first suspend
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-05 20:52 UTC by dirtystickyfloor
Modified: 2020-12-05 21:57 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (ntarmos)


Attachments
proposed patch (411 bytes, text/plain)
2020-12-05 20:52 UTC, dirtystickyfloor
no flags Details
proposed patch (402 bytes, patch)
2020-12-05 21:57 UTC, dirtystickyfloor
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description dirtystickyfloor 2020-12-05 20:52:38 UTC
Created attachment 220293 [details]
proposed patch

I configured battmond to suspend instead of shutting down the system. In line 197 exec is used to invoke suspend:

execl("/usr/sbin/acpiconf", "acpiconf", "-s3", NULL);

As exec will replace the current process image with the new process, battmond is no longer running when the system resumes after battmond suspended for the first time.

To make sure that battmond is running after resume, I see two possible solutions:

1.) Replace exec with system
or
2.) Restart battmond on resume using rc-scripts

I attached a patch for solution #1
Comment 1 dirtystickyfloor 2020-12-05 21:29:51 UTC
Comment on attachment 220293 [details]
proposed patch

>--- battmond.c.orig	2020-12-05 20:19:13 UTC
>+++ battmond.c
>@@ -194,8 +194,7 @@ int main(int argc, char ** argv)
> 				if (dosuspend) { // Suspend
> 					syslog(LOG_EMERG, BATT_SUSP);
> 					close(acpifd);
>-					execl("/usr/sbin/acpiconf", "acpiconf", "-s3", NULL);
>-					oops("execl");
>+					system("/usr/sbin/acpiconf -s3");
> 				} else { // Halt
> 					syslog(LOG_EMERG, BATT_HALT);
> 					close(acpifd);
Comment 2 dirtystickyfloor 2020-12-05 21:57:08 UTC
Created attachment 220296 [details]
proposed patch