[BusyBox] Question about busybox/libbb/device_open.c

Hiroshi Ito ito at mlb.co.jp
Sat Nov 6 11:10:24 UTC 2004


Hello,
If somebody knows the reason, please helps me.

Why it needs to try 5 times for open device.
I think one time is enough.

Is there any reason to trying few times ?
and What is a case ?

This fucntion is called from syslogd.c and init.c only.
----from busybox/libbb/device_open.c-----
/* try to open up the specified device */
extern int device_open(const char *device, int mode)
{
    int m, f, fd = -1;
                                                                                
    m = mode | O_NONBLOCK;
                                                                                
    /* Retry up to 5 times */
    for (f = 0; f < 5; f++)
        if ((fd = open(device, m, 0600)) >= 0)
            break;
    if (fd < 0)
        return fd;
    /* Reset original flags. */
    if (m != mode)
        fcntl(fd, F_SETFL, mode);
    return fd;
}
---------------
--------
Hiroshi Ito
Media Lab. Inc.,
URL http://www.mlb.co.jp ( Sorry, Japanese only. )
TEL +81-3-5294-7255  FAX +81-3-5294-7256



More information about the busybox mailing list