What does `/usr/lib/pm-utils/sleep.d/94cpufreq` try to do?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite












On my Ubuntu 16.04, I am trying to understand a system default file /usr/lib/pm-utils/sleep.d/94cpufreq (see the end of this post for its content.)



Is "$PM_FUNCTIONS" a script, given that it is sourced by .?



When I echo "$PM_FUNCTIONS" in bash, it outputs nothing. Is PM_FUNCTIONS defined in another script which calls the script?



Are savestate, state_exists, and restorestate functions defined in "$PM_FUNCTIONS"?



Is TEMPORARY_CPUFREQ_GOVERNOR" a variable defined in "$PM_FUNCTIONS"?



What does the script try to do upon suspend|hibernate and upon thaw|resume?



Thanks.



#!/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()


thaw_cpufreq()
continue
restorestate "$x%%/*_governor" > "$x"
done )


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






share|improve this question


























    up vote
    3
    down vote

    favorite












    On my Ubuntu 16.04, I am trying to understand a system default file /usr/lib/pm-utils/sleep.d/94cpufreq (see the end of this post for its content.)



    Is "$PM_FUNCTIONS" a script, given that it is sourced by .?



    When I echo "$PM_FUNCTIONS" in bash, it outputs nothing. Is PM_FUNCTIONS defined in another script which calls the script?



    Are savestate, state_exists, and restorestate functions defined in "$PM_FUNCTIONS"?



    Is TEMPORARY_CPUFREQ_GOVERNOR" a variable defined in "$PM_FUNCTIONS"?



    What does the script try to do upon suspend|hibernate and upon thaw|resume?



    Thanks.



    #!/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()


    thaw_cpufreq()
    continue
    restorestate "$x%%/*_governor" > "$x"
    done )


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






    share|improve this question
























      up vote
      3
      down vote

      favorite









      up vote
      3
      down vote

      favorite











      On my Ubuntu 16.04, I am trying to understand a system default file /usr/lib/pm-utils/sleep.d/94cpufreq (see the end of this post for its content.)



      Is "$PM_FUNCTIONS" a script, given that it is sourced by .?



      When I echo "$PM_FUNCTIONS" in bash, it outputs nothing. Is PM_FUNCTIONS defined in another script which calls the script?



      Are savestate, state_exists, and restorestate functions defined in "$PM_FUNCTIONS"?



      Is TEMPORARY_CPUFREQ_GOVERNOR" a variable defined in "$PM_FUNCTIONS"?



      What does the script try to do upon suspend|hibernate and upon thaw|resume?



      Thanks.



      #!/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()


      thaw_cpufreq()
      continue
      restorestate "$x%%/*_governor" > "$x"
      done )


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






      share|improve this question














      On my Ubuntu 16.04, I am trying to understand a system default file /usr/lib/pm-utils/sleep.d/94cpufreq (see the end of this post for its content.)



      Is "$PM_FUNCTIONS" a script, given that it is sourced by .?



      When I echo "$PM_FUNCTIONS" in bash, it outputs nothing. Is PM_FUNCTIONS defined in another script which calls the script?



      Are savestate, state_exists, and restorestate functions defined in "$PM_FUNCTIONS"?



      Is TEMPORARY_CPUFREQ_GOVERNOR" a variable defined in "$PM_FUNCTIONS"?



      What does the script try to do upon suspend|hibernate and upon thaw|resume?



      Thanks.



      #!/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()


      thaw_cpufreq()
      continue
      restorestate "$x%%/*_governor" > "$x"
      done )


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








      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 2 at 23:09

























      asked Apr 2 at 23:03









      Tim

      22.6k63224401




      22.6k63224401




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote













          The functions state_exists, etc are defined in /usr/lib/pm-utils/functions and PM_FUNCTIONS refers to the script /usr/lib/pm-utils/pm-functions. And yes, TEMPORARY_CPUFREQ_GOVERNOR is defined in PM_FUNCTIONS.






          share|improve this answer




















          • Thanks. How did you find them out by just looking at the file system? Where is PM_FUNCTIONS defined? How shall I find out where /usr/lib/pm-utils/sleep.d/94cpufreq and /etc/pm/sleep.d/20_cpu_freq are called?
            – Tim
            Apr 2 at 23:30











          • You can find filenames using find or locate and then search the files using grep. For instance, to search for the variable TEMPORARY_CPUFREQ_GOVERNOR you can use the command grep -ri "TEMPORARY_CPUFREQ_GOVERNOR" /usr/lib/pm-utils
            – J. Taylor
            Apr 2 at 23:36










          • Thanks. I was wondering how to find out where /usr/lib/pm-utils/sleep.d/94cpufreq and /etc/pm/sleep.d/20_cpu_freq are called? Under /usr/lib/pm-utils/, I run grep -R freq ., and it only return the file /usr/lib/pm-utils/sleep.d/94cpufreq, which is meaningless. I run grep -R sleep.d ., and it returns nothing useful either.
            – Tim
            Apr 2 at 23:39











          • They are hooks that are run in the function _run_hooks() from the file pm-functions. Note the part that looks like this: for base in $(IFS="$oifs"; for f in "$syshooks/"*[!~] "$phooks/"*[!~]; do [ -O "$f" ] && echo $f##*/ ; done | $sort | uniq) ; ... See How do I run commands on suspend/return from suspend?
            – J. Taylor
            Apr 3 at 0:14











          • By the way, to find that, I used grep as follows: grep -ri '.d' /usr/lib/pm-utils/, which returned a couple of lines that looked like this: usr/lib/pm-utils/pm-functions: local syshooks="$PM_UTILS_ETCDIR/$1.d" I searched for ".d" in because since sleep.d wasn't showing up explicitly, I figured there was some kind of loop that went through all of the ".d" directories.
            – J. Taylor
            Apr 3 at 0:22











          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );








           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f435150%2fwhat-does-usr-lib-pm-utils-sleep-d-94cpufreq-try-to-do%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          2
          down vote













          The functions state_exists, etc are defined in /usr/lib/pm-utils/functions and PM_FUNCTIONS refers to the script /usr/lib/pm-utils/pm-functions. And yes, TEMPORARY_CPUFREQ_GOVERNOR is defined in PM_FUNCTIONS.






          share|improve this answer




















          • Thanks. How did you find them out by just looking at the file system? Where is PM_FUNCTIONS defined? How shall I find out where /usr/lib/pm-utils/sleep.d/94cpufreq and /etc/pm/sleep.d/20_cpu_freq are called?
            – Tim
            Apr 2 at 23:30











          • You can find filenames using find or locate and then search the files using grep. For instance, to search for the variable TEMPORARY_CPUFREQ_GOVERNOR you can use the command grep -ri "TEMPORARY_CPUFREQ_GOVERNOR" /usr/lib/pm-utils
            – J. Taylor
            Apr 2 at 23:36










          • Thanks. I was wondering how to find out where /usr/lib/pm-utils/sleep.d/94cpufreq and /etc/pm/sleep.d/20_cpu_freq are called? Under /usr/lib/pm-utils/, I run grep -R freq ., and it only return the file /usr/lib/pm-utils/sleep.d/94cpufreq, which is meaningless. I run grep -R sleep.d ., and it returns nothing useful either.
            – Tim
            Apr 2 at 23:39











          • They are hooks that are run in the function _run_hooks() from the file pm-functions. Note the part that looks like this: for base in $(IFS="$oifs"; for f in "$syshooks/"*[!~] "$phooks/"*[!~]; do [ -O "$f" ] && echo $f##*/ ; done | $sort | uniq) ; ... See How do I run commands on suspend/return from suspend?
            – J. Taylor
            Apr 3 at 0:14











          • By the way, to find that, I used grep as follows: grep -ri '.d' /usr/lib/pm-utils/, which returned a couple of lines that looked like this: usr/lib/pm-utils/pm-functions: local syshooks="$PM_UTILS_ETCDIR/$1.d" I searched for ".d" in because since sleep.d wasn't showing up explicitly, I figured there was some kind of loop that went through all of the ".d" directories.
            – J. Taylor
            Apr 3 at 0:22















          up vote
          2
          down vote













          The functions state_exists, etc are defined in /usr/lib/pm-utils/functions and PM_FUNCTIONS refers to the script /usr/lib/pm-utils/pm-functions. And yes, TEMPORARY_CPUFREQ_GOVERNOR is defined in PM_FUNCTIONS.






          share|improve this answer




















          • Thanks. How did you find them out by just looking at the file system? Where is PM_FUNCTIONS defined? How shall I find out where /usr/lib/pm-utils/sleep.d/94cpufreq and /etc/pm/sleep.d/20_cpu_freq are called?
            – Tim
            Apr 2 at 23:30











          • You can find filenames using find or locate and then search the files using grep. For instance, to search for the variable TEMPORARY_CPUFREQ_GOVERNOR you can use the command grep -ri "TEMPORARY_CPUFREQ_GOVERNOR" /usr/lib/pm-utils
            – J. Taylor
            Apr 2 at 23:36










          • Thanks. I was wondering how to find out where /usr/lib/pm-utils/sleep.d/94cpufreq and /etc/pm/sleep.d/20_cpu_freq are called? Under /usr/lib/pm-utils/, I run grep -R freq ., and it only return the file /usr/lib/pm-utils/sleep.d/94cpufreq, which is meaningless. I run grep -R sleep.d ., and it returns nothing useful either.
            – Tim
            Apr 2 at 23:39











          • They are hooks that are run in the function _run_hooks() from the file pm-functions. Note the part that looks like this: for base in $(IFS="$oifs"; for f in "$syshooks/"*[!~] "$phooks/"*[!~]; do [ -O "$f" ] && echo $f##*/ ; done | $sort | uniq) ; ... See How do I run commands on suspend/return from suspend?
            – J. Taylor
            Apr 3 at 0:14











          • By the way, to find that, I used grep as follows: grep -ri '.d' /usr/lib/pm-utils/, which returned a couple of lines that looked like this: usr/lib/pm-utils/pm-functions: local syshooks="$PM_UTILS_ETCDIR/$1.d" I searched for ".d" in because since sleep.d wasn't showing up explicitly, I figured there was some kind of loop that went through all of the ".d" directories.
            – J. Taylor
            Apr 3 at 0:22













          up vote
          2
          down vote










          up vote
          2
          down vote









          The functions state_exists, etc are defined in /usr/lib/pm-utils/functions and PM_FUNCTIONS refers to the script /usr/lib/pm-utils/pm-functions. And yes, TEMPORARY_CPUFREQ_GOVERNOR is defined in PM_FUNCTIONS.






          share|improve this answer












          The functions state_exists, etc are defined in /usr/lib/pm-utils/functions and PM_FUNCTIONS refers to the script /usr/lib/pm-utils/pm-functions. And yes, TEMPORARY_CPUFREQ_GOVERNOR is defined in PM_FUNCTIONS.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 2 at 23:24









          J. Taylor

          1,60211322




          1,60211322











          • Thanks. How did you find them out by just looking at the file system? Where is PM_FUNCTIONS defined? How shall I find out where /usr/lib/pm-utils/sleep.d/94cpufreq and /etc/pm/sleep.d/20_cpu_freq are called?
            – Tim
            Apr 2 at 23:30











          • You can find filenames using find or locate and then search the files using grep. For instance, to search for the variable TEMPORARY_CPUFREQ_GOVERNOR you can use the command grep -ri "TEMPORARY_CPUFREQ_GOVERNOR" /usr/lib/pm-utils
            – J. Taylor
            Apr 2 at 23:36










          • Thanks. I was wondering how to find out where /usr/lib/pm-utils/sleep.d/94cpufreq and /etc/pm/sleep.d/20_cpu_freq are called? Under /usr/lib/pm-utils/, I run grep -R freq ., and it only return the file /usr/lib/pm-utils/sleep.d/94cpufreq, which is meaningless. I run grep -R sleep.d ., and it returns nothing useful either.
            – Tim
            Apr 2 at 23:39











          • They are hooks that are run in the function _run_hooks() from the file pm-functions. Note the part that looks like this: for base in $(IFS="$oifs"; for f in "$syshooks/"*[!~] "$phooks/"*[!~]; do [ -O "$f" ] && echo $f##*/ ; done | $sort | uniq) ; ... See How do I run commands on suspend/return from suspend?
            – J. Taylor
            Apr 3 at 0:14











          • By the way, to find that, I used grep as follows: grep -ri '.d' /usr/lib/pm-utils/, which returned a couple of lines that looked like this: usr/lib/pm-utils/pm-functions: local syshooks="$PM_UTILS_ETCDIR/$1.d" I searched for ".d" in because since sleep.d wasn't showing up explicitly, I figured there was some kind of loop that went through all of the ".d" directories.
            – J. Taylor
            Apr 3 at 0:22

















          • Thanks. How did you find them out by just looking at the file system? Where is PM_FUNCTIONS defined? How shall I find out where /usr/lib/pm-utils/sleep.d/94cpufreq and /etc/pm/sleep.d/20_cpu_freq are called?
            – Tim
            Apr 2 at 23:30











          • You can find filenames using find or locate and then search the files using grep. For instance, to search for the variable TEMPORARY_CPUFREQ_GOVERNOR you can use the command grep -ri "TEMPORARY_CPUFREQ_GOVERNOR" /usr/lib/pm-utils
            – J. Taylor
            Apr 2 at 23:36










          • Thanks. I was wondering how to find out where /usr/lib/pm-utils/sleep.d/94cpufreq and /etc/pm/sleep.d/20_cpu_freq are called? Under /usr/lib/pm-utils/, I run grep -R freq ., and it only return the file /usr/lib/pm-utils/sleep.d/94cpufreq, which is meaningless. I run grep -R sleep.d ., and it returns nothing useful either.
            – Tim
            Apr 2 at 23:39











          • They are hooks that are run in the function _run_hooks() from the file pm-functions. Note the part that looks like this: for base in $(IFS="$oifs"; for f in "$syshooks/"*[!~] "$phooks/"*[!~]; do [ -O "$f" ] && echo $f##*/ ; done | $sort | uniq) ; ... See How do I run commands on suspend/return from suspend?
            – J. Taylor
            Apr 3 at 0:14











          • By the way, to find that, I used grep as follows: grep -ri '.d' /usr/lib/pm-utils/, which returned a couple of lines that looked like this: usr/lib/pm-utils/pm-functions: local syshooks="$PM_UTILS_ETCDIR/$1.d" I searched for ".d" in because since sleep.d wasn't showing up explicitly, I figured there was some kind of loop that went through all of the ".d" directories.
            – J. Taylor
            Apr 3 at 0:22
















          Thanks. How did you find them out by just looking at the file system? Where is PM_FUNCTIONS defined? How shall I find out where /usr/lib/pm-utils/sleep.d/94cpufreq and /etc/pm/sleep.d/20_cpu_freq are called?
          – Tim
          Apr 2 at 23:30





          Thanks. How did you find them out by just looking at the file system? Where is PM_FUNCTIONS defined? How shall I find out where /usr/lib/pm-utils/sleep.d/94cpufreq and /etc/pm/sleep.d/20_cpu_freq are called?
          – Tim
          Apr 2 at 23:30













          You can find filenames using find or locate and then search the files using grep. For instance, to search for the variable TEMPORARY_CPUFREQ_GOVERNOR you can use the command grep -ri "TEMPORARY_CPUFREQ_GOVERNOR" /usr/lib/pm-utils
          – J. Taylor
          Apr 2 at 23:36




          You can find filenames using find or locate and then search the files using grep. For instance, to search for the variable TEMPORARY_CPUFREQ_GOVERNOR you can use the command grep -ri "TEMPORARY_CPUFREQ_GOVERNOR" /usr/lib/pm-utils
          – J. Taylor
          Apr 2 at 23:36












          Thanks. I was wondering how to find out where /usr/lib/pm-utils/sleep.d/94cpufreq and /etc/pm/sleep.d/20_cpu_freq are called? Under /usr/lib/pm-utils/, I run grep -R freq ., and it only return the file /usr/lib/pm-utils/sleep.d/94cpufreq, which is meaningless. I run grep -R sleep.d ., and it returns nothing useful either.
          – Tim
          Apr 2 at 23:39





          Thanks. I was wondering how to find out where /usr/lib/pm-utils/sleep.d/94cpufreq and /etc/pm/sleep.d/20_cpu_freq are called? Under /usr/lib/pm-utils/, I run grep -R freq ., and it only return the file /usr/lib/pm-utils/sleep.d/94cpufreq, which is meaningless. I run grep -R sleep.d ., and it returns nothing useful either.
          – Tim
          Apr 2 at 23:39













          They are hooks that are run in the function _run_hooks() from the file pm-functions. Note the part that looks like this: for base in $(IFS="$oifs"; for f in "$syshooks/"*[!~] "$phooks/"*[!~]; do [ -O "$f" ] && echo $f##*/ ; done | $sort | uniq) ; ... See How do I run commands on suspend/return from suspend?
          – J. Taylor
          Apr 3 at 0:14





          They are hooks that are run in the function _run_hooks() from the file pm-functions. Note the part that looks like this: for base in $(IFS="$oifs"; for f in "$syshooks/"*[!~] "$phooks/"*[!~]; do [ -O "$f" ] && echo $f##*/ ; done | $sort | uniq) ; ... See How do I run commands on suspend/return from suspend?
          – J. Taylor
          Apr 3 at 0:14













          By the way, to find that, I used grep as follows: grep -ri '.d' /usr/lib/pm-utils/, which returned a couple of lines that looked like this: usr/lib/pm-utils/pm-functions: local syshooks="$PM_UTILS_ETCDIR/$1.d" I searched for ".d" in because since sleep.d wasn't showing up explicitly, I figured there was some kind of loop that went through all of the ".d" directories.
          – J. Taylor
          Apr 3 at 0:22





          By the way, to find that, I used grep as follows: grep -ri '.d' /usr/lib/pm-utils/, which returned a couple of lines that looked like this: usr/lib/pm-utils/pm-functions: local syshooks="$PM_UTILS_ETCDIR/$1.d" I searched for ".d" in because since sleep.d wasn't showing up explicitly, I figured there was some kind of loop that went through all of the ".d" directories.
          – J. Taylor
          Apr 3 at 0:22













           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f435150%2fwhat-does-usr-lib-pm-utils-sleep-d-94cpufreq-try-to-do%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Displaying single band from multi-band raster using QGIS

          How many registers does an x86_64 CPU actually have?