Rom Lemarchand | 113bd47 | 2013-01-10 15:21:18 -0800 | [diff] [blame] | 1 | /* system/core/include/logwrap/logwrap.h |
| 2 | * |
| 3 | * Copyright 2013, The Android Open Source Project |
| 4 | * |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | #ifndef __LIBS_LOGWRAP_H |
| 19 | #define __LIBS_LOGWRAP_H |
| 20 | |
| 21 | __BEGIN_DECLS |
| 22 | |
Rom Lemarchand | b58a822 | 2013-01-09 21:31:25 -0800 | [diff] [blame^] | 23 | /* |
| 24 | * Run a command while logging its stdout and stderr |
| 25 | * |
| 26 | * WARNING: while this function is running it will clear all SIGCHLD handlers |
| 27 | * if you rely on SIGCHLD in the caller there is a chance zombies will be |
| 28 | * created if you're not calling waitpid after calling this. This function will |
| 29 | * log a warning when it clears SIGCHLD for processes other than the child it |
| 30 | * created. |
| 31 | * |
| 32 | * Arguments: |
| 33 | * argc: the number of elements in argv |
| 34 | * argv: an array of strings containing the command to be executed and its |
| 35 | * arguments as separate strings. argv does not need to be |
| 36 | * NULL-terminated |
| 37 | * status: the equivalent child status as populated by wait(status). This |
| 38 | * value is only valid when logwrap successfully completes |
| 39 | * |
| 40 | * Return value: |
| 41 | * 0 when logwrap successfully run the child process and captured its status |
| 42 | * -1 when an internal error occurred |
| 43 | * |
| 44 | */ |
| 45 | int logwrap(int argc, char* argv[], int *status); |
Rom Lemarchand | 113bd47 | 2013-01-10 15:21:18 -0800 | [diff] [blame] | 46 | |
| 47 | __END_DECLS |
| 48 | |
| 49 | #endif /* __LIBS_LOGWRAP_H */ |