Remove libsaproc mapfiles. ihse-remove-mapfiles-branch
authorihse
Tue, 13 Feb 2018 12:39:56 +0100
branchihse-remove-mapfiles-branch
changeset 56109 5bf57be44328
parent 56108 88838a55535b
child 56110 e2bb6d2abb5d
Remove libsaproc mapfiles.
make/lib/Lib-jdk.hotspot.agent.gmk
make/mapfiles/libjaas/mapfile-vers
make/mapfiles/libsaproc/mapfile-linux
make/mapfiles/libsaproc/mapfile-macosx
make/mapfiles/libsaproc/mapfile-solaris
src/jdk.hotspot.agent/linux/native/libsaproc/libproc.h
src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.c
src/jdk.hotspot.agent/linux/native/libsaproc/proc_service.h
src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c
src/jdk.hotspot.agent/linux/native/libsaproc/ps_proc.c
src/jdk.hotspot.agent/macosx/native/libsaproc/libproc.h
src/jdk.hotspot.agent/macosx/native/libsaproc/libproc_impl.c
src/jdk.hotspot.agent/macosx/native/libsaproc/libproc_impl.h
src/jdk.hotspot.agent/macosx/native/libsaproc/ps_core.c
src/jdk.hotspot.agent/macosx/native/libsaproc/ps_proc.c
src/jdk.hotspot.agent/solaris/native/libsaproc/saproc.cpp
--- a/make/lib/Lib-jdk.hotspot.agent.gmk	Tue Feb 13 11:54:44 2018 +0100
+++ b/make/lib/Lib-jdk.hotspot.agent.gmk	Tue Feb 13 12:39:56 2018 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -29,17 +29,12 @@
 
 ################################################################################
 
-ifneq ($(findstring $(OPENJDK_TARGET_OS), macosx windows), )
-  DISABLE_MAPFILES := true
-endif
-
 SA_TOPDIR := $(TOPDIR)/src/jdk.hotspot.agent
 
 # Defaults for most platforms
 SA_TOOLCHAIN := TOOLCHAIN_DEFAULT
 SA_NAME := saproc
 SA_SRC += $(SA_TOPDIR)/share/native/libsaproc $(SA_TOPDIR)/$(OPENJDK_TARGET_OS)/native/libsaproc
-SA_MAPFILE := $(TOPDIR)/make/mapfiles/libsaproc/mapfile-$(OPENJDK_TARGET_OS)
 SA_INCLUDES := \
     $(addprefix -I, $(SA_SRC)) \
     -I$(SUPPORT_OUTPUTDIR)/headers/jdk.hotspot.agent \
@@ -111,7 +106,6 @@
     CXXFLAGS := $(SA_INCLUDES) $(SA_CXXFLAGS) $(SA_CUSTOM_CXXFLAGS), \
     LDFLAGS := $(SA_LDFLAGS) $(SA_CUSTOM_LDFLAGS), \
     LIBS := $(SA_LIBS), \
-    MAPFILE := $(SA_MAPFILE), \
     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libsa, \
 ))
 
--- a/make/mapfiles/libjaas/mapfile-vers	Tue Feb 13 11:54:44 2018 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-#
-# Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code 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
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# Define library interface.
-
-SUNWprivate_1.1 {
-	global:
-            Java_com_sun_security_auth_module_UnixSystem_getUnixInfo;
-        local:
-	    *;
-};
-
--- a/make/mapfiles/libsaproc/mapfile-linux	Tue Feb 13 11:54:44 2018 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-#
-# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code 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
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#  
-
-# Define public interface.
-
-SUNWprivate_1.1 {
-        global:
-
-		# native methods of LinuxDebuggerLocal class
-		Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLocal_init0;
-		Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLocal_getAddressSize;
-		Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLocal_attach0__I;
-		Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLocal_attach0__Ljava_lang_String_2Ljava_lang_String_2;
-		Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLocal_detach0;
-		Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLocal_lookupByName0;
-		Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLocal_lookupByAddress0;
-		Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLocal_readBytesFromProcess0;
-		Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLocal_getThreadIntegerRegisterSet0;
-	
-                # Disassembler interface
-                Java_sun_jvm_hotspot_asm_Disassembler_decode;
-                Java_sun_jvm_hotspot_asm_Disassembler_load_1library;
-
-		# proc_service.h functions - to be used by libthread_db
-		ps_getpid;
-		ps_pglobal_lookup;
-		ps_pdread;
-		ps_pdwrite;
-		ps_lsetfpregs;
-		ps_lsetregs;
-		ps_lgetfpregs;
-		ps_lgetregs;
-		ps_get_thread_area;
-
-                # used by attach test program
-                init_libproc;
-                Pgrab;
-                Pgrab_core;
-                Prelease;
-	
-	local:
-		*;
-};
--- a/make/mapfiles/libsaproc/mapfile-macosx	Tue Feb 13 11:54:44 2018 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-#
-
-#
-# Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code 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
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#  
-#
-
-# Define public interface.
-
-SUNWprivate_1.1 {
-        global:
-
-		# native methods of BsdDebuggerLocal class
-		Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_init0;
-		Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_getAddressSize;
-		Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_attach0__I;
-		Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_attach0__Ljava_lang_String_2Ljava_lang_String_2;
-		Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_detach0;
-		Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_lookupByName0;
-		Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_lookupByAddress0;
-		Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_readBytesFromProcess0;
-		Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_getThreadIntegerRegisterSet0;
-	
-		# proc_service.h functions - to be used by libthread_db
-		ps_getpid;
-		ps_pglobal_lookup;
-		ps_pread;
-		ps_pwrite;
-		ps_lsetfpregs;
-		ps_lsetregs;
-		ps_lgetfpregs;
-		ps_lgetregs;
-		ps_lcontinue;
-		ps_lgetxmmregs;
-		ps_lsetxmmregs;
-		ps_lstop;
-		ps_linfo;
-
-                # used by attach test program
-                init_libproc;
-                Pgrab;
-                Pgrab_core;
-                Prelease;
-	
-	local:
-		*;
-};
--- a/make/mapfiles/libsaproc/mapfile-solaris	Tue Feb 13 11:54:44 2018 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-#
-# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code 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
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#  
-
-# Define public interface.
-SUNWprivate_1.1 {
-	global:
-		Java_sun_jvm_hotspot_debugger_proc_ProcDebuggerLocal_attach0__Ljava_lang_String_2;
-		Java_sun_jvm_hotspot_debugger_proc_ProcDebuggerLocal_attach0__Ljava_lang_String_2Ljava_lang_String_2;
-		Java_sun_jvm_hotspot_debugger_proc_ProcDebuggerLocal_demangle0;
-		Java_sun_jvm_hotspot_debugger_proc_ProcDebuggerLocal_detach0;
-		Java_sun_jvm_hotspot_debugger_proc_ProcDebuggerLocal_fillCFrameList0;
-		Java_sun_jvm_hotspot_debugger_proc_ProcDebuggerLocal_fillLoadObjectList0;
-		Java_sun_jvm_hotspot_debugger_proc_ProcDebuggerLocal_fillThreadList0;
-		Java_sun_jvm_hotspot_debugger_proc_ProcDebuggerLocal_getPageSize0;
-		Java_sun_jvm_hotspot_debugger_proc_ProcDebuggerLocal_getRemoteProcessAddressSize0;
-		Java_sun_jvm_hotspot_debugger_proc_ProcDebuggerLocal_getThreadIntegerRegisterSet0;
-		Java_sun_jvm_hotspot_debugger_proc_ProcDebuggerLocal_initIDs;
-		Java_sun_jvm_hotspot_debugger_proc_ProcDebuggerLocal_lookupByAddress0;
-		Java_sun_jvm_hotspot_debugger_proc_ProcDebuggerLocal_lookupByName0;
-		Java_sun_jvm_hotspot_debugger_proc_ProcDebuggerLocal_readBytesFromProcess0;
-		Java_sun_jvm_hotspot_debugger_proc_ProcDebuggerLocal_resume0;
-		Java_sun_jvm_hotspot_debugger_proc_ProcDebuggerLocal_suspend0;
-		Java_sun_jvm_hotspot_debugger_proc_ProcDebuggerLocal_writeBytesToProcess0;
-                # this is needed by saproc_audit.c to redirect opens in libproc.so
-                libsaproc_open;
-                # Disassembler interface
-		Java_sun_jvm_hotspot_asm_Disassembler_decode;
-		Java_sun_jvm_hotspot_asm_Disassembler_load_1library;
-	local:
-	*;
-};
--- a/src/jdk.hotspot.agent/linux/native/libsaproc/libproc.h	Tue Feb 13 11:54:44 2018 +0100
+++ b/src/jdk.hotspot.agent/linux/native/libsaproc/libproc.h	Tue Feb 13 12:39:56 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -93,19 +93,23 @@
 struct ps_prochandle;
 
 // attach to a process
-struct ps_prochandle* Pgrab(pid_t pid, char* err_buf, size_t err_buf_len);
+JNIEXPORT struct ps_prochandle* 
+Pgrab(pid_t pid, char* err_buf, size_t err_buf_len);
 
 // attach to a core dump
-struct ps_prochandle* Pgrab_core(const char* execfile, const char* corefile);
+JNIEXPORT struct ps_prochandle* 
+Pgrab_core(const char* execfile, const char* corefile);
 
 // release a process or core
-void Prelease(struct ps_prochandle* ph);
+JNIEXPORT void 
+Prelease(struct ps_prochandle* ph);
 
 // functions not directly available in Solaris libproc
 
 // initialize libproc (call this only once per app)
 // pass true to make library verbose
-bool init_libproc(bool verbose);
+JNIEXPORT bool 
+init_libproc(bool verbose);
 
 // get number of threads
 int get_num_threads(struct ps_prochandle* ph);
--- a/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.c	Tue Feb 13 11:54:44 2018 +0100
+++ b/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.c	Tue Feb 13 12:39:56 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
 #include <string.h>
 #include <fcntl.h>
 #include <thread_db.h>
+#include "jni.h"
 #include "libproc_impl.h"
 
 #define SA_ALTROOT "SA_ALTROOT"
@@ -112,7 +113,8 @@
 }
 
 // initialize libproc
-bool init_libproc(bool debug) {
+JNIEXPORT bool
+init_libproc(bool debug) {
    // init debug mode
    _libsaproc_debug = debug;
 
@@ -149,7 +151,8 @@
 // ps_prochandle cleanup
 
 // ps_prochandle cleanup
-void Prelease(struct ps_prochandle* ph) {
+JNIEXPORT void
+Prelease(struct ps_prochandle* ph) {
    // do the "derived class" clean-up first
    ph->ops->release(ph);
    destroy_lib_info(ph);
@@ -398,7 +401,8 @@
 // proc service functions
 
 // get process id
-pid_t ps_getpid(struct ps_prochandle *ph) {
+JNIEXPORT pid_t
+ps_getpid(struct ps_prochandle *ph) {
    return ph->pid;
 }
 
@@ -407,20 +411,23 @@
 // It returns the symbol's value as an address in the target process in
 // *sym_addr.
 
-ps_err_e ps_pglobal_lookup(struct ps_prochandle *ph, const char *object_name,
+JNIEXPORT ps_err_e
+ps_pglobal_lookup(struct ps_prochandle *ph, const char *object_name,
                     const char *sym_name, psaddr_t *sym_addr) {
   *sym_addr = (psaddr_t) lookup_symbol(ph, object_name, sym_name);
   return (*sym_addr ? PS_OK : PS_NOSYM);
 }
 
 // read "size" bytes info "buf" from address "addr"
-ps_err_e ps_pdread(struct ps_prochandle *ph, psaddr_t  addr,
+JNIEXPORT ps_err_e
+ps_pdread(struct ps_prochandle *ph, psaddr_t  addr,
                    void *buf, size_t size) {
   return ph->ops->p_pread(ph, (uintptr_t) addr, buf, size)? PS_OK: PS_ERR;
 }
 
 // write "size" bytes of data to debuggee at address "addr"
-ps_err_e ps_pdwrite(struct ps_prochandle *ph, psaddr_t addr,
+JNIEXPORT ps_err_e
+ps_pdwrite(struct ps_prochandle *ph, psaddr_t addr,
                     const void *buf, size_t size) {
   return ph->ops->p_pwrite(ph, (uintptr_t)addr, buf, size)? PS_OK: PS_ERR;
 }
@@ -429,28 +436,33 @@
 // Functions below this point are not yet implemented. They are here only
 // to make the linker happy.
 
-ps_err_e ps_lsetfpregs(struct ps_prochandle *ph, lwpid_t lid, const prfpregset_t *fpregs) {
+JNIEXPORT ps_err_e
+ps_lsetfpregs(struct ps_prochandle *ph, lwpid_t lid, const prfpregset_t *fpregs) {
   print_debug("ps_lsetfpregs not implemented\n");
   return PS_OK;
 }
 
-ps_err_e ps_lsetregs(struct ps_prochandle *ph, lwpid_t lid, const prgregset_t gregset) {
+JNIEXPORT ps_err_e
+ps_lsetregs(struct ps_prochandle *ph, lwpid_t lid, const prgregset_t gregset) {
   print_debug("ps_lsetregs not implemented\n");
   return PS_OK;
 }
 
-ps_err_e  ps_lgetfpregs(struct  ps_prochandle  *ph,  lwpid_t lid, prfpregset_t *fpregs) {
+JNIEXPORT ps_err_e
+ps_lgetfpregs(struct  ps_prochandle  *ph,  lwpid_t lid, prfpregset_t *fpregs) {
   print_debug("ps_lgetfpregs not implemented\n");
   return PS_OK;
 }
 
-ps_err_e ps_lgetregs(struct ps_prochandle *ph, lwpid_t lid, prgregset_t gregset) {
+JNIEXPORT ps_err_e
+ps_lgetregs(struct ps_prochandle *ph, lwpid_t lid, prgregset_t gregset) {
   print_debug("ps_lgetfpregs not implemented\n");
   return PS_OK;
 }
 
 // new libthread_db of NPTL seem to require this symbol
-ps_err_e ps_get_thread_area() {
+JNIEXPORT ps_err_e
+ps_get_thread_area() {
   print_debug("ps_get_thread_area not implemented\n");
   return PS_OK;
 }
--- a/src/jdk.hotspot.agent/linux/native/libsaproc/proc_service.h	Tue Feb 13 11:54:44 2018 +0100
+++ b/src/jdk.hotspot.agent/linux/native/libsaproc/proc_service.h	Tue Feb 13 12:39:56 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <thread_db.h>
+#include "jni.h"
 
 // Linux does not have the proc service library, though it does provide the
 // thread_db library which can be used to manipulate threads without having
@@ -44,33 +45,42 @@
 } ps_err_e;
 
 // ps_getpid() is only defined on Linux to return a thread's process ID
-pid_t ps_getpid(struct ps_prochandle *ph);
+JNIEXPORT pid_t
+ps_getpid(struct ps_prochandle *ph);
 
 // ps_pglobal_lookup() looks up the symbol sym_name in the symbol table
 // of the load object object_name in the target process identified by ph.
 // It returns the symbol's value as an address in the target process in
 // *sym_addr.
 
-ps_err_e ps_pglobal_lookup(struct ps_prochandle *ph, const char *object_name,
+JNIEXPORT ps_err_e
+ps_pglobal_lookup(struct ps_prochandle *ph, const char *object_name,
                     const char *sym_name, psaddr_t *sym_addr);
 
 // read "size" bytes of data from debuggee at address "addr"
-ps_err_e ps_pdread(struct ps_prochandle *ph, psaddr_t  addr,
+JNIEXPORT ps_err_e
+ps_pdread(struct ps_prochandle *ph, psaddr_t  addr,
                    void *buf, size_t size);
 
 // write "size" bytes of data to debuggee at address "addr"
-ps_err_e ps_pdwrite(struct ps_prochandle *ph, psaddr_t addr,
+JNIEXPORT ps_err_e
+ps_pdwrite(struct ps_prochandle *ph, psaddr_t addr,
                     const void *buf, size_t size);
 
-ps_err_e ps_lsetfpregs(struct ps_prochandle *ph, lwpid_t lid, const prfpregset_t *fpregs);
+JNIEXPORT ps_err_e
+ps_lsetfpregs(struct ps_prochandle *ph, lwpid_t lid, const prfpregset_t *fpregs);
 
-ps_err_e ps_lsetregs(struct ps_prochandle *ph, lwpid_t lid, const prgregset_t gregset);
+JNIEXPORT ps_err_e
+ps_lsetregs(struct ps_prochandle *ph, lwpid_t lid, const prgregset_t gregset);
 
-ps_err_e  ps_lgetfpregs(struct  ps_prochandle  *ph,  lwpid_t lid, prfpregset_t *fpregs);
+JNIEXPORT ps_err_e
+ps_lgetfpregs(struct  ps_prochandle  *ph,  lwpid_t lid, prfpregset_t *fpregs);
 
-ps_err_e ps_lgetregs(struct ps_prochandle *ph, lwpid_t lid, prgregset_t gregset);
+JNIEXPORT ps_err_e
+ps_lgetregs(struct ps_prochandle *ph, lwpid_t lid, prgregset_t gregset);
 
 // new libthread_db of NPTL seem to require this symbol
-ps_err_e ps_get_thread_area();
+JNIEXPORT ps_err_e
+ps_get_thread_area();
 
 #endif /* _PROC_SERVICE_H_ */
--- a/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c	Tue Feb 13 11:54:44 2018 +0100
+++ b/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c	Tue Feb 13 12:39:56 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1008,7 +1008,8 @@
 }
 
 // the one and only one exposed stuff from this file
-struct ps_prochandle* Pgrab_core(const char* exec_file, const char* core_file) {
+JNIEXPORT struct ps_prochandle*
+Pgrab_core(const char* exec_file, const char* core_file) {
   ELF_EHDR core_ehdr;
   ELF_EHDR exec_ehdr;
   ELF_EHDR lib_ehdr;
--- a/src/jdk.hotspot.agent/linux/native/libsaproc/ps_proc.c	Tue Feb 13 11:54:44 2018 +0100
+++ b/src/jdk.hotspot.agent/linux/native/libsaproc/ps_proc.c	Tue Feb 13 12:39:56 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,7 @@
 #include <sys/wait.h>
 #include <sys/ptrace.h>
 #include <sys/uio.h>
+#include "jni.h"
 #include "libproc_impl.h"
 
 #if defined(x86_64) && !defined(amd64)
@@ -373,7 +374,8 @@
 };
 
 // attach to the process. One and only one exposed stuff
-struct ps_prochandle* Pgrab(pid_t pid, char* err_buf, size_t err_buf_len) {
+JNIEXPORT struct ps_prochandle*
+Pgrab(pid_t pid, char* err_buf, size_t err_buf_len) {
   struct ps_prochandle* ph = NULL;
   thread_info* thr = NULL;
 
--- a/src/jdk.hotspot.agent/macosx/native/libsaproc/libproc.h	Tue Feb 13 11:54:44 2018 +0100
+++ b/src/jdk.hotspot.agent/macosx/native/libsaproc/libproc.h	Tue Feb 13 12:39:56 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -72,6 +72,7 @@
 #endif
 
 #endif //sparc or sparcv9
+#include "jni.h"
 
 // This C bool type must be int for compatibility with BSD calls and
 // it would be a mistake to equivalence it to C++ bool on many platforms
@@ -113,19 +114,23 @@
 struct ps_prochandle;
 
 // attach to a process
-struct ps_prochandle* Pgrab(pid_t pid);
+JNIEXPORT struct ps_prochandle*
+Pgrab(pid_t pid);
 
 // attach to a core dump
-struct ps_prochandle* Pgrab_core(const char* execfile, const char* corefile);
+JNIEXPORT struct ps_prochandle*
+Pgrab_core(const char* execfile, const char* corefile);
 
 // release a process or core
-void Prelease(struct ps_prochandle* ph);
+JNIEXPORT void
+Prelease(struct ps_prochandle* ph);
 
 // functions not directly available in Solaris libproc
 
 // initialize libproc (call this only once per app)
 // pass true to make library verbose
-bool init_libproc(bool verbose);
+JNIEXPORT bool
+init_libproc(bool verbose);
 
 // get number of threads
 int get_num_threads(struct ps_prochandle* ph);
--- a/src/jdk.hotspot.agent/macosx/native/libsaproc/libproc_impl.c	Tue Feb 13 11:54:44 2018 +0100
+++ b/src/jdk.hotspot.agent/macosx/native/libsaproc/libproc_impl.c	Tue Feb 13 12:39:56 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,6 +21,7 @@
  * questions.
  *
  */
+#include "jni.h"
 #include "libproc_impl.h"
 
 static const char* alt_root = NULL;
@@ -160,7 +161,8 @@
 #endif //__APPLE__
 
 // initialize libproc
-bool init_libproc(bool debug) {
+JNIEXPORT bool
+init_libproc(bool debug) {
    _libsaproc_debug = debug;
 #ifndef __APPLE__
    // initialize the thread_db library
@@ -194,7 +196,8 @@
 }
 
 // ps_prochandle cleanup
-void Prelease(struct ps_prochandle* ph) {
+JNIEXPORT void
+Prelease(struct ps_prochandle* ph) {
   // do the "derived class" clean-up first
   ph->ops->release(ph);
   destroy_lib_info(ph);
@@ -514,7 +517,8 @@
 }
 
 // fill in ptrace_lwpinfo for lid
-ps_err_e ps_linfo(struct ps_prochandle *ph, lwpid_t lwp_id, void *linfo) {
+JNIEXPORT ps_err_e
+ps_linfo(struct ps_prochandle *ph, lwpid_t lwp_id, void *linfo) {
   return ph->ops->get_lwp_info(ph, lwp_id, linfo)? PS_OK: PS_ERR;
 }
 
@@ -554,7 +558,8 @@
   return PS_OK;
 }
 
-ps_err_e ps_lstop(struct ps_prochandle *ph, lwpid_t lid) {
+JNIEXPORT ps_err_e
+ps_lstop(struct ps_prochandle *ph, lwpid_t lid) {
   print_debug("ps_lstop not implemented\n");
   return PS_OK;
 }
--- a/src/jdk.hotspot.agent/macosx/native/libsaproc/libproc_impl.h	Tue Feb 13 11:54:44 2018 +0100
+++ b/src/jdk.hotspot.agent/macosx/native/libsaproc/libproc_impl.h	Tue Feb 13 12:39:56 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,7 @@
 #include <limits.h>
 #include "libproc.h"
 #include "symtab.h"
+#include "jni.h"
 
 #ifdef __APPLE__
 #include <inttypes.h>     // for PRIx64, 32, ...
@@ -210,7 +211,8 @@
                    const void *buf, size_t size);
 
 // fill in ptrace_lwpinfo for lid
-ps_err_e ps_linfo(struct ps_prochandle *ph, lwpid_t lwp_id, void *linfo);
+JNIEXPORT ps_err_e
+ps_linfo(struct ps_prochandle *ph, lwpid_t lwp_id, void *linfo);
 
 // needed for when libthread_db is compiled with TD_DEBUG defined
 void ps_plog (const char *format, ...);
--- a/src/jdk.hotspot.agent/macosx/native/libsaproc/ps_core.c	Tue Feb 13 11:54:44 2018 +0100
+++ b/src/jdk.hotspot.agent/macosx/native/libsaproc/ps_core.c	Tue Feb 13 12:39:56 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -893,7 +893,8 @@
 }
 
 // the one and only one exposed stuff from this file
-struct ps_prochandle* Pgrab_core(const char* exec_file, const char* core_file) {
+JNIEXPORT struct ps_prochandle*
+Pgrab_core(const char* exec_file, const char* core_file) {
   mach_header_64 core_header;
   mach_header_64 exec_header;
 
@@ -1425,7 +1426,8 @@
 }
 
 // the one and only one exposed stuff from this file
-struct ps_prochandle* Pgrab_core(const char* exec_file, const char* core_file) {
+JNIEXPORT struct ps_prochandle*
+Pgrab_core(const char* exec_file, const char* core_file) {
   ELF_EHDR core_ehdr;
   ELF_EHDR exec_ehdr;
 
--- a/src/jdk.hotspot.agent/macosx/native/libsaproc/ps_proc.c	Tue Feb 13 11:54:44 2018 +0100
+++ b/src/jdk.hotspot.agent/macosx/native/libsaproc/ps_proc.c	Tue Feb 13 12:39:56 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,6 +38,7 @@
 #include <libutil.h>
 #include "libproc_impl.h"
 #include "elfmacros.h"
+#include "jni.h"
 
 // This file has the libproc implementation specific to live process
 // For core files, refer to ps_core.c
@@ -432,7 +433,8 @@
 };
 
 // attach to the process. One and only one exposed stuff
-struct ps_prochandle* Pgrab(pid_t pid) {
+JNIEXPORT struct ps_prochandle*
+Pgrab(pid_t pid) {
   struct ps_prochandle* ph = NULL;
 
   if ( (ph = (struct ps_prochandle*) calloc(1, sizeof(struct ps_prochandle))) == NULL) {
--- a/src/jdk.hotspot.agent/solaris/native/libsaproc/saproc.cpp	Tue Feb 13 11:54:44 2018 +0100
+++ b/src/jdk.hotspot.agent/solaris/native/libsaproc/saproc.cpp	Tue Feb 13 12:39:56 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,7 @@
 #include <stdarg.h>
 #include <stdlib.h>
 #include <errno.h>
+#include "jni.h"
 
 #define CHECK_EXCEPTION_(value) if(env->ExceptionOccurred()) { return value; }
 #define CHECK_EXCEPTION if(env->ExceptionOccurred()) { return;}
@@ -221,7 +222,8 @@
 // implement as a pathmap style facility for the SA.  If libproc
 // starts using other interfaces then this might have to extended to
 // cover other calls.
-extern "C" int libsaproc_open(const char * name, int oflag, ...) {
+JNIEXPORT extern "C" int 
+libsaproc_open(const char * name, int oflag, ...) {
   if (oflag == O_RDONLY) {
     init_alt_root();