From 7228350401c5f304f32e7e64873da83e40f3410f Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 15 Aug 1999 12:56:00 +0000 Subject: [PATCH] (ENOSYS): Define to a bogus value if not already defined. (parse_options): Warn if --pid=PID is used and kill() returns ENOSYS (e.g. when compiled with DJGPP). --- src/tail.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/tail.c b/src/tail.c index b1b4b44902..40ce9f02aa 100644 --- a/src/tail.c +++ b/src/tail.c @@ -51,6 +51,12 @@ # define OFF_T_MAX TYPE_MAXIMUM (off_t) #endif +#ifndef ENOSYS + /* Some systems don't have ENOSYS -- this should be a big enough + value that no valid errno value will match it. */ +# define ENOSYS 99999 +#endif + /* Number of items to tail. */ #define DEFAULT_N_LINES 10 @@ -1435,6 +1441,11 @@ parse_options (int argc, char **argv, if (pid && !forever) error (0, 0, _("warning: PID ignored; --pid=PID is useful only when following")); + else if (pid && kill (pid, 0) != 0 && errno == ENOSYS) + { + error (0, 0, _("warning: --pid=PID is not supported on this system")); + pid = 0; + } } int -- 2.47.3