notification of cd mount - Linux

This is a discussion on notification of cd mount - Linux ; Dear all, Does linux has any service through which the user application can be notified about the newly mounted cdrom or filesystem? Any callback routines? Or the only option is a watchdog type stuff? Thanks, Regards --Himanshu...

+ Reply to Thread
Results 1 to 5 of 5

Thread: notification of cd mount

  1. notification of cd mount

    Dear all,

    Does linux has any service through which the user application can be
    notified about the newly mounted cdrom or filesystem? Any callback
    routines? Or the only option is a watchdog type stuff?

    Thanks,

    Regards
    --Himanshu


  2. Re: notification of cd mount

    On 2006-09-12, Himanshu Chauhan wrote:
    > Dear all,
    >
    > Does linux has any service through which the user application can be
    > notified about the newly mounted cdrom or filesystem? Any callback
    > routines? Or the only option is a watchdog type stuff?


    You ould use famd to monitor /etc/mtab

    there may be a better way.

    Bye.
    Jasen

  3. Re: notification of cd mount

    Himanshu Chauhan wrote:

    > Dear all,
    >
    > Does linux has any service through which the user application can be
    > notified about the newly mounted cdrom or filesystem? Any callback
    > routines? Or the only option is a watchdog type stuff?
    >
    > Thanks,
    >
    > Regards
    > --Himanshu


    Gee, i am not sure i understand your question. When i put and audio CD in,
    it plays. When i put a blank CD or DVD in K3B comes up. When i put in a
    video DVD i recorded, it plays. When i plug in a flash disk, it mounts.
    When i plug in a disk on firewire it mounts. This is using fairly old Suse
    9.2 And i always get a current user notify.

    --
    JosephKK
    Gegen dummheit kampfen die Gotter Selbst, vergebens.**
    --Schiller

  4. Re: notification of cd mount

    On a sunny day (12 Sep 2006 02:52:53 -0700) it happened "Himanshu Chauhan"
    wrote in
    <1158054773.592022.154770@b28g2000cwb.googlegroups. com>:

    >Dear all,
    >
    >Does linux has any service through which the user application can be
    >notified about the newly mounted cdrom or filesystem? Any callback
    >routines? Or the only option is a watchdog type stuff?
    >
    >Thanks,
    >
    >Regards


    Well, it seems it waits! (likely for a CR or something).
    Try this, both for 'ls -rtl' and for 'cat /dev/random'
    cat /dev/random will only output when it has gathered enough stuff,
    run a couple of times, and wait a long time for output on some occasions.

    #include
    #include

    int main(int argc, char **argv)
    {
    int a;
    FILE *pptr;

    //pptr = popen("ls -rtl", "r");
    pptr = popen("cat /dev/random", "r");
    if(!pptr)
    {
    fprintf(stderr, "test4: could not open ls -rtl for read, aborting.\n");

    exit(1);
    }

    while(1)
    {
    a = fgetc(pptr);
    if(a == EOF)
    {
    fprintf(stderr, "test4: EOF detected.\n");

    pclose(pptr);

    exit(0);
    }

    fprintf(stdout, "%0x2", a);
    }


    fprintf(stderr, "WAS HERE, OOOPS.\n");

    exit(0);
    } /* end function main */


  5. Re: notification of cd mount

    Sorry, wrong subject line.

+ Reply to Thread