[PATCH synaptics 3/4] syndaemon: document exit codes and change them to fall into categories.
Peter Hutterer
peter.hutterer at who-t.net
Wed Jul 27 18:16:59 PDT 2011
Changing pid file creation failure to same exit code that fork() failure
uses.
Changing XRECORD init failure to unique code. This way clients can trap
exit code 4 and re-start syndaemon without the -R flag.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
man/syndaemon.man | 20 ++++++++++++++++++++
tools/syndaemon.c | 4 ++--
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/man/syndaemon.man b/man/syndaemon.man
index f850941..a9d69b0 100644
--- a/man/syndaemon.man
+++ b/man/syndaemon.man
@@ -66,6 +66,26 @@ the keyboard state.
.TP
\fBDISPLAY\fP
Specifies the X server to contact.
+.SH EXIT CODES
+If syndaemon exists with a return code other than 0, the error encountered
+is as below.
+.LP
+.TP
+\fBExit code 1
+Invalid commandline argument.
+.LP
+.TP
+\fBExit code 2
+The connection to the X sever could not be established or no touchpad device
+could be found.
+.LP
+.TP
+\fBExit code 3
+The fork into daemon mode failed or the pid file could not be created.
+.LP
+.TP
+\fBExit code 4
+XRECORD requested but not available or usable on the server.
.SH "CAVEATS"
.LP
It doesn't make much sense to connect to a remote X server, because
diff --git a/tools/syndaemon.c b/tools/syndaemon.c
index a8a0499..d527b76 100644
--- a/tools/syndaemon.c
+++ b/tools/syndaemon.c
@@ -598,7 +598,7 @@ main(int argc, char *argv[])
FILE *fd = fopen(pid_file, "w");
if (!fd) {
perror("Can't create pid file");
- exit(2);
+ exit(3);
}
fprintf(fd, "%d\n", getpid());
fclose(fd);
@@ -616,7 +616,7 @@ main(int argc, char *argv[])
else {
fprintf(stderr, "Use of XRecord requested, but failed to "
" initialize.\n");
- exit(2);
+ exit(4);
}
} else
#endif /* HAVE_X11_EXTENSIONS_RECORD_H */
--
1.7.6
More information about the xorg-devel
mailing list