This file is indexed.

/usr/include/parrot/6.6.0/parrot/platform_interface.h is in libparrot-dev 6.6.0-1build1.

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
/*
 * Copyright (C) 2003-2012, Parrot Foundation.
 */

#ifndef PARROT_PLATFORM_INTERFACE_H_GUARD
#define PARROT_PLATFORM_INTERFACE_H_GUARD
/*
** platform_interface.h
*/
#include "parrot/config.h"
#include "parrot/interpreter.h"

#include <math.h>

#if PARROT_HAS_HEADER_LIMITS
#  include <limits.h>
#endif

#ifndef PARROT_HAS_TIMESPEC
struct timespec {
    time_t tv_sec;
    long   tv_nsec;
};
#endif /* PARROT_HAS_TIMESPEC */

#ifdef _MSC_VER

#  ifndef LLONG_MAX
#    define LLONG_MAX _I64_MAX
#  endif
#  ifndef LLONG_MIN
#    define LLONG_MIN _I64_MIN
#  endif

#  if _MSC_VER >= 1400
#    define strdup _strdup
#  endif

/* These disable certain Level 4 Warnings */
#  pragma warning(disable: 4100) /* disables 'unreferenced formal parameter'
                                  * warnings */
#  pragma warning(disable: 4115) /* disables 'named type definition in
                                  * parentheses' warnings triggered in VC98
                                  * include files */
#  pragma warning(disable: 4505) /* disables 'unreferenced local function has
                                  * been removed' warnings in header files */

#endif /* _MSC_VER */

/*
 * init
 */

void Parrot_platform_init_code(void);

/*
 * Errors
 */

STRING *Parrot_platform_strerror(PARROT_INTERP, INTVAL error);

/*
** I/O:
*/

#ifdef _WIN32
#  define PIO_INVALID_HANDLE ((void *)-1)
typedef void *PIOHANDLE;
typedef HUGEINTVAL PIOOFF_T;
#else
#  define PIO_INVALID_HANDLE -1
typedef INTVAL PIOHANDLE;
typedef off_t PIOOFF_T;
#endif

PIOHANDLE Parrot_io_internal_std_os_handle(PARROT_INTERP, INTVAL fileno);
PIOHANDLE Parrot_io_internal_open(PARROT_INTERP, ARGIN(STRING *path), INTVAL flags);
PIOHANDLE Parrot_io_internal_dup(PARROT_INTERP, PIOHANDLE handle);
INTVAL Parrot_io_internal_close(PARROT_INTERP, PIOHANDLE handle);
INTVAL Parrot_io_internal_is_tty(PARROT_INTERP, PIOHANDLE fd);
PARROT_CONST_FUNCTION
INTVAL Parrot_io_internal_getblksize(PIOHANDLE fd);
INTVAL Parrot_io_internal_flush(PARROT_INTERP, PIOHANDLE os_handle);
size_t Parrot_io_internal_read(PARROT_INTERP, PIOHANDLE os_handle, ARGOUT(char *buf), size_t len);
size_t Parrot_io_internal_write(PARROT_INTERP, PIOHANDLE os_handle,
        ARGIN(const char *buf), size_t len);
PIOOFF_T Parrot_io_internal_seek(PARROT_INTERP, PIOHANDLE os_handle,
        PIOOFF_T offset, INTVAL whence);
PIOOFF_T Parrot_io_internal_tell(PARROT_INTERP, PIOHANDLE os_handle);
PIOHANDLE Parrot_io_internal_open_pipe(PARROT_INTERP, ARGIN(STRING *command), INTVAL flags,
        ARGOUT(INTVAL *pid_out));
INTVAL Parrot_io_internal_pipe(PARROT_INTERP, ARGMOD(PIOHANDLE *reader),
        ARGMOD(PIOHANDLE *writer));

PARROT_EXPORT
INTVAL Parrot_io_internal_async(PARROT_INTERP, ARGMOD(PMC *pmc), INTVAL async);

/*
 * Socket
 */

PMC *Parrot_io_internal_getaddrinfo(PARROT_INTERP, ARGIN(STRING *addr), INTVAL port,
        INTVAL protocol, INTVAL family, INTVAL passive);
INTVAL Parrot_io_internal_addr_match(PARROT_INTERP, ARGIN(PMC *sa), INTVAL family, INTVAL type,
            INTVAL protocol);
STRING *Parrot_io_internal_getnameinfo(PARROT_INTERP, ARGIN(const void *addr), INTVAL addr_len);
INTVAL Parrot_io_internal_getprotobyname(PARROT_INTERP, ARGIN(STRING *name));
PIOHANDLE Parrot_io_internal_socket(PARROT_INTERP, int fam, int type, int proto);
void Parrot_io_internal_connect(PARROT_INTERP, PIOHANDLE handle, ARGIN(void *addr),
        INTVAL addr_len);
void Parrot_io_internal_bind(PARROT_INTERP, PIOHANDLE handle, ARGIN(void *addr), INTVAL addr_len);
void Parrot_io_internal_listen(PARROT_INTERP, PIOHANDLE handle, INTVAL sec);
PIOHANDLE Parrot_io_internal_accept(PARROT_INTERP, PIOHANDLE handle, ARGOUT(PMC * remote_addr));
INTVAL Parrot_io_internal_send(PARROT_INTERP, PIOHANDLE handle, ARGIN(const char *buf),
        size_t len);
INTVAL Parrot_io_internal_recv(PARROT_INTERP, PIOHANDLE handle, ARGOUT(char *buf), size_t len);
INTVAL Parrot_io_internal_poll(PARROT_INTERP, PIOHANDLE handle, int which, int sec, int usec);
INTVAL Parrot_io_internal_close_socket(PARROT_INTERP, PIOHANDLE handle);

/*
 * Files and directories
 */

/* &gen_from_def(stat.pasm) */

#define STAT_EXISTS               0
#define STAT_FILESIZE             1
#define STAT_ISDIR                2
#define STAT_ISREG                3
#define STAT_ISDEV                4
#define STAT_CREATETIME           5
#define STAT_ACCESSTIME           6
#define STAT_MODIFYTIME           7
#define STAT_CHANGETIME           8
#define STAT_BACKUPTIME           9
#define STAT_UID                 10
#define STAT_GID                 11
#define STAT_ISLNK               12
#define STAT_PLATFORM_DEV        -1
#define STAT_PLATFORM_INODE      -2
#define STAT_PLATFORM_MODE       -3
#define STAT_PLATFORM_NLINKS     -4
#define STAT_PLATFORM_DEVTYPE    -5
#define STAT_PLATFORM_BLOCKSIZE  -6
#define STAT_PLATFORM_BLOCKS     -7

#define STAT_TYPE_UNKNOWN         0
#define STAT_TYPE_FILE            1
#define STAT_TYPE_DIRECTORY       2
#define STAT_TYPE_PIPE            3
#define STAT_TYPE_LINK            4
#define STAT_TYPE_DEVICE          5

/* &end_gen */

typedef struct _Parrot_Stat_Buf {
    INTVAL     type;
    HUGEINTVAL size;
    INTVAL     uid;
    INTVAL     gid;
    INTVAL     dev;
    HUGEINTVAL inode;
    INTVAL     mode;
    INTVAL     n_links;
    INTVAL     block_size;
    INTVAL     blocks;

    struct timespec create_time;
    struct timespec access_time;
    struct timespec modify_time;
    struct timespec change_time;
} Parrot_Stat_Buf;

PARROT_EXPORT
STRING *Parrot_file_getcwd(PARROT_INTERP);

PARROT_EXPORT
void Parrot_file_mkdir(PARROT_INTERP, ARGIN(STRING *path), INTVAL mode);

PARROT_EXPORT
void Parrot_file_chdir(PARROT_INTERP, ARGIN(STRING *path));

PARROT_EXPORT
void Parrot_file_rmdir(PARROT_INTERP, ARGIN(STRING *path));

PARROT_EXPORT
void Parrot_file_unlink(PARROT_INTERP, ARGIN(STRING *path));

PARROT_EXPORT
void Parrot_file_stat(PARROT_INTERP, ARGIN(STRING *path), ARGOUT(Parrot_Stat_Buf *buf));

PARROT_EXPORT
void Parrot_file_lstat(PARROT_INTERP, ARGIN(STRING *path), ARGOUT(Parrot_Stat_Buf *buf));

PARROT_EXPORT
void Parrot_file_fstat(PARROT_INTERP, PIOHANDLE handle, ARGOUT(Parrot_Stat_Buf *buf));

PARROT_EXPORT
INTVAL Parrot_file_stat_intval(PARROT_INTERP, ARGIN(STRING *path), INTVAL thing);

PARROT_EXPORT
INTVAL Parrot_file_lstat_intval(PARROT_INTERP, ARGIN(STRING * path), INTVAL thing);

PARROT_EXPORT
INTVAL Parrot_file_fstat_intval(PARROT_INTERP, PIOHANDLE os_handle, INTVAL thing);

PARROT_EXPORT
void Parrot_file_symlink(PARROT_INTERP, ARGIN(STRING *from), ARGIN(STRING *to));

PARROT_EXPORT
STRING *Parrot_file_readlink(PARROT_INTERP, ARGIN(STRING *path));

PARROT_EXPORT
void Parrot_file_link(PARROT_INTERP, ARGIN(STRING *from), ARGIN(STRING *to));

PARROT_EXPORT
INTVAL Parrot_file_umask(PARROT_INTERP, INTVAL mask);

PARROT_EXPORT
void Parrot_file_chroot(PARROT_INTERP, ARGIN(STRING *path));

PARROT_EXPORT
PMC *Parrot_file_readdir(PARROT_INTERP, ARGIN(STRING *path));

PARROT_EXPORT
void Parrot_file_rename(PARROT_INTERP, ARGIN(STRING *from), ARGIN(STRING *to));

PARROT_EXPORT
void Parrot_file_chmod(PARROT_INTERP, ARGIN(STRING *path), INTVAL mode);

PARROT_EXPORT
INTVAL Parrot_file_can_read(PARROT_INTERP, ARGIN(STRING *path));

PARROT_EXPORT
INTVAL Parrot_file_can_write(PARROT_INTERP, ARGIN(STRING *path));

PARROT_EXPORT
INTVAL Parrot_file_can_execute(PARROT_INTERP, ARGIN(STRING *path));

/*
** Math:
*/

extern int Parrot_signbit(double x);
#if NUMVAL_SIZE == 12
int Parrot_signbit_l(long double x);
#endif

#ifndef signbit
#  if NUMVAL_SIZE == 8
#    define signbit(x) Parrot_signbit(x)
#  else
#    define signbit(x) Parrot_signbit_l(x)
#  endif
#endif

#define Parrot_is_nzero(x) ((x) == 0.0 && signbit(x))

/*
** Memory:
*/

void *Parrot_memalign(size_t align, size_t size);
void *Parrot_memalign_if_possible(size_t align, size_t size);
void Parrot_free_memalign(void *);

#if !defined(PARROT_HAS_SOME_MEMALIGN)
#  define Parrot_memalign_if_possible(a, s) malloc(s)
#else
#  define Parrot_memalign_if_possible(a, s) Parrot_memalign((a), (s))
#endif

/*
** Processes
*/

typedef enum Parrot_proc_exec_enum {
    /*
     * Activates RTLD_GLOBAL on *NIX systems, making symbols from the newly
     * loaded library visible to other libraries; this is usually needed if
     * it will load libraries itself.
     */
    PARROT_EXEC_STDIN   = 0x01,
    PARROT_EXEC_STDOUT  = 0x02,
    PARROT_EXEC_STDERR  = 0x04
} Parrot_proc_exec_flags;

PARROT_EXPORT
INTVAL Parrot_Run_OS_Command(Interp*, STRING *);

PARROT_EXPORT
INTVAL Parrot_Run_OS_Command_Argv(Interp*, PMC *);

PARROT_EXPORT
UINTVAL Parrot_getpid(void);

INTVAL Parrot_proc_exec(Interp *, STRING *command, INTVAL flags, PIOHANDLE *handles);
INTVAL Parrot_proc_waitpid(Interp *, INTVAL pid);

/*
** Time
*/

PARROT_EXPORT
void Parrot_sleep(unsigned int seconds);

PARROT_EXPORT
void Parrot_usleep(unsigned int microseconds);
void Parrot_floatval_sleep(FLOATVAL time);

PARROT_EXPORT
INTVAL Parrot_intval_time(void);

PARROT_EXPORT
FLOATVAL Parrot_floatval_time(void);

PARROT_EXPORT
struct tm * Parrot_gmtime_r(const time_t *, struct tm *);

PARROT_EXPORT
struct tm * Parrot_localtime_r(const time_t *, struct tm *);

PARROT_EXPORT
char* Parrot_asctime_r(const struct tm*, char *);

/*
 * Env
 */

PARROT_EXPORT
void Parrot_setenv(PARROT_INTERP, STRING *name, STRING *value);

PARROT_EXPORT
void Parrot_unsetenv(PARROT_INTERP, STRING *name);

PARROT_EXPORT
STRING * Parrot_getenv(PARROT_INTERP, STRING *name);

/*
** Dynamic Loading:
*/

/*
 * The second argument to Parrot_dlopen below provides portable access to
 * non-default behavior of dynamic linkers.
 *
 * All flags will be ignored on platforms for which they are inapplicable.
 */

/* &gen_from_enum(dlopenflags.pasm) */
typedef enum Parrot_dlopen_enum {
    /*
     * Activates RTLD_GLOBAL on *NIX systems, making symbols from the newly
     * loaded library visible to other libraries; this is usually needed if
     * it will load libraries itself.
     */
    Parrot_dlopen_global_FLAG   = 0x01
} Parrot_dlopen_flags;
/* &end_gen */

void *Parrot_dlopen(const char *filename, Parrot_dlopen_flags flags);
const char *Parrot_dlerror(void);
void *Parrot_dlsym(void *handle, const char *symbol);
int Parrot_dlclose(void *handle);

/*
 * encoding
 */
void Parrot_init_platform_encoding(PARROT_INTERP);
size_t Parrot_str_platform_strlen(PARROT_INTERP, const char *s);

/*
 * system timer
 */

#ifdef PARROT_HAS_SOME_SYS_TIMER

void * new_sys_timer_ms(void);
void start_sys_timer_ms(void *handle, int ms);
void stop_sys_timer_ms(void *handle);
int get_sys_timer_ms(void *handle);

#else

#  define new_sys_timer_ms() NULL
#  define start_sys_timer_ms(h, m)
#  define stop_sys_timer_ms(h)
#  define get_sys_timer_ms(h) 0

#endif

/*
 * high-resolution timer support
 */

PARROT_EXPORT
UHUGEINTVAL Parrot_hires_get_time(void);

PARROT_EXPORT
PARROT_CONST_FUNCTION
UINTVAL     Parrot_hires_get_tick_duration(void);

/*
 * user information
 */

PARROT_EXPORT
UINTVAL Parrot_get_user_id(void);

/*
 * system memory
 */

PARROT_EXPORT
size_t Parrot_sysmem_amount(Interp*);

/*
 * Entropy
 */

PARROT_EXPORT
INTVAL Parrot_get_entropy(PARROT_INTERP);

/*
 * CPU
 */
PARROT_EXPORT
STRING *Parrot_get_cpu_type(PARROT_INTERP);

PARROT_EXPORT
INTVAL Parrot_get_num_cpus(PARROT_INTERP);


#endif /* PARROT_PLATFORM_INTERFACE_H_GUARD */

/*
 * Local variables:
 *   c-file-style: "parrot"
 * End:
 * vim: expandtab shiftwidth=4 cinoptions='\:2=2' :
 */