equal
deleted
inserted
replaced
|
1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: JavaCaptain |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "com_nokia_mj_impl_javacontrolpanel_JavaCaptain.h" |
|
20 |
|
21 #ifdef __SYMBIAN32__ |
|
22 #include <spawn.h> |
|
23 #else |
|
24 #include <stdio.h> |
|
25 #endif |
|
26 |
|
27 #include <errno.h> |
|
28 #include "logger.h" |
|
29 |
|
30 /* |
|
31 * Class: com_nokia_mj_impl_javacontrolpanel_JavaCaptain |
|
32 * Method: _start |
|
33 * Signature: ()V |
|
34 */ |
|
35 JNIEXPORT void JNICALL Java_com_nokia_mj_impl_javacontrolpanel_JavaCaptain__1start |
|
36 (JNIEnv *, jobject) |
|
37 { |
|
38 int rc = 0; |
|
39 int pid = 0; |
|
40 char* av[2]; |
|
41 int index = 0; |
|
42 av[index++] = "javacaptain"; |
|
43 av[index] = NULL; |
|
44 |
|
45 #ifdef __SYMBIAN32__ |
|
46 rc = posix_spawn(&pid, "javacaptain", NULL, NULL, av, NULL); |
|
47 #else |
|
48 if (!(pid = fork())) |
|
49 { |
|
50 rc = execvp("javacaptain", av); |
|
51 if (rc == -1) |
|
52 { |
|
53 rc = errno; |
|
54 } |
|
55 } |
|
56 #endif // __SYMBIAN32__ |
|
57 |
|
58 if (rc) |
|
59 { |
|
60 ELOG3(EUtils,"%s failed, %s - errno=%d", __PRETTY_FUNCTION__, strerror(rc), rc); |
|
61 } |
|
62 |
|
63 } |
|
64 |