chiark / gitweb /
prefork-interp: pass startup mtime
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 21 Aug 2022 11:34:39 +0000 (12:34 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 21 Aug 2022 20:21:10 +0000 (21:21 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
cprogs/prefork-interp.c
pm/Proc/Prefork/Interp.pm

index fb1be68389878b42bdf5dff92809744190db8513..0b4988d36d2ba3c581355315a722f0997fcf7138 100644 (file)
@@ -724,11 +724,14 @@ void become_setup(int sfd, int lockfd, int fake_pair[2],
 
   // Extension could work like this:
   //
-  // We advertise a new protocol (perhaps one which is nearly entirely
+  // We could advertise a new protocol (perhaps one which is nearly entirely
   // different after the connect) by putting a name for it comma-separated
   // next to "v1".  Simple extension can be done by having the script
   // side say something about it in the ack xdata, which we currently ignore.
-  putenv(m_asprintf("PREFORK_INTERP=v1 %d,%d,%d,%d",
+  // Or we could add other extra data after v1.
+  putenv(m_asprintf("PREFORK_INTERP=v1,%jd.%09ld %d,%d,%d,%d",
+                    (intmax_t)initial_stab.st_mtim.tv_sec,
+                    (long)initial_stab.st_mtim.tv_nsec,
                    sfd, call_fd, watcher_stdin, watcher_stderr));
 
   execvp(executor_argv[0], (char**)executor_argv);
index d1d99ee03004aed3cabd764c9c6fb2ec7dac9a6a..d11051f1f89bc12542d5161a77526269d08fa47e 100644 (file)
@@ -19,6 +19,7 @@ our $env_name = 'PREFORK_INTERP';
 our @call_fds;
 our $socket_path;
 our $fail_log = 0;
+our $startup_mtime;
 
 sub fail_log ($) {
   my ($m) = @_;
@@ -162,7 +163,8 @@ sub initialisation_complete {
   my @env_data = split / /, ($ENV{$env_name} // return);
   croak "$env_name has too few words" unless @env_data >= 2;
   my (@vsns) = split /,/, $env_data[0];
-  croak "$env_name doesn't offer protocol v1" unless grep { $_ eq 'v1' } @vsns;
+  croak "$env_name doesn't specify v1" unless @vsns >= 2 && $vsns[0] eq 'v1';
+  $startup_mtime = $vsns[1];
   my @env_fds = split /,/, $env_data[1];
   croak "$env_name has too few fds" unless @env_fds >= 4;;
   $#env_fds = 3;