File: exec.h

package info (click to toggle)
vzctl 3.0.22-14
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 3,340 kB
  • ctags: 4,462
  • sloc: ansic: 15,696; sh: 11,712; makefile: 460
file content (74 lines) | stat: -rw-r--r-- 2,315 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
 *  Copyright (C) 2000-2007 SWsoft. All rights reserved.
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
#ifndef	_EXEC_H_
#define	_EXEC_H_


#include "types.h"

#define SCRIPT_EXEC_TIMEOUT	5 * 60

/** Exec modes.
 */
enum {
	MODE_EXEC,	/**< use exec syscall. */
	MODE_BASH,	/**< exec bash, and put command on stdin. */
};

int execvep(const char *path, char *const argv[], char *const envp[]);

/** Execute command inside VE.
 *
 * @param h		VE handler.
 * @param veid		VE id.
 * @param root		VE root.
 * @param exec_mode	execution mode (MODE_EXEC, MODE_BASH).
 * @param arg		argv array.
 * @param envp		command environment array.
 * @param std_i		read command from buffer stdin point to.
 * @param timeout	execution timeout, 0 - unlimited.
 * @return		0 on success.
 */
int vps_exec(vps_handler *h, envid_t veid, char *root, int exec_mode,
	char *const argv[], char *const envp[], char *std_in, int timeout);

/** Read script and execute it in VE.
 *
 * @param h		VE handler.
 * @param veid		VE id.
 * @param root		VE root.
 * @param arg		argv array.
 * @param envp		command environment array.
 * @param fname		script file name
 * @paran func		function file name
 * @param timeout	execution timeout, 0 - unlimited.
 * @return		0 on success.
 */
int vps_exec_script(vps_handler *h, envid_t veid, char *root,
	char *const argv[], char *const envp[], const char *fname, char *func,
	int timeout);

int vps_execFn(vps_handler *h, envid_t veid, char *root, execFn fn, void *data,
	int flags);

int env_wait(int pid);

struct vps_param;
int vps_run_script(vps_handler *h, envid_t veid, char *script,
	struct vps_param *vps_p);
#endif