This file is indexed.

/usr/share/ada/adainclude/florist/posix-configurable_file_limits.adb is in libflorist2014-dev 2014-1.

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
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
------------------------------------------------------------------------------
--                                                                          --
--            FLORIST (FSU Implementation of POSIX.5) COMPONENTS            --
--                                                                          --
--        P O S I X . C O N F I G U R A B L E _ F I L E _ L I M I T S       --
--                                                                          --
--                                  B o d y                                 --
--                                                                          --
--                                                                          --
--             Copyright (C) 1996-1997 Florida State University             --
--                     Copyright (C) 1998-2006 AdaCore                      --
--                                                                          --
--  This file is a component of FLORIST, an  implementation of an  Ada API  --
--  for the POSIX OS services, for use with  the  GNAT  Ada  compiler  and  --
--  the FSU Gnu Ada Runtime Library (GNARL).   The  interface  is intended  --
--  to be close to that specified in  IEEE STD  1003.5: 1990  and IEEE STD  --
--  1003.5b: 1996.                                                          --
--                                                                          --
--  FLORIST is free software;  you can  redistribute  it and/or  modify it  --
--  under terms of the  GNU  General  Public  License as  published by the  --
--  Free Software Foundation;  either version  2, or (at  your option) any  --
--  later version.  FLORIST is distributed  in  the hope  that  it will be  --
--  useful, but WITHOUT ANY WARRANTY;  without  even the implied  warranty  --
--  of MERCHANTABILITY or FITNESS FOR A PARTICULAR  PURPOSE.  See  the GNU  --
--  General Public License for more details.  You  should have  received a  --
--  copy of the GNU General Public License  distributed  with  GNARL;  see  --
--  file  COPYING.  If not,  write to  the  Free  Software  Foundation, 59  --
--  Temple Place - Suite 330, Boston, MA 02111-1307, USA.                   --
--                                                                          --
--                                                                          --
--                                                                          --
--                                                                          --
--                                                                          --
--                                                                          --
--                                                                          --
--                                                                          --
------------------------------------------------------------------------------

with POSIX.C,
     POSIX.Implementation;

package body POSIX.Configurable_File_Limits is

   use POSIX.C;
   use POSIX.Implementation;

   -------------------------
   --  Local Subprograms  --
   -------------------------

   function pathconf (path : char_ptr; name : int) return long;
   pragma Import (C, pathconf, pathconf_LINKNAME);

   function fpathconf (fd : int; name : int) return long;
   pragma Import (C, fpathconf, fpathconf_LINKNAME);

   function Is_Limited
     (Pathname : POSIX.Pathname;
      PC_Code : int) return Boolean;
   function Is_Limited
     (File : POSIX.IO.File_Descriptor;
      PC_Code : int) return Boolean;
   function Is_Supported
     (Pathname : POSIX.Pathname;
      PC_Code : int) return Boolean;
   function Is_Supported
     (File : POSIX.IO.File_Descriptor;
      PC_Code : int) return Boolean;
   function Limit
     (Pathname : POSIX.Pathname;
      PC_Code : int;
      Default_Maximum : long) return long;
   function Limit
     (File : POSIX.IO.File_Descriptor;
      PC_Code : int;
      Default_Maximum : long) return long;

   function Is_Limited
     (Pathname : POSIX.Pathname;
      PC_Code : int) return Boolean is
      Pathname_With_NUL : POSIX_String := Pathname & NUL;
   begin
      Store_Errno (0);
      --  -1 without errno unchanged -> no limit
      --  -1 with errno              -> bad name or other error
      --  other values               -> there exists a limit
      if pathconf (Pathname_With_NUL
        (Pathname_With_NUL'First)'Unchecked_Access, PC_Code) = -1 then
         if Fetch_Errno /= 0 then
            Raise_POSIX_Error;
         end if;
         return False;
      else
         return True;
      end if;
   end Is_Limited;

   function Is_Limited
     (File : POSIX.IO.File_Descriptor;
      PC_Code : int) return Boolean is
   begin
      Store_Errno (0);
      if fpathconf (int (File), PC_Code) = -1 then
         if Fetch_Errno /= 0 then
            Raise_POSIX_Error;
         end if;
         return False;
      else
         return True;
      end if;
   end Is_Limited;

   function Limit
     (Pathname : POSIX.Pathname;
      PC_Code : int;
      Default_Maximum : long) return long is
      Pathname_With_NUL : POSIX_String := Pathname & NUL;
      Result : long;
   begin
      Result := pathconf
       (Pathname_With_NUL (Pathname_With_NUL'First)'Unchecked_Access, PC_Code);
      if Result = -1 then
         if Fetch_Errno /= 0 then
            Raise_POSIX_Error;
         end if;
         return Default_Maximum;
      else
         return Result;
      end if;
   end Limit;

   function Limit
     (File : POSIX.IO.File_Descriptor;
      PC_Code : int;
      Default_Maximum : long) return long is
      Result : long;
   begin
      Result := fpathconf (int (File), PC_Code);
      if Result = -1 then
         if Fetch_Errno /= 0 then
            Raise_POSIX_Error;
         end if;
         return Default_Maximum;
      else
         return Result;
      end if;
   end Limit;

   function Is_Supported
     (Pathname : POSIX.Pathname;
      PC_Code : int) return Boolean is
      Pathname_With_NUL : POSIX_String := Pathname & NUL;
   begin
      return pathconf (Pathname_With_NUL
       (Pathname_With_NUL'First)'Unchecked_Access, PC_Code) /= 0;
   end Is_Supported;

   function Is_Supported
     (File : POSIX.IO.File_Descriptor;
      PC_Code : int) return Boolean is
   begin return fpathconf (int (File), PC_Code) /= 0;
   end Is_Supported;

   -------------------
   --  Link Limits  --
   -------------------

   function Link_Is_Limited (Pathname : POSIX.Pathname)
      return Boolean is
   begin
      return Is_Limited (Pathname, PC_LINK_MAX);
   end Link_Is_Limited;

   function Link_Is_Limited (File : POSIX.IO.File_Descriptor)
      return Boolean is
   begin
      return Is_Limited (File, PC_LINK_MAX);
   end Link_Is_Limited;

   function Link_Limit (Pathname : POSIX.Pathname)
      return Link_Limit_Maxima is
   begin
      return Link_Limit_Maxima (Limit
       (Pathname, PC_LINK_MAX, long (Link_Limit_Maxima'Last)));
   end Link_Limit;

   function Link_Limit (File : POSIX.IO.File_Descriptor)
      return Link_Limit_Maxima is
   begin
      return Link_Limit_Maxima (Limit
       (File, PC_LINK_MAX, long (Link_Limit_Maxima'Last)));
   end Link_Limit;

   ------------------------
   --  Input Line Limits --
   ------------------------

   function Input_Line_Is_Limited (Pathname : POSIX.Pathname)
      return Boolean is
   begin
      return Is_Limited (Pathname, PC_MAX_CANON);
   end Input_Line_Is_Limited;

   function Input_Line_Is_Limited (File : POSIX.IO.File_Descriptor)
      return Boolean is
   begin
      return Is_Limited (File, PC_MAX_CANON);
   end Input_Line_Is_Limited;

   function Input_Line_Limit (Pathname : POSIX.Pathname)
      return Input_Line_Limit_Maxima is
   begin
      return Input_Line_Limit_Maxima (Limit
       (Pathname, PC_MAX_CANON, long (Input_Line_Limit_Maxima'Last)));
   end Input_Line_Limit;

   function Input_Line_Limit (File : POSIX.IO.File_Descriptor)
      return Input_Line_Limit_Maxima is
   begin
      return Input_Line_Limit_Maxima (Limit
       (File, PC_MAX_CANON, long (Input_Line_Limit_Maxima'Last)));
   end Input_Line_Limit;

   -------------------------
   --  Input Queue Limits --
   -------------------------

   function Input_Queue_Is_Limited (Pathname : POSIX.Pathname)
      return Boolean is
   begin
      return Is_Limited (Pathname, PC_MAX_INPUT);
   end Input_Queue_Is_Limited;

   function Input_Queue_Is_Limited (File : POSIX.IO.File_Descriptor)
      return Boolean is
   begin
      return Is_Limited (File, PC_MAX_INPUT);
   end Input_Queue_Is_Limited;

   function Input_Queue_Limit (Pathname : POSIX.Pathname)
      return Input_Queue_Limit_Maxima is
   begin
      return Input_Queue_Limit_Maxima (Limit
       (Pathname, PC_MAX_INPUT, long (Input_Queue_Limit_Maxima'Last)));
   end Input_Queue_Limit;

   function Input_Queue_Limit (File : POSIX.IO.File_Descriptor)
      return Input_Queue_Limit_Maxima is
   begin
      return Input_Queue_Limit_Maxima (Limit
       (File, PC_MAX_INPUT, long (Input_Queue_Limit_Maxima'Last)));
   end Input_Queue_Limit;

   ------------------------------------
   --  Filename And Pathname Limits  --
   ------------------------------------

   function Filename_Is_Limited (Pathname : POSIX.Pathname)
      return Boolean is
   begin
      return Is_Limited (Pathname, PC_NAME_MAX);
   end Filename_Is_Limited;

   function Filename_Is_Limited (File : POSIX.IO.File_Descriptor)
      return Boolean is
   begin
      return Is_Limited (File, PC_NAME_MAX);
   end Filename_Is_Limited;

   function Filename_Limit (Pathname : POSIX.Pathname)
      return Filename_Limit_Maxima is
   begin
      return Filename_Limit_Maxima (Limit
       (Pathname, PC_NAME_MAX, long (Filename_Limit_Maxima'Last)));
   end Filename_Limit;

   function Filename_Limit (File : POSIX.IO.File_Descriptor)
      return Filename_Limit_Maxima is
   begin
      return Filename_Limit_Maxima (Limit
       (File, PC_NAME_MAX, long (Filename_Limit_Maxima'Last)));
   end Filename_Limit;

   function Pathname_Is_Limited (Pathname : POSIX.Pathname)
      return Boolean is
   begin
      return Is_Limited (Pathname, PC_PATH_MAX);
   end Pathname_Is_Limited;

   function Pathname_Is_Limited (File : POSIX.IO.File_Descriptor)
      return Boolean is
   begin
      return Is_Limited (File, PC_PATH_MAX);
   end Pathname_Is_Limited;

   function Pathname_Limit (Pathname : POSIX.Pathname)
      return Pathname_Limit_Maxima is
   begin
      return Pathname_Limit_Maxima (Limit
       (Pathname, PC_PATH_MAX, long (Pathname_Limit_Maxima'Last)));
   end Pathname_Limit;

   function Pathname_Limit (File : POSIX.IO.File_Descriptor)
      return Pathname_Limit_Maxima is
   begin
      return Pathname_Limit_Maxima (Limit
       (File, PC_PATH_MAX, long (Pathname_Limit_Maxima'Last)));
   end Pathname_Limit;

   --------------------------
   --  Pipe Length Limits  --
   --------------------------

   function Pipe_Length_Is_Limited (Pathname : POSIX.Pathname)
      return Boolean is
   begin
      return Is_Limited (Pathname, PC_PIPE_BUF);
   end Pipe_Length_Is_Limited;

   function Pipe_Length_Is_Limited (File : POSIX.IO.File_Descriptor)
      return Boolean is
   begin
      return Is_Limited (File, PC_PIPE_BUF);
   end Pipe_Length_Is_Limited;

   function Pipe_Length_Limit (Pathname : POSIX.Pathname)
      return Pipe_Limit_Maxima is
   begin
      return Pipe_Limit_Maxima (Limit
       (Pathname, PC_PIPE_BUF, long (Pipe_Limit_Maxima'Last)));
   end Pipe_Length_Limit;

   function Pipe_Length_Limit (File : POSIX.IO.File_Descriptor)
      return Pipe_Limit_Maxima is
   begin
      return Pipe_Limit_Maxima (Limit
       (File, PC_PIPE_BUF, long (Pipe_Limit_Maxima'Last)));
   end Pipe_Length_Limit;

   --------------------------------
   --  Change Owner Restriction  --
   --------------------------------

   function Change_Owner_Is_Restricted (Pathname : POSIX.Pathname)
      return Change_Owner_Restriction is
   begin
      return Is_Supported (Pathname, PC_CHOWN_RESTRICTED);
   end Change_Owner_Is_Restricted;

   function Change_Owner_Is_Restricted (File : POSIX.IO.File_Descriptor)
      return Change_Owner_Restriction is
   begin
      return Is_Supported (File, PC_CHOWN_RESTRICTED);
   end Change_Owner_Is_Restricted;

   ---------------------------
   --  Filename Truncation  --
   ---------------------------

   function Filename_Is_Truncated (Pathname : POSIX.Pathname)
      return Filename_Truncation is
   begin
      return Is_Supported (Pathname, PC_NO_TRUNC);
   end Filename_Is_Truncated;

   function Filename_Is_Truncated (File : POSIX.IO.File_Descriptor)
      return Filename_Truncation is
   begin
      return Is_Supported (File, PC_NO_TRUNC);
   end Filename_Is_Truncated;

   -----------------------
   --  Synchronized IO  --
   -----------------------

   function Synchronized_IO_Is_Supported (Pathname : POSIX.Pathname)
      return Boolean is
   begin
      return Is_Supported (Pathname, PC_SYNC_IO);
   end Synchronized_IO_Is_Supported;

   function Synchronized_IO_Is_Supported (File : POSIX.IO.File_Descriptor)
      return Boolean is
   begin
      return Is_Supported (File, PC_SYNC_IO);
   end Synchronized_IO_Is_Supported;

   -----------------------
   --  Asynchronous IO  --
   -----------------------

   function Asynchronous_IO_Is_Supported (Pathname : POSIX.Pathname)
      return Boolean is
   begin
      return Is_Supported (Pathname, PC_ASYNC_IO);
   end Asynchronous_IO_Is_Supported;

   function Asynchronous_IO_Is_Supported (File : POSIX.IO.File_Descriptor)
      return Boolean is
   begin
      return Is_Supported (File, PC_ASYNC_IO);
   end Asynchronous_IO_Is_Supported;

   ----------------------
   --  Prioritized IO  --
   ----------------------

   function Prioritized_IO_Is_Supported (Pathname : POSIX.Pathname)
     return Boolean is
   begin
      return Is_Supported (Pathname, PC_PRIO_IO);
   end Prioritized_IO_Is_Supported;

   function Prioritized_IO_Is_Supported (File : POSIX.IO.File_Descriptor)
     return Boolean is
   begin
      return Is_Supported (File, PC_PRIO_IO);
   end Prioritized_IO_Is_Supported;

   --  POSIX.5c [D2] additions

   function Socket_Buffer_Is_Limited (File : POSIX.IO.File_Descriptor)
     return Boolean is
   begin
      return Is_Limited (File, PC_SOCK_MAXBUF);
   end Socket_Buffer_Is_Limited;

   function Socket_Buffer_Is_Limited (Pathname : POSIX.Pathname)
     return Boolean is
   begin
      return Is_Limited (Pathname, PC_SOCK_MAXBUF);
   end Socket_Buffer_Is_Limited;

   function Socket_Buffer_Limit (Pathname : POSIX.Pathname)
     return POSIX.Limits.Socket_Buffer_Maxima is
   begin
      return POSIX.Limits.Socket_Buffer_Maxima (Limit
       (Pathname, PC_SOCK_MAXBUF,
        long (POSIX.Limits.Socket_Buffer_Maxima'Last)));
   end Socket_Buffer_Limit;

   function Socket_Buffer_Limit (File : POSIX.IO.File_Descriptor)
     return POSIX.Limits.Socket_Buffer_Maxima is
   begin
      return POSIX.Limits.Socket_Buffer_Maxima (Limit
       (File, PC_SOCK_MAXBUF, long (POSIX.Limits.Socket_Buffer_Maxima'Last)));
   end Socket_Buffer_Limit;

end POSIX.Configurable_File_Limits;