一般ファイルを読み込めません - IOワークブロック

一般ファイルを読み込めません - IOワークブロック

私は特定の文字列を見つけるためにAndroidデバイス上のすべてのファイルを検索するプログラムを書いています。プロセス全体が進むのに数秒が経過し、次のファイルが詰まっています。

/sys/power/wakelock_count

使ってみようgrep,C 関数ポペンそして他の選択肢はすべてそのファイルのIOをブロックし、決して返されません。サイズは正確に4096バイトですが、統計資料またはls-lファイルは次のように報告されます。一般ファイル- シンボリックリンクやデバイスファイルがありません。開いたハンドルを確認しました。ファイルは次のようにアクセスされました。システム_SE、何十もの異なるファイルへのハンドルも持っていますが、よく読むことができます。ロックも確認してみました。必須読み取りアクセスを防止するロックです。

このファイルの特別な点は何ですか?どうやって読むかスキップできますか?

編集:私はすべてをSUとして実行しています。

編集2:LS-LD結果:

-rw-r--r-- 1 system system 4096 1971-10-10 21:59 wakeup_count

ベストアンサー1

このファイルは/sys/power/wakeup_count「一般」ファイルシステムにはないため、実際には「一般」ファイルではありません。 「sysfs-power」ファイルシステムでは、実際にはディスク上のファイルのようなものを示さないという点で、「proc」ファイルシステムとほぼ同じです。

すべてファイルsysfs-powerシステム文書:

What:       /sys/power/wakeup_count
Date:       July 2010
Contact:    Rafael J. Wysocki <[email protected]>
Description:
        The /sys/power/wakeup_count file allows user space to put the
        system into a sleep state while taking into account the
        concurrent arrival of wakeup events.  Reading from it returns
        the current number of registered wakeup events and it blocks if
        some wakeup events are being processed at the time the file is
        read from.  Writing to it will only succeed if the current
        number of wakeup events is equal to the written value and, if
        successful, will make the kernel abort a subsequent transition
        to a sleep state if any wakeup events are reported after the
        write has returned.

したがって、読み取り中断は問題にならない可能性がありますが、上記の文書を考慮すると長い時間中断されるようにはなりません。

ただし、次のエラーが発生する可能性が高くなります。 /sys/power/wakeup_countからの読み込みは無期限に中断されます。 おっしゃった症状とほぼ同じです。

おすすめ記事