Misha Brukman | 3b87f21 | 2004-08-04 21:19:49 +0000 | [diff] [blame] | 1 | /*===- SysUtils.h - Utilities to do low-level system stuff ----------------===*\ |
| 2 | * |
| 3 | * The LLVM Compiler Infrastructure |
| 4 | * |
| 5 | * This file was developed by the LLVM research group and is distributed under |
| 6 | * the University of Illinois Open Source License. See LICENSE.TXT for details. |
| 7 | * |
| 8 | *===----------------------------------------------------------------------=== |
| 9 | * |
| 10 | * |
| 11 | * This file contains functions used to do a variety of low-level, often |
| 12 | * system-specific, tasks. |
| 13 | * |
Misha Brukman | 0abaaf4 | 2003-08-11 22:29:36 +0000 | [diff] [blame] | 14 | \*===----------------------------------------------------------------------===*/ |
| 15 | |
| 16 | #ifndef SYSUTILS_H |
| 17 | #define SYSUTILS_H |
| 18 | |
Misha Brukman | 2e1fbdd | 2003-09-29 22:37:00 +0000 | [diff] [blame] | 19 | struct stat; |
| 20 | |
| 21 | /* |
| 22 | * isExecutable - This function returns true if given struct stat describes the |
| 23 | * file as being executable. |
| 24 | */ |
| 25 | unsigned isExecutable(const struct stat *buf); |
| 26 | |
Misha Brukman | 0abaaf4 | 2003-08-11 22:29:36 +0000 | [diff] [blame] | 27 | /* |
| 28 | * isExecutableFile - This function returns true if the filename specified |
| 29 | * exists and is executable. |
| 30 | */ |
Misha Brukman | 593ece0 | 2003-08-15 23:31:16 +0000 | [diff] [blame] | 31 | unsigned isExecutableFile(const char *ExeFileName); |
Misha Brukman | 0abaaf4 | 2003-08-11 22:29:36 +0000 | [diff] [blame] | 32 | |
| 33 | /* |
Misha Brukman | 593ece0 | 2003-08-15 23:31:16 +0000 | [diff] [blame] | 34 | * FindExecutable - Find a named executable in the path. |
Misha Brukman | 0abaaf4 | 2003-08-11 22:29:36 +0000 | [diff] [blame] | 35 | */ |
| 36 | char *FindExecutable(const char *ExeName); |
| 37 | |
Misha Brukman | 2e1fbdd | 2003-09-29 22:37:00 +0000 | [diff] [blame] | 38 | /* |
| 39 | * This method finds the real `execve' call in the C library and executes the |
| 40 | * given program. |
| 41 | */ |
| 42 | int |
| 43 | executeProgram(const char *filename, char *const argv[], char *const envp[]); |
| 44 | |
Misha Brukman | 0abaaf4 | 2003-08-11 22:29:36 +0000 | [diff] [blame] | 45 | #endif |