Rizin
unix-like reverse engineering framework and cli tools
libiberty.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2001, 2002, 2005 Free Software Foundation, Inc.
2 // SPDX-License-Identifier: GPL-2.0-or-later
3 
4 /* Function declarations for libiberty.
5 
6  Copyright 2001, 2002, 2005 Free Software Foundation, Inc.
7 
8  Note - certain prototypes declared in this header file are for
9  functions whoes implementation copyright does not belong to the
10  FSF. Those prototypes are present in this file for reference
11  purposes only and their presence in this file should not construed
12  as an indication of ownership by the FSF of the implementation of
13  those functions in any way or form whatsoever.
14 
15  This program is free software; you can redistribute it and/or modify
16  it under the terms of the GNU General Public License as published by
17  the Free Software Foundation; either version 2, or (at your option)
18  any later version.
19 
20  This program is distributed in the hope that it will be useful,
21  but WITHOUT ANY WARRANTY; without even the implied warranty of
22  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  GNU General Public License for more details.
24 
25  You should have received a copy of the GNU General Public License
26  along with this program; if not, write to the Free Software
27  Foundation, Inc., 51 Franklin Street - Fifth Floor,
28  Boston, MA 02110-1301, USA.
29 
30  Written by Cygnus Support, 1994.
31 
32  The libiberty library provides a number of functions which are
33  missing on some operating systems. We do not declare those here,
34  to avoid conflicts with the system header files on operating
35  systems that do support those functions. In this file we only
36  declare those functions which are specific to libiberty. */
37 
38 #ifndef LIBIBERTY_H
39 #define LIBIBERTY_H
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 #include "ansidecl.h"
46 
47 /* Get a definition for size_t. */
48 #include <stddef.h>
49 /* Get a definition for va_list. */
50 #include <stdarg.h>
51 
52 #include <stdio.h>
53 
54 /* If the OS supports it, ensure that the supplied stream is setup to
55  avoid any multi-threaded locking. Otherwise leave the FILE pointer
56  unchanged. If the stream is NULL do nothing. */
57 
58 extern void unlock_stream(FILE *);
59 
60 /* If the OS supports it, ensure that the standard I/O streams, stdin,
61  stdout and stderr are setup to avoid any multi-threaded locking.
62  Otherwise do nothing. */
63 
64 extern void unlock_std_streams(void);
65 
66 /* Open and return a FILE pointer. If the OS supports it, ensure that
67  the stream is setup to avoid any multi-threaded locking. Otherwise
68  return the FILE pointer unchanged. */
69 
70 extern FILE *fopen_unlocked(const char *, const char *);
71 extern FILE *fdopen_unlocked(int, const char *);
72 extern FILE *freopen_unlocked(const char *, const char *, FILE *);
73 
74 /* Build an argument vector from a string. Allocates memory using
75  malloc. Use freeargv to free the vector. */
76 
77 extern char **buildargv(const char *) ATTRIBUTE_MALLOC;
78 
79 /* Free a vector returned by buildargv. */
80 
81 extern void freeargv(char **);
82 
83 /* Duplicate an argument vector. Allocates memory using malloc. Use
84  freeargv to free the vector. */
85 
86 extern char **dupargv(char **) ATTRIBUTE_MALLOC;
87 
88 /* Expand "@file" arguments in argv. */
89 
90 extern void expandargv PARAMS((int *, char ***));
91 
92 /* Return the last component of a path name. Note that we can't use a
93  prototype here because the parameter is declared inconsistently
94  across different systems, sometimes as "char *" and sometimes as
95  "const char *" */
96 
97 /* HAVE_DECL_* is a three-state macro: undefined, 0 or 1. If it is
98  undefined, we haven't run the autoconf check so provide the
99  declaration without arguments. If it is 0, we checked and failed
100  to find the declaration so provide a fully prototyped one. If it
101  is 1, we found it so don't provide any declaration at all. */
102 #if !HAVE_DECL_BASENAME
103 #if defined(__GNU_LIBRARY__) || defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__CYGWIN__) || defined(__CYGWIN32__) || defined(__MINGW32__) || defined(HAVE_DECL_BASENAME)
104 extern char *basename(const char *);
105 #else
106 /* Do not allow basename to be used if there is no prototype seen. We
107  either need to use the above prototype or have one from
108  autoconf which would result in HAVE_DECL_BASENAME being set. */
109 #define basename basename_cannot_be_used_without_a_prototype
110 #endif
111 #endif
112 
113 /* A well-defined basename () that is always compiled in. */
114 
115 extern const char *lbasename(const char *);
116 
117 /* A well-defined realpath () that is always compiled in. */
118 
119 extern char *lrealpath(const char *);
120 
121 /* Concatenate an arbitrary number of strings. You must pass NULL as
122  the last argument of this function, to terminate the list of
123  strings. Allocates memory using xmalloc. */
124 
125 extern char *concat(const char *, ...) ATTRIBUTE_MALLOC ATTRIBUTE_SENTINEL;
126 
127 /* Concatenate an arbitrary number of strings. You must pass NULL as
128  the last argument of this function, to terminate the list of
129  strings. Allocates memory using xmalloc. The first argument is
130  not one of the strings to be concatenated, but if not NULL is a
131  pointer to be freed after the new string is created, similar to the
132  way xrealloc works. */
133 
134 extern char *reconcat(char *, const char *, ...) ATTRIBUTE_MALLOC ATTRIBUTE_SENTINEL;
135 
136 /* Determine the length of concatenating an arbitrary number of
137  strings. You must pass NULL as the last argument of this function,
138  to terminate the list of strings. */
139 
140 extern unsigned long concat_length(const char *, ...) ATTRIBUTE_SENTINEL;
141 
142 /* Concatenate an arbitrary number of strings into a SUPPLIED area of
143  memory. You must pass NULL as the last argument of this function,
144  to terminate the list of strings. The supplied memory is assumed
145  to be large enough. */
146 
147 extern char *concat_copy(char *, const char *, ...) ATTRIBUTE_SENTINEL;
148 
149 /* Concatenate an arbitrary number of strings into a GLOBAL area of
150  memory. You must pass NULL as the last argument of this function,
151  to terminate the list of strings. The supplied memory is assumed
152  to be large enough. */
153 
154 extern char *concat_copy2(const char *, ...) ATTRIBUTE_SENTINEL;
155 
156 /* This is the global area used by concat_copy2. */
157 
158 extern char *libiberty_concat_ptr;
159 
160 /* Concatenate an arbitrary number of strings. You must pass NULL as
161  the last argument of this function, to terminate the list of
162  strings. Allocates memory using alloca. The arguments are
163  evaluated twice! */
164 #define ACONCAT(ACONCAT_PARAMS) \
165  (libiberty_concat_ptr = (char *)alloca(concat_length ACONCAT_PARAMS + 1), \
166  concat_copy2 ACONCAT_PARAMS)
167 
168 /* Check whether two file descriptors refer to the same file. */
169 
170 extern int fdmatch(int fd1, int fd2);
171 
172 /* Return the position of the first bit set in the argument. */
173 /* Prototypes vary from system to system, so we only provide a
174  prototype on systems where we know that we need it. */
175 #if defined(HAVE_DECL_FFS) && !HAVE_DECL_FFS
176 extern int ffs(int);
177 #endif
178 
179 /* Get the working directory. The result is cached, so don't call
180  chdir() between calls to getpwd(). */
181 
182 extern char *getpwd(void);
183 
184 /* Get the current time. */
185 /* Prototypes vary from system to system, so we only provide a
186  prototype on systems where we know that we need it. */
187 #ifdef __MINGW32__
188 /* Forward declaration to avoid #include <sys/time.h>. */
189 struct timeval;
190 extern int gettimeofday(struct timeval *, void *);
191 #endif
192 
193 /* Get the amount of time the process has run, in microseconds. */
194 
195 extern long get_run_time(void);
196 
197 /* Generate a relocated path to some installation directory. Allocates
198  return value using malloc. */
199 
200 extern char *make_relative_prefix(const char *, const char *,
201  const char *) ATTRIBUTE_MALLOC;
202 
203 /* Choose a temporary directory to use for scratch files. */
204 
206 
207 /* Return a temporary file name or NULL if unable to create one. */
208 
209 extern char *make_temp_file(const char *) ATTRIBUTE_MALLOC;
210 
211 /* Remove a link to a file unless it is special. */
212 
213 extern int unlink_if_ordinary(const char *);
214 
215 /* Allocate memory filled with spaces. Allocates using malloc. */
216 
217 extern const char *spaces(int count);
218 
219 /* Return the maximum error number for which strerror will return a
220  string. */
221 
222 extern int errno_max(void);
223 
224 /* Return the name of an errno value (e.g., strerrno (EINVAL) returns
225  "EINVAL"). */
226 
227 extern const char *strerrno(int);
228 
229 /* Given the name of an errno value, return the value. */
230 
231 extern int strtoerrno(const char *);
232 
233 /* ANSI's strerror(), but more robust. */
234 
235 extern char *xstrerror(int);
236 
237 /* Return the maximum signal number for which strsignal will return a
238  string. */
239 
240 extern int signo_max(void);
241 
242 /* Return a signal message string for a signal number
243  (e.g., strsignal (SIGHUP) returns something like "Hangup"). */
244 /* This is commented out as it can conflict with one in system headers.
245  We still document its existence though. */
246 
247 /*extern const char *strsignal (int);*/
248 
249 /* Return the name of a signal number (e.g., strsigno (SIGHUP) returns
250  "SIGHUP"). */
251 
252 extern const char *strsigno(int);
253 
254 /* Given the name of a signal, return its number. */
255 
256 extern int strtosigno(const char *);
257 
258 /* Register a function to be run by xexit. Returns 0 on success. */
259 
260 extern int xatexit(void (*fn)(void));
261 
262 /* Exit, calling all the functions registered with xatexit. */
263 
264 extern void xexit(int status) ATTRIBUTE_NORETURN;
265 
266 /* Set the program name used by xmalloc. */
267 
268 extern void xmalloc_set_program_name(const char *);
269 
270 /* Report an allocation failure. */
271 extern void xmalloc_failed(size_t) ATTRIBUTE_NORETURN;
272 
273 /* Allocate memory without fail. If malloc fails, this will print a
274  message to stderr (using the name set by xmalloc_set_program_name,
275  if any) and then call xexit. */
276 
277 extern void *xmalloc(size_t) ATTRIBUTE_MALLOC;
278 
279 /* Reallocate memory without fail. This works like xmalloc. Note,
280  realloc type functions are not suitable for attribute malloc since
281  they may return the same address across multiple calls. */
282 
283 extern void *xrealloc(void *, size_t);
284 
285 /* Allocate memory without fail and set it to zero. This works like
286  xmalloc. */
287 
288 extern void *xcalloc(size_t, size_t) ATTRIBUTE_MALLOC;
289 
290 /* Copy a string into a memory buffer without fail. */
291 
292 extern char *xstrdup(const char *) ATTRIBUTE_MALLOC;
293 
294 /* Copy at most N characters from string into a buffer without fail. */
295 
296 extern char *xstrndup(const char *, size_t) ATTRIBUTE_MALLOC;
297 
298 /* Copy an existing memory buffer to a new memory buffer without fail. */
299 
300 extern void *xmemdup(const void *, size_t, size_t) ATTRIBUTE_MALLOC;
301 
302 /* Physical memory routines. Return values are in BYTES. */
303 extern double physmem_total(void);
304 extern double physmem_available(void);
305 
306 /* These macros provide a K&R/C89/C++-friendly way of allocating structures
307  with nice encapsulation. The XDELETE*() macros are technically
308  superfluous, but provided here for symmetry. Using them consistently
309  makes it easier to update client code to use different allocators such
310  as new/delete and new[]/delete[]. */
311 
312 /* Scalar allocators. */
313 #ifdef _MSC_VER
314 #include <stdlib.h>
315 #define xmalloc malloc
316 #define xcalloc calloc
317 #define xrealloc realloc
318 #endif
319 #define XNEW(T) ((T *)xmalloc(sizeof(T)))
320 #define XCNEW(T) ((T *)xcalloc(1, sizeof(T)))
321 #define XDELETE(P) free((void *)(P))
322 
323 /* Array allocators. */
324 
325 #define XNEWVEC(T, N) ((T *)xmalloc(sizeof(T) * (N)))
326 #define XCNEWVEC(T, N) ((T *)xcalloc((N), sizeof(T)))
327 #define XRESIZEVEC(T, P, N) ((T *)xrealloc((void *)(P), sizeof(T) * (N)))
328 #define XDELETEVEC(P) free((void *)(P))
329 
330 /* Allocators for variable-sized structures and raw buffers. */
331 
332 #define XNEWVAR(T, S) ((T *)xmalloc((S)))
333 #define XCNEWVAR(T, S) ((T *)xcalloc(1, (S)))
334 #define XRESIZEVAR(T, P, S) ((T *)xrealloc((P), (S)))
335 
336 /* Type-safe obstack allocator. */
337 
338 #define XOBNEW(O, T) ((T *)obstack_alloc((O), sizeof(T)))
339 #define XOBFINISH(O, T) ((T)obstack_finish((O)))
340 
341 /* hex character manipulation routines */
342 
343 #define _hex_array_size 256
344 #define _hex_bad 99
345 extern const unsigned char _hex_value[_hex_array_size];
346 extern void hex_init(void);
347 #define hex_p(c) (hex_value(c) != _hex_bad)
348 /* If you change this, note well: Some code relies on side effects in
349  the argument being performed exactly once. */
350 #define hex_value(c) ((unsigned int)_hex_value[(unsigned char)(c)])
351 
352 /* Flags for pex_init. These are bits to be or'ed together. */
353 
354 /* Record subprocess times, if possible. */
355 #define PEX_RECORD_TIMES 0x1
356 
357 /* Use pipes for communication between processes, if possible. */
358 #define PEX_USE_PIPES 0x2
359 
360 /* Save files used for communication between processes. */
361 #define PEX_SAVE_TEMPS 0x4
362 
363 /* Prepare to execute one or more programs, with standard output of
364  each program fed to standard input of the next.
365  FLAGS As above.
366  PNAME The name of the program to report in error messages.
367  TEMPBASE A base name to use for temporary files; may be NULL to
368  use a random name.
369  Returns NULL on error. */
370 
371 extern struct pex_obj *pex_init(int flags, const char *pname,
372  const char *tempbase);
373 
374 /* Flags for pex_run. These are bits to be or'ed together. */
375 
376 /* Last program in pipeline. Standard output of program goes to
377  OUTNAME, or, if OUTNAME is NULL, to standard output of caller. Do
378  not set this if you want to call pex_read_output. After this is
379  set, pex_run may no longer be called with the same struct
380  pex_obj. */
381 #define PEX_LAST 0x1
382 
383 /* Search for program in executable search path. */
384 #define PEX_SEARCH 0x2
385 
386 /* OUTNAME is a suffix. */
387 #define PEX_SUFFIX 0x4
388 
389 /* Send program's standard error to standard output. */
390 #define PEX_STDERR_TO_STDOUT 0x8
391 
392 /* Input file should be opened in binary mode. This flag is ignored
393  on Unix. */
394 #define PEX_BINARY_INPUT 0x10
395 
396 /* Output file should be opened in binary mode. This flag is ignored
397  on Unix. For proper behaviour PEX_BINARY_INPUT and
398  PEX_BINARY_OUTPUT have to match appropriately--i.e., a call using
399  PEX_BINARY_OUTPUT should be followed by a call using
400  PEX_BINARY_INPUT. */
401 #define PEX_BINARY_OUTPUT 0x20
402 
403 /* Execute one program. Returns NULL on success. On error returns an
404  error string (typically just the name of a system call); the error
405  string is statically allocated.
406 
407  OBJ Returned by pex_init.
408 
409  FLAGS As above.
410 
411  EXECUTABLE The program to execute.
412 
413  ARGV NULL terminated array of arguments to pass to the program.
414 
415  OUTNAME Sets the output file name as follows:
416 
417  PEX_SUFFIX set (OUTNAME may not be NULL):
418  TEMPBASE parameter to pex_init not NULL:
419  Output file name is the concatenation of TEMPBASE
420  and OUTNAME.
421  TEMPBASE is NULL:
422  Output file name is a random file name ending in
423  OUTNAME.
424  PEX_SUFFIX not set:
425  OUTNAME not NULL:
426  Output file name is OUTNAME.
427  OUTNAME NULL, TEMPBASE not NULL:
428  Output file name is randomly chosen using
429  TEMPBASE.
430  OUTNAME NULL, TEMPBASE NULL:
431  Output file name is randomly chosen.
432 
433  If PEX_LAST is not set, the output file name is the
434  name to use for a temporary file holding stdout, if
435  any (there will not be a file if PEX_USE_PIPES is set
436  and the system supports pipes). If a file is used, it
437  will be removed when no longer needed unless
438  PEX_SAVE_TEMPS is set.
439 
440  If PEX_LAST is set, and OUTNAME is not NULL, standard
441  output is written to the output file name. The file
442  will not be removed. If PEX_LAST and PEX_SUFFIX are
443  both set, TEMPBASE may not be NULL.
444 
445  ERRNAME If not NULL, this is the name of a file to which
446  standard error is written. If NULL, standard error of
447  the program is standard error of the caller.
448 
449  ERR On an error return, *ERR is set to an errno value, or
450  to 0 if there is no relevant errno.
451 */
452 
453 extern const char *pex_run(struct pex_obj *obj, int flags,
454  const char *executable, char *const *argv,
455  const char *outname, const char *errname,
456  int *err);
457 
458 /* Return a `FILE' pointer FP for the standard input of the first
459  program in the pipeline; FP is opened for writing. You must have
460  passed `PEX_USE_PIPES' to the `pex_init' call that returned OBJ.
461  You must close FP yourself with `fclose' to indicate that the
462  pipeline's input is complete.
463 
464  The file descriptor underlying FP is marked not to be inherited by
465  child processes.
466 
467  This call is not supported on systems which do not support pipes;
468  it returns with an error. (We could implement it by writing a
469  temporary file, but then you would need to write all your data and
470  close FP before your first call to `pex_run' -- and that wouldn't
471  work on systems that do support pipes: the pipe would fill up, and
472  you would block. So there isn't any easy way to conceal the
473  differences between the two types of systems.)
474 
475  If you call both `pex_write_input' and `pex_read_output', be
476  careful to avoid deadlock. If the output pipe fills up, so that
477  each program in the pipeline is waiting for the next to read more
478  data, and you fill the input pipe by writing more data to FP, then
479  there is no way to make progress: the only process that could read
480  data from the output pipe is you, but you are blocked on the input
481  pipe. */
482 
483 extern FILE *pex_write_input(struct pex_obj *obj, int binary);
484 
485 /* Return a stream for a temporary file to pass to the first program
486  in the pipeline as input. The file name is chosen as for pex_run.
487  pex_run closes the file automatically; don't close it yourself. */
488 
489 extern FILE *pex_input_file(struct pex_obj *obj, int flags,
490  const char *in_name);
491 
492 /* Return a stream for a pipe connected to the standard input of the
493  first program in the pipeline. You must have passed
494  `PEX_USE_PIPES' to `pex_init'. Close the returned stream
495  yourself. */
496 
497 extern FILE *pex_input_pipe(struct pex_obj *obj, int binary);
498 
499 /* Read the standard output of the last program to be executed.
500  pex_run can not be called after this. BINARY should be non-zero if
501  the file should be opened in binary mode; this is ignored on Unix.
502  Returns NULL on error. Don't call fclose on the returned FILE; it
503  will be closed by pex_free. */
504 
505 extern FILE *pex_read_output(struct pex_obj *, int binary);
506 
507 /* Return exit status of all programs in VECTOR. COUNT indicates the
508  size of VECTOR. The status codes in the vector are in the order of
509  the calls to pex_run. Returns 0 on error, 1 on success. */
510 
511 extern int pex_get_status(struct pex_obj *, int count, int *vector);
512 
513 /* Return times of all programs in VECTOR. COUNT indicates the size
514  of VECTOR. struct pex_time is really just struct timeval, but that
515  is not portable to all systems. Returns 0 on error, 1 on
516  success. */
517 
518 struct pex_time {
519  unsigned long user_seconds;
520  unsigned long user_microseconds;
521  unsigned long system_seconds;
522  unsigned long system_microseconds;
523 };
524 
525 extern int pex_get_times(struct pex_obj *, int count,
526  struct pex_time *vector);
527 
528 /* Clean up a pex_obj. */
529 
530 extern void pex_free(struct pex_obj *);
531 
532 /* Just execute one program. Return value is as for pex_run.
533  FLAGS Combination of PEX_SEARCH and PEX_STDERR_TO_STDOUT.
534  EXECUTABLE As for pex_run.
535  ARGV As for pex_run.
536  PNAME As for pex_init.
537  OUTNAME As for pex_run when PEX_LAST is set.
538  ERRNAME As for pex_run.
539  STATUS Set to exit status on success.
540  ERR As for pex_run.
541 */
542 
543 extern const char *pex_one(int flags, const char *executable,
544  char *const *argv, const char *pname,
545  const char *outname, const char *errname,
546  int *status, int *err);
547 
548 /* pexecute and pwait are the old pexecute interface, still here for
549  backward compatibility. Don't use these for new code. Instead,
550  use pex_init/pex_run/pex_get_status/pex_free, or pex_one. */
551 
552 /* Definitions used by the pexecute routine. */
553 
554 #define PEXECUTE_FIRST 1
555 #define PEXECUTE_LAST 2
556 #define PEXECUTE_ONE (PEXECUTE_FIRST + PEXECUTE_LAST)
557 #define PEXECUTE_SEARCH 4
558 #define PEXECUTE_VERBOSE 8
559 
560 /* Execute a program. */
561 
562 extern int pexecute(const char *, char *const *, const char *,
563  const char *, char **, char **, int);
564 
565 /* Wait for pexecute to finish. */
566 
567 extern int pwait(int, int *, int);
568 
569 #if defined(HAVE_DECL_STRVERSCMP) && !HAVE_DECL_STRVERSCMP
570 /* Compare version strings. */
571 extern int strverscmp(const char *, const char *);
572 #endif
573 
574 #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
575 
576 /* Drastically simplified alloca configurator. If we're using GCC,
577  we use __builtin_alloca; otherwise we use the C alloca. The C
578  alloca is always available. You can override GCC by defining
579  USE_C_ALLOCA yourself. The canonical autoconf macro C_ALLOCA is
580  also set/unset as it is often used to indicate whether code needs
581  to call alloca(0). */
582 extern void *C_alloca(size_t) ATTRIBUTE_MALLOC;
583 #undef alloca
584 #if GCC_VERSION >= 2000 && !defined USE_C_ALLOCA
585 #define alloca(x) __builtin_alloca(x)
586 #undef C_ALLOCA
587 #define ASTRDUP(X) \
588  (__extension__({ const char *const libiberty_optr = (X); \
589  const unsigned long libiberty_len = strlen (libiberty_optr) + 1; \
590  char *const libiberty_nptr = (char *const) alloca (libiberty_len); \
591  (char *) memcpy (libiberty_nptr, libiberty_optr, libiberty_len); }))
592 #else
593 #define alloca(x) C_alloca(x)
594 #undef USE_C_ALLOCA
595 #define USE_C_ALLOCA 1
596 #undef C_ALLOCA
597 #define C_ALLOCA 1
598 extern const char *libiberty_optr;
599 extern char *libiberty_nptr;
600 extern unsigned long libiberty_len;
601 #define ASTRDUP(X) \
602  (libiberty_optr = (X), \
603  libiberty_len = strlen(libiberty_optr) + 1, \
604  libiberty_nptr = (char *)alloca(libiberty_len), \
605  (char *)memcpy(libiberty_nptr, libiberty_optr, libiberty_len))
606 #endif
607 
608 #ifdef __cplusplus
609 }
610 #endif
611 
612 #endif /* ! defined (LIBIBERTY_H) */
static bool err
Definition: armass.c:435
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec vector
Definition: sflib.h:82
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
Definition: sflib.h:98
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog gettimeofday
Definition: sflib.h:79
#define const
Definition: ansidecl.h:240
#define ATTRIBUTE_SENTINEL
Definition: ansidecl.h:370
#define ATTRIBUTE_MALLOC
Definition: ansidecl.h:274
#define ATTRIBUTE_NORETURN
Definition: ansidecl.h:300
char * concat(const char *,...) ATTRIBUTE_MALLOC ATTRIBUTE_SENTINEL
void unlock_stream(FILE *)
FILE * pex_input_pipe(struct pex_obj *obj, int binary)
const char * strsigno(int)
FILE * pex_input_file(struct pex_obj *obj, int flags, const char *in_name)
void * xmemdup(const void *, size_t, size_t) ATTRIBUTE_MALLOC
char * xstrdup(const char *) ATTRIBUTE_MALLOC
Definition: util.c:48
void pex_free(struct pex_obj *)
void unlock_std_streams(void)
void expandargv PARAMS((int *, char ***))
char * xstrndup(const char *, size_t) ATTRIBUTE_MALLOC
char * xstrerror(int)
const char * strerrno(int)
char * lrealpath(const char *)
const char * lbasename(const char *)
void * xrealloc(void *, size_t)
Definition: util.c:25
#define _hex_array_size
Definition: libiberty.h:343
void * xcalloc(size_t, size_t) ATTRIBUTE_MALLOC
int strtosigno(const char *)
FILE * fdopen_unlocked(int, const char *)
void xmalloc_set_program_name(const char *)
FILE * pex_write_input(struct pex_obj *obj, int binary)
void * C_alloca(size_t) ATTRIBUTE_MALLOC
struct pex_obj * pex_init(int flags, const char *pname, const char *tempbase)
#define basename
Definition: libiberty.h:109
void xmalloc_failed(size_t) ATTRIBUTE_NORETURN
char * reconcat(char *, const char *,...) ATTRIBUTE_MALLOC ATTRIBUTE_SENTINEL
char * libiberty_nptr
int strtoerrno(const char *)
int pwait(int, int *, int)
char ** buildargv(const char *) ATTRIBUTE_MALLOC
int pex_get_status(struct pex_obj *, int count, int *vector)
char ** dupargv(char **) ATTRIBUTE_MALLOC
const char * spaces(int count)
int xatexit(void(*fn)(void))
char * getpwd(void)
FILE * fopen_unlocked(const char *, const char *)
char * make_temp_file(const char *) ATTRIBUTE_MALLOC
const char * libiberty_optr
double physmem_available(void)
int unlink_if_ordinary(const char *)
const char * pex_one(int flags, const char *executable, char *const *argv, const char *pname, const char *outname, const char *errname, int *status, int *err)
int errno_max(void)
unsigned long libiberty_len
FILE * freopen_unlocked(const char *, const char *, FILE *)
void * xmalloc(size_t) ATTRIBUTE_MALLOC
int signo_max(void)
char * libiberty_concat_ptr
const char * pex_run(struct pex_obj *obj, int flags, const char *executable, char *const *argv, const char *outname, const char *errname, int *err)
double physmem_total(void)
void xexit(int status) ATTRIBUTE_NORETURN
char * make_relative_prefix(const char *, const char *, const char *) ATTRIBUTE_MALLOC
unsigned long concat_length(const char *,...) ATTRIBUTE_SENTINEL
char * choose_temp_base(void) ATTRIBUTE_MALLOC
void hex_init(void)
char * concat_copy2(const char *,...) ATTRIBUTE_SENTINEL
char * concat_copy(char *, const char *,...) ATTRIBUTE_SENTINEL
int pexecute(const char *, char *const *, const char *, const char *, char **, char **, int)
int pex_get_times(struct pex_obj *, int count, struct pex_time *vector)
void freeargv(char **)
int fdmatch(int fd1, int fd2)
const unsigned char _hex_value[_hex_array_size]
long get_run_time(void)
FILE * pex_read_output(struct pex_obj *, int binary)
static static fork const void static count static fd const char const char static newpath char char argv
Definition: sflib.h:40
static const char struct stat static buf struct stat static buf static idle const char static path static fd const char static len const void static prot const char struct module static image struct kernel_sym static table unsigned char static buf static fsuid unsigned struct dirent unsigned static count const struct iovec static count static pid const void static len static flags const struct sched_param static p static pid static policy struct timespec static tp static suid unsigned fn
Definition: sflib.h:186
static const char struct stat static buf struct stat static buf static vhangup int status
Definition: sflib.h:145
string FILE
Definition: benchmark.py:21
static struct sockaddr static addrlen static backlog const void static flags void flags
Definition: sfsocketcall.h:123
unsigned long user_microseconds
Definition: libiberty.h:520
unsigned long user_seconds
Definition: libiberty.h:519
unsigned long system_seconds
Definition: libiberty.h:521
unsigned long system_microseconds
Definition: libiberty.h:522
static char * binary(unsigned int val, unsigned int bits)
Definition: debug.c:3