mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] doc: watchdog simple example: don't fail on fsync()
@ 2010-03-22 12:22 Giel van Schijndel
  2010-03-24  9:04 ` Giel van Schijndel
  2010-03-29 18:40 ` Wim Van Sebroeck
  0 siblings, 2 replies; 4+ messages in thread
From: Giel van Schijndel @ 2010-03-22 12:22 UTC (permalink / raw)
  To: Wim Van Sebroeck
  Cc: Randy Dunlap, linux-doc, linux-kernel, Giel van Schijndel

Don't terminate the watchdog daemon when fsync() fails because no
watchdog driver actually implements the fsync() syscall.
---
 Documentation/watchdog/src/watchdog-simple.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/Documentation/watchdog/src/watchdog-simple.c b/Documentation/watchdog/src/watchdog-simple.c
index 4cf72f3..cd6d0dd 100644
--- a/Documentation/watchdog/src/watchdog-simple.c
+++ b/Documentation/watchdog/src/watchdog-simple.c
@@ -1,3 +1,4 @@
+#include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -18,7 +19,9 @@ int main(void)
 			break;
 		}
 		ret = fsync(fd);
-		if (ret)
+		if (ret
+		 && errno != EINVAL
+		 && errno != ENOSYS)
 			break;
 		sleep(10);
 	}
-- 
1.6.4.4


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] doc: watchdog simple example: don't fail on fsync()
  2010-03-22 12:22 [PATCH] doc: watchdog simple example: don't fail on fsync() Giel van Schijndel
@ 2010-03-24  9:04 ` Giel van Schijndel
  2010-03-29 18:40 ` Wim Van Sebroeck
  1 sibling, 0 replies; 4+ messages in thread
From: Giel van Schijndel @ 2010-03-24  9:04 UTC (permalink / raw)
  To: Wim Van Sebroeck; +Cc: Randy Dunlap, linux-doc, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 488 bytes --]

On Mon, Mar 22, 2010 at 01:22:37PM +0100, Giel van Schijndel wrote:
> Don't terminate the watchdog daemon when fsync() fails because no
> watchdog driver actually implements the fsync() syscall.
> ---
>  Documentation/watchdog/src/watchdog-simple.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)

Seems I forgot to sign off my own patch:

Signed-off-by: Giel van Schijndel <me@mortis.eu>

-- 
Met vriendelijke groet,
With kind regards,
Giel van Schijndel

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] doc: watchdog simple example: don't fail on fsync()
  2010-03-22 12:22 [PATCH] doc: watchdog simple example: don't fail on fsync() Giel van Schijndel
  2010-03-24  9:04 ` Giel van Schijndel
@ 2010-03-29 18:40 ` Wim Van Sebroeck
  2010-03-29 19:12   ` Giel van Schijndel
  1 sibling, 1 reply; 4+ messages in thread
From: Wim Van Sebroeck @ 2010-03-29 18:40 UTC (permalink / raw)
  To: Giel van Schijndel; +Cc: Randy Dunlap, linux-doc, linux-kernel

Hi Giel,

> Don't terminate the watchdog daemon when fsync() fails because no
> watchdog driver actually implements the fsync() syscall.

Wouldn't it be simpler then to just do an fsync without checking the error-result?

Kind regards,
Wim.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] doc: watchdog simple example: don't fail on fsync()
  2010-03-29 18:40 ` Wim Van Sebroeck
@ 2010-03-29 19:12   ` Giel van Schijndel
  0 siblings, 0 replies; 4+ messages in thread
From: Giel van Schijndel @ 2010-03-29 19:12 UTC (permalink / raw)
  To: Wim Van Sebroeck; +Cc: Randy Dunlap, linux-doc, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1498 bytes --]

On Mon, Mar 29, 2010 at 08:40:41PM +0200, Wim Van Sebroeck wrote:
>> Don't terminate the watchdog daemon when fsync() fails because no
>> watchdog driver actually implements the fsync() syscall.
> 
> Wouldn't it be simpler then to just do an fsync without checking the error-result?

Yes, it definitly would be. Though I think it would be even simpler to
simply ditch the fsync() call. Considering that none of the watchdog
drivers implements it, nor can I think of a usecase where it would make
sense to implement (as more than a NOP).

So instead I suggest the patch following this line:
========================================================================
doc: watchdog simple example: don't fail on fsync()

Don't terminate the watchdog daemon when fsync() fails because no
watchdog driver actually implements the fsync() syscall.

Signed-off-by: Giel van Schijndel <me@mortis.eu>
---
 Documentation/watchdog/src/watchdog-simple.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/Documentation/watchdog/src/watchdog-simple.c b/Documentation/watchdog/src/watchdog-simple.c
index 4cf72f3..ba45803 100644
--- a/Documentation/watchdog/src/watchdog-simple.c
+++ b/Documentation/watchdog/src/watchdog-simple.c
@@ -17,9 +17,6 @@ int main(void)
 			ret = -1;
 			break;
 		}
-		ret = fsync(fd);
-		if (ret)
-			break;
 		sleep(10);
 	}
 	close(fd);
-- 
1.6.4.4

-- 
Met vriendelijke groet,
With kind regards,
Giel van Schijndel

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-03-29 19:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-22 12:22 [PATCH] doc: watchdog simple example: don't fail on fsync() Giel van Schijndel
2010-03-24  9:04 ` Giel van Schijndel
2010-03-29 18:40 ` Wim Van Sebroeck
2010-03-29 19:12   ` Giel van Schijndel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®