This file is indexed.

/usr/lib/ocaml/netplex/netplex_cenv.mli is in libocamlnet-ocaml-dev 4.1.2-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
(* $Id$ *)

(** Container environment
  *
  * Some helper functions to explore the environment from a container.
  * Most of the following functions {b must} be called from a container context,
  * i.e. from a process or thread that acts as container, otherwise
  * the exception [Not_in_container_thread] is raised. There are also some
  * functions that can be called from controller context for convenience.
  *
  * {b Thread safety:} Full. The functions in this module can be called from any
  * thread.
 *)

open Netplex_types

exception Not_in_container_thread
  (** Raised when the caller's thread is not a container thread *)

(** {2 Logging} *)

(** Logging functions can be invoked from both container and controller 
    contexts.
 *)

val log : level -> string -> unit
  (** Writes a log message *)

val logf : level -> ('a, unit, string, unit) format4 -> 'a
  (** Writes a log message like [printf] *)

val report_connection_string : Unix.file_descr -> string -> string
  (** Output a log line for the [netplex.connections] admin message.
      The string is the detail to report.
   *)

(** {2 Timer} *)

(** Timer functions can only be invoked from container contexts. 
    More documentation is available in {!Netplex_advanced.timers}.
 *)

type timer
  (** A timer *)

val create_timer : (timer -> bool) -> float -> timer
  (** [create_timer f tmo]: Creates a timer with timeout value [tmo]:
      In [tmo] seconds [f] is called, and if this function returns [true],
      the timer remains active, and another round of timing is arranged.
      If the functions returns [false] or raises an exception, the timer
      is stopped.

      Timers are also stopped on container shutdown.

      Timers are attached to the container event system, and run only
      if this event system runs. Also note that [f] is always called from
      the main thread of the container.
   *)

val cancel_timer : timer -> unit
  (** Cancels the timer: The callback function is not called any longer *)

val cancel_all_timers : unit -> unit
  (** Cancels all active timers *)

val timer_id : timer -> int
  (** Returns an ID, e.g. useful for debugging *)


(** {2 Container variables} *)

(** Container variables exist once per container. Primary access is
    done via the [var] and [set_var] methods of the container class.
    The following functions are often more convenient, however.

    These functions can only be invoked from container contexts. 

    More documentation: {!Netplex_advanced.contvars}
 *)

exception Container_variable_not_found of string
  (** The variable does not exist *)

exception Container_variable_type_mismatch of string
  (** The (dynamically typed) variable has the wrong type *)


val int_var : string -> int
val string_var : string -> string
val float_var : string -> float
val bool_var : string -> bool
  (** Access a variable with simple type. May raise 
      [Container_variable_not_found] or [Container_variable_type_mismatch]
   *)

val set_int_var : string -> int -> unit
val set_string_var : string -> string -> unit
val set_float_var : string -> float -> unit
val set_bool_var : string -> bool -> unit
  (** Set a variable with simple type *)

val make_var_type :
      ('a -> encap) -> (encap -> 'a) -> ((string -> 'a) * (string -> 'a -> unit))
  (** Create get and set functions for any (monomorphic) type. For example,
      to create such function for a type [foo], do

      {[ 
          module E = Netplex_encap.Make_encap(struct type t = foo end)
          let (get, set) = 
            make_var_type E.wrap E.unwrap
      ]}

      Read on for using functors to create [get] and [set].
   *)

module type TYPE = sig type t end
  (** Just a (monomorphic) type [t] *)

module type VAR_TYPE = sig
  type t 
  val get : string -> t
  val set : string -> t -> unit
end
  (** A (monomorphic) type [t] with two functions [get] and [set]
      accessing the container variables
   *)

module Make_var_type(T:TYPE) : VAR_TYPE with type t = T.t
  (** Creates [get] and [set] like [make_var_type]. Call it like

      {[
         module Foo_var = 
           Make_var_type(struct t = foo end)
      ]}

      and use [Foo_var.get] and [Foo_var.set] to access the container
      variables of type [foo].
   *)




(** {2 System control} *)

(** System control functions can be invoked from both container and controller 
    contexts.
 *)

val system_shutdown : unit -> unit
  (** Initiates a system shutdown (like the [shutdown] method of the
      controller)
     *)

val system_restart : unit -> unit
  (** Initiates a system restart (like the [restart] method of the
      controller)
     *)


(** {2 Inter-Container Communication} *)

(** These functions can only be invoked from container contexts, 
    except [send_message].
 *)


val send_message : string -> string -> string array -> unit
  (** [send_message service_pattern msg_name msg_arguments]: Sends
       a message to all services and message receivers matching
       [service_pattern]. The pattern may include the wildcard [*].

       See the {!Netplex_types.controller.send_message} method for
       the notification guarantees.

       This function can be invoked from both container and controller
       contexts.
   *)

val lookup : string -> string -> string option
  (** [lookup service_name protocol_name] tries to find a Unix domain
      socket for the service and returns it.

      On Win32, the returned path refers to a file describing the
      IPC mechanism. Use {!Netplex_sockserv.any_file_client_connector}
      to convert the path into an RPC connector.
   *)

val lookup_container_sockets : string -> string -> string array 
  (** [lookup_container_sockets service_name protocol_name]: returns
      the Unix Domain paths of all container sockets for this service and
      protocol. These are the sockets declared with address type
      "container" in the config file.

      On Win32, the returned paths refer to files describing the
      IPC mechanism. Use {!Netplex_sockserv.any_file_client_connector}
      to convert the paths into RPC connectors.

      Container sockets are explained here:
      {!Netplex_advanced.contsocks}
   *)


(** {2 Direct container and admin interface access} *)

val self_cont : unit -> container
  (** Returns the container running the code of the caller,
      or raise [Not_in_container_thread] if called from outside a 
      container context.
   *)

val self_obj : unit -> [ `Container of container |
			 `Controller of controller ]
  (** Returns the container or the controller running the code of the
      caller, or raise [Not_found] if called from
      neither a container not a controller thread.
   *)

val current_sys_id : unit -> [ `Thread of int | `Process of int ]
  (** Returns the system-dependent thread identifier of the caller
      (which must be in container or controller context)
   *)


val admin_connector : unit -> Rpc_client.mode2
  (** Determines the admin socket of the controller, and returns an RPC
      client connector suitable for connecting with the admin interface
      of the controller. For instance to initiate a system shutdown from
      the context of a container:

      {[
         let conn = Netplex_cenv.admin_connector() in
         let client = Netplex_ctrl_clnt.Admin.V2.create_client2 conn in
         Netplex_ctrl_clnt.Admin.V2.system_shutdown client ();
         Rpc_client.shut_down client
       ]}

      Note that the admin interface is going to evolve, and it is advisable
      to avoid admin calls whenever possible.

      This function must be called from container context.
   *)

val run_in_controller_context : controller -> (unit -> unit) -> unit
  (** [run_in_controller_context ctrl f]: Arranges that [f()] is executed
      in the context of the controller. {b This is only possible for
      multi-threading but not for multi-processing style!} For
      programs using multi-processing, see {!Netplex_cenv.Make_lever}
      for a workaround.

      This function can be called from any thread. The function [f] is
      executed by pushing it onto the event queue, and calling it when
      the pushed event is reached. This is usually a safe point for
      many kinds of operations, but if controller methods are invoked
      the details are left unspecified.

      For example, this allows it to start helper threads via
      {!Netplex_kit.add_helper_service} at any time.

      An example can be found here: {!Netplex_advanced.levers}
   *)


val run_in_container_context : container -> (unit -> unit) -> unit
  (** [run_in_container_context cont f]: Arranges that [f()] is executed
      in the context of the container [cont]. {b This is only possible for
      multi-threading but not for multi-processing style!}

      This function can be called from any thread. The function [f] is
      executed by pushing it onto the event queue, and calling it when
      the pushed event is reached. This is usually a safe point for
      many kinds of operations, but if container method are invoked
      the details are left unspecified.

      There is no guarantee that [f] is called anytime soon - if the
      container is busy with something else than with the event queue
      the execution will be blocked until these other activities are
      over.
   *)


(** Levers are a way to send messages to the controller, and to effectively
    run functions there that were previously registered. 

    More documentation: {!Netplex_advanced.levers}
 *)

(** Abstraction for function types [s->t] *)
module type FUN_TYPE = 
  sig 
    type s  (** argument type *)
    type r  (** result type *)
  end

module type LEVER = sig
  type s  (** argument type *)
  type r  (** result type *)
  type t = s->r

  val register : Netplex_types.controller -> 
                 (Netplex_types.controller -> t) -> t
    (** [let reg_lever = register ctrl raw_lever]:
        Registers [raw_lever] in the controller [ctrl], so one can call
        [reg_lever] to activate it. For example:

        {[ 
           module LT = struct type s = unit type r = int end
           module L = Make_lever(LT)
         
           let get_num_services =
             L.register ctrl (fun ctrl () -> List.length ctrl#services)
        ]}

        The registration must be done in controller context, e.g.
        in the [pre_start_hook] of a container.

        From the running container, one can now call:

        {[ get_num_services() ]}

        to get the current length of the [ctrl#services] list.
     *)
end

module Make_lever(T:FUN_TYPE) : LEVER with type s=T.s and type r=T.r
  (** Creates a [LEVER] module from a function type as specified in
      [FUN_TYPE]
   *)


(** {2 Persistent kernel objects} *)

val pmanage : unit -> Netsys_pmanage.pmanage
  (** Access the manager for persistent kernel objects with limited
      lifetime. Among these objects there are shared memory objects,
      and named semaphores. These objects can usually be deleted when
      the program finishes (or crashes), but this is not done automatically
      because of kernel persistency.

      See {!Netplex_admin.unlink} for more information.
   *)

(** {1 Debugging} *)

module Debug : sig
  val enable : bool ref
    (** Enables {!Netlog}-style debugging *)

end


(**/**)

val register_par : parallelizer -> unit
val register_cont : container -> par_thread -> unit
val unregister_cont : container -> par_thread -> unit
val register_ctrl : controller -> unit
val unregister_ctrl : controller -> unit