From: <kon...@us...> - 2009-02-02 00:10:26
|
Revision: 4968 http://jnode.svn.sourceforge.net/jnode/?rev=4968&view=rev Author: konkubinaten Date: 2009-02-02 00:10:20 +0000 (Mon, 02 Feb 2009) Log Message: ----------- revert headers of files that were accidentially modified Modified Paths: -------------- trunk/core/src/classpath/vm/gnu/classpath/VMStackWalker.java trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMFrame.java trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMIdManager.java trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMMethod.java trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMVirtualMachine.java trunk/core/src/classpath/vm/gnu/java/lang/VMInstrumentationImpl.java trunk/core/src/classpath/vm/gnu/java/nio/VMChannel.java trunk/core/src/classpath/vm/java/lang/Thread.java trunk/core/src/classpath/vm/java/lang/VMProcess.java trunk/core/src/classpath/vm/java/lang/VMSystem.java trunk/core/src/openjdk/vm/java/lang/NativeStrictMath.java trunk/core/src/openjdk/vm/java/lang/ProcessEnvironment.java trunk/core/src/openjdk/vm/java/lang/ProcessImpl.java trunk/core/src/openjdk/vm/java/lang/Terminator.java trunk/core/src/openjdk/vm/java/lang/UNIXProcess.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_be.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_bg.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_ca.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_cs.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_da.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_de.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_el.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_el_CY.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_en.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_en_GB.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_en_IE.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_en_MT.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_es.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_es_ES.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_es_US.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_et.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_fi.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_fr.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_fr_CA.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_hr.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_hu.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_in_ID.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_is.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_it.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_lt.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_lv.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_mk.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_ms_MY.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_mt.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_mt_MT.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_nl.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_no.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_pl.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_pt.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_pt_PT.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_ro.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_ru.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_sk.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_sl.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_sq.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_sr.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_sv.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_tr.java trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_uk.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_be_BY.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_bg_BG.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_ca_ES.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_cs_CZ.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_da_DK.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_de_AT.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_de_CH.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_de_DE.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_de_GR.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_de_LU.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_el_CY.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_el_GR.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_en_AU.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_en_CA.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_en_GB.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_en_IE.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_en_IN.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_en_MT.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_en_NZ.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_en_PH.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_en_SG.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_en_US.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_en_ZA.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_AR.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_BO.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_CL.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_CO.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_CR.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_DO.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_EC.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_ES.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_GT.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_HN.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_MX.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_NI.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_PA.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_PE.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_PR.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_PY.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_SV.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_US.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_UY.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_VE.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_et_EE.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_fi_FI.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_fr_BE.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_fr_CA.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_fr_CH.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_fr_FR.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_fr_LU.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_ga_IE.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_hr_HR.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_hu_HU.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_in_ID.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_is_IS.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_it_CH.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_it_IT.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_lt_LT.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_lv_LV.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_mk_MK.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_ms_MY.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_mt_MT.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_nl_BE.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_nl_NL.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_no_NO.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_pl_PL.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_pt_BR.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_pt_PT.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_ro_RO.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_ru_RU.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_sk_SK.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_sl_SI.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_sq_AL.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_sr_BA.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_sr_CS.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_sr_ME.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_sv_SE.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_tr_TR.java trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_uk_UA.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_be.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_bg.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_ca.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_cs.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_da.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_de.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_el.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_el_CY.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_en.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_en_MT.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_en_PH.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_en_SG.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_es.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_es_US.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_et.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_fi.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_fr.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_ga.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_hr.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_hu.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_in.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_is.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_it.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_lt.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_lv.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_mk.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_ms.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_mt.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_nl.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_no.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_pl.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_pt.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_pt_BR.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_pt_PT.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_ro.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_ru.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_sk.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_sl.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_sq.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_sr.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_sv.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_tr.java trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_uk.java Modified: trunk/core/src/classpath/vm/gnu/classpath/VMStackWalker.java =================================================================== --- trunk/core/src/classpath/vm/gnu/classpath/VMStackWalker.java 2009-02-01 22:13:30 UTC (rev 4967) +++ trunk/core/src/classpath/vm/gnu/classpath/VMStackWalker.java 2009-02-02 00:10:20 UTC (rev 4968) @@ -1,24 +1,40 @@ -/* - * $Id$ - * - * JNode.org - * Copyright (C) 2003-2009 JNode.org - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This library 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 Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; If not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +/* VMStackWalker.java -- Reference implementation of VM hooks for stack access + Copyright (C) 2005, 2006 Free Software Foundation +This file is part of GNU Classpath. + +GNU Classpath 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, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + package gnu.classpath; import org.jnode.vm.VmSystem; Modified: trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMFrame.java =================================================================== --- trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMFrame.java 2009-02-01 22:13:30 UTC (rev 4967) +++ trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMFrame.java 2009-02-02 00:10:20 UTC (rev 4968) @@ -1,24 +1,42 @@ -/* - * $Id$ - * - * JNode.org - * Copyright (C) 2003-2009 JNode.org - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This library 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 Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; If not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - +/* VMFrame.java -- Reference implementation of VM hooks for JDWP Frame access. + Copyright (C) 2005, 2006 Free Software Foundation + +This file is part of GNU Classpath. + +GNU Classpath 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, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + package gnu.classpath.jdwp; import gnu.classpath.jdwp.util.Location; Modified: trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMIdManager.java =================================================================== --- trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMIdManager.java 2009-02-01 22:13:30 UTC (rev 4967) +++ trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMIdManager.java 2009-02-02 00:10:20 UTC (rev 4968) @@ -1,24 +1,44 @@ -/* - * $Id$ - * - * JNode.org - * Copyright (C) 2003-2009 JNode.org - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This library 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 Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; If not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - +/* VMIdManager.java -- A reference/example implementation of a manager for + JDWP object/reference type IDs + + Copyright (C) 2005, 2006 Free Software Foundation + +This file is part of GNU Classpath. + +GNU Classpath 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, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + package gnu.classpath.jdwp; import gnu.classpath.jdwp.exception.InvalidClassException; Modified: trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMMethod.java =================================================================== --- trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMMethod.java 2009-02-01 22:13:30 UTC (rev 4967) +++ trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMMethod.java 2009-02-02 00:10:20 UTC (rev 4968) @@ -1,24 +1,42 @@ -/* - * $Id$ - * - * JNode.org - * Copyright (C) 2003-2009 JNode.org - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This library 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 Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; If not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - +/* VMMethod.java -- a method in a virtual machine + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + package gnu.classpath.jdwp; import java.io.DataOutputStream; Modified: trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMVirtualMachine.java =================================================================== --- trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMVirtualMachine.java 2009-02-01 22:13:30 UTC (rev 4967) +++ trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMVirtualMachine.java 2009-02-02 00:10:20 UTC (rev 4968) @@ -1,24 +1,44 @@ -/* - * $Id$ - * - * JNode.org - * Copyright (C) 2003-2009 JNode.org - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This library 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 Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; If not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - +/* VMVirtualMachine.java -- A reference implementation of a JDWP virtual + machine + + Copyright (C) 2005, 2006 Free Software Foundation + +This file is part of GNU Classpath. + +GNU Classpath 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, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + package gnu.classpath.jdwp; import gnu.classpath.jdwp.event.EventRequest; Modified: trunk/core/src/classpath/vm/gnu/java/lang/VMInstrumentationImpl.java =================================================================== --- trunk/core/src/classpath/vm/gnu/java/lang/VMInstrumentationImpl.java 2009-02-01 22:13:30 UTC (rev 4967) +++ trunk/core/src/classpath/vm/gnu/java/lang/VMInstrumentationImpl.java 2009-02-02 00:10:20 UTC (rev 4968) @@ -1,24 +1,42 @@ -/* - * $Id$ - * - * JNode.org - * Copyright (C) 2003-2009 JNode.org - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This library 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 Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; If not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - +/* VMInstrumentationImpl.java -- interface for the GNU implementation + of InstrumentationImpl + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + package gnu.java.lang; import java.lang.instrument.ClassDefinition; Modified: trunk/core/src/classpath/vm/gnu/java/nio/VMChannel.java =================================================================== --- trunk/core/src/classpath/vm/gnu/java/nio/VMChannel.java 2009-02-01 22:13:30 UTC (rev 4967) +++ trunk/core/src/classpath/vm/gnu/java/nio/VMChannel.java 2009-02-02 00:10:20 UTC (rev 4968) @@ -1,669 +1,686 @@ -/* - * $Id: header.txt 2224 2006-01-01 12:49:03Z epr $ - * - * JNode.org - * Copyright (C) 2003-2009 JNode.org - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This library 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 Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; If not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package gnu.java.nio; - -import gnu.classpath.Configuration; - -import java.io.IOException; -import java.net.Inet4Address; -import java.net.Inet6Address; -import java.net.InetAddress; -import java.net.InetSocketAddress; -import java.net.SocketAddress; -import java.net.SocketException; -import java.nio.ByteBuffer; -import java.nio.MappedByteBuffer; - -import org.jnode.vm.VmChannel; - -/** - * Native interface to support configuring of channel to run in a non-blocking - * manner and support scatter/gather io operations. - * - * @author Michael Barker <mi...@mi...> - * - */ -public final class VMChannel -{ - /** - * Our reference implementation uses an integer to store the native - * file descriptor. Implementations without such support - */ - private final State nfd; - - private Kind kind; - - public VMChannel() - { - // XXX consider adding security check here, so only Classpath - // code may create instances. - this.nfd = new State(); - kind = Kind.OTHER; - } - - /** - * This constructor is used by the POSIX reference implementation; - * other virtual machines need not support it. - * - * <strong>Important:</strong> do not call this in library code that is - * not specific to Classpath's reference implementation. - * - * @param native_fd The native file descriptor integer. - * @throws IOException - */ - VMChannel(final int native_fd) throws IOException - { - this(); - this.nfd.setNativeFD(native_fd); - } - - public State getState() - { - return nfd; - } - - static - { - // load the shared library needed for native methods. - if (Configuration.INIT_LOAD_LIBRARY) - { - System.loadLibrary ("javanio"); - } - try - { - // so fare this will throw an IOException - VmChannel.initIDs(); - } - catch (IOException e) - { - } - } - - public static VMChannel getStdin() throws IOException - { - return new VMChannel(VmChannel.stdin_fd()); - } - - public static VMChannel getStdout() throws IOException - { - return new VMChannel(VmChannel.stdout_fd()); - } - - public static VMChannel getStderr() throws IOException - { - return new VMChannel(VmChannel.stderr_fd()); - } - - - /** - * Set the file descriptor to have the required blocking - * setting. - * - * @param blocking The blocking flag to set. - */ - public void setBlocking(boolean blocking) throws IOException - { - VmChannel.setBlocking(nfd.getNativeFD(), blocking); - } - - - public int available() throws IOException - { - return VmChannel.available(nfd.getNativeFD()); - } - - - /** - * Reads a byte buffer directly using the supplied file descriptor. - * - * @param dst Direct Byte Buffer to read to. - * @return Number of bytes read. - * @throws IOException If an error occurs or dst is not a direct buffers. - */ - public int read(ByteBuffer dst) - throws IOException - { - return VmChannel.read(nfd.getNativeFD(), dst); - } - - /** - * Read a single byte. - * - * @return The byte read, or -1 on end of file. - * @throws IOException - */ - public int read() throws IOException - { - return VmChannel.read(nfd.getNativeFD()); - } - - - /** - * Reads into byte buffers directly using the supplied file descriptor. - * Assumes that the buffer list contains DirectBuffers. Will perform a - * scattering read. - * - * @param dsts An array direct byte buffers. - * @param offset Index of the first buffer to read to. - * @param length The number of buffers to read to. - * @return Number of bytes read. - * @throws IOException If an error occurs or the dsts are not direct buffers. - */ - public long readScattering(ByteBuffer[] dsts, int offset, int length) - throws IOException - { - if (offset + length > dsts.length) - throw new IndexOutOfBoundsException("offset + length > dsts.length"); - - return VmChannel.readScattering(nfd.getNativeFD(), dsts, offset, length); - } - - - /** - * Receive a datagram on this channel, returning the host address - * that sent the datagram. - * - * @param dst Where to store the datagram. - * @return The host address that sent the datagram. - * @throws IOException - */ - public SocketAddress receive(ByteBuffer dst) throws IOException - { - if (kind != Kind.SOCK_DGRAM) - throw new SocketException("not a datagram socket"); - ByteBuffer hostPort = ByteBuffer.allocateDirect(18); - int hostlen = VmChannel.receive(nfd.getNativeFD(), dst, hostPort); - if (hostlen == 0) - return null; - if (hostlen == 4) // IPv4 - { - byte[] addr = new byte[4]; - hostPort.get(addr); - int port = hostPort.getShort() & 0xFFFF; - return new InetSocketAddress(Inet4Address.getByAddress(addr), port); - } - if (hostlen == 16) // IPv6 - { - byte[] addr = new byte[16]; - hostPort.get(addr); - int port = hostPort.getShort() & 0xFFFF; - return new InetSocketAddress(Inet6Address.getByAddress(addr), port); - } - - throw new SocketException("host address received with invalid length: " - + hostlen); - } - - /** - * Writes from a direct byte bufer using the supplied file descriptor. - * Assumes the buffer is a DirectBuffer. - * - * @param src The source buffer. - * @return Number of bytes written. - * @throws IOException - */ - public int write(ByteBuffer src) throws IOException - { - return VmChannel.write(nfd.getNativeFD(), src); - } - - - /** - * Writes from byte buffers directly using the supplied file descriptor. - * Assumes the that buffer list constains DirectBuffers. Will perform - * as gathering write. - * - * @param fd - * @param srcs - * @param offset - * @param length - * @return Number of bytes written. - * @throws IOException - */ - public long writeGathering(ByteBuffer[] srcs, int offset, int length) - throws IOException - { - if (offset + length > srcs.length) - throw new IndexOutOfBoundsException("offset + length > srcs.length"); - - // A gathering write is limited to 16 buffers; when writing, ensure - // that we have at least one buffer with something in it in the 16 - // buffer window starting at offset. - while (!srcs[offset].hasRemaining() && offset < srcs.length) - offset++; - - // There are no buffers with anything to write. - if (offset == srcs.length) - return 0; - - // If we advanced `offset' so far that we don't have `length' - // buffers left, reset length to only the remaining buffers. - if (length > srcs.length - offset) - length = srcs.length - offset; - - return VmChannel.writeGathering(nfd.getNativeFD(), srcs, offset, length); - } - - - /** - * Send a datagram to the given address. - * - * @param src The source buffer. - * @param dst The destination address. - * @return The number of bytes written. - * @throws IOException - */ - public int send(ByteBuffer src, InetSocketAddress dst) - throws IOException - { - InetAddress addr = dst.getAddress(); - if (addr == null) - throw new NullPointerException(); - if (addr instanceof Inet4Address) - return VmChannel.send(nfd.getNativeFD(), src, addr.getAddress(), dst.getPort()); - else if (addr instanceof Inet6Address) - return VmChannel.send6(nfd.getNativeFD(), src, addr.getAddress(), dst.getPort()); - else - throw new SocketException("unrecognized inet address type"); - } - - /** - * Write a single byte. - * - * @param b The byte to write. - * @throws IOException - */ - public void write(int b) throws IOException - { - VmChannel.write(nfd.getNativeFD(), b); - } - - - // Network (socket) specific methods. - - /** - * Create a new socket. This method will initialize the native file - * descriptor state of this instance. - * - * @param stream Whether or not to create a streaming socket, or a datagram - * socket. - * @throws IOException If creating a new socket fails, or if this - * channel already has its native descriptor initialized. - */ - public void initSocket(boolean stream) throws IOException - { - if (nfd.isValid()) - throw new IOException("native FD already initialized"); - if (stream) - kind = Kind.SOCK_STREAM; - else - kind = Kind.SOCK_DGRAM; - nfd.setNativeFD(VmChannel.socket(stream)); - } - - - /** - * Connect the underlying socket file descriptor to the remote host. - * - * @param saddr The address to connect to. - * @param timeout The connect timeout to use for blocking connects. - * @return True if the connection succeeded; false if the file descriptor - * is in non-blocking mode and the connection did not immediately - * succeed. - * @throws IOException If an error occurs while connecting. - */ - public boolean connect(InetSocketAddress saddr, int timeout) - throws SocketException - { - int fd; - - InetAddress addr = saddr.getAddress(); - - // Translates an IOException into a SocketException to conform - // to the throws clause. - try - { - fd = nfd.getNativeFD(); - } - catch (IOException ioe) - { - throw new SocketException(ioe.getMessage()); - } - - if (addr instanceof Inet4Address) - return VmChannel.connect(fd, addr.getAddress(), saddr.getPort(), - timeout); - if (addr instanceof Inet6Address) - return VmChannel.connect6(fd, addr.getAddress(), saddr.getPort(), - timeout); - throw new SocketException("unsupported internet address"); - } - - /** - * Disconnect this channel, if it is a datagram socket. Disconnecting - * a datagram channel will disassociate it from any address, so the - * socket will remain open, but can send and receive datagrams from - * any address. - * - * @throws IOException If disconnecting this channel fails, or if this - * channel is not a datagram channel. - */ - public void disconnect() throws IOException - { - if (kind != Kind.SOCK_DGRAM) - throw new IOException("can only disconnect datagram channels"); - VmChannel.disconnect(nfd.getNativeFD()); - } - - - public InetSocketAddress getLocalAddress() throws IOException - { - if (!nfd.isValid()) - return null; - ByteBuffer name = ByteBuffer.allocateDirect(18); - int namelen = VmChannel.getsockname(nfd.getNativeFD(), name); - if (namelen == 0) // not bound - return null; // XXX return some wildcard? - if (namelen == 4) - { - byte[] addr = new byte[4]; - name.get(addr); - int port = name.getShort() & 0xFFFF; - return new InetSocketAddress(Inet4Address.getByAddress(addr), port); - } - if (namelen == 16) - { - byte[] addr = new byte[16]; - name.get(addr); - int port = name.getShort() & 0xFFFF; - return new InetSocketAddress(Inet6Address.getByAddress(addr), port); - } - throw new SocketException("invalid address length"); - } - - /** - * Returns the socket address of the remote peer this channel is connected - * to, or null if this channel is not yet connected. - * - * @return The peer address. - * @throws IOException - */ - public InetSocketAddress getPeerAddress() throws IOException - { - if (!nfd.isValid()) - return null; - ByteBuffer name = ByteBuffer.allocateDirect(18); - int namelen = VmChannel.getpeername (nfd.getNativeFD(), name); - if (namelen == 0) // not connected yet - return null; - if (namelen == 4) // IPv4 - { - byte[] addr = new byte[4]; - name.get(addr); - int port = name.getShort() & 0xFFFF; - return new InetSocketAddress(Inet4Address.getByAddress(addr), port); - } - else if (namelen == 16) // IPv6 - { - byte[] addr = new byte[16]; - name.get(addr); - int port = name.getShort() & 0xFFFF; - return new InetSocketAddress(Inet6Address.getByAddress(addr), port); - } - throw new SocketException("invalid address length"); - } - - - /** - * Accept an incoming connection, returning a new VMChannel, or null - * if the channel is nonblocking and no connection is pending. - * - * @return The accepted connection, or null. - * @throws IOException If an IO error occurs. - */ - public VMChannel accept() throws IOException - { - int new_fd = VmChannel.accept(nfd.getNativeFD()); - if (new_fd == -1) // non-blocking accept had no pending connection - return null; - return new VMChannel(new_fd); - } - - // File-specific methods. - - /** - * Open a file at PATH, initializing the native state to operate on - * that open file. - * - * @param path The absolute file path. - * @throws IOException If the file cannot be opened, or if this - * channel was previously initialized. - */ - public void openFile(String path, int mode) throws IOException - { - if (nfd.isValid() || nfd.isClosed()) - throw new IOException("can't reinitialize this channel"); - int fd = VmChannel.open(path, mode); - nfd.setNativeFD(fd); - kind = Kind.FILE; - } - - - public long position() throws IOException - { - if (kind != Kind.FILE) - throw new IOException("not a file"); - return VmChannel.position(nfd.getNativeFD()); - } - - - public void seek(long pos) throws IOException - { - if (kind != Kind.FILE) - throw new IOException("not a file"); - VmChannel.seek(nfd.getNativeFD(), pos); - } - - - public void truncate(long length) throws IOException - { - if (kind != Kind.FILE) - throw new IOException("not a file"); - VmChannel.truncate(nfd.getNativeFD(), length); - } - - - public boolean lock(long pos, long len, boolean shared, boolean wait) - throws IOException - { - if (kind != Kind.FILE) - throw new IOException("not a file"); - return VmChannel.lock(nfd.getNativeFD(), pos, len, shared, wait); - } - - - public void unlock(long pos, long len) throws IOException - { - if (kind != Kind.FILE) - throw new IOException("not a file"); - VmChannel.unlock(nfd.getNativeFD(), pos, len); - } - - - public long size() throws IOException - { - if (kind != Kind.FILE) - throw new IOException("not a file"); - return VmChannel.size(nfd.getNativeFD()); - } - - public MappedByteBuffer map(char mode, long position, int size) - throws IOException - { - if (kind != Kind.FILE) - throw new IOException("not a file"); - return VmChannel.map(nfd.getNativeFD(), mode, position, size); - } - - - public boolean flush(boolean metadata) throws IOException - { - if (kind != Kind.FILE) - throw new IOException("not a file"); - return VmChannel.flush(nfd.getNativeFD(), metadata); - } - - // Close. - - /** - * Close this socket. The socket is also automatically closed when this - * object is finalized. - * - * @throws IOException If closing the socket fails, or if this object has - * no open socket. - */ - public void close() throws IOException - { - nfd.close(); - } - - - /** - * <p>Provides a simple mean for the JNI code to find out whether the - * current thread was interrupted by a call to Thread.interrupt().</p> - * - * @return - */ - static boolean isThreadInterrupted() - { - return Thread.currentThread().isInterrupted(); - } - - // Inner classes. - - /** - * A wrapper for a native file descriptor integer. This tracks the state - * of an open file descriptor, and ensures that - * - * This class need not be fully supported by virtual machines; if a - * virtual machine does not use integer file descriptors, or does and - * wishes to hide that, then the methods of this class may be stubbed out. - * - * System-specific classes that depend on access to native file descriptor - * integers SHOULD declare this fact. - */ - public final class State - { - private int native_fd; - private boolean valid; - private boolean closed; - - State() - { - native_fd = -1; - valid = false; - closed = false; - } - - public boolean isValid() - { - return valid; - } - - public boolean isClosed() - { - return closed; - } - - public int getNativeFD() throws IOException - { - if (!valid) - throw new IOException("invalid file descriptor"); - return native_fd; - } - - void setNativeFD(final int native_fd) throws IOException - { - if (valid) - throw new IOException("file descriptor already initialized"); - this.native_fd = native_fd; - valid = true; - } - - public void close() throws IOException - { - if (!valid) - throw new IOException("invalid file descriptor"); - try - { - VmChannel.close(native_fd); - } - finally - { - valid = false; - closed = true; - } - } - - public String toString() - { - if (closed) - return "<<closed>>"; - if (!valid) - return "<<invalid>>"; - return String.valueOf(native_fd); - } - - protected void finalize() throws Throwable - { - try - { - if (valid) - close(); - } - finally - { - super.finalize(); - } - } - } - - /** - * An enumeration of possible kinds of channel. - */ - static class Kind // XXX enum - { - /** A streaming (TCP) socket. */ - static final Kind SOCK_STREAM = new Kind(); - - /** A datagram (UDP) socket. */ - static final Kind SOCK_DGRAM = new Kind(); - - /** A file. */ - static final Kind FILE = new Kind(); - - /** Something else; not a socket or file. */ - static final Kind OTHER = new Kind(); - - private Kind() { } - } -} +/* VMChannel.java -- Native interface suppling channel operations. + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.java.nio; + +import gnu.classpath.Configuration; + +import java.io.IOException; +import java.net.Inet4Address; +import java.net.Inet6Address; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.SocketAddress; +import java.net.SocketException; +import java.nio.ByteBuffer; +import java.nio.MappedByteBuffer; + +import org.jnode.vm.VmChannel; + +/** + * Native interface to support configuring of channel to run in a non-blocking + * manner and support scatter/gather io operations. + * + * @author Michael Barker <mi...@mi...> + * + */ +public final class VMChannel +{ + /** + * Our reference implementation uses an integer to store the native + * file descriptor. Implementations without such support + */ + private final State nfd; + + private Kind kind; + + public VMChannel() + { + // XXX consider adding security check here, so only Classpath + // code may create instances. + this.nfd = new State(); + kind = Kind.OTHER; + } + + /** + * This constructor is used by the POSIX reference implementation; + * other virtual machines need not support it. + * + * <strong>Important:</strong> do not call this in library code that is + * not specific to Classpath's reference implementation. + * + * @param native_fd The native file descriptor integer. + * @throws IOException + */ + VMChannel(final int native_fd) throws IOException + { + this(); + this.nfd.setNativeFD(native_fd); + } + + public State getState() + { + return nfd; + } + + static + { + // load the shared library needed for native methods. + if (Configuration.INIT_LOAD_LIBRARY) + { + System.loadLibrary ("javanio"); + } + try + { + // so fare this will throw an IOException + VmChannel.initIDs(); + } + catch (IOException e) + { + } + } + + public static VMChannel getStdin() throws IOException + { + return new VMChannel(VmChannel.stdin_fd()); + } + + public static VMChannel getStdout() throws IOException + { + return new VMChannel(VmChannel.stdout_fd()); + } + + public static VMChannel getStderr() throws IOException + { + return new VMChannel(VmChannel.stderr_fd()); + } + + + /** + * Set the file descriptor to have the required blocking + * setting. + * + * @param blocking The blocking flag to set. + */ + public void setBlocking(boolean blocking) throws IOException + { + VmChannel.setBlocking(nfd.getNativeFD(), blocking); + } + + + public int available() throws IOException + { + return VmChannel.available(nfd.getNativeFD()); + } + + + /** + * Reads a byte buffer directly using the supplied file descriptor. + * + * @param dst Direct Byte Buffer to read to. + * @return Number of bytes read. + * @throws IOException If an error occurs or dst is not a direct buffers. + */ + public int read(ByteBuffer dst) + throws IOException + { + return VmChannel.read(nfd.getNativeFD(), dst); + } + + /** + * Read a single byte. + * + * @return The byte read, or -1 on end of file. + * @throws IOException + */ + public int read() throws IOException + { + return VmChannel.read(nfd.getNativeFD()); + } + + + /** + * Reads into byte buffers directly using the supplied file descriptor. + * Assumes that the buffer list contains DirectBuffers. Will perform a + * scattering read. + * + * @param dsts An array direct byte buffers. + * @param offset Index of the first buffer to read to. + * @param length The number of buffers to read to. + * @return Number of bytes read. + * @throws IOException If an error occurs or the dsts are not direct buffers. + */ + public long readScattering(ByteBuffer[] dsts, int offset, int length) + throws IOException + { + if (offset + length > dsts.length) + throw new IndexOutOfBoundsException("offset + length > dsts.length"); + + return VmChannel.readScattering(nfd.getNativeFD(), dsts, offset, length); + } + + + /** + * Receive a datagram on this channel, returning the host address + * that sent the datagram. + * + * @param dst Where to store the datagram. + * @return The host address that sent the datagram. + * @throws IOException + */ + public SocketAddress receive(ByteBuffer dst) throws IOException + { + if (kind != Kind.SOCK_DGRAM) + throw new SocketException("not a datagram socket"); + ByteBuffer hostPort = ByteBuffer.allocateDirect(18); + int hostlen = VmChannel.receive(nfd.getNativeFD(), dst, hostPort); + if (hostlen == 0) + return null; + if (hostlen == 4) // IPv4 + { + byte[] addr = new byte[4]; + hostPort.get(addr); + int port = hostPort.getShort() & 0xFFFF; + return new InetSocketAddress(Inet4Address.getByAddress(addr), port); + } + if (hostlen == 16) // IPv6 + { + byte[] addr = new byte[16]; + hostPort.get(addr); + int port = hostPort.getShort() & 0xFFFF; + return new InetSocketAddress(Inet6Address.getByAddress(addr), port); + } + + throw new SocketException("host address received with invalid length: " + + hostlen); + } + + /** + * Writes from a direct byte bufer using the supplied file descriptor. + * Assumes the buffer is a DirectBuffer. + * + * @param src The source buffer. + * @return Number of bytes written. + * @throws IOException + */ + public int write(ByteBuffer src) throws IOException + { + return VmChannel.write(nfd.getNativeFD(), src); + } + + + /** + * Writes from byte buffers directly using the supplied file descriptor. + * Assumes the that buffer list constains DirectBuffers. Will perform + * as gathering write. + * + * @param fd + * @param srcs + * @param offset + * @param length + * @return Number of bytes written. + * @throws IOException + */ + public long writeGathering(ByteBuffer[] srcs, int offset, int length) + throws IOException + { + if (offset + length > srcs.length) + throw new IndexOutOfBoundsException("offset + length > srcs.length"); + + // A gathering write is limited to 16 buffers; when writing, ensure + // that we have at least one buffer with something in it in the 16 + // buffer window starting at offset. + while (!srcs[offset].hasRemaining() && offset < srcs.length) + offset++; + + // There are no buffers with anything to write. + if (offset == srcs.length) + return 0; + + // If we advanced `offset' so far that we don't have `length' + // buffers left, reset length to only the remaining buffers. + if (length > srcs.length - offset) + length = srcs.length - offset; + + return VmChannel.writeGathering(nfd.getNativeFD(), srcs, offset, length); + } + + + /** + * Send a datagram to the given address. + * + * @param src The source buffer. + * @param dst The destination address. + * @return The number of bytes written. + * @throws IOException + */ + public int send(ByteBuffer src, InetSocketAddress dst) + throws IOException + { + InetAddress addr = dst.getAddress(); + if (addr == null) + throw new NullPointerException(); + if (addr instanceof Inet4Address) + return VmChannel.send(nfd.getNativeFD(), src, addr.getAddress(), dst.getPort()); + e... [truncated message content] |