http://bugzilla.novell.com/show_bug.cgi?id=546559
Summary: kernel notify event DN_DELETE wrongly handled
Classification: openSUSE
Product: openSUSE 11.2
Version: Factory
Platform: Other
OS/Version: Other
Status: NEW
Severity: Normal
Priority: P5 - None
Component: Kernel
AssignedTo: agruen@novell.com
ReportedBy: ms@novell.com
QAContact: qa@suse.de
Found By: ---
When using the kernel notify system to detect create and delete events
the delete event produces two signals: "delete" but followed by a
wrong "create" event
How to reproduce: code example
---snip---
#define _GNU_SOURCE
#include
#include
#include
#include
#include
#include
#include
void handleNotifyEvent ( int, siginfo_t* , void* );
int main (void) {
int n=0;
struct sigaction action;
sigset_t block_set;
action.sa_sigaction = handleNotifyEvent;
sigemptyset (&action.sa_mask);
action.sa_flags = SA_SIGINFO;
sigaction (SIGRTMIN + 0 , &action , NULL);
sigaction (SIGRTMIN + 1 , &action , NULL);
sigemptyset (&block_set);
sigaddset (&block_set,SIGIO);
for (n=0;n<2;n++) {
sigaddset (&block_set,SIGRTMIN + n);
}
sigprocmask(SIG_BLOCK, &block_set,0);
for (n=0;n<2;n++) {
int fd = open ("/mnt/", O_RDONLY);
if (fd == -1) {
return 1;
}
fcntl (fd, F_SETSIG, SIGRTMIN + n);
long flags = 0;
switch (n) {
case 0:
flags = DN_MULTISHOT | DN_CREATE;
break;
case 1:
flags = DN_MULTISHOT | DN_DELETE;
break;
default:
break;
}
if (fcntl (fd,F_NOTIFY, flags) == -1) {
return 1;
}
}
sigprocmask(SIG_UNBLOCK, &block_set,0);
printf ("entering event loop\n");
while (1) {
pause();
}
}
void handleNotifyEvent ( int s, siginfo_t* si , void* p) {
if (s == SIGRTMIN) {
printf ("Create... %d\n",si->si_fd);
} else {
printf ("Delete... %d\n",si->si_fd);
}
}
---snap---
Thanks
--
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.