hotspot/test/runtime/jsig/TestJNI.java
author mgerdin
Mon, 11 Aug 2014 17:12:41 +0400
changeset 25958 8dc85547d6d6
parent 18939 2afa9e202276
permissions -rw-r--r--
8011397: JTREG needs to copy additional WhiteBox class file to JTwork/scratch/sun/hotspot Reviewed-by: kvn, iignatyev, mgerdin Contributed-by: andrey.x.zakharov@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
18939
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
     1
/*
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
     2
 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
     4
 *
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
     7
 * published by the Free Software Foundation.
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
     8
 *
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    13
 * accompanied this code).
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    14
 *
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    18
 *
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    21
 * questions.
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    22
 */
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    23
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    24
public class TestJNI {
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    25
    static {
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    26
        System.loadLibrary("TestJNI");
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    27
    }
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    28
    public static native void doSomething(int val);
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    29
    public static void main(String[] args) {
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    30
        int intArg = 43;
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    31
        if (args.length > 0) {
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    32
            try {
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    33
                intArg = Integer.parseInt(args[0]);
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    34
            } catch (NumberFormatException e) {
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    35
                System.err.println("arg " + args[0] + " must be an integer");
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    36
                System.exit(1);
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    37
            }
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    38
        }
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    39
        TestJNI.doSomething(intArg);
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    40
    }
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    41
}
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    42