blob: a50d5fe45b5ecea41999c5fb263d7d9a28cf192d [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2007 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.os;
18
19import java.io.FileDescriptor;
20
21/**
22 * @hide
23 * Tools for executing commands. Not for public consumption.
24 */
25
26public class Exec
27{
28 /**
29 * @param cmd The command to execute
30 * @param arg0 The first argument to the command, may be null
31 * @param arg1 the second argument to the command, may be null
32 * @return the file descriptor of the started process.
33 *
34 */
35 public static FileDescriptor createSubprocess(
36 String cmd, String arg0, String arg1) {
37 return createSubprocess(cmd, arg0, arg1, null);
38 }
39
40 /**
41 * @param cmd The command to execute
42 * @param arg0 The first argument to the command, may be null
43 * @param arg1 the second argument to the command, may be null
44 * @param processId A one-element array to which the process ID of the
45 * started process will be written.
46 * @return the file descriptor of the started process.
47 *
48 */
49 public static native FileDescriptor createSubprocess(
50 String cmd, String arg0, String arg1, int[] processId);
51
52 public static native void setPtyWindowSize(FileDescriptor fd,
53 int row, int col, int xpixel, int ypixel);
54 /**
55 * Causes the calling thread to wait for the process associated with the
56 * receiver to finish executing.
57 *
58 * @return The exit value of the Process being waited on
59 *
60 */
61 public static native int waitFor(int processId);
62}
63