static char console[32] = _PATH_CONSOLE;
-/* try to open up the specified device */
-int device_open(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;
-}
-
/* print a message to the specified device:
* device may be bitwise-or'd from LOG | CONSOLE */
void message(int device, char *fmt, ...)
static char console[32] = _PATH_CONSOLE;
-/* try to open up the specified device */
-int device_open(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;
-}
-
/* print a message to the specified device:
* device may be bitwise-or'd from LOG | CONSOLE */
void message(int device, char *fmt, ...)
extern int check_wildcard_match(const char* text, const char* pattern);
extern long getNum (const char *cp);
extern pid_t findInitPid();
+#if defined BB_INIT || defined BB_SYSLOGD
+extern int device_open(char *device, int mode)
+#endif
#if defined BB_FEATURE_MOUNT_LOOP
extern int del_loop(const char *device);
"\t-O\tSpecify an alternate log file. default=/var/log/messages\n";
-/* try to open up the specified device */
-static int device_open(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;
-}
-
/* print a message to the log file */
static void message(char *fmt, ...)
{
"\t-O\tSpecify an alternate log file. default=/var/log/messages\n";
-/* try to open up the specified device */
-static int device_open(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;
-}
-
/* print a message to the log file */
static void message(char *fmt, ...)
{
#endif /* BB_DD || BB_TAIL */
+#if defined BB_INIT || defined BB_SYSLOGD
+/* try to open up the specified device */
+extern int device_open(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;
+}
+#endif /* BB_INIT BB_SYSLOGD */
+
+
#if defined BB_INIT || defined BB_HALT || defined BB_REBOOT
#if ! defined BB_FEATURE_USE_PROCFS