【Linux】カーネル総合3【Kernel】at LINUX
【Linux】カーネル総合3【Kernel】 - 暇つぶし2ch527:login:Penguin
07/04/27 21:53:32 8003YhUG
ちょっと質問なんですがinotifyを利用しようとちょこちょこっとサンプルを書いてみたのですが、
動作仕様がどうにも理解に苦しみます。下のように、ループでreadしてブロッキングすると、最初の一回だけはreadするのですが、2回目以降無反応になってしまいます。


/* size of the event structure, not counting name */
#define EVENT_SIZE (sizeof (struct inotify_event))
/* reasonable guess as to size of 1024 events */
#define BUF_LEN (1024 * (EVENT_SIZE + 16)
char buf[BUF_LEN];
int len, i = 0;

int fd = inotify_init();
int wd = inotify_add_watch(fd, "/usr/local/hoge", IN_ACCESS | IN_MODIFY);
while(1){
len = read (fd, buf, BUF_LEN);
}




次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch