[Bug 454722] Re: inotify does not watch /proc
Angelo Borsotti
angelo.borsotti at gmail.com
Mon Aug 23 18:56:42 UTC 2010
apport information
** Tags added: apport-collected
** Description changed:
Compile the following program (inotifyerr.c)
#include <stdlib.h>
#include <stdio.h>
#include <sys/inotify.h>
int main(int argc, char* argv[]){
int fd = inotify_init();
if (fd == -1){
perror("inotify_init");
}
char path[256];
sprintf(path,"/proc/%s",argv[1]);
printf("watching %s\n",path);
int wd = inotify_add_watch(fd,path,IN_ALL_EVENTS);
if (wd == -1){
perror("inotify_add_watch");
}
char buf[1024];
ssize_t siz = read(fd,buf,1024);
if (siz == -1){
perror("inotify read");
}
printf("read done, bytes: %d\n",siz);
}
gcc inotifyerr.c
The program is supposed to watch events occurring on file /proc/nnn, where nnn is passed as
argument to program invokation.
Then start a process in background, and watch it with the program above. E.g.
$ sleep 20 &
[1] 8246
$ ls /proc/8246
attr cpuset io mountinfo pagemap smaps wchan
auxv cwd latency mounts personality stat
cgroup environ limits mountstats root statm
clear_refs exe loginuid net sched status
cmdline fd maps oom_adj schedstat syscall
coredump_filter fdinfo mem oom_score sessionid task
$ ./a.out 8246
watching /proc/8246
^C
[1]+ Done sleep 20
Note that the background process and the inotifyerr one are run from
within the same terminal, same user, and that the latter has read
access to the file being watched.
No events are reported.
The expected behaviour of inotify is to report events on /proc files
and directories instead.
Additional information:
I have run the same test also with superuser privileges, but the result
is the same.
I have modified the test program so as to make the process to whatch
a child of the inotifyerr one. In this case inotify catches all the events.
- Ubuntu 9.04. 2.6.28-15-generic #52-Ubuntu SMP Wed Sep 9 10:49:34 UTC
- 2009 i686 GNU/Linux
+ Ubuntu 9.04. 2.6.28-15-generic #52-Ubuntu SMP Wed Sep 9 10:49:34 UTC 2009 i686 GNU/Linux
+ ---
+ AlsaVersion: Advanced Linux Sound Architecture Driver Version 1.0.21.
+ Architecture: i386
+ AudioDevicesInUse:
+ USER PID ACCESS COMMAND
+ /dev/snd/controlC0: angelo 1376 F.... pulseaudio
+ CRDA: Error: [Errno 2] No such file or directory
+ Card0.Amixer.info:
+ Card hw:0 'NVidia'/'HDA NVidia at 0xfe028000 irq 23'
+ Mixer name : 'Realtek ALC888'
+ Components : 'HDA:10ec0888,1631e601,00100001'
+ Controls : 37
+ Simple ctrls : 21
+ DistroRelease: Ubuntu 10.04
+ HibernationDevice: RESUME=UUID=335bd2d5-504f-4410-a53a-96814ee336e8
+ InstallationMedia: Ubuntu 10.04 LTS "Lucid Lynx" - Release i386 (20100429)
+ Lsusb:
+ Bus 002 Device 002: ID 046d:c315 Logitech, Inc. Classic New Touch Keyboard
+ Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
+ Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
+ MachineType: Packard Bell BV IMEDIA 8425
+ NonfreeKernelModules: nvidia
+ Package: linux (not installed)
+ ProcCmdLine: BOOT_IMAGE=/boot/vmlinuz-2.6.32-24-generic root=UUID=2258e664-9423-4566-ae33-52c12a4645ec ro quiet splash
+ ProcEnviron:
+ LANG=en_US.utf8
+ SHELL=/bin/bash
+ ProcVersionSignature: Ubuntu 2.6.32-24.41-generic 2.6.32.15+drm33.5
+ Regression: No
+ RelatedPackageVersions: linux-firmware 1.34.1
+ Reproducible: Yes
+ RfKill:
+ 0: phy0: Wireless LAN
+ Soft blocked: no
+ Hard blocked: no
+ Tags: lucid filesystem needs-upstream-testing
+ Uname: Linux 2.6.32-24-generic i686
+ UserGroups: adm admin cdrom dialout lpadmin plugdev sambashare
+ dmi.bios.date: 11/01/2006
+ dmi.bios.vendor: Phoenix Technologies, LTD
+ dmi.bios.version: M2N-NM 0401
+ dmi.board.name: M2N-NM
+ dmi.board.vendor: Packard Bell BV
+ dmi.board.version: 1.XX
+ dmi.chassis.asset.tag: 123456789000
+ dmi.chassis.type: 3
+ dmi.chassis.vendor: Packard Bell BV
+ dmi.chassis.version: Chassis Version
+ dmi.modalias: dmi:bvnPhoenixTechnologies,LTD:bvrM2N-NM0401:bd11/01/2006:svnPackardBellBV:pnIMEDIA8425:pvrPB80107506:rvnPackardBellBV:rnM2N-NM:rvr1.XX:cvnPackardBellBV:ct3:cvrChassisVersion:
+ dmi.product.name: IMEDIA 8425
+ dmi.product.version: PB80107506
+ dmi.sys.vendor: Packard Bell BV
** Attachment added: "AlsaDevices.txt"
https://bugs.edge.launchpad.net/bugs/454722/+attachment/1513676/+files/AlsaDevices.txt
--
inotify does not watch /proc
https://bugs.launchpad.net/bugs/454722
You received this bug notification because you are a member of Kernel
Bugs, which is subscribed to linux in ubuntu.
More information about the kernel-bugs
mailing list