bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/5] shutdown: Use new acpi RPC to halt machine, clean up


From: Samuel Thibault
Subject: Re: [PATCH 2/5] shutdown: Use new acpi RPC to halt machine, clean up
Date: Tue, 6 Sep 2022 00:49:09 +0200
User-agent: NeoMutt/20170609 (1.8.3)

Damien Zammit, le dim. 04 sept. 2022 03:47:14 +0000, a ecrit:
> This allows clean shutdown of all modern x86 machines
> (not just qemu) by using the acpi translator to call
> into libacpica code.

Way less hardcoded :D

> diff --git a/shutdown/shutdown.c b/shutdown/shutdown.c
> index f821b1f2..a4cc4a50 100644
> --- a/shutdown/shutdown.c
> +++ b/shutdown/shutdown.c
> @@ -56,8 +58,16 @@ struct port_class *trivfs_control_class;
>  kern_return_t
>  S_shutdown_shutdown(trivfs_protid_t server)
>  {
> -  disappear_via_acpi();
> -  return 0;
> +  kern_return_t err;
> +  mach_port_t acpi;
> +
> +  acpi = file_name_lookup (_SERVERS_ACPI, O_RDONLY, 0);

So that'd be O_RDWR to get access to the acpi_sleep RPC.

> +  if (acpi == MACH_PORT_NULL)
> +    return EIO;
> +
> +  err = acpi_sleep(acpi, SLEEP_STATE_S5);
> +
> +  return err;
>  }
> 
>  static int
> --
> 2.34.1
> 
> 
> 

-- 
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]