[Bug 13035] New: select for cpufreq/ files

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

 



http://bugzilla.kernel.org/show_bug.cgi?id=13035

           Summary: select for cpufreq/ files
           Product: Power Management
           Version: 2.5
    Kernel Version: 2.6.24
          Platform: All
        OS/Version: Linux
              Tree: Mainline
            Status: NEW
          Severity: normal
          Priority: P1
         Component: cpufreq
        AssignedTo: cpufreq@xxxxxxxxxxxxxxx
        ReportedBy: suzuki.hironobu@xxxxxxxxx
        Regression: No


/*

 A code of  select test for 
  "/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies" file.

 $cat /proc/version
 Linux version 2.6.24-23-generic (buildd@crested) (gcc version 4.2.3 (Ubuntu
4.2.3-2ubuntu7)) #1 SMP Mon Jan 26 01:04:16 UTC 2009
 $ cc foo.c 
 $ ./a.out
 blah, blah, blah
 <It should not wait but it wait 10 seconds>
 $ 

I don't know that it is a bug or kind of specification of kernel.  I
think that "/sys/devices/......./scaling_available_frequencies" should
be closed by kernel because "/proc/version" has been worked well for
this sample program.

By 
   Hironobu SUZUKI <hironobu at h2np dot net>
   7 Apr 2009 

 */
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>


main() {
  int fd;
  fd_set rfds;
  struct timeval tv;
  char buf[BUFSIZ];

  FD_ZERO (&rfds);
 
fd=open("/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies",O_RDONLY);

  /*  cf.
  fd=open("/proc/version",O_RDONLY);
  */

  FD_SET (fd, &rfds);
  tv.tv_sec = 10;  tv.tv_usec = 0;
  while (   read(fd,&buf,BUFSIZ) > 0 ) {
    puts(buf);
    select (fd+1, &rfds, NULL, NULL, &tv);
  }
  close(fd);
}

-- 
Configure bugmail: http://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
--
To unsubscribe from this list: send the line "unsubscribe cpufreq" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Devel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Forum]     [Linux SCSI]

  Powered by Linux