Merge branch 'refs/heads/t/ll'
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 18 Sep 2022 14:28:33 +0000 (16:28 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 18 Sep 2022 14:35:09 +0000 (16:35 +0200)
Two little cleanups related to the logging facility and two commits
which add the ll command to para_server and para_audiod.

The merge resulted in a conflict in afs.c due to the earlier merge of
the poll topic branch which replaced all calls to select() by calls
to poll(). The implementation of the ll server command introduced a
new caller of select(), afs_select(), which needs to be replaced by
afs_poll() to resolve the conflict.

* refs/heads/t/ll:
  New server command: ll to change the log level at runtime.
  New audiod command: ll to change the log level at runtime.
  daemon: Kill get_loglevel_by_name().
  server/audiod: Don't parse loglevel argument unnecessarily.

13 files changed:
1  2 
NEWS.md
afs.c
audioc.c
audiod.c
audiod_command.c
client.c
command.c
error.h
interactive.c
interactive.h
server.c
string.c
string.h

diff --cc NEWS.md
index 0f2eec0d5e232f5ff11a74bd11860e77ea0e7e56,e9713d9826ff74e25aa01ceaad9a9db13f3113a5..e5b9901054062c92667c3ab403daa5960dd90603
+++ b/NEWS.md
@@@ -5,17 -5,6 +5,17 @@@ NEW
  0.7.1 (to be announced) "digital spindrift"
  -------------------------------------------
  
 +- The autogen.sh script now only creates the autoconf specific files
 +  but no longer runs configure, make and the test suite.
 +- A stripped down copy of the discontinued libmp4ff library has become
 +  part of the paraslash code base. As a result it is no longer necessary
 +  to install faad from source to get support for aac/m4a files. The
 +  faad decoder package must still be installed.
++- The log level of the running daemon can now be changed with the
++  new ll command. It is available for para_server and para_audiod.
 +- All calls to select(2) have been replaced by calls to poll(2)
 +  to avoid known shortcomings of the select API.
 +
  [tarball](./releases/paraslash-git.tar.xz)
  
  ----------------------------------
diff --cc afs.c
index febe13b3e7c561cf2082ab9200c6578806ab8026,21ab9ae87251cce0b88741aecc9b0023755521db..f29080290424d95506ec643df567e24c2d095a74
--- 1/afs.c
--- 2/afs.c
+++ b/afs.c
@@@ -979,6 -980,15 +980,14 @@@ static void register_command_task(struc
        }, s);
  }
  
 -static int afs_select(int max_fileno, fd_set *readfds, fd_set *writefds,
 -              struct timeval *timeout_tv)
++static int afs_poll(struct pollfd *fds, nfds_t nfds, int timeout)
+ {
+       mutex_lock(mmd_mutex);
+       daemon_set_loglevel(mmd->loglevel);
+       mutex_unlock(mmd_mutex);
 -      return para_select(max_fileno + 1, readfds, writefds, timeout_tv);
++      return xpoll(fds, nfds, timeout);
+ }
  /**
   * Initialize the audio file selector process.
   *
@@@ -1003,7 -1013,9 +1012,8 @@@ __noreturn void afs_init(int socket_fd
        PARA_INFO_LOG("server_socket: %d\n", server_socket);
        init_admissible_files(OPT_STRING_VAL(AFS_INITIAL_MODE));
        register_command_task(&s);
 -      s.select_function = afs_select;
 -      s.default_timeout.tv_sec = 0;
 -      s.default_timeout.tv_usec = 999 * 1000;
 +      s.default_timeout = 1000;
++      s.poll_function = afs_poll;
        ret = write(socket_fd, "\0", 1);
        if (ret != 1) {
                if (ret == 0)
diff --cc audioc.c
Simple merge
diff --cc audiod.c
Simple merge
Simple merge
diff --cc client.c
Simple merge
diff --cc command.c
Simple merge
diff --cc error.h
Simple merge
diff --cc interactive.c
Simple merge
diff --cc interactive.h
Simple merge
diff --cc server.c
index 2c66cc279c9faa99e009ae747fd4d8a54738e2e8,b9026ad6713e665fe461a6b563f364186dc3e1cc..2852ee1f10f7a9d8d4f5a93e2233b8b6fd4a4ecc
+++ b/server.c
@@@ -621,9 -626,10 +625,10 @@@ static int server_poll(struct pollfd *f
  {
        int ret;
  
+       daemon_set_loglevel(mmd->loglevel);
        status_refresh();
        mutex_unlock(mmd_mutex);
 -      ret = para_select(max_fileno + 1, readfds, writefds, timeout_tv);
 +      ret = xpoll(fds, nfds, timeout);
        mutex_lock(mmd_mutex);
        return ret;
  }
diff --cc string.c
Simple merge
diff --cc string.h
Simple merge