Re: notification of cd mount



On Dec 6, 1:17 pm, Jan Panteltje <pNaonStpealm...@xxxxxxxxx> wrote:
On a sunny day (12 Sep 2006 02:52:53 -0700) it happened "Himanshu Chauhan"
<hs.chau...@xxxxxxxxx> wrote in
<1158054773.592022.154...@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>:

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 <stdlib.h>
#include <stdio.h>

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 */- Hide quoted text -

- Show quoted text -

Hi,
You are needed here for your professioner talent as a programmer
and sign up is free.You are going to be collecting contract, work it
at home and recieve your money,click on it now and sign up;
http://www.getafreelancer.com/affiliates/ref.php?u=diksa&l=http://www.getafreelancer.com/projects/PHP-ASP/selling-using-text-message-sms.html

.



Relevant Pages

  • Re: run process with popen()
    ... notified about the newly mounted cdrom or filesystem? ... Any callback ... int main ...
    (comp.os.linux.development.apps)
  • Re: notification of cd mount
    ... notified about the newly mounted cdrom or filesystem? ... Any callback ... int main ...
    (comp.os.linux.development.apps)
  • Re: [patch 1/7] Immediate Values - Architecture Independent Code
    ... static unsigned int stopmachine_num_threads; ... * help our sisters onto their CPUs. ... all the other CPUs will execute the callback concurrently. ...
    (Linux-Kernel)
  • Re: Proper use of scanf
    ... have published some routines which operate directly on the input ... Barring EOF it will NOT be a digit. ... This forbids overflow, ... int readxwd ...
    (comp.lang.c)
  • [PATCH 15/20] inflate: (arch) tidy user declarations
    ... bulk of the users are now _not_ a collection of routines copied from ... * Modified for ARM Linux by Russell King ... static int input_data_size; ... - * gzip declarations ...
    (Linux-Kernel)