anchor.diff:  
   terminate({port_terminated, _Reason}, _State) ->
     ok;
  -terminate(_Reason, #state{port = Port} = _State) ->
  +terminate(_Reason, #state{port = Port, pid_file = PidFile} = _State) ->
     port_close(Port),
  -  os:cmd (lists:concat(["kill -9 `cat ",pid_file (),"`"])),
  +  os:cmd (lists:concat(["kill -9 `cat ",PidFile,"`"])),
     ok.
   
   code_change (_OldVsn, State, _Extra) ->
  
positive.code:   erlang:error ({badconfig, A}).
  
  pid_file () ->
    filename:join(["","tmp",lists:concat(["rrdcached-",os:getpid(),".pid"])]).
  
  listen_file () ->
    filename:join(["","tmp",lists:concat(["rrdcached-",os:getpid(),".sock"])]).
  
  alive () ->
    case os:cmd (lists:concat (["kill -0 `cat ",pid_file (),"`"])) of
  
negative.code: ping () ->
    gen_server:cast (?MODULE, ping).
  
  init (Config0) ->
    process_flag(trap_exit, true),
    PrivDir = filename:join ([filename:dirname(code:which(?MODULE)),"..","priv"]),
    ExtCmd = filename:join([PrivDir, "killable "]),
  
    { RootDir, Config1 } =
      case lists:keytake (root_dir, 1, Config0) of
        {value, {root_dir, R}, C1} -> {R, C1};
        false -> { ["", "var", "run" ], Config0 }
      end,
  
    { ListenFile, Config2 } =
      case lists:keytake (listen, 1, Config1) of
        {value, {listen, L}, C2} -> {L, C2};
        false ->
          { filename:join (lists:concat ([RootDir,
                [lists:concat(["rrdcached-",os:getpid(),".sock"])]])),
            Config1
          }
      end,
  
    { PidFile, Config3 } =
      case lists:keysearch (pidfile, 1, Config2) of
        {value, {pidfile, P}, C3} -> {P, C3};
        false ->
          { filename:join (lists:concat ([RootDir,
                [lists:concat(["rrdcached-",os:getpid(),".pid"])]])),
            Config2
          }
      end,
  
    Args =
      process_config ([ foreground,
                        {listen, ListenFile},
                        {pidfile, PidFile}
                        | Config3
                      ]),
    Cmd = binary_to_list(list_to_binary([ExtCmd, "rrdcached ", Args])),
    Port =
      open_port({spawn, Cmd},
                [stream,{line, 10000},exit_status,stderr_to_stdout]),
  
    {ok, #state{port = Port, pid_file = PidFile, listen_file = ListenFile}}.
  
  handle_call (pid_file, _From, State = #state { pid_file = PidFile }) ->
    { reply, PidFile, State };
  handle_call (listen_file, _From, State = #state { listen_file = ListenFile}) ->
    { reply, ListenFile, State };
  handle_call (_Request, _From, State) ->
    { reply, ok, State }.
  
  