`/usr/lib/pm-utils/sleep.d/94cpufreq`は何をしようとしていますか?

`/usr/lib/pm-utils/sleep.d/94cpufreq`は何をしようとしていますか?

私はUbuntu 16.04でシステムの基本ファイルを理解したいと思います/usr/lib/pm-utils/sleep.d/94cpufreq(その内容についてはこの記事の最後を見てください)。

"${PM_FUNCTIONS}"それがどこから来たのかスクリプトですか.

bashにある場合はecho "${PM_FUNCTIONS}" 何も出力されません。PM_FUNCTIONSこのスクリプトを呼び出す他のスクリプトで定義されていますか?

savestatestate_existsそしてrestorestate関数は"${PM_FUNCTIONS}"

変数TEMPORARY_CPUFREQ_GOVERNOR""${PM_FUNCTIONS}"

suspend|hibernateさらに、このスクリプトは何をしようとしていますかthaw|resume

ありがとうございます。

#!/bin/sh                                                                                                                                                                          
# Ensure cpu governor is set to something sane.                                                                                                                                    
# TODO: Which of the cpu governors is still insane?  File bugs against                                                                                                             
#       those that are.                                                                                                                                                            

. "${PM_FUNCTIONS}"

[ -d /sys/devices/system/cpu/ ] || exit $NA

hibernate_cpufreq()
{
  ( cd /sys/devices/system/cpu/
  for x in cpu[0-9]*; do
    # if cpufreq is a symlink, it is handled by another cpu. Skip.                                                                                                                 
    [ -L "$x/cpufreq" ] && continue
    gov="$x/cpufreq/scaling_governor"
    # if we do not have a scaling_governor file, skip.                                                                                                                             
    [ -f "$gov" ] || continue
    # if our temporary governor is not available, skip.                                                                                                                            
    grep -q "$TEMPORARY_CPUFREQ_GOVERNOR" \
            "$x/cpufreq/scaling_available_governors" || continue
    savestate "${x}_governor" < "$gov"
    echo "$TEMPORARY_CPUFREQ_GOVERNOR" > "$gov"
  done )
}

thaw_cpufreq()
{
  ( cd /sys/devices/system/cpu/
  for x in cpu[0-9]*/cpufreq/scaling_governor ; do
    [ -f "$x" ] || continue
    state_exists "${x%%/*}_governor" || continue
    restorestate "${x%%/*}_governor" > "$x"
  done )
}

case "$1" in
  suspend|hibernate)
    hibernate_cpufreq
    ;;
  resume|thaw)
    thaw_cpufreq
    ;;
  *) exit $NA
    ;;
esac

ベストアンサー1

関数state_existsなどは以下に定義されています。/usr/lib/pm-utils/関数そしてPM_FUNCTIONS台本を引用/usr/lib/pm-utils/pm-functions。はい、TEMPORARY_CPUFREQ_GOVERNORで定義されていますPM_FUNCTIONS

おすすめ記事