Re: [RFC/PATCH] Nonotify - A simplistic way to determine directory content changes



On Fri, 2004-06-04 at 19:21, Manuel Amador (Rudd-O) wrote:
> Only one question remains.  Does nonotify require open fds?  I mean,
> will it block cdrom ejection? =)

That is clearly the wrong question: there can be no relationship between
open fds on a mounted cdrom and cdrom locking.

           From: 
Ikke
<eikke eikke com>
             To: 
hal freedesktop org
        Subject: 
Re: Unmounting and
'eject' press
           Date: 
Thu, 3 Jun 2004
14:45:00 +0200

Ok, I did the testings.

To unlock the tray: very simple

#include <stdio.h>
#include <fcntl.h>
#include <sys/ioctl.h>

#include <linux/cdrom.h>

int main()
{
        int fd;

        fd = open("/dev/hdc", O_RDONLY | O_NONBLOCK);
        if (fd == -1) {
                perror("open");
                return 1;
        }

        if(ioctl(fd, CDROM_LOCKDOOR, 0) < 0)
                 perror("cdrom tray lock");
        return 0;
}

gcc -o test test.c
mount /mnt/cdrom
./test
(press eject, cd ejects, I get error messages in syslog)


Mathieu
-- 
Mathieu Lacage <mathieu gnu org>





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