| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Licensed to the Apache Software Foundation (ASF) under one or more | |
| 3 * contributor license agreements. See the NOTICE file distributed with | |
| 4 * this work for additional information regarding copyright ownership. | |
| 5 * The ASF licenses this file to You under the Apache License, Version 2.0 | |
| 6 * (the "License"); you may not use this file except in compliance with | |
| 7 * the License. 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 package org.apache.tomcat.jni; | |
| 19 | |
| 20 /** Procattr | |
| 21 * | |
| 22 * @author Mladen Turk | |
| 23 */ | |
| 24 public class Procattr { | |
| 25 | |
| 26 /** | |
| 27 * Create and initialize a new procattr variable | |
| 28 * @param cont The pool to use | |
| 29 * @return The newly created procattr. | |
| 30 */ | |
| 31 public static native long create(long cont) | |
| 32 throws Error; | |
| 33 | |
| 34 /** | |
| 35 * Determine if any of stdin, stdout, or stderr should be linked to pipes | |
| 36 * when starting a child process. | |
| 37 * @param attr The procattr we care about. | |
| 38 * @param in Should stdin be a pipe back to the parent? | |
| 39 * @param out Should stdout be a pipe back to the parent? | |
| 40 * @param err Should stderr be a pipe back to the parent? | |
| 41 */ | |
| 42 public static native int ioSet(long attr, int in, int out, int err); | |
| 43 /** | |
| 44 * Set the child_in and/or parent_in values to existing apr_file_t values. | |
| 45 * <br> | |
| 46 * This is NOT a required initializer function. This is | |
| 47 * useful if you have already opened a pipe (or multiple files) | |
| 48 * that you wish to use, perhaps persistently across multiple | |
| 49 * process invocations - such as a log file. You can save some | |
| 50 * extra function calls by not creating your own pipe since this | |
| 51 * creates one in the process space for you. | |
| 52 * @param attr The procattr we care about. | |
| 53 * @param in apr_file_t value to use as child_in. Must be a valid file. | |
| 54 * @param parent apr_file_t value to use as parent_in. Must be a valid file. | |
| 55 */ | |
| 56 public static native int childInSet(long attr, long in, long parent); | |
| 57 | |
| 58 /** | |
| 59 * Set the child_out and parent_out values to existing apr_file_t values. | |
| 60 * <br> | |
| 61 * This is NOT a required initializer function. This is | |
| 62 * useful if you have already opened a pipe (or multiple files) | |
| 63 * that you wish to use, perhaps persistently across multiple | |
| 64 * process invocations - such as a log file. | |
| 65 * @param attr The procattr we care about. | |
| 66 * @param out apr_file_t value to use as child_out. Must be a valid file. | |
| 67 * @param parent apr_file_t value to use as parent_out. Must be a valid file
. | |
| 68 */ | |
| 69 public static native int childOutSet(long attr, long out, long parent); | |
| 70 | |
| 71 /** | |
| 72 * Set the child_err and parent_err values to existing apr_file_t values. | |
| 73 * <br> | |
| 74 * This is NOT a required initializer function. This is | |
| 75 * useful if you have already opened a pipe (or multiple files) | |
| 76 * that you wish to use, perhaps persistently across multiple | |
| 77 * process invocations - such as a log file. | |
| 78 * @param attr The procattr we care about. | |
| 79 * @param err apr_file_t value to use as child_err. Must be a valid file. | |
| 80 * @param parent apr_file_t value to use as parent_err. Must be a valid file
. | |
| 81 */ | |
| 82 public static native int childErrSet(long attr, long err, long parent); | |
| 83 | |
| 84 /** | |
| 85 * Set which directory the child process should start executing in. | |
| 86 * @param attr The procattr we care about. | |
| 87 * @param dir Which dir to start in. By default, this is the same dir as | |
| 88 * the parent currently resides in, when the createprocess call | |
| 89 * is made. | |
| 90 */ | |
| 91 public static native int dirSet(long attr, String dir); | |
| 92 | |
| 93 /** | |
| 94 * Set what type of command the child process will call. | |
| 95 * @param attr The procattr we care about. | |
| 96 * @param cmd The type of command. One of: | |
| 97 * <PRE> | |
| 98 * APR_SHELLCMD -- Anything that the shell can handle | |
| 99 * APR_PROGRAM -- Executable program (default) | |
| 100 * APR_PROGRAM_ENV -- Executable program, copy environment | |
| 101 * APR_PROGRAM_PATH -- Executable program on PATH, copy env | |
| 102 * </PRE> | |
| 103 */ | |
| 104 public static native int cmdtypeSet(long attr, int cmd); | |
| 105 | |
| 106 /** | |
| 107 * Determine if the child should start in detached state. | |
| 108 * @param attr The procattr we care about. | |
| 109 * @param detach Should the child start in detached state? Default is no. | |
| 110 */ | |
| 111 public static native int detachSet(long attr, int detach); | |
| 112 | |
| 113 /** | |
| 114 * Specify that apr_proc_create() should do whatever it can to report | |
| 115 * failures to the caller of apr_proc_create(), rather than find out in | |
| 116 * the child. | |
| 117 * @param attr The procattr describing the child process to be created. | |
| 118 * @param chk Flag to indicate whether or not extra work should be done | |
| 119 * to try to report failures to the caller. | |
| 120 * <br> | |
| 121 * This flag only affects apr_proc_create() on platforms where | |
| 122 * fork() is used. This leads to extra overhead in the calling | |
| 123 * process, but that may help the application handle such | |
| 124 * errors more gracefully. | |
| 125 */ | |
| 126 public static native int errorCheckSet(long attr, int chk); | |
| 127 | |
| 128 /** | |
| 129 * Determine if the child should start in its own address space or using the | |
| 130 * current one from its parent | |
| 131 * @param attr The procattr we care about. | |
| 132 * @param addrspace Should the child start in its own address space? Defaul
t | |
| 133 * is no on NetWare and yes on other platforms. | |
| 134 */ | |
| 135 public static native int addrspaceSet(long attr, int addrspace); | |
| 136 | |
| 137 /** | |
| 138 * Specify an error function to be called in the child process if APR | |
| 139 * encounters an error in the child prior to running the specified program. | |
| 140 * @param attr The procattr describing the child process to be created. | |
| 141 * @param pool The the pool to use. | |
| 142 * @param o The Object to call in the child process. | |
| 143 * <br> | |
| 144 * At the present time, it will only be called from apr_proc_create() | |
| 145 * on platforms where fork() is used. It will never be called on other | |
| 146 * platforms, on those platforms apr_proc_create() will return the error | |
| 147 * in the parent process rather than invoke the callback in the now-forked | |
| 148 * child process. | |
| 149 */ | |
| 150 public static native void errfnSet(long attr, long pool, Object o); | |
| 151 | |
| 152 /** | |
| 153 * Set the username used for running process | |
| 154 * @param attr The procattr we care about. | |
| 155 * @param username The username used | |
| 156 * @param password User password if needed. Password is needed on WIN32 | |
| 157 * or any other platform having | |
| 158 * APR_PROCATTR_USER_SET_REQUIRES_PASSWORD set. | |
| 159 */ | |
| 160 public static native int userSet(long attr, String username, String password
); | |
| 161 | |
| 162 /** | |
| 163 * Set the group used for running process | |
| 164 * @param attr The procattr we care about. | |
| 165 * @param groupname The group name used | |
| 166 */ | |
| 167 public static native int groupSet(long attr, String groupname); | |
| 168 | |
| 169 | |
| 170 } | |
| OLD | NEW |