This file is indexed.

/usr/lib/ocaml/netsys/netsys_polysocket.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
(* $Id$ *)

(** Polymorphic message sockets *)

(** These pipes are restricted to a single process, and can be used
    to send messages of any types between threads.
 *)

(** {2 Types} *)

type 'a polyendpoint =
    'a Netsys_polypipe.polypipe * 'a Netsys_polypipe.polypipe
  (** An endpoint is simply a pair [(rd,wr)] where [rd] is a polypipe open
      for reading, and [wr] is a polypipe open for writing.
   *)

type 'a polyclient
  (** A client, connected or unconnected *)

type 'a polyserver
  (** A server *)

(** {2 Clients} *)

val create_client : int -> 'a polyclient
  (** Create a new socket client. The int is the number of messages in the
      pipe buffer.
   *)

val connect : 'a polyclient -> 'a polyserver -> unit
  (** Requests the connection with this server. This function returns always
      immediately.

      Possible [Unix.unix_error] codes:
       - [EALREADY]
       - [EISCONN]
   *)

val endpoint : synchronous:bool -> nonblock:bool ->
               'a polyclient -> 'a polyendpoint
  (** Returns the endpoint once connected. In asynchronous mode, the
      connect is immediately successful. In synchronous mode, it is
      awaited that the server accepts the connection. If also [nonblock]
      is true, the [Unix_error] [EAGAIN] is returned if such waiting
      is needed.

      Possible [Unix.unix_error] codes:
       - [EAGAIN]: the client is non-blocking, and the connection is not yet
         established
       - [EINTR]: a signal arrived
       - [ECONNREFUSED]: the server went down in the meantime
       - [ENOTCONN]: no previous [connect]

      If called several times, this function always returns the same endpoint.
   *)

val close_client : 'a polyclient -> unit
  (** Closes the client and the endpoint. Further interactions with the client
      raise the exception {!Netsys_polypipe.Closed}.
   *)

val set_connect_notify : _ polyclient -> (unit -> unit) -> unit
  (** [set_connect_notify cl f]: Sets that the function [f] is called when
      the connection is accepted. There can only be one such function; any
      previous function is overwritten. Only future connect events are
      reported. The function is called from a different thread.
   *)

val connect_descr : 'a polyclient -> Unix.file_descr
  (** Returns a descriptor that can be used for polling. This is only
      meaningful for synchronous connects. When the descriptor
      is readable the connection is accepted, and calling [endpoint]
      again is promising.

      If [connect_descr] is called several times, always the same descriptor is
      returned.

      The caller has to close the descriptor after use.

      You can call this function only after [connect].
   *)


(** {2 Servers} *)

val create_server : unit -> 'a polyserver
  (** Create a new socket server.

      Note that a server needs 2-6 file descriptors in the current
      implementation.
   *)

val accept : nonblock:bool -> 'a polyserver -> 'a polyendpoint
  (** Accepts the next connection (or returns the next connection from the
      backlog queue). If the server is blocking, this
      function waits until the connection is established.

      Possible [Unix.unix_error] codes:
       - [EAGAIN]: the server is non-blocking, and no connection attempt is
         pending
       - [EINTR]: a signal arrived
   *)

val refuse : nonblock:bool -> 'a polyserver -> unit
  (** All pending connection attempts will be refused. The clients will get
      [ECONNREFUSED]. It is possible to return to accepting connections.

      For a non-blocking [refuse] you need to call [refuse] again after
      catching [EAGAIN].
   *)

val pending_connection : _ polyserver -> bool
  (** Whether there is a client waiting for being accepted *)

val close_server : 'a polyserver -> unit
  (** Closes the server. The accepted endpoints need to be closed separately.

      Further interactions with the server cause that the exception
      {!Netsys_polypipe.Closed} will be raised.
   *)

val set_accept_notify : _ polyserver -> (unit -> unit) -> unit
  (** [set_accept_notify srv f]: Sets that the function [f] is called when
      a new connection arrives. There can only be one such function; any
      previous function is overwritten. The event is edge-triggered: when
      several connections arrive the function is only called once. The
      function is called from a different thread.
   *)

val accept_descr : 'a polyserver -> Unix.file_descr
  (** Returns a descriptor that can be used for polling. When the descriptor
      is readable a pending connection exists. If called several times,
      always the same descriptor is returned.

      The caller has to close the descriptor after use.

      You can call this function before or after [accept].
   *)