aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Seebach <peter.seebach@windriver.com>2015-08-20 17:40:47 -0500
committerPeter Seebach <peter.seebach@windriver.com>2015-08-21 11:13:00 -0500
commit35d5b50b64b91c580b3cf1462fe9e9560d96b69d (patch)
treec57c435f9a72e153645f270134881d05857a0bda
parent0deb5e20ad9bea4426e67cc5fe86acefdd715c09 (diff)
downloadpseudo-35d5b50b64b91c580b3cf1462fe9e9560d96b69d.tar.gz
pseudo-35d5b50b64b91c580b3cf1462fe9e9560d96b69d.tar.bz2
pseudo-35d5b50b64b91c580b3cf1462fe9e9560d96b69d.zip
Reduce unused message sending
OP_OPEN and OP_EXEC are used only when logging. The server can now tell the client (in response to initial ping) whether or not it is logging, and if it isn't, the client doesn't send those messages. Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
-rw-r--r--ChangeLog.txt3
-rw-r--r--pseudo.c6
-rw-r--r--pseudo_client.c14
3 files changed, 19 insertions, 4 deletions
diff --git a/ChangeLog.txt b/ChangeLog.txt
index 1ac657c..3a9b9e2 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,3 +1,6 @@
+2015-08-20:
+ * (seebs) don't send open/exec messages unless server is logging.
+
2015-08-19:
* (seebs) Reduce alloc/free cycles in path computations.
diff --git a/pseudo.c b/pseudo.c
index 3912fef..26772e6 100644
--- a/pseudo.c
+++ b/pseudo.c
@@ -1069,7 +1069,11 @@ int
pseudo_server_response(pseudo_msg_t *msg, const char *program, const char *tag, char **response_path, size_t *response_len) {
switch (msg->type) {
case PSEUDO_MSG_PING:
- msg->result = RESULT_SUCCEED;
+ /* mad hackery: if we aren't logging, the client gets told
+ * not to send open/exec notifications, which have no other
+ * purpose.
+ */
+ msg->result = opt_l ? RESULT_SUCCEED : RESULT_FAIL;
if (opt_l)
pdb_log_msg(SEVERITY_INFO, msg, program, tag, NULL);
return 0;
diff --git a/pseudo_client.c b/pseudo_client.c
index 650ca7d..128be50 100644
--- a/pseudo_client.c
+++ b/pseudo_client.c
@@ -74,6 +74,7 @@ char *pseudo_cwd_rel = NULL;
int pseudo_disabled = 0;
int pseudo_allow_fsync = 0;
static int pseudo_local_only = 0;
+static int pseudo_client_logging = 1;
int pseudo_umask = 022;
@@ -1064,7 +1065,14 @@ client_ping(void) {
/* and that's not good, so... */
server_pid = 0;
return 1;
- }
+ } else {
+ /* The server tells us whether or not to log things. */
+ if (ack->result == RESULT_SUCCEED) {
+ pseudo_client_logging = 1;
+ } else {
+ pseudo_client_logging = 0;
+ }
+ }
pseudo_debug(PDBGF_CLIENT | PDBGF_VERBOSE, "ping ok\n");
return 0;
}
@@ -1644,7 +1652,8 @@ pseudo_client_op(pseudo_op_t op, int access, int fd, int dirfd, const char *path
break;
case OP_OPEN:
pseudo_client_path(fd, path);
- do_request = 1;
+ case OP_EXEC: /* fallthrough */
+ do_request = pseudo_client_logging;
break;
case OP_CLOSE:
/* no request needed */
@@ -1700,7 +1709,6 @@ pseudo_client_op(pseudo_op_t op, int access, int fd, int dirfd, const char *path
* (operations which can create should be CREAT or MKNOD
* or MKDIR)
*/
- case OP_EXEC:
case OP_CHOWN:
case OP_FCHOWN:
case OP_FSTAT: