View source with raw comments or as raw
    1:- dynamic
    2	pre_files/1.    3:- findall(F, source_file(F), FL),
    4   assertz(pre_files(FL)).    5:- doc_collect(true).    6:- attach_packs(packs, [duplicate(replace)]).    7:- load_files([ library(pldoc/doc_library),
    8		library(thread_pool),
    9		library(http/http_session),
   10		library(http/http_unix_daemon),
   11		library(http/http_dyn_workers),
   12		library(prolog_source),
   13		plweb,
   14		wiki_edit,
   15		stats,
   16		pack,
   17		register,
   18		changelog,
   19		tagit,
   20		forum,
   21		make,
   22		test_recaptcha,
   23		watchdog
   24	      ],
   25	      [ silent(true)
   26	      ]).   27
   28:- if(exists_source(library(ssh_server))).   29:- use_module(library(ssh_server)).   30:- use_module(library(broadcast)).   31:- listen(http(pre_server_start),
   32          start_sshd).   33
   34start_sshd :-
   35    ssh_server([ port(2022),
   36                 authorized_keys_file('etc/ssh/authorized_keys')
   37               ]).
   38:- endif.
 read_comments(+File)
Reads PlDoc comments for a file that was already loaded before the server was started.
   45read_comments(File) :-
   46	source_file_property(File, module(M)),  !,
   47	setup_call_cleanup(
   48	    ( prolog_open_source(File, In),
   49	      set_prolog_flag(xref, true),
   50	      '$set_source_module'(Old, M)
   51	    ),
   52	    ( repeat,
   53	        prolog_read_source_term(In, Term, _,
   54					[ process_comment(true)
   55					]),
   56	        Term == end_of_file,
   57	      !
   58	    ),
   59	    ( '$set_source_module'(_, Old),
   60	      set_prolog_flag(xref, false),
   61	      prolog_close_source(In)
   62	    )).
   63read_comments(_).				% not a module, we do not care
   64
   65reload_pre_files :-
   66	pre_files(FL),
   67	forall(member(F, FL),
   68	       read_comments(F)).
   69
   70:- reload_pre_files.   71:- doc_load_library.   72:- http_set_session_options([enabled(false)]).   73:- send(@(pce), catch_error_signals, @(off)).
 show_fd
Show open file descriptors. Sanity-check that works only on Linux systems.
   80show_fd :-
   81        current_prolog_flag(pid, Pid),
   82        format(string(Cmd),
   83               '/bin/sh -c "(cd /proc/~w/fd && ls -l | grep socket)"',
   84               [Pid]),
   85        shell(Cmd).
   86
   87show_pools :-
   88	format('~`-t~52|~n'),
   89	format('~w~t~20|~t~w~8+~t~w~8+~t~w~8+~t~w~8+~n',
   90	       [ 'Pool name', 'Running', 'Size', 'Waiting', 'Backlog' ]),
   91	format('~`-t~52|~n'),
   92	forall(current_thread_pool(Pool), show_pool(Pool)),
   93	format('~`-t~52|~n').
   94
   95show_pool(Pool) :-
   96	findall(P, thread_pool_property(Pool, P), List),
   97	memberchk(size(Size), List),
   98	memberchk(running(Running), List),
   99	memberchk(backlog(Waiting), List),
  100	memberchk(options(Options), List),
  101	option(backlog(MaxBackLog), Options, infinite),
  102	format('~w~t~20|~t~D  ~8+~t~D ~8+~t~D  ~8+~t~w  ~8+~n',
  103	       [Pool, Running, Size, Waiting, MaxBackLog]).
  104
  105stop :-
  106	halt(42)