wrapper_3.5.51_src/build32.sh 100755 0 0 324 14333053647 13137 0 ustar 0 0 #!/bin/sh
BUILDFILE="`pwd`/`dirname $0`/build.xml"
echo "--------------------"
echo "Wrapper Build System"
echo "using $BUILDFILE"
echo "--------------------"
"$ANT_HOME/bin/ant" -f "$BUILDFILE" -Dbits=32 $@
wrapper_3.5.51_src/build64.sh 100755 0 0 324 14333053647 13144 0 ustar 0 0 #!/bin/sh
BUILDFILE="`pwd`/`dirname $0`/build.xml"
echo "--------------------"
echo "Wrapper Build System"
echo "using $BUILDFILE"
echo "--------------------"
"$ANT_HOME/bin/ant" -f "$BUILDFILE" -Dbits=64 $@
wrapper_3.5.51_src/build/ 40755 0 0 0 14333053647 12357 5 ustar 0 0 wrapper_3.5.51_src/doc/ 40755 0 0 0 14333053650 12017 5 ustar 0 0 wrapper_3.5.51_src/src/ 40755 0 0 0 14333053647 12047 5 ustar 0 0 wrapper_3.5.51_src/src/bin/ 40755 0 0 0 14333053650 12611 5 ustar 0 0 wrapper_3.5.51_src/src/c/ 40755 0 0 0 14333053652 12265 5 ustar 0 0 wrapper_3.5.51_src/src/conf/ 40755 0 0 0 14333053652 12770 5 ustar 0 0 wrapper_3.5.51_src/src/java/ 40755 0 0 0 14333053647 12770 5 ustar 0 0 wrapper_3.5.51_src/src/java/org/ 40755 0 0 0 14333053647 13557 5 ustar 0 0 wrapper_3.5.51_src/src/java/org/tanukisoftware/ 40755 0 0 0 14333053647 16625 5 ustar 0 0 wrapper_3.5.51_src/src/java/org/tanukisoftware/wrapper/ 40755 0 0 0 14333053652 20301 5 ustar 0 0 wrapper_3.5.51_src/src/java/org/tanukisoftware/wrapper/demo/ 40755 0 0 0 14333053652 21225 5 ustar 0 0 wrapper_3.5.51_src/src/java/org/tanukisoftware/wrapper/demo/html/ 40755 0 0 0 14333053652 22171 5 ustar 0 0 wrapper_3.5.51_src/src/java/org/tanukisoftware/wrapper/event/ 40755 0 0 0 14333053652 21422 5 ustar 0 0 wrapper_3.5.51_src/src/java/org/tanukisoftware/wrapper/jmx/ 40755 0 0 0 14333053652 21077 5 ustar 0 0 wrapper_3.5.51_src/src/java/org/tanukisoftware/wrapper/security/ 40755 0 0 0 14333053652 22150 5 ustar 0 0 wrapper_3.5.51_src/src/java/org/tanukisoftware/wrapper/test/ 40755 0 0 0 14333053652 21260 5 ustar 0 0 wrapper_3.5.51_src/src/java/org/tanukisoftware/wrapper/test2/ 40755 0 0 0 14333053652 21342 5 ustar 0 0 wrapper_3.5.51_src/src/test/ 40755 0 0 0 14333053647 13026 5 ustar 0 0 wrapper_3.5.51_src/src/test/common/ 40755 0 0 0 14333053647 14316 5 ustar 0 0 wrapper_3.5.51_src/src/test/org/ 40755 0 0 0 14333053647 13615 5 ustar 0 0 wrapper_3.5.51_src/src/test/org/tanukisoftware/ 40755 0 0 0 14333053647 16663 5 ustar 0 0 wrapper_3.5.51_src/src/test/org/tanukisoftware/wrapper/ 40755 0 0 0 14333053652 20337 5 ustar 0 0 wrapper_3.5.51_src/README_de.txt 100644 0 0 14770 14333053653 13551 0 ustar 0 0 -------------------------------------------------------------------------------
Java Service Wrapper Community Edition 3.5.51
Copyright (C) 1999-2022 Tanuki Software, Ltd. All Rights Reserved.
https://wrapper.tanukisoftware.com
-------------------------------------------------------------------------------
Zusammenfassung:
1. Was ist der Java Service Wrapper?
2. Dokumentation
3. Installation
4. Lizenzoptionen
5. Wie zu erwerben?
6. Aktualisieren
7. FAQ
8. Support
9. Systemvoraussetzungen
1. Was ist der Java Service Wrapper?
-------------------------------------------------------------------------------
Der Java Service Wrapper ist eine Anwendung, die aus dem Wunsch heraus erstellt
worden ist, eine Vielzahl von Java bedingten Problem und Einschränkungen zu
beheben.
Einige der Möglichkeiten des Wrappers sind:
* Eine Java-Anwendung als Windows-Dienst und Unix Daemon zu starten
* Erhöhung der Zuverlässigkeit von Javaanwendungen.
* Automatische Crash-, Stillstand- und Deadlock-Erkennung und
Wiederherstellung
* On-Demand-Neustarts
* Standard-, Out-of-the-Box-Scripting
* Flexible Cross-Platform-Konfiguration
* Vereinfachung der Installation von Java-Anwendungen
* Logging
* Und vieles mehr ...
Bitte gehen Sie auf unsere Downloadseite für mehr Details:
=> https://wrapper.tanukisoftware.com/doc/german/download.jsp
Für weitere Informationen gehen Sie bitte auf:
=> https://wrapper.tanukisoftware.com/doc/german/introduction.html
2. Dokumentation
-------------------------------------------------------------------------------
Bitte die vollständige Dokumentation finden Sie auf unserer Webseite.
Hier sind ein paar Informationen für den Anfang:
* Die vollständige Dokumentation finden Sie online:
=> https://wrapper.tanukisoftware.com/doc/german/
* Wie Sie Ihre Anwendung mit dem Java Service Wrapper integrieren:
=> https://wrapper.tanukisoftware.com/doc/german/integrate.html
* Konfigurationseigenschaften:
=> https://wrapper.tanukisoftware.com/doc/german/properties.html
* HOWTOs:
=> https://wrapper.tanukisoftware.com/doc/german/howto.html
* Javadocs, für fortgeschrittene Benutzer:
=> https://wrapper.tanukisoftware.com/doc/german/javadocs.html
* Tanuki Software, Ltd. Firmenseite:
=> https://www.tanukisoftware.com/
3. Installation
-------------------------------------------------------------------------------
Wenn Sie das hier lesen, heißt das, dass Sie unsere Software bereits
erfolgreich entpackt haben.
Die Standard und Professional Editionen des Java Service Wrappers beinhalten
bereits eine zeitlich beschränkte, aber vollfunktionstüchtige Testlizenz, die
es Ihnen erlaubt den Wrapper unbegrenzt oft zu starten und jeweils für 15
Minuten zu laufen. Dies ist für einfache, ungezwungene erste Tests gedacht.
Sie können ebenfalls kostenlos eine einmonatige Testlizenz beantragen, die wie
eine Serverlizenz funktioniert und für diesen Zeitraum auf einem Server Ihrer
Wahl ohne die zeitliche Begrenzung von 15 Minuten pro Anwendung verwendet
werden kann. Testlizenzen können auf folgender Seite beantragt werden:
=> https://wrapper.tanukisoftware.com/doc/german/requestTrial.jsp
Dauerhafte Lizenzen können auf der folgenden Seite erworben werden:
=> https://wrapper.tanukisoftware.com/doc/german/accountLicenses.jsp
The Community Edition benötigt keinerlei Lizenz!
Sollten Sie bereits eine Lizenz erworben haben, können Sie den Lizenzschlüssel
auf der folgendenen Seiten erstellen und herunterladen:
Für Serverlizenzen:
=> https://wrapper.tanukisoftware.com/doc/german/accountServerLicenses.jsp
Für Entwicklerlizenzen:
=> https://wrapper.tanukisoftware.com/doc/german/accountDevLicenses.jsp
Abhängig von der Art der Java-Anwendung, bedarf es verschiedener Arten, wie Sie
die Anwendung mit dem Wrapper integrieren. Die Integrationsschritte finden
Sie auf folgender Seite:
=> https://wrapper.tanukisoftware.com/doc/german/integrate.html
4. Lizenzoptionen
-------------------------------------------------------------------------------
Der Java Service Wrapper ist unter 3 verschiedenen Lizenzen verfügbar:
* Entwicklerlizenz-Vereinbarung (Kommerziell)
* Serverlizenz-Vereinbarung (Kommerziell)
* Communitylizenz-Vereinbarung (kompatibel mit GPL2 und GPL3)
Für mehr Informationen besuchen Sie bitte die Lizenzübersicht auf unserer
Seite:
=> https://wrapper.tanukisoftware.com/doc/german/licenseOverview.html
5. Wie zu erwerben?
-------------------------------------------------------------------------------
Sollten Sie an den Funktionen der Standard bzw. Professional
Edition interessiert sein, können Sie diese hier online erwerben:
=> https://wrapper.tanukisoftware.com/doc/german/accountLicenses.jsp
Sollten Sie eine Banküberweisung bevorzugen, kontaktieren Sie uns bitte unter
sales@tanukisoftware.com und wir werden Ihnen ein ausführliches Angebot mit den
Zahlungsdaten zukommen lassen.
Eine Händlerliste finden Sie auf folgender Webseite:
=> https://www.tanukisoftware.com/en/distributors.php
6. Aktualisieren
-------------------------------------------------------------------------------
Sie finden die aktuellste Version des Wrappers immer auf unserer Downloadseite:
=> https://wrapper.tanukisoftware.com/doc/german/download.jsp
Für die Anleitung gehen Sie bitte auf diese Seite:
=> https://wrapper.tanukisoftware.com/doc/german/howto-upgrade.html
7. FAQ
-------------------------------------------------------------------------------
Bitte gehen Sie auf den FAQ-Bereich unserer Seite:
=> https://wrapper.tanukisoftware.com/doc/german/faq.html
Desweiteren haben wir auch eine Troubleshooting-, HOWTOs- und
Fragen- & Antwortenseite:
=> https://wrapper.tanukisoftware.com/doc/german/troubleshooting.html
=> https://wrapper.tanukisoftware.com/doc/german/howto.html
=> https://wrapper.tanukisoftware.com/doc/german/qna.html
=> https://wrapper.tanukisoftware.com/doc/german/debugging.html
8. Support
-------------------------------------------------------------------------------
Informationen zum Support finden Sie auf unserer Supportseite:
=> https://wrapper.tanukisoftware.com/doc/german/support.jsp
9. Systemvoraussetzungen
-------------------------------------------------------------------------------
Eine vollständige Liste der unterstützten Plattformen finden Sie auf der
folgenden Seite:
=> https://wrapper.tanukisoftware.com/doc/german/supported-platforms.html
-------------------------------------------------------------------------------
Copyright (C) 1999-2022 Tanuki Software, Ltd. All Rights Reserved.
wrapper_3.5.51_src/README_en.txt 100644 0 0 13757 14333053653 13567 0 ustar 0 0 -------------------------------------------------------------------------------
Java Service Wrapper Community Edition 3.5.51
Copyright (C) 1999-2022 Tanuki Software, Ltd. All Rights Reserved.
https://wrapper.tanukisoftware.com
-------------------------------------------------------------------------------
Summary:
1. What is the Java Service Wrapper?
2. Documentation
3. Installation
4. License Options
5. How to Purchase
6. Getting Updates
7. FAQ
8. Support
9. System Requirements
1. What is the Java Service Wrapper?
-------------------------------------------------------------------------------
The Java Service Wrapper is an application that has evolved out of a desire
to solve a number of problems common to many Java applications.
Some of the Wrapper's features are:
* Run a Java application as a Windows Service or Unix Daemon
* Java Application Reliability
* Automatic detection and recovery of Crashes, Freezes and Deadlocks
* On-Demand Restarts
* Standard, Out-of-the Box Scripting
* Flexible Cross-Platform Configuration
* Ease Application Installations
* Logging
* Many more...
See our Product Features page for a more detailed feature list:
=> https://wrapper.tanukisoftware.com/doc/english/product-features.html
For more information, please visit:
=> https://wrapper.tanukisoftware.com/doc/english/introduction.html
2. Documentation
-------------------------------------------------------------------------------
Please visit our website for the full documentation.
Here are some ways to get you started.
* Complete documentation can be found online:
=> https://wrapper.tanukisoftware.com/
* How to integrate the Java Service Wrapper with an Application:
=> https://wrapper.tanukisoftware.com/doc/english/integrate.html
* Configuration Properties:
=> https://wrapper.tanukisoftware.com/doc/english/properties.html
* HOWTOs:
=> https://wrapper.tanukisoftware.com/doc/english/howto.html
* Javadocs, for advanced users:
=> https://wrapper.tanukisoftware.com/doc/english/javadocs.html
* Tanuki Software, Ltd. Corporate site:
=> https://www.tanukisoftware.com/
3. Installation
-------------------------------------------------------------------------------
If you are reading this, it means you have successfully unpacked this software.
The Standard and Professional Editions of the Java Service Wrapper ship with
a time-limited but full-featured trial license key, which allows you to run
the Wrapper as many times as you want for up to 15 minutes. This is meant
for quick, no-hassle testing.
You can also request a FREE 1-month trial license that allows you to run the
Wrapper for the validity of the license (one month) on a single server without
the 15-minute limit per session.
Trial licenses can be obtained at the following URL:
=> https://wrapper.tanukisoftware.com/doc/english/requestTrial.jsp
Permanent licenses can be purchased at the following URL:
=> https://wrapper.tanukisoftware.com/doc/english/accountLicenses.jsp
The Community Edition does not require a license key.
If you have already purchased a license, you can generate and download your
license key by logging on and viewing your License Management Page.
For Server Licenses:
=> https://wrapper.tanukisoftware.com/doc/english/accountServerLicenses.jsp
For Development Licenses:
=> https://wrapper.tanukisoftware.com/doc/english/accountDevLicenses.jsp
Depending on the specific type of Java application that will be run with the
Wrapper, there are a few integration options available:
=> https://wrapper.tanukisoftware.com/doc/english/integrate.html
4. License Options
-------------------------------------------------------------------------------
The Java Service Wrapper is made available under three types of licenses.
* Development License Agreement (Commercial)
* Server License Agreement (Commercial)
* Community License Agreement (Compatible with GPL2 or GPL3)
For more information, please browse our license overview:
=> https://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
5. How to Purchase
-------------------------------------------------------------------------------
If you are interested in the features available with our Standard or
Professional Editions, licenses can be purchased online:
=> https://wrapper.tanukisoftware.com/doc/english/accountLicenses.jsp
If you prefer to pay via wire transfer, please contact us at
sales@tanukisoftware.com and we will send you a detailed quote with payment
information.
For a list of distributors, please consult the page below:
=> https://www.tanukisoftware.com/en/distributors.php
6. Getting Updates
-------------------------------------------------------------------------------
You can always find the latest Wrapper release on our download page:
=> https://wrapper.tanukisoftware.com/doc/english/download.jsp
We also offer an upgrade guide:
=> https://wrapper.tanukisoftware.com/doc/english/howto-upgrade.html
7. FAQ
-------------------------------------------------------------------------------
Please see our general FAQ page:
=> https://wrapper.tanukisoftware.com/doc/english/faq.html
We also offer Troubleshooting, HOWTOs, and a Question & Answers page:
=> https://wrapper.tanukisoftware.com/doc/english/troubleshooting.html
=> https://wrapper.tanukisoftware.com/doc/english/howto.html
=> https://wrapper.tanukisoftware.com/doc/english/qna.html
=> https://wrapper.tanukisoftware.com/doc/english/debugging.html
8. Support
-------------------------------------------------------------------------------
Please see the following page for support options:
=> https://wrapper.tanukisoftware.com/doc/english/support.jsp
9. System Requirements
-------------------------------------------------------------------------------
A full list of supported platforms can be found online:
=> https://wrapper.tanukisoftware.com/doc/english/supported-platforms.html
-------------------------------------------------------------------------------
Copyright (C) 1999-2022 Tanuki Software, Ltd. All Rights Reserved.
wrapper_3.5.51_src/README_es.txt 100644 0 0 14730 14333053653 13564 0 ustar 0 0 -------------------------------------------------------------------------------
Java Service Wrapper Community Edition 3.5.51
Copyright (C) 1999-2022 Tanuki Software, Ltd. All Rights Reserved.
https://wrapper.tanukisoftware.com
-------------------------------------------------------------------------------
Resumen:
1. ¿Qué es el Java Service Wrapper?
2. Documentación
3. Instalación
4. Opciones de Licencia
5. Cómo Comprar
6. Actualizaciones
7. FAQ
8. Soporte Técnico
9. Requisitos del Sistema
1. ¿Qué es el Java Service Wrapper?
-------------------------------------------------------------------------------
El Java Service Wrapper es una aplicación que ha evolucionado con el deseo de
resolver una seria de problemas comúnes encontrados en aplicaciones Java.
Alguna de las características del Wrapper son:
* Ejecutar aplicaciones Java como Servicio de Windows o Demonio de Unix
* Fiabilidad en Aplicaciones Java
* Detección y recuperación automática de fallas, congelamientos o bloqueos
* Reinicios de la JVM en demanda
* Scripting estándar y listo para usar
* Configuración multiplataforma flexible
* Instalaciones más fáciles
* Registros de datos
* Y muchas más...
Por favor visite nuestra página de Características del Producto para una lista
más detallada:
=> https://wrapper.tanukisoftware.com/doc/spanish/product-features.html
Para más información, por favor visite:
=> https://wrapper.tanukisoftware.com/doc/spanish/introduction.html
2. Documentación
-------------------------------------------------------------------------------
Por favor visite nuestro sitio web para ver toda nuestra documentación.
Aquí hay algunas maneras de empezar.
* La documentación completa puede ser encontrada en línea en:
=> https://wrapper.tanukisoftware.com/
* Cómo integrar el Java Service Wrapper con una aplicación:
=> https://wrapper.tanukisoftware.com/doc/spanish/integrate.html
* Propiedades de Configuración:
=> https://wrapper.tanukisoftware.com/doc/spanish/properties.html
* HOWTOs:
=> https://wrapper.tanukisoftware.com/doc/spanish/howto.html
* Javadocs, para usuarios avanzados:
=> https://wrapper.tanukisoftware.com/doc/spanish/javadocs.html
(Sólo Inglés)
* Sitio de la compañia - Tanuki Software, Ltd.:
=> https://www.tanukisoftware.com/es/
3. Instalación
-------------------------------------------------------------------------------
Si está leyendo esto, significa que ha descomprimido correctamente este
software.
Las ediciones Estándar y Profesional del Java Service Wrapper son
distribuidas con una clave de licencia de prueba de tiempo limitado, con todas
las características habilitadas, que le permite ejectuar el Wrapper tantas
veces quiera por hasta 15 minutos por vez. Esto está diseñado para realizar
pruebas rápidas y sin complicaciones.
También puede solicitar una licencia de prueba GRATUITA de 1 mes, que le
permite ejecutar el Wrapper en un solo servidor durante la validez de la
licencia (un mes), sin el límite de 15 minutos por sesión.
La licencia de prueba puede ser adquirida en:
=> https://wrapper.tanukisoftware.com/doc/spanish/requestTrial.jsp
Las licencias permanentes se pueden comprar en el siguiente enlace:
=> https://wrapper.tanukisoftware.com/doc/spanish/accountLicenses.jsp
La edición comunidad (Community Edition) no require una clave de licencia.
Si ya ha comprado una licencia, puede iniciar sesión y generar su clave de
licencia desde su Página de Administración de Licencias.
Para Licencias para Servidor:
=> https://wrapper.tanukisoftware.com/doc/spanish/accountServerLicenses.jsp
Para Licencias de Desarrollo:
=> https://wrapper.tanukisoftware.com/doc/spanish/accountDevLicenses.jsp
Dependiendo del tipo específico de aplicación Java que se ejecutará con el
Wrapper, hay opciones diferentes de integración disponibles:
=> https://wrapper.tanukisoftware.com/doc/spanish/integrate.html
4. Tipos de Licencia
-------------------------------------------------------------------------------
El Java Service Wrapper está disponible bajo tres licencias.
* Licencia de Desarrollo (Comercial)
* Licencia para Servidor (Comercial)
* Licencia para la Comunidad (Compatible con GPL2 o GPL3)
Para más información, por favor visite nuestra página de licencias:
=> https://wrapper.tanukisoftware.com/doc/spanish/licenseOverview.html
5. Cómo Comprar
-------------------------------------------------------------------------------
Si está interesado en las funciones disponibles con nuestras ediciones
Estándar o Profesional, las licencias se pueden comprar en línea:
=> https://wrapper.tanukisoftware.com/doc/spanish/accountLicenses.jsp
Si prefiere pagar mediante transferencia bancaria, contáctenos en
sales@tanukisoftware.com y le enviaremos un presupuesto detallado con
la información de pago.
Para ver la lista de distribuidores, consulte la página siguiente:
=> https://www.tanukisoftware.com/es/distributors.php
6. Actualizaciones
-------------------------------------------------------------------------------
Siempre es posible encontrar la versión más reciente en:
=> https://wrapper.tanukisoftware.com/doc/spanish/download.jsp
Nosotros también ofrecemos una guía de actualización:
=> https://wrapper.tanukisoftware.com/doc/spanish/howto-upgrade.html
7. FAQ
-------------------------------------------------------------------------------
Para ver nuestra página de Preguntas Frequentes general, por favor visite:
=> https://wrapper.tanukisoftware.com/doc/spanish/faq.html
Solución de problemas, HOWTOs o nuestra sección de Preguntas y Respuestas:
=> https://wrapper.tanukisoftware.com/doc/spanish/troubleshooting.html
=> https://wrapper.tanukisoftware.com/doc/spanish/howto.html
=> https://wrapper.tanukisoftware.com/doc/spanish/qna.html
=> https://wrapper.tanukisoftware.com/doc/spanish/debugging.html
8. Soporte Técnico
-------------------------------------------------------------------------------
Por favor visite nuestra página de soporte para más opciones:
=> https://wrapper.tanukisoftware.com/doc/spanish/support.jsp
9. Requisitos del Sistema
-------------------------------------------------------------------------------
La lista completa de plataformas soportadas puede ser encontrada en línea:
=> https://wrapper.tanukisoftware.com/doc/spanish/supported-platforms.html
-------------------------------------------------------------------------------
Copyright (C) 1999-2022 Tanuki Software, Ltd. All Rights Reserved.
wrapper_3.5.51_src/README_ja.txt 100644 0 0 17256 14333053653 13555 0 ustar 0 0 -------------------------------------------------------------------------------
Java Service Wrapper Community Edition 3.5.51
Copyright (C) 1999-2022 Tanuki Software, Ltd. All Rights Reserved.
https://wrapper.tanukisoftware.com
-------------------------------------------------------------------------------
概要:
1. Java Service Wrapper とは?
2. ドキュメンテーション
3. インストール
4. ライセンスの種類
5. ライセンス購入方法
6. アップデート方法
7. よくある質問 FAQ
8. サポート
9. システム要件
1. Java Service Wrapper とは?
-------------------------------------------------------------------------------
Java Service Wrapper は、多くの Java アプリケーションによくある問題を
解決したいという多くの要望に応えて登場したアプリケーションです。
主な Wrapper の特徴:
* Windows サービスや Unix デーモンとして Java アプリケーションを動かす
* Java アプリケーションの信頼性
* クラッシュ、フリーズ、デッドロックなど自動検知および自動リカバリー
* オンデマンドによる再起動
* 簡単にすぐ使えるスクリプト付き
* クロスプラットフォームに対応した柔軟なコンフィギュレーション
* アプリケーションの簡単なインストール
* ログ記録
* その他色々
さらに詳しい特徴などは機能の比較ページをご覧ください。
=> https://wrapper.tanukisoftware.com/doc/japanese/product-features.html
さらに詳しくはこちらもご覧ください。
=> https://wrapper.tanukisoftware.com/doc/japanese/introduction.html
2. ドキュメンテーション
-------------------------------------------------------------------------------
完全なドキュメンテーションをご覧になりたい場合にはウェブサイトをご覧ください。
「始めるには?」を簡単にご紹介します。
* オンラインで完全なドキュメンテーションをご覧になれます。
=> https://wrapper.tanukisoftware.com/doc/japanese/
* Java アプリケーションを Java Service Wrapper とインテグレーションする方法
=> https://wrapper.tanukisoftware.com/doc/japanese/integrate.html
* コンフィギュレーションプロパティ一覧
=> https://wrapper.tanukisoftware.com/doc/japanese/properties.html
* HOWTO(ハウツー)
=> https://wrapper.tanukisoftware.com/doc/japanese/howto.html
* Javadocs(上級レベルのユーザー向け)
=> https://wrapper.tanukisoftware.com/doc/japanese/javadocs.html
(英語のみ)
* タヌキソフトウェア有限会社サイト
=> https://www.tanukisoftware.com/ja/
3. インストール
-------------------------------------------------------------------------------
このファイルを読んでいるということは、本ソフトウェアが正常に解凍されたことを意味します。
Java Service Wrapper のスタンダード版やプロフェッショナル版には、時間制限つきの
全機能を利用できるトライアルライセンスキーを同梱してあり、1回の稼働が最長15分までに
制限されていますが、回数に関係なく何度でも利用が可能です。
簡単にクイックテストなど便利にご利用いただけます。
さらに長時間の利用を希望であれば、セッションごとに15分の制限なしで1台のサーバー上で
使える1カ月の無料トライアルライセンスもご用意しています。
1カ月トライアルライセンスは次のページからリクエストすることができます。
=> https://wrapper.tanukisoftware.com/doc/japanese/requestTrial.jsp
永久ライセンスは次のURLよりご購入できます。
=> https://wrapper.tanukisoftware.com/doc/japanese/accountLicenses.jsp
Java Service Wrapperコミュニティー版にはライセンス・キーは不要です。
既にライセンスを購入済みの方は、サイトにログインして、ライセンス管理ページで
ライセンスキーを生成することができます。
サーバーライセンス管理ページ
=> https://wrapper.tanukisoftware.com/doc/japanese/accountServerLicenses.jsp
開発ライセンス管理ページ
=> https://wrapper.tanukisoftware.com/doc/japanese/accountDevLicenses.jsp
Java Service Wrapper で動かす Java アプリケーションの種類により、
いくつかインテグレーション方法があります。
=> https://wrapper.tanukisoftware.com/doc/japanese/integrate.html
4. ライセンスの種類
-------------------------------------------------------------------------------
Java Service Wrapper の利用には3つのライセンスがあります。
* 開発ライセンス契約 (商用ライセンス)
* サーバーライセンス契約 (商用ライセンス)
* コミュニティライセンス契約 (GPL2 または GPL3 と両立)
さらに詳しくは、ライセンス概要をご覧ください。
=> https://wrapper.tanukisoftware.com/doc/japanese/licenseOverview.html
5. ライセンス購入方法
-------------------------------------------------------------------------------
Java Service Wrapper スタンダード版あるいはプロフェッショナル版の機能を
ご利用になるためにオンラインでライセンスを購入することが可能です。
=> https://wrapper.tanukisoftware.com/doc/japanese/accountLicenses.jsp
銀行振り込みを希望される場合は sales@tanukisoftware までお問い合わせ願います。
支払い方法の詳細を記載した見積書を送付いたします。
代理店、ディストリビューター経由からの購入も可能です。
=> https://www.tanukisoftware.com/ja/distributors.php
6. アップデート方法
-------------------------------------------------------------------------------
最新の Java Service Wrapper リリースはいつでもダウンロードページで入手できます。
=> https://wrapper.tanukisoftware.com/doc/japanese/download.jsp
最新版へのアップグレード手順ガイド
=> https://wrapper.tanukisoftware.com/doc/japanese/howto-upgrade.html
7. よくある質問 FAQ
-------------------------------------------------------------------------------
よくある質問 FAQ ページも便利に活用いただけます:
=> https://wrapper.tanukisoftware.com/doc/japanese/faq.html
その他、トラブルシューティング、HOWTO、質問と回答など各ページもご活用ください。
=> https://wrapper.tanukisoftware.com/doc/japanese/troubleshooting.html
=> https://wrapper.tanukisoftware.com/doc/japanese/howto.html
=> https://wrapper.tanukisoftware.com/doc/japanese/qna.html
=> https://wrapper.tanukisoftware.com/doc/japanese/debugging.html
8. サポート
-------------------------------------------------------------------------------
皆様が快適にユーザーサポートを受けられるよう、いくつかオプションをご用意
しています。サポートの詳細については弊社のサポートページをご覧ください。
=> https://wrapper.tanukisoftware.com/doc/japanese/support.jsp
9. システム要件
-------------------------------------------------------------------------------
サポートされているプラットフォームの完全なリストをオンラインで
ご用意していますのでご参照ください。
=> https://wrapper.tanukisoftware.com/doc/japanese/supported-platforms.html
-------------------------------------------------------------------------------
Copyright (C) 1999-2022 Tanuki Software, Ltd. All Rights Reserved.
wrapper_3.5.51_src/build-tests.xml 100644 0 0 513400 14333053650 14373 0 ustar 0 0
wrapper.java.classpath.1=../lib/wrapper.jar
wrapper.console.format=PM
wrapper.console.format=PM
wrapper.console.format=PM
]]>
wrapper.java.additional.1=
wrapper.java.additional.1=-verbose:gc
wrapper.java.additional.1=
]]>
wrapper.syslog.loglevel=NONE
wrapper.syslog.loglevel=NONE
]]>
]]>
wrapper.java.additional.1=
wrapper.java.classpath.2=../lib/wrapper.jar
wrapper.java.classpath.2=../lib/wrapper.jar
wrapper.syslog.loglevel=NONE
wrapper.syslog.loglevel=NONE
wrapper.java.additional.1=
wrapper.java.classpath.1=../lib/wrapper.jar
wrapper.java.classpath.1=../lib/wrapper.jar
wrapper.java.classpath.1=../lib/wrapper.jar
]]>
]]>
]]>
ABC DEF GHI
]]>
"Hello World."
]]>
"Hello World."
]]>
#encoding=UTF-8
ABC
]]>
# This is a comment.
ABC # This is another comment.
DEF##param2
"#GHI"
]]>
%WRAPPER_LANG%
"%WRAPPER_BIN_DIR%"
%WRAPPER_BITS%
-Dparam1=param1 -Dparam2=param2 -Dparam3=param3
-Dparam="Hello World."
-Dparam="Hello World."
#encoding=UTF-8
-Dparam=param
# This is a comment.
-Dparam1=param1 # This is another comment.
-Dparam2=##param2
-Dparam3="#param3"
-Dparam1=%WRAPPER_LANG%
-Dparam2="%WRAPPER_BIN_DIR%"
-Dparam3=%WRAPPER_BITS%
wrapper.java.additional.1=
wrapper.java.additional.1=
wrapper.java.additional.1=
]]>
wrapper.java.classpath.2=../lib/wrapper.jar
wrapper.java.classpath.2=../lib/wrapper.jar
setlocal
@echo off
rem Use a relative path to the wrapper %~dp0 is location of current script under NT
echo PassThroughMode=START Test
echo The '****PASSTHROUGH****' argument should appear after 'StartParam'
echo.
%~dp0\..\bin\wrapper.exe -c ..\test\passthrough.conf wrapper.java.additional.1=-Dorg.tanukisoftware.wrapper.WrapperStartStopApp.passthroughMode=START -- "****PASSTHROUGH****"
echo.
echo PassThroughMode=STOP Test
echo The '****PASSTHROUGH****' argument should appear after ''StopParam'
echo.
%~dp0\..\bin\wrapper.exe -c ..\test\passthrough.conf wrapper.java.additional.1=-Dorg.tanukisoftware.wrapper.WrapperStartStopApp.passthroughMode=STOP -- "****PASSTHROUGH****"
echo.
echo PassThroughMode=BOTH Test
echo The '****PASSTHROUGH****' argument should appear after 'StartParam' and 'StopParam'
echo.
%~dp0\..\bin\wrapper.exe -c ..\test\passthrough.conf wrapper.java.additional.1=-Dorg.tanukisoftware.wrapper.WrapperStartStopApp.passthroughMode=BOTH -- "****PASSTHROUGH****"
echo.
echo PassThroughMode=IGNORE Test
echo The '****PASSTHROUGH****' argument should not appear at all.
echo.
%~dp0\..\bin\wrapper.exe -c ..\test\passthrough.conf wrapper.java.additional.1=-Dorg.tanukisoftware.wrapper.WrapperStartStopApp.passthroughMode=IGNORE -- "****PASSTHROUGH****"
echo.
echo Default PassThroughMode Test
echo The '****PASSTHROUGH****' argument should not appear at all.
echo.
%~dp0\..\bin\wrapper.exe -c ..\test\passthrough.conf -- "****PASSTHROUGH****"
echo.
wrapper.app.parameter.1=<YourMainClass>
wrapper.app.parameter.1=<YourMainClass>
wrapper.app.parameter.1=<YourMainClass>
wrapper.app.parameter.1=<YourMainClass>
wrapper.app.parameter.1=<YourMainClass>
wrapper.app.parameter.1=<YourMainClass>
wrapper.app.parameter.1=<YourMainClass>
wrapper.app.parameter.1=<YourMainClass>
wrapper.app.parameter.1=<YourMainClass>
the needs of your application
#! /bin/sh
echo "PassThroughMode=START Test"
echo "The '****PASSTHROUGH****' argument should appear after 'StartParam'"
echo ""
../bin/wrapper -c ../test/passthrough.conf wrapper.java.additional.1=-Dorg.tanukisoftware.wrapper.WrapperStartStopApp.passthroughMode=START -- "****PASSTHROUGH****"
echo ""
echo "PassThroughMode=STOP Test"
echo "The '****PASSTHROUGH****' argument should appear after ''StopParam'"
echo ""
../bin/wrapper -c ../test/passthrough.conf wrapper.java.additional.1=-Dorg.tanukisoftware.wrapper.WrapperStartStopApp.passthroughMode=STOP -- "****PASSTHROUGH****"
echo ""
echo "PassThroughMode=BOTH Test"
echo "The '****PASSTHROUGH****' argument should appear after 'StartParam' and 'StopParam'"
echo ""
../bin/wrapper -c ../test/passthrough.conf wrapper.java.additional.1=-Dorg.tanukisoftware.wrapper.WrapperStartStopApp.passthroughMode=BOTH -- "****PASSTHROUGH****"
echo ""
echo "PassThroughMode=IGNORE Test"
echo "The '****PASSTHROUGH****' argument should not appear at all"
echo ""
../bin/wrapper -c ../test/passthrough.conf wrapper.java.additional.1=-Dorg.tanukisoftware.wrapper.WrapperStartStopApp.passthroughMode=IGNORE -- "****PASSTHROUGH****"
echo ""
echo "Default PassThroughMode Test"
echo "The '****PASSTHROUGH****' argument should not appear at all."
echo ""
../bin/wrapper -c ../test/passthrough.conf -- "****PASSTHROUGH****"
echo ""
]]>
#wrapper.license.debug=TRUE
wrapper_3.5.51_src/build.xml 100644 0 0 331465 14333053650 13244 0 ustar 0 0
wrapper.check.deadlock.interval=60
wrapper.java.classpath.1=../lib/wrapper.jar
# of the the file.
wrapper.java.classpath.1=../lib/wrapper.jar
# Out Of Memory detection.
**********************************************************
* An intermediate pre-release distribution has been *
* created in the dist directory. This file can be *
* expanded on any system to quickly produce a native *
* release by running "build<64/32> release". *
* *
* Alternately a release can be generated for the current *
* platform by running "build<64/32> release" now. *
* *
* Intermediate pre-release distributions: *
* ${dist.dir}/${prerelease.file}.zip
* ${dist.dir}/${prerelease.file}.tar.gz
**********************************************************
**********************************************************
* You must first either run the pre-release task in a *
* full source distribution or run within an intermediate *
* pre-release distribution. *
**********************************************************
# of the the file.
wrapper.java.classpath.1=../lib/wrapper.jar
# Out Of Memory detection.
**********************************************************
* A native release distribution has been created in the *
* dist directory. *
* *
* Release distribution: *
* ${dist.dir}/${releasefile}${release-unsigned-tail}.zip
**********************************************************
# of the the file.
wrapper.java.classpath.1=../lib/wrapper.jar
# Out Of Memory detection.
**********************************************************
* A native release distribution has been created in the *
* dist directory. *
* *
* Release distribution: *
* ${dist.dir}/${releasefile}${release-unsigned-tail}.tar.gz
**********************************************************
wrapper.check.deadlock.interval=60
wrapper.java.classpath.1=../lib/wrapper.jar
# Wrapper Properties
wrapper.java.classpath.1=../lib/wrapper.jar
**********************************************************
* A delta-pack release distribution has been created in *
* the dist directory. *
* *
* Release distributions: *
* ${dist.dir}/${deltareleasefile}.zip
* ${dist.dir}/${deltareleasefile}.tar.gz
**********************************************************
wrapper_3.5.51_src/build32.bat 100644 0 0 366 14333053647 13276 0 ustar 0 0 @echo off
setlocal
set BUILDFILE=%~dp0%build.xml
echo --------------------
echo Wrapper Build System
echo using %BUILDFILE%
echo --------------------
call "%ANT_HOME%\bin\ant.bat" -f "%BUILDFILE%" -Dbits=32 %1 %2 %3 %4 %5 %6 %7 %8
wrapper_3.5.51_src/build64.bat 100644 0 0 363 14333053647 13300 0 ustar 0 0 @echo off
setlocal
set BUILDFILE=%~dp0%build.xml
echo --------------------
echo Wrapper Build System
echo using %BUILDFILE%
echo --------------------
call "%ANT_HOME%\bin\ant.bat" -f "%BUILDFILE%" -Dbits=64 %1 %2 %3 %4 %5 %6 %7 %8
wrapper_3.5.51_src/default.properties 100644 0 0 6333 14333053650 15116 0 ustar 0 0 # -------------------------------------------------------------------
# B U I L D P R O P E R T I E S
# -------------------------------------------------------------------
# Specifies default property values
# Overridden ant.properties
# Not user-editable; use ant.properties files instead
name = wrapper
Name = Wrapper
long.name = Java Service Wrapper Community ${version.root}
Version = 3.5.51
version = ${Version}
version.root = 3.5.51
year = 2022
# NOTE - The version property gets corrupted by the use of Xalan
# so Version is used instead.
app.name = testwrapper
app.caps.name = TestWrapper
app.long.name = Test Wrapper Sample Application
app.desc = Test Wrapper Sample Application Description
# Settings used to configure compile environment
build.debug = on
build.optimize = off
build.deprecation = off
build.compress = false
junit.failonerror = true
# Minimum version of Java required to build the Wrapper
javac.target.version=1.4
# Location of java to build the pre-release
javac.dir=E:\\j2sdk1.4.2_19
# location of intermediate products
build.dir = ${basedir}/build
build.classes = ${build.dir}/classes
build.headers = ${build.dir}/headers
build.testclasses = ${build.dir}/testclasses
build.tests = ${build.dir}/tests
dist.dir = ${basedir}/dist
signtool.dir=C:\\Program Files (x86)\\Windows Kits\\8.1\\bin\\x64
cert.dir=
# Set the properties for existing directories
bin.dir = ${basedir}/bin
conf.dir = ${basedir}/conf
src.dir = ${basedir}/src
lib.dir = ${basedir}/lib
logs.dir = ${basedir}/logs
doc.dir = ${basedir}/doc
jdoc.dir = ${basedir}/jdoc
test.dir = ${basedir}/test
context.dir = ${src.dir}/documentation
tools.dir = ${basedir}/tools
# --------------------------------------------------
# REQUIRED LIBRARIES
# --------------------------------------------------
# List of possible locations for the visual studio setup scripts
vcvars.v8_32_1=c:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\bin\\vcvars32.bat
vcvars.v8_32_2=d:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\bin\\vcvars32.bat
vcvars.v8_32_3=c:\\Program Files (x86)\\Microsoft Visual Studio 8\\VC\\bin\\vcvars32.bat
vcvars.v8_32_4=d:\\Program Files (x86)\\Microsoft Visual Studio 8\\VC\\bin\\vcvars32.bat
vcvars.v8_32_5=C:\\Program Files\\Microsoft Platform SDK for Windows Server 2003 R2\\SetEnv.Cmd
vcvars.v8_32_5.arg.1=/XP32
vcvars.v8_32_5.arg.2=/RETAIL
vcvars.v8_32_6=C:\\Program Files\\Microsoft Platform SDK\\SetEnv.Cmd
vcvars.v8_32_6.arg.1=/XP32
vcvars.v8_32_6.arg.2=/RETAIL
vcvars.v8_x86_64_1=c:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\bin\\vcvars64.bat
vcvars.v8_x86_64_2=c:\\Program Files\\Microsoft Visual Studio 9\\VC\\bin\\amd64\\vcvarsamd64.bat
vcvars.v8_x86_64_3=c:\\Program Files\\Microsoft Platform SDK for Windows Server 2003 R2\\SetEnv.Cmd
vcvars.v8_x86_64_3.arg.1=/XP64
vcvars.v8_x86_64_3.arg.2=/RETAIL
vcvars.v8_x86_64_4=c:\\Program Files\\Microsoft Platform SDK\\SetEnv.Cmd
vcvars.v8_x86_64_4.arg.1=/XP64
vcvars.v8_x86_64_4.arg.2=/RETAIL
vcvars.v8_ia_64_1=c:\\Program Files\\Microsoft Platform SDK\\SetEnv.Cmd
vcvars.v8_ia_64_1.arg.1=/SRV64
vcvars.v8_ia_64_1.arg.2=/RETAIL
# --------------------------------------------------
# OPTIONAL LIBRARIES
# --------------------------------------------------
wrapper_3.5.51_src/doc/index.html 100644 0 0 703 14333053650 14071 0 ustar 0 0
Java Service Wrapper Documentation
Complete documentation can be found online:
http://wrapper.tanukisoftware.org
Java docs are available online as well:
http://wrapper.tanukisoftware.org/jdoc/index.html
wrapper_3.5.51_src/doc/revisions.txt 100644 0 0 1140107 14333053650 14762 0 ustar 0 0 Java Service Wrapper Revision History.
--------------------------------------
3.5.51
* Fix a bug where some cleanup tasks related to the backend pipe or socket
(usually performed between a JVM shutdown and the next restart) were being
skipped. This was only a problem if the JVM had crashed, was frozen or if the
Wrapper process was abnormally delayed. Since 3.5.47.
* Fix installation failure of Windows Services when using a managed service
account, a group-managed service account, or a virtual account. Also improve
the detection of built-in service accounts, which do not require
authentication.
* Fix an issue on Windows where the 'file.encoding' system property, if
specified in the wrapper.java.additional. properties, was overridden.
* Improve the behavior when the command used to request the Java version fails.
For any failure while waiting for the process to complete, an automatic
restart will be scheduled (as this could simply be due to the system being
temporarily under high load). If, in addition, the process cannot be killed,
the Wrapper will stop.
* Fix status message not showing when the JVM was continued (with SIGCONT) on
macOS.
* Fix a timing issue where some remaining JVM output was sometimes printed
after confirming that the JVM process had completed.
* Increase the width of the 'W' and 'J' columns of the log format to fit the
size of the maximum PID value.
* Change the link order of the Make files for the Community Edition, so that
the libraries appear after the sources. This is done to be more compatible
with some linkers, which only accept this order.
* (Standard) Fix 'wrapper -h' command not returning any hostIds on Microsoft
Azure or Hyper-V Virtual Machines.
* (Standard) Improve messages printed when there is a problem with the license,
and indicate the property name of the key id currently used to help identify
the problematic property set when the license key file contains multiple
keys.
* (Standard) Fix a minor logging problem where the 'D' format was displaying
"unknown" for messages being logged by the main Wrapper instance when
wrapper.single_invocation.notify was set to TRUE.
3.5.50
* (Standard) Fix an issue where the Wrapper would sometimes fail to validate
the license HostId on some Windows installations.
* Fix a log rolling bug where old files were not being purged on Wrapper
startup if the mode was WRAPPER, JVM, SIZE_OR_WRAPPER, or SIZE_OR_JVM.
Since 3.5.45.
* Update the MacOS and Windows installer titles to include the architecture.
This is to avoid confusion between x86 (or universal for MacOS) and arm
installers.
* Add wrapper.check_certificate.default.loglevel property to control the log
level of non-critical errors detected when performing trust verification on
the certificate chain built by the Wrapper. Change the default log level to
DEBUG.
* Enhance security when running on old versions of Windows where only SHA-1
hash algorithm is supported. The Wrapper will shutdown if the signature of
the certificate cannot be verified, as is the case for SHA-2 certificates.
* Stop the Wrapper when the counter signature of the code signing timestamp
was not valid.
* Fix a hung issue on Windows caused by the certificate validation being
slower than the main thread's execution. This could happen on machines with
incomplete certificate installation, and when the Wrapper stopped soon after
it started (e.g when the configuration is incorrect).
* Improve behavior on exit to wait for threads that are still running while the
Wrapper still handles CTRL-C signals, and before displaying the final
"Wrapper stopped" message.
* Fix wrapper.startup_thread.timeout being a few milliseconds shorter than
configured.
* Add missing '-fPIC' compilation option for FreeBSD 32-bit (lack of this
option could cause some errors in the execution of the native library).
* Remove redundant log message when the path to the log file is either
incorrect or doesn't have sufficient permissions.
* Remove misleading status message "JVM process is gone" which was actually for
the JVM instance launched to get the Java version (UNIX only).
* Improve display of the 'J' column in the log format to only show the PID of
the Java process when it's existing. Otherwise "-----" is displayed.
* Improve behavior when requesting a thread dump while the Java process doesn't
exist: skip sending a signal, and simply log a message stating that the JMV
is not running.
* (Standard) Improve the messages printed when there is a problem with the
license, and indicate the location of the license key file currently used to
help when it needs to be replaced.
* (Standard) Remove unnecessary debug message and skip some configuration
loading when launching the Wrapper with a command that doesn't involve a JVM.
* (Profesional) Fix false positive on checking when the JVM process is
continued if an event command completed while the JVM process was in the
stopped state.
* Fix potential issue where a SIGCHLD signal from the JVM could be received by
other running threads of the Wrapper and ignored. This would result in a
slower detection of the JVM shutdown.
* (Standard) Fix memory issues when using wrapper.timezone or
wrapper.java.timezone. Since 3.5.46.
* (Standard) Fix incorrect calculation of the offset when using a timezone with
'UTC' format if minutes where specified. The detailed timestamps printed with
wrapper.timezone.debug_timestamps, which showed the offset of the system time
on Windows, are also corrected.
* (Standard) When wrapper.java.timezone uses (or defaults to) a value with
'UTC' it is now passed to the command line using the corresponding 'GMT'
notation to be compatible with Java.
3.5.49
* Fix high CPU usage observed on certain Unix platforms when running as a
console application. The Windows platform, as well as daemon installations
on Unix are not affected. Since 3.5.47. Applications using version 3.5.48
that do not need to handle stdin may circumvent the issue by
adding wrapper.disable_console_input=TRUE to their configuration file. This
workaround is not recommended for 3.5.47 because of another issue (see
below).
* Reintroduce Solaris SPARC releases in the Delta Pack.
* Fix an issue where the Linux armel and armhf (32-bit) architectures were not
correctly loading the native library. This was only a problem when using the
Delta Pack.
* Fix Windows installers that were ignoring the installation directory if it
was changed by the user.
3.5.48
* Fix a critical bug on UNIX where the Wrapper could get stuck and fail to
restart if a JVM restart was requested by the JVM or Wrapper. This would
happen when wrapper.disable_console_input was set to TRUE, which is the
default when running as a daemon. Since 3.5.47.
* Fix a bug on UNIX where console messages would sometimes be truncated,
causing the next message to start on the same line. This was only a display
problem and did not affect the operation of the Wrapper. The log file was
not affected. Since 3.5.47.
* Windows versions were unchanged from 3.5.47.
3.5.47
* (Standard) Fix a bug where setting wrapper.share..startup.premapped or
wrapper.share..startup.failure to 'SHUTDOWN' would cancel the action
specified by wrapper.on_exit.. Since 3.5.30.
* Fix 'Invalid permission eventType: "serviceremote control"' exception when
using a Security Manager. Security Manager has, however, been deprecated
since Java 17 and usage is no longer recommended.
* Fix incorrect return code of Windows Batch Scripts when there is a problem.
* On Windows, Oracle Java version 12 and above start using the default code
page of the UI language (instead of the default ANSI Windows code page). The
Wrapper will add the 'file.encoding' system property to the command line to
be able to print the Java output correctly regardless of the Java version.
* Rework the initialization of the Unix Shell Script: improved validation of
startup arguments, better control of user and permissions, etc.
* Improve the Shell Script so it now updates its SELinux context (type to
'bin_t') during the installation as a systemd daemon, and restores it when
removing the unit. This is required to be authorized to start, and only done
when SELinux is enabled.
* Improve message to indicate the Wrapper log file(s) when the Wrapper is
launched from the Shell Script and fails to start.
* Deprecate the SU_BIN parameter of the Unix Shell Script. The command to
substitute the user is now resolved to 'runuser' when present on the system,
and falls back on 'su' otherwise. This behavior is regardless the start type
(console or daemon). In addition, the RUN_AS_USER feature will now always
check that the root user is used.
* Improve handling of signals sent to the process group of the script so that
they are forwarded to the Wrapper and handled in sync with it. This works
both when running normally or as a substitute user. In particular, this makes
it possible to send interruption requests with CTRL-C on the shell when
running as a user, but also ensures that the script never terminates leaving
the Wrapper process running in the background. When not targeting a process
group, it is advised to send the signals directly to the Wrapper process.
* Launch Java in a new process group. This allows the Wrapper to handle signals
more consistently and solves issues such as the double thread dump happening
when pressing CTRL-\ or sending a QUIT signal to the process group (UNIX).
* (Professional) Add new wrapper.event..command.new_process_group
properties to control whether event commands should be launched in new
process groups.
* (Professional) Add a new setAutoCloseInputStreams() method to the
WrapperProcessConfig class to make it possible to control the mode to read
pipes of child processes. The default is now "true" for UNIX. It was
effectively "false" for previous versions which caused the input stream to
block if sub-child processes were still using the pipes, or in some cases
where the direct child process would crash.
* (Professional) More accurate timeouts when using WrapperProcess.destroy()
and better performances for WrapperProcess.waitFor().
* (Professional) Fix exception being thrown on Windows when launching a child
process if the working directory was changed.
* Improve the cleanup of monitored child process groups when their group leader
is terminated but other members are still running. The Wrapper will make sure
that the group's status is at least checked every 5 seconds.
* Fix a problem where the TestWrapper application in console mode would keep
prompting an action in an infinite loop if the input stream was closed.
* (Professional) The z/OS distributions are not available for this release.
Please contact us if you need them, as we may be able to provide them at a
later date.
3.5.46
* Add a new signed installers for Windows.
* Add new Apple silicon "aarch64" releases.
* Add new FreeBSD 64-bit ARM (aarch64) releases. Built on FreeBSD 13.0.
* Change the architecture name to "arm" for linux 64-bit. "armhf" is still used
for the 32-bit distributions to differentiate with "armel".
* Stop providing new releases for Solaris SPARC. No usage have been reported
recently. Please contact us if there is a need for this platform.
* Add additional checks for os.arch on MacOS so only supported "ppc", "ppc64",
"x86", and "x86_64" will be mapped to the "universal" architecture.
* (Standard) Add new property wrapper.java.timezone to make it possible to
override the value of wrapper.timezone and configure a different timezone for
the Java application. Also add the 'SYSTEM' value to let these properties be
set with the local timezone of the system.
* (Standard) Always make sure to restore the value of the TZ environment
variable set by the Wrapper prior to launching the JVM.
* Fix an advice wrongly reported when using 'UTC' for the value of
wrapper.timezone.
* (Professional) Add a new setNewProcessGroup() method to the
WrapperProcessConfig class to make it possible to control whether or not
child processes will be assigned to a new process group (PGID). The default
is now true for UNIX, it was effectively false for previous versions which
made it easy to end up with orphaned processes which are launched indirectly,
such as via an intermediate bash process.
* (Professional) The shutdown of child processes on Wrapper exit, as well as
when calling WrapperProcess.dispose() were waiting for the soft shutdown
timeout after attempting to send a CTRL-C to a console child proceess. Due
to the way the Windows API works, these CTRL-C signals will never be seen
by the child process, and the timeout will always be used. To avoid this
delay, the Wrapper now immediately terminates console processes as that was
always the end result anyway. This will be revisited if a way to send the
CTRL-C signal can be implemented. Windows processes are asked to shutdown
nicely, and then the timeout is used to wait for them to exit cleanly.
* (Professional) Add WrapperProcessConfig.getSoftShutdownTimeout() method for
consistency.
* (Professional) Fix memory leak when launching a child process with
POSIX_SPAWN. Also improve the FORK_EXEC and VFORK_EXEC methods to cleanly
terminate the child process in case an error occurs while creating it.
* (Professional) Add support of POSIX_SPAWN start type for child processes on
FreeBSD 8+.
* (Professional) Fix log output of child processes not being printed on z/OS
and improve performances on other platforms.
* (Professional) Fix a warning message on UNIX platforms where the Wrapper
would report that an event command exited unexpectedly if
wrapper.event..command.block.timeout was 0. The command would
otherwise complete correctly. Positive timeouts were working correctly.
* Fix jar files being signed with an older code signing certificate (expiring
on 2020-12-15 but with a timestamp valid until 2027-06-27). The new
certificate is the same as the one used to sign Windows binaries and expires
on 2023-11-19 with a timestamp valid until 2031-01-06.
* Fix wrong path to the id command in the Shell Script. That was mainly causing
an issue when using RUN_AS_USER on Solaris. The srcmstr daemon must be
reinstalled after upgrading the Wrapper.
* (Standard) Fix a problem where no hostIds were listed when using NIC teaming
on Windows Server.
* Normalize paths used in the Unix Shell Script. Non-normalized paths were
causing certain systemd commands to fail.
* Fix exit code not being set to an error (value of wrapper.exit_code.error)
when the JVM is being killed because it is unresponsive while stopping.
* Fix GUI of the Demo application not being scaled correctly with Java 9+ on
Windows. If you were using WrapperManager.nativeGetDpiScale(), you may need
to precede its call with WrapperManager.nativeGetDpiAwareness() to retrieve
the dpi awareness of the process, and WrapperManager.nativeSetDpiAwareness()
to set it to a different value.
* On Windows, automatically switch to monitoring the Java process when it is
redirected from the process launched by the Wrapper. Use
wrapper.java.monitor=LAUNCHED to restore the previous behavior and monitor
the launched process instead.
* Add wrapper.java.monitor.redirect.loglevel to control the log level of
messages printed if a redirection of the java process is detected and when
the monitored process changes.
* Fix the log level of some property warnings. Use the value of
wrapper.property_warning.loglevel.
* Fix an issue where the Wrapper could crash when trying to format a message.
This was observed when the JVM returned a negative exit code.
* (Professional) Fix 'wrapper -h' returning "No valid HostId(s)" on z/OS.
* Improved German translations.
3.5.45
* Fix a problem where Windows binaries were not being signed correctly in the
3.5.44 release. Added additional checks.
* Fix a parsing error causing the Wrapper to hang on startup if the file
'etcetera' (part of the IANA tz database) was present at the location
specified by wrapper.timezone.folder. Removing this file would solve the
issue.
* Add support for encodings added in Java 11 (ISO-8859-16, x-Big5-HKSCS-2001,
x-IBM1129, x-IBM1166, x-IBM1364, x-IBM833, x-MS932_0213, x-MS950-HKSCS-XP).
* Fix a problem where the Wrapper would fail to start if the shell script was
on a path which contained multiple consecutive spaces. (Bug #311)
* When building tests (Community Edition), check the presence of a Javascript
engine instead of assuming its availability based on the Java version. If no
built-in engine is found, an external engine can be specified by setting the
'external.js.engine.dir' property when calling Ant. (Bug #313)
* Add a new _WRAPPER_TIMEOUT setting in the Windows batch scripts which makes
it possible to control the maximum number of seconds to pause on exit when
there is a problem. (Feature #136)
* Make it possible to build the Community Edition with Java 10+ by
automatically using 'javac -h' instead of 'javah'. (Bug #312)
* Use the value of javac.target.version in default.properties (Ant file) as the
minimum version of Java supported by the Wrapper instead of a hard-coded
value (useful when compiling the Community Edition).
* No longer show a warning when Java is launched via a script. Instead the
Wrapper will check that the Java PID is as expected to confirm that Java has
been launched correctly.
* Fix a problem where the Wrapper would show an error on startup if the stdin
pipe was not tied to a console window. This can happen when called within
other programs. Since 3.5.43.
* Modify the DemoApp so its internal Wrapper instance no longer logs to the
main wrapper.log file as that was causing confusion. Fix an NPE in the
DemoApp if the Wrapper was shutdown external to the DemoApp dialog.
* Fix a log rolling issue if the current log file was manually deleted or if it
did not exist because the logging was temporarily turned off. The WRAPPER,
JVM, SIZE_OR_WRAPPER, SIZE_OR_JVM modes were still rolling the old files and
the most recent one ended up having a roll number of "2". Now the rolling
occurs only when a log file without roll number exists.
* Fix an issue where some early messages were logged before the log file was
being rolled on startup.
* Fix duplicate messages generated while loading the configuration: when the
path to the configuration file or the working directory can't be resolved,
when the Wrapper is elevated to control a Windows Service, or in some cases
when properties are not set correctly.
* Use the configured log file, if possible, when an invalid command line
property is found or when the Wrapper fails to load resource properties (not
final). Before a default log file was created in the working directory.
* Fix the log level of some property warnings (wrapper.*.group,
wrapper.*.action, wrapper.event..email.attach_log). Use the value
of wrapper.property_warning.loglevel.
* Fix an issue where the pid file was wrongly detected as stale and removed by
the Shell Script on some Linux systems. This was happening when the path to
the working directory exceeded a certain amount of characters.
* Make it possible to query permissions of a service with WrapperW. The output
will be displayed in the dialog window.
* Print the path of the log file when the Wrapper is launched from the Shell
Script and fails to start.
* Make sure the console output is completely disabled when running as a
background process on UNIX systems. Previously certain messages generated
right after startup or while loading the configuration were printed before
the output was being disabled.
* Fix a bug when the Java version output contained '%' characters. In normal
situations this should not happen, but there might be such issue when
wrapper.java.command is not set correctly.
* Print the output of the command used to request the Java version at the INFO
level if it fails.
* Disable filters for Java version output as they should only apply to the JVM
output printed by the Java application.
* Fix wrapper.java.command.resolve being ignored when querying the Java
version (Unix). This is critical because it could cause the Wrapper to stop.
Since 3.5.44.
* Fix issue on UNIX platforms where jdb was not being detected if used directly
in the value of wrapper.java.command. See wrapper.java.detect_debug_jvm.
* When jdb or javaw are used as the Java command, their output can't be used to
parse information such as the Java version or vendor. The Wrapper now tries
to find the 'java' command in the same directory (or simply 'java' if the
command has to be resolved using the system PATH), and uses it to query
information.
* Fix several messages in the script that were not translated because of single
and double quotes not being escaped correctly. Some also had syntax errors.
* The z/Linux distributions are now built on a IBM z14 machine with RedHat
Linux 7.8.
3.5.44
* Add a log message when a wildcard classpath, defined with a
wrapper.java.classpath. property, does not match any files. The log level
is controlled with the wrapper.java.classpath.missing.loglevel property.
* Add a new wrapper.java.pid.loglevel property which makes it possible to
control when the PID of a newly launched JVM is logged.
* Modify the way the -q, -qs and -qp arguments work to query the status or
permissions of a Windows Service. The configuration file is now required.
This change is not compatible with the implementation in 3.5.43.
* Update the LSB Init Block in the default shell script so it works more
smoothly with older Linux systems using update-rc.d.
* Improve logging when the value of wrapper.java.command is not a Java binary.
* Add property wrapper.ntservice.account.logon_as_service to control whether or
not the Wrapper should add the 'Log on as a service' privilege to the
configured account during installation of the Windows Service.
* Fix issue where the authentication attempt performed during installation of a
Windows Service would fail if the configured wrapper.ntservice.account did
not have the 'Log on as a service' privilege. Since 3.5.42.
* Fix a problem where special service accounts (LocalService, NetworkService
and LocalSystem) could not be used by wrapper.ntservice.account when
installing a service. Since 3.5.42.
* Fix a timing problem where the Wrapper would sometimes claim that the JVM
exited unexpectedly if the JVM requested a stop while starting.
* Sign the binaries in the macosx tar.gz distributions as well as in the
delta pack distributions.
* Add a new signed and notarized package distribution for macosx.
* Stop providing new releases for Windows and Linux Itanium. The Itanium
architecture is discontinued and no usage have been reported recently. Please
contact us if there is a need for these platforms.
* Build the z/OS distribution on z/OS 2.4. Previously z/OS 1.8 was used.
3.5.43
* Rename sh.script.in to App.sh.in in the src/bin directory.
* Create 'App.shconf.in' in the src/bin directory. This template contains a
copy of all settings of the Shell Script. It is recommended to customize this
file rather than the Shell Script to simplify Wrapper upgrades.
* Improve customization of the Wrapper binaries to limit failures when the
target executable is temporarily locked by an external process (often an
antivirus).
* Fix misleading error messages during customization of the Wrapper binaries.
* Fix bug where calls to WrapperManager.signalStarting() were overriding the
disabling of wrapper.startup.timeout (when its value is set to 0). This was
also happening with WrapperManager.signalStopping() and
wrapper.sthutdown.timeout=0.
* Add new '--conf-optional' option to be used when customizing the Wrapper. It
allows the target executable to run without configuration file if the
configuration has been embedded as a binary resource. Without this option,
the configuration file will be required. Previously, Wrapper with embedded
configuration were allowed to continue without configuration file, but could
potentially fail at a later stage.
* Improve logging when the configuration file fails to load, and make sure the
Wrapper always stops if a file was specified but could not be found.
* Add the ability to query the status of a service by specifying its name
instead of the configuration file (e.g. 'wrapper -q=testwrapper',
'wrapper -qs=testwrapper').
* Add new property wrapper.console.quickedit to enable or disable the QuickEdit
Mode of the console attached to the Wrapper process. The default value will
disable the QuickEdit Mode as it can cause the Java application to freeze.
* Fix a problem running the Demo Application with the delta pack.
* Add a new WrapperManager.generateDetailedNativeBaseName(baseName) method
which lets user code generate a base file name based on the current platform.
* Fix a crash that happened when the Wrapper was handling control signals
during its shutdown process. It had no serious implications because the
Wrapper was almost stopped and already disposed, but on Windows it caused to
generate an empty dump file in the working directory.
* Fix a problem where WrapperManager.stop() failed if the native library was
not loaded successfully.
* Fix misleading debug messages describing the JVM and Wrapper exit codes.
* Raise to STATUS the log level of notifications about the JVM exit whenever
it ends with an exit code resulting of a crash on Windows.
* Fix 'demoapp' script file not being executable in the bin folder (UNIX).
* Fix some malformed/corrupted messages in German.
* Fix cases where the JVM was detected as 64-bits on 32-bit systems (for debug
only).
* Fix dialog window not showing if an error occurred while controlling a
Windows Service with WrapperW.
3.5.42
* Add the ability to query and edit permissions granted to users or groups on
Windows Services. With appropriate permissions, the Wrapper can control a
service without prompting the user for Administrator credentials.
* Fix Wrapper not waiting for Network Interfaces when using license keys
prefixed with HostIds (wrapper.wait_for_hostid=TRUE was ignored).
* Fix an issue where Wrapper instances used to control the Wrapper as a Windows
Service were writing the output in wide characters (UTF-16). When the Wrapper
output was piped, the console was reading the pipe output in its code page,
thus causing a bad character translation.
* Fix output issues when the Wrapper is elevated to control a Windows Service:
- if wrapper.console.direct is set to TRUE (default), force using only stdout
to preserve the output order.
- if wrapper.console.direct is set to FALSE, handle stdout and stderr
separately (previously everything was redirected to stdout).
- no longer block when messages are too large.
* No longer prompt for information required to install a Windows Service if the
service already exists.
* Check that the account and password provided are correct during the
installation of a Windows Service, rather than on startup. Also, check that
the account has the service privilege enabled.
* Handle the Windows Service password more securely and load it in memory only
when required.
* Add new properties wrapper.monitor_exit and wrapper.java.monitor_exit, which
are used by the --setup (-su) command on Windows to allow the Event Log to
monitor the Wrapper or Java processes whenever they exit. This is useful to
diagnose cases where the Wrapper or Java are being killed by another process.
* Change the way HostIds are generated on Windows and allow HostIds tied to
wireless network interfaces.
* No longer automatically stop a Windows Service prior to updating it. If the
service is running while the user attempts to update it, the command will
fail.
* Change the default value of wrapper.java.version.timeout to 30 seconds
(previously it was 10 seconds).
* Fix cases where the Java version was not resolved to its default value if it
couldn't be retrieved from the JVM output (for example when
wrapper.java.version.timeout elapsed). This was causing the Wrapper to stop.
* Add a debug message logged whenever stdout or stderr are reassigned by the
Java application. This helps understand cases where the standard streams are
no longer forwarded to the Wrapper output.
* Fix a problem where the code of the Shell Script resolving the status of a
daemon was checking the presence of some commands which were actually not
used. This was causing an incorrect status reported when the PATH environment
variable did not contain the location of the commands.
* Improve the way a daemon is installed and removed using the tools available
on the different Linux distributions.
* Remove support for Linux PPC-BE. This architecture is discontinued for lack
of usage.
3.5.41
* Fix java.lang.IllegalArgumentException occuring when printing the usage of
the WrapperSimpleApp, WrapperJarApp, WrapperStartStopApp integration methods.
* Ignore wrapper.java.additional.auto_bits and
wrapper.java.additional.auto_bits. for Java 9 and above. This means
that the "-d32" or "-d64" options will no longer be added to the Java command
line. These options were deprecated in Java 9 and their usage started to
cause a fatal exception after being removed in Java 10.
* Add new environment variable 'WRAPPER_RUN_MODE', which is set to 'console'
when running as a console, or 'service' when running as a Windows Service /
Unix Daemon.
* Add new environment variable 'WRAPPER_BASE_NAME', which is set to the binary
name without the extension, and without the OS, architecture and bits (if
included in the name).
* Change the name of default configuration file to be the value of
'WRAPPER_BASE_NAME' suffixed with '.conf'. This means that the default
configuration file when using the delta pack will no longer include the OS,
architecture and bits.
* No longer require for a network interface to be active for its HostId to be
used by the Wrapper.
* Fix delay on startup which may occur when the IP address of the machine is
resolved via DNS that is not configured correctly (Unix).
* Fix a bug where the Wrapper failed to parse the version of Java and stopped
when wrapper.javaio.use_thread was set true. Since 3.5.35.
* Fix a bug where the Java version failed to be parsed on certain JVM
implementations (observed on Raspbian with openjdk 9+).
* Fix an issue where threads were not safely used on HPUX (Itanium and PA-RISC),
and inside libwrapper.so (Linux and FreeBSD). For instance, this was causing
repeated log errors when the Java IO thread (wrapper.javaio.use_thread=TRUE)
was reading no byte from the pipe.
* Fix rare cases where the WrapperW log dialog was displayed without message
or with garbled characters.
* Add output in the log for a crash dump to make it clear if the Wrapper binary
had been customized.
* Modify the debug message when a language resource fails to be loaded.
* Fix a crash on Windows when wrapper.lang.windows.encoding was set and the JVM
output contained certain C formatting sequences like '%s'. Since 3.5.35.
* Improve detection of Linux distributions in the Shell Script and fix Amazon
Linux not being recognized.
* Fix a crash when the Wrapper prompts the user for a password during the
installation of a Windows Service. Since 3.5.33.
* Fix an issue where non-ASCII characters were not read correctly in the
password input by the user during the installation of a Windows Service.
* Deprecate wrapper.max_hostid_timeout in favour of
wrapper.wait_for_hostid.timeout, and change the default value to 15 which is
the maximum number of seconds that the Wrapper should wait for Network
Interfaces to come up. Previously the default value was 0 to wait
indefinitely.
* Add new property wrapper.wait_for_hostid.strict to force waiting for a
specific hostId up to the value of wrapper.wait_for_hostid.timeout. The
default value if FALSE which tells the wrapper to stop waiting once at least
one network interface is found.
* Always flush each log output to the log file on startup until the Wrapper
enters its cycle to monitor the application.
3.5.40
* Fix a segmentation fault on UNIX systems when the user of the Wrapper process
is not part of the group specified by a wrapper.*.group property.
* Add Full RELRO to all Linux Wrapper binaries (except zLinux and Linux ia64).
RELRO is a security measure which protects against types of GOT-overwrite
memory corruption attacks.
* Enhance security with FORTIFY_SOURCE level 2 (buffer overflows detection) for
Linux (except zLinux, Linux x86 32-bit and Linux ia64) and MacOSX.
* Prevent parallel installations of the Wrapper as a daemon using different
service management tools.
* Fix wrong status reported when the daemon was installed with systemd and the
SERVICE_MANAGEMENT_TOOL variable was changed to a different system. This was
changing the behavior when installing, removing, or printing the status of a
daemon. Wrong usage or false positive on checking script arguments were also
observed.
* Fix potential memory corruption when printing the certificate information on
Windows.
* Add the ability to suspend & resume timeouts while the JVM is running. These
two actions can be triggered by filters, timers, on a deadlock check, on a
ping timeout, using the command file, or from the Java code by using the new
WrapperManager.suspendTimeouts() and WrapperManager.resumeTimeouts() methods.
This gives a way to tell the Wrapper not to worry about the JVM being
unresponsive while the Java application is performing a long blocking task.
* Improve the command file by trimming trailing spaces before processing the
command. Trailing spaces caused to interpret the last argument of some
commands as empty instead of NULL.
* Fix a rounding issue causing the timeouts of the JVM states to be slightly
inaccurate (less than one second).
* Fix sh-incompatible syntax issues in the shell script introduced in version
3.5.38, and version 3.5.36 when RUN_AS_USER is set.
3.5.39
* Add the ability to set the wrapper.*.group properties with a group id.
* Improve logging messages when wrapper.*.group properties are set to invalid
values.
* Fix an issue where WRAPPER_JAVA_VERSION, WRAPPER_JAVA_VERSION_MAJOR,
WRAPPER_JAVA_VERSION_MINOR, WRAPPER_JAVA_VERSION_REVISION were not set if the
Java version failed to be parsed and was resolved to the value of
wrapper.java.version.fallback or the minimum supported version.
* Fix an issue introduced in 3.5.38 where a daemon installed with systemd would
fail to start and stop on a system boot or when using systemctl.
3.5.38
* Add support for 64-bit ARMHF platforms (aarch64). Built on SUSE Linux
Enterprise Server 12 SP4 (glibc 2.22).
* Fix a problem where the Wrapper, running as a console application, and the
JVM were not cleanly shutdown on Windows Vista, Server2008 and above when the
user logged off.
* Add new property wrapper.user_logoffs.message to change the message displayed
by Windows when the Wrapper is stopping and blocking a user log off.
* Fix a problem on UNIX where the Wrapper could hang trying to read from the
output pipe of a JVM if the fork to launch the JVM process failed. This was
happenning when the maximum number of processes available for the user
(ulimit -u) was hit perfectly.
* No longer show debug output "active log file changed" when the configuration
is loaded.
* Fix misleading messages when setting wrapper.lang to an unknown locale name.
* Stop printing warnings about missing mo files. Only show messages if there
was an error while loading a language file that exists but is invalid.
* Fix a bug where the Wrapper considered that the wrapperw process had an
attached console. This was causing several small issues: performance decay
in case of intensive logging, irrelevant warning about QuickEdit mode being
enabled, and inability to use certain locales when the OEM encoding, usually
used for consoles, was not compatible.
* Improve the error message logged when all of the ports in the configured port
range are already in use.
* Fix a crash in WrapperManager.nativeGetPortStatus() caused by an unhandled
return code while checking on the status of the port to be used by the JVM to
connect to the Wrapper (Windows only). This problem was introduced in version
3.5.27, but has only been seen once. The crash is only possible immediately
after the JVM is launched. It can also be worked around by using a pipe rather
than a socket with the wrapper.backend.type property.
* Add new set of properties wrapper.group and wrapper.*.group to change the
group of several files created by the Wrapper on Unix systems.
* Fix a bug introduced in 3.5.37 where Shell Script invocations during the
Wrapper execution were deleting the PID file set in the configuration file.
The status command, especially, was not only deleting the PID file, but then
also returned a wrong status assuming the Wrapper process was gone.
* Fix a bug where the Java version failed to be parsed on HPUX Itanium. The
suffix "-hp-ux" being attached to the version was causing the failure.
* Add new property wrapper.java.version.fallback which will be used in case the
Wrapper fails to parse the output of 'java -version'. If this property is not
set, the Java version will be resolved to the lowest supported version, but
the Wrapper will stop when certain properties requiring the Java version are
used.
* No longer stop the Wrapper when failing to write the lockfile on Windows, and
allow it to be written by Windows Services. These changes were made to match
with the behavior on Unix. The lockfile is not used by the Windows system,
but is made available for external applications that would make use of it.
* Add 'WRAPPER_PERCENTAGE' to represent '%' characters in the values of
configuration properties. Usage of this variable solves a syntactic ambiguity
arising when two or more % characters are used, causing the content in
between to be interpreted as an environment variable.
* Fix '.shconf' file not being loaded when the Shell Script has a '.sh'
extension.
* Fix a crash when installing the Wrapper as a Windows Service, happening if
the binaries contained embedded configuration and '-' was used in place of
the configuration file in the command line used to launch the Wrapper.
* Fix an issue where wrapper.console.flush and wrapper.internal.namedpipe were
copied to the command line of the Windows Service when the Wrapper was first
launched for installation without Administrator privileges. This would affect
performance of interactive services if a console was attached and visible.
* Fix FIXED_COMMAND being ignored when set in the .shconf file.
* Add value 'both' for the PASS_THROUGH variable of the Shell Script & Windows
Batch files to allow both passing script arguments as Wrapper properties and
application parameters. See the description in the scripts for usage.
* Restrict usage of arguments passed to the Shell Script & Windows Batch files,
for only the commands that make use of them, and when PASS_THROUGH is not
disabled. On Windows, commands that can be used with arguments are 'console',
'install', 'installstart' and 'update'. On UNIX, only the 'console' command
and, if not installed as a UNIX Daemon, the 'start', 'restart', 'condrestart'
commands. Unlike on Windows, arguments are not stored when installing a UNIX
Daemon, so this restriction was added to avoid cases where the script can be
manually called with arguments, and automatically launched without arguments
on a system boot.
* Several small corrections in the Shell Script & Windows Batch files,
including improved warnings and error messages, and a better help shown in
case of a wrong command input.
* Add a 'README.txt' file in the bin folder on the Windows releases to explain
about the popup "Windows protected your PC" that might show up when executing
the batch files. In production, this readme file can be removed.
3.5.37
* Load the wrapper.ntservice.preshutdown.timeout property during the
installation of a Windows service and no longer when starting the service.
The preshutdown timeout value is stored in the service configuration, which
can only be changed by a user with sufficient permissions, and not all users
who start Windows Services have these permissions.
* Make it possible to use system locales with an encoding notation that is not
directly supported by iconv, if the canonical alias for that encoding is
supported.
* Fix a memory corruption happening when the configured locale encoding is not
supported by iconv.
* No longer show a warning when the configured locale matches a system locale
with a default encoding.
* Fix a locale issue when launching the Wrapper with RUN_AS_USER set in the
Unix shell script. Depending on the OS and how the Wrapper is launched,
either the 'runuser' or 'su' commands can be used, but until now, only 'su'
was using the system locale for the forked process. Now, the system locale is
explicitly passed to the forked process when using runuser to ensure the same
behavior with both commands.
* Fix the initial value of the time passed since the last JVM output (displayed
with the 'R' column of the log format), which was '99999999' when launching
the JVM instance used to get the Java version. It now displays the time since
the JVM has started.
* Fix heading and tailing tab characters not being trimmed when parsing the
lines of the configuration file and timezone file. This was causing
properties and directives preceded by a tab to be ignored.
* Fix a problem where the configuration file could not be read if it contained
characters that were not supported by the encoding of the context in which
the Wrapper was launched. It is now possible to change the encoding by using
wrapper.lang..encoding and thus give the Wrapper a second chance
to read the configuration file and convert it in the correct encoding.
* Fix a problem where include configuration files containing corrupted
characters were skipped instead of causing a fatal error.
* Add new environment variable: WRAPPER_JAVA_VENDOR. This variable is set after
the configuration is loaded, when parsing the 'java -version' output.
* Improve handling of the customize command line and logging of errors in case
it is malformatted.
* Make it possible to skip the configuration file by specifying '-' in the
command line used to launch the Wrapper if the binary has been customized to
embed the configuration. This allows the user to append command lines
properties after the '-' and override the default configuration.
* Add the ability to register a native exception handler in Windows versions of
the Java process by passing the -Dwrapper.register_native_handler=TRUE system
property to the JVM. This can be useful in tracking down the cause of a JVM
crash.
* Add new raiseExceptionNative() and raiseFailFastExceptionNative() methods in
the WrapperManager class which can be useful in testing JVM crash recovery.
* Make it possible to combine log rolling by date with any other existing modes
(SIZE, WRAPPER, JVM, SIZE_OR_WRAPPER, SIZE_OR_JVM).
* Change the default value of wrapper.logfile.purge.sort to 'NAME_SMART' for
all rolling modes. Before the default value was 'TIMES' except when rolling
by date. 'NAME_SMART' will purge the log files sorting them using the dates
and indexes included in their names. With this mode, the files will always be
purged in the correct order without being affected by manual edits which
cause their last modified dates to be changed.
* Add a warning on startup when the Wrapper is running in a console with
QuickEdit mode enabled (Windows), and a property
wrapper.console.quickedit.loglevel to control its log level. The QuickEdit
make it easier to select text in the console, but should be used with caution
as selecting text will freeze the Wrapper and block the Java application.
* When running the delta pack on a 64-bit OS, the script launching the Wrapper
will first send a request to resolve whether the license is 32-bit or 64-bit,
then launch the appropriate Wrapper binaries. Before the binaries matching
the OS bits was used.
* Add an optional source file which can contain the customized configuration of
the UNIX shell script. This file will be executed after setting the variables
on the top of the script, giving the user a chance to override any of them.
The file must have the same basename as the script and suffixed with a
'.shconf' extension. This should allow the user to keep the shell script in
its original state, and make it easier to upgrade it.
* Set the default values of the APP_NAME and APP_LONG_NAME variables in the
UNIX shell script. APP_NAME will default to the name of the shell script,
and then APP_LONG_NAME will default to the value of APP_NAME.
* Add a property wrapper.forced_shutdown.delay to control the minimum amount of
time required between two CTRL-C or TERM signals to initiate a forced
shutdown. The default value is 2 (200ms) to prevent double signals from
forcibly shutting down the application.
3.5.36
* Add new properties wrapper.java.additional..java_version.min and
wrapper.java.additional..java_version.max to allow passing different
options to the JVM depending on the Java version.
* Allow WRAPPER_JAVA_HOME to be updated on each JVM restart. This variable is
set when the Java command is located using the Windows registry and cleared
when using wrapper.java.command. Previously, this variable was final, meaning
that once it was set it could not be changed, causing potential mismatch with
the location of the Java command being used.
* Ensure that a variable cannot be set by the user if it is also used by the
Wrapper internally. Before, this was only done for certain variables but not
those set after the configuration is loaded (such as the WRAPPER_EVENT_* and
the WRAPPER_JAVA_HOME variables). For any conflict, a warning message will be
logged and the value set by the user will be ignored.
* Add new environment variables: WRAPPER_JAVA_VERSION,
WRAPPER_JAVA_VERSION_MAJOR, WRAPPER_JAVA_VERSION_MINOR and
WRAPPER_JAVA_VERSION_REVISION. These variables are set after the
configuration is loaded, when parsing the 'java -version' output.
* Add new environment variables WRAPPER_VERSION and WRAPPER_EDITION.
* Deprecate wrapper.environment.dump in favor of
wrapper.environment.dump.loglevel and generate a new dump each time the
configuration is reloaded if wrapper.restart.reload_configuration is set to
TRUE.
* Add new properties wrapper.java.additional_file.required and
wrapper.app.parameter_file.required.
* Allow the Wrapper to be launched without specifying a configuration file if
the binaries have been customized with embedded properties.
* Fix insufficient buffer size causing the Wrapper to crash when printing large
messages in UTF-8 on Windows.
* Change the default value of the #properties.on_overwrite.loglevel directive
to 'AUTO' which is resolved to:
- 'WARN':
- When a property is overridden within the same configuration file or in a
file with a lower include depth than the file of the previous
definition;
- When a final property embedded during customization is overridden.
- 'DEBUG': in all other cases.
* Fix an issue where the Wrapper ignored systems properties surrounded by
double quotes and referenced in the wrapper.java.additional. properties
(Windows only). Instead of giving priority to the properties of the
configuration file, the Wrapper was creating duplicates in the Java command
line when using the same system properties internally.
* Fix an issue where environment variables were expanded too early while
embedding configuration properties into the Wrapper binaries. Now they are
left untouched and expanded at runtime. During customization, the properties
and variable definitions will be stored as a binary resource in the original
order of the configuration file to ensure that variables will be expanded
with the same rules as when loading from the file.
* Fix a bug where the Wrapper failed to parse the Java version if some system
messages were inserted before the JVM output.
* Fix a bug causing the Wrapper to sometimes freeze or crash when launching a
child process on UNIX systems other than Linux (observed on AIX).
* Enable the wrapper.console.title property to be reloaded when
wrapper.restart.reload_configuration is set to TRUE.
* Use the '-K PIC' option instead of '-K pic' when compiling the Wrapper 64-bit
binaries (but not for the native library) on Solaris SPARC. This was required
as the size of the binaries increased, but should not affect the Wrapper
behavior.
* Add a new property wrapper.registry.java_version, which makes it possible to
target a specific version of Java when locating the command using the Windows
registry. If this property is not set, the Wrapper will use the
CurrentVersion string of the registry. Note that Java 9 and above use a
different location in the Windows registry, so by default the Wrapper will
first search in this new location to prefer recent JVMs.
* Fix a bug where a daemon installed with systemd would fail to start if the
path to the shell script contained spaces.
* Fix corrupted messages logged by the native library if the system encoding
and the JVM encoding were different. This was most noticeable when using
localization on Windows (on UNIX systems, this would only occur if
'file.encoding' was manually added to the JVM options).
* Add a check to make sure that the UNIX shell script can be accessed using an
absolute path. If not, the permissions to each intermediate folder will be
listed and the script will stop.
* Other small fixes, performance improvements and corrected log messages.
3.5.35
* Fix a bug where the icon of the hidden console allocated by wrapperw
reappeared in the taskbar whenever the Java application opened a full screen
window. If this would occur the icon will be quickly hidden, but a flicker
may be observed on the taskbar as the icon will still briefly show up.
* Fix a bug introduced in 3.5.31 where setting wrapper.logfile to a blank value
was not disabling file logging. Instead the Wrapper was showing a warning and
fell back using the default log file in the working directory. This version
restores the ability to disable file logging with a blank value.
* Handle the backend communication (via pipe or socket) from the native Wrapper
to the JVM in UTF-8. Before, the encoding of the current locale was used, but
some encodings could not support all characters when the Java side of the
Wrapper was reading the configuration.
* Fix string conversion issues on the native library happening when the JVM was
using a default encoding that did not match the system encoding. This
resulted in unreadable JVM outputs.
* Add the ability to parse any encoding specified in the JVM arguments (via
file.encoding, sun.stdout.encoding or sun.stderr.encoding) and read the JVM
output using the same encoding.
* Deprecate wrapper.lang.encoding in favor of wrapper.lang.unix.encoding and
add wrapper.lang..encoding to specify an encoding per platform.
While Unix systems often use the same syntax for encodings, Windows uses code
pages instead of names. The new created set of properties helps setting the
encoding used by the Wrapper in a cross-platform way. The specified value
will be both used to encode the JVM output and the Wrapper log output.
* Improve portability of wrapper.lang.unix.encoding. If its value doesn't match
any encoding of the locales installed on the system, the Wrapper will search
for a match with a different notation of the same encoding (without case
sensitivity, dashes, etc.).
* Add wrapper.jvm.encoding to control the default encoding of the JVM. Usage of
this property requires Java 8 and above, and should be limited to cases where
the encoding of the JVM has to be different from the Wrapper output encoding.
Otherwise wrapper.lang.[windows|unix].encoding is preferred.
* Improve the way the encoding is passed to the JVM on the different platforms:
- On Windows, since version 3.5.8 (Professional and Standard Editions),
file.encoding was added to the JVM arguments to ensure that the Wrapper
always reads the JVM output using a suitable encoding for its own language
regardless of the OS language. However it forced the Java application to
use an encoding that may not be appropriate. From now on, the encoding is
passed to the JVM only if wrapper.lang.windows.encoding or
wrapper.jvm.encoding are set, or if the version of Java is older than 7
(recent versions of Java have their default encoding set to the default
ANSI Windows code page, like the Wrapper, but that was not always the case
on older versions of Java).
- On MacOSX, JVMs older than version 7 have their default encoding set to
"MacRoman" regardless the current locale. This caused some encoding issues
because the Wrapper uses the encoding of the locale to read the JVM output.
To correctly read the output of those JVMs, the Wrapper sets file.encoding
to the locale encoding (unless it is already present among the JVM
arguments).
- On all other UNIX platforms, the JVM encoding is automatically resolved
from the current locale, so it is only added to the JVM arguments if
wrapper.jvm.encoding specifies a different value.
* On Windows, user.language and user.country will be set and passed to the JVM
whenever wrapper.lang differs from the language and country of the UI.
Previously only user.language was passed.
* Make it possible to use wrapper.lang.folder, wrapper.lang.domain,
wrapper.lang.window.encoding and wrapper.lang.unix.encoding without setting
wrapper.lang. This can be useful if any of this configuration needs to be
changed while still using the default language of the OS. On Windows, if
wrapper.lang is set to 'DESKTOP' or 'DEFAULT', the encoding must be set to
'ANSI', 'OEM' or 'UTF-8' to ensure a correct encoding through the different
platforms.
* Fix garbled messages when exceptions are raised from the native library on
UNIX.
* Fix an issue where the Wrapper failed to load a language pack (*.mo) other
than those provided by default (German and Japanese).
* Fix wrong exit code (0) returned in case the Wrapper would fail to launch a
JVM.
* Allow wrapper.exit_code.error to be used at an earlier stage if the Wrapper
has to stop while loading the configuration (for example when duplicate
properties are found with #properties.on_overwrite.exit being set to TRUE).
* Allow the CPU affinity of the Wrapper process to be changed when the
configuration is reloaded.
* Add wrapper.java.version.min and wrapper.java.version.max to control the
versions of Java for which the Wrapper is allowed to run. Out of the
specified range, the Wrapper will stop.
* Fix wrapper.console.title being ignored with wrapperw.exe and
wrapper.ntservice.console set to TRUE.
* Add four customization options (properties-default, property-file-default,
properties-final, property-file-final) to include configuration properties
into the Wrapper binaries (Windows). The properties specified with the
'default' options can be overridden from the configuration file or the
command line, whereas those specified with the 'final' options are marked as
final and cannot be overridden.
* Add a new property, wrapper.properties.dump.format, to print various kinds of
information when dumping configuration properties. Note that the default
formatting changes from 'NAME=VALUE' to 'SOURCE | FINAL | NAME | VALUE'.
* Add a new property wrapper.test.no_jvm. By setting it to TRUE, the Wrapper
will run until it is about to launch a JVM and then will shutdown. This can
be useful to test a configuration, confirm the license status, check
properties or environment variables dumps, etc. without starting the Java
application.
* If wrapper.timezone is set, -Duser.timezone will be added to the Java command
line to synchronize the time between the Java application and the Wrapper. It
is possible to pass a different timezone using one of the
wrapper.java.additional. properties, in which case the Wrapper will not
add its own timezone to the Java command line.
* Improve Linux distribution detection in the shell script by checking that
update-rc.d is present on the system before installing the daemon. This
corrects an installation failure on Amazon Linux AMI.
* No longer use IBM Advanced Toolchain when building the Wrapper for Linux
PPC-LE. Advanced Toolchain was introduced in v. 3.5.34, but since then some
users reported that the Wrapper binaries could not be executed on their
machine.
* Fix a bug happening on Red Hat Enterprise Linux, CentOS, Amazon Linux AMI and
Fedora, where the logfile was not rolling if the ROLLNUM token was used
inside the value of wrapper.logfile.
* Always make sure to process queued log messages before the Wrapper exits on
UNIX platforms (previously this was only done on Windows).
3.5.34
* Fix a memory access violation when the Wrapper uses localization files.
* Fix minor memory leaks (after validating the certificate and when launching
child processes).
* Improve logging when establishing connection to an SMTP server and when
sending emails.
* Dual sign the Wrapper binaries with SHA-1 and SHA-2 hash algorithms and
timestamping to allow stronger verification at the OS level while keeping
compatibility with older versions of Windows that don't support SHA-2.
* Add parameter "--silent" to never show the log dialog when customizing
wrapperw.exe.
* Return an exit code of 1 whenever the customization of wrapper.exe failed.
Previous versions were always returning 0.
* Improve the detection of the location of several commands used by the shell
script when performing actions like detecting the service management tool.
* Remove the ID_BIN variable defined on the top of the script file, as it was
ignored on most platforms. The location of the id command is now
automatically resolved.
* Fix methods of the shell script to restart a daemon installed with launchd
or upstart. They behaved like 'condrestart', which means they exited with an
error code of 1 if the service was not running.
* Fix the condrestart command of the shell script to use built-in restart
methods of upstart, systemd, launchd and src, instead of performing a stop
followed by a start.
* Improve messages when starting/stopping/restarting the Wrapper daemon with
the different service management tools available on Unix systems.
* Fix errors when querying the status of a service on AIX without being root.
* Add a new property, SYSTEMD_KILLMODE, in the shell script to control how
systemd should kill the Wrapper child processes on shutdown. When using the
Professional edition, it may be useful to set this property to 'process'.
This will prevent systemd from killing detached child processes that should
normally be left running on shutdown.
* Many improvements in the Japanese and German translations.
3.5.33
* Fix a false positive when detecting Upstart on Linux.
* Fix a bug where it was required to register the Wrapper to the Event Log on
Windows in order to send messages to a remote syslog server via UDP.
* Fix a memory leak when sending messages to a remote syslog server. Since
3.5.27.
* Fix wrong exit code when the Wrapper was configured to shutdown on a ping
timeout. The exit code was always 1 whereas it should be the value of the
wrapper.exit_code.error property.
* Check that the configured service management tool is available before
installing a daemon on Linux and return an exit code of 1 whenever the
installation fails.
* Add new properties wrapper.ulimit.data.{soft|hard} to limit the size of the
data segment of any process started by the Wrapper. It is similar to running
the command "ulimit -d X" in a terminal.
* Improve the processing of the command file by ignoring blank lines and any
spaces before the command.
* Correct invalid exit code that may be written in the command file along with
a STOP command. If the exit code is out of the range 0-255, it will be
resolved to the value of the wrapper.exit_code.error property.
* Improve messages when the Wrapper is paused or resumed.
* Fix a bug where, on certain UNIX platforms, the locale was not correctly set
from the environment at startup.
* Fix a bug on FreeBSD where conversions of JVM outputs to a different encoding
(specified with wrapper.lang.encoding) systematically failed because the
iconv library was not loaded by the native library.
* On FreeBSD, it has been observed that certain versions of iconv fail to
convert some characters like backslashes when the SJIS encoding is specified.
In such case the Wrapper will consider SJIS as unsupported and fall back
using the encoding of the console which launched the Wrapper.
* Fix garbled question marks that appeared in messages logged while performing
actions (install, start, pause, etc.) on a Windows service when the Wrapper
language was different than the system language.
* On Windows, instead of printing system errors in the language of the UI, the
Wrapper will now first try to use the language specified in the configuration
(English for the community edition).
* Enhance security by adding a linker option to enable ASLR (Address Space
Layout Randomization) on Windows Vista and above (Windows Itanium not
supported), and by attempting to enable DEP (Data Execution Prevention) right
after the Wrapper is launched (Windows XP SP3 and above). DEP enforcement
will only affect 32-bit versions as Windows automatically enables DEP for
64-bit binaries.
* Fix double thread dump issue when pressing CTRL-\ while the Wrapper is
running as a console on Linux. The problem remains on other UNIX platforms.
* Fix a problem where backslashes in the path of the log file, configured with
the wrapper.logfile property, were not being handled correctly resulting in
the Wrapper being unable to create the log file (Unix only).
3.5.32
* Fix a bug introduced in 3.5.31 where the Wrapper did not clean up child
processes when shutting down.
* Fix a bug on z/OS where commands were ignored if the command file contained
an EBCDIC newline character.
* In the script file, stop using "runuser" when running the Wrapper in console
mode and use "su" instead to handle signals properly.
* In the script file, it is now possible to pass options to the command
"runuser" with $SU_OPTS.
* Fix an issue where some messages coming from Wrapper invocations used to
control the Wrapper as a service were not marked with the "wrapperm" logging
source.
* Fix a memory fault happening when the Wrapper exits after failing to write
the pid file. This was causing to return 139 instead of the normal exit code.
Since 3.5.31.
* Fix a minor memory leak when sending emails.
3.5.31
* Fix script file to resolve the architecture name correctly on Z/Linux.
* Change the default behavior of the script file to automatically detect the
service management tool on Linux and AIX. See 'SERVICE_MANAGEMENT_TOOL' in
the script file.
* Add new properties wrapper.ulimit.nofile.{soft|hard} to limit the use of open
files. It is similar to running the command "ulimit -n X" in a terminal.
* Fix a bug introduced in 3.5.30 where the log file was opened for outputs with
a log level lower than the value specified by wrapper.logfile.loglevel. This
could cause a performance issue if the wrapper.logfile.close.timeout property
was set to a low value as it would cause to reopen the file regularly.
* Fix a bug where messages generated shortly after the Wrapper starts could not
be redirected to the configured log file. This was happening when using a
custom working directory and when the path to the log file was set relative
to it.
* Fix issues when processing queued log messages which could result in minor
memory leaks and dysfunction in the way log file change events are fired.
* Fix a problem where the log rolling by date stopped working if at some point
the Wrapper could not access the configured log file and switched to the
default log file. From now on, the rolling will continue as soon as the
configured log file becomes available. As for the default log file, it is
always set up to roll with another single file, each file having a size limit
of 5Mb.
* Fix misleading error messages when the Wrapper fails to write in the log file
or fails to terminate the JVM process. The system error codes and their
descriptions were incorrect.
* Several improvements when the Wrapper switches to a different log file.
When the log file was not accessible, if its path was changed and the
configuration reloaded, the Wrapper failed to resume into the new log file.
Also improved log notifications whenever the log file changes.
* Improve how the Wrapper checks if there is a source for the Windows Event
Log. Before, this was done on the first message being logged. Now, this check
is done at launch time for better performance and readability. If there is no
source registered, the logging to the Event Log will be disabled, with the
exception of critical messages such as when the log file changed.
* Several improvements in the log outputs such as wrong entries in the property
dump, double outputs, thread messages being inserted in the middle of
multi-line messages, etc.
* Fix a bug where the Wrapper did not stop even though the action specified
by wrapper.event.wrapper_pause.command.on_exit.=SHUTDOWN was triggered.
* Several improvements and bug fixes related to time zones, especially when
parsing the IANA time zone file.
* Add new WrapperManager.getOS() and WrapperManager.getArch() methods to make
it easy to access the same resolved OS and architecture used by the Wrapper.
* Fix a buffer overflow problem happening when collecting HostIds if the number
of adapters on the local machine exceeded 10. Also improved the display of
HostIds when calling 'wrapper -h'.
* When launching the Wrapper in console mode, the UNIX shell script will now
return the exit code of the Wrapper. When using the start action, the script
will not wait for the Wrapper to finish and will not return its exit code.
* Add a new property, wrapper.exit_code.error, which allows the user to specify
the exit code to use when the Wrapper stops with an error. This can be used
to distinguish the Wrapper exit codes from other codes that the Java
application may return. Note that this will only take effect after the
configuration has been loaded.
* Correct the exit code of a child process launched by WrapperManager.exec()
on UNIX platforms when it exited due to a crash.
* Several bug fixes and improvements when setting the language and encoding.
If the configuration doesn't match with any locale installed on the system,
the Wrapper will try using a similar locale ignoring case and modifiers.
See the Internationalization/Localization page for details.
* Stop setting the LANG environment variable on Windows.
* Fix a problem where wrapper.lang.encoding was ignored if the LC_ALL
environment variable was set on the terminal that launched the Wrapper. To
solve this issue, LC_ALL is now set by the Wrapper with the same value as
LANG. This only applies to UNIX platforms when wrapper.lang is set.
* Due to changes in the way locales are set, the value of the WRAPPER_LANG
environment variable may be affected. This variable was and is still set with
the 2 first characters of the locale used by the Wrapper, but it is now
always lowercase. This makes it match with the suffix used in the language
file. On the community edition, the value is always 'en'.
* After a ping timeout takes place, the Wrapper will no longer wait for
wrapper.shutdown.timeout to elapse and will immediately kill the JVM if a
RESTART or SHUTDOWN action was specified. A hung JVM process can't be shut
down cleanly, so there is no need to wait for an additional timeout.
* Deprecate the use of the wrapper.event..email.attach_log
properties in favor of wrapper.event..email.maillog. These
new properties make it possible to control if the logs should be sent as an
attachment and/or directly in the body of the Notification emails. Also note
that, unlike the deprecated properties, logs inclusion can now be set for
individual events without activating it for the "default" event type.
* Add new actions PAUSE, RESUME and CLOSE_LOGFILE to the signal properties
wrapper.signal.mode.hup, wrapper.signal.mode.usr1 and
wrapper.signal.mode.usr2. CLOSE_LOGFILE can be used to force the Wrapper to
recreate a new log file after it has been moved or renamed.
* Add the possibility to pause and resume the Wrapper from the UNIX shell
script. Two modes were added and can be activated with the PAUSABLE_MODE
variable. The first mode, which is the default, uses the SIGUSR1 and SIGUSR2
signals to request pause and resume. The second mode uses the command file.
By default the script will not allow pausing or resuming unless the PAUSABLE
variable is explicitly set. When this feature is activated be aware that
depending on the mode, wrapper.signal.mode.usr1, wrapper.signal.mode.usr2,
or wrapper.commandfile will be passed as command properties to the wrapper
and thus override the corresponding properties of the configuration file.
* Add event handler methods to the Demo application to show how to handle the
service control event sent by the Wrapper when wrapper.pausable.stop_jvm is
set to FALSE.
* Stop allowing the Wrapper to run when versions of the Wrapper executable,
native library, and jar file do not match. The Wrapper had always shown a
warning then attempted to continue, but this would often lead to
unpredictable behaviour and some features simply not working. Please be sure
to upgrade all Wrapper files when upgrading the Wrapper.
* Deprecate the use of the wrapper.command.poll_interval and
wrapper.anchor.poll_interval properties in favor of
wrapper.commandfile.poll_interval and wrapper.anchorfile.poll_interval.
* Fixed a rounding issue causing the intervals between two pings or two
deadlock checks to be 900ms shorter than the value specified in the
configuration.
3.5.30
* Improve the logging messages when using the IANA timezones introduced in
version 3.5.29 and add a new property, wrapper.timezone.debug_timestamps, to
display additional information (offset to GMT and whether DST is in effect)
in the timestamps of the log outputs.
* Improve the behavior when the Wrapper fails to parse the timezone file or
fails to resolve daylight saving time. Any error on startup will cause the
Wrapper to fall back to system time. If an error would occur during a time
change, the Wrapper will continue with the current time.
* Add new properties wrapper.ntservice.preshutdown and
wrapper.ntservice.preshutdown.timeout to allow Windows services with a long
shutdown time to stop cleanly before the system starts its shutdown process.
The first property specifies that the service will accept PRESHUTDOWN
notifications. The second property tells the service control manager how
long to wait until the service stops. These properties are not supported on
Windows Itanium or Windows XP and lower.
* Fix a memory leak on Fedora 21 and lower. This issue was fixed for RHEL,
CentOS and Amazon Linux AMI on version 3.5.28, but was still happening on
Fedora when rolling the log file in size mode.
* Fix a bug where, under certain conditions, a white square appeared briefly
on the screen just before the splashscreen was drawn (wrapperw).
* Change name of the architecture for Linux PPC. Since 3.5.29 the Wrapper is
available on Linux PPC little-endian and big-endian. To avoid confusion
'linux ppc' is now 'linux ppcbe' and 'linux ppc64le' becomes 'linux ppcle'.
* In the script file, add the variable FILES_TO_SOURCE which should contain a
list of files to source prior to executing any commands.
* Add two tokens, 'W' and 'J', to the logging format to display the Wrapper
process id and the Java process id.
* Fix a bug where the Wrapper stopped to log messages coming from the Java
application, or one of its child process, when it encountered a null
character (\0). It also resulted in a memory leak if the Java application
was logging messages at a frequency higher than the value specified with
wrapper.log.lf_delay.threshold.
* Fix a wrong implementation of the property 'wrapper.log.lf_delay.threshold'.
The amount of time specified by this property was counted from the last log
output received instead of the last line feed received.
* If the Wrapper is unable to write to the configured wrapper.logfile, it would
fall back to a default log file in the working directory. If this would also
fail, the log file will be disabled and logging will only continue in the
console, syslog or EventLog. From 3.5.30, the Wrapper will resume logging
into the configured file as soon as it is available again. If the log file
had been disabled and the configured log file would still be locked, then it
will try to resume the logging in the default log file.
* Fix a bug where a RESTART or a PAUSE action specified with
wrapper.on_exit. (or wrapper.on_exit.default) would abort a SHUTDOWN
triggered by an event, a filter, a timer, a deadlock, a ping timeout or
failures of mounted shares.
* Improve the logging messages when the action 'KILL_RESTART' is specified for
the 'wrapper.event..command.block.action' property. Depending on
the event, RESTART is not always applicable, but the Wrapper always notified
that a new JVM was going to be launched. Now it will clearly inform when the
restart is not applicable.
* Improve the output when querying the status of a service on Unix. It will
show whether the service is installed or not, and which system is used if
there are several possibilities for the current OS (init.d, systemd, etc.).
* Fix a bug where the daemon was not reloaded when the Wrapper was installed
using systemd and a custom service file.
* When installing a daemon with systemd or upstart, the Wrapper will now check
for a previous install like it does for the other init systems. This implies
that the service should first be removed to force reinstallation.
* Add the ability to log the properties each time the Wrapper loads or reloads
the configuration file. A new wrapper.properties.dump.loglevel property was
created to control at which level they will be logged.
* fixed a bug happening when launching multiple instances of the shell script
in a short time interval. If one instance was starting the Wrapper while
another attempted to stop it, the PID file of the new Wrapper process might
eventually be deleted. Running without a PID file could cause some issues and
would leave open the possibility for a second instance of the Wrapper to run
simultaneously even though wrapper.pidfile.strict would be set to TRUE.
3.5.29
* Fix two problems when wrapper.lang.folder was passed in the command line to
the JVM. The path was limited to 78 characters and was not put in quotes on
Windows.
* Add new supported platform: Linux PPC64LE 64-bit. Built on a RedHat 7.1 LE
machine, GNU libc 2.17.
* Fix a bug happening on startup where timers set with an interval less than
wrapper.timer.max_catchup were executed several times.
* Add a dynamic variable 'WRAPPER_SYSMEM_' where
is a percentage of the
physical memory available on the system. This variable can be used in the
wrapper.java.additional. properties to set the values of JVM options like
-Xmn, -XX:PermSize or -XX:MaxMetaspaceSize.
* Fix a bug on AIX where the properties wrapper.java.maxmemory.percent and
wrapper.java.initmemory.percent did not work because the Wrapper failed to
get the physical memory size of the system.
* Fix script (AIX only) to allow users to start and stop the Wrapper without
using SRC and fix syntax error in a message when validating the size of
APP_NAME.
* Add the possibility to specify a timezone of the IANA tz database in which
the Wrapper will be executed. Although the old timezone abbreviations are
still available for backward compatibility, usage of the new IANA identifiers
is preferred because it solves several issues, especially regarding daylight
saving time. By default, summer/winter time changes are automatic and will
update timers, mail settings and time-stamps of all log outputs.
* Fix script for MacOSX where users could only start the daemon if it was
installed. Now it is not necessary to install it. Introduced in 3.5.28.
* Improve a workaround to a bug in a libc function on AIX which causes memory
errors when messages containing Japanese characters are logged. There might
still be some errors if the Java application logs very long messages through
the Wrapper, but in this case a special configuration is possible as a
workaround.
* Fix a bug on FreeBSD 10.x where the libiconv library could not be loaded.
This caused the Wrapper to stop at startup.
* Fix a scaling issue on the GUI of the Demo application. The main window was
too small on high-DPI displays.
3.5.28
* Fix a memory leak on Red Hat Enterprise Linux, CentOS and Amazon Linux AMI.
It occurred when activating log rolling in size mode. This memory leak came
from an issue in the GNU C Library (glibc) which was fixed on version 2.21.
However, a workaround was added so that the Wrapper can run without issues
on any version of glibc.
* Fix an issue on z/OS that if the path to the Wrapper binaries was longer
than 79 characters, the script could not execute the 'start' and 'stop'
commands properly. It reported a stale PID file when starting the daemonized
process and later failed to stop it because it could not find that PID file.
* Fix the console flicker bug that was still happening when launching
wrapperw.exe from a Windows shortcut.
* Add the possibility to configure Processor affinity for AIX, FreeBSD, HP-UX
and Solaris. For HP-UX and Solaris it is only possible to bind one CPU per
process.
* Fix a problem where boolean configuration properties were not assigned their
default values if a wrong value was set. The Wrapper always resolved unknown
values to FALSE even though the default value should be TRUE.
* Add a new event 'WrapperSecondInvocationEvent' that can be consumed in the
Java Application on Windows. This event will be fired whenever a second
instance of the Wrapper tries to start when single invocation mode has
been specified. This enables you to execute custom tasks like showing a
message or bringing a window of your application to the front.
* With single invocation mode, it is now possible to specify that the Wrapper
will focus the foreground window of the running Java Application instead of
launching it a second time. If no window can be found, the focus will be set
to the Wrapper monitoring the application. This can be used in combination
with the event handling to activate any window that was brought to the front.
* Fix bug on Linux where RUN_AS_USER was ignored when running the Wrapper as
a service controlled by systemd. The service was always running as root.
* Fix bug on AIX where running the Wrapper as a service would not use the
System Resource Controller (SRC) and ignore RUN_AS_USER value. Thanks to
Miroslaw for pointing this out and for his contributions to the shell script.
* Add a new bit flag (0x8000) to indicate that an error occurred when querying
the status of a Windows service. If the query is silent (-qs option),
wrapperw.exe will no longer display error messages in the dialogbox, but
these errors will still be logged in the log file.
* Add new system property to WrapperStartStopApp (integration method #2) to
handle passthrough parameters. These parameters can be passed to the start
and/or stop method of your Java application. By default the passthrough
parameters are ignored (see the javadocs of the WrapperStartStopApp class
for details).
* On Windows, the Wrapper will now check that the code page of the console
supports the specified language. If it doesn't, it will fall back to English.
* Add two new values for the wrapper.lang property: 'DESKTOP' and 'SYSTEM'.
These values are used on Windows and ignored on other systems. The first,
which is the default, specifies that the language of the Wrapper will be
resolved according to the UI language. The second will cause it to use the
system language. Before, the Wrapper used the language of the Region Format
settings.
* Fix a bug where messages in Japanese coming from the JVM were badly encoded.
This occurred on Windows when the language for non-unicode programs was not
set to Japanese.
* Improve the error message if there are any problems initializing the backend
pipe or socket.
* Add 'installstart' command to the UNIX shell script in order to install and
then automatically start the Wrapper as a daemon process.
* On AIX and HPUX Itanium, the Wrapper will no longer have the GNU version of
libiconv as a dependency. This dependency was introduced in version 3.5.26
for AIX and 3.5.27 for HPUX itanium, but caused some compatibility issues.
* Add a new '--teardown' option (and TeardownApp.bat.in) to the Windows version
which can be used to reverse changes done with the '--setup' option.
Administrative credentials will be requested. As of version 3.5.28, this will
only unregister the application/service from the event log system.
* Add a new property, wrapper.syslog.ident.enable, which tells the Wrapper to
create or delete an identification (also known as source) for the event log.
Starting with Windows Vista or Windows Server 2003, this action requires
administrative credentials. When running on a lower permission, the Wrapper
will ignore this property and start normally.
* Fix a bug where actions specified by wrapper.ping.timeout.action were only
performed the first time the JVM became hung. All subsequent hangs were
ignored. With the default configuration, this would mean the Wrapper could
only restart a hung JVM once. Since 3.5.16.
* The Wrapper is now signed with a SHA-2 certificate. SHA-2 provides stronger
security than the previously used SHA-1 algorithm. The decision to change the
certificate was made in compliance with Microsoft's SHA-1 deprecation plan
which states that Windows 7 and higher will no longer support SHA-1 after
January 1st, 2016. It should be noted that Windows XP SP2 and lower, as well
as Windows Server 2003, don't support SHA-2 and the new certificate will not
apply on these platforms. The binaries provided for Windows Itanium will also
no longer be signed.
* Fix memory errors happening on AIX when the system uses some localizations
like Japanese.
3.5.27
* Fix a misleading error message when there is a problem processing a system
error message on Windows.
* Handle system exit codes with descriptions (Windows only).
* Add new configuration file directives (#properties.on_overwrite.loglevel and
#properties.on_overwrite.exit) to better control how the Wrapper should
behave when detecting duplicate property definitions.
* Fix: No longer tries to resume a Windows service that is already running,
or pause a service that is already paused.
* Improve accuracy of status messages when installing, removing, starting,
stopping, resuming and pausing a Windows service.
* Improve the display of the available HostIds when calling 'wrapper -h'.
* Fix the console flicker bug. Happened when wrapper.ntservice.generate_console
was set to TRUE, which is required for thread dumping.
* Fix a problem on Windows with the consoleless version of the Wrapper. If a
splash screen was set at launch time, and if the Wrapper eventually failed to
start normally, the splash screen did not disappear and remained on the top
of the log window.
* Fix a problem on Windows platforms that caused the log window to overlap all
the other forms even when the focus was set on an other application.
* Add the ability to define CPU affinity for the Wrapper and JVM processes
(Windows and Linux systems, professional edition).
* The wrapper can now be executed with a '--setup' option in order to install
components under elevated mode on Windows. During the installation, the
wrapper will register the application to the Windows Event Log system.
After the Wrapper is executed with the '--setup' option, the Event Viewer
will no longer report that the installation was corrupted.
* wrapper.exe and wrapper.dll are now manifested for compatibility with newer
versions of Windows (8.1 and above).
* Modify the Community Edition license to allow the Wrapper to be integrated
and distributed with Products released under either the GPL version 2 or GPL
version 3 licenses.
* Include the PID of the Wrapper and Java processes in debug output.
* Fix a problem where the wrapper.jvm.port.min and wrapper.jvm.port.max
properties were being ignored. This meant that the defaults were always
being used. Since 3.5.26.
* Fix a very infrequent issue in which the Wrapper would produce an out of
memory error or fail when trying to get the path to the Wrapper on Windows
XP.
* Modify the wrapper.pausable and wrapper.pausable.stop_jvm properties so they
are no longer reloaded when wrapper.restart.reload_configuration=TRUE.
* Fix a bug when the child process printing the JVM version became a zombie
after completion (problem known on CentOS). Add property
wrapper.java.version.timeout to let the user set a timeout for the child
process to print the JVM version before being terminated.
* Avoid 4227 events in the Windows LogBook when using SOCKET values for the
wrapper.backend.type property. We now try to check the port status in
native code prior to opening it in Java. The Wrapper worked correctly, but
a Windows issue was causing warnings in the EventLog if the port had an
existing socket in the TIME_WAIT state from a previous JVM invocation.
* Fix a problem on AIX with OpenJRE where the Wrapper failed to load the
native library. The native library now has a '.so' extension like on other
UNIX platforms.
* Fix a problem on HP-UX when listing HostIds. If several HostIds were
available on the machine, the Wrapper could only get the first one and
reported DLPI errors when attempting to get the others.
* Fix path to remove files when uninstalling the Wrapper daemon process on
HPUX.
* Added Linux Itanium binaries in the "Delta Pack". It was removed since
version 3.5.18.
* Fix an encoding conversion error when sending email on HP-UX.
* On MacOSX, set the launchd KeepAlive key to "false" by default as
recommended by Apple. However, it is possible to set it to "true" by editing
the new MACOSX_KEEP_RUNNING variable in the script file.
3.5.26
* Improve the log messages when a JVM restart is requested when the Wrapper is
in a state that it will be ignored.
* (Standard, Professional) Add an additional debug message when a deadlock
sweep completes. No functional change but this was added to make it easy to
tell how long the sweep takes on a given application.
* Clean up the internal tracking of where environment variables were set.
No functional changes.
* When detecting Cygwin with 'uname -o' in the script file, some OS's
(Solaris, MacOS, etc.) show an error message because '-o' is not a valid
parameter. Now we hide this error message to avoid confusion and we can
guess that Cygwin is not running.
* Add the ability to control the service with systemd using the script file.
* On Mac OS X, fix a typo, add another alternative way to find Java to set
the JAVA_HOME environment variable, and use the full path to execute sysctl
in case it's not in the path. Thanks to Dannes Wessels for pointing this
out.
* Fix a problem on newer versions of Windows when customizing the Wrapper.
The certificate was not removed when creating the target. This was leading
to an error when trying to sign the target with a new certificate.
* Add missing support in the shell script for restarting/stopping the Wrapper
service with launchctl on Mac OS X.
* Add missing support in the shell script for restarting/stopping the Wrapper
service with Upstart.
* Add the ability to set the path of the 'su' command as well as the ability
to specify additional arguments in the Wrapper shell script using new SU_BIN
and SU_OPTS variables.
* Fix a problem in the WrapperSimpleApp, WrapperStartStopApp, and
WrapperJarApp helper classes where command line problems that resulted in
the JVM exiting on startup looked like unexpected exits. This meant that
the Wrapper would try to relaunch the JVM again rather than giving up on the
first attempt.
* Modified the WrapperSimpleApp, WrapperStartStopApp, and WrapperJarApp helper
classes so that their usage banners will only now be shown for command line
related problems. Issues with the specified classes, methods, or jar files
are still logged as errors, but showing the user the usage in these cases
was confusing.
* Correct the WrapperResources.getString() method that has no replacement
arguments so that its processing of the raw string is handled the same as
methods which have replacement arguments. Now all strings are processed
by the MessageFormat class before being returned. Previous versions were
not consistent about the need to escape single quotes.
* Added optional key validation to make sure that strings passed in to the
WrapperResources.getString() method are formatted correctly. See the
WrapperResources class for information how to enable.
* Clean up escaping of single quotes in a few messages.
* Add new options for property wrapper.backend.type: AUTO, SOCKET,
SOCKET_IPv4, SOCKET_IPv6, PIPE. When set to AUTO, the Wrapper will try to
open a socket ipv4 and fallback to ipv6 and to pipe in case of error.
* Fix bug when converting from multibyte to wide char without setting the
locale at startup (Unix only). Thanks to Bert.
* Add a 'CLOSE_BACKEND' alias to 'CLOSE_SOCKET' as a test command for the
wrapper.commandfile property. This is because there have been multiple
options for the backend connection for some time and the name is more
portable.
* Fix a problem on Mac when running OS X Yosemite where the script was failing
to correctly compare versions '10.10' to '10.5.0'. This was leading to the
script thinking that only 32-bit binaries could be run. This was only an
issue if the delta pack naming of the wrapper binaries was being used.
* Add a new wrapper.java.classpath.missing.loglevel property which makes it
possible to control how the Wrapper logs warnings about missing classpath
elements. Previously this was always logged as debug output and could not
be disabled.
* If there are any low level problems launching the Java process that are not
related to configuration or the JVM itself, the Wrapper will no longer try
again as such retries were meaningless.
* Windows system APIs have a problem that cause a process to crash if it
attempts to set an environment variable over 32767 characters in length.
The Wrapper now checks for this and logs an error rather than setting the
variable. This was a problem if very large classpaths were used when the
wrapper.java.classpath.use_environment property was TRUE.
* Windows does not allow a command line to be longer than 32766 characters in
length. Different versions of Windows handle it differently when such a
long command is provided. The Wrapper now does its own check and shows an
error in a consistent way.
* Improve the error message on UNIX platforms when the command line is longer
than the system maximum. This maximum varies greatly by platform and
environment and is difficult to calculate reliably, so the maximum length
is not currently shown in the message.
* Fix a problem on UNIX platforms where a very large configuration file could
cause the WrapperManager to fail to startup. This was caused by the partial
transfer of the configuration file to the WrapperManager via the backend
connection. This would happen regardless of the backend type used. The
size of the configuration file that would cause a problem varied greatly
based on the specific system.
* Fix a problem on Windows platforms where a very large configuration file
would fail to be sent to the WrapperManager on startup when the
wrapper.backend.type property was set to PIPE. The only problem was that
the WrapperManager.getProperties() method would be empty.
* (Professional) Add checks to the WrapperManager.exec() methods on Windows
for the maximum command line length of 32766, and maximum environment
variable name-value pair length of 32767.
* (Professional) Fix a problem where a free of a NULL pointer was being done
as part of the cleanup process of a WrapperManager.exec() call. This is not
known to have caused any issues.
* Added getStdOut(), getStdErr(), and getStdIn() methods to the WrapperProcess
class as aliases to the getInputStream(), getErrorStream(), and
getOutputStream() methods to help avoid confusion.
* Fix a problem on Windows 7 where long log lines got corrupted after 31397
characters when wrapper.console.direct was true. This seems to be a problem
with the underlying Windows API and was only a display issue. Reduced the
maximum number of characters that can be written with a single API call to
30000 to work around the issue. This change is internal and there is still
no limit on the length of logged lines.
* Fix a deadlock if the Wrapper failed to write to the backend when the
wrapper.backend.type property was PIPE. Found by code review and is not
known to have actually happened.
* From Mac OSX 10.5.0, the script file will use the key 'KeepAlive' in the
launchctl configuration file. Prior versions of Mac OSX will continue to use
the same key 'OnDemand'. Thanks to Robin for pointing this out.
* (Standard, Professional) Disallow the use of hostids tied to Apple Bluetooth
devices when running on a virtualized Windows system hosted on an OS X
system.
* Fix a problem where WrapperManager.log() was not working correctly when
multi-byte messages were logged.
* In the debug output the full configuration properties packet is suppressed
from the log output because it is huge and can contain sensitive data.
Add a size to the abbreviated output to assist with debugging.
* Fix a memory leak on UNIX platforms whenever an error message was reported.
This was only a problem if the message was logged repeatedly.
* Correct a couple other potential memory leaks found through code review.
Not known to have been causing any actual problems.
3.5.25
* (Professional) Improve the wrapper.timer..interval property so it is now
possible to specify ranges and lists of values as well as offsets for
interval values to more precisely control when timers are fired.
* (Professional) Fix a problem with the wrapper.timer..interval property
where timers would not fire during an interval the system time was set back.
Also fixed a problem where timers would stop firing permanently if the
system time was set forward by more than the value of the
wrapper.timer.max_catchup property and a timer had been scheduled to be
fired during that interval. Both of these issues were most likely during
daylight savings time.
* Fix a problem where signals received by the JVM were not being logged in
debug output correctly if the wrapper.ignore_signals property is set to
true. We now also log debug output even if a user event listener consumes
the signal event.
* Fix a problem on Gentoo Linux where the shell script was not correctly
detecting the system architecture. This may also be a problem on other
distributions whose 'uname -p' returns a detailed architecture.
* In the shell script, when the flag to use systemd (USE_SYSTEMD) is set,
the shell script generates a ".service" file in /etc/systemd/system/
when installing the Wrapper as a daemon.
* In the shell script, add a function to validate the size of APP_NAME when
installing or removing the daemon on AIX.
* It was possible to disable the logging of the Java command line even when
debug output was enabled by setting the wrapper.java.command.loglevel
property to NONE. This made it difficult to debug problems and is no longer
possible.
* When the wrapper.java.version.output property is set to true, add debug log
output to show the actual command line used.
* Fix a problem on Windows when the wrapper.java.version.output property is
true where it was possible that java executable being run to get the version
could be different than that used to run the application if the java
executable was being located on the default system PATH as well as the PATH
defined in the environment. The Wrapper now looks once and uses the same
fully resolved path in both places. For clarity, both java command lines are
now included in debug log output when the version is requested. (Bug #288)
* Change the timing of the logging of the Java command line on UNIX so it is
consistent with Windows.
* Improve the error message text thrown when a native feature is not available
from Java to be more clear about whether the problem is that the native
library could not be loaded versus the wrong edition being used.
* On Windows, detect when the Wrapper is running under Cygwin and set the
default value for wrapper.console.flush to TRUE. On other platforms,
the script will display a message and stop running.
* (Professional) Add support for WRAPPER_EVENT_TIME_* and WRAPPER_EVENT_RAND_*
variable references so event times can be used when events are fired.
* Fix a buffer overflow problem on AIX which caused crashes or deadlocks on
startup for some users. This had been an issue since 3.5.0 but only reported
recently.
* Remove output debug messages on UNIX when the wrapper.port.address property
was set.
* Clean up code when converting multibyte characters to wide characters. Some
error checks were not implemented correctly. Found during a code review and
is not known to have actually caused any problems.
3.5.24
* Fix a problem where the message source of remote syslog messages from the JVM
were being logged as "jvm %d" rather than "jvm 1".
* Add a new wrapper.syslog.split_messages property which controls whether or
not multi-line messages will be logged as is or first split into individual
lines.
* Fix a problem on Windows Vista and above where the wrapper.single_invocation
property was not correctly identifying Wrapper instances running in different
sessions under some circumstances.
3.5.23
* Clean up the error messages logged when the Wrapper failed to elevate itself
on Windows platforms. They are now more informative.
* (Professional) Fix a handle leak on Windows in WrapperProcess.isAlive().
* (Professional) Modify the exception thrown when WrapperManager.exec is called
while the Wrapper is shutdown so it now says that rather than saying that the
native library is not loaded.
* (Processional) The Wrapper is now more careful to make sure that the backend
is never closed while a child process is being launched to ensure that the
Wrapper knows about all child processes launched.
* (Professional) Add a warning message in case the Wrapper is not notified of
a launched child process due to the backend connection being closed.
* (Professional) Fix a potential NPE that could be thrown while reading stdout
or stderr output from a child process while the Wrapper was shutting down and
after the child process exited.
* (Professional) Fix a problem on UNIX platforms where we were getting stuck
trying to cleanup after a process which was currently blocking on a read from
stdout or stderr.
* (Professional) Fix a problem on UNIX platforms where a timeout attempting to
obtain an internal lock of the child process list was causing an internal
counter to get out of sync, leading to a other terminated child processes
being left as defunct zombies until the Java process terminated.
* (Professional) Fix a problem on UNIX platforms where pipe file descriptions
used to communicate with child processes were being incorrectly passed to all
child processes. They were not growing over time.
* (Professional) Fix a potential synchronization problem calling
WrapperProcess.waitFor() or WrapperProcess.exitValue().
* Add additional debug log output showing the various timeout values to help
with debugging user issues.
* Fix a problem where the shell script was not correctly detecting the OS
version with Mac OSX Maverick.
* Add warnings about undefined environment variables in include file references
in the configuration file.
* Add support for environment variable expansion in files specified with the
wrapper.java.additional_file and wrapper.app.parameter_file properties.
* Correct the integer formatting in the WrapperUNIXGroup.toString() method so
it is consistent with the rest of the Wrapper.
* Fix a problem where the iconv library requirement couldn't be satisfied in
FreeBSD 10. We now locate the library dynamically by looking for
/usr/local/lib/libiconv.so, /usr/local/lib/libbiconv.so, or
/lib/libkiconv.so.4 in that order.
* Fix a the WrapperPrintStream.println method so strings containing linefeeds
will correctly have each line prepended with the configured header.
* (Standard, Professional) When an unknown license type is encountered, include
the unknown type in the error message to help with debugging.
* (Standard, Professional) Fix a problem on FreeBSD systems where the
wrapper.lang.encoding was not resolving to UTF-8 correctly when the LANG
environment variable was not set.
* (Professional) Fix a memory corruption problem on z/OS when the language was
set to a double byte locale like Japanese.
* Go through and make the Wrapper much more durable when badly encoded double
byte characters are encountered.
3.5.22
* (Standard, Professional) Fix a crash in native code behind WrapperResources
instances which could happen if the system was very low on memory. Since
version 3.5.7.
* (Professional) Fix a couple slow memory leaks in the native code involved
with launching and checking on the status of child processes.
* (Professional) Fix a problem where an attempt to throw a WrapperJNIError
within native code on Z/OS would result in a ClassNotFoundException being
thrown.
* Reviewed the native JNI code and fixed a few potential crashes and memory
leaks which could occur under low memory conditions.
* Modify the way the wrapper.console.direct property works so the Wrapper will
now always downgrade itself to using piped console writing as soon as it has
determined that a physical console does not exist. In 3.5.21 we tried to
predict when the console would not exist and disabling it in advance. There
were cases where this was not correct, resulting in error messages in the
console output.
* Fix a problem where operations like installing a service on Windows 7 and
above which need to be elevated were resulting in an error that the Wrapper
could not write to the console. The actual operation was working correctly
but the console output was incorrect. Since 3.5.21.
* Move the check that the jar and wrapper versions match earlier in the startup
process so we guarantee that a warning will always be displayed. There were
some errors which could abort the startup process before this warning was
logged.
* (Standard, Professional) Fix a problem where the value of wrapper.lang.folder
was not being recognized if a wrapper.lang value was not set.
* (Standard, Professional) Fix a small memory leak resolving the language to
run the Wrapper with.
* (Professional) Fix a potential buffer overflow reading data from a child
process stderr or stdout if the amount of data available in the pipe is
larger than the buffer length passed in to WrapperProcessInputStream.
read(byte b[], int off, int len).
* (Professional) Fix a problem where reads from a WrapperProcessInputStream
were consuming too much CPU while blocking for data on Windows. Now
correctly being done asynchronously.
* (Professional) Fix a problem where JVM cleanup, including cleanup of child
processes, was not always being done completely if the user requested an
immediate shutdown by pressing CTRL-C twice.
3.5.21
* Add a new 'R' log format which will track the number of milliseconds since
the previous JVM log output. Useful for simple performance checks. See
the wrapper.console.format, wrapper.event.default.email.maillog.format,
wrapper.logdialog.format, and wrapper.logfile.format properties.
* When the ACCESS_VIOLATION testing command of the wrapper.commandfile was used
to kill the Wrapper some log output was not making it into the wrapper.log
file. Add a forced flush just before crashing the Wrapper to make sure
everything makes it into the log file.
* Add a new wrapper.javaio.buffer_size property which makes it possible to
control the size of the internal buffer used to process console output from
the JVM. Also increased the default from the system default to 65536 bytes.
* Renamed the wrapper.use_javaio_thread property to wrapper.javaio.use_thread.
The old property still exists as a deprecated alias.
* Added a new wrapper.console.direct property on Windows which tells the
Wrapper to use Windows APIs to render log output to the console rather than
writing to stdout and stderr. This results in a major speed improvement.
The drawback is that this removes the ability to pipe the output to another
program on the command line. We chose to enable this by default so the
majority of users can take advantage of the speed improvement. If your
application takes advantage of piping on Windows, you will need to disable
this property to regain the old behavior.
* Add a new "wrapperm" logging source on Windows to help differentiate which
log entries are coming from Wrapper invocations used to control the Wrapper
as a service such as starting, stopping, installing, etc. Previously the
log entries from the Wrapper service process and launching process both
used a "wrapper" logging source, which could be confusing.
* On UNIX, modify the way we keep track of whether the process is daemonized or
not. This was done to clean up a bit, but should not effect how the Wrapper
works.
* On Windows, change the timing of when PID files are created when running as
a service so any failures creating them will correctly be reported as a
service error. If the Wrapper was unable to write to a PID file because it
was read-only then the user was presented with a confusing message about
the service timing out on startup. This was in addition to the correct
error being logged.
* Fix a potential problem where internally queued log entries could fail to be
logged on shutdown. The log queue is now always processed as part of the
shutdown process.
* Modify UNIX shell script to remove all existing run level rc files for the
application on both install and remove, rather than only the ones for the
currently configured run level to avoid unexpected behavior due to old rc
files being left around. This only affects platforms which make use of
rc files.
* Add a new RUN_LEVEL variable to the UNIX shell script to make it easy to
configure the run levels when installing as a daemon on various platforms.
* Add new wrapper.logfile.close.timeout and wrapper.logfile.flush.timeout
properties, and deprecate the wrapper.logfile.inactivity.timeout property,
to increase control over when and how the logfile is flushed and closed.
* Add a new PIDFILE_CHECK_PID setting in the UNIX shell script which makes it
possible to control whether or not the script double checks that the pid in
an existing pidfile is actually the pid of the application's Wrapper. This
property makes it possible to disable this check so multiple applications
can be tied to the same pid file.
* Go through and make sure that none of the Wrapper native JNI methods are
called after the WrapperManager shutdown has completed. Doing so was causing
a JVM crash on some Linux JVMs. This was happening when a WrapperResources
instance was finalized by the garbage collector on shutdown.
* (Professional) Fix a problem where processes created by calling the
WrapperManager.exec functions could fail to be registered with the Wrapper
for cleanup if the call was made as the JVM was shutting down. This was
resolved by making sure that JNI calls can not be called after the
WrapperManager shutdown has completed.
* Modify the internal WrapperManager tick thread so it is allowed to complete
once the WrapperManager has fully shutdown. This was the only remaining
reference to the WrapperManager class.
* Add a new wrapper.property_warning.loglevel property which controls the log
level at which the Wrapper will log warnings about undefined but referenced
environment variables, as well as invalid boolean or integer values.
* Update the way environment variable references within property values are
parsed to make it possible to report those which are not defined. Each pair
of '%'s is now expected to be part of a variable reference. For example
"%AAA%BBB%CCC%", previously if "AAA" was not defined, "BBB" would be located,
but now only "AAA" and "CCC" will be recognized as variables.
* Fix a problem on Windows where a non-existent wrapper.working.dir directory
was causing multiple error messages in the log file.
* Modify the way the wrapper.environment.dump property works so it will now
log at the INFO level with the rest of Wrapper output when set to true.
When false however, the output will be logged as DEBUG output if enabled.
Previous versions always logged the output to the INFO log level in either
case.
* Fix a problem on Linux IA64 where the WrapperActionServer was throwing an
IOException when the JVM was shutdown by calling System.exit. It did not
cause any problems other than the message in the log.
* (Professional) Added new "jvm_ping_timeout", "jvm_ping_slow", and
"jvm_ping_response_slow" events to help respond to ping related issues.
* Fix a problem where a value of 0 for wrapper.ping.alert.threshold was not
correctly disabling ping threshold alerts.
* (Professional) Fix a problem where the thread that handles events would
permanently get stuck if the event queue filled up. This was very unlikely
but not impossible if a large number of filter events were triggered in a
very short time. Corrected the problem so it now recovers correctly, but
also increased the queue size to make the overflow even more unlikely.
* (Standard, Professional) Fix a problem where console output of a wrapperw.exe
processes launched when the wrapper.ntservice.console property was TRUE was
not being shown correctly. This issue was introduced in 3.5.19.
3.5.20
* Further improvements to the memory footprint of the Wrapper to minimize the
memory required when logging JVM output consisting of very long lines.
* Fix a minor potential buffer overflow, which could occur if the path of the
first classpath element is larger than 1024 characters. This overflow was
detected during a code review and we have no reports that it actually ever
caused any problems.
* Improve the error message displayed when the Wrapper's configuration file
could not be loaded so that it now includes the name of the file.
* Work around a libc system library bug on some HPUX platforms in which calls
to vswprintf can cause a crash if the expanded string does not fit into the
buffer. Worked around the problem with the help of HP support by making sure
the buffer length followed a rule so that its length was 1+N where N is a
multiple of 8.
* Fix a problem on HPUX platforms where the JVM would sometimes get stuck on
shutdown, when the shutdown was initiated within the JVM, leading to the
Wrapper having to forcibly kill it. This was caused by the Wrapper
attempting to close the backend socket when another read was blocking
attempting to read from the same socket. This was introduced in version
3.5.8.
* Fix a potential log corruption when queued log messages were larger than the
internal buffer size. Found during a code review and is not known to have
actually caused any problems.
* Fix a typo in the shell script which was breaking the 'install' command on
Solaris platforms.
* Fix a potential crash on HPUX platforms if the value of the
wrapper.port.address property had an encoding problem.
3.5.19
* Fix a problem in the batch file, where a space in the path to the Wrapper.exe
file would cause the script to locate the Wrapper.exe file. Introduced in
3.5.18.
* When running as Windows service with hiding the console of the Wrapper will
cause the Wrapper to disable unnecessary logging to the console in order
to enhance performance.
3.5.18
* Fix a problem, where an unclosed percentage character '%' was opening the
chance of a dangling pointer in the additional java parameters. The '%'
character is a special character, specifying an environment variable.
* Added variable _WRAPPER_DIR the batch files to make it possible to specify
any other directory where the Wrapper binary file is located. Until now the
batch file and exe file had to be in the same location. Thanks and credits
go to Geoff.
* Added property wrapper.port.address, which makes it possible to specify a
different address to bind the socket to when using the socket backend
connection between the Wrapper and the JVM. Until now, the socket was
always bound to the localhost loopback interface.
* The script will from now on also use the update-rc.d tool for installing
an application as daemon on Debian. Thanks and credits go to Haifeng.
* Whenever the Wrapper is causing the JVM to be forcibly terminated, the
Wrapper will make sure the JVM has actually been terminated. If it wasn't
after wrapper.jvm_terminate.timeout seconds, a pending restart will be
canceled and the Wrapper exit.
* Reworked the way the Wrapper is processing output from the JVM, in order
to increase performance on huge output on a single line and also reduce
memory usage.
3.5.17
* Add a new wrapper.java.additional.default.stripquotes property to make it
possible to specify the default value of
wrapper.java.additional..stripquotes
* Fix a bug where the timer failed to calculate the fire time when that time
was more than one week in the future. This was possible for weekly timers
which spanned a daylight savings time change which rolled the time back by
an hour in the fall.
* Fix problem in the shell script, where it might fail to remove an installed
daemon after the location of the script has been changed.
* Add additional advice messages when a Windows service fails to be started
due to file access problems involving the Wrapper binary, configuration, or
log files.
* Fix a problem where the dynamic library on MacOSX was not able to load it's
functions.
* Added wrapper.app.parameter_file property, which works similar to the
wrapper.java.additional_file property
* Reduce CPU-consumption of WrapperProcess.waitFor() function
3.5.16
* (Standard, Professional) Retry failed share mappings if the target host or
network is unreachable as that may be a temporary problem.
* (Professional) There was a problem where the IO-redirection of a child
process which got created with the WrapperManager.exec API and used the
feature to run the child process in the logged on users desktop was
only allowing to create a process once per second.
* Include information about the base configuration file in the debug output
when debugging of cascading configuration files has been enabled.
* Add a check in the UNIX script to output a more descriptive error message,
when the user specified in the RUN_AS_USER variable doesn't exist.
* (Standard, Professional) Fix a problem where console log output was not being
displayed correctly when running with the WrapperW.exe binary with the
wrapper.ntservice.console property was set to true.
* (Standard, Professional) Implement the wrapper.ntservice.generate_console
property when using the WrapperW.exe binary so it is now possible to disable
the creation of the hidden console.
* Modify the way the wrapper.ntservice.generate_console property works so
it is now easier to disable the generation of the console using just this
property.
* Improve the message logged when the Wrapper attempts to perform a thread
dump without a valid console being available.
* Add new wrapper.ping.alert.threshold and wrapper.ping.alert.loglevel
properties which make it much easier to debug ping timeout issues by asking
the Wrapper to log messages about ping responses which were shorter than the
registered wrapper.ping.timeout, but longer than the threshold.
* Add a new WrapperManager.appearSlow method which makes it easier to test
how the Wrapper behaves when the JVM is being slow to respond to commands.
* Add a new wrapper.disable_tests property which can be used to disable all of
the testing methods of the WrapperManager class. It has always been possible
to control their access with a SecurityManager, but this is simpler for most
applications.
* Update the default wrapper configuration file template so a restart due to a
matched OutOfMemoryError filter will no longer be triggered by default if the
user enables -verbose:class output.
* Fix a problem on UNIX platforms where the Wrapper would fail to start if it
was located on the system PATH. This had been a problem since version 3.3.0
but had gone unnoticed as the Wrapper is not usually referenced in this way.
* Rework the internal flags governing the generation and hiding of the backend
console on Windows so we are able to almost always obtain the console's
window handle.
* Cleanup some startup code to reduce duplication and make sure that more debug
and warning messages are logged after the "Wrapper Started" message.
* Add new wrapper.java.additional_file and
wrapper.java.additional_file.stripquotes properties to make it possible to
specify JVM parameters in a file.
* Add support for Linux on ARM systems.
* Re-Enabled the forced reloading of the SYSTEM (and if set to a specific
account, the user) registry before launching the Wrapper as a service on
Windows XP and 2003. This has been originally disabled for Windows XP and
2003 since version 3.5.5.
* (Standard, Professional) Fix a problem where the instance class names logged
when a deadlock involving ReentrantLock instances were corrupted. The actual
deadlock detection was working correctly, but this could have lead to other
problems caused by the corruption. A workaround was to set the
wrapper.check.deadlock.output property to SIMPLE.
* (Standard, Professional) Make it possible to completely disable the details
of a deadlock by setting the wrapper.check.deadlock.output property to NONE.
* (Standard, Professional) Object Ids in thread dump reports were not correctly
being logged as 64-bit ids on 64-bit JVMs in some cases.
* Fix a problem where the source code values returned by the
WrapperServiceActionEvent.getSourceCode() method were incorrect. The
constant values were incorrect and have been corrected from this release.
* Add new WrapperServiceActionEvent.getSourceCodeName() and
WrapperServiceActionEvent.getSourceCodeName(int actionSourceCode) methods
which returns a localized name of the source where the event originated.
* Fix a minor problem where a couple uncommon backend packet codes were not
being correctly identified by name in the debug log output. Functionally
they were all working correctly.
* Added property wrapper.ping.timeout.action, which will let you specify an
action in case the timeout triggers. So far the only action was to restart
the JVM.
* Fix a problem where a JVM process was not stopped completely on a UNIX
platform and stayed defunct after a forced kill until the Wrapper process
itself stopped. This was especially noticeable if the JVM is frozen and the
JVM is being killed forcibly.
* Add additional debug log output showing the various timeout values to help
with debugging user issues.
3.5.15
* Add a new _WRAPPER_CONF_OVERRIDE setting to the Wrapper dedicated command
batch files on Windows so it is now possible to control whether or not the
first parameter is the configuration file name. The ability to specify an
alternate configuration file is now disabled by default as it was confusing
for users who tried to pass other parameters to the JVM.
* Correct a couple log messages in the WrapperManager class which were missing
the correct prefix identifying where they originated.
* Remove some old reflection code needed for Java 1.2.x support as we have
required Java 1.4 since version 3.4.0.
* Remove some code to try to reconnect the backend socket from Java. It has
never been possible to do so without restarting the JVM, and the related
messages were confusing.
* Add a new wrapper.disable_forced_shutdown property to make it possible to
disable the feature to forcibly kill the JVM on shutdown if CTRL-C was
pressed twice.
* Reduce the number of times thread priorities are changed within the
WrapperManager class to simplify the startup and shutdown process.
* Fixed a dangling pointer problem, which could cause undefined behaviour
whenever a property contained an unset environment variable.
* Fix a race condition in the timer thread, which could cause a sigkill
being propagated through the whole process group rather than the timer
thread. This can only happen during the shutdown of the Wrapper.
* When a child process, which got launched by WrapperManager.exec()
failed to start due to a runtime-error (such as missing privileges), the
forked heap persisted and the child process never finished until
shutdown/restart of the JVM. The error only appears on Unix platforms
when using the FORK_EXEC start-type.
* Change log level and message if a certificate check returned a problem,
which is not directly caused by the signature of the Wrapper, but the
signature chain.
* Fix a problem when the silent query command wasn't returning the correct
exit code on windows Vista (and later) when the command was run from an
unelevated console. Thanks to Darren for pointing this out.
* The java system property wrapper.backend.so_timeout was ignored if it
was set to 0, making it not possible to explicitly set the timeout to
be indefinitely.
* Added the properties wrapper.java.additional.auto_bits. to
individually turn on/off the feature for the supported platforms.
* Fix a problem where the script was trying to use the 64-bit binaries on
Mac OSX even if the CPU was only a 32-bit architecture. This only affected
versions of Mac OSX greater 10.5.0, the vast majority of those machines are
already 64-bit CPU's.
* The Wrapper when reloading the configuration file, was trying to access
data from the call stack of a function which was actually outside of the
memory range of the stack. This access violation might yield a segmentation
fault. This issue was introduced in 3.5.5. Thanks to Lincoln for helping
finding this problem.
3.5.14
* Fix a problem in the AppCommand.bat.in file where a parenthesis in the
file name of the Wrapper binary would have caused a
"PATH was unexpected at this time" error.
* (Standard, Professional) Fix a problem when using a localized version of
the Wrapper on Windows 64-bit platforms where the Wrapper would continue
to use the default system language even wrapper.lang was used to specify
a different language. Introduced in 3.5.12.
* Fix a problem in the Windows AppCommand.bat.in command based batch file
where the 'status' command was incorrectly being reported as 'query' in the
usage output. The 'status' command had always worked correctly if used.
* Fix a problem on UNIX platforms where some asynchronous messages were
causing a warning message "Coding Error..." to be logged in place of the
intended message. This could be seen if the configured log file did not
have write permissions. Other than the incorrect log message, the Wrapper
worked correctly. Introduced in 3.5.2.
* Fix a problem in the UNIX script where running with Upstart wasn't working
correctly when RUN_AS_USER was set.
* Relax security checks when running the 'status' command against the UNIX
shell script so it now allows any user running the script to perform the
read-only check of the pid file.
* Fix a problem with the UNIX script where the 'remove' command was trying to
stop a running application even when the application had not been installed.
* Fix a buffer overflow which could potentially cause a crash during the
installation of a Windows Service when wrapper.ntservice.account was
specified. This was introduced in 3.5.12.
* Fix a heap corruption which could occur on startup and potentially cause a
crash. Only Windows systems, which use the System Event logs, were affected.
Discovered from a code review, there had never been any reports of this
causing problems for users. This could happen if the configured wrapper.log
could not be written to as the Wrapper always tries to write to the Event
Log in such cases. Introduced in 3.5.12.
* Add a new version comparison between the UNIX shell script and Wrapper to
start showing a warning in case of a version mismatch. The check will only
work if the shell script and Wrapper are each of at least version 3.5.14.
* Added a new wrapper.pidfile.strict property which will tell the Wrapper not
to start if the pid file already existed. Defaults to false for backwards
compatibility.
* Make the Java side of the backend socket more resilient in case of a read
or write timeout. The backend socket does not have a timeout set by default
so this should not have been an issue. A couple users reported problems on
specific systems however which led to this fix.
* To aid in the testing of the backend socket timeout, a new
wrapper.backend.so_timeout system property was added to make it possible to
configure the backend socket to use a timeout. See the Javadocs of the
WrapperManager class for details.
3.5.13
* Fix a typo in the script where the environment variable 'TR_BIN' should
actually be 'TREXE'. This was causing the "install" command on UNIX
platforms to fail. Introduced in 3.5.12.
* Fix a heap corruption which could lead to a crash that would occur the
second time an internal buffer used for logging was expanded. The buffer
would be expanded the first time a log line over 2048 characters in length
was encountered. Then the second expansion would happen when a line at
least 1024 characters longer was encountered. Introduced in 3.5.11.
Bug ID #3423108
3.5.12
* Put more descriptive Text in case the Wrapper is using integration method 4,
but the jar file deos not specify the Main-Class correctly in its meta
information.
* Fix a bug when failing to grant the LogOnAsService permission to a domain
user.
* Fix a bug where the ident for the syslog on Unix platforms was broken since
3.5.0. This was because when opening the syslog, the Wrapper was freeing the
memory for pointing to ident. However the string pointer ident will be
retained internally by the Syslog routines. And must not free the memory that
ident points to. Bug #3404978.
* Add a check on the script to make sure the 'tr' command exists on Unix
platforms.
* Improve the parsing of log formats so that format tokens are recocognized
even if they are lower case. This affects the wrapper.console.format,
wrapper.event.default.email.maillog.format, wrapper.logdialog.format, and
wrapper.logfile.format properties.
* The Wrapper parses log formats by looking for known tokens, any invalid
tokens are simply ignored. If the entire format is made up of invalid tokens
then this resulted in the Wrapper logging an empty line, which was not very
useful and caused confusion when encountered. The Wrapper now reverts to the
default log format in such cases. This affects the wrapper.console.format,
wrapper.event.default.email.maillog.format, wrapper.logdialog.format, and
wrapper.logfile.format properties.
* Improve the debug output while loading native libraries to avoid confusion
about the meaning of the warning logged about attempts to load alternately
named native library files.
* Fix a problem on Unix platforms where the default umask was being set to 0000
rather than inheriting it from the parent process when running as a daemon
process. This can be a security problem as log and other files have global
read/write access. Introduced in 3.5.8. Can be worked around by setting
the wrapper.umask property to a safe value.
3.5.11
* Fix a potential crash on Windows caused by a buffer overflow. This has been
a problem since version 3.5.0 and affects configurations which define more
than one wrapper.ntservice.dependency.. Depending on what was in memory,
this did not always result in a crash. It has very reproducible behavior for
a given configuration file.
* Fix a problem on Windows where the Wrapper was taking 15 seconds or longer to
startup on some systems because the WinVerifyTrust system call was having
problems updating the CRL. This had been a problem since the Wrapper
binaries started being signed in version 3.5.7. If the WinVerifyTrust call
takes longer than the configured wrapper.startup_thread.timeout then the
Wrapper will continue to startup without further delay.
* (Standard, Professional) Explicitly remove the certificate of the customized
binary during customization. There were problems resigning the binary with
another certificate otherwise.
* If the Wrapper is unable to write to the configured wrapper.logfile for any
reason then we always fall back to a default log file and then log a message
about the failure. If the default also fails then that is also logged but
the messages would only be logged to the console in most cases. Modify the
Wrapper so we now always send both messages to the syslog or EventLog
regardless of what the wrapper.syslog.loglevel is set to. This is important
to help track down the cause of logfile access problems.
* Starting with version 3.5.0, it was internally possible to print out
multi-line log messages so that all of the lines would always be grouped
together in the log file. This version modifies the logging code slightly so
that such multi-line log output is now logged as a single message in the UNIX
sylog or Windows EventLog.
* Fix a problem where very long lines of output from the JVM would cause the
Wrapper to appear to hang for a while. The first time a single line of
output containing several hundred thousand characters was logged, an internal
buffer was being incrementally increased by 100 characters per cycle. The
Wrapper now increases the size based on last known size to greatly reduce the
number of cycles needed to choose a new buffer size.
* Modify the PAUSE_THREAD command so it is now possible to wait indefinitely.
Only useful for testing the Wrapper.
* Add a new PAUSE_LOGGER command to make it possible to pause the next log
entry. Only useful for testing the Wrapper.
* On UNIX, the stdout/stderr pipe between the JVM and Wrapper was not being
cleaned up correctly. This resulted in a small leak but was otherwise
harmless. The pipes are now cleaned up and initialized for each JVM
instance.
* Fix a problem where the Wrapper could fail to restart the JVM when the
restart request originated in the JVM if the system was experiencing very
heavy IO resulting in long disk IO queues. This was causing the Wrapper's
main loop to block on the write and miss the restart request, causing the
Wrapper to shutdown rather than restart. This could affect all platforms.
On Windows, it could also be reproduced by making a selection in the console
to freeze output and then making a request from within the JVM to restart.
* Add a new WrapperPropertyUtil helper class to make it easer to access Wrapper
property values from within the JVM.
* Fix a bug on some platforms where java log output could get corrupted due to
misuse of a strncpy system function. This function warns that some
implementations do not support overlapping memory copies. The problem could
only be reproduced on a single Linux test machine in lines following an empty
line of output. This problem has existed since 3.4.0.
3.5.10
* Setting wrapper.jvm.port to '0' (zero) will make the JVM to assign an
available port for the backend socket by itself.
* Add warnings in the log file if an integer configuration property value
contains a non-numerical value. Previously, the Wrapper would silently
ignore the problem and use the value of 0 if the number started with an
invalid character, it will now return the default value. If the property
value started with valid numerical characters then those were, and still will
be, used to generate a value, but the invalid characters will be trimmed.
The later is being kept this way to avoid breaking old configurations.
* Add warnings in the log file if a boolean configuration property has any
value other than TRUE or FALSE. It will still return a value of FALSE
for other values to avoid breaking old configurations.
* Add a warning if an invalid value is specified for the wrapper.on_exit.
property.
* Add a new wrapper.log.lf_delay.threshold property which makes it possible
to control how long a partial line of Java log output will be allowed to be
buffered until it is completed with a line feed. If the threshold is
exceeded then the partial line will be logged as a full line resulting in an
extra line feed in the log output. All previous versions would do this
within 1-2 ms. The default is now 500ms.
* (Standard, Professional) Make it possible to customize the manufacturer
through the customize options.
* (Professional) Fix a problem where the Wrapper was sending a CTRL-BREAK
rather than a CTRL-C signal to child processes launched with
WrapperManager.exec when destroying them on Windows. For most child
processes this was not a problem, but if the direct child process was a JVM
then the CTRL-BREAK was triggering a thread dump rather than asking the JVM
to exit. The Wrapper was then timing out and forcibly killing the JVM child
process.
* (Standard, Professional) Fixed a bug, where the timezone ICT when set by
the wrapper.timezone property got misinterpreted as IST.
* (Standard, Professional) Fixed a problem where the UTC offset value in the
wrapper.timezone property was not being parsed correctly on UNIX platforms.
This led to the Wrapper to using an offset UTC0000.
* Take out the warning about unset LANG environment variable on Linux and
AIX systems. On system startup, some systems fail to set the LANG
environment variable. This is not really a problem for the Wrapper and the
warning was causing confusion for users so we decided to remove it.
3.5.9
* (Standard, Professional) Fix a problem on Windows where network adapters
whose names contained "PRO/1000" were being removed from the list of hostids
displayed when "wrapper.exe -h" was run. This did not affect existing server
license key files generated for hostIds reported by 3.5.7 or earlier, or
development license keys. But it did cause the Wrapper to report that no
valid hostIds could be found when the Wrapper was started without a license
file. This was caused by some test code added in 3.5.8 that we failed to
remove.
* Fix a problem where the Wrapper was not correctly yielding control back to
its main loop when very large amounts of continuous output was being logged
from the JVM. Introduced in version 3.4.0. In versions prior to 3.5.8, this
could have caused the JVM to timeout and restart itself. That particular
issue was resolved but the Wrapper process in 3.5.8 would still have been
unresponsive when this was happening. The Wrapper will now always yeild back
to its main loop after 250 milliseconds of continuous logging.
* Fix a problem where the WrapperManager could block trying write debug output
if the current user application was writing very large amounts of output to
the console as well. In extreme circumstances this led to the Wrapper
thinking that the JVM was frozen. This was only an issue if debug output was
enabled.
* Restructured the shell script so all editions now use the same script again.
3.5.8
* (Standard, Professional) Starting with version 3.5.5, we invalidated the use
of all 00ff* hostids on Windows to avoid problems with changing hostids when
users have a Juniper Network Connect network adapter on their system. This
turned out to be too restrictive as Guest OSs running under Parallels also
make use of this hostid range. The Wrapper is now more careful to only
invalidate actual Juniper Network Connect hostids.
* (Standard, Professional) Improve the message shown to the user when the
Wrapper is unable to locate any hostids for a system.
* Fixed a problem with the wrapper script on Solaris, where the option -F was
not available for grep.
* Added Windows version information on the wrapper debug output.
* Added a wrapper.log.warning.threshold property which makes the Wrapper show
a warning whenever it detects that the Wrapper took a long time to record a
log message. This was added to test a reported issue caused by slow IO on
very heavily loaded systems.
* Added a new 'G' log format to log the time in milliseconds of the previous
log message. See documentation with the wrapper.log.warning.threshold
property. Added to the wrapper.console.format, wrapper.logfile.format, and
wrapper.logdialog.format properties.
* Fix a problem where a filter that requested the JVM to restart would be
ignored if the JVM exited on its own immediately. The Wrapper is now more
consistent so that restart requests from within the JVM or filters will
always take priority over such exit requests. External shutdown requests, or
those from other actions will still behave as they did in the past and
continue to shutdown the Wrapper. The Wrapper also logs messages in debug
output if an outstanding restart request is being preserved or ignored.
* Fixed a problem in the AppCommand.bat batch file which could occur on some
Windows platforms with certain multi-byte system encodings. The script has
been rewritten and questionable parts have been simplified. The functionality
of the script has been preserved.
* Added the environment variable WRAPPER_CONF_DIR, which can be used for
the configuration properties. Feature Request #3160644.
* Made the script exit with the right exit code received when running the
script as different user, specified in RUN_AS_USER. Bug #3185281.
* Fix an access violation which could happen when reporting that the code
signing certificate has failed to been verified.
* Log an error if the backend socket is forcibly closed externally. It had
been getting logged at a debug log level. The message is "An existing
connection was forcibly closed by the remote host. (0x2746)". Because the
message was only logged if debug output was enabled, the JVM would be
restarted with no clear explanation as to what happened. The source of the
socket closure is under investigation.
* (Professional) Added the Java call fireUserEvent to the WrapperManager API.
This enables to fire user event mails, actions without the filter trigger.
* Fix a warning on Mac versions if the configured java command was not a
universal binary. A check was added in 3.4.0 to make sure that the
wrapper.java.command pointed directly to an executable to avoid unexpected
behavior when running a script. The message is only a warning and the
Wrapper continues regardless. Standard ppc, ppc_64, x86_64, i386, as well
as the universal binaries will now all work correctly without a warning.
* The default value of the wrapper.*.umask properties is using the current
umask the process has. Before the default value was always 0022.
* Add a new wrapper.backend.type property that is used to control whether the
Wrapper communicates with the JVM using the traditional "SOCKET" or new
experimental "PIPE". This was added as a workaround to a rare problem where
some Windows machines are closing the socket at an OS level. This was only
ever seen on Windows 2003, but could exist on other Windows versions as well.
* Add a new experimental wrapper.use_javaio_thread property which causes the
Wrapper to handle all java console output in a dedicated thread.
* Add a new WrapperManager.isNativeLibraryOk() method which lets user code
easily test whether or not the native library was loaded and initialized on
startup.
* Add a new PAUSE_THREAD command to the wrapper.commandfile property which
makes it possible to test how the Wrapper behaves when various threads block
or freeze. This was used to simulate and reproduce issues on heavily IO
bound servers.
* Improve the way the Java side of the Wrapper behaves when the Wrapper fails
to ping the JVM for an extended period of time. The JVM used to exit to let
itself resync itself with the JVM. This was causing problems on systems
which were heavily IO bound because the Wrapper could block for a while while
trying to write to the log file and the JVM was exiting. The JVM will now
never exit under such circumstances. The JVM will never become orphaned
because it will still exit almost immediately if the backend socket or pipe
with the Wrapper is ever closed.
* Deprecate the WrapperManager.appearOrphan() method as it is used to simulate
a failure mode which is no longer possible with the Wrapper.
* Changed the way the Wrapper is handling certificate errors regarding the
code signing/timestamping certificate. The Wrapper will now only shutdown
itself if the signature of the binary was not successfully verified because
the binary or signature has been malformed but not if any problem with
the counter-signer has been found. Starting with 3.5.7, the Windows Wrapper
binaries are signed. Some users with locked down Windows 2008 systems had
problems with the Wrapper refusing to start because the Comodo certificate
had been disabled on their system.
* Add a new wrapper.java.detach_started property which makes it possible to use
the Wrapper as a simple tool to launch Java applications. When enabled, the
Wrapper terminates immediately and the JVM is left to run on its own. Also
add new wrapper.java.outfile and wrapper.java.errfile properties which make
it possible to redirect the stdout and stderr of the JVM to files when
detached.
* When running the Wrapper as a specified User Account, through the
wrapper.ntservice.account property, the Wrapper will add permission for the
account to log on as service automatically upon install. Feature Request
#3286491.
* Fixed a problem binding the backend socket on Windows. If another process
bound a port inside the wrapper.port.min and wrapper.port.max range using the
SO_EXCLUSIVEADDRUSE option, the Wrapper would stop at this port report
an Access Permission problem and omits binding any further port in the range.
This problem existed ever since the Wrapper was released.
3.5.7
* Changed the way the script is installing the daemon gets installed on an AIX
system. The script now uses inittab & SRC.
* Fix a problem in the shell script that was preventing the script from
starting the Wrapper correctly if a file or directory existed in the current
working directory which was one character in length. This was only a problem
when the delta-pack naming of the Wrapper was used. This was easy to
reproduce on AIX systems on system restart because a "u" directory exists in
the root directory by default. This had been a problem since 3.4.0 when
it was introduced as a fix to a Solaris problem. The root cause was a
missing set of quotes in the tr command.
* Fix a problem in the shell script that was preventing the script from finding
the running wrapper process when it was started when the working directory
was in the same directory as the wrapper binary, but queried later from
another location. It would also fail if it was started from another
location, but then queried from the location of the Wrapper. This was
introduced in version 3.5.6 when the script stopped changing the working
directory in the script.
* Add a new GC action that will cause the JVM to immediately perform a full
garbage collection sweep. See the wrapper.commandfile,
wrapper.filter.action., wrapper.check.deadlock.action, and
wrapper.timer..action properties for details.
* (Professional) Modify the wrapper.event..command.block.action
property slightly so it will now correctly warn if an unknown action is
encountered. It had been defaulting to CONTINUE silently.
* Modify the timing of the message shown when an #encoding directive is missing
from the top of a configuration file. It was only being logged if debug
output was enabled. It will now also be logged if the #include.debug
directive is specified.
* Fix the indentation of warning messages about encoding or include problems in
configuration files.
* (Standard, Professional) Fix a problem where include file problems could
cause the shell script to have errors due to invalid translated output from
the Wrapper.
* Add a warning when the maximum include depth is reached and include debugging
is enabled. The Wrapper had always just silently skipped the include.
* Fix a problem where #include.required directive was not correctly preventing
startup if the include file was missing but the required include was in a
nested include.
* Fix a problem where the cause of some fatal include problems were not being
logged correctly, resulting in a simple, non-informative message only that
the configuration file failed to be loaded. This was a problem since 3.5.5.
* Fix a Windows problem where the Wrapper could fail to start as a service if a
defined environment variable would expand to a length larger than the 32k
limit specified in the ExpandEnvironmentStrings system function. This was a
problem on all Windows platforms prior to version 3.5.5, but only on Windows
2000 since then, when the code used to reload the environment from the
registry was disabled for newer versions of Windows. We now simply skip the
expansion of the problem variable and continue with a warning. Bug #3103776.
* Add a set of optional system properties that the WrapperSimpleApp,
WrapperStartStopApp, and WrapperJarApp helper classes are aware of to tell
them to ignore uncaught exceptions thrown within the main methods of the user
application. The exceptions will still be logged, but they can now be
configured so that the main method is just allowed to end without causing the
Wrapper to shutdown in an error state. Java on its own will stay running in
such a case as long as it has launched at least one non-daemon thread prior
to the uncaught exception being thrown. This does not affect most users, but
an application was found that was having problems because of this difference
in behavior. See the javadocs of the helper classes for details.
* (Professional) Fix a problem when looking for the correct exit code to use
for the wrapper.event..command.on_exit. property. The Wrapper
now searches for a value as follows:
wrapper.event..command.on_exit.,
wrapper.event..command.on_exit.default,
wrapper.event.default.command.on_exit., then
wrapper.event.default.command.on_exit.default. The third pattern had been
getting skipped in previous versions since it was added in version 3.3.0.
* (Professional) Add logic to report a warning if an unexpected value is
specified for the wrapper.event..command.on_exit. or
wrapper.event..command.block.action properties.
* (Professional) Clean up the message log levels so the output is as expected
when using the wrapper.event..command.loglevel property.
* (Professional) Improve the wrapper.event..command.on_exit.
property so the configured action will now work even if the command exits
after the block time out has expired. In previous versions, there was no
way to make the Wrapper do anything other than continue.
* (Professional) Fix a problem where the Wrapper was failing to detect a JVM
exit correctly if an event command had been fired first. The only problem
was that the Wrapper was always reporting a JVM exit code of 0 rather than
the actual exit code.
* Fix a buffer overflow on Windows when either installing as a service, or
updating an existing service. The problem only occurred when properties
containing spaces, or Java passthrough arguments containing spaces were
specified on the command line. The running service did not have any
problems. This was introduced in 3.5.0.
* (Standard, Professional) Improve the error message logged when an unlicensed
version of the Wrapper's native library is used.
* (Standard, Professional) Fix a buffer overflow problem on Windows when
creating a customized Wrapper binary if the target binary name did not
include the ".exe" extension. This problem existed since its intruduction in
version 3.3.7.
* The wrapper.exe, wrapperw.exe and wrapper.dll binaries are now being signed
on Windows making it possible to verify that valid Tanuki Software binaries
are being used.
* Implemented a way to install, remove, start, stop, etc., the Wrapper as a
Windows service from a non-elevated (UAC) console. The Wrapper is elevated
transparently using a child process. This is needed starting with Windows
Vista and 2008 for smooth interaction with the Windows Service Manager.
* (Standard, Professional) Fix a problem where the wrapperjni_*.mo localized
files were not being loaded correctly. These messages are only shown when
debug output is enabled. Application and Wrapper localization was working
fine. Introduced in 3.5.5.
* (Standard, Professional) Enhanced the ability to run with localizations
other than the system language on Windows. The Wrapper process locale was
not being set correctly. So Japanese text was not always showing correctly
if the wrapper.lang property was set when the OS was English or German.
The Java process still has an issue where it will always start with the
system default value for the file.encoding system property. This can still
cause problems writing Japanese text when the file.encoding is German for
example.
* Added support in the shell script for starting/installing the wrapper on
system boot with Upstart.
* Fix a problem in the shell script where it would fail to recognize a running
Wrapper if the Wrapper command line or path contained a square bracket.
* Modify the way we test for the existance of the temp directory so we now
generate our own file name rather than using File.createTempFile. On some
systems createTempFile was taking a long time because it requires that Java
initialize its internal entropy. We discovered that large numbers of files
in the java.tmpdir directory makes Java's entropy initialization code very
slow. This has been a potential issue since 3.5.0.
* Fixed a problem on Windows where passthrough arguments after a "--" which
contained spaces were not being passed through to the JVM intact, they were
being split at the spaces into multiple arguments.
* Fix a problem on Windows where the Wrapper could sometimes crash on shutdown
if more than one thread got into the cleanup code at the same time. This
did not affect running applications and was only an issue on shutdown. It
was more likely if a language pack was loaded. Introduced in 3.5.3.
3.5.6
* Fix a problem on UNIX platforms where the log file path was being calculated
incorrectly if an absolute path was specified for wrapper.logfile, and the
file did not already exist. A warning message was being displayed but the
Wrapper would continue using the default log file. There was a problem in
the message displayed which caused a crash on some platforms include Mac OSX.
Introduced in version 3.5.5.
* Fix a problem on Windows platforms where the Wrapper would crash if it could
not access the directory of the configured wrapper.logfile.
Introduced in version 3.5.5. Bug #3087424.
* Improve the way warnings are logged when there are problems writing to the
configured wrapper.logfile so that the message will now be logged into the
log file that the Wrapper ends up using in case it is successful in falling
back to a default log file.
* Fix a problem on Windows platforms where wrapper.java.additional.
properties that were specified on the command line, and contained spaces,
were not being requoted correctly when building up the Java command line.
Introduced in version 3.3.6.
* Fix a problem where the warning message logged for invalid values of the
wrapper.java.additional. property, contained corrupted text. Introduced
in version 3.3.6.
* Fix a problem on UNIX platforms where an invalid value for the
wrapper.java.additional. property was correctly being reported and then
skipped, but the resulting command line to launch the JVM had a blank value
that was causing the JVM to fail to launch. An invalid value is any value
that does not begin with a "-" character.
* Add a new WRAPPER_INIT_DIR environment variable which can be used to
reference the working directory from which the Wrapper was launched. This is
needed for certain applications because the Wrapper always changes its
working directory to the location of the Wrapper binary.
* Modify the UNIX shell script so it no longer changes the current working dir
to the location of the script. This is no longer needed because the Wrapper
has been changing the working directory to its own location since version
3.2.0.
* Add a new wrapper.request_thread_dump_on_failed_jvm_exit.delay property to
control how long the Wrapper will wait after doing a thread dump before
killing the Java process. This delay has always been hardcoded to 5 seconds.
* Clean up the text of several warning messages about invalid configuration
values to make them more consistent.
* (Professional) Add a new wrapper.jvm_kill.delay property which makes it
possible to control the amount of time to allow between the jvm_kill event
being fired and the JVM actually being killed. Useful if an external event
command is fired that needs to do something with the JVM process first.
* (Professional) Fix a problem where the output of the
wrapper.event..message and wrapper.event..loglevel
properties were not displaying correctly on UNIX platforms.
* (Professional) Fix a problem on UNIX platforms where the Java side of the
Wrapper was not being correctly notified if a large number of child
processes that had been launched with WrapperManager.exec, exited at the
same instant. Some of them were going into a defunct state until the next
child exited, at which point they would be cleaned up. This was mainly an
issue on JVM shutdown if the user code was calling WrapperProcess.waitFor()
as part of its shutdown process. WaitFor calls at any point were getting
stuck and would remain so until another child exited. As part of this fix,
there were also several changes to the Windows implementation to bring the
two code bases into sync.
* Fix a problem on Windows when multiple threads were creating Childobjects,
Handles could have been unintendedly get inherited by another Child Process,
causing problems on reading/writing to the Input/Output/Errorstream.
* Fix a problem on solaris and AIX when errno calls were not thread safe due
to a compiler switch.
* Fix a problem where debug level warning output while loading the Wrapper
configuration was being displayed on startup. This could be fixed because
the Wrapper actually loads the configuration twice, and such output is now
only logged on the second call.
* (Standard, Professional) Remove the undocumented ability to define a single
file share mapping without the index. This would cause confusion if used,
and complicated the code.
* (Standard, Professional) Fix a byte alignment problem caused by a bad
compiler directive on Windows platforms. It was known to cause a crash when
defining mapped drives on 64-bit Windows versions. The problem was in the
source since version 3.3.7, but is not known to cause any other issues.
* (Standard, Professional) Modify the messages displayed when network shares
are mapped or fail for some reason. Also add messages about them being
unmapped on shutdown.
* On some Windows platforms, a failure to delete a rolled log file was not
being reported correctly. The system function to delete a file was
returning success even if it had failed. We now double check.
* Fix a deadlock in the code that is used to send data to the Java process.
It was only possible if debug level output was enabled and log file rolling
was enabled. Introduced in 3.3.7.
* Fix a problem where the Wrapper was not notifying the JVM whenever the log
file was rolled and the new name was the same as the previous one, as it is
when wrapper.logfile.rollmode is anything other than NONE or DATE.
* Fix a problem where the WrapperManager.getWrapperLogFile() was not returning
the accurate log file name until the first time the log file was rolled after
each JVM invocation. This was only noticeable if the wrapper.logfile
contained either the "ROLLNUM" or "YYYYMMDD" tokens.
* Correct an error message that was displayed on UNIX platforms when the
configured java binary could not be accessed. The message referenced a
buffer whose contents were undefined on some platforms.
* Fix a problem on z/OS where due a difference in the API used to lock a
mutex compared to all other UNIX platforms, the mutex's locking and
unlocking code were effectively being ignored. This means that multiple
threads were able to access code which was not thread safe and could lead to
a crash of the Wrapper. This is a problem that has been in the code since
the first z/OS release and is not known to have actually caused any problems.
Starting with 3.5.1, this was only an issue if debug output was enabled.
Versions 3.3.9 through 3.5.0 could have also had problems whenever the
Wrapper received a system signal.
3.5.5
* Add new wrapper.filter.trigger. action, "SUCCESS". If this gets triggered
then the Wrapper will treat the current JVM invocation as a success, and
reset its internal failed invocation counter. This is useful for
applications that need to be restarted frequently.
* (Standard, Professional) Ignore Juniper Network Connect hostIds as they
change on each reboot and are thus unreliable as hostIds.
* Added a PASS_THROUGH setting to the UNIX shell script and Windows
AppCommand.bat.in files which tells them to pass any extra arguments directly
on to the JVM when it is launched.
* Added a FIXED_COMMAND setting to the UNIX shell script and Windows
AppCommand.bat.in files to make it possible to run either without specifying
a command. Mainly useful in conjunction with PASS_THROUGH.
* (Standard, Professional) Added a --passthrough option to the exe
customization, in order to tell the wrapper to precede the whole command line
through to the application in the JVM.
* (Standard, Professional) Added a --conf option to change the default conf
file, the wrapper tries opening when no conf file was explicitly specified.
* Added wrapper.ntservice.account.prompt. If set to TRUE the wrapper will
prompt for all account details (domain, account name, password).
* Fix a minor issue in #include file declarations where a leading space was not
required.
* Add a new #include.required directive which works the same as the #include
directive except that it will output an error and prevent the loading of the
configuration if the included file does not exist. Normally include files
are optional by design.
* Modify the error messages displayed when configuration files fail to load so
they now provide more information about where specifically the problem was.
* Disabled the forced reloading of the SYSTEM (and if set to a specific
account, the user) registry before launching the Wrapper as a service on
Windows. This was done originally in Windows NT because changes to the
configured environment were not being reflected when running a service unless
the system was first rebooted. Microsoft appears to have solved this problem
in Windows XP and 2003. In Windows 7 and 2008, this was actually causing a
problem because the SYSTEM registry contains a setting "USERNAME=SYSTEM" by
default that was overwriting the USERNAME when run as specific user. It was
decided to disable this registry loading for Windows versions starting with
XP and 2003. Of the supported versions, only 2000 is now reloading its
environment. The only difference from version 3.5.4 and earlier that could
be found is that when running as the SYSTEM user on Windows 7 or 2008, the
USERNAME environment variable will now be set to the host name followed by a
dollar sign rather than SYSTEM. This is actually how all other services
work. But just in case this is a problem, it can we resolved by adding a
"set.USERNAME=SYSTEM" property into the Wrapper configuration file.
Bug #3061490.
* (Standard, Professional) Fix a problem for Solaris and HP-UX where the socket
timeout properties for the email notifications were ignored.
* (Standard, Professional) Added wrapper.ntservice.recovery. properties to
define system level actions in the event that the Wrapper process itself
has a failure.
* (Standard, Professional) Fixed a problem in the WrapperProcess.waitFor() and
WrapperProcess.exitValue() call, where it would fail to return when called
after the Wrapper had initiated the shutdown of the JVM.
* (Standard, Professional) Add WrapperProcessConfig.setSoftShutdownTimeout(int)
method to tell the Wrapper how long to wait after nicely asking the child
process to shutdown cleanly when calling WrapperProcess.destroy(). Once the
timeout has ellapsed, the child process will be forcibly terminated. This
timeout had been hard coded to 5 seconds in earlier versions.
* Add more detailed usage output to the UNIX shell script.
* Make it possible to 'pause' and 'resume' the JVM from the UNIX shell and
Windows batch scripts.
* (Professional) Fix a minor memory memory leak while initializing timers.
* Fix a memory leak which could happen if there were any invalid strings in
localization resources.
* (Professional) Fix a bug where the wrapper.event..command.argv.
properties were not correctly parsed on Windows. This issue was introduced
in version 3.5.0.
* (Professional) Add the ability to define wrapper.event.default.command.argv.
properties that will be used if the event specific specific commands are not
defined. Mainly useful for testing.
* Fix a problem occuring when the wrapper failed to roll the log file causing
to write to the wrapper's default log (wrapper.log) file rather than
continuing to write to the current logfile.
* (Standard, Professional) Fix a put problem in the internal hash map
implemenation used for localization where values could be lost. This was
not a visible issue because of the data used.
* Add new wrapper.filter.allow_wildcards. property and make it possible to
specify wrapper.filter.trigger. patterns which contain '*' and '?'
wildcards.
* Add a commented alternative in the default OutOfMemoryError filter
configuration to make it more specific to only trigger on uncaught exception
stack traces. This is to avoid output like that from the
-XX:+PrintClassHistogram JVM argument from causing the JVM to restart with a
false out of memory warning. See the wrapper.filter.trigger.
OutOfMemoryError example for more details.
* Localize the default filter message.
* Added ISO-8859-* encoding support and a few other encodings.
* (Standard, Professional) Fix a problem on UNIX versions, parsing dates in
license keys that was introduced in version 3.5.0. Windows verisons did not
have this problem. All license upgrade terms and lease terms which contained
"08" or "09" as either a month or day were being parsed incorrectly. This
was leading the Wrapper to interpret those date components as "00". If the
number was the date, then this would cause the date to be set to the last day
of the previous month. If it was the month however, it would cause the date
to be set to December of the previous year. For example "2010-08-20" was
being interpreted as "2009-12-20", and "2010-10-08" was being interpreted as
"2009-09-30". This would have prevented some licenses from being able to
start because the upgrade terms were in effect prior to the Wrapper's release
date. Some trial licenses could also have stopped early because their lease
term end was earlier that it should may have been. For normal licenses, his
will have no effect on installations once they are up and running because
they do not use the lease term.
* Fix a problem on Windows when a service received several service control
codes in rapid succession. Since version 3.5.1, the Wrapper was only to
process a single control code in each cycle of its main loop. This was
resulting in messages like "Previous control code (4) was still in queue,
overwriting with (4)." in the logs. The Wrapper can now handle up to 25
control codes per 10ms cycle.
* Fix a problem where it was not possible to send passthrough arguments to the
JVM when installing or updating a Windows Service. Passthrough using the
"--" argument was added in 3.5.2.
* Add a new wrapper.pause_on_startup property which makes it possible to tell
the Wrapper to go directly into a paused state without ever launching a JVM.
* Fix a problem where the STOP command set in a command file was being ignored
if the Wrapper was currently in a paused state.
* Make it possible to specify DEFAULT for the configuration file encoding.
This will cause the file to be loaded using the default system encoding. We
added this by request, but recommend using a portable encoding like UTF-8 to
ensure that the configuration file will load correctly on all systems.
* Added a WRAPPER_LANG environment variable which makes it possible to reference
the current locale language code in the configuration file. One common use
is to do localization using inclues.
(e.g. #include ../conf/wrapper-%WRAPPER_LANG%.conf)
3.5.4
* Add optional support for custom public static methods in the
WrapperSimpleApp and WrapperStartStopApp helper classes. Feature Request
#2812276.
* Add a new special configuration file directive "#properties.debug" which
enables debug output about the properties as they are loaded by the
configuration file. This can be useful to tell if and why certain properties
are being overwritten. Feature Request #3042959.
* Fix a minor problem where the "#include.debug" configuration file directive
was sticky so it would be enabled when the configuration file was reloaded
even if the reloaded configuration file no longer had the directive set.
This was only an issue if the wrapper.restart.reload_configuration property
was set.
* Messages about missing included configuration files that were output when the
#include.debug" configuration file directive was active were being logged at
the ERROR level even though they were not problems.
* Fix a minor problem where the WRAPPER_JAVA_HOME environment variable was not
correctly being set to final when it was set internally by Wrapper. This
could lead to unexected results if the user overwrote it later in their
configuration file.
* Fix a problem on AIX and z/OS, when running the Wrapper without any
arguments. The Wrapper was attempting to use the default wrapper.conf file
but the check for the file was failing causing the Wrapper to continue even
though the file did not exist. This caused a confusing error message to be
displayed, but was otherwise harmless.
* Clean up some debug code associated with sleeping where log output was being
queued when it did not need to be.
* (Standard, Professional) Consolidate some redundant code associated with
waiting for interfaces on startup.
* (Professional) Fix a problem in the email feature of the Wrapper where a
subject of more than 27 bytes in length when encoded as UTF-8. This was
caused by a miscalculation in the Base64 conversion of the subject.
* (Professional) Fix a problem when the WrapperManager.exec method which takes
an array of command elements was called on Windows. The command elements
need to be combined into a single command line, but if any of the elements
contained spaces, the resulting command line was not being correctly quoted.
* Add a new wrapper.java.command.resolve property to control whether or not the
Wrapper tries to resolve any symbolic links in the Java command, specified
with the wrapper.java.command property. Historically, it has always done so,
but some jvm started applications like run-java-tool on Gentoo will fail if
it is run directly as they have a check to make sure it is launched via a
symbolic link.
* Fix a problem on Windows versions where a path to the Wrapper binary,
including the Wrapper binary itself, which was more than 100 characters would
cause a buffer overflow when installing the service. A second similar
problem would happen if the same path was more than 128 characters, whenever
the Wrapper was launched. These were both very old issues and only happened
on 32-bit versions of Windows XP and 2000. Microsoft documentation says that
the issue should also exist on the 64-bit versions, but we were unable to
reproduce it there. Newer versions of Windows are all fine.
3.5.3
* Fix a typo in the UNIX shell scripts that was causing "command not found"
errors to be shown when running the Community Edition.
* Add new wrapper.console.fatal_to_stderr, wrapper.console.error_to_stderr,
and wrapper.console.warn_to_stderr properties to control whether the output
at the FATAL, ERROR, and WARN log levels go to stdout or stderr. In the past
they all went to stdout. With this change, FATAL and ERROR log levels now
default to stderr output.
* Fix a problem where the shell script would produce unexpected results if the
Standard or Professional Edition shell scripts were used with the Community
Edition Wrapper. Fix was in Wrapper binary by changing the default ERROR and
FATAL log level console output to stderr rather than stdout.
* (Standard, Professional) Fix a problem where script error message output was
not being shown if the wrapper.conf file specified in the script did not
exist.
* Fix a problem where errors from failed forks on Windows were always being
flushed immediately rather than honoring the value of the
wrapper.console.flush property.
* Fix a problem on Windows 2000 systems where a new feature added in 3.5.2 was
preventing the Wrapper from running because the API used was too new.
* Change the font of the wrapperw dialog in order to have prettier output of
multibyte characters.
* Add a line feed after the first message when starting the Wrapper from the
UNIX script.
* Add a note in the debug output so the configured java temporary directory is
always logged to help with debugging.
* Add a workaround for a bug in both Sun and IBM JVMs which cause an invalid
exception to be thrown when a socket is already bound. It had been causing
the Wrapper to report: "Unexpected exception opening backend socket:
java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind":
http://bugs.sun.com/view_bug.do?bug_id=6965962
* Add the encoding of the subjects in the event mails to be always UTF-8
Base-64 encoded.
* Add new wrapper.event..email.smtp.auth.type,
wrapper.event..email.smtp.auth.userid, and
wrapper.event..email.smtp.auth.password properties which make it possible
to do LOGIN and PLAIN connection authorizations. Currently SSL (STARTTLS)
connections to the mail are server are not yet supported.
* Fix a buffer overflow while loading the configuration file on Mac OSX
versions. Introduced in 3.5.0.
* Fix a several memory leaks on UNIX versions that were added in 3.5.0, as well
as a few others on all platforms, some from quite early versions.
* Fix some places where a resolved path of exactly MAX_PATH characters in
length could have resulted in a buffer overflow.
* (Standard, Professional) Fix a memory leak disposing language packs.
* Go through and increase the consistency of text strings.
* Fix a problem on HP-UX where the Wrapper was logging a warning that the
configured JVM was invalid if it was a PA-RISC 2.0 binary. Bug #3037317.
* Fix a problem where the WrapperManager was failing to trap and hide errors
initializing the MBean server on some JVMs that did not support it.
3.5.2
* Added new command line argument "--" . All arguments following will be
preceded and passed to the java application. The arguments are attached after
the arguments used in wrapper.app.parameter.
* Fixed a problem in the shell script which could lead to report failed starts
of a daemon incorrectly on the command line.
* Implemented some small logic in the wrapper script which tries to change the
permissions of the wrapper binary to executable if it wasn't set.
* The Demo Application had problems locating the right conf file on Unix
platforms and failed to launch the internal demonstration wrapper process.
* Improved the error message logged if the Windows version of the Wrapper exits
with an internal error. It now logs more information about the internal
state of the Wrapper as well as saving a mini dump file which can be sent to
support to make it easier to diagnose the cause of the problem.
* Fix a problem where the names and displayNames in WrapperWin32Service
instances were corrupted. List affected the WrapperManager.listServices()
and WrapperManager.sendServiceControlCode() methods. There was a similar
problem with the WrapperManger.getUser(), WrapperManager.getInteractiveUser()
and WrapperManager.setConsoleTitle() methods. Introduced in 3.5.0.
* Fix a problem on Windows where wildcards would sometimes fail to be resolved
or cause the Wrapper to crash. This affected the generation of classpaths
and logfile rolling. Introduced in 3.5.0.
* Fix a problem on UNIX platforms where some error messages related to a failed
fork to launch the JVM were not being logged correctly. Introduced in 3.5.0.
* Fix a problem where invalid characters in configuration files that did not
declare an encoding could cause the Wrapper to crash on startup. This could
be issue for users upgrading from versions prior to 3.5.0 as older versions
did not do any character set translations and would not have had a problem.
* Fix a problem in code to check whether a drive was a mapped network drive or
not was failing. This would sometimes lead to a false warning that the drive
could not be identified. Introduced in 3.5.0.
* Add a new ACCESS_VIOLATION command to the wrapper.commandfile property to
test how the Wrapper and external systems behave if the Wrapper were to
crash. Only enabled when the wrapper.commandfile.enable_tests property is
enabled.
3.5.1
* Start using a system function to determine whether or not a character in the
configuration file is a control character or not. This way it works on
non-ASCII platforms.
* (Standard, Professional) Fix a crash on Windows platforms caused by freeing
up unallocated memory while loading the Wrapper's configuration.
* Add debug output describing the system and current code pages on Windows
versions to help understand encoding and mojibake issues.
* Add a Japanese localized src/conf/wrapper.conf.in_ja template configuration
file to assist Japanese users.
* Fix an potential deadlock on UNIX platforms if the JVM exits while logging
is taking place and the wrapper.debug or undocumented wrapper.state_output
properties were set to TRUE.
* Fix a problem where a failed JVM invocation that happened immediately after
being launched would cause the Wrapper to immediately give up and shutdown.
This should not have been possible with normal JVM configurations, but was
turned up in testing.
* Fix a problem where some startup output of the tick timer debug output was
corrupted. This was only an issue if the wrapper.tick_output property was
set.
* (Standard, Professional) Rework the way text is localized so that mallocs
are all handled on initialization. 3.5.0 had problems with occassional
freezes and crashes caused by mallocs being made within signal handlers.
The problems were rare unless debug output was enabled.
* Greatly simplify signal handlers on all platforms so they now do as little
as possible, actions are now queued and then processed by the main thread.
* (Standard, Professional) Fix a problem where the hostname in the
wrapper.syslog.remote.host couldn't resolve a hostname (IP Address was
working).
* (Standard, Professional) Add debug output on Windows versions to help debug
localization and code page issues.
* (Standard, Professional) Fix a localization problem on Windows where the
Wrapper was using the system-wide language rather than that of the current
process. This was resulting in mojibake if the Wrapper was launched in a
new console if that new console did not support the required code page.
This was only an issue if the user had changed the active code page from the
default for their Windows desktop.
* Fix a problem on Windows platforms where the JVM child output was being
logged with an extra line feed in some cases.
* Fix a problem running the DemoApp from some Network shares on Windows.
* Add a new WrapperManager.isWindows() and WrapperManager.isMacOSX() methods to
make it easy to write such conditional code as both platforms can require non
standard code.
* (Standard, Professional) Make the GetHostId.bat file more robust so it can be
executed using a relative reference from the command line. It also now
supports Delta-pack style Wrapper binary naming and falling back to use which
binaries are available.
* Change the timing of when the wrapper.working.dir is set so that any error
messages generated while loading the configuration will be logged to the
correct log file. It is also needed for Standard and Professional Editions
to ensure that the language pack is loaded from the correct location so that
all such messages will be in the correct locale.
* Fix a problem on UNIX platforms where the status command was failing with an
error due to the localization feature added in 3.5.0.
3.5.0
* (Standard) Added the ability to detect and react to thread dead locks in
the JVM. Requires at Java 1.5. Added wrapper.check.deadlock,
wrapper.check.deadlock.interval, wrapper.check.deadlock.action, and
wrapper.check.deadlock.output properties to configure the detection.
* (Professional) Add a new jvm_deadlock event which is fired in response to
a thread deadlock being detected within the JVM.
* Fix a problem where the intervals like wrapper.ping.interval were all
rounding down causing them to function at a rate one second shorter than
configured.
* Fix a minor memory leak calling WrapperManager.exec.
* Add a new wrapper.filter.message. property which can be used to control
the message which is logged when a wrapper.filter.trigger. is matched.
* Rework the way actions are fired for the wrapper.filter..action and
wrapper.timer..action properties so there is no longer any duplicate
code.
* Modify the way the wrapper.filter..action and wrapper.timer..action
properties work so it is now possible to specify a list of actions which will
happen in the order specified. This makes it possible to do a thread dump
and then restart in response to an error.
* Add the DEBUG action to the wrapper.filter..action property for
consistency.
* (Professional) Implement the ability to fire user defined events as actions
of the wrapper.filter..action, wrapper.timer..action, and
wrapper.check.deadlock.action properties.
* Fix a problem in the WrapperProcess.destroy() function, when a child process
couldn't have been forcibly killed.
* Add GetHosdID.bat file for Windows platforms. This file will open a dialog
displaying the HostId of the machine.
* Fix a problem in the shell script which, on a rc based OS, could lead to
problems starting the Wrapper when the APP_NAME in the script contained
capital letters.
* (Standard, Professional) Added a set of wrapper.share..* properties which
makes it possible to configure the Wrapper to map specific network resources
before launching the JVM on Windows.
* Corrected the way the Wrapper is installing itself as a Windows service when
the binary and/or conf file are located on a Mapped Drive.
* Add new wrapper.pausable and wrapper.pausable.stop_jvm properties to control
whether the JVM can be paused or not, and deprecate the use of the Windows
specific wrapper.ntservice.pausable and wrapper.ntservice.pausable.stop_jvm
properties.
* Modified the wrapper.commandfile property so PAUSE and RESUME commands are
now supported on all platforms at any time.
* Modified the wrapper.filter.action. property so PAUSE, RESUME, and DEBUG
actions are now supported.
* (Professional) Modified the wrapper.timer..action property so PAUSE and
RESUME actions are now supported.
* (Professional) Modified the wrapper.event..command.block.action
property so PAUSE and RESUME actions are now supported.
* Added new WrapperServicePauseEvent and WrapperServiceResumeEvent classes to
make it possible to notify an application that it has been paused or resumed.
To date, this was only possible when the Windows service was paused or
resumed
* (Professional) Add new "wrapper_pause" and "wrapper_resume" event types that
are fired whenever the Wrapper is paused or resumed.
* Enhance the command line parsing for the WrapperManager.exec() command. The
single commandLine version of the exec call will handle quotes more
sophisticated.
* Modified the wrapper.syslog.ident property so its value is now silently
trimmed to 32 characters in length. This is needed to avoid problems with
syslog servers. (See RFC 3164 section 4.1.3)
* (Standard, Professional) Add new wrapper.syslog.remote.host,
wrapper.syslog.remote.port, and wrapper.syslog.local.host properties which
can be used to redirect all syslog (UNIX) or Event Log (Windows) output to
a remote syslog server.
* Add support for the wrapper.syslog.facility property on Windows so remote
syslog entries can be sent from Windows versions of the Wrapper.
* Add debug output from the WrapperManager class which shows information about
the current wrapper.jar, including its size, location, and MD5 hash.
* Add a check for wrapper.java.classpath. entries containing quotes. The
quotes are now stripped and a debug warning logged.
* (Standard, Professional) Increase the size of the wrapperw.exe error dialog
so it is a little easier to read. Also changed the font for the same reason.
* (Standard, Professional) Modify the title of the wrapperw.exe error dialog
so it now includes the value of the wrapper.displayname property.
* Add a new check for the writability of the configured Java temporary
directory. When running on Vista, it will not be writable and can lead to
errors.
* Added new wrapper.java.tmpdir.required and wrapper.java.tmpdir.warn_silently
properties to control whether the temporary directory is required.
* Add a note in Wrapper conf template showing users how to configure a specific
Java version to use.
* Add a new CLOSE_SOCKET command to the wrapper.commandfile property and added
a new wrapper.commandfile.enable_tests property to control whether it can be
used.
* Fix a debug warning while shutting down caused by one thread closing the
backend socket when another expected it to be open.
* If the backend socket between the JVM and Wrapper is somehow closed, make the
JVM respond promptly by restarting the JVM immediately to resync with the
Wrapper. Added log information to make it clear when this happens.
* Add a new wrapper.use_tick_mutex property to control whether or not the
internal tick timer is protected by a mutex. (Experimental)
* (Standard, Professional) Add support for zLinux 32 and 64-bit on s390 and
s390x systems.
* Change the internal encoding of the wrapper from native characters to
UNICODE. This will allow the wrapper to handle correctly any characters in
its configuration file and internally.
* (Standard, Professional) Implement a new WrapperResources class which makes
it possible for user applications to localize their applications using the
same methods common to native applications. The Wrapper uses this internally
to provide localized versions of the Wrapper.
* Remove the old org.tanukisoftware.wrapper.resources package as it is no
longer being used.
* (Standard, Professional) Add Japanese language pack to localize the Wrapper
to Japanese.
* Fix a problem in the WrapperManager class where unexpected exceptions thrown
in the main socket loop were being thrown away without being logged.
* Make the Wrapper more robust against failures removing the Wrapper's shutdown
hook on shutdown. It had been causing the clean shutdown of the JVM to fail
as an unexpected exit.
* Fixed a problem in the wrapper customize code where customized multi layer
icons may get scaled incorrectly by Windows. Bug #3015848
* Modify the wrapper.on_exit. property so it is now possible to PAUSE the
Wrapper when a JVM exits. This delays the restart of the JVM until the
Wrapper is resumed.
* Add a new log format, 'U', which logs the approximate time in seconds since
the Wrapper was launched. It is based on the internal tick timer and will
be a few percent lower than the actual number of seconds that have elapsed.
Added to the wrapper.console.format, wrapper.logfile.format, and
wrapper.logdialog.format properties.
* Fix a problem where deleting the configured anchor file was not recognized
if the JVM was not running at the time. The Wrapper was not noticing that
it was missing until the next JVM was launched.
* (Standard, Professional) Add a new NOTICE log level which is used to log
license related message. These will only show up trial license log output.
* (Standard, Professional) Add a new default 15 minute trial license which
can be used out of the box on any machine without the need to register and
obtain a trial license or purchase a license.
* Add a new wrapper.environment.dump property which will dump all of the
environment variables to the log, along with where the variables originated.
* Force the Wrapper to flush all logfile output for each line until the
configuration file has been loaded. There is normally no output up to this
point anyway, but this ensures that any errors are logged in a consistent
location.
* Move the registration of the main thread with the logging system up a bit
to make it possible to perform low level debug logging earlier.
* Add a set of checks to display an error and prevent the Wrapper from starting
if the batch or shell scripts being used are based on the TestWrapper demo
application. It is important that the user start with the default template
files in the distribution src/bin and src/conf directories to make sure the
integration goes smoothly.
3.4.1
* Fix a problem where the wrapper.app.parameter.1 property was always being
set to an empty string when launched from launchd on Mac OSX. It worked
correctly with the testwrapper application, but would fail for most user
applications.
* (Professional) Fix a potential synchronization problem in the log output
of the tick timer, event command and event email code. This had been in
the code since 3.3.0 without any reports of problems.
* Improve the error message displayed when the configured wrapper.java.command
can not be found on the path.
* Log the name of the signal in the logs when a SIGSEGV is detected from the
JVM. It had been logged as Unknown.
* Add some comments to the wrapper.conf.in template to help users get started
with a new license key file.
* Add some default properties to the wrapper.conf.in template file to make
it easier to get up and running with out of memory checks, as well as
sending out alert emails.
* Add a small debug message when running wrapperw.exe so it is clear which
wrapper binary is being used.
* Fix a problem where the wrapper.logfile.maxfiles was not being applied on
startup when the current log file did not yet exist. This was true for any
wrapper.logfile value which contained a unique value like a PID.
* (Professional) Fix a problem in the WrapperProcess.destroy() function, where
the function was failing to forcibly kill the child process.
* (Standard, Professional) Add a new GetHostID.bat file for Windows platforms.
This file will open a dialog displaying the HostId of the machine to help
new users get up and running.
* Add a new WrapperManager.appearOrphan() method which can be used to test
how the WrapperManager shuts down the JVM in the event that the Wrapper
process ever crashes or freezes. This was not due to any particular problem
and was added to fill out our test coverage.
* (Professional) Fix a problem where event commands were being left in a
defunct state after execution on UNIX platforms.
* Fix a potential problem on 64-bit versions where the internal tick timer was
not rolling over in the same way as the 32-bit versions. This has been in all
previous versions but is not known to have caused any problems. It was fixed
for consistency.
* Modify the WrapperManager class so it will now request a JVM hard exit only
after 4-times the ping timeout, in seconds, since the last contact with the
JVM. This had been 90 seconds more than the ping timeout, which was not
always long enough when the wrapper.ping.timeout was very large.
* Shift the initial start point of the tick counter so it will roll over 50
seconds after startup. This shouldn't be noticeable to the user, but makes
sure that this roll over is much better tested as it always happens the first
time on startup.
* Add a new wrapper.java.classpath.use_environment property which makes it
possible to set the classpath using the CLASSPATH environment variable rather
than including it on the Java command line.
* Fix a problem where requests to shutdown the Wrapper when in the state where
it was just about to launch a JVM would being ignored. This was fixed in all
editions, but was only an issue in the Professional Edition when the
wrapper.event.jvm_prelaunch.command.on_exit.=SHUTDOWN property was being
used with the wrapper.event.jvm_prelaunch.command.block=TRUE property and the
command exited with a code that triggered the SHUTDOWN.
* (Professional) Add a new wrapper.event..command.block.action
property to control how the Wrapper behaves when a command does not complete
execution within the configured timeout. Accepted values are CONTINUE, KILL,
KILL_SHUTDOWN and KILL_RESTART. Default value is CONTINUE.
* (Professional) Made it possible to use the "default" event type with the
wrapper.event..command.loglevel,
wrapper.event..command.block,
wrapper.event..command.block.timeout,
wrapper.event..command.on_exit., and
wrapper.event..command.on_exit.default properties.
* Fixed a single byte buffer overflow which takes place just before the JVM is
launched on Windows platforms. This was introduced in 3.4.0.
* Add a message pointing the user to the Wrapper's log file when the service
fails to start after it has been launched.
* Update the debug message displayed when attempting to open the backend socket
if the port is unavailable so it doesn't seem like a problem. It will retry
with another port.
* Work around an issue on some Solaris problems where the shell script would fail
if /usr/ucb/ps wasn't installed.
* Fix a problem on UNIX versions where the Wrapper would fail to resolve the
correct location of java if it was located using the system PATH, and that PATH
element pointed to a binary via a relative symbolic link. This was introduced
in 3.4.0.
3.4.0
* Increased the minimum supported Java version from 1.2 to 1.4.
* Removed the reflection code used to manage the Wrapper's shutdown hook.
The Runtime methods are now called normally.
* Add a note in the TestWrapper shell script to make it clear that the user
should always use the scripts in the WRAPPER_HOME/src/bin/ directory when
generating scripts for their own applications. This became more of an
issue because of changes to the TestWrapper script starting with 3.3.8.
Bug #2902843.
* (Professional) Added new WrapperManager.exec methods and a new
WrapperProcess class to allow the launching and management of child
processes through the Wrapper rather than using the standard Runtime
class. This makes it possible to clean up child processes when the
JVM crashes or is restarted, as well as solves severe memory issues with
the way processes are forked on some UNIX platforms.
* (Professional) Added a new wrapper.child.status.loglevel property to make
it easier to debug the status of child processes.
* (Professional) Added a new wrapper.child.count.interval property to control
the interval at which the number of waiting child processes is logged after
a JVM is shutdown.
* (Professional) Added a new wrapper.jvm_cleanup.timeout property to control
the amount of time that managed child processes still running after the JVM
has exited are given to shutdown before being forcibly killed.
* Fix a problem with WrapperManager.getUser() and getInteractiveUser() methods
which was preventing us from using the latest compiler on 32-bit Windows.
(The compiler used to build 32-bit Windows versions was rolled back to the
version used through the 3.3.5 release in 3.3.9 to work around the problem
that was causing these methods to always return null.) The change in this
version should not affect how the Wrapper functions.
* The old compiler used in 3.3.9 for Windows 32-bit builds was causing a false
hit on Symantec security software. The new compiler causes the Wrapper to
once again pass without any warnings.
* Added a warning while starting up the JVM which will be displayed if the
Java command in wrapper.java.command does not point to a valid java binary
file.
* [Changed the scripts and batch files to try to load the wrapper executable
according to the system, i.e. on 64-bit systems the 64bit binary of the
wrapper is attempted to be executed first and after this fails the 32 bit
gets attempted to be loaded. This behaviour is primaly useful with the
delta-pack of the wrapper.]
* Add some debug output logging the current timezone to assist supporting
time related problems.
* (Standard, Professional) Added a new wrapper.license.debug property which
will log information about the license key(s) being tested on startup.
* (Standard, Professional) Fix a problem where license validation was
failing at certain times of the day for servers with timezones east of
Japan. Development license keys which have their update times obfuscated
were not affected. This was a problem introduced in 3.3.7.
* Fixed a bug in the wrapper shell script which occurred when running the script
on a Solaris within a non singlebyte locale. Bug #2910327
* Fixed a potential bug in the wrapper script where requesting a Thread Dump,
the shell is sending the wrapper console to the background and returning
with a prompt.
* Fix a problem where Java log output would sometimes get extra line feeds
when under heavy load.
* Fix a problem which was leading to a resource not found error when trying
to start a service, if it was installed on a Mapped Network Drive under
Windows.
* Added some advice messages recommending the use of UNC paths if a resource
located on a Mapped Network Drive is used in the configuration file on
Windows versions.
* (Standard, Professional) Fix a bug in the wrapper binary customization,
which occurred when the source binary file was set to read only.
* Fixed a null string problem in the error message if a classpath value
wasn't found.
* (Professional) Added the option to include a logfile into the wrapper's
EmailNotification mails via wrapper.event.default.attach_log=TRUE
* Improve the message displayed when a user calls
WrapperManager.requestThreadDump() in JVM which does not have console
window on Windows. This should never be an issue when run with the Wrapper,
but can happen if running standalone without the wrapper binary.
* Update the Windows batch scripts so they now take AMD64 and IA64
architectures into account when deciding which version of the Wrapper to
run when using the delta pack.
* Update the UNIX shell script so it now does a much better job of resolving
the ideal platform bits to run the correct version of the Wrapper when using
the delta pack. Thanks to Leo Leung for the patch.
* Add install and remove commands to the UNIX shell script so it is now much
easier to install and remove the Wrapper on many UNIX plattforms to start
and stop on system startup and shutdown. Thanks to Leo Leung for the patch.
* Update the Windows batch scripts so it is now easier to change the location
of the Wrapper configuration file or rename the Wrapper binary when using
the scripts.
* Added a new QueryApp-NT.bat.in template script which can be used to query
the current running status of the service on Windows.
* (Standard, Professional) Add a new "-u" or "--update" command to the Wrapper
which allows you to effectively reinstall the Wrapper as a service without
having to provide the account credentials if the service is running as a
specific user. This is very useful for installers upgrading an application
to a new version.
* Add a new "update" command to the Windows AppCommand.bat.in batch script.
* Go through and clean up the messages displayed when controlling the Wrapper
as a service so the messages are consistent and more meaningful to the user.
* Add wrapper.wait_for_hostid and wrapper.max_hostid_timeout property.
This properties set if and how long the wrapper shall wait when starting up
until the hostid is available. This is important to make sure that server
licenses are validated correctly on UNIX platforms as the OS is booting up.
* (Professional) Fix a problem where environment variables referenced in
property values were not being expanded correctly the first time they were
referenced if the property's value was a default value. The underlying fix
was in all editions, but this was only causing a problem in the Professional
Edition where the WRAPPER_HOSTNAME variable was not being expanded in the
subject and body of emails sent out for the "wrapper_start" event if the
defaults were used.
* (Professional) Fix a problem where backslashes in the body of emails,
configured with the wrapper.event..email.body property, were
not being handled correctly when displaying things like paths from
environment variable references.
* Fix a problem on UNIX platforms where the Wrapper was displaying an error
about not being able to locate the configuration file when the Wrapper was
run without any arguments.
* (Standard, Professional) Improve the message shown when a License Key is not
found.
* Add a new message to the Community Edition when the user requests a HostId.
* Add WAIT_FOR_STARTED_STATUS and WAIT_FOR_STARTED_TIMEOUT to the script. This
lets the script wait (up to timeout sec.) when starting a daemonized process
until the process has been started.
Thanks to Dobes V. Feature Requests #2917391.
* Improve the error message displayed when the user tries to run the Wrapper
with the internal -s or --service commands.
* Fix a problem where the WrapperSystemPropertyUtil.getBooleanValue() method
was not correctly returning the specified default value when the looked up
property was missing. Also added a new getStringValue() method.
* Improve the error message displayed when the user tries to install and remove
the wrapper as Service on Windows Versions after Windows Vista.
* Add an advice message when MacOSX applications launched with launchd
encounter a "Returning nil _server" error when displaying a GUI.
3.3.9
* Modify the way JNI functions are called from within the native library so
they work correctly on platforms which are not ASCII based.
* (Professional) Add support for IBM z/OS 390 servers. This is still an alpha
release and will be made available on request.
* Improve the message displayed when a server license key is used on a
different server.
* Add a minimum max file size of 1024 bytes to the wrapper.logfile.maxsize
property to avoid the log file rotating too often if the user enters a
very small value.
* Add a message that shows up in the console when the Wrapper fails to write
to the configured log file. As with previous versions, it will then fall
back to writing to wrapper.log in the current working directory.
* On UNIX platforms, automatically set the wrapper.disable_console_input
property when wrapper.daemonize is set.
* Fix a problem introduced in 3.3.8 where relative configuration file includes
were failing to resolve correctly when the wrapper.working.dir and
wrapper.daemonize properties were used together. The wrapper.daemonize
property causes the configuration to be loaded twice on startup and the
working directly was not being reset correctly before it was loaded the
second time.
* Fix a problem introduced in 3.3.8 where wildcard selection of files on
Windows failed in some cases.
* Fix a problem introduced in 3.3.8 where setting the wrapper.logfile.maxfiles
property to 0 was causing all log files to be deleted rather than none when
the ROLLNUM file pattern was used.
* Revert the way rolled log files are deleted when using the ROLLNUM file
pattern to the functionality used in versions 3.3.7 and earlier. Files such
as wrapper.log.bak or other files manually created with the same log file
base name were also being deleted with 3.3.8.
* (Standard, Professional) Fix a problem where the close window button in the
title of the WrapperW log dialog was not correctly cancelling the dialog.
* (Standard, Professional) Fix a problem where the WrapperW log dialog would
sometimes fail to show itself on top of other windows if the splashscreen
had been displayed on startup.
* Fix a problem on 32-bit Windows versions where starting with he Wrapper,
the WrapperManager.getUser() and getInteractiveUser() methods were always
returning null. This problem was introduced in version 3.3.6.
* (Professional) Fix a buffer overflow when sending alert emails to multiple
addresses. This would sometimes cause crashes in versions 3.3.7 and 3.3.8
when sending alert emails to even a single recipient. Because of the nature
of the overflow, in most cases did not cause any problems.
3.3.8
* Add the new start type DELAY_START for NT Services, which startes the service
after other auto-start services are started plus a short delay.
* Fix a problem where the Wrapper's PID file was not being set to the correct
PID when the wrapper was launched daemonized. With the shell scripts that
ship with the Wrapper, this means that it would not be possible to stop the
Wrapper using the script because the expected PID did not exist. This was
a problem introduced in 3.3.7.
* Changed the timing for the wrapper's splashscreen when the splash screen
mode was set to JVM_STARTING. Now the splashscreen will disappear when the
JVM has been initialized.
* Fix a problem where the splashscreen was being shown when starting a service
or performing other command line operations.
* Remove some extra debug output on startup for Mac versions.
* Fix a crash in the Community Edition on PPC platforms of the Mac OSX version.
This crash has been reproduced in all versions starting with 3.3.1. The OSX
distribution is a universal binary but does not appear to result in a crash
on x86 servers. Standard and Professional Editions were not affected.
* Fix a problem on Windows versions where problems accessing the registry were
not reporting the correct error message. This did not cause any problems in
and of itself, but it made it difficult to track the down the cause.
* When wildcards are used in the classpath elements, the list of matching jar
files included in the classpath are now sorted to ensure that their order
is consistent across installations. Normally it would not matter, but if
certain classes or resources are redefined in multiple jars this will ensure
that the application now always works the same.
* Fix a problem where wrapper.logfile.maxfiles was being ignored when
wrapper.logfile.rollmode=JVM was set.
* Changed the way the wrapper.logfile.maxfiles property works with the ROLLNUM
token. Now when the log files are rolled, all files greater than maxfiles
count will be deleted. Previously, the Wrapper would roll within the maxfiles
count and ignore extra files if they existed. This would cause extra files to
be left around if the maxfiles property value was decreased.
* Add new wrapper.logfile.purge.pattern and wrapper.logfile.purge.sort
properties which make it possible to limit the number of log files in some
advanced cases. Be sure to read the documentation before playing with them.
* Fix a potential crash when referencing non-existent environment variables
in the value of wrapper.logfile.
* Modify the way all properties used to define file names behave so that
undefined environment variable references will now have their '%' characters
replaced by '_'. This is to avoid problems caused by file names containing
'%' characters on some platforms.
* Fix a problem introduced in 3.3.6 where the windows shown by the JVM or its
child processes could not be displayed when running in iteractive mode.
* Rework the TestWrapper application a bit so it can now be run in headless
mode for testing.
* Fix a problem on some UNIX platforms where the shell script was showing an
extra '-n' when run with the "start" command.
* Fix a problem for FreeBSD which could cause the wrapper being unable to stop
the wrapper daemon if the ps command buffer size (kern.ps_arg_cache_limit)
was too small to contain the wrapper command line.
3.3.7
* (Professional and Standard) Added the ability to customize the wrapper.exe
and wrapperw.exe binaries on Windows with a user specified icon and splash
screen.
* (Professional and Standard) Added a new wrapper.splashscreen.mode property
to control how long the splashscreen is visible.
* Fix a problem on SELinux where a strict security policy could lead the
Wrapper fail to load the libwrapper library. Thanks to Jean for the hint.
* Fixed a problem in the obfuscated license date, which caused a license to
be reported as invalid if run in a timezone west of Japan. This feature
was implemented in 3.3.6, but disabled on the site until the release of
version 3.3.7. Thanks to Leo for the hint.
* Added a new WRAPPER_PID environment variable. Feature Request #2870136.
* Added a new WrapperManager.getWrapperLogFile() method and
WrapperLogFileChangedEvent class that can be used to receive notifications
of changes to the Wrapper log file currently in use.
Feature Request #2870133.
* (Profesional) Improved the wrapper.event..email.to property
so it now supports the ability to specify multiple recipients.
3.3.6
* Introduce the wrapper.timezone property. This property allows to set the
timezone in which the wrapper will be executed. This property is available
in the standard and the professional Edition of the Java Service Wrapper.
* Fix a potential problem on Windows platforms where a failure to register the
control handler was not being logged. If this happened, user logoffs would
not be trapped correctly but no other problems would have occurred.
* Fixed a problem in the shell script on Solaris platforms where a deep
directory structure would cause the script to incorrectly report that the
Wrapper was not running. That could lead to multiple zombie copies of the
Wrapper and its application running in memory.
Bug #1664303.
* Fixed a problem in the shell script on HP-UX platforms where a deep
directory structure would cause the script to incorrectly report that the
Wrapper was not running. That could lead to multiple zombie copies of the
Wrapper and its application running in memory.
Bug #2812207.
* Improve the error message displayed when there are problems initializing the
main class specified for the WrapperSimpleApp, WrapperStartStopApp, or
WrapperJarApp helper classes.
* (Professional) Add new wrapper.event..loglevel and
wrapper.event..message properties which can be used to output
a customizable message like "Event: " to the logs at an arbitrary
log level.
* Add debug output in the Windows version to log the full path of the native
library.
* Add a new wrapper.java.detect_debug_jvm property which will control whether
or not the Wrapper disabled timeouts when java's debugger is in use. The
Wrapper has automatically disabled timeouts in this case since version 3.2.1.
Thanks to Ruslan Gainutdinov for the patch.
* Fix a buffer overflow problem for values of wrapper.ntservice.name.
* Fix a problem with where the wrapper.syslog.ident property was not working
as documented. It had been necessary to use wrapper.ntservice.name in its
place.
* Add a new wrapper.ignore_sequence_gaps property which makes it possible to
have non sequential numbered property values. This affects the
wrapper.app.parameter., wrapper.event..command.argv.,
wrapper.filter.trigger., wrapper.java.additional.,
wrapper.java.classpath., wrapper.java.library.path.,
wrapper.ntservice.dependency., and wrapper.timer..interval,
properties. The default value maintains past functionality.
Feature Request #1930298.
* (Professional) Fix a problem where the Event Handler Variables
were not being set correctly in the values of the
wrapper.event..command.argv. properties.
* (Professional) Fix a potential access violation if memory allocations fail
while sending event mails or executing event commands.
* Add a new WRAPPER_HOSTNAME default environment variable as an alias of the
existing WRAPPER_HOST_NAME variable.
* (Professional) Deprecate the use of the wrapper.event..set_environment
property. It will remain in the product for compatibility but its use is
discouraged as it does not always work correctly when the configuration
file is reloaded. See the property's documentation for more details.
* Add a new DUMP action to the wrapper.filter.action. property to make it
possible to invoke a thread dump in response to a specific string in the
JVM's console output.
* Fix a problem where the WrapperManager.stopAndReturn method was dead locking
if called when the JVM was being run in standalone mode without the Wrapper.
Bug #2711872.
* (Standard, Professional) Modify the way the licensing times work so the
Wrapper compares the License Upgrade Term to an official release date
rather than the build date. This makes it possible to release additional
platforms at a later date while keeping the use of a license consistent.
* (Standard, Professional) Make it possible to obfuscate the upgrade term in
License Key files for development licenses so it is not visible to an end
user what the development license holder's upgrade term is. This feature
is accessed from the License Management Page when downloading a new or
existing License Key file.
3.3.5
* Fix a problem on some UNIX platforms introduced in 3.3.4 where the Wrapper
would crash on startup if the configured JVM could not be found.
* Fix a problem introduced in 3.3.2 where the Wrapper could crash if the
system host name was longer than 27 characters in length.
* Fix a potential problem with the way thread ids were being compared on UNIX
systems.
* Add a new wrapper.java.additional.auto_bits property which will automatically
add the -d32 or -d64 arguments to the JVM for platforms whose JVMs typically
expect the argument.
* (Professional) Fix a problem with the Date field of outgoing event emails.
3.3.4
* (Standard, Professional) Update the development license to version 1.1
so that a new copyright notice file can be shipped with user applications
rather than the full license text.
* The Community Edition may be licensed under either the GPL2 based Community
License, or the Development License. The source for the Standard and
Professional Editions of the Wrapper are proprietary.
http://wrapper.tanukisoftware.org/doc/english/licenseOverview.html
* Fix a problem introduced in 3.3.2 where querying a the status of a Windows
service with the -q or -qs commands resulted in an access violation. The
running status of the service was reported correctly but additional
configuration information was failing. Bug #2644515.
* Add a new wrapper.disable_restarts.automatic property to disable only
restarts caused by JVM timeouts, crashes, etc. Manual or configured
restarts will still be allowed.
* Switch to using make for HPUX IA 32/64 builds.
* Add Advice comments when the Wrapper fails to launch the JVM process.
* Fix a problem on UNIX platforms where log entries made by the forked Wrapper
process would result in two blocks of log entries in the log file because
the parent Wrapper process would think they were console output from the JVM
process.
* Add a set of new wrapper environment variables that can be referenced in the
wrapper.conf file to generate random numbers, or timestamps for use in
generating unique file names, etc. See the Default Environment Variable
definitions section for more details.
* (Standard, Professional) Fix a problem with Development licenses being
able to authorize applications using Integration Method #4 which was
added in version 3.3.3.
* Add the number of bits of the current Wrapper to the startup banner to aid
in support requests.
* (Standard, Professional) Fix a crash problem on HPUX versions which would
reliably happen on some machines at startup.
3.3.3
* Modify the wrapper.ignore_signals property so it now takes the values
WRAPPER, JAVA, and BOTH, in addition to TRUE and FALSE.
* Modify the WrapperManager so it is now careful never to poll the native
library once the JVM is flagged as being ready to shutdown. This is to
make sure that the JVM never exits in the middle of a call as that could
lead to the JVM crashing.
* Add a pair of methods to allow threads to request and release locks which
will prevent the Wrapper from letting the JVM exit while certain operations
are in progress. See WrapperManager.requestShutdownLock() and
WrapperManager.releaseShutdownLock().
* Fix a problem where interactive services would sometimes leave a console
window visible when after starting up. The Wrapper is now more resilient
about closing the window even if it fails to do so initially.
* Add a new integration method (#4), which makes it easy to configure the
Wrapper to execute an executable jar file.
* Fix a problem where the random generator was not being seeded correctly
before naming the Wrapper's console window when running as a Windows
service. This was leading to problems identifying the wrapper's console
when more than one service was running on the same machine.
3.3.2
* Add a file information record to the wrapper.exe and wrapperw.exe binaries
so the Version tab will be displayed correctly in the Properties dialog of
the file.
* (Standard, Professional) Fix a problem with the wrapperw.exe binary where
the log dialog was not being displayed correctly when the Wrapper was
launched with the "-?", "-v", or "-h" arguments.
* (Standard, Professional) Fix a problem with the wrapperw.exe binary where
a message was being displayed in the dialog with the location of the full
log file even if there had not been any entries written to the log.
* (Professional) Improve the debug output produced when sending event emails
when the wrapper.event..email.debug property enabled.
* (Professional) Add wrapper.event..email.send.timeout and
wrapper.event..email.receive.timeout properties to avoid the
wrapper hanging waiting for a response from a remote mail server.
Bug #2064885.
* (Professional) Fix a problem where the Wrapper would get stuck and fail to
send emails with some mail servers. Problems was being caused by incorrect
linefeeds in the body of the email.
* Add a warning if the leading '#' is missing from an '#include' in the
configuration file to assist users with include file problems.
* Added a new wrapper.ntservice.generate_console property which will cause
the Wrapper to always generate a console when running as a service and
then hide it immediately. This will cause a slight flicker but is needed
to support thread dumps. Bug #2060181.
* Fix a problem in the Windows version where the console window would
sometimes be left visible when running as an interactive service even when
it was configured to be hidden.
* Add support for PowerEvents so Windows services can respond to suspend
and resume events.
* Fix a problem where the wrapper.key system property passed to the JVM was
being generated incorrectly randomly, 1 in 2048 times the JVM was launched.
This would result in the JVM failing to start and the Wrapper shutting down.
* Add a new wrapper.disable_console_input to disable to feature which allows
the Wrapper to pass console input on to the Java process.
* Fix a buffer overflow problem in the logging code which would happen once on
startup. This was benign on most platforms but was causing intermittent
crashes in the 32-bit AIX version.
* Modify the way configuration properties are parsed so that their names are
no longer case sensitive.
* Modify the WrapperServiceException so that a new getErrorCode method can be
used to obtain the integer error code which caused the exception.
Feature Request #2188280.
* (Standard, Professional) Fix a problem where on some Windows machines the
Wrapper would return a random hostId that changed each time the system was
rebooted.
* (Standard, Professional) Make it possible to define License Keys so that
their property names are encoded using either the host name or hostId. This
makes it possible to define multiple keys within the same configuration file,
visible on the same host. This was necessary to support some load balanced
network adapters where the visible hostId changes depending on the active
physical network adapter.
* Rework the Java side state engine so it is now possible for the Java side of
the Wrapper to respond to stop events while the WrapperListener.start method
is still in progress.
* Add a new wrapper.listener.force_stop property which allows control over
whether the WrapperListener.stop method is called on shutdown even if the
WrapperListener.start method has not yet completed.
* Fix a problem on Windows where the ability to start and stop the Wrapper as
a service using the Wrapper itself was requiring the Administrator permission
when a lower permission should have been possible. The Wrapper should now
allow service control to do whatever is possible from the Services control
panel.
* Fix a memory corruption error if the value of wrapper.java.maxmemory was more
than 4 digits in length. wrapper.java.initmemory did not have any problems.
* (Professional) Add a new wrapper.event..email.client.host
property which makes it possible to configure the host name sent in EHLO and
HELO commands to the SMTP server.
* Add a new default environment variable, WRAPPER_HOST_NAME, which stores the
name of the machine where the Wrapper is running.
3.3.1
* Add debug output showing the current os name and architecture to aid in
debugging problems.
* (Standard, Professional) Improve the message displayed when a license key
is found but is deemed to be invalid.
* Modify the template wrapper.conf file to help users debug include file
problems.
* Disable the console title feature on all UNIX platforms other than LINUX
because the console title does not get reset correctly when the Wrapper
process terminates.
* Add support for HP-UX IA64 CPUs.
* Update the license banner in source files so it is clearer that the user
is restricted by the license they agreed to.
* Modify the Community edition so it will now display a Licensed to banner
on startup if shipped with a Development License. This is required to
enable the distribution of the Community Edition under the Development
License.
* (Professional) Fix a problem where the UNIX versions of the Professional
Edition would sometimes deadlock on startup when run as a daemon process.
Bug #1989355.
* (Professional) Added two new events; jvm_failed_invocation and
jvm_max_failed_invocations. Feature Request #1994718.
* Fix a problem where the Windows service exit code was not being set
correctly when the JVM exited with a non-zero exit code. The problem
could be seen by running "sc query {service}" from the command line.
Bug #1859061.
* Added support for the Windows Itanium 64-bit platform.
* Added support for the HP-UX Itanium 32 and 64-bit platforms.
* Added support for the MAC OSX 64-bit platform.
* (Standard, Professional) Fix a problem on Windows versions where servers
which reported a large number of possible host ids could cause a buffer
overflow on startup. This crash was possible when using either
Development or Server licenses. Removed duplicate host ids from the list
of possible ids.
* Add a new "condrestart" command to the shell script which will restart
the Wrapper only if it is already running. Feature Request #1928045.
* Fix a problem where the 64-bit Solaris x86 version was unable to load its
JNI library. Bug #1992039.
* Fix a problem on Windows versions where a frozen JVM process was not always
being killed. This could result in the zombie JVM processes being left
around that consumed memory and other resources.
* Add a new wrapper.ignore_console_logouts property which allows the Wrapper
and JVM to survive logouts when launched as a console application from
another service.
* (Standard, Professional) Add a wrapperw.exe binary in Windows implementations
which makes it possible to run the Wrapper without a console. A console still
flickers for an instant when the Wrapper starts. This is the same issue that
has existed when running as an interactive service and is required to make
thread dumping possible.
* (Standard, Professional) Add new wrapper.logdialog.enable,
wrapper.logdialog.format, wrapper.logdialog.lines, and
wrapper.logdialog.loglevel properties used to configure the display of a Log
dialog when the wrapperw.exe binary exits in an error state.
* Fix a problem where the Wrapper was attempting to reopen its backend port
even when the JVM was down. This was only a problem when the defined port
range was limited to a single port with the wrapper.port.min and
wrapper.port.max properties. In such a case one or more warning messages
were being displayed because the port is locked for a few moments after
being closed.
* (Standard, Professional) The wrapper.initmemory.percent and
wrapper.maxmemory.percent properties were not correctly being calculated
relative to a maximum of 2048MB for 32-bit versions of the Wrapper.
Bug #2053167.
3.3.0
* Add a new wrapper.ping.interval.logged property which makes it possible to
reduce the debug output caused by ping transactions between the Wrapper and
JVM.
* Fix a problem on Windows where the Windows Service Manager was not waiting
the full configured time of the wrapper.jvm_exit.timeout and
wrapper.shutdown.timeout properties. This was leading to the net stop
command timing out and the system shutting down without the java application
having fully stopped. Bug #1582568.
* If internal firewalls were preventing the backend socket from being created,
it was not being made clear what the cause was. It was also possible that
the JVM would deadlock on shutdown. This second problem was recovered from
when the Wrapper killed the JVM.
* Rework the console output from all Wrapper classes to make it much more
obvious that that is their source.
* Submit a patch to the UNIX sh script by Chris Dance which makes it possible
to tell the shell to wait a few seconds for the wrapper to start up. Also
includes some modifications to work correctly on older Debian and RedHat
systems.
* Fix a problem where the local copy of ant was not always being used
correctly on UNIX systems which have a default copy of any installed.
Thanks to Robey Pointer for the patch.
* Add the -lm to the command line when building Linux 32 and 64 bit versions
of the wrapper on Linux. This is to support building on recent Debian
and Ubuntu versions. Thanks to Robey Pointer for the patch.
* Add support for the SIGUSR1 and SIGUSR2 signals so they can now trigger a
shutdown, restart or be forwarded to the JVM for custom functionality.
See the wrapper.signal.mode.usr1 and wrapper.signal.mode.usr2 properties.
Based on a patch by Robey Pointer. Note that the JVM process does not
trap SIGUSR1 or SIGUSR2 signals as they are used internally by the JVM
as part of the garbage collection process.
* Fix a problem where the WRAPPER_OS, WRAPPER_ARCH, and WRAPPER_BITS
environment variables were not being initialized correctly for the various
unix platforms.
* Removed the 4096Mb upper limit set on the wrapper.java.initmemory and
wrapper.java.maxmemory properties. 64bit users need to go way beyond that.
* Fix a problem where relative include file references in the configuration
file were not working correctly if the wrapper.working.dir was used to
change the working directory. The working directory is now always reset
to its original value as the configuration file is being loaded.
* Added a new wrapper.registry.java_home property which makes it
possible to specify the location of java within the registry.
* Set a new WRAPPER_JAVA_HOME environment variable if the JAVA_HOME is
located in the Windows registry.
* Modify the way properties are looked up so that any unreplaced environment
variable references will be reevaluated in case they were set after the
property was originally set. This is possible with some WRAPPER_*
environment variables or depending on the placement of set.* properties
in the configuration file.
* Set any unset properties to their default values internally. This is
necessary so the WrapperManager.getProperties() method returns the
correct set of active properties.
* Fix an occasional crash with 64-bit UNIX caused by a native synchronization
problem when system signals are trapped. Bug #1614010.
* Fix a problem on Solaris versions, where the Wrapper was not correctly
recovering and attempting another back end port when the first was already
in use. Bug #1594073.
* Fix a problem on Solaris and AIX where the RUN_AS_USER feature of the
shell script was not working due to lack of support for the "-m" option of
su. The shell script now uses "su -". Bug #1590168.
* Add HP-UX Makefiles for building with make. Fix some problems in the
shell script to make the script work better on HP-UX. Thanks to David
Brown and Nicolas Varney for the patches.
* Fix a problem where any signals received by the JVM and triggering a
SIGCHLD signal in the Wrapper were being interpretted as the JVM having
stopped. This was not always true. Bug #1643666.
* The Wrapper is now able to detect when the JVM process is stopped and
continued. It will still timeout if stopped, but a descriptive warning
is now logged.
* Increase the maximum number of log entries which can be queued to avoid
losing them. These are only used for log entries outside of the primary
thread.
* Fix a problem in the shell script which was making it impossible to stop
the Wrapper or query its status on OSX.
* Add support for 64 bit AIX. Thanks to Nicolas Varney for supplying a
Makefile.
* Correct the AIX library extension to be ".a".
* Rename the UNIX Makefiles so it is more obvious which tool must be used
to build with them.
* Fix a problem where the HP-UX native library would not be located
correctly for some processor types if the file had a platform specific
name.
* Internally rename the WRAPPER_JSTATE_LAUNCH state to
WRAPPER_JSTATE_LAUNCH_DELAY for clarity.
* Fix a problem where the UNIX versions of the Wrapper would shutdown
rather than restarting a frozen JVM if the arrival of the SIGCHLD signal
from the old JVM process was delayed by more than a second or two.
* Rework the Windows build so it now uses nmake and a Makefile rather than
vcbuild. This is probably not as clean, but it was needed to get the
64-bit build working.
* Fix a problem on Windows versions where quoted values specified from the
command line were not always being requoted correctly when generating the
java command line.
* Add validation checks for Windows versions to make sure that all additional
parameters, application arguments, the classpath, and library path all
contain values which are quoted correctly. Incorrectly quoted values will
now result in a warning message that will help resolve the problem.
* Fix a memory leak when calling WrapperManager.listServices() on Windows.
Bug #1665947.
* Fix a buffer overflow problem if the Wrapper was launched without explicitly
specifying a configuration file.
* Add tests of the return values of all malloc calls to catch out of memory
errors and recover as gracefully as possible. Bug #1649880.
* Modify the WrapperManager.signalStarting and signalStopping methods so that
they will never have the effect of shortening the existing timeout.
Updated the javadocs of both methods so they more accurately reflect what
the methods do.
* Move the Wrapper Copyright banner into the Wrapper process so it will be
output more consistently.
* Branch the code to support Community, Standard, and Professional Editions
of the Java Service Wrapper.
* (Standard, Professional) Add support for Server (Fixed) as well as
Development (OEM based) licenses.
* (Standard, Professional) Add 64-bit versions of the Windows version. The
64-bit Community Edition will not be distributed initially to support
ongoing development costs.
* (Professional) Add event handling callbacks for Wrapper start/stop, JVM
start/stop, JVM started/stopped, JVM restart, JVM killed, and JVM unexpected
exit events.
* (Professional) Add the ability to send emails in response to any event
callback.
* (Professional) Add the ability to execute a a user configured command in
response to any event callback.
* Add WRAPPER_BIN_DIR and WRAPPER_WORKING_DIR environment variables which are
now available for use within the wrapper.conf file as well as by any child
processes.
* Add documentation to the integration pages about existing system properties
that be used to control the way the WrapperSimpleApp and WrapperStartStopApp
handle application startup.
* Remove support for native PPC and x86 distributions of the Wrapper for
MAC OSX in favor of the universal X-Code distribution. This appears to be
the standard for the market and saves lots of time on testing.
* Add a new '-it' command to the Windows version which makes it possible to
install and start a service as a single command.
* Fix a problem where the PATH environment variable was not being set correctly
on Windows versions when run as a service if the wrapper.ntservice.account
was set and a PATH was set for both the SYSTEM and user accounts.
Bug #1702274.
* Modify the shell script to set JAVA_HOME to the default JVM location on
OSX systems if it is not already set. OSX always places the JVM in a known
location so this is possible. Thanks to Andrew Williams for the patch.
* Fix a problem where the UNIX shell script would fail if the APP_NAME was set
to a value containing spaces. Thanks to Andrew Williams for the patch.
Bug #1695678.
* Fix a problem where the DIST_ARCH was not being resolved correctly on HP-UX
systems. Thanks to Matej Kraus for the patch. Patch #1697421.
* Log output from the timer thread was not being queued correctly, this could
have lead to timing problems if there were any delays writing to disk.
* Add partial support for OS/400 into the build file. Still needs a Makefile.
* Fix a problem where the WrapperActionServer would deadlock in its stop method
if the JVM shutdown was initiated by a call to the shutdown or restart
actions.
* Add support for wrapper.console.title on UNIX platforms. Add a set of
wrapper.console.title. properties which make it possible to set the
title based on the platform.
* Fix a problem where the wrapper.ntservice.account and
wrapper.ntservice.password properties were being stored in the system
registry if the they were specified on the command line when the Wrapper
was installed as a service. This was broken in version 3.2.2.
Bug #1538725.
* Fix a problem where the DUMP command was not working with the
wrapper.commandfile property when run as a service on Windows.
Bug #1644421.
* Fix a problem where wildcards like "*.*" or "*" in a classpath property were
including the "." and ".." files on Windows versions. Bug #1517928.
* Modify the debug log output when the Wrapper is attempting to load its native
library in an attempt to make the expected failures less threatening.
* Commit a patch by Rob Oxspring which adds the start_msg and stop_msg commands
to the shell script. These are expected by init scripts on HP-UX.
Patch #1750027.
* Add a DETAIL_STATUS flag to the UNIX shell script which will cause the
status, start_msg, and stop_msg commands to display the current internal
status of both the Wrapper and Java processes.
* Commit a patch by Rob Oxspring which adds an init block to the UNIX shell
script to make it work with install_initd and remove_initd scripts used by
SUSE linux. Patch #1750028.
* Commit a patch by Travis Carlson, ia64 systems were being grouped as "x86"
systems. They now are assigned the name "ia" which makes it possible to
create a distribution for them. Patch #1663887.
* (Standard, Professional) Add new wrapper.java.initmemory.percent and
wrapper.java.maxmemory.percent properties which make it possible to set
the initial and maximum memory values relative to the amount of physical
memory on the system. Feature Request #1741051.
* Add a new #include.debug declaration in the wrapper configuration file which
makes it much easier to debug problems with cascading include files.
* Add -l and --controlcode commands to the Windows version which make it easy
to send user defined control codes to the Wrapper running as a service.
* Fix a synchronization problem in the logging code which could result in
data corruption or access violations.
* Add version numbers to the bat and sh scripts to make them easier to
support.
* Make the wrapper.ntservice.name, wrapper.ntservice.displayname, and
wrapper.ntservice.description properties aliases of new wrapper.name,
wrapper.displayname, and wrapper.description properties as they are now
used on UNIX platforms as well as Windows.
* Fix a problem where the wrapper would sometimes fail to send a packet to
the JVM because the sending of the packet would block. Thanks to Peter
Gorgon for the patch.
* Fix a problem where CPUs identifying themselves as 'ia64n' or 'ia64w' were
not correctly being categorized as 'ia'. Thanks to Stirling Chow for the
patch. Patch #1859412.
* Add -d and --dump commands to the Windows version which make it possible to
send thread dump requests to the Wrapper when running as a service. Works
in association with the new wrapper.thread_dump_control_code property.
Feature Request #1118110.
* (Professional) Add wrapper.timer..interval and wrapper.timer..action
properties which make it possible to schedule Wrapper shutdowns, JVM
restarts and thread dumps at arbitrary times.
* Fix a problem where the default configuration file name was being corrupted
by a buffer overrun. Thanks to Rob Joyce for the patch. Patch #1879049.
* Fix a problem where the WrapperManager would sometimes attempt to unregister
its shutdown hook after the shutdown hook had been initiated. Bug #1799489.
* Fix a problem where log files were limited to 2GB on Linux systems.
Bug #1881038.
3.2.3
* Add support for x86 Mac OS X distributions.
* The 3.2.2 Windows version was accidentally released with its MFC libraries
dynamically linked. This meant that anyone who did not have VS8 installed
were not able to run the Wrapper due to missing DLLs. This version fixes
that snafu by correctly using statically linked libraries as was done in
previous versions built with VS6. Bug #1578554.
3.2.2
* Correct a typo in the usage output of the WrapperStartStopApp. Thanks to
Michael Giroux for pointing it out.
* Fix a problem on OSF1 systems where the backend socket was not listening
correctly due to a backlog of 0. This was broken in 3.2.0. Thanks to
Phillip Gussow for supplying a patch.
* Remove the com.silveregg.wrapper package classes that were deprecated in
version 3.0.0.
* Fix a potential problem in the UNIX script where the lock file permissions
were not being set correctly if the LOCKFILE and RUN_AS_USER variables are
specified but the group of the specified user could not be resolved.
* Fix a problem where the exit code returned by WrapperListener.stop was being
ignored in some cases.
* Fix a problem where the shell script would not work correctly when the
wrapper or its configuration files were located in a directory path
containing spaces.
* Apply a series of patches by Michael Saya to get the Windows 64 bit build
working.
* Fix a problem in UNIX versions where the SIGTERM handler was being disabled
when a SIGCHLD was received.
* Added support in UNIX versions for the SIGHUP signal.
* Migrated the source to Subversion from CVS. Did a bunch of cleanup in the
source, removing CVS specific tags.
* Fix a problem in UNIX versions were the pid file specified by the
wrapper.java.pidfile property contained the wrapper pid rather than the
jvm pid. Bug #1565011.
* Fix a problem in UNIX versions where the file specified by the
wrapper.java.pidfile property was not always being deleted when the JVM
process went away.
* A user encountered a JVM bug where calls to System.exit were resulting in
an IllegalThreadStateException being thrown. Added some code to trap this
and shut down the JVM using other means to avoid a hang during shutdown.
* Fix a NullPointerException caused by users incorrectly implementing
an Integration Method #3 class and then calling WrapperManager.start with
a null value for the args parameter.
* Update the banner displayed by the Wrapper on startup to include a
copyright notice. Please see the license page of the documentation for
details.
* Add a new 'Z' log format which will log the time to millisecond accuracy.
* Fix a problem where the JVM exit code was not being set correctly when
the JVM was shutdown using WrapperManager.stopImmediate(). The exit code
of the Wrapper was being set correctly through other means however.
* Fix a potential synchronization problem in the logging code if a JVM exits
with debug output enabled.
* Updated the WrapperListener.stop method javadocs to better explain the
exitCode value under certain exit modes.
* On UNIX versions, add a log message which records the signal that caused
the JVM process to exit when it terminates unexpectedly.
* Fix a problem where the wrapper.on_exit. property was not working
correctly in some cases on UNIX. With help from Andreas Schafer.
* Add support for building the Wrapper with Visual Studio 8 for Windows.
Releases will now be done using this compiler.
* Fix a CRITICAL bug in the 3.2.0 and 3.2.1 Windows versions of the Wrapper
where the Wrapper would crash under rare circumstances when running as a
service. If the service manager interrogated the service at the same
instant as the wrapper was pinging the JVM, the wrapper was sometimes
crashing due to a synchronization problem. The problem did not exist
prior to 3.2.0. Bug #1574537.
* Fix a minor logging problem where the 'D' format was not displaying the
correct thread name for queued log messages.
3.2.1
* Fix a problem with the solaris-sparc-64 makefile.
* Add a solaris-x86-64 makefile.
* Merge in a patch by Hugo Weber to make it possible to configure the Wrapper
to pull the JRE from the system registry on windows.
* Fix a batch file bug added in 3.2.0 where the scripts would not function
correctly if the full path to the batch file contained spaces.
Bug #1450601.
* Modify the message shown when a native library fails to load so the
exception message text is now shown in the log without having to enable
debug log output.
* Modify the UNIX shell script to be more informative if the script is unable
to locate a wrapper binary due to a executable bit permission problem.
* Fix a minor permission problem with the build for the delta-pack.
* Commit a patch by Juergen Hermann to make the error shown when realpath
fails clearer.
* Add the ability to use a default wrapper.conf file that is in the same
directory as the wrapper binary. The file will be named based on the
name of the wrapper binary.
* Synchronize the command line so that both the Windows and UNIX versions
are now the same. The old command line syntaxes are now supported
everywhere so there will be no compatibility problems.
* It is no longer possible to specify arguments using the '/c' syntax.
This was undocumented so hopefully it is not being used. The documented
'-c' syntax must now be used. The change was necessary to synchronize
the command line between UNIX and windows platforms.
* The 32-bit HP-UX 3.2.0 build was generating a libwrapper.so file rather
than libwrapper.sl.
* Make the WrapperManager.setConsoleTitle, getWrapperPID, and getJavaPID
methods available through JMX.
* Fix a state engine problem introduced in 3.2.0 which was causing the
wrapper.on_exit. properties to be ignored in most cases.
* Fix a potential problem that could have caused crashes when debug logging
was enabled.
* Fix a problem where signals were not being handled correctly on some UNIX
platforms, including AIX. This was making it impossible to shutdown the
wrapper cleanly with the TERM signal. Bug #1477619.
* Add new default environment variables which can be referenced in a
configuration file to configure platform specific directories and file
names. WRAPPER_OS, WRAPPER_ARCH, and WRAPPER_BITS.
* Add a -v argument to make it possible to request the version from a wrapper
binary.
* Add support for registering the WrapperManager MBean with the
PlatformMBeanServer when run on a 1.5+ JVM. See the JMX section in the
documentation for details.
* Rework the way timeout properties are handled. Values of 0 now actually
disable the timeouts rather than setting them to a large value. To avoid
overflow problems when converting to internal timer ticks, timeouts are now
restricted to a maximum of 20 days, or 1728000 seconds. Change affects the
wrapper.cpu.timeout, wrapper.startup.timeout, wrapper.ping.timeout,
wrapper.shutdown.timeout, and wrapper.jvm_exit.timeout properties. For
values less than 20 days, there should be no change in functionality.
* Add support for debuggers. The Wrapper will now show a warning on startup
and then again the first time a timeout occurs. But all timeouts will be
ignored. This is to avoid problems with the Wrapper restarting a suspended
JVM in the middle of a debugging session. The wrapper enters this mode if
the wrapper.java.command ends with the string "jdb" or "jdb.exe", or the
"-Xdebug" parameter is passed to the JVM.
* Add 'athlon' to the list of supported architectures.
* Fix a problem where the environment variables loaded when a service was
started were always the system environment even if the service was running
as a specific account. The environment of a specific account will now be
loaded on top of the system environment if the USERNAME environment
variable is set by the system. Bug #1491138.
* Added new wrapper.ntservice.pausable and wrapper.ntservice.pausable.stop_jvm
properties to make it possible to pause and resume the Wrapper when installed
as a Windows service.
* Added new Pause and Resume batch files as well as modified the command batch
file to support pause and resume.
* Added PAUSE and RESUME commands for use by the wrapper.commandfile property.
* Fix a problem with the wrapper.pidfile, wrapper.java.pidfile,
wrapper.anchorfile, wrapper.commandfile, wrapper.statusfile,
wrapper.java.statusfile, wrapper.java.idfile, and wrapper.lockfile
properties where forward slashes in paths were not being changed to back
slashes on Windows versions.
* Simplify the code used to load a native library by using the
System.mapLibraryName method rather than doing the same thing manually.
* Add a new wrapper.syslog.facility property which makes it possible to
specify the syslog facility on UNIX systems. Thanks for the patch from
Bruce Pennypacker.
* Removed the custom thread counting used to keep track of when the wrapped
Java application has completed. It is now done in a different way that
will work on all Java implementations without requiring any special
consideration of the current JVM. Deprecated the
wrapper.monitor_thread_count and wrapper.thread_count_delay properties.
Bug #1470265.
* The WrapperStartStopApp helper class still requires thread counting if the
stopWait parameter is set to true. Previous versions all hardcoded the
system thread count to 1 which worked for most JVMs. A new system property,
org.tanukisoftware.wrapper.WrapperStartStopApp.systemThreadCount, was added
to make it possible to customize. It currently defaults to 1.
* Make it possible to extend the WrapperSimpleApp and WrapperStartStopApp
helper classes. Feature Request #1510274.
* Add warning messages if the old org.silveregg.wrapper package classes are
still being used. They will be removed in the next release.
3.2.0
* Rework the release cycle so that the wrapper.jar file released for all
platforms is now built on the same machine. This resolves a few
incompatibility problems caused by jars built on very new JVMs but run
on old JVMs.
* Add additional output when the JVM can not be launched due to security
restrictions on Windows.
* Greatly improved the performance of file logging. On a windows test machine
3.1.2 could log 67210 lines of output in 20 seconds with a 80-15% split
between the Wrapper and JVM process CPU usage. It now outputs 215214 lines
with a 64-34% split, also showing less load on the system process. This is
a 220% increase in performance. In both cases, the JVM was completely idle
other than the console output which makes the Wrapper appear to be a bit of
a CPU hog. In fact it is the only process doing any work in this case.
This improvement was accomplished by keeping the log file open unless idle.
The idle time can be controlled using the new
wrapper.logfile.inactivity.timeout property. The speed increase on UNIX
platforms was much smaller at around 10%.
* Add a new property, wrapper.disable_restarts, which will completely disable
the Wrapper's ability to restart JVMs.
* Add a pair of new properties, wrapper.port.min and wrapper.port.max, which
make it possible to define the port range used when a specific wrapper.port
is not specified.
* Fix a problem where certain characters like umlauts were being stripped from
property values. Bug #1049528.
* Make the PIDs of the Wrapper and Java process easier to access by providing
a new pair os system properties; wrapper.pid and wrapper.java.pid, as well
as a new pair of methods; WrapperManager.getWrapperPID() and
WrapperManager.getJavaPID().
* Add a new WrapperEventListener class which can be implemented to receive
a wide variety of events from the Wrapper.
* Add a WrapperServiceControlEvent class which will report any service control
codes received by the Wrapper as it is running as an NT service. This was
added to make it possible for other applications to sent custom codes to the
Wrapper using the Window Service Manager.
* Add a WrapperManager.listServices() method which can be used to obtain the
status of all services on a Windows system.
* Add a WrapperManager.sendServiceControlCode() method which makes it possible
to start, stop, pause, continue, any service on Windows systems. It is also
possible to send custom user codes via the service manager.
* Add comments in the sh script to support the chkconfig command.
* Implement the ability to read from standard input via System.in. Feature
Request #1024693.
* Made the tick based timer the default by changing the default value of the
wrapper.use_system_time property to false. Most users should see an
improvement in reliability under heavy loads with this new setting. If you
have extended any timeouts in the past, you may wish to try going back to
defaults as they may no longer need to be extended.
* Add a new wrapper.restart.reload_configuration property which causes the
Wrapper to reload its configuration file immediately before a JVM restart.
Properties which can not be reloaded have comments stating that fact in
their documentation. Feature Request #981060.
* Fix a problem in the UNIX shell script which was preventing the script from
locating the PID and anchor files when the wrapper.working.dir property was
used.
* Modify UNIX versions so that the wrapper binary will now force its working
directory to the location of the wrapper binary. This change was made to
make the UNIX version work the same way as the Windows version and thus make
configuration files that modify their working directory work correctly on
a cross platform basis. Users which have been using the scripts supplied
with the Wrapper should not encounter any problems. Other users may require
slight changes to their configuration file to deal with the new way that the
Wrapper deals with its initial working directory.
* Add a new method WrapperManager.getProperties() which makes it possible to
access any property in the Wrapper configuration file.
* Fix a problem where TERM signals were not being correctly ignored by the
JVM process on UNIX platforms even if the wrapper.ignore_signals property
was set to true. Earlier versions of the Wrapper would generate a
WRAPPER_CTRL_SHUTDOWN_EVENT when a TERM signal was received. On Windows
that signal should never be ignored. To resolve this a new
WRAPPER_CTRL_TERM_EVENT was added making it possible to selectively ignore
the TERM signals. This change may affect user implementations of the
WrapperListener.controlEvent() method. Bug #1086344.
* The Windows version has a feature which allows the user to immediately kill
the Wrapper and its Java application without waiting for a clean shutdown
by pressing CTRL-C twice. Windows sends the CTRL-C signal to both the
Wrapper and Java processes. Due to a rare timing problem, it was possible
for the Java process to get the signal first and initialize a shutdown
before the Wrapper could respond to the signal. In this case the Wrapper
was interpreting this as a second CTRL-C signal even though the user only
pressed it once.
* If the wrapper.anchorfile or wrapper.pidfile properties are used on Windows
they were being unintentionally deleted if the -t, -p, -i, or -r commands
were used while another Wrapper instance was running. In the case of the
anchor file, this would result in the Wrapper being shutdown unintentionally.
This was not an issue on non-Windows versions. Bug #1108517.
* Fix a security problem where the value of the wrapper.ntservice.account
and wrapper.ntservice.password properties were being stored in plain text
within the registry if they were specified on the command line when
installing the Wrapper as a Windows service. Bug #1110183.
* Add a pair of properties wrapper.ntservice.password.prompt and
wrapper.ntservice.password.prompt.mask which which will cause the Wrapper
to prompt the user for an account password when it is being installed as
an NT service.
* Added system properties to make it possible to configure whether or not
the WrapperSimpleApp and WrapperStartStopApp helper classes will wait
for the configured main methods to complete before reporting that the
application has started. See the javadocs for these classes for more
details.
* Modify the HP-UX build so that it now dynamically links with the pthread
library. This was to make the binaries work with HP-UX 11.00. Thanks to
Sun Kun Choi for the patch.
* Add new wrapper.statusfile and wrapper.java.statusfile properties which can
be used by external applications to monitor the internal state of the Wrapper
or JVM at any given time. These will not be useful to most users.
* Add a new wrapper.commandfile property which can be used by external
applications to control the Wrapper and its JVM.
* Add a new wrapper.java.idfile property which can be used by external
applications to monitor the internal state of the JVM at any given time.
* Add a warning on startup if the JVM has a SecurityManager set but the
wrapper.jar has not been granted the AllPermissions permission. Failure
to do so will almost certainly lead to the Wrapper throwing a number of
errors and this helps to point out the cause.
* Add a security model which protects most Wrapper method calls when a
SecurityManager has been registered. See the Security Model section
for more details.
* Add a new pair of batch files which can be used to start and stop the
Wrapper when installed as a service.
* Add new -q and -qs commands to the Windows version of the Wrapper which
make it possible to query the currently installed status of the service.
* Fix a problem where the wrapper.java.library.path.append_system_path
property was not working correctly on Windows when the system PATH
contained quotes. Bug #1238726.
* Modify the usage output of the Wrapper on all platforms so the Wrapper's
version is now included. It was not previously possible to get the version
of the Wrapper being used without launching a JVM.
* Add a pair of new methods WrapperManager.stopAndReturn() and
WrapperManager.restartAndReturn() which make it possible for code to
stop or restart the JVM and then continue until the JVM is shutdown.
This can be useful for shutdowns initiated within places like servlets,
whose operation is expected to complete.
* Fix a problem on UNIX where the child JVM was sometimes leaving around
zombie processes after a restart. The SIGCHLD signal was not being handled
correctly. Thanks to Traun Leyden for the patch. Bug #1291201.
* Implement the ability to catch control events using the WrapperEventLisener.
Feature Request #836975.
* Add new wrapper.jvm.port, wrapper.jvm.port.min, and wrapper.jvm.port.max
properties which make it possible to control the port the JVM uses to open
a connection back to the JVM. The Wrapper uses to leave this up to the
OS, but some users were having problems with the default conflicting with
other ports.
* Switch from using ftime() to gettimeofday() on UNIX platforms to work around
a problem where the Wrapper would not run on new versions of OSX because
they deprecated the ftime() function call. Thanks for the patch by
Michael Macaluso. Bug #1313162.
* Remove the shutdown timeout from the UNIX shell script. It is not needed
and can cause a zombie JVM if the wrapper's internal shutdown timeout was
longer than that of the shell script.
* Add the ability to specify integer property values in base 8 or 16 in
addition to base 10. Base 8 values start with a '0' and base 16 values
start with a '0x'.
* Make it possible to set the umask on all files created by the Wrapper
as well as the default umask of files created by the JVM. Added new
wrapper.umask, wrapper.java.umask, wrapper.pidfile.umask,
wrapper.lockfile.umask, wrapper.java.pidfile.umask,
wrapper.java.idfile.umask, wrapper.statusfile.umask,
wrapper.java.statusfile.umask, wrapper.anchorfile.umask, and
wrapper.logfile.umask properties.
* Improve the message when the native library can not be loaded to make mention
of the possibility of a 32/64 bit mismatch.
* Add a new wrapper.monitor_thread_count property which makes it possible to
disable the Wrapper's counting of non-daemon threads and thus the shutting
down of the JVM when they have all completed.
* Add support for BELOW_NORMAL and ABOVE_NORMAL options to the
wrapper.ntservice.process_priority property. Feature Request #1373922.
* Ignore '#' characters which are included within double quotes in the value
of a property in the configuration file. Unquoted values must be escaped
with a second '#' characters or it will be interpreted as a comment.
* Display the Wrapper banner in the JVM earlier so that it is displayed
even where there are startup errors.
* Modify the WrapperSimpleApp and WrapperStartStopApp classes so that the
WrapperManager is always initialized immediately. This makes the output
clearer in the event of startup errors.
* Fix a problem where the Windows ServiceManager was not correctly reporting
a startup error if a service failed on startup. The service was being
reported as having started even though it failed to start.
* Fix a problem on UNIX versions where the Wrapper would go into a recursive
state of attempting to launch the JVM from failed child processes if there
was any problems executing the configured java process.
* Rework the way the RUN_AS_USER setting in the UNIX shell script works so
the specified user is now set regardless of the command being executed.
To make sure the user never has to enter the password twice when running
the script, it now recurses after changing the user. The script then
runs entirely as the configured user.
* Improve the message that is displayed when attempting to start, stop, or
remove a windows service which is not installed.
* Add new wrapper.lockfile property which makes it possible to specify a
lock file containing a pid.
* Modified the sh script so it now creates a lock file on startup in the
/var/lock/subsys directory if it exists. This is needed by fedora systems
on shutdown.
* Store javadocs in tar distibutions in a nested tar file to avoid problems
with long filenames in some tar distributions.
* Fix a problem with the WrapperSimpleApp and WrapperStartStopApp helper
classes where on heavily loaded systems it was possible for the Wrapper
to get a running thread count of 0 and shutdown before the main thread
had a chance to be started.
* Add a new wrapper.thread_count_delay property which will force the
WrapperManager to wait the specified number of seconds before it begins
to check the number of running threads.
* Fix a problem where the wrapper.java.library.path.append_system_path
property was appending the PATH rather than the LD_LIBRARY_PATH environment
variable on Unix systems. PATH is correct for Windows systems.
* Add a new wrapper.logfile.rollmode property which makes it possible to
control how and when the logfile is rolled. Feature Requests #864463,
#1085097, and #1085850.
* Fix a problem on Linux where the test for the status of the Java child
process would sometimes fail causing the Wrapper to shutdown with the
error "Critical error: wait for JVM process failed (No child processes)"
rather than restart the child JVM. Users who encountered this problem
found it easy to reproduce, but it only happened on some systems.
* Modify the way the UNIX shell script tests for the existence of a process
matching the pid in an existing pid file. It now verifies the process
command as well as the pid to fix a system reboot problem where a stale
pid has been reused by another application, making the script think the
wrapper was already running.
* Add support for the GNU libjcj JVM. Like JRocket, it requires slightly
different thread counting.
* Add support for Linux 64-bit PPC and Solaris 32-bit x86 versions.
* Add a new set.default.ENV syntax to the configuration file making it
possible to environment variable values which do not overwrite existing
values, ie. to specify a default value.
* Added a new wrapper.console.flush property which forces the wrapper to
explicitly flush stdout after each line of log output.
* Change the error shown when the JVM shuts down prematurely during a
shutdown to a warning message.
* Fix a problem where the Wrapper would show the following error message
if user code called System.exit from within the WrapperListener.stop
callback method. This would happen if the stop class's main method
registered with the WrapperStartStopApp called System.exit.
"JVM exited unexpectedly while stopping the application."
Bug #945976.
* Add a new wrapper.syslog.ident property which makes it possible to
specify the identity used in syslog entries on UNIX. This was possible
in older versions but was set using the wrapper.ntservice.name property.
Bug #1432855.
* Add support for MacOSX Universal Binary distributions.
* Add support for Delta Pack distributions. This is a distribution that
contains the binaries of multiple platforms.
3.1.2
* Modify the way boolean system properties are resolved by the WrapperManager
so it is now possible to set them to true or false rather than assuming they
are true if set.
* Fix a problem where some localized error messages were not having their
tokens replaced correctly.
* Fix a problem when using the WrapperStartStopApp helper class. The usage
text was incorrectly being displayed in the console if an exception was
thrown while executing the main method of the configured stop class. This
did not change the functionality of the application, but it did cause some
confusion.
* Fix a problem on Windows where a library path or class path which ended in
a backslash was preventing the Wrapper from launching the JVM. The Windows
OS was using the backslash to escape the quote used to close the path. The
fix was to add a second backslash where needed.
* Added a new wrapper.java.command.loglevel property which makes it possible
to control the log level of the generated java command.
* Add support for escaped quotes when stripping quotes on UNIX for the
wrapper.java.additional. and wrapper.app.parameter. properties.
* Change the default value of wrapper.jvm_exit.timeout from 5 to 15 seconds.
The old default was too fast for some applications which take a while to
exit. Applications which were exiting promptly will not see any difference.
* Fix a problem where the JVM would restart at certain times when using the
system time based timer due to an overflow error. This problem was
introduced in 3.1.0. Due to a separate bug in 3.1.0, the Wrapper would
shutdown rather than simply restarting the JVM as was happening in 3.1.1.
The last restart happened on Aug 21, 2004. It will next occur Oct 10, 2004
and repeat at regular intervals. There are no problems when using the new
Tick based timer. Bug #1014405.
* Correct the wrapper.logfile.maxsize property so that a a kilobyte is now 1024
rather than 1000, and a megabyte is a megabyte. We aren't a hard drive
manufacturer after all.
* Add try-catch blocks around all thread entry points in the Windows version.
This has always been done in the main function, but these blocks will help
to narrow down the cause of problems should they ever be encountered in
control or service handlers.
* Centralize shutdown code on UNIX version in an appExit method as was already
being done for Windows versions.
* Fix a problem where the build.sh was not correctly using the included ant
if an ANT_HOME environment variable was defined.
* Add a new wrapper.single_invocation property which will prevent multiple
invocations of an application from being started on Windows platforms.
The shell script handles this on UNIX platforms. Feature Request #889123.
* Fix a crash problem introduced in 3.1.1, caused by a pair of uninitialized
pointers. The crash was possible on all platforms but would only happen
if the Wrapper was started without any arguments. It would not affect
users running the Wrapper normally. Bug #1018481.
* Fix a problem with the run as user feature of the shell script on Solaris.
Needed to be using /usr/xpg4/bin/id rather than /usr/bin/in if available.
Bug #1024008.
* Replace calls to usleep with nanosleep on platforms where it is available.
This was to fix an occasional hang on a specific Solaris machine. It would
occasionally hang on calls to usleep. From research, it appears that usleep
has problems when signals are encountered while sleeping. Still testing
whether or not this change solved the problem.
* Upgrade the version of Ant included with source releases to 1.6.2 to fix
some problems generating jni headers when building with Java 1.4.2.
* Upgrade the version of Cocoon included with source releases to 2.0.4 to
fix some problems generating documentation using Java 1.4.2.
* Display a warning if the exit status of a JVM process ever returns the
STILL_ACTIVE status on Windows. There was no known problem here, just
noticed it while looking over the code.
* Display a descriptive error message on Windows if the JVM process crashes
due to an uncaught exception in native JVM code.
* Add a test for invalid jvm arguments set using the wrapper.java.additional.
properties. Invalid arguments could cause the Wrapper startup to fail in
non obvious ways if they are mistaken by the JVM as the main class.
3.1.1
* Modified the way libwrapper.so is built on Solaris and Linux so that it
no longer statically links its required libraries.
* Fix a file handle leak when calling WrapperManager.getUser or
WrapperManager.getInteractiveUser on Windows platforms.
* Fix a problem introduced in 3.1.0 where the JVM would not be restarted
correctly if it quit after a ping timeout to let the Wrapper resynch and
restart it.
* Fix a problem where CTRL-C was not being handled correctly if the console
was configured to be shown when running as an NT service.
* Fix a problem where signals fired at UNIX versions of the wrapper were
not being handled correctly when the tick timer was being used.
* Fix a synchronization problem in the logging code which would
occassionally cause the Wrapper to crash with an Access Violation.
The problem was only encountered when the tick timer was enabled,
and was only seen on multi-CPU systems. Bug #949877.
* Fix a problem when using the tick timer where the Wrapper would sometimes
exit on startup due to an uncaught SIGALRM. Only reported on multi-CPU
Solaris systems.
* Fix a problem where the Wrapper would sometimes hang on shutdown if
another thread called System.exit while the Wrapper was shutting down.
Bug #955248.
* Fix a problem introduced in 3.1.0 where a very very large CPU timeout
warning message was being displayed if the system time was set back
while using the default system timer.
* Added a new property, wrapper.anchorfile, which makes it possible to
cause the Wrapper to shutdown by deleting an anchor file. The UNIX sh
script has been modified to optionally make use of this feature.
* Add a debug message at startup which makes it clear which timer is being
used.
* A Windows user reported that using forward slashes in the path the log
file was failing. Avoid this problem by always converting '/' to '\'
in the wrapper.logfile property on Windows.
* Fix a problem where it was not possible disable the wrapper log file as
documented in the wrapper.logfile property. Most likely broken way back
in version 2.2.5.
* Add some additional error checks after calls to control the pipe between
the JVM and Wrapper as well as improving the messages around other socket
related error messages.
* Fix a problem on some HP-UX systems were not working correctly because
the EAGAIN and EWOULDBLOCK constants are not equal with some compilers.
* Change some of the defaults in the src/conf/wrapper.conf.in file which
ships with the Wrapper to avoid confusion with new users.
* Rewrote the routine which reads and logs console output from the JVM
for Windows versions. Internal buffers are now scaled dynamically,
fixing a problem where long lines were being wrapped at 1024 characters.
This rewrite also resulted in a 4 fold increase in speed when the JVM is
sending large quantities of output to the console.
* Increase debug output on UNIX platforms when a signal is caught. When
possible, information about where the signal came from is now logged.
* Modified the way log output from within signal handlers is handled so it
is now queued and then logged by the main event loop.
* Back out a 3.1.0 change where a JVM that had failed to exit cleanly was
sent a SIGTERM prior to a SIGKILL. The SIGTERM made no difference and
slowed down the forced shutdown. A modification to the event loop made
the functionality more difficult to implement.
* Add the ability to set the user that the Wrapper and its JVM will run as
from within the sh script on UNIX platforms.
* Add an icon resource to the Wrapper binary on Windows versions.
* Fix a typo in the UNIX sh script which caused an extra slash to be included
in the path of the pid file. Was not causing any known problems.
* Added support for 64-bit HP-UX. Big thanks to Venkatesh Sellappa for
supplying the patch.
* Fix a deadlock problem introduced in 3.1.0 with some FreeBSD systems. Not
all users were experiencing it, but those who did were able to reliably
reproduce the problem. The problem appears to have been caused by
FreeBSD bug #kern/64313.
* Make the signal handling variables in the wrapper native library volatile.
Directly this was to fix a compiler warning on HP-UX64 systems but it
should also make the calls more efficient.
3.1.0
* The license was revised for this version to include a copyright omission.
This change is to be retroactively applied to all versions of the Java
Service Wrapper starting with version 3.0.0. The changes should have
no effect on users.
* The Online documentation and web site were both reworked. The logo has
been updated so that Duke is no longer used. The new online site now
has the ability for users to logon and append comments to any page.
* Added a new batch file which accepts commands like the UNIX shell script.
The new file is offered as an alternative to the default batch files, and
can be found at src/bin/AppCommand.bat.in. Thanks to Mike Castle for
donating the new script.
* The Windows version of the Wrapper was not correctly registering that it
would accept SHUTDOWN messages when running as a service. The Wrapper
was getting the message anyway so this should not change functionality.
Thanks to Jason Tishler for noticing this and sending in a patch.
* Add a new property, wrapper.native_library, which can be used to specify
the base name of the native library which is loaded by the WrapperManager
class.
* Modify the WrapperManager class so it now stores references to System.out
and System.err on initialization and always writes to those stored streams.
This makes sure that all Wrapper console output always goes to the
wrapper.log file even if user code overrides those streams with calls to
System.setOut and System.setErr. This was necessary to prevent deadlocks
in such user code from affecting the functionality of the Wrapper.
* Fixed a problem where some environment variables where not being correctly
loaded from the system registry when running as an NT service. Big thanks
to Eric Smith for tracking this down and submitting a patch. It turns out
that the putenv function was not being used correctly.
* Modified the way the wrapper.conf file is loaded so it will now read the
contents correctly even if the line feeds in the file are incorrect for
the current platform. Windows line feeds had been causing problems when
used on UNIX platforms. Feature Request #829896.
* Added a new property, wrapper.ntservice.console, which allows a console to
be displayed when running as an NT service.
* Fixed a problem where the request thread dump on failed JVM exit feature
had never worked when running as an NT service. Bug #831775.
* Add a new property, wrapper.console.title, which makes it possible to set
the title of the console in which the Wrapper is currently running. This
currently only works on Windows platforms.
* Added a new method, setConsoleTitle, to the WrapperManager class which
enables the application to dynamically set the console title. Like the
wrapper.console.title property, this only works on Windows platforms.
* Improved the algorithm of the request thread dump on failed JVM exit feature
so that extremely large thread dumps will not be truncated when the JVM
is killed.
* Fix a problem where CTRL-C was being ignored by the WrapperManager if a
WrapperListener is never registered. This is not possible if the Wrapper
is being used correctly but never the less a user did come across it.
* Add some additional debug output to help identify the cause of problems
loading the native library.
* The WrapperManager class now checks to make sure that its current version
matches the version of the native library and Wrapper. If there are any
discrepancies found then appropriate warnings will be displayed, but the
Application will still be allowed to start. This was added to make obvious
the cause of problems resulting from mismatched versions.
* Added a new property wrapper.use_system_time system time. By setting this
property to false, the Wrapper will start using a new experimental timer
which uses a background thread to manage time rather than the system time.
This has a number of advantages over using the system time and should give
most users even more reliable behavior when the system is under high load
or there are changes being made to the system time. The timer is very
critical to the operation of the Wrapper so the old behavior is left as
the default for the time being until this feature has had the chance to be
"time" tested. If all goes well then this will be enabled as the default
in a future version of the Wrapper.
A pair of related properties, wrapper.timer_fast_threshold and
wrapper.timer_slow_threshold were also added to aid in debugging.
* Rework the logging code so it is now thread safe. The addition of the
timer thread means that there is now more than a single thread accessing
that code. This was causing problems as the two threads tried to use the
same buffers. As part of this change, a new format variable 'D' was added
to display the thread which is doing the logging.
* Fix a problem where a thread dump would be invoked if the request thread
dump on failed JVM exit was enabled and the user forced an immediate
shutdown by pressing CTRL-C more than once.
* Add getUser and getInteractiveUser methods to the WrapperManager class to
make it possible for user code to query information about the user running
Wrapper or the user who is interacting with the Wrapper and its JVM.
Feature Request #812175.
* The Wrapper will now always exit with the exit code used to terminate the JVM
whether System.exit is used or WrapperManager.stop. When running as an NT
service the Wrapper now correctly returns the correct exit code to the
service manager so failure recovery tools should now work correctly.
Feature Request #852491.
* Add a status command to the UNIX shell script which can be used to find out
whether or not the wrapper is currently running. Patch submitted by
Joseph Benavidez.
* Modify the WrapperSimpleApp and WrapperStartStopApp so that the main method
of a class is located even if it exists in a parent class rather than the
class specified.
* To make debugging classpath problems easier, the Wrapper now verifies all
classpath entries before launching a JVM and logs debug level warnings for
any entries that do not exist.
* Fix a problem where it was possible to define a zero length filter that would
trigger on any output.
* Add some additional debug output to make it easier to debug startup,
shutdown and restart problems.
* Modify the way the Wrapper forcibly kills a frozen JVM on UNIX platforms so
that it now sends a SIGTERM, waits up to 5 seconds, then sends a SIGKILL.
* Add a new wrapper.java.library.path.append_system_path property which will
cause the Wrapper to append the system path to the generated library path.
Feature Request #917902.
* Fix a problem where spaces around the '=' character of a property definition
were rendering the property invisible to the Wrapper. Bug #916001.
* Fix a problem where the first ping timeout after the JVM was started was
still hard coded at 30 seconds. This was causing a combination of large
values of wrapper.ping.interval and wrapper.ping.timeout to fail.
* Fix a problem where the JVM would fail to shutdown cleanly if the Wrapper
was asked to stop too soon after launching a JVM. This was leading to the
JVM being killed after the shutdown timeout expired. Bug #917281.
* Added an adviser which will print out explanatory messages to the console
and wrapper log file when the Wrapper encounters a commonly made
configuration mistake. This is designed to cut down on support requests
by new users. Can be disabled using the wrapper.adviser property.
* The bash script and the realpath utility have been deprecated since version
3.0.3. They have been removed in this release. The sh script is recommended
on all UNIX platforms, and the realpath utility which was used by pre-3.0.3
bash and sh scripts has not been used since.
* Add the wrapper.startup.delay property along with console and service
specific variants which make it possible to configure a delay between the
Wrapper being launched and the first JVM being launched.
* Promote the wrapper.debug property back from being "deprecated". It has
continued to be useful and deserved documentation and official status.
* Add wrapper.on_exit. properties to control what happens when a exits
based on the exit code.
* Modify the way calls to System.in.read() are handled so that they now block
rather than throwing an exception. Currently, System.in can not be used with
the Wrapper because of the way I/O is passed between the Wrapper and JVM.
* Modified the Windows batch files to fix a problem where the path to the
Wrapper.exe contained more than one "/bin". The new batch files are much
simpler and should be easier to customize if needed. Bug #925308.
* Modified the wrapper.java.initmemory and wrapper.java.maxmemory properties
so that they now default to a value of 0 which causes the -Xms and -Xmx
parameters to be omitted from the command used to launch Java. This
will cause the JVM to use its own default values and also makes it possible
to specify the memory parameters using the wrapper.java.additional.
properties.
* Added a pair of environment variables, WRAPPER_FILE_SEPARATOR and
WRAPPER_PATH_SEPARATOR, whose values are set to either '/' and ':' or
'\' and ';' on startup. They can be used in the wrapper.conf file
to construct platform independent property values.
* Add a new wrapper.working.dir property which makes if possible to change
the Wrapper and JVM's working directory to a location other than the
location of the Wrapper binary. Feature Request #738160.
3.0.5
* Added support for SGI Irix. Big thanks to Andreas Wendt for supplying the
patch.
* Due to a bug in the build, the native library was not included in the 3.0.3
or 3.0.4 binary releases for OSX, building from source was working correctly.
This has been fixed and the build greatly simplified to avoid such problems
in the future. Bug #791755.
* Changed the default location of the pid file generated by the sh script to
exist in the same directory as the sh script rather than in the /var/run.
This can be changed by setting the PIDDIR variable in the sh script used to
launch the Wrapper.
* Added support for the wrapper.pidfile property on the Windows platform.
* Added the wrapper.java.pidfile property which will cause the pid of the
java process to be written to a specified file.
(WINDOWS USERS) If you are using a wrapper.conf file that was created prior
to version 3.0.0 of the Wrapper, then you may have this property defined in
your configuration file. You will get an error on startup if the specified
path does not exist.
* Stop clearing the file creation mask when the Unix version of the Wrapper is
run as a daemon process. The file creation mask will not be inherited from
the process which launches the Wrapper. Bug #788849.
* Modify the sh script so it works on Linux, then deprecate the bash script.
This means that all Unix platforms can now use the same script to control
the Wrapper. Thanks to Mike Castle for the patch. The bash script can still
be found in the release, but it is deprecated and will be removed in a
future version.
* Modified the sh script so it is now possible to set the nice priority in the
script configuration block.
* Remove output to System.out in the WrapperManager.requestThreadDump() method.
If some JVM threads were hung while accessing the System.out object,
attempting to do a thread a dump would cause the calling thread to hang as
well. Thanks to Thomas Hart for the patch.
* Make it obvious in the log whether or not the Wrapper was started as a
daemon process on UNIX systems.
* Modify the way restarts requested from the JVM, or caused by a filter are
handled. The Wrapper will no longer reset the restart count in either of
these cases. If an application runs for longer than the
wrapper.successful_invocation_time timeout then the count will still be
reset back to 0.
* Added a new wrapper.ignore_signals property which makes it possible to
configure the Wrapper so it will ignore CTRL-C, HALT and INT signals.
* Modify the WrapperManager.isLaunchedAsService() method on UNIX systems so it
now returns true if the Wrapper was launched with the wrapper.daemonize flag
set.
* Added a pair of MBean interfaces which allow the Wrapper to be controlled
using JMX. See the new JMX section in the documentation for details.
Thanks to Sal Ingrilli for help with testing.
* Modify the Windows build so the Wrapper.exe and Wrapper.dll files can now
be built from Ant if MSVC is installed.
* Added a new wrapper.ping.interval property which lets users control the
frequency that the Wrapper pings the JVM. Feature Request #607768.
* When a JVM refuses to shutdown, the Wrapper can be configured to request a
thread dump using the wrapper.request_thread_dump_on_failed_jvm_exit
property. The Wrapper was then waiting 1 second before the process was
killed. This was not always long enough, resulting in a truncated thread
dump. Increased the pause to 3 seconds. Feature Request #633761.
* Fix a bug where wrapper.app.parameter. and wrapper.java.additional.
properties declared from the Windows command line were not correctly
handling spaces in their values. Support Request #802139.
3.0.4
* Fix a problem on UNIX systems where requesting a second thread dump any time
during the life of a single Wrapper process would cause the Wrapper and JVM
to shutdown rather than perform the thread dump.
* Fix a problem where a, user without permission, attempting to stop an
application was able to delete the pid file even though they were unable
to stop the application itself. This would make the scripts think that
the application was stopped when was actually still running.
* Fix a problem where an application was being killed prematurely if it took
longer than 6 seconds to exit on its own. The scripts now make sure that
an application always has enough time to shutdown cleanly.
* Improve the debug output so that packet codes are now shown using a name
rather than a raw number.
* Reduce the frequency of "Waiting to stop..." messages displayed when removing
an NT service that is currently running. Decreased frequency from once per
second to once every five seconds.
* Fix a minor problem where the hour in the date returned by
WrapperInfo.getBuildTime() was not base 24.
* Added -t and -p command line options to the Windows version of the Wrapper
to sTart and stoP the Wrapper as an NT service. This can be used in place
of "net start" and "net stop", which do not always work correctly when a
service takes a long time to start up or shutdown. See the Launching Your
Application (Win32) section for more details.
* Add a new method WrapperManager.stopImmediate which will cause the JVM to
exit immediately without calling any stop methods or shutdown hooks.
* Add a new class, WrapperActionServer, which makes it easy to remotely control
the Wrapper remotely by opening a socket and sending commands. See the
javadocs of the class for more details.
* Fix bug #744801. A Java GUI was not being displayed when the application was
run in either console mode or as a service with wrapper.ntservice.interactive
enabled. This problem was introduced in Version 3.0.0 when using 1.2.x or
1.3.x versions of Java. To use interactive services with 1.2.x or 1.3.x
versions of java, please review the documentation for the
wrapper.ntservice.interactive property.
* Fix a problem where the JVM was not receiving CTRL-C and CTRL-CLOSE events
when running under the Wrapper on Windows. This was not a problem in most
cases as the Wrapper was taking care of the processing of the events. But
the WrapperListener.controlEvent() method was not being called as documented.
* Changed the way the WrapperSimpleApp and WrapperStartStopApp respond to
control events so that the JVM will respond and call WrapperManager.stop()
even when being controlled by the Wrapper.
* Modified the suggested behavior of the WrapperListener.controlEvent() method.
Users who have implemented the WrapperListener interface themselves should
review the Javadocs. The changes are not required and applications will
continue to function as they did before.
* Added support for DEC OSF1 (Alpha). Big thanks to Andreas Wendt for
supplying the patch.
* Fix a problem where the sh and bash scripts were failing if the path to the
script contained spaces.
* Fix a problem where the JVM would sometimes hang when trying to shutdown if
the wrapper.key parameter was passed to the JVM while not being controlled
by the Wrapper. This would happen if a user copied the command from the
Wrapper's debug output and attempted to run it as is without first removing
the wrapper.key parameter.
* Implement the ability to specify an NT service's load order group in response
to feature request #764143. See the javadocs for the new
wrapper.ntservice.load_order_group property for details.
* Improve the error message displayed when the NT EventLog is full in response
to feature request #643617. The EventLog output will now be disabled if any
errors are encountered while logging events. This prevents the error from
repeating.
* Improve the error message displayed on Windows when the configured Java
command can not be executed or does not exist.
* Fix a problem where the Wrapper was leaving a pipe unclosed each time the JVM
was restarted on all UNIX platforms. This was causing the Wrapper to run out
of file handles. Bug #767267, discovered and patched by David Wong.
* Fix a problem where the '#' character, which signifies a comment, could not
be included in property values. A double hash, '##' will now resolve into a
'#' within the property value. Bug #777303.
* Added support for FreeBSD. Big thanks to Alphonse Bendt for supplying the
patch.
* Make the wrapper.port property optional.
* Changed the way environment variables are loaded from the registry on Windows
platforms so users will no longer get warning messages about not being able
to handle very large environment variables. Prior versions could only handle
environment variables whose expanded value was less than 2048 characters in
length.
* Fix a problem on UNIX platforms where a shell used to start the Wrapper
running as a detached process would hang when the user attempted to exit
the shell. Thanks to Mike Castle for this patch.
3.0.3
* Added support for Mac OS X. Big thanks to Andy Barnett for supplying the
patch.
* Fix a segmentation fault on UNIX systems when the first console output
from the JVM was an empty line. Thanks to Mike Castle for finding this.
* Fix a problem where a 0 length malloc was being called if there were no
configured filters. This was fine on most platforms but caused a crash
on MAC OS X.
* Rework the initialization of the bash and sh scripts so that they will
work correctly when referenced as symbolic links. Thanks go out to Richard
Emberson for the code to resolve symbolic links.
* Deprecated the realpath binary in the *NIX distributions as it is no longer
used by the bash or sh scripts. It is being left in for now so as not to
break the build scripts of other projects, but it will be removed after a
couple more releases.
* Added a test to make sure that wrapper.ntservice.interactive is not set to
TRUE when an account is specified using wrapper.ntservice.account.
3.0.2
* Modified the sh and bash scripts so that console log output is disabled by
default when the scripts are launched with the 'start' action. Running with
the 'console' action will still send output to the console. Logging to the
file is still enabled.
* Modified the wrapper.ping.timeout property so it also controls the ping
timeout within the JVM. Before the timeout on responses to the Wrapper
could be controlled, but the ping timeout within the JVM was hardcoded to
30 seconds.
* In the last release, some work was done to avoid false timeouts caused by
large quantities of output. On some heavily loaded systems, timeouts were
still being encountered. Rather than reading up to 50 lines of input, the
code will now read for a maximum of 250ms before returning to give the main
event loop more cycles.
* Fix a problem where the values of environment variables set in the
configuration file were not correct when those values included references
to other environment variables.
* Fix a potential buffer overflow problem if configuration properties
referenced extremely large environment variables.
* Fix a potential problem where the inability to expand very large environment
variables would have led to an access violation when run as an NT service.
* Add some extra checks in the event where the native library can not be loaded
so that the WrapperManager can differentiate between the library missing and
not being readable due to permission problems.
* Remove the wrapper.ntservice.process_priority from the default wrapper.conf
because its use can produce unexpected results if used improperly. Please
see the property documentation for details.
* Fix a problem where environment variables in the registry which had no value
were causing the Wrapper to crash with an access violation. This was
introduced in version 3.0.0 with the feature to load environment variables
from the registry. The offending registry entry was WV_GATEWAY_CFG which
appears to be related to Oracle.
3.0.1
* Fix a problem with the wrapper.disable_shutdown_hook. Due to a typo in the
source, the property was being ignored. This was broken in the 3.0.0
release.
* Fix a problem with the HP-UX release build reported by Ashish Gawarikar.
* Add the ability to set environment variables from within the configuration
file or from the command line.
* Fix a problem on HP-UX and AIX machines where the stop() function in the
shell scripts was causing a syntax error due to a conflict with a like named
shell command on those platforms. This appears to be an issue with the
Korn shell on all platforms.
* Fix a problem where very heavy output from the JVM can cause the Wrapper to
give a false timeout. The Wrapper now only reads 50 lines of input at a time
to guarantee that the Wrapper's event loop always gets cycles.
* Fix a problem on UNIX versions where extra line breaks would sometimes be
added to the logged output when there was large amounts of output being
sent from the JVM.
* Fix a problem where a large number of calls to WrapperManager.log()
immediately before the JVM exits could lead to the Wrapper incorrectly
reporting that the JVM exited unexpectedly.
3.0.0
* Deprecated the com.silveregg.wrapper package in favor of
org.tanukisoftware.wrapper. The classes and interfaces in the silveregg
package will continue to function, but migration to the new package should
be done when possible. See the project history for details.
* On Windows systems change any forward slashes in the wrapper.java.command
property to back slashes. Some users had reported having problems on
Windows XP.
* Implemented feature request #633178. Added WrapperManager.requestThreadDump()
to force the current JVM to immediately perform a thread dump.
* Fixed bug where wrapper.logfile.maxsize was being set to 0 if the 'k' or 'm'
unit was omitted.
* Add the ability to specify an account name and password when installing an
NT service.
* Add a property, wrapper.ntservice.interactive, which makes it possible to
control whether or not the Java process can gain access to the desktop while
it is running as an NT service.
* Add limited support for 1.2.x versions of Java. Shutdown hooks are
supported until Java 1.3 so those functions will be disabled. If the
application displays a GUI then Java 1.3 should be used as the GUI can not
currently be displayed when using Java 1.2.x.
* Made it possible to use the wrapper.pidfile property on all *nix platforms.
Please notice that the property has been removed from the default
wrapper.conf file. The property is not needed when the wrapper is launched
with the bash shell script. The sh shell script will set the wrapper.pidfile
when the wrapper is launched. If either of the scripts provided with the
Wrapper distribution are used then the wrapper.pidfile should always be
removed from your wrapper.conf file.
* Added a new wrapper.daemonize property which, when set, will form the wrapper
process to be a detached non-session group leader. This makes it possible to
launch the wrapper in such a way that it will not be terminated when the user
launching the process logs out. This had been a problem on Solaris systems
when using the sh shell. The default sh and bash scripts both make use of
this in the default. Please update your scripts for use with this version.
Thanks to Rajiv Subrahmanyam for the patch.
* Fix a problem where the Wrapper was incorrectly counting the number of
non-daemon threads in BEA's JRockit Virtual Machine. This was causing the
application to shutdown when the non-daemon thread count dropped to 1.
* Added support for building the wrapper on AIX and HP-UX systems. Thanks for
the patches involved go out to Ashish Gawarikar and William Lee.
* Implement feature request #653131 to force the JVM to immediately exit when
the user presses CTRL-C multiple times.
* Added a 'console' action to the bash and sh scripts to make it possible to
launch the Wrapper in the current shell process. The 'start' task will launch
the Wrapper as a spawned daemon process.
* Fixed a problem where missing environment variables specified in classpath
or library path properties were not being handled correctly.
* Implemented feature request #676599 to enable the filtering of JVM output to
trigger JVM restarts or Wrapper shutdowns. See the new
wrapper.filter.trigger.n and wrapper.filter.action.n properties.
* Modify the Win32 version of the Wrapper so that Environment Variables are
always read from the system registry when the Wrapper is run as a service.
By doing this, it makes it possible to change or add the system environment
variables and have them take effect without having to first reboot the
machine.
* Implemented cascading configuration files.
* Changed the default value for the wrapper.java.initmemory property to be 3Mb.
The default on Windows and Linux JVMs is 2Mb, but the Solaris JVM requires
a minimum of 3Mb. The minimum value accepted by the Wrapper was changed
from 8Mb to 1Mb to make it possible to reduce the footprint of applications
to what is possible without using the wrapper.
* Improve the parsing of configuration files so that leading and trailing white
space is now correctly trimmed. It is also now possible to have comments at
the end of a line containing a property.
* Modify the way exceptions thrown by an application's main method are
presented to the user by the WrapperSimpleApp and WrapperStartStopApp so
they no longer look like a problem with Wrapper configuration.
2.2.9
* Added a new property, wrapperper.restart.delay, which allows the user to control
the amount of time to pause between a JVM exiting and a new JVM being
launched.
* Fixed bug #611024. The Wrapper would sometimes fail to start if
wrapper.max_failed_invocations is set to 1.
* Fix a problem where the number of non-daemon threads was not being calculated
in some cases.
* Implemented feature request #491443. Environment variables referenced in the
wrapper.conf file will now be evaluated as the file is loaded. The windows
syntax for environment variables is used on all platforms to make them
platform independent.
* Fixed a problem where the wrapper.conf was being open with both read and
write locks when a read lock is all that is needed. Made the wrapper fail
on startup if another application held a read lock on the conf file.
* Modified the message displayed when the native library could not be found,
so that it is much more descriptive. Hopefully it will cut down on questions
caused by configuration problems.
* Implemented feature request #613539. Modified the wrapper.java.library.path
to function like the wrapper.java.classpath.n properties so that multiple
directories can be specified in the library path in a platform independent
way. The old property is still supported, but deprecated.
* Fix Bug #632215. The WrapperManager.isLaunchedAsService() method was always
returning false, even when run as a service under Windows. On linux, the
Wrapper is always run as a console app, so this method will always return
false.
* Improve the message thrown when user code attempts to access System.in from
within a JVM being controlled by the Wrapper. System.in will not work
because the JVM is a spawned process.
2.2.8
* Fixed a compiler problem on Solaris some systems.
* Added a new property, wrapper.cpu.timeout, which allows the user to control
how much time without receiving any CPU the Wrapper will tolerate before
displaying a warning message. The CPU timeout feature was added in 2.2.7
but the default timeout of 10 seconds was not configurable.
* The Wrapper was only allowing 5 seconds between the JVM informing the
Wrapper that it was going to exit and the JVM process actually exiting.
This would cause the Wrapper to terminate the process prematurely in
cases where an application shutdown thread took longer than 5 seconds to
complete. The Wrapper now allows wrapper.jvm_exit.timeout seconds for
the JVM process to exit on its own before being forcibly terminated.
* When there is a configuration problem or a resource is unavailable, a JVM
will sometimes exit abnormally very shortly after being launched. This
can lead the JVM being infinitely restarted due to a simple class
path misconfiguration. To work around this, the Wrapper has always had
a hard limit of 5 restarts within a short period of time. If the JVM
has been running for more than a few minutes, then the count was reset.
In this version, a new property. wrapper.max_failed_invocations was added
to allow the max value to be set. The time period which the JVM must
now be running for the JVM launch to have been considered a success for
restart purposes is set using the new wrapper.successful_invocation_time
property.
* The number of advanced properties which most users do not need has been
increasing as the Wrapper has been made more and more flexible. This
has been causing confusion in their usage by people who play with them
without first reading the documentation. To solve this, the advanced
properties were removed from the default configuration file. They still
function. But users must now read to the advanced configuration
documentation to learn about their existence. Added quite about to the
descriptions of these properties to hopefully clear up any confusion
about their usage.
* When the JVM exits abnormally, the Wrapper will pause for a few seconds
before starting another JVM. If the user pressed CTRL-C during this
pause, a new JVM would still be launched. The new JVM was exiting
immediately but it was a waste of time. The Wrapper now recognizes the
event and aborts launching the new JVM.
* Added a page to the documentation which shows inline javadocs. This
will hopefully make it easier to navigate them as part of the full
documentation set.
* Added a new method to the WrapperManager which enables user code to
log at any log level.
* Added a new Helper class WrapperStartStopApp which allows users to easily
integrate applications like Tomcat which use a separate class to stop
the application.
* Added a samples section to the documentation. Just includes Tomcat 4
for now.
2.2.7
* Fix a problem where the JVM was trying to reconnect the Wrapper as it was
being shutdown. This was causing problems if the JVM was being restarted.
* Added support for the system being suspended to RAM or disk. Also improved
wrapper performance when a system is under 100% load. See the new example
output in the example section.
* Fix a problem where the log output was not being directed to a file called
wrapper.log in the same directory as the Wrapper binary in the event that the
configured wrapper log file could not be accessed.
* Fix a problem where the Wrapper was not shutting down the JVM correctly when
all non daemon threads completed. Normally a JVM will exit when all of its
non daemon threads have completed so this was causing some problems.
(Thanks to Jung Tamas)
* Added the ability to set the priority of the Wrapper and its JVM when run
as an NT service or console application. The same thing can be better
achieved on Unix systems by using "nice" in the shell script used to launch
the Wrapper. See the documentation for for details.
* JVM information was not being displayed correctly when the Wrapper native
library could not be loaded.
* Added a new property to cause the wrapper to attempt to request a thread dump
when the JVM does not exit on request.
* Improved the documentation of the WrapperSimpleApp and WrapperListener
classes.
* Adding a new property wrapper.shutdown.timeout to allow the user to extend
the length of time that an application is allowed to take shutting down.
* Rework the way the shutdown process works so that System.exit will never be
called before the stop method in WrapperListener has had a chance to complete.
* Add a Restart button to the TestWrapper application.
* Fix a problem on Unix versions where '%' characters in Java output would
sometimes cause the wrapper to crash. Somehow missed getting this into the
last release.
* Added a test to make sure that WrapperManager.stop is not called recursively.
* Added support for building under Windows XP. Prebuilt installations had
already been working.
2.2.6
* Fix a problem where '%' characters in Java output would sometimes cause the
wrapper to crash. (Thanks to Frode Moe)
* Added support for requesting a Java thread dump without shutting down the
Java process.
* Fixed a problem on windows where the java command was looking in the windows
system and system32 directories for the java executable before checking the
path when the full path to the java executable was not specified in the
configuration file. This could lead to different JVM being run from the
Wrapper than was run if java -version was run from the command line. The
Wrapper will now attempt to resolve the full java path using the PATH
environment variable.
* Added debug output showing Java version information when the JVM first
starts.
* Modified c source to use /* */ style comments rather than // style comments.
Some people were having problems with some compilers.
2.2.5
* Added support for service descriptions for Win2k and XP.
* Fixed bug issue when reading configuration files from Windows on Unix.
* Deprecated the wrapper.debug property in favor of loglevels.
* Added new logger functionality includes the following features:
Loglevels like Log4j, NT Eventlog support, UNIX syslog support and rolling
log files.
* Added wildcard support for classpath entries in wrapper.conf.
* Added the ability to specify configuration properties from the command line.
* Changed the way NT services are installed so that a patched version of the
Wrapper.exe file no longer needs to be created to reference the
wrapper.conf file.
2.2.4
* The value of APP_NAME in the bash or sh scripts no longer needs to be the
same as the script.
* Added the ability to format and/or disable file logging and output to the
console.
* Set mode of executables in binary release tar files so that they can be run
without modification after being extracted.
* Fixed line feeds in release so that bat files are always CRLF, unix scripts
are always LF. Other source files are always CRLF in ZIP archives and LF
in tar.gz archives.
* Make the build fail if Wrapper.exe or Wrapper.dll do not exist for Windows
builds.
* Added an empty wrapper.log to the releases so that the TestWrapper example
program runs out of the box.
2.2.3
* Added template scripts and conf files for ease of integration with other
applications.
* Cleaned up the build.
* The WrapperSimpleApp method of launchine applications was not working
correctly with applications whose main method did not return.
* Add sample scripts and wrapper.conf files in the bin and lib directories.
These scripts are used to start a sample application which runs out of the
box. See the new example.html page in the documentation for more details.
* Get rid of the platform specific directories in the bin and lib directories.
* Enable relative paths for Windows version. In previous versions of Wrapper,
it was necessary to always use absolute paths because the working directory
of the wrapper would be then NT System32 directory when run as a service.
* On the windows version, the wrapper always sets the current working
directory to the location of the wrapper executable immediately after
startup.
* Improvements to the documentation / web page.
2.2.2
* Added HTML based documentation.
2.2.1
* Added Linux and Solaris build files.
* Added Linux and Solaris documentation.
2.2.0
* Initial Public Release.
wrapper_3.5.51_src/doc/wrapper-community-license-1.3.txt 100644 0 0 152561 14333053650 20350 0 ustar 0 0 ----------------------------------------------------------------------
----------------- -----------------
Tanuki Software, Ltd.
Community Software License Agreement
Version 1.3
IMPORTANT-READ CAREFULLY: This license agreement is a legal agreement
between you ("Licensee") and Tanuki Software, Ltd. ("TSI"), which
includes computer software, associated media, printed materials, and
may include online or electronic documentation ( Software ). PLEASE
READ THIS AGREEMENT CAREFULLY BEFORE YOU INSTALL, COPY, DOWNLOAD OR
USE THE SOFTWARE ACCOMPANYING THIS PACKAGE.
Section 1 - Grant of License
Community editions of the Software are made available on the GNU
General Public License, Version 2 ("GPLv2") or Version 3 ("GPLv3"),
included in Sections 4 and 5 of this license document. All sections
of the Community Software License Agreement must be complied with in
addition to those of either the GPLv2 or GPLv3. This license allows
the Software Program to be used with Products that are released under
either GPLv2 or GPLv3.
Section 2 - Definitions
2.1. "Community Edition" shall mean versions of the Software Program
distributed in source form under this license agreement, and all new
releases, corrections, enhancements and updates to the Software
Program, which TSI makes generally available under this agreement.
2.2. "Documentation" shall mean the contents of the website
describing the functionality and use of the Software Program, located
at http://wrapper.tanukisoftware.org
2.3. "Product" shall mean the computer programs, that are provided by
Licensee to Licensee customers or potential customers, and that
contain both the Software Program as a component of the Product, and a
component or components (other than the Software Program) that provide
the material functionality of the Product. If the Product is released
in source form, the Software Program or any of its components may only
be included in executable form.
2.4. "Software Program" shall mean the computer software and license
file provided by TSI under this Agreement, including all new releases,
corrections, enhancements and updates to such computer software, which
TSI makes generally available and which Licensee receive pursuant to
Licensee subscription to TSIMS. Some specific features or platforms
may not be enabled if they do not fall under the feature set(s)
covered by the specific license fees paid.
2.5 "End User" shall mean the customers of the Licensee or any
recipient of the Product whether or not any payment is made to use
the Product.
Section 3 - Licensee Obligations
A copy of this license must be distributed in full with the Product
in a location that is obvious to any End User.
In accordance with Section 4 (GPLv2) or Section 5 (GPLv3), the full
source code of all components of the Product must be made available to
any and all End Users.
Licensee may extend and/or modify the Software Program and distribute
under the terms of this agreement provided that the copyright notice
and license information displayed in the console and log files are
not obfuscated or obstructed in any way.
Section 4 - GPLv2 License Agreement
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
Everyone is permitted to copy and distribute verbatim copies of
this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General
Public License is intended to guarantee your freedom to share and
change free software--to make sure the software is free for all
its users. This General Public License applies to most of the Free
Software Foundation's software and to any other program whose
authors commit to using it. (Some other Free Software Foundation
software is covered by the GNU Library General Public License
instead.) You can apply it to your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and
charge for this service if you wish), that you receive source code
or can get it if you want it, that you can change the software or
use pieces of it in new free programs; and that you know you can
do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the
rights. These restrictions translate to certain responsibilities
for you if you distribute copies of the software, or if you modify
it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights
that you have. You must make sure that they, too, receive or can
get the source code. And you must show them these terms so they
know their rights.
We protect your rights with two steps:
(1) copyright the software, and
(2) offer you this license which gives you legal permission to
copy, distribute and/or modify the software.
Also, for each author's protection and ours, we want to make
certain that everyone understands that there is no warranty for
this free software. If the software is modified by someone else
and passed on, we want its recipients to know that what they have
is not the original, so that any problems introduced by others
will not reflect on the original authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making
the program proprietary. To prevent this, we have made it clear
that any patent must be licensed for everyone's free use or not
licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which
contains a notice placed by the copyright holder saying it may be
distributed under the terms of this General Public License. The
"Program", below, refers to any such program or work, and a "work
based on the Program" means either the Program or any derivative
work under copyright law: that is to say, a work containing the
Program or a portion of it, either verbatim or with modifications
and/or translated into another language. (Hereinafter, translation
is included without limitation in the term "modification".) Each
licensee is addressed as "you".
Activities other than copying, distribution and modification are
not covered by this License; they are outside its scope. The act
of running the Program is not restricted, and the output from the
Program is covered only if its contents constitute a work based on
the Program (independent of having been made by running the
Program). Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep
intact all the notices that refer to this License and to the
absence of any warranty; and give any other recipients of the
Program a copy of this License along with the Program.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange
for a fee.
2. You may modify your copy or copies of the Program or any
portion of it, thus forming a work based on the Program, and copy
and distribute such modifications or work under the terms of
Section 1 above, provided that you also meet all of these
conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but does
not normally print such an announcement, your work based on the
Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the
Program, and can be reasonably considered independent and separate
works in themselves, then this License, and its terms, do not
apply to those sections when you distribute them as separate works.
But when you distribute the same sections as part of a whole which
is a work based on the Program, the distribution of the whole must
be on the terms of this License, whose permissions for other
licensees extend to the entire whole, and thus to each and every
part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or
contest your rights to work written entirely by you; rather, the
intent is to exercise the right to control the distribution of
derivative or collective works based on the Program.
In addition, mere aggregation of another work not based on the
Program with the Program (or with a work based on the Program) on
a volume of a storage or distribution medium does not bring the
other work under the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms
of Sections 1 and 2 above provided that you also do one of the
following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software
interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work
for making modifications to it. For an executable work, complete
source code means all the source code for all modules it contains,
plus any associated interface definition files, plus the scripts
used to control compilation and installation of the executable.
However, as a special exception, the source code distributed need
not include anything that is normally distributed (in either
source or binary form) with the major components (compiler,
kernel, and so on) of the operating system on which the executable
runs, unless that component itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this
License. However, parties who have received copies, or rights,
from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify
or distribute the Program or its derivative works. These actions
are prohibited by law if you do not accept this License.
Therefore, by modifying or distributing the Program (or any work
based on the Program), you indicate your acceptance of this
License to do so, and all its terms and conditions for copying,
distributing or modifying the Program or works based on it.
6. Each time you redistribute the Program (or any work based on
the Program), the recipient automatically receives a license from
the original licensor to copy, distribute or modify the Program
subject to these terms and conditions. You may not impose any
further restrictions on the recipients' exercise of the rights
granted herein. You are not responsible for enforcing compliance
by third parties to this License.
7. If, as a consequence of a court judgment or allegation of
patent infringement or for any other reason (not limited to
patent issues), conditions are imposed on you (whether by court
order, agreement or otherwise) that contradict the conditions of
this License, they do not excuse you from the conditions of this
License. If you cannot distribute so as to satisfy simultaneously
your obligations under this License and any other pertinent
obligations, then as a consequence you may not distribute the
Program at all. For example, if a patent license would not permit
royalty-free redistribution of the Program by all those who
receive copies directly or indirectly through you, then the only
way you could satisfy both it and this License would be to refrain
entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable
under any particular circumstance, the balance of the section is
intended to apply and the section as a whole is intended to apply
in other circumstances.
It is not the purpose of this section to induce you to infringe
any patents or other property right claims or to contest validity
of any such claims; this section has the sole purpose of
protecting the integrity of the free software distribution system,
which is implemented by public license practices. Many people have
made generous contributions to the wide range of software
distributed through that system in reliance on consistent
application of that system; it is up to the author/donor to decide
if he or she is willing to distribute software through any other
system and a licensee cannot impose that choice.
This section is intended to make thoroughly clear what is believed
to be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces,
the original copyright holder who places the Program under this
License may add an explicit geographical distribution limitation
excluding those countries, so that distribution is permitted only
in or among countries not thus excluded. In such case, this
License incorporates the limitation as if written in the body of
this License.
9. The Free Software Foundation may publish revised and/or new
versions of the General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies a version number of this License which applies
to it and "any later version", you have the option of following
the terms and conditions either of that version or of any later
version published by the Free Software Foundation. If the Program
does not specify a version number of this License, you may choose
any version ever published by the Free Software Foundation.
10. If you wish to incorporate parts of the Program into other
free programs whose distribution conditions are different, write
to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free
status of all derivatives of our free software and of promoting
the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE
LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS
AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR
OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY
MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE
LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU
OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY
OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Section 5 - GPLv3 License Agreement
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright c 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies of
this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are
designed to take away your freedom to share and change the works.
By contrast, the GNU General Public License is intended to
guarantee your freedom to share and change all versions of a
program--to make sure it remains free software for all its users.
We, the Free Software Foundation, use the GNU General Public
License for most of our software; it applies also to any other
work released this way by its authors. You can apply it to your
programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and
charge for them if you wish), that you receive source code or can
get it if you want it, that you can change the software or use
pieces of it in new free programs, and that you know you can do
these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you
have certain responsibilities if you distribute copies of the
software, or if you modify it: responsibilities to respect the
freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too,
receive or can get the source code. And you must show them these
terms so they know their rights.
Developers that use the GNU GPL protect your rights with two
steps: (1) assert copyright on the software, and (2) offer you
this License giving you legal permission to copy, distribute
and/or modify it.
For the developers' and authors' protection, the GPL clearly
explains that there is no warranty for this free software. For
both users' and authors' sake, the GPL requires that modified
versions be marked as changed, so that their problems will not be
attributed erroneously to authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the
manufacturer can do so. This is fundamentally incompatible with
the aim of protecting users' freedom to change the software. The
systematic pattern of such abuse occurs in the area of products
for individuals to use, which is precisely where it is most
unacceptable. Therefore, we have designed this version of the GPL
to prohibit the practice for those products. If such problems
arise substantially in other domains, we stand ready to extend
this provision to those domains in future versions of the GPL, as
needed to protect the freedom of users.
Finally, every program is threatened constantly by software
patents. States should not allow patents to restrict development
and use of software on general-purpose computers, but in those
that do, we wish to avoid the special danger that patents applied
to a free program could make it effectively proprietary. To
prevent this, the GPL assures that patents cannot be used to
render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public
License.
"Copyright" also means copyright-like laws that apply to other
kinds of works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the
work in a fashion requiring copyright permission, other than the
making of an exact copy. The resulting work is called a "modified
version" of the earlier work or a work "based on" the earlier
work.
A "covered work" means either the unmodified Program or a work
based on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it
on a computer or modifying a private copy. Propagation includes
copying, distribution (with or without modification), making
available to the public, and in some countries other activities as
well.
To "convey" a work means any kind of propagation that enables
other parties to make or receive copies. Mere interaction with a
user through a computer network, with no transfer of a copy, is
not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently
visible feature that (1) displays an appropriate copyright notice,
and (2) tells the user that there is no warranty for the work
(except to the extent that warranties are provided), that
licensees may convey the work under this License, and how to view
a copy of this License. If the interface presents a list of user
commands or options, such as a menu, a prominent item in the list
meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an
official standard defined by a recognized standards body, or, in
the case of interfaces specified for a particular programming
language, one that is widely used among developers working in that
language.
The "System Libraries" of an executable work include anything,
other than the work as a whole, that (a) is included in the normal
form of packaging a Major Component, but which is not part of that
Major Component, and (b) serves only to enable use of the work
with that Major Component, or to implement a Standard Interface
for which an implementation is available to the public in source
code form. A "Major Component", in this context, means a major
essential component (kernel, window system, and so on) of the
specific operating system (if any) on which the executable work
runs, or a compiler used to produce the work, or an object code
interpreter used to run it.
The "Corresponding Source" for a work in object code form means
all the source code needed to generate, install, and (for an
executable work) run the object code and to modify the work,
including scripts to control those activities. However, it does
not include the work's System Libraries, or general-purpose tools
or generally available free programs which are used unmodified in
performing those activities but which are not part of the work.
For example, Corresponding Source includes interface definition
files associated with source files for the work, and the source
code for shared libraries and dynamically linked subprograms that
the work is specifically designed to require, such as by intimate
data communication or control flow between those subprograms and
other parts of the work.
The Corresponding Source need not include anything that users can
regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running
a covered work is covered by this License only if the output,
given its content, constitutes a covered work. This License
acknowledges your rights of fair use or other equivalent, as
provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise
remains in force. You may convey covered works to others for the
sole purpose of having them make modifications exclusively for
you, or provide you with facilities for running those works,
provided that you comply with the terms of this License in
conveying all material for which you do not control copyright.
Those thus making or running the covered works for you must do
so exclusively on your behalf, under your direction and control,
on terms that prohibit them from making any copies of your
copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section
10 makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under
article 11 of the WIPO copyright treaty adopted on 20 December
1996, or similar laws prohibiting or restricting circumvention of
such measures.
When you convey a covered work, you waive any legal power to
forbid circumvention of technological measures to the extent such
circumvention is effected by exercising rights under this License
with respect to the covered work, and you disclaim any intention
to limit operation or modification of the work as a means of
enforcing, against the work's users, your or third parties' legal
rights to forbid circumvention of technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright
notice; keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the
code; keep intact all notices of the absence of any warranty;
and give all recipients a copy of this License along with the
Program.
You may charge any price or no price for each copy that you
convey, and you may offer support or warranty protection for a
fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications
to produce it from the Program, in the form of source code under
the terms of section 4, provided that you also meet all of these
conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to "keep
intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and
independent works, which are not by their nature extensions of the
covered work, and which are not combined with it such as to form a
larger program, in or on a volume of a storage or distribution
medium, is called an "aggregate" if the compilation and its
resulting copyright are not used to limit the access or legal
rights of the compilation's users beyond what the individual works
permit. Inclusion of a covered work in an aggregate does not cause
this License to apply to the other parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the machine-
readable Corresponding Source under the terms of this License, in
one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the Corresponding
Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission,
provided you inform other peers where the object code and
Corresponding Source of the work are being offered to the general
public at no charge under subsection 6d.
A separable portion of the object code, whose source code is
excluded from the Corresponding Source as a System Library, need
not be included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means
any tangible personal property which is normally used for
personal, family, or household purposes, or (2) anything designed
or sold for incorporation into a dwelling. In determining whether
a product is a consumer product, doubtful cases shall be resolved
in favor of coverage. For a particular product received by a
particular user, "normally used" refers to a typical or common use
of that class of product, regardless of the status of the
particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A
product is a consumer product regardless of whether the product
has substantial commercial, industrial or non-consumer uses,
unless such uses represent the only significant mode of use of the
product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to
install and execute modified versions of a covered work in that
User Product from a modified version of its Corresponding Source.
The information must suffice to ensure that the continued
functioning of the modified object code is in no case prevented or
interfered with solely because modification has been made.
If you convey an object code work under this section in, or with,
or specifically for use in, a User Product, and the conveying
occurs as part of a transaction in which the right of possession
and use of the User Product is transferred to the recipient in
perpetuity or for a fixed term (regardless of how the transaction
is characterized), the Corresponding Source conveyed under this
section must be accompanied by the Installation Information. But
this requirement does not apply if neither you nor any third party
retains the ability to install modified object code on the User
Product (for example, the work has been installed in ROM).
The requirement to provide Installation Information does not
include a requirement to continue to provide support service,
warranty, or updates for a work that has been modified or
installed by the recipient, or for the User Product in which it
has been modified or installed. Access to a network may be denied
when the modification itself materially and adversely affects the
operation of the network or violates the rules and protocols for
communication across the network.
Corresponding Source conveyed, and Installation Information
provided, in accord with this section must be in a format that is
publicly documented (and with an implementation available to the
public in source code form), and must require no special password
or key for unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of
this License by making exceptions from one or more of its
conditions. Additional permissions that are applicable to the
entire Program shall be treated as though they were included in
this License, to the extent that they are valid under applicable
law. If additional permissions apply only to part of the Program,
that part may be used separately under those permissions, but the
entire Program remains governed by this License without regard to
the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part
of it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered
work, for which you have or can give appropriate copyright
permission.
Notwithstanding any other provision of this License, for material
you add to a covered work, you may (if authorized by the copyright
holders of that material) supplement the terms of this License
with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material,
or requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors
or authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions
of it) with contractual assumptions of liability to the recipient,
for any liability that these contractual assumptions directly
impose on those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as
you received it, or any part of it, contains a notice stating that
it is governed by this License along with a term that is a further
restriction, you may remove that term. If a license document
contains a further restriction but permits relicensing or
conveying under this License, you may add to a covered work
material governed by the terms of that license document, provided
that the further restriction does not survive such relicensing or
conveying.
If you add terms to a covered work in accord with this section,
you must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in
the form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights
under this License (including any patent licenses granted under
the third paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly
and finally terminates your license, and (b) permanently, if the
copyright holder fails to notify you of the violation by some
reasonable means prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you
have received notice of violation of this License (for any work)
from that copyright holder, and you cure the violation prior to 30
days after your receipt of the notice.
Termination of your rights under this section does not terminate
the licenses of parties who have received copies or rights from
you under this License. If your rights have been terminated and
not permanently reinstated, you do not qualify to receive new
licenses for the same material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer
transmission to receive a copy likewise does not require
acceptance. However, nothing other than this License grants you
permission to propagate or modify any covered work. These actions
infringe copyright if you do not accept this License. Therefore,
by modifying or propagating a covered work, you indicate your
acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not
responsible for enforcing compliance by third parties with this
License.
An "entity transaction" is a transaction transferring control of
an organization, or substantially all assets of one, or
subdividing an organization, or merging organizations. If
propagation of a covered work results from an entity transaction,
each party to that transaction who receives a copy of the work
also receives whatever licenses to the work the party's
predecessor in interest had or could give under the previous
paragraph, plus a right to possession of the Corresponding Source
of the work from the predecessor in interest, if the predecessor
has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you
may not impose a license fee, royalty, or other charge for
exercise of rights granted under this License, and you may not
initiate litigation (including a cross-claim or counterclaim in a
lawsuit) alleging that any patent claim is infringed by making,
using, selling, offering for sale, or importing the Program or any
portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under
this License of the Program or a work on which the Program is
based. The work thus licensed is called the contributor's
"contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired
or hereafter acquired, that would be infringed by some manner,
permitted by this License, of making, using, or selling its
contributor version, but do not include claims that would be
infringed only as a consequence of further modification of the
contributor version. For purposes of this definition, "control"
includes the right to grant patent sublicenses in a manner
consistent with the requirements of this License.
Each contributor grants you a non-exclusive, worldwide, royalty-
free patent license under the contributor's essential patent
claims, to make, use, sell, offer for sale, import and otherwise
run, modify and propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any
express agreement or commitment, however denominated, not to
enforce a patent (such as an express permission to practice a
patent or covenant not to sue for patent infringement). To "grant"
such a patent license to a party means to make such an agreement
or commitment not to enforce a patent against the party.
If you convey a covered work, knowingly relying on a patent
license, and the Corresponding Source of the work is not available
for anyone to copy, free of charge and under the terms of this
License, through a publicly available network server or other
readily accessible means, then you must either (1) cause the
Corresponding Source to be so available, or (2) arrange to deprive
yourself of the benefit of the patent license for this particular
work, or (3) arrange, in a manner consistent with the requirements
of this License, to extend the patent license to downstream
recipients. "Knowingly relying" means you have actual knowledge
that, but for the patent license, your conveying the covered work
in a country, or your recipient's use of the covered work in a
country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of,
a covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate,
modify or convey a specific copy of the covered work, then the
patent license you grant is automatically extended to all
recipients of the covered work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that
are specifically granted under this License. You may not convey a
covered work if you are a party to an arrangement with a third
party that is in the business of distributing software, under
which you make payment to the third party based on the extent of
your activity of conveying the work, and under which the third
party grants, to any of the parties who would receive the covered
work from you, a discriminatory patent license (a) in connection
with copies of the covered work conveyed by you (or copies made
from those copies), or (b) primarily for and in connection with
specific products or compilations that contain the covered work,
unless you entered into that arrangement, or that patent license
was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or
limiting any implied license or other defenses to infringement
that may otherwise be available to you under applicable patent
law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order,
agreement or otherwise) that contradict the conditions of this
License, they do not excuse you from the conditions of this
License. If you cannot convey a covered work so as to satisfy
simultaneously your obligations under this License and any other
pertinent obligations, then as a consequence you may not convey it
at all. For example, if you agree to terms that obligate you to
collect a royalty for further conveying from those to whom you
convey the Program, the only way you could satisfy both those
terms and this License would be to refrain entirely from conveying
the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work
licensed under version 3 of the GNU Affero General Public License
into a single combined work, and to convey the resulting work. The
terms of this License will continue to apply to the part which is
the covered work, but the special requirements of the GNU Affero
General Public License, section 13, concerning interaction through
a network will apply to the combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new
versions of the GNU General Public License from time to time. Such
new versions will be similar in spirit to the present version, but
may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU
General Public License "or any later version" applies to it, you
have the option of following the terms and conditions either of
that numbered version or of any later version published by the
Free Software Foundation. If the Program does not specify a
version number of the GNU General Public License, you may choose
any version ever published by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that
proxy's public statement of acceptance of a version permanently
authorizes you to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow
a later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE
COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS"
WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE
RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.
SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES
AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF
THE POSSIBILITY OF SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely
approximates an absolute waiver of all civil liability in
connection with the Program, unless a warranty or assumption of
liability accompanies a copy of the Program in return for a fee.
Section 6 - 3rd Party Components
(1) The Software Program includes software and documentation components
developed in part by Silver Egg Technology, Inc.("SET") prior to 2001
and released under the following license.
Copyright (c) 2001 Silver Egg Technology
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sub-license, and/or
sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
wrapper_3.5.51_src/src/bin/App.bat.in 100644 0 0 17737 14333053647 14570 0 ustar 0 0 @echo off
setlocal
rem
rem Copyright (c) 1999, 2022 Tanuki Software, Ltd.
rem http://www.tanukisoftware.com
rem All rights reserved.
rem
rem This software is the proprietary information of Tanuki Software.
rem You shall use it only in accordance with the terms of the
rem license agreement you entered into with Tanuki Software.
rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
rem
rem Java Service Wrapper script - Run as a console application.
rem
rem -----------------------------------------------------------------------------
rem These settings can be modified to fit the needs of your application
rem Optimized for use with version 3.5.51 of the Wrapper.
rem The base name for the Wrapper binary.
set _WRAPPER_BASE=wrapper
rem The directory where the Wrapper binary (.exe) file is located. It can be
rem either an absolute or a relative path. If the path contains any special
rem characters, please make sure to quote the variable.
set _WRAPPER_DIR=
rem The name and location of the Wrapper configuration file. This will be used
rem if the user does not specify a configuration file as the first parameter to
rem this script.
rem If a relative path is specified, please note that the location is based on the
rem location of the Wrapper executable.
set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf"
rem Makes it possible to override the Wrapper configuration file by specifying it
rem as the first parameter.
rem set _WRAPPER_CONF_OVERRIDE=true
rem _PASS_THROUGH controls how the script arguments should be passed to the
rem Wrapper. Possible values are:
rem - commented or 'false': the arguments will be ignored (not passed).
rem - 'app_args' or 'true': the arguments will be passed through the Wrapper as
rem arguments for the Java Application.
rem - 'both': both Wrapper properties and Application arguments can be passed to
rem the Wrapper. The Wrapper properties come in first position. The
rem user can optionally add a '--' separator followed by application
rem arguments.
rem NOTE - If _WRAPPER_CONF_OVERRIDE is set to true the above applies to arguments
rem starting with the second, otherwise it applies to all arguments.
rem set _PASS_THROUGH=app_args
rem If there are any errors, the script will pause for a specific number of seconds
rem or until the user presses a key. (0 not to wait, negative to wait forever).
set _WRAPPER_TIMEOUT=-1
rem Do not modify anything beyond this point
rem -----------------------------------------------------------------------------
rem
rem Resolve the real path of the wrapper.exe
rem For non NT systems, the _REALPATH and _WRAPPER_CONF values
rem can be hard-coded below and the following test removed.
rem
if "%OS%"=="Windows_NT" goto nt
echo This script only works with NT-based versions of Windows.
goto :eof
:nt
rem Find the application home.
rem if no path path specified do the default action
IF not DEFINED _WRAPPER_DIR goto dir_undefined
set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%"
if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\"
rem check if absolute path
if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path
if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path
rem everythig else means relative path
set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%"
goto pathfound
:dir_undefined
rem Use a relative path to the wrapper %~dp0 is location of current script under NT
set _REALPATH="%~dp0"
goto pathfound
:absolute_path
rem Use an absolute path to the wrapper
set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%"
:pathfound
rem
rem Decide on the specific Wrapper binary to use (See delta-pack)
rem
if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64
if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64
:x86_32
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe"
set _BIN_BITS="32"
goto search
:amd64
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe"
set _BIN_BITS="64"
goto search
:ia64
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe"
set _BIN_BITS="64"
goto search
:search
set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%"
if exist %_WRAPPER_EXE% goto check_lic_bits
set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe"
if exist %_WRAPPER_EXE% goto conf
if %_BIN_BITS%=="64" goto x86_32
echo Unable to locate a Wrapper executable using any of the following names:
echo %_WRAPPER_L_EXE%
echo %_WRAPPER_EXE%
goto preexitpause
:check_lic_bits
if %_BIN_BITS%=="64" (
set _CHECK_LIC_BITS=true
)
rem
rem Find the wrapper.conf
rem
:conf
if [%_WRAPPER_CONF_OVERRIDE%]==[true] (
set _WRAPPER_CONF="%~f1"
if not [%_WRAPPER_CONF%]==[""] (
shift
goto conf
)
)
set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%"
rem The command should not be called inside a IF, else errorlevel would be 0
if not [%_CHECK_LIC_BITS%]==[true] goto conf
%_WRAPPER_EXE% --request_delta_binary_bits %_WRAPPER_CONF% > nul 2>&1
if %errorlevel% equ 32 (
set _LIC32_OS64=true
set _CHECK_LIC_BITS=false
goto x86_32
)
:conf
if [%_PASS_THROUGH%]==[true] (
set _PASS_THROUGH=app_args
)
if [%_PASS_THROUGH%]==[app_args] (
set _PARAMETERS=--
set ARGS_ARE_APP_PARAMS=true
set _PASS_THROUGH_ON=true
)
if [%_PASS_THROUGH%]==[both] (
set _PASS_THROUGH_ON=true
)
if not [%_PASS_THROUGH_ON%]==[true] (
set _PASS_THROUGH=false
)
if not [%1]==[] (
if [%_PASS_THROUGH%]==[false] (
echo Additional arguments are not allowed when _PASS_THROUGH is set to false.
goto preexitpause
)
)
rem Collect all parameters
:parameters
if [%1]==[] goto callcommand
if [%ARGS_ARE_APP_PARAMS%]==[true] goto append
if [%1]==[--] (
set ARGS_ARE_APP_PARAMS=true
goto append
)
rem So we are appending a wrapper property.
rem 1) Check it is wrapped inside double quotes.
if not ["%~1"]==[%1] (
if not [%_MISSING_QUOTES_REPORTED%]==[true] (
set _MISSING_QUOTES_REPORTED=true
echo WARNING: Any property assignment before '--' should be wrapped inside double quotes on Windows. In a powershell prompt command, double quotes should be escaped with backquote characters ^(^`^).
)
rem If not wrapped inside quotes, the following tests are not relevant, so skip them. Should we stop? We always used to continue.. but the Wrapper will probably fail.
goto append
)
rem 2) Check that the arg matches the pattern of a property (the command should be outside of a IF block for errorlevel to be correct)
echo %1 | findstr ^wrapper\..*\=.*$ > nul 2>&1
if %errorlevel% equ 0 goto append
echo %1 | findstr ^.*\=.*$ > nul 2>&1
if %errorlevel% equ 0 goto unkown_property
rem Not a valid assignment.
echo WARNING: Encountered an invalid configuration property assignment '%~1'. When PASS_THROUGH is set to 'both', any argument before '--' should be in the format '^=^'.
goto append
:unkown_property
rem The property name is not starting with 'wrapper.' so invalid.
rem Extract the property name (this should be outside of a IF-ELSE block)
for /f "tokens=1* delims==" %%a in ("%~1") do set _COMMAND_PROP=%%a
echo WARNING: Encountered an unknown configuration property '%_COMMAND_PROP%'. When PASS_THROUGH is set to 'both', any argument before '--' should target a valid Wrapper configuration property.
:append
set _PARAMETERS=%_PARAMETERS% %1
shift
goto parameters
rem
rem Run the Wrapper
rem
:callcommand
if [%_PASS_THROUGH%]==[false] (
%_WRAPPER_EXE% -c %_WRAPPER_CONF%
) else (
%_WRAPPER_EXE% -c %_WRAPPER_CONF% %_PARAMETERS%
)
if not errorlevel 1 goto :eof
rem Exit when there is a problem
:preexitpause
if %errorlevel% equ 0 (
set EXIT_CODE=1
) else (
set EXIT_CODE=%errorlevel%
)
if %_WRAPPER_TIMEOUT% gtr 0 (
timeout /t %_WRAPPER_TIMEOUT%
) else (
if %_WRAPPER_TIMEOUT% lss 0 (
pause
)
)
EXIT /B %EXIT_CODE%
wrapper_3.5.51_src/src/bin/App.sh.in 100644 0 0 340201 14333053647 14435 0 ustar 0 0 #! /bin/sh
#
# Copyright (c) 1999, 2022 Tanuki Software, Ltd.
# http://www.tanukisoftware.com
# All rights reserved.
#
# This software is the proprietary information of Tanuki Software.
# You shall use it only in accordance with the terms of the
# license agreement you entered into with Tanuki Software.
# http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
#
# Java Service Wrapper sh script. Suitable for starting and stopping
# wrapped Java applications on UNIX platforms.
# Optimized for use with version 3.5.51 of the Wrapper.
#
#-----------------------------------------------------------------------------
# These settings can be modified to fit the needs of your application
# IMPORTANT - Please always stop and uninstall an application before making
# any changes to this file. Failure to do so could remove the
# script's ability to control the application.
# NOTE - After loading the variables below, the script will attempt to locate a
# file with the same basename as this script and having a '.shconf' extension.
# If such file exists, it will be executed giving the user a chance to
# override the default settings. Having the customized configuration in a
# separate '.shconf' file makes it easier to upgrade the Wrapper, as the
# present script file can then be replaced with minimal changes (although at
# least the 'INIT INFO' below needs to be updated).
# Initialization block for the install_initd and remove_initd scripts used by
# SUSE linux, CentOS and RHEL distributions. Also used by update-rc.d.
# Note: From CentOS 6, make sure the BEGIN INIT INFO section is before any line
# of code otherwise the service won't be displayed in the Service
# Configuration GUI.
### BEGIN INIT INFO
# Provides: @app.name@
# Required-Start: $remote_fs $syslog
# Should-Start: $network $time
# Should-Stop: $network $time
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: @app.long.name@
# Description: @app.description@
### END INIT INFO
# Application name and long name: If these variables are not set (or left to
# the default tokens), APP_NAME will default to the name of the script, then
# APP_LONG_NAME will default to the value of APP_NAME.
APP_NAME="@app.name@"
APP_LONG_NAME="@app.long.name@"
# If uncommented (and set to false), APP_NAME and APP_LONG_NAME will no longer
# be passed to the wrapper. See documentation for details.
#APP_NAME_PASS_TO_WRAPPER=false
# Wrapper
WRAPPER_CMD="./wrapper"
WRAPPER_CONF="../conf/wrapper.conf"
# Priority at which to run the wrapper. See "man nice" for valid priorities.
# nice is only used if a priority is specified.
PRIORITY=
# Location of the pid file.
PIDDIR="."
# PIDFILE_CHECK_PID tells the script to double check whether the pid in the pid
# file actually exists and belongs to this application. When not set, only
# check the pid, but not what it is. This is only needed when multiple
# applications need to share the same pid file.
PIDFILE_CHECK_PID=true
# FIXED_COMMAND tells the script to use a hard coded action rather than
# expecting the first parameter of the command line to be the command.
# By default the command will be expected to be the first parameter.
#FIXED_COMMAND=console
# PASS_THROUGH controls how the script arguments should be passed to the
# Wrapper. Possible values are:
# - commented or 'false': the arguments will be ignored (not passed).
# - 'app_args' or 'true': the arguments will be passed through the Wrapper as
# arguments for the Java Application.
# - 'both': both Wrapper properties and Application arguments can be passed to
# the Wrapper. The Wrapper properties come in first position. The
# user can optionally add a '--' separator followed by application
# arguments.
# NOTE - If FIXED_COMMAND is set to true the above applies to all arguments,
# otherwise it applies to arguments starting with the second.
# NOTE - Passing arguments is only valid with the following commands:
# - 'console'
# - 'start', 'restart', 'condrestart' (if not installed as a daemon)
#PASS_THROUGH=app_args
# If uncommented, causes the Wrapper to be shutdown using an anchor file.
# When launched with the 'start' command, it will also ignore all INT and
# TERM signals.
#IGNORE_SIGNALS=true
# Wrapper will start the JVM asynchronously. Your application may have some
# initialization tasks and it may be desirable to wait a few seconds
# before returning. For example, to delay the invocation of following
# startup scripts. Setting WAIT_AFTER_STARTUP to a positive number will
# cause the start command to delay for the indicated period of time
# (in seconds).
WAIT_AFTER_STARTUP=0
# If set, wait for the wrapper to report that the daemon has started
WAIT_FOR_STARTED_STATUS=true
WAIT_FOR_STARTED_TIMEOUT=120
# If set, the status, start_msg and stop_msg commands will print out detailed
# state information on the Wrapper and Java processes.
#DETAIL_STATUS=true
# If set, the 'pause' and 'resume' commands will be enabled. These make it
# possible to pause the JVM or Java application without completely stopping
# the Wrapper. See the wrapper.pausable and wrapper.pausable.stop_jvm
# properties for more information.
#PAUSABLE=true
# Set the mode used to 'pause' or 'resume' the Wrapper. Possible values are
# 'signals' which uses SIGUSR1 and SIGUSR2, and 'file' which uses the command
# file to communicate these actions. The default value is 'signals'.
# Be aware that depending on the mode, the properties wrapper.signal.mode.usr1,
# wrapper.signal.mode.usr2, or wrapper.commandfile of the configuration file may
# be overriden.
#PAUSABLE_MODE=signals
# If set, the Wrapper will be run as the specified user.
# IMPORTANT - Make sure that the user has the required privileges to write
# the PID file and wrapper.log files. Failure to be able to write the log
# file will cause the Wrapper to exit without any way to write out an error
# message.
# NOTES - This will set the user which is used to run the Wrapper as well as
# the JVM and is not useful in situations where a privileged resource or
# port needs to be allocated prior to the user being changed.
# - Setting this variable will cause stdin to be closed. While this
# should not be a problem when running as Daemon, it would disable ability
# for console applications to receive inputs.
#RUN_AS_USER=
# When RUN_AS_USER is set, the 'runuser' command will be used to substitute the
# user. If not present on the machine, 'su' will be used as a fallback.
# The parameter below lets you specify option(s) for the 'runuser' (or 'su')
# command.
# NOTES - The '-u' option is not allowed. Please set the user with RUN_AS_USER.
# - On GNU/Linux systems, if the user specified by RUN_AS_USER doesn't
# have a default shell please specify one with the '-s' option.
#SU_OPTS="-s /bin/bash"
# By default we show a detailed usage block. Uncomment to show brief usage.
#BRIEF_USAGE=true
# Set which service management tool to use.
# Possible values are:
# for linux...: auto, systemd, upstart, initd
# for aix.....: auto, src, initd
# When set to 'auto', this script file will try to detect in the order of the
# list for each platform which service management tool to use to install the Wrapper.
SERVICE_MANAGEMENT_TOOL=auto
# Specify how the Wrapper daemon and its child processes should be killed
# when using systemd.
# The default is 'control-group' which tells systemd to kill all child
# processes (including detached ones) in the control group of the daemon
# when it stops.
# Alternatively, 'process' can be specified to prevent systemd from
# killing the child processes leaving this responsibility to the Wrapper.
# In this case child processes marked as 'detached' will not be killed on shutdown.
# NOTE - the daemon must be reinstalled for any changes on this property to take effect.
SYSTEMD_KILLMODE=control-group
# When installing on Mac OSX platforms, the following domain will be used to
# prefix the plist file name.
PLIST_DOMAIN=org.tanukisoftware.wrapper
# When installing on Mac OSX platforms, this parameter controls whether the daemon
# is to be kept continuously running or to let demand and conditions control the
# invocation.
MACOSX_KEEP_RUNNING="false"
# The following two lines are used by the chkconfig command. Change as is
# appropriate for your application. They should remain commented.
# chkconfig: 2345 20 80
# description: @app.long.name@
# Set run level to use when installing the application to start and stop on
# system startup and shutdown. It is important that the application always
# be uninstalled before making any changes to the run levels.
# It is also possible to specify different run levels based on the individual
# platform. When doing so this script will look for defined run levels in
# the following order:
# 1) "RUN_LEVEL_S_$DIST_OS" or "RUN_LEVEL_K_$DIST_OS", where "$DIST_OS" is
# the value of DIST_OS. "RUN_LEVEL_S_solaris=20" for example.
# 2) RUN_LEVEL_S or RUN_LEVEL_K, to specify specify start or stop run levels.
# 3) RUN_LEVEL, to specify a general run level.
RUN_LEVEL=20
# List of files to source prior to executing any commands. Use ';' as delimiter.
# For example:
# FILES_TO_SOURCE="/home/user/.bashrc;anotherfile;../file3"
FILES_TO_SOURCE=
# Do not modify anything beyond this point
#-----------------------------------------------------------------------------
gettext() {
"$WRAPPER_CMD" --translate "$1" "$WRAPPER_CONF" 2>/dev/null
if [ $? != 0 ] ; then
echo "$1"
fi
}
checkIsRoot() {
if [ `id | sed 's/^uid=//;s/(.*$//'` != "0" ] ; then
IS_ROOT=false
else
IS_ROOT=true
fi
}
mustBeRootOrExit() {
checkIsRoot
if [ "$IS_ROOT" != "true" ] ; then
eval echo `gettext 'Must be root to perform this action.'`
exit 1
fi
}
##
# Normalize a dir path.
#
# $1: the name of the variable to set (without the $)
# $2: the path to normalize
normalizeDirPath() {
# NOTE: Variables are prefixed with 'ndp_' to avoid conflict with code
# outside this function. Keyword 'local' is not supported on some
# systems (z/OS, Solaris 10)
#
# Use '&&' to ensure pwd is only executed on an existing directory
ndp_normalDirPath=`unset CDPATH && cd "$2" 2>/dev/null && pwd`
ndp_ret=$?
if [ $ndp_ret -eq 0 ] ; then
eval "$1=$ndp_normalDirPath"
else
eval "$1=$2"
fi
return $ndp_ret
}
##
# Normalize a file path.
#
# $1: the name of the variable to set (without the $)
# $2: the path to normalize
normalizeFilePath() {
# NOTE: Variables are prefixed with 'nfp_' to avoid conflict with code
# outside this function. Keyword 'local' is not supported on some
# systems (z/OS, Solaris 10)
nfp_dirPath=`dirname "$2"`
normalizeDirPath nfp_normalDirPath $nfp_dirPath
nfp_ret=$?
if [ $nfp_ret -eq 0 ] ; then
nfp_fileName=`basename "$2"`
eval "$1=$nfp_normalDirPath/$nfp_fileName"
else
eval "$1=$2"
fi
return $nfp_ret
}
##
# Resolves the location of a system command.
#
# $1: the name of the variable to set (without the $)
# $2: the name of the command
# $3: an ordered and semicolon-separated list of paths where the command should
# be searched. The list should contain an empty value for the command to be
# searched using the PATH environment variable.
# $4: 1 to be strict (the script will stop with an error), 0 otherwise.
resolveLocation() {
eval "CMD_TEMP=\$$1"
if [ "X$CMD_TEMP" = "X" ] ; then
found=0
OIFS=$IFS
IFS=';'
for CMD_PATH in $3
do
if [ -z "$CMD_PATH" ] ; then
# empty path
CMD_TEMP="$2"
ret=`command -v $CMD_TEMP 2>/dev/null`
if [ $? -eq 0 ] ; then
found=1
break
fi
else
CMD_TEMP="${CMD_PATH}/$2"
if [ -x "$CMD_TEMP" ] ; then
found=1
break
fi
fi
done
IFS=$OIFS
if [ $found -eq 1 ] ; then
eval "$1=$CMD_TEMP"
elif [ $4 -eq 1 ] ; then
eval echo `gettext 'Unable to locate "$2".'`
eval echo `gettext 'Please report this message along with the location of the command on your system.'`
exit 1
else
# return the error
return 1
fi
fi
return 0
}
resolveIdLocation() {
# On Solaris, the version in /usr/xpg4/bin should be used in priority.
resolveLocation ID_BIN id "/usr/xpg4/bin;;/usr/bin" 1
}
resolveCurrentUser() {
if [ "X$CURRENT_USER" = "X" ] ; then
resolveIdLocation
CURRENT_USER=`$ID_BIN -u -n 2>/dev/null`
fi
}
validateRunUser() {
if [ "X$RUN_AS_USER" != "X" ]
then
resolveCurrentUser
if [ "$CURRENT_USER" = "$RUN_AS_USER" ]
then
# Already running as the configured user.
RUN_AS_USER=""
fi
fi
if [ "X$RUN_AS_USER" != "X" ]
then
# Make sure the user exists
if [ "`$ID_BIN -u -n "$RUN_AS_USER" 2>/dev/null`" != "$RUN_AS_USER" ]
then
eval echo `gettext 'User $RUN_AS_USER does not exist.'`
exit 1
fi
# Make sure to be root when using RUN_AS_USER. This is required for runuser. For su, it is technically possible to use
# it with a normal user, but we are using the command several times so this would result in multiple password prompts.
checkIsRoot
if [ "$IS_ROOT" != "true" ] ; then
eval echo `gettext 'Must be root to run with RUN_AS_USER=$RUN_AS_USER.'`
exit 1
fi
# Resolve the location of the 'runuser' command, or fall back on 'su' if it is not present.
resolveLocation RUNUSER_BIN runuser ";/sbin;/usr/sbin" 0
ret=$?
if [ $ret -eq 1 ] ; then
resolveLocation RUNUSER_BIN su ";/bin" 0
ret=$?
fi
if [ $ret -eq 1 ] ; then
eval echo `gettext 'Unable to locate the command to run with a substitute user.'`
exit 1
fi
fi
}
# Make sure APP_NAME is less than 14 characters, otherwise in AIX, the commands
# "lsitab" or "lssrc" will fail
validateAppNameLength() {
if [ ${#APP_NAME} -gt 14 ] ; then
eval echo `gettext ' APP_NAME must be less than 14 characters long. Length of ${APP_NAME} is ${#APP_NAME}.'`
exit 1
fi
}
# Method to check if systemd is running.
# Returns 0 if systemd is found, otherwise returns 1.
systemdDetection() {
if [ ! -d "/etc/systemd" ] ; then
return 1
fi
resolveLocation PIDOF_BIN pidof ";/bin;/usr/sbin" 1
result=`$PIDOF_BIN systemd`
return $?
}
# Detect if upstart is installed
# Returns 0 if upstart is found, otherwise returns 1.
upstartDetection() {
if [ ! -d "/etc/init" ] ; then
return 1
fi
INITCTL_BIN="initctl"
result=`command -v $INITCTL_BIN 2>/dev/null`
if [ $? -ne 0 ] ; then
INITCTL_BIN="/sbin/initctl"
if [ ! -x "$INITCTL_BIN" ] ; then
return 1
fi
fi
result=`$INITCTL_BIN version 2>/dev/null`
if [ $? -eq 0 ] ; then
# if the word "upstart" is in the result, then we assume upstart is installed.
result=`echo $result | grep upstart`
if [ $? -eq 0 ] ; then
return 0
fi
fi
# The command /sbin/initctl may fail if the user doesn't have enough privilege
# but that doesn't mean upstart is not present.
# In this case we can assume upstart exists if the service was previously
# installed by the root user.
if [ -f "/etc/init/${APP_NAME}.conf" ] ; then
return 0
fi
return 1
}
# Method to check if SRC is running.
# Returns 0 if SRC is found, otherwise returns 1.
srcDetection() {
# $PS_BIN has already been resolved at startup
result=`$PS_BIN -A | grep srcmstr`
return $?
}
setServiceManagementToolLinux() {
case "$SERVICE_MANAGEMENT_TOOL" in
'auto')
systemdDetection
if [ $? -eq 0 ] ; then
USE_SYSTEMD=1
return
fi
upstartDetection
if [ $? -eq 0 ] ; then
USE_UPSTART=1
return
fi
;;
'systemd')
USE_SYSTEMD=1
;;
'upstart')
USE_UPSTART=1
;;
'initd')
;;
*)
return 1
esac
}
setServiceManagementToolAix() {
case "$SERVICE_MANAGEMENT_TOOL" in
'auto')
srcDetection
if [ $? -eq 0 ] ; then
USE_SRC=1
fi
;;
'src')
USE_SRC=1
;;
'initd')
;;
*)
return 1
esac
}
# Resolve the service management tool for linux and aix.
setServiceManagementTool() {
if [ ! -n "$SERVICE_MANAGEMENT_TOOL" ] ; then
# Set the default value to auto.
SERVICE_MANAGEMENT_TOOL=auto
fi
if [ "$DIST_OS" = "linux" ] ; then
setServiceManagementToolLinux
elif [ "$DIST_OS" = "aix" ] ; then
setServiceManagementToolAix
else
if [ "$SERVICE_MANAGEMENT_TOOL" != "auto" ] ; then
eval echo `gettext 'The script does not support the service management tool \"$SERVICE_MANAGEMENT_TOOL\" on this platform.'`
SERVICE_MANAGEMENT_TOOL=auto
fi
return
fi
if [ $? = 1 ] ; then
eval echo `gettext 'Service management tool value is invalid: $SERVICE_MANAGEMENT_TOOL.'`
exit 1
fi
}
# default location for the service file
SYSTEMD_SERVICE_FILE="/etc/systemd/system/$APP_NAME.service"
# Installation status
SERVICE_NOT_INSTALLED=0
SERVICE_INSTALLED_DEFAULT=1
SERVICE_INSTALLED_SYSTEMD=2
SERVICE_INSTALLED_UPSTART=4
SERVICE_INSTALLED_SRC=8
SERVICE_INSTALLED_SRC_PARTIAL=16 #incomplete installation with SRC (lssrc or lsitab failed to return a record)
getServiceControlMethod() {
if [ "$DIST_OS" = "macosx" -a -f "/Library/LaunchDaemons/${APP_PLIST}" ] ; then
CTRL_WITH_LAUNCHD=true
elif [ "$DIST_OS" = "linux" -a -n "$USE_UPSTART" ] && [ -f "/etc/init/${APP_NAME}.conf" ] ; then
CTRL_WITH_UPSTART=true
elif [ "$DIST_OS" = "linux" -a -n "$USE_SYSTEMD" -a -z "$SYSD" ] && [ -f "${SYSTEMD_SERVICE_FILE}" ] ; then
CTRL_WITH_SYSTEMD=true
elif [ "$DIST_OS" = "aix" -a -n "$USE_SRC" ] && [ -n "`/usr/bin/lssrc -S -s $APP_NAME`" ] ; then
CTRL_WITH_SRC=true
else
CTRL_WITH_DEFAULT=true
fi
}
checkInstalled() {
# Install status
installedStatus=$SERVICE_NOT_INSTALLED
installedWith=""
if [ "$DIST_OS" = "solaris" ] ; then
if [ -f "/etc/init.d/$APP_NAME" -o -L "/etc/init.d/$APP_NAME" ] ; then
installedStatus=$SERVICE_INSTALLED_DEFAULT
fi
elif [ "$DIST_OS" = "linux" ] ; then
if [ "X$1" != "Xstrict" -o \( -z "$USE_SYSTEMD" -a -z "$USE_UPSTART" \) ] ; then
if [ -f "/etc/init.d/$APP_NAME" -o -L "/etc/init.d/$APP_NAME" ] ; then
installedStatus=$SERVICE_INSTALLED_DEFAULT
installedWith="init.d"
fi
fi
if [ "X$1" != "Xstrict" -o -n "$USE_SYSTEMD" ] ; then
if [ -f "${SYSTEMD_SERVICE_FILE}" ] ; then
installedStatus=`expr $installedStatus + $SERVICE_INSTALLED_SYSTEMD`
installedWith="${installedWith}${installedWith:+, }systemd"
fi
fi
if [ "X$1" != "Xstrict" -o -n "$USE_UPSTART" ] ; then
if [ -f "/etc/init/${APP_NAME}.conf" ] ; then
installedStatus=`expr $installedStatus + $SERVICE_INSTALLED_UPSTART`
installedWith="${installedWith}${installedWith:+, }upstart"
fi
fi
elif [ "$DIST_OS" = "hpux" ] ; then
if [ -f "/sbin/init.d/$APP_NAME" -o -L "/sbin/init.d/$APP_NAME" ] ; then
installedStatus=$SERVICE_INSTALLED_DEFAULT
fi
elif [ "$DIST_OS" = "aix" ] ; then
if [ "X$1" != "Xstrict" -o -z "$USE_SRC" ] ; then
if [ -f "/etc/rc.d/init.d/$APP_NAME" -o -L "/etc/rc.d/init.d/$APP_NAME" ] ; then
installedStatus=$SERVICE_INSTALLED_DEFAULT
installedWith="init.d"
fi
fi
if [ "X$1" != "Xstrict" -o -n "$USE_SRC" ] ; then
validateAppNameLength
if [ "$IS_ROOT" = "true" ] ; then
# Check both lssrc & lsitab to make sure the installation is complete. lsitab requires root privileges.
# We will go through this case before installing or removing a service, so we can redo a clean installation
# or a clean removal if installedStatus=5
if [ -n "`/usr/sbin/lsitab $APP_NAME`" -a -n "`/usr/bin/lssrc -S -s $APP_NAME`" ] ; then
installedStatus=`expr $installedStatus + $SERVICE_INSTALLED_SRC`
installedWith="${installedWith}${installedWith:+, }SRC"
elif [ -n "`/usr/sbin/lsitab $APP_NAME`" -o -n "`/usr/bin/lssrc -S -s $APP_NAME`" ] ; then
installedStatus=`expr $installedStatus + $SERVICE_INSTALLED_SRC_PARTIAL`
installedWith="${installedWith}${installedWith:+, }SRC"
fi
else
# Using lssrc is enough to test normal installations and doesn't require root privileges
if [ -n "`/usr/bin/lssrc -S -s $APP_NAME`" ] ; then
installedStatus=`expr $installedStatus + $SERVICE_INSTALLED_SRC`
installedWith="${installedWith}${installedWith:+, }SRC"
fi
fi
fi
elif [ "$DIST_OS" = "freebsd" ] ; then
if [ -f "/etc/rc.d/$APP_NAME" -o -L "/etc/rc.d/$APP_NAME" ] ; then
installedStatus=$SERVICE_INSTALLED_DEFAULT
fi
elif [ "$DIST_OS" = "macosx" ] ; then
if [ -f "/Library/LaunchDaemons/${APP_PLIST}" -o -L "/Library/LaunchDaemons/${APP_PLIST}" ] ; then
installedStatus=$SERVICE_INSTALLED_DEFAULT
fi
elif [ "$DIST_OS" = "zos" ] ; then
if [ -f /etc/rc.bak ] ; then
installedStatus=$SERVICE_INSTALLED_DEFAULT
fi
fi
}
showUsage() {
# $1 bad command
if [ -n "$1" ]
then
eval echo `gettext 'Unexpected command: $1'`
echo "";
fi
if [ "X${PASS_THROUGH}" = "Xapp_args" ] ; then
ARGS=" {JavaAppArgs}"
elif [ "X${PASS_THROUGH}" = "Xboth" ] ; then
ARGS=" {WrapperProperties} [-- {JavaAppArgs}]"
else
ARGS=""
fi
eval MSG=`gettext 'Usage: '`
if [ -n "$FIXED_COMMAND" ] ; then
echo "${MSG} $0${ARGS}"
else
setServiceManagementTool
checkInstalled "strict"
if [ $installedStatus -eq $SERVICE_NOT_INSTALLED ] ; then
# not installed, allow arguments to be passed through
ARGS_START=$ARGS
else
ARGS_START=""
fi
if [ -n "$PAUSABLE" ] ; then
echo "${MSG} $0 [ console${ARGS} | start${ARGS_START} | stop | restart${ARGS_START} | condrestart${ARGS_START} | pause | resume | status | install | installstart | remove | dump ]"
else
echo "${MSG} $0 [ console${ARGS} | start${ARGS_START} | stop | restart${ARGS_START} | condrestart${ARGS_START} | status | install | installstart | remove | dump ]"
fi
fi
if [ ! -n "$BRIEF_USAGE" ]
then
echo "";
if [ ! -n "$FIXED_COMMAND" ] ; then
echo "`gettext 'Commands:'`"
echo "`gettext ' console Launch in the current console.'`"
echo "`gettext ' start Start in the background as a daemon process.'`"
echo "`gettext ' stop Stop if running as a daemon or in another console.'`"
echo "`gettext ' restart Stop if running and then start.'`"
echo "`gettext ' condrestart Restart only if already running.'`"
if [ -n "$PAUSABLE" ] ; then
echo "`gettext ' pause Pause if running.'`"
echo "`gettext ' resume Resume if paused.'`"
fi
echo "`gettext ' status Query the current status.'`"
echo "`gettext ' install Install to start automatically when system boots.'`"
echo "`gettext ' installstart Install and start running as a daemon process.'`"
echo "`gettext ' remove Uninstall.'`"
echo "`gettext ' dump Request a Java thread dump if running.'`"
echo "";
fi
if [ "X${PASS_THROUGH}" = "Xapp_args" -o "X${PASS_THROUGH}" = "Xboth" ] ; then
if [ "X${PASS_THROUGH}" = "Xboth" ] ; then
echo "WrapperProperties:"
echo "`gettext ' Optional configuration properties which will be passed to the Wrapper.'`"
echo "";
fi
echo "JavaAppArgs:"
echo "`gettext ' Optional arguments which will be passed to the Java application.'`"
echo "";
fi
fi
exit 1
}
# Output help to understand why the working directory is not accessible.
# The permissions of each folder composing the path will be printed.
# If a folder doesn't have enough permissions, the wrapper binaries or the
# script located in that directory won't be able to execute.
# - When running with the current user, this means we won't be able to detect
# whether the Wrapper binaries are executable, nor send requests such as
# --translate, --request_delta_binary_bits, --request_log_file.
# - When RUN_AS_USER is set, we must be root so the current user should always
# have enough permission. However the command to substitute the user would
# fail if the specified user doesn't have permission on the full path.
#
# $1: The name of the user for which we fail to execute a command in the
# working directory.
reportRealDirNotAccessible() {
# Unfortunately the following message will not be translated because currently the Wrapper fails to execute correctly when it can't access to the absolute path.
eval echo `gettext 'Failed to access the script using an absolute path. Insufficient permissions may prevent the user \"$1\" from traversing one of the folders. Please check the following permissions:'`
OIFS=$IFS
IFS='/'
for DIR in $REALDIR
do
# REALDIR should already be normalized, but skip '.' if any remains.
if [ "$DIR" != "" -a "$DIR" != "." ] ; then
INT_PATH="${INT_PATH}/$DIR"
ALL_PATHS="${ALL_PATHS} ${INT_PATH}"
result=`cd "${INT_PATH}" 2>/dev/null`
if [ $? -ne 0 ] ; then
# no access to this folder and so to the rest of the path.
break
fi
fi
done
IFS=$OIFS
ls -dal $ALL_PATHS
}
# check if we are running under Cygwin terminal.
# Note: on some OS's (for example Solaris, MacOS), -o is not a valid parameter
# and it shows an error message. We redirect stderr to null so the error message
# doesn't show up.
CYGWIN=`uname -o 2>/dev/null`
if [ "$CYGWIN" = "Cygwin" ]
then
eval echo `gettext 'This script is not compatible with Cygwin. Please use the Wrapper batch files to control the Wrapper.'`
exit 1
fi
# Resolve the location of the 'ps' & 'tr' command
resolveLocation PS_BIN ps "/usr/ucb;/usr/bin;/bin" 1
resolveLocation TR_BIN tr "/usr/bin;/bin" 1
# Resolve the OS (needs to be done before any call to showUsage, checkInstalled, etc.)
DIST_OS=`uname -s | $TR_BIN "[A-Z]" "[a-z]" | $TR_BIN -d ' '`
case "$DIST_OS" in
'sunos')
DIST_OS="solaris"
;;
'hp-ux' | 'hp-ux64')
# HP-UX needs the XPG4 version of ps (for -o args)
DIST_OS="hpux"
UNIX95=""
export UNIX95
PATH=$PATH:/usr/bin
;;
'darwin')
DIST_OS="macosx"
;;
'unix_sv')
DIST_OS="unixware"
;;
'os/390')
DIST_OS="zos"
;;
'linux')
DIST_OS="linux"
;;
esac
# check if there is a parameter "sysd"
SYSD=
if [ $# -gt 1 ] ; then
if [ $2 = "sysd" ] ; then
SYSD=1
fi
fi
# Get the fully qualified path to the script
case $0 in
/*)
SCRIPT="$0"
;;
*)
PWD=`pwd`
if [ $? -ne 0 ] ; then
# On some systems pwd may fail if one of the parent folder has insufficient permissions.
# Is there a way to access the current location which would allow to print the permissions
# for each folder like we do below?
exit 1
fi
SCRIPT="$PWD/$0"
;;
esac
# Resolve the true real path without any sym links.
CHANGED=true
while [ "X$CHANGED" != "X" ]
do
# Change spaces to ":" so the tokens can be parsed.
SAFESCRIPT=`echo "$SCRIPT" | sed -e 's; ;:;g'`
# Get the real path to this script, resolving any symbolic links
TOKENS=`echo $SAFESCRIPT | sed -e 's;/; ;g'`
REALPATH=
for C in $TOKENS; do
# Change any ":" in the token back to a space.
C=`echo $C | sed -e 's;:; ;g'`
REALPATH="$REALPATH/$C"
# If REALPATH is a sym link, resolve it. Loop for nested links.
while [ -h "$REALPATH" ] ; do
LS="`ls -ld "$REALPATH"`"
LINK="`expr "$LS" : '.*-> \(.*\)$'`"
if expr "$LINK" : '/.*' > /dev/null; then
# LINK is absolute.
REALPATH="$LINK"
else
# LINK is relative.
REALPATH="`dirname "$REALPATH"`""/$LINK"
fi
done
done
if [ "$REALPATH" = "$SCRIPT" ]
then
CHANGED=""
else
SCRIPT="$REALPATH"
fi
done
normalizeFilePath REALPATH $REALPATH
# Try to source a file with the same filename as the script and with the '.shconf' extension.
case $REALPATH in
*.sh)
SHCONF_FILE=`echo $REALPATH | rev | cut -d "." -f2- | rev`
;;
*)
SHCONF_FILE="$REALPATH"
;;
esac
SHCONF_FILE="${SHCONF_FILE}.shconf"
if [ -f "$SHCONF_FILE" ] ; then
if [ ! -x "$SHCONF_FILE" ] ; then
# We should stop here because the configuration expected in the shconf file will not be loaded.
eval echo `gettext 'Found $SHCONF_FILE but could not execute it. Please make sure that the file has execute permissions.'`
exit 1
fi
. "$SHCONF_FILE"
fi
if [ -n "$FIXED_COMMAND" ] ; then
COMMAND="$FIXED_COMMAND"
FIRST_ARG=$1
else
COMMAND="$1"
FIRST_ARG=$2
fi
if [ "X${PASS_THROUGH}" = "Xtrue" -o "X${PASS_THROUGH}" = "Xapp_args" ] ; then
PASS_THROUGH=app_args
elif [ "X${PASS_THROUGH}" != "Xboth" ] ; then
PASS_THROUGH=false
fi
# Get the location of the script.
REALDIR=`dirname "$REALPATH"`
if [ "X$IS_SUBSTITUTE_USER" = "X" ] ; then
# First check if the command is valid for the current user.
case "$COMMAND" in
'console' | 'dump' | 'start_msg' | 'stop_msg')
validateRunUser
;;
'install' | 'installstart' | 'remove')
mustBeRootOrExit
;;
'start' | 'stop' | 'restart' | 'condrestart')
setServiceManagementTool
getServiceControlMethod
if [ "$CTRL_WITH_DEFAULT" = "true" -o "$CTRL_WITH_SYSTEMD" = "true" ] ; then
validateRunUser
else
mustBeRootOrExit
fi
;;
'launchdinternal' | 'upstartinternal')
if [ ! "$DIST_OS" = "macosx" -o ! -f "/Library/LaunchDaemons/${APP_PLIST}" ] ; then
validateRunUser
fi
;;
'pause' | 'resume')
if [ -z "$PAUSABLE" ] ; then
showUsage "$COMMAND"
fi
;;
'status')
;;
*)
showUsage "$COMMAND"
;;
esac
# The user has appropriate rights for the given command, but we still need to verify that it has permission to acccess the real dir.
# NOTE: This is not necessary when running as a substitute user because runuser (or su) would have failed if the specified user could not access the real dir.
result=`cd "${REALDIR}" 2>/dev/null`
if [ $? -ne 0 ] ; then
# The command can be run with a normal user, but we don't have sufficient permission to access the real dir.
resolveCurrentUser
reportRealDirNotAccessible $CURRENT_USER
exit 1
fi
fi
# If the PIDDIR is relative, set its value relative to the full REALPATH to avoid problems if
# the working directory is later changed.
FIRST_CHAR=`echo $PIDDIR | cut -c1,1`
if [ "$FIRST_CHAR" != "/" ]
then
PIDDIR=$REALDIR/$PIDDIR
normalizeDirPath PIDDIR $PIDDIR
fi
# Same test for WRAPPER_CMD
FIRST_CHAR=`echo $WRAPPER_CMD | cut -c1,1`
if [ "$FIRST_CHAR" != "/" ]
then
WRAPPER_CMD=$REALDIR/$WRAPPER_CMD
fi
# Same test for WRAPPER_CONF
FIRST_CHAR=`echo $WRAPPER_CONF | cut -c1,1`
if [ "$FIRST_CHAR" != "/" ]
then
WRAPPER_CONF=$REALDIR/$WRAPPER_CONF
fi
# Give default values to $APP_NAME and $APP_LONG_NAME
DELIMITER="@"
if [ "X$APP_NAME" = "X" -o "$APP_NAME" = "${DELIMITER}app.name${DELIMITER}" ] ; then
APP_NAME=`basename -- "$0"`
fi
if [ "X$APP_LONG_NAME" = "X" -o "$APP_LONG_NAME" = "${DELIMITER}app.long.name${DELIMITER}" ] ; then
APP_LONG_NAME=$APP_NAME
fi
# Process ID
ANCHORFILE="$PIDDIR/$APP_NAME.anchor"
COMMANDFILE="$PIDDIR/$APP_NAME.command"
STATUSFILE="$PIDDIR/$APP_NAME.status"
JAVASTATUSFILE="$PIDDIR/$APP_NAME.java.status"
PIDFILE="$PIDDIR/$APP_NAME.pid"
LOCKDIR="/var/lock/subsys"
LOCKFILE="$LOCKDIR/$APP_NAME"
pid=""
# Compare Versions $1<$2=0, $1==$2=1, $1>$2=2
compareVersions () {
if [ "$1" = "$2" ]
then
return 1
else
local i=1
while true
do
local v1=`echo "$1" | cut -d '.' -f $i`
local v2=`echo "$2" | cut -d '.' -f $i`
if [ "X$v1" = "X" ]
then
if [ "X$v2" = "X" ]
then
return 1
fi
v1="0"
elif [ "X$v2" = "X" ]
then
v2="0"
fi
if [ $v1 -lt $v2 ]
then
return 0
elif [ $v1 -gt $v2 ]
then
return 2
fi
i=`expr $i + 1`
done
fi
}
# Resolve the architecture
if [ "$DIST_OS" = "macosx" ]
then
OS_VER=`sw_vers | grep 'ProductVersion:' | grep -o '[0-9]*\.[0-9]*\.[0-9]*\|[0-9]*\.[0-9]*'`
DIST_ARCH=`uname -p 2>/dev/null | $TR_BIN "[A-Z]" "[a-z]" | $TR_BIN -d ' '`
if [ "X${DIST_ARCH}" = "Xarm" ]
then
DIST_ARCH="arm"
else
DIST_ARCH="universal"
fi
compareVersions "$OS_VER" "10.5.0"
if [ $? -lt 1 ]
then
DIST_BITS="32"
KEY_KEEP_ALIVE="OnDemand"
else
# Note: "OnDemand" has been deprecated and replaced from Mac OS X 10.5 by "KeepAlive"
KEY_KEEP_ALIVE="KeepAlive"
if [ "X`/usr/sbin/sysctl -n hw.cpu64bit_capable`" = "X1" ]
then
DIST_BITS="64"
else
DIST_BITS="32"
fi
fi
APP_PLIST_BASE=${PLIST_DOMAIN}.${APP_NAME}
APP_PLIST=${APP_PLIST_BASE}.plist
elif [ "$DIST_OS" = "zos" ] ; then
# Z/Os is not supported in the Delta Pack, therefore we only provide a binary
# file named "wrapper". However this script will still check for a file named
# "wrapper-zos-390-32" and "wrapper-zos-390-64" in case the user edited the name.
DIST_ARCH="390"
DIST_BITS="64"
else
if [ "$DIST_OS" = "linux" ]
then
DIST_ARCH=
else
DIST_ARCH=`uname -p 2>/dev/null | $TR_BIN "[A-Z]" "[a-z]" | $TR_BIN -d ' '`
fi
if [ "X$DIST_ARCH" = "X" ]
then
DIST_ARCH="unknown"
fi
if [ "$DIST_ARCH" = "unknown" ]
then
DIST_ARCH=`uname -m 2>/dev/null | $TR_BIN "[A-Z]" "[a-z]" | $TR_BIN -d ' '`
fi
case "$DIST_ARCH" in
'athlon' | 'i386' | 'i486' | 'i586' | 'i686')
DIST_ARCH="x86"
if [ "${DIST_OS}" = "solaris" ] ; then
DIST_BITS=`isainfo -b`
else
DIST_BITS="32"
fi
;;
'amd64' | 'x86_64')
DIST_ARCH="x86"
DIST_BITS="64"
;;
'ia32')
DIST_ARCH="ia"
DIST_BITS="32"
;;
'ia64' | 'ia64n' | 'ia64w')
DIST_ARCH="ia"
DIST_BITS="64"
;;
'ip27')
DIST_ARCH="mips"
DIST_BITS="32"
;;
'ppc64le')
DIST_ARCH="ppcle"
DIST_BITS="64"
;;
'power' | 'powerpc' | 'power_pc' | 'ppc64')
if [ "${DIST_ARCH}" = "ppc64" ] ; then
DIST_BITS="64"
else
DIST_BITS="32"
fi
DIST_ARCH="ppcbe"
if [ "${DIST_OS}" = "aix" ] ; then
DIST_ARCH="ppc"
if [ `getconf KERNEL_BITMODE` -eq 64 ]; then
DIST_BITS="64"
else
DIST_BITS="32"
fi
fi
;;
'pa_risc' | 'pa-risc')
DIST_ARCH="parisc"
if [ `getconf KERNEL_BITS` -eq 64 ]; then
DIST_BITS="64"
else
DIST_BITS="32"
fi
;;
'sun4u' | 'sparcv9' | 'sparc')
DIST_ARCH="sparc"
DIST_BITS=`isainfo -b`
;;
'9000/800' | '9000/785')
DIST_ARCH="parisc"
if [ `getconf KERNEL_BITS` -eq 64 ]; then
DIST_BITS="64"
else
DIST_BITS="32"
fi
;;
s390* )
DIST_ARCH="390"
if [ `getconf LONG_BIT` -eq 64 ] ; then
DIST_BITS="64"
else
DIST_BITS="32"
fi
;;
aarch64* | arm64*)
# 'aarch64_be', 'aarch64', 'arm64', etc.
DIST_ARCH="arm"
DIST_BITS="64"
;;
armv*)
# 'armv8b', 'armv8l', 'armv7l', 'armv5tel', etc.
# => armv8 and above should be 64-bit, but it is more reliable to check the bits with getconf.
if [ `getconf LONG_BIT` -eq 64 ]; then
DIST_ARCH="arm"
DIST_BITS="64"
else
# Note: The following command returns nothing on SUSE for Raspberry Pi 3 (aarch64).
# An alternative command would be 'dpkg --print-architecture', but dpkg may not exist.
if [ -z "`readelf -A /proc/self/exe | grep Tag_ABI_VFP_args`" ] ; then
DIST_ARCH="armel"
else
DIST_ARCH="armhf"
fi
DIST_BITS="32"
fi
;;
esac
fi
# OSX always places Java in the same location so we can reliably set JAVA_HOME
if [ "$DIST_OS" = "macosx" ]
then
if [ -z "$JAVA_HOME" ]; then
if [ -x /usr/libexec/java_home ]; then
JAVA_HOME=`/usr/libexec/java_home`; export JAVA_HOME
else
JAVA_HOME="/Library/Java/Home"; export JAVA_HOME
fi
fi
fi
# Test Echo
ECHOTEST=`echo -n "x"`
if [ "$ECHOTEST" = "x" ]
then
ECHOOPT="-n "
ECHOOPTC=""
else
ECHOOPT=""
ECHOOPTC="\c"
fi
outputFile() {
if [ -f "$1" ]
then
eval echo `gettext ' $1 Found but not executable.'`;
else
echo " $1"
fi
}
# Check if the first parameter is an existing executable file.
detectWrapperBinary() {
if [ -f "$1" ] ; then
WRAPPER_TEST_CMD="$1"
if [ ! -x "$WRAPPER_TEST_CMD" ] ; then
chmod +x "$WRAPPER_TEST_CMD" 2>/dev/null
fi
if [ -x "$WRAPPER_TEST_CMD" ] ; then
WRAPPER_CMD="$WRAPPER_TEST_CMD"
else
outputFile "$WRAPPER_TEST_CMD"
WRAPPER_TEST_CMD=""
fi
fi
}
# Decide on the wrapper binary to use.
# If the bits of the OS could be detected, we will try to look for the
# binary with the correct bits value. If it doesn't exist, fall back
# and look for the 32-bit binary. If that doesn't exist either then
# look for the default.
WRAPPER_TEST_CMD=""
BIN_BITS=$DIST_BITS
if [ ! "$BIN_BITS" = "32" ] ; then
# On a 64-bit platform, both Wrapper 32-Bit and 64-Bit can be used.
# Send a request to the Wrapper to know if the license has the 64-bit feature.
WRAPPER_CMD_ORIG=$WRAPPER_CMD
detectWrapperBinary "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-$BIN_BITS"
if [ ! -z "$WRAPPER_TEST_CMD" ] ; then
if [ "$COMMAND" = "console" -o "$COMMAND" = "start" -o "$COMMAND" = "restart" -o "$COMMAND" = "condrestart" -o "$COMMAND" = "installstart" ] ; then
"$WRAPPER_CMD" --request_delta_binary_bits "$WRAPPER_CONF" 2>/dev/null
if [ $? = 32 ] ; then
# License is 32-Bit. Reset and search for 32-Bit Wrapper binaries.
WRAPPER_TEST_CMD=""
WRAPPER_CMD=$WRAPPER_CMD_ORIG
BIN_BITS=32
fi
fi
fi
fi
if [ -z "$WRAPPER_TEST_CMD" ] ; then
detectWrapperBinary "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
fi
if [ -z "$WRAPPER_TEST_CMD" ] ; then
detectWrapperBinary "$WRAPPER_CMD"
fi
if [ -z "$WRAPPER_TEST_CMD" ] ; then
eval echo `gettext 'Unable to locate any of the following binaries:'`
outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-$BIN_BITS"
if [ ! "$BIN_BITS" = "32" ] ; then
outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
fi
outputFile "$WRAPPER_CMD"
exit 1
fi
# Build the nice clause
if [ "X$PRIORITY" = "X" ]
then
CMDNICE=""
else
CMDNICE="nice -$PRIORITY"
fi
# Build the anchor file clause.
if [ "X$IGNORE_SIGNALS" = "X" ]
then
ANCHORPROP=
IGNOREPROP=
else
ANCHORPROP=wrapper.anchorfile=\"$ANCHORFILE\"
IGNOREPROP=wrapper.ignore_signals=TRUE
fi
# Build the status file clause.
if [ "X$DETAIL_STATUS$WAIT_FOR_STARTED_STATUS" = "X" ]
then
STATUSPROP=
else
STATUSPROP="wrapper.statusfile=\"$STATUSFILE\" wrapper.java.statusfile=\"$JAVASTATUSFILE\""
fi
# Build the command file clause.
if [ -n "$PAUSABLE" ]
then
if [ "$PAUSABLE_MODE" = "file" ] ; then
COMMANDPROP="wrapper.commandfile=\"$COMMANDFILE\" wrapper.pausable=TRUE"
else
COMMANDPROP="wrapper.signal.mode.usr1=PAUSE wrapper.signal.mode.usr2=RESUME wrapper.pausable=TRUE"
fi
else
COMMANDPROP=
fi
if [ ! -n "$WAIT_FOR_STARTED_STATUS" ]
then
WAIT_FOR_STARTED_STATUS=true
fi
if [ $WAIT_FOR_STARTED_STATUS = true ] ; then
DETAIL_STATUS=true
fi
# Build the lock file clause. Only create a lock file if the lock directory exists on this platform.
LOCKPROP=
if [ -d $LOCKDIR ]
then
if [ -w $LOCKDIR ]
then
LOCKPROP=wrapper.lockfile=\"$LOCKFILE\"
fi
fi
# Build app name clause
if [ ! -n "$APP_NAME_PASS_TO_WRAPPER" ]
then
APP_NAME_PASS_TO_WRAPPER=true
fi
if [ $APP_NAME_PASS_TO_WRAPPER = false ]
then
APPNAMEPROP=
else
APPNAMEPROP="wrapper.name=\"$APP_NAME\" wrapper.displayname=\"$APP_LONG_NAME\""
fi
# Decide on run levels.
RUN_LEVEL_S_DIST_OS_TMP=`eval "echo \$\{RUN_LEVEL_S_${DIST_OS}\}"`
RUN_LEVEL_S_DIST_OS=`eval "echo ${RUN_LEVEL_S_DIST_OS_TMP}"`
if [ "X${RUN_LEVEL_S_DIST_OS}" != "X" ] ; then
APP_RUN_LEVEL_S=${RUN_LEVEL_S_DIST_OS}
elif [ "X$RUN_LEVEL_S" != "X" ] ; then
APP_RUN_LEVEL_S=$RUN_LEVEL_S
else
APP_RUN_LEVEL_S=$RUN_LEVEL
fi
APP_RUN_LEVEL_S_CHECK=`echo "$APP_RUN_LEVEL_S" | sed "s/[(0-9)*]/0/g"`
if [ "X${APP_RUN_LEVEL_S_CHECK}" != "X00" ] ; then
eval echo `gettext 'Run level \"${APP_RUN_LEVEL_S}\" must be numeric and have a length of two \(00-99\).'`
exit 1;
fi
RUN_LEVEL_K_DIST_OS_TMP=`eval "echo \$\{RUN_LEVEL_K_${DIST_OS}\}"`
RUN_LEVEL_K_DIST_OS=`eval "echo ${RUN_LEVEL_K_DIST_OS_TMP}"`
if [ "X${RUN_LEVEL_K_DIST_OS}" != "X" ] ; then
APP_RUN_LEVEL_K=${RUN_LEVEL_K_DIST_OS}
elif [ "X$RUN_LEVEL_K" != "X" ] ; then
APP_RUN_LEVEL_K=$RUN_LEVEL_K
else
APP_RUN_LEVEL_K=$RUN_LEVEL
fi
APP_RUN_LEVEL_K_CHECK=`echo "$APP_RUN_LEVEL_K" | sed "s/[(0-9)*]/0/g"`
if [ "X${APP_RUN_LEVEL_K_CHECK}" != "X00" ] ; then
eval echo `gettext 'Run level \"${APP_RUN_LEVEL_K}\" must be numeric and have a length of two \(00-99\).'`
exit 1;
fi
prepAdditionalParams() {
ADDITIONAL_PARA=""
if [ "X${PASS_THROUGH}" = "Xapp_args" -o "X${PASS_THROUGH}" = "Xboth" ] ; then
if [ "X${PASS_THROUGH}" = "Xapp_args" ] ; then
ADDITIONAL_PARA="--"
ARGS_ARE_APP_PARAMS=true
fi
while [ -n "$1" ] ; do
if [ ! -n "$ARGS_ARE_APP_PARAMS" ] ; then
if [ "$1" = "--" ] ; then
ARGS_ARE_APP_PARAMS=true
else
# Check that the arg matches the pattern of a property
case "$1" in
wrapper.*=*)
# Correct, nothing to do
;;
*=*)
# The property name is not starting with 'wrapper.' so invalid.
COMMAND_PROP=${1%%=*}
eval echo `gettext 'WARNING: Encountered an unknown configuration property \"${COMMAND_PROP}\". When PASS_THROUGH is set to \"both\", any argument before \"--\" should target a valid Wrapper configuration property.'`
;;
*)
# Not a valid assignment.
eval echo `gettext 'WARNING: Encountered an invalid configuration property assignment \"$1\". When PASS_THROUGH is set to \"both\", any argument before \"--\" should be in the format \"\=\\".'`
;;
esac
fi
fi
ADDITIONAL_PARA="$ADDITIONAL_PARA \"$1\""
shift
done
fi
}
resolveSysLocale() {
# First try to get the system encoding from /etc/default/locale.
# Note: For some reason, the system encoding stored in /etc/default/locale and the value returned by localectl may differ.
# When using 'localectl set-local', /etc/default/locale is always updated accordingly, but when manually editing /etc/default/locale,
# the output of the command sometimes doesn't get updated. When the values differ, SU uses the same locale as /etc/default/locale,
# so that's why we start trying to get the locale using this method.
if [ -f "/etc/default/locale" ] ; then
PASS_SYS_LANG=`grep 'LANG=' /etc/default/locale`
case "$PASS_SYS_LANG" in
LANG=*)
PASS_SYS_LANG="$PASS_SYS_LANG "
;;
*)
PASS_SYS_LANG=""
;;
esac
fi
if [ "X$PASS_SYS_LANG" = "X" ] ; then
# Try to get the system encoding using localectl.
LOCALECTL_BIN="localectl"
result=`command -v $LOCALECTL_BIN 2>/dev/null`
if [ $? -ne 0 ] ; then
LOCALECTL_BIN="/usr/bin/localectl"
if [ ! -x "$LOCALECTL_BIN" ] ; then
# Keep the warning for debugging, but don't actually show it because it may be normal for some OS to not have the command.
# echo " WARNING: Could not locate localectl used to get the system locale. The encoding may not be correct when running as $RUN_AS_USER."
LOCALECTL_BIN=""
fi
fi
if [ "X$LOCALECTL_BIN" != "X" ] ; then
# The first line that localectl outputs should look like this: ' System Locale: n/a'
PASS_SYS_LANG=`$LOCALECTL_BIN | grep "System Locale" | awk '{print $3}' 2>/dev/null`
case "$PASS_SYS_LANG" in
*n/a*)
# No system locale set. Skip.
PASS_SYS_LANG=""
;;
LANG=*)
PASS_SYS_LANG="$PASS_SYS_LANG "
;;
*)
# echo " WARNING: Failed to parse the output of localectl. The encoding may not be correct when running as $RUN_AS_USER.'"
PASS_SYS_LANG=""
;;
esac
fi
fi
}
checkRunUser() {
# $1 touchLock flag
# $2.. [command] args
# Make sure the configuration is valid.
validateRunUser
# Check the configured user. If necessary rerun this script as the desired user.
if [ "X$RUN_AS_USER" != "X" ]
then
# If LOCKPROP and $RUN_AS_USER are defined then the new user will most likely not be
# able to create the lock file. The Wrapper will be able to update this file once it
# is created but will not be able to delete it on shutdown. If $1 is set then
# the lock file should be created for the current command
if [ "X$LOCKPROP" != "X" ]
then
if [ "X$1" != "X" ]
then
# Resolve the primary group
RUN_AS_GROUP=`groups $RUN_AS_USER | awk '{print $3}' | tail -1`
if [ "X$RUN_AS_GROUP" = "X" ]
then
RUN_AS_GROUP=$RUN_AS_USER
fi
touch $LOCKFILE
chown $RUN_AS_USER:$RUN_AS_GROUP $LOCKFILE
fi
fi
# Still want to change users, recurse. This means that the user will only be
# prompted for a password once. Variables shifted by 1
shift
# Wrap the parameters so they can be passed.
ADDITIONAL_PARA=""
while [ -n "$1" ] ; do
if [ "$1" = 'installstart' ] ; then
# At this point the service is already installed. When we will fork the process we only need to start the service.
ADDITIONAL_PARA="$ADDITIONAL_PARA \"start\""
else
ADDITIONAL_PARA="$ADDITIONAL_PARA \"$1\""
fi
shift
done
resolveSysLocale
RUNUSER_INTERRUPT_TRAPPED=false
$RUNUSER_BIN - $RUN_AS_USER -c "IS_SUBSTITUTE_USER=true $PASS_SYS_LANG\"$REALPATH\" $ADDITIONAL_PARA" $SU_OPTS
RUN_AS_USER_EXITCODE=$?
if [ $RUN_AS_USER_EXITCODE -eq 126 ] ; then
reportRealDirNotAccessible $RUN_AS_USER
elif [ $RUN_AS_USER_EXITCODE -gt 128 -o "$RUNUSER_INTERRUPT_TRAPPED" = "true" ] ; then
# The range 128-255 is reserved for signals, but if the user presses CTRL+C (or sends a signal?) two consecutive times, runuser/su will be interrupted and may return 0.
# The RUNUSER_INTERRUPT_TRAPPED is set when trapping INT, TERM, QUIT or HUP, but there might be other signals causing interruption.
# We use the 2 above conditions to cover most cases.
# Why can this happen: If a signal causing interruption is sent to the process group of the parent script, it will also be caught by the
# runuser process which belongs to the same group. The parent script can ignore it but the runuser process will be terminated.
# The Wrapper will take some time to exit cleanly or may not even exit depending on the signal, so we should wait for its PID.
# NOTES: - it is not possible to use the wait command because the Wrapper is a child of the login shell started by runuser.
# - it is possible that Wrapper returned a reserved exit code, but we wouldn't wait below because getpid should return an empty $pid.
getpid
if [ "X$pid" != "X" ] ; then
if [ $RUN_AS_USER_EXITCODE -eq 255 ] ; then
# On some system, su returns 255 if it has to kill the command (because it was asked to terminate, and the command did not terminate in time).
# Print a different message to make it clear that runuser/su did not force kill the Wrapper process.
eval echo `gettext 'Intermediate login shell was killed. Still waiting for the Wrapper process to stop...'`
else
eval echo `gettext 'Waiting for the Wrapper process to stop...'`
fi
fi
while [ "X$pid" != "X" ] ; do
sleep 1
testpid
done
elif [ $RUN_AS_USER_EXITCODE -eq 1 ] ; then
# 1 is a special case as it can either be a generic error before executing the Wrapper, or the Wrapper exit code returned on error.
checkForkCommand
fi
# Now that we are the original user again, we may need to clean up the lock file.
if [ "X$LOCKPROP" != "X" ]
then
getpid
if [ "X$pid" = "X" ]
then
# Wrapper is not running so make sure the lock file is deleted.
if [ -f "$LOCKFILE" ]
then
rm "$LOCKFILE"
fi
fi
fi
exit $RUN_AS_USER_EXITCODE
fi
}
# Try to fork by executing a simple command.
# With this function, we want to make sure we are able to fork.
checkForkCommand() {
$RUNUSER_BIN - $RUN_AS_USER -c "ls \"$REALPATH\"" $SU_OPTS > /dev/null 2>&1 &
CHECK_EXITCODE=$?
if [ $CHECK_EXITCODE -ne 0 ]
then
# clearly a problem with forking
eval echo `gettext 'Error: unable to create fork process.'`
eval echo `gettext 'Advice:'`
eval echo `gettext 'One possible cause of failure is when the user \(\"$RUN_AS_USER\"\) has no shell.'`
eval echo `gettext 'In this case, two solutions are available by editing the script file:'`
eval echo `gettext '1. Use \"SU_OPTS\" to set the shell for the user.'`
eval echo `gettext '2. Use a OS service management tool \(only available on some platforms\).'`
echo ""
fi
}
getpid() {
pid=""
if [ -f "$PIDFILE" ]
then
if [ -r "$PIDFILE" ]
then
pid=`cat "$PIDFILE"`
if [ "X$pid" != "X" ]
then
if [ "X$PIDFILE_CHECK_PID" != "X" ]
then
# It is possible that 'a' process with the pid exists but that it is not the
# correct process. This can happen in a number of cases, but the most
# common is during system startup after an unclean shutdown.
# The ps statement below looks for the specific wrapper command running as
# the pid. If it is not found then the pid file is considered to be stale.
case "$DIST_OS" in
'freebsd')
pidtest=`$PS_BIN -p $pid -o args | tail -1`
if [ "X$pidtest" = "XCOMMAND" ]
then
pidtest=""
fi
;;
'macosx')
pidtest=`$PS_BIN -ww -p $pid -o command | grep -F "$WRAPPER_CMD" | tail -1`
;;
'solaris')
if [ -f "/usr/bin/pargs" ]
then
pidtest=`pargs $pid | fgrep "$WRAPPER_CMD" | tail -1`
else
case "$PS_BIN" in
'/usr/ucb/ps')
pidtest=`$PS_BIN -auxww $pid | fgrep "$WRAPPER_CMD" | tail -1`
;;
'/usr/bin/ps')
TRUNCATED_CMD=`$PS_BIN -o comm -p $pid | tail -1`
COUNT=`echo $TRUNCATED_CMD | wc -m`
COUNT=`echo ${COUNT}`
COUNT=`expr $COUNT - 1`
TRUNCATED_CMD=`echo $WRAPPER_CMD | cut -c1-$COUNT`
pidtest=`$PS_BIN -o comm -p $pid | fgrep "$TRUNCATED_CMD" | tail -1`
;;
'/bin/ps')
TRUNCATED_CMD=`$PS_BIN -o comm -p $pid | tail -1`
COUNT=`echo $TRUNCATED_CMD | wc -m`
COUNT=`echo ${COUNT}`
COUNT=`expr $COUNT - 1`
TRUNCATED_CMD=`echo $WRAPPER_CMD | cut -c1-$COUNT`
pidtest=`$PS_BIN -o comm -p $pid | fgrep "$TRUNCATED_CMD" | tail -1`
;;
*)
echo "Unsupported ps command $PS_BIN"
exit 1
;;
esac
fi
;;
'hpux')
pidtest=`$PS_BIN -p $pid -x -o args | grep -F "$WRAPPER_CMD" | tail -1`
;;
'zos')
TRUNCATED_CMD=`$PS_BIN -p $pid -o args | tail -1`
COUNT=`echo $TRUNCATED_CMD | wc -m`
COUNT=`echo ${COUNT}`
COUNT=`expr $COUNT - 1`
TRUNCATED_CMD=`echo $WRAPPER_CMD | cut -c1-$COUNT`
pidtest=`$PS_BIN -p $pid -o args | grep -F "$TRUNCATED_CMD" | tail -1`
;;
'linux')
pidtest=`$PS_BIN -ww -p $pid -o args | grep -F "$WRAPPER_CMD" | tail -1`
;;
*)
pidtest=`$PS_BIN -p $pid -o args | grep -F "$WRAPPER_CMD" | tail -1`
;;
esac
else
# Check to see whether the pid exists as a running process, but in this mode, don't check what that pid is.
case "$DIST_OS" in
'solaris')
case "$PS_BIN" in
'/usr/ucb/ps')
pidtest=`$PS_BIN $pid | grep "$pid" | awk '{print $1}' | tail -1`
;;
'/usr/bin/ps')
pidtest=`$PS_BIN -p $pid -o pid | grep "$pid" | tail -1`
;;
'/bin/ps')
pidtest=`$PS_BIN -p $pid -o pid | grep "$pid" | tail -1`
;;
*)
echo "Unsupported ps command $PS_BIN"
exit 1
;;
esac
;;
*)
pidtest=`$PS_BIN -p $pid -o pid | grep "$pid" | tail -1`
;;
esac
fi
if [ "X$pidtest" = "X" ]
then
# This is a stale pid file.
rm -f "$PIDFILE"
eval echo `gettext 'Removed stale pid file: $PIDFILE'`
pid=""
fi
fi
else
eval echo `gettext 'Cannot read $PIDFILE.'`
exit 1
fi
fi
}
getstatus() {
STATUS=
if [ -f "$STATUSFILE" ]
then
if [ -r "$STATUSFILE" ]
then
STATUS=`cat "$STATUSFILE"`
fi
fi
if [ "X$STATUS" = "X" ]
then
STATUS="Unknown"
fi
JAVASTATUS=
if [ -f "$JAVASTATUSFILE" ]
then
if [ -r "$JAVASTATUSFILE" ]
then
JAVASTATUS=`cat "$JAVASTATUSFILE"`
fi
fi
if [ "X$JAVASTATUS" = "X" ]
then
JAVASTATUS="Unknown"
fi
}
testpid() {
case "$DIST_OS" in
'solaris')
case "$PS_BIN" in
'/usr/ucb/ps')
pid=`$PS_BIN $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1`
;;
'/usr/bin/ps')
pid=`$PS_BIN -p $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1`
;;
'/bin/ps')
pid=`$PS_BIN -p $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1`
;;
*)
echo "Unsupported ps command $PS_BIN"
exit 1
;;
esac
;;
*)
pid=`$PS_BIN -p $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1` 2>/dev/null
;;
esac
if [ "X$pid" = "X" ]
then
pid=""
fi
}
launchdtrap() {
stopit
exit
}
waitForWrapperStop() {
getpid
while [ "X$pid" != "X" ] ; do
sleep 1
getpid
done
}
launchinternal() {
getpid
trap launchdtrap TERM
if [ "X$pid" = "X" ]
then
# The string passed to eval must handles spaces in paths correctly.
COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=\"$APP_NAME\" wrapper.pidfile=\"$PIDFILE\" wrapper.daemonize=TRUE $APPNAMEPROP $ANCHORPROP $IGNOREPROP $STATUSPROP $COMMANDPROP $LOCKPROP wrapper.script.version=3.5.51 $ADDITIONAL_PARA"
eval "$COMMAND_LINE"
else
eval echo `gettext '$APP_LONG_NAME is already running.'`
exit 1
fi
# launchd expects that this script stay up and running so we need to do our own monitoring of the Wrapper process.
if [ $WAIT_FOR_STARTED_STATUS = true ]
then
waitForWrapperStop
fi
}
consoleTrapInterrupt() {
# Set a flag to inform su/runuser that we caught an interrupt signal.
RUNUSER_INTERRUPT_TRAPPED=true
}
consoleTrap() {
if [ $2 = 1 ] ; then
# Set a flag to inform su/runuser that we caught an interrupt signal (do it as early as possible).
RUNUSER_INTERRUPT_TRAPPED=true
fi
getpid
if [ "X$pid" != "X" ] ; then
# still alive
kill -$1 $pid
if [ $? -ne 0 ] ; then
# log a message but do not exit
eval echo `gettext 'Unable to forward $1 signal to $APP_LONG_NAME.'`
fi
# Nothing else to do. Let the script complete normally after the Wrapper exits.
fi
}
consoleTrapSignals() {
if [ "$IS_SUBSTITUTE_USER" != "true" ] ; then
# Trap the following signals in order to forward them to the Wrapper.
if [ "X$RUN_AS_USER" != "X" ] ; then
trap "consoleTrap INT 1" INT
trap "consoleTrap TERM 1" TERM
else
trap "consoleTrap INT 0" INT
trap "consoleTrap TERM 0" TERM
fi
# SIGQUIT is usually triggered with the keyboard (CTRL+\). Forward it when running as a user.
# When running normally, the Wrapper being member of the same process group will also get the signal, so no need to forward it.
if [ "X$RUN_AS_USER" != "X" ] ; then
trap "consoleTrap QUIT 1" QUIT
else
trap '' QUIT
fi
# SIGHUP should be caught otherwise it would interrupt the script, but do not forward it.
if [ "X$RUN_AS_USER" != "X" ] ; then
# SIGHUP behaves differently than INT/TERM/QUIT and should not interrupt su/runuser when a custom handler is registered.
# But this might depend on the shell & platform. Be safe and set the RUNUSER_INTERRUPT_TRAPPED flag anyway.
trap 'consoleTrapInterrupt' HUP
else
trap '' HUP
fi
fi
}
console() {
eval echo `gettext 'Running $APP_LONG_NAME...'`
getpid
if [ "X$pid" = "X" ]
then
prepAdditionalParams "$@"
# The string passed to eval must handles spaces in paths correctly.
COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=\"$APP_NAME\" wrapper.pidfile=\"$PIDFILE\" $APPNAMEPROP $ANCHORPROP $STATUSPROP $COMMANDPROP $LOCKPROP wrapper.script.version=3.5.51 $ADDITIONAL_PARA"
eval "$COMMAND_LINE"
COMMAND_EXIT_CODE=$?
if [ $COMMAND_EXIT_CODE -ne 0 ] ; then
exit $COMMAND_EXIT_CODE
fi
else
eval echo `gettext '$APP_LONG_NAME is already running.'`
exit 1
fi
}
waitforjavastartup() {
getstatus
eval echo $ECHOOPT `gettext 'Waiting for $APP_LONG_NAME...$ECHOOPTC'`
# Wait until the timeout or we have something besides Unknown.
counter=15
while [ "$JAVASTATUS" = "Unknown" -a $counter -gt 0 -a -n "$JAVASTATUS" ] ; do
echo $ECHOOPT".$ECHOOPTC"
sleep 1
getstatus
counter=`expr $counter - 1`
done
if [ -n "$WAIT_FOR_STARTED_TIMEOUT" ] ; then
counter=$WAIT_FOR_STARTED_TIMEOUT
else
counter=120
fi
while [ "$JAVASTATUS" != "STARTED" -a "$JAVASTATUS" != "Unknown" -a $counter -gt 0 -a -n "$JAVASTATUS" ] ; do
echo $ECHOOPT".$ECHOOPTC"
sleep 1
getstatus
counter=`expr $counter - 1`
done
echo ""
}
##
# Request the path to the log file to the Wrapper and print it
#
# $1 prefix
printlogfilepath() {
LOG_FILE1=`"$WRAPPER_CMD" --request_log_file "$WRAPPER_CONF" 2>/dev/null`
if [ $? = 0 -a "X$LOG_FILE1" != "X" ] ; then
# try to see if a default log file exists
LOG_FILE2=`"$WRAPPER_CMD" --request_default_log_file "$WRAPPER_CONF" 2>/dev/null`
if [ $? != 0 -o ! -f "$LOG_FILE2" ] ; then
LOG_FILE2=""
fi
else
# try to see if a default log file exists
LOG_FILE1=`"$WRAPPER_CMD" --request_default_log_file "$WRAPPER_CONF" 2>/dev/null`
if [ $? != 0 -o ! -f "$LOG_FILE1" ] ; then
LOG_FILE1=""
fi
fi
if [ "X$LOG_FILE2" != "X" ] ; then
LOG_FILE_MSG=`gettext 'The log files \"${LOG_FILE1}\" and \"${LOG_FILE2}\" may contain further information.'`
elif [ "X$LOG_FILE1" != "X" ] ; then
LOG_FILE_MSG=`gettext 'The log file \"${LOG_FILE1}\" may contain further information.'`
else
LOG_FILE_MSG=`gettext 'The syslog may contain further information.'`
fi
LOG_FILE_MSG=`eval echo "${LOG_FILE_MSG}"` # expand ${LOG_FILE}
echo "$1${LOG_FILE_MSG}" # print with indentation
}
startwait() {
if [ $WAIT_FOR_STARTED_STATUS = true ]
then
waitforjavastartup
fi
# Sleep for a few seconds to allow for intialization if required
# then test to make sure we're still running.
#
i=0
while [ $i -lt $WAIT_AFTER_STARTUP ]
do
sleep 1
echo $ECHOOPT".$ECHOOPTC"
i=`expr $i + 1`
done
if [ $WAIT_AFTER_STARTUP -gt 0 -o $WAIT_FOR_STARTED_STATUS = true ]
then
getpid
if [ "X$pid" = "X" ]
then
eval echo `gettext 'WARNING: $APP_LONG_NAME may have failed to start.'`
printlogfilepath " "
exit 1
else
eval echo `gettext ' running: PID:$pid'`
fi
else
echo ""
fi
}
mustBeStoppedOrExit() {
getpid
if [ "X$pid" != "X" ] ; then
eval echo `gettext '$APP_LONG_NAME is already running.'`
exit 1
fi
}
# Detect if the Wrapper is running
# Returns 0 if the process is running, otherwise returns 1.
checkRunning() {
getpid
if [ "X$pid" = "X" ] ; then
eval echo `gettext '$APP_LONG_NAME is not running.'`
if [ "X$1" = "X1" ] ; then
exit 1
fi
return 1
fi
return 0
}
macosxStart() {
mustBeRootOrExit
mustBeStoppedOrExit
eval echo `gettext 'Starting $APP_LONG_NAME with launchd...'`
# If the daemon was just installed, it may not be loaded.
LOADED_PLIST=`launchctl list | grep ${APP_PLIST_BASE}`
if [ "X${LOADED_PLIST}" = "X" ] ; then
launchctl load /Library/LaunchDaemons/${APP_PLIST}
fi
# If launchd is set to run the daemon already at Load, we don't need to call start
getpid
if [ "X$pid" = "X" ] ; then
launchctl start ${APP_PLIST_BASE}
fi
startwait
}
macosxStop() {
mustBeRootOrExit
# The daemon must be running.
checkRunning "1"
eval echo `gettext 'Stopping $APP_LONG_NAME...'`
if [ "$MACOSX_KEEP_RUNNING" = "true" ] ; then
echo ""
eval echo `gettext 'Daemon is set to be kept continuously running and it will be automatically restarted.'`
eval echo `gettext 'To stop the daemon you need to uninstall it.'`
eval echo `gettext 'If you want to use the \"stop\" argument, you need to find MACOSX_KEEP_RUNNING'`
eval echo `gettext 'at the beginning of the script file and set it to \"false\".'`
echo ""
fi
launchctl stop ${APP_PLIST_BASE}
}
macosxRestart() {
mustBeRootOrExit
checkRunning $1
eval echo `gettext 'Restarting $APP_LONG_NAME...'`
if [ "$MACOSX_KEEP_RUNNING" = "true" ] ; then
# by stopping it, launchd will automatically restart it
launchctl stop ${APP_PLIST_BASE}
else
launchctl unload "/Library/LaunchDaemons/${APP_PLIST}"
sleep 1
launchctl load "/Library/LaunchDaemons/${APP_PLIST}"
fi
startwait
}
upstartInstall() {
# Always verify that upstart exists.
upstartDetection
if [ $? -ne 0 ] ; then
eval echo `gettext 'Unable to install the $APP_LONG_NAME daemon because upstart does not exist.'`
return 1
fi
eval echo `gettext ' Installing the $APP_LONG_NAME daemon with upstart...'`
if [ -f "${REALDIR}/${APP_NAME}.install" ] ; then
eval echo `gettext ' Custom upstart conf file ${APP_NAME}.install found.'`
cp "${REALDIR}/${APP_NAME}.install" "/etc/init/${APP_NAME}.conf"
else
eval echo `gettext ' Creating default upstart conf file...'`
echo "# ${APP_NAME} - ${APP_LONG_NAME}" > "/etc/init/${APP_NAME}.conf"
echo "description \"${APP_LONG_NAME}\"" >> "/etc/init/${APP_NAME}.conf"
echo "author \"Tanuki Software Ltd. \"" >> "/etc/init/${APP_NAME}.conf"
echo "start on runlevel [2345]" >> "/etc/init/${APP_NAME}.conf"
echo "stop on runlevel [!2345]" >> "/etc/init/${APP_NAME}.conf"
echo "env LANG=${LANG}" >> "/etc/init/${APP_NAME}.conf"
echo "exec \"${REALPATH}\" upstartinternal" >> "/etc/init/${APP_NAME}.conf"
fi
}
upstartStart() {
mustBeRootOrExit
mustBeStoppedOrExit
eval echo `gettext 'Starting $APP_LONG_NAME with upstart...'`
/sbin/start ${APP_NAME}
startwait
}
upstartStop() {
mustBeRootOrExit
# The daemon must be running.
checkRunning "1"
eval echo `gettext 'Stopping $APP_LONG_NAME...'`
/sbin/stop ${APP_NAME}
}
upstartRestart() {
mustBeRootOrExit
checkRunning $1
if [ "X$pid" = "X" ] ; then
# Don't use /sbin/restart because it requires the daemon to be running.
# We want to match with other systems behaviour which is to restart the
# daemon even if it was not running.
upstartStart
else
# The daemon was running
eval echo `gettext 'Restarting $APP_LONG_NAME...'`
/sbin/restart ${APP_NAME}
startwait
fi
}
upstartRemove() {
stopit "0"
eval echo `gettext ' Removing the $APP_LONG_NAME daemon from upstart...'`
rm "/etc/init/${APP_NAME}.conf"
}
systemdInstall() {
# Always verify that systemd exists.
systemdDetection
if [ $? -ne 0 ] ; then
eval echo `gettext 'Unable to install the $APP_LONG_NAME daemon because systemd does not exist.'`
return 1
fi
eval echo `gettext ' Installing the $APP_LONG_NAME daemon with systemd...'`
if [ -f "${REALDIR}/${APP_NAME}.service" ] ; then
eval echo `gettext ' Custom service file ${APP_NAME}.service found.'`
cp "${REALDIR}/${APP_NAME}.service" "${SYSTEMD_SERVICE_FILE}"
else
eval echo `gettext ' Creating default service file...'`
echo "[Unit]" > "${SYSTEMD_SERVICE_FILE}"
echo "Description=${APP_LONG_NAME}" >> "${SYSTEMD_SERVICE_FILE}"
echo "After=syslog.target" >> "${SYSTEMD_SERVICE_FILE}"
echo "" >> "${SYSTEMD_SERVICE_FILE}"
echo "[Service]" >> "${SYSTEMD_SERVICE_FILE}"
echo "Type=forking" >> "${SYSTEMD_SERVICE_FILE}"
case "${REALPATH}" in
*\ *)
# REALPATH contains spaces
LINE_HEAD='ExecStart=/usr/bin/env "'
LINE_TAIL='" start sysd'
echo "${LINE_HEAD}${REALPATH}${LINE_TAIL}" >> "${SYSTEMD_SERVICE_FILE}"
LINE_HEAD='ExecStop=/usr/bin/env "'
LINE_TAIL='" stop sysd'
echo "${LINE_HEAD}${REALPATH}${LINE_TAIL}" >> "${SYSTEMD_SERVICE_FILE}"
;;
*)
echo "ExecStart=${REALPATH} start sysd" >> "${SYSTEMD_SERVICE_FILE}"
echo "ExecStop=${REALPATH} stop sysd" >> "${SYSTEMD_SERVICE_FILE}"
;;
esac
if [ "X${RUN_AS_USER}" != "X" ] ; then
echo "User=${RUN_AS_USER}" >> "${SYSTEMD_SERVICE_FILE}"
fi
if [ "X${SYSTEMD_KILLMODE}" != "X" ] ; then
echo "KillMode=${SYSTEMD_KILLMODE}" >> "${SYSTEMD_SERVICE_FILE}"
fi
if [ $SYSTEMD_KILLMODE != "process" -a $SYSTEMD_KILLMODE != "none" ] ; then
# Set an environment variable to show a warning if a detached process is launched by the WrapperManager.
echo "Environment=SYSTEMD_KILLMODE_WARNING=true" >> "${SYSTEMD_SERVICE_FILE}"
fi
echo "" >> "${SYSTEMD_SERVICE_FILE}"
echo "[Install]" >> "${SYSTEMD_SERVICE_FILE}"
echo "WantedBy=multi-user.target" >> "${SYSTEMD_SERVICE_FILE}"
fi
systemctl daemon-reload
systemctl enable "${APP_NAME}"
}
systemdStart() {
# Don't do mustBeRootOrExit because systemd will ask for the password when not root
mustBeStoppedOrExit
result=`systemctl -p KillMode show $APP_NAME`
if [ $result != "KillMode=$SYSTEMD_KILLMODE" ] ; then
eval echo `gettext 'SYSTEMD_KILLMODE is set to \"${SYSTEMD_KILLMODE}\" on the top of the script, but the daemon is running with $result.'`
eval echo `gettext 'The daemon must be reinstalled for the value of SYSTEMD_KILLMODE to take effect.'`
exit 1
fi
eval echo `gettext 'Starting $APP_LONG_NAME with systemd...'`
systemctl start $APP_NAME
if [ $? -ne 0 ] ; then
eval echo `gettext 'Failed to start $APP_LONG_NAME.'`
printlogfilepath
exit 1
fi
startwait
}
systemdStop() {
# Don't do mustBeRootOrExit because systemd will ask for the password when not root
# The daemon must be running.
checkRunning "1"
eval echo `gettext 'Stopping $APP_LONG_NAME...'`
systemctl stop $APP_NAME
if [ $? -ne 0 ] ; then
eval echo `gettext 'Failed to stop $APP_LONG_NAME.'`
exit 1
fi
}
systemdRestart() {
# Don't do mustBeRootOrExit because systemd will ask for the password when not root
checkRunning $1
eval echo `gettext 'Restarting $APP_LONG_NAME...'`
systemctl restart $APP_NAME
if [ $? -ne 0 ] ; then
eval echo `gettext 'Failed to restart service $APP_NAME'`
printlogfilepath
exit 1
fi
startwait
}
systemdRemove() {
stopit "0"
eval echo `gettext ' Removing the $APP_LONG_NAME daemon from systemd...'`
systemctl disable $APP_NAME
rm "/etc/systemd/system/${APP_NAME}.service"
systemctl daemon-reload
}
srcInstall() {
# Always verify that SRC exists.
srcDetection
if [ $? -ne 0 ] ; then
eval echo `gettext 'Unable to install the $APP_LONG_NAME daemon because SRC does not exist.'`
return 1
fi
if [ "X$RUN_AS_USER" = "X" ] ; then
USERID="0"
else
resolveIdLocation
USERID=`$ID_BIN -u "$RUN_AS_USER"`
if [ $? -ne 0 ] ; then
eval echo `gettext 'Failed to get user id for $RUN_AS_USER'`
exit 1
fi
fi
validateAppNameLength
/usr/bin/mkssys -s "$APP_NAME" -p "$REALPATH" -a "launchdinternal" -u "$USERID" -f 9 -n 15 -S
/usr/sbin/mkitab "$APP_NAME":2:once:"/usr/bin/startsrc -s \"${APP_NAME}\" >/dev/console 2>&1"
}
srcStart() {
mustBeRootOrExit
mustBeStoppedOrExit
eval echo `gettext 'Starting $APP_LONG_NAME with SRC...'`
startsrc -s "${APP_NAME}"
if [ $? -ne 0 ] ; then
eval echo `gettext 'Failed to start $APP_LONG_NAME.'`
printlogfilepath
exit 1
fi
startwait
}
srcStop() {
mustBeRootOrExit
# The daemon must be running.
checkRunning "1"
eval echo `gettext 'Stopping $APP_LONG_NAME...'`
stopsrc -s "${APP_NAME}"
if [ $? -ne 0 ] ; then
eval echo `gettext 'Failed to stop $APP_LONG_NAME.'`
exit 1
fi
}
srcRestart() {
mustBeRootOrExit
checkRunning $1
if [ "X$pid" != "X" ] ; then
# The daemon was running. Stop it first.
eval echo `gettext 'Restarting $APP_LONG_NAME...'`
srcStop
waitForWrapperStop
fi
srcStart
}
start() {
mustBeStoppedOrExit
eval echo `gettext 'Starting $APP_LONG_NAME...'`
prepAdditionalParams "$@"
# The string passed to eval must handles spaces in paths correctly.
COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=\"$APP_NAME\" wrapper.pidfile=\"$PIDFILE\" wrapper.daemonize=TRUE $APPNAMEPROP $ANCHORPROP $IGNOREPROP $STATUSPROP $COMMANDPROP $LOCKPROP wrapper.script.version=3.5.51 $ADDITIONAL_PARA"
eval "$COMMAND_LINE"
startwait
}
stopit() {
# $1 exit if down flag
checkRunning $1
if [ $? -eq 0 ] ; then
# The daemon should be running.
eval echo `gettext 'Stopping $APP_LONG_NAME...'`
if [ "X$IGNORE_SIGNALS" = "X" ]
then
# Running so try to stop it.
kill $pid
if [ $? -ne 0 ]
then
# An explanation for the failure should have been given
eval echo `gettext 'Unable to stop $APP_LONG_NAME.'`
exit 1
fi
else
rm -f "$ANCHORFILE"
if [ -f "$ANCHORFILE" ]
then
# An explanation for the failure should have been given
eval echo `gettext 'Unable to stop $APP_LONG_NAME.'`
exit 1
fi
fi
# We can not predict how long it will take for the wrapper to
# actually stop as it depends on settings in wrapper.conf.
# Loop until it does.
savepid=$pid
CNT=0
TOTCNT=0
while [ "X$pid" != "X" ]
do
# Show a waiting message every 5 seconds.
if [ "$CNT" -lt "5" ]
then
CNT=`expr $CNT + 1`
else
eval echo `gettext 'Waiting for $APP_LONG_NAME to exit...'`
CNT=0
fi
TOTCNT=`expr $TOTCNT + 1`
sleep 1
# Check if the process is still running.
testpid
if [ "X$pid" = "X" ]
then
# The process is gone, but it is possible that another instance restarted while we waited...
SAVE_PIDFILE_CHECK_PID=$PIDFILE_CHECK_PID
PIDFILE_CHECK_PID=""
getpid
PIDFILE_CHECK_PID=$SAVE_PIDFILE_CHECK_PID
if [ "X$pid" != "X" ]
then
# Another process is running.
if [ "$pid" = "$savepid" ]
then
# This should never happen, unless the PID was recycled?
eval echo `gettext 'Failed to stop $APP_LONG_NAME.'`
exit 1
else
eval echo `gettext 'The content of $PIDFILE has changed.'`
eval echo `gettext 'Another instance of the Wrapper might have started in the meantime.'`
# Exit now. Any further actions might compromise the running instance.
exit 1
fi
fi
fi
done
eval echo `gettext 'Stopped $APP_LONG_NAME.'`
fi
}
pause() {
getpid
if [ "X$pid" = "X" ] ; then
# The application is not running, print the status
status
else
if [ "$PAUSABLE_MODE" = "file" ] ; then
echo "PAUSE" >> $COMMANDFILE
if [ $? != 0 ] ; then
eval echo `gettext 'Failed to write in the command file to pause $APP_LONG_NAME.'`
exit 1
fi
else
# send a SIGUSR1 (use constants because numbers change depending on the platform)
kill -USR1 $pid 2>/dev/null
if [ $? != 0 ] ; then
kill -SIGUSR1 $pid
if [ $? != 0 ] ; then
eval echo `gettext 'Failed to send a signal to pause $APP_LONG_NAME.'`
exit 1
fi
fi
fi
eval echo `gettext 'Pausing $APP_LONG_NAME.'`
fi
}
resume() {
getpid
if [ "X$pid" = "X" ] ; then
# The application is not running, print the status
status
else
if [ "$PAUSABLE_MODE" = "file" ] ; then
echo "RESUME" >> $COMMANDFILE
if [ $? != 0 ] ; then
eval echo `gettext 'Failed to write in the command file to resume $APP_LONG_NAME.'`
exit 1
fi
else
# send a SIGUSR2 (use constants because numbers change depending on the platform)
kill -USR2 $pid 2>/dev/null
if [ $? != 0 ] ; then
kill -SIGUSR2 $pid
if [ $? != 0 ] ; then
eval echo `gettext 'Failed to send a signal to resume $APP_LONG_NAME.'`
exit 1
fi
fi
fi
eval echo `gettext 'Resuming $APP_LONG_NAME.'`
fi
}
# Get the status of SELinux and sets SELINUX_STATUS
# 0: Not present or unkown
# 1: Disabled
# 2: Permissive (unauthorized access attempts aren't denied but logs are written)
# 3: Enforcing
getSELinuxStatus() {
result=`getenforce 2>/dev/null`
if [ $? -ne 0 ] ; then
# Not present
SELINUX_STATUS=0
else
case "$result" in
'Disabled')
SELINUX_STATUS=1
;;
'Permissive')
SELINUX_STATUS=2
;;
'Enforcing')
SELINUX_STATUS=3
;;
*)
SELINUX_STATUS=0
;;
esac
fi
}
status() {
checkInstalled
getpid
if [ "X$pid" = "X" ]
then
if [ $installedStatus -eq $SERVICE_NOT_INSTALLED ] ; then
eval echo `gettext '$APP_LONG_NAME \(not installed\) is not running.'`
elif [ "X$installedWith" = "X" ] ; then
eval echo `gettext '$APP_LONG_NAME \(installed\) is not running.'`
else
eval echo `gettext '$APP_LONG_NAME \(installed with $installedWith\) is not running.'`
fi
exit 1
else
if [ "X$DETAIL_STATUS" = "X" ]
then
if [ $installedStatus -eq $SERVICE_NOT_INSTALLED ] ; then
eval echo `gettext '$APP_LONG_NAME \(not installed\) is running: PID:$pid'`
elif [ "X$installedWith" = "X" ] ; then
eval echo `gettext '$APP_LONG_NAME \(installed\) is running: PID:$pid'`
else
eval echo `gettext '$APP_LONG_NAME \(installed with $installedWith\) is running: PID:$pid'`
fi
else
getstatus
if [ $installedStatus -eq $SERVICE_NOT_INSTALLED ] ; then
eval echo `gettext '$APP_LONG_NAME \(not installed\) is running: PID:$pid, Wrapper:$STATUS, Java:$JAVASTATUS'`
elif [ "X$installedWith" = "X" ] ; then
eval echo `gettext '$APP_LONG_NAME \(installed\) is running: PID:$pid, Wrapper:$STATUS, Java:$JAVASTATUS'`
else
eval echo `gettext '$APP_LONG_NAME \(installed with $installedWith\) is running: PID:$pid, Wrapper:$STATUS, Java:$JAVASTATUS'`
fi
fi
exit 0
fi
}
resolveInitdCommand() {
# NOTE: update-rc.d & chkconfig are the recommended interfaces for managing
# init scripts. insserv is a low level tool used by these interfaces.
# chkconfig was available on old versions Ubuntu, but update-rc.d is
# preferred. chkconfig is used on RHEL based Linux.
# update-rc.d is used on distros such as Debian/Ubuntu
resolveLocation INITD_COMMAND "update-rc.d" ";/usr/sbin" 0
if [ $? -eq 0 ] ; then
USE_UPDATE_RC=1
else
# chkconfig is used on distros such as RHEL or Amazon Linux
resolveLocation INITD_COMMAND chkconfig ";/sbin" 0
if [ $? -eq 0 ] ; then
USE_CHKCONFIG=1
else
# if neither chkconfig nor update-rc.d are present, try insserv
resolveLocation INITD_COMMAND insserv ";/sbin" 0
if [ $? -eq 0 ] ; then
USE_INSSERV=1
else
INITD_COMMAND=""
fi
fi
fi
}
installdaemon() {
mustBeRootOrExit
checkInstalled
APP_NAME_LOWER=`echo "$APP_NAME" | $TR_BIN "[A-Z]" "[a-z]"`
if [ "$DIST_OS" = "solaris" ] ; then
eval echo `gettext 'Detected Solaris:'`
if [ $installedStatus -ne $SERVICE_NOT_INSTALLED ] ; then
eval echo `gettext ' The $APP_LONG_NAME daemon is already installed.'`
else
eval echo `gettext ' Installing the $APP_LONG_NAME daemon...'`
ln -s "$REALPATH" "/etc/init.d/$APP_NAME"
for i in `ls "/etc/rc3.d/K"??"$APP_NAME_LOWER" "/etc/rc3.d/S"??"$APP_NAME_LOWER" 2>/dev/null` ; do
eval echo `gettext ' Removing unexpected file before proceeding: $i'`
rm -f $i
done
ln -s "/etc/init.d/$APP_NAME" "/etc/rc3.d/K${APP_RUN_LEVEL_K}$APP_NAME_LOWER"
ln -s "/etc/init.d/$APP_NAME" "/etc/rc3.d/S${APP_RUN_LEVEL_S}$APP_NAME_LOWER"
fi
elif [ "$DIST_OS" = "linux" ] ; then
eval echo `gettext 'Detected Linux:'`
if [ $installedStatus -ne $SERVICE_NOT_INSTALLED ] ; then
eval echo `gettext ' The $APP_LONG_NAME daemon is already installed with $installedWith.'`
elif [ -n "$USE_SYSTEMD" ] ; then
systemdInstall
# If SELinux is present and enabled, then the context of the script needs to be updated for systemd to be allowed to execute it.
getSELinuxStatus
if [ $SELINUX_STATUS -ge 2 ] ; then
# Use chcon rather than semanage because it is present on more installations and also allows us to restore the default context more easily.
result=`chcon -t bin_t $REALPATH 2>/dev/null`
if [ $? -ne 0 ] ; then
# Print a warning, but the user can still configure SELinux manually.
SCRIPT_BASENAME=`basename "$REALDIR"`
eval echo `gettext ' WARNING: Could not update the SELinux context of $SCRIPT_BASENAME.'`
fi
fi
elif [ -n "$USE_UPSTART" ] ; then
upstartInstall
else
resolveInitdCommand
if [ -n "$USE_CHKCONFIG" ] ; then
eval echo `gettext ' Installing the $APP_LONG_NAME daemon with init.d \($INITD_COMMAND\)...'`
ln -s "$REALPATH" "/etc/init.d/$APP_NAME"
$INITD_COMMAND --add "$APP_NAME"
$INITD_COMMAND "$APP_NAME" on
elif [ "$USE_INSSERV" ] ; then
eval echo `gettext ' Installing the $APP_LONG_NAME daemon with init.d \($INITD_COMMAND\)...'`
ln -s "$REALPATH" "/etc/init.d/$APP_NAME"
$INITD_COMMAND "/etc/init.d/$APP_NAME"
elif [ "$USE_UPDATE_RC" ] ; then
eval echo `gettext ' Installing the $APP_LONG_NAME daemon with init.d \($INITD_COMMAND\)...'`
ln -s "$REALPATH" "/etc/init.d/$APP_NAME"
$INITD_COMMAND "$APP_NAME" defaults
else
eval echo `gettext ' Installing the $APP_LONG_NAME daemon with init.d...'`
ln -s "$REALPATH" /etc/init.d/$APP_NAME
for i in `ls "/etc/rc3.d/K"??"$APP_NAME_LOWER" "/etc/rc5.d/K"??"$APP_NAME_LOWER" "/etc/rc3.d/S"??"$APP_NAME_LOWER" "/etc/rc5.d/S"??"$APP_NAME_LOWER" 2>/dev/null` ; do
eval echo `gettext ' Removing unexpected file before proceeding: $i'`
rm -f $i
done
ln -s "/etc/init.d/$APP_NAME" "/etc/rc3.d/K${APP_RUN_LEVEL_K}$APP_NAME_LOWER"
ln -s "/etc/init.d/$APP_NAME" "/etc/rc3.d/S${APP_RUN_LEVEL_S}$APP_NAME_LOWER"
ln -s "/etc/init.d/$APP_NAME" "/etc/rc5.d/S${APP_RUN_LEVEL_S}$APP_NAME_LOWER"
ln -s "/etc/init.d/$APP_NAME" "/etc/rc5.d/K${APP_RUN_LEVEL_K}$APP_NAME_LOWER"
fi
fi
elif [ "$DIST_OS" = "hpux" ] ; then
eval echo `gettext 'Detected HP-UX:'`
if [ $installedStatus -ne $SERVICE_NOT_INSTALLED ] ; then
eval echo `gettext ' The $APP_LONG_NAME daemon is already installed.'`
else
eval echo `gettext ' Installing the $APP_LONG_NAME daemon...'`
ln -s "$REALPATH" "/sbin/init.d/$APP_NAME"
for i in `ls "/sbin/rc3.d/K"??"$APP_NAME_LOWER" "/sbin/rc3.d/S"??"$APP_NAME_LOWER" 2>/dev/null` ; do
eval echo `gettext ' Removing unexpected file before proceeding: $i'`
rm -f $i
done
ln -s "/sbin/init.d/$APP_NAME" "/sbin/rc3.d/K${APP_RUN_LEVEL_K}$APP_NAME_LOWER"
ln -s "/sbin/init.d/$APP_NAME" "/sbin/rc3.d/S${APP_RUN_LEVEL_S}$APP_NAME_LOWER"
fi
elif [ "$DIST_OS" = "aix" ] ; then
eval echo `gettext 'Detected AIX:'`
if [ $installedStatus -ne $SERVICE_NOT_INSTALLED -a $installedStatus -ne $SERVICE_INSTALLED_SRC_PARTIAL ] ; then
eval echo `gettext ' The $APP_LONG_NAME daemon is already installed with $installedWith.'`
else
eval echo `gettext ' Installing the $APP_LONG_NAME daemon...'`
if [ -n "`/usr/sbin/lsitab install_assist`" ] ; then
eval echo `gettext ' The task /usr/sbin/install_assist was found in the inittab, this might cause problems for all subsequent tasks to launch as this process is known to block the init task. Please make sure this task is not needed anymore and remove/deactivate it.'`
fi
for i in `ls "/etc/rc.d/rc2.d/K"??"$APP_NAME_LOWER" "/etc/rc.d/rc2.d/S"??"$APP_NAME_LOWER" 2>/dev/null` ; do
eval echo `gettext ' Removing unexpected file before proceeding: $i'`
rm -f $i
done
if [ -n "$USE_SRC" ] ; then
srcInstall
else
# install using initd
ln -s "$REALPATH" "/etc/rc.d/init.d/$APP_NAME"
ln -s "/etc/rc.d/init.d/$APP_NAME" "/etc/rc.d/rc2.d/K${APP_RUN_LEVEL_K}$APP_NAME_LOWER"
ln -s "/etc/rc.d/init.d/$APP_NAME" "/etc/rc.d/rc2.d/S${APP_RUN_LEVEL_S}$APP_NAME_LOWER"
fi
fi
elif [ "$DIST_OS" = "freebsd" ] ; then
eval echo `gettext 'Detected FreeBSD:'`
if [ $installedStatus -ne $SERVICE_NOT_INSTALLED ] ; then
eval echo `gettext ' The $APP_LONG_NAME daemon is already installed.'`
else
eval echo `gettext ' Installing the $APP_LONG_NAME daemon...'`
sed -i.bak "/${APP_NAME}_enable=\"YES\"/d" /etc/rc.conf
if [ -f "${REALDIR}/${APP_NAME}.install" ] ; then
ln -s "${REALDIR}/${APP_NAME}.install" "/etc/rc.d/$APP_NAME"
else
echo '#!/bin/sh' > "/etc/rc.d/$APP_NAME"
echo "#" >> "/etc/rc.d/$APP_NAME"
echo "# PROVIDE: $APP_NAME" >> "/etc/rc.d/$APP_NAME"
echo "# REQUIRE: NETWORKING" >> "/etc/rc.d/$APP_NAME"
echo "# KEYWORD: shutdown" >> "/etc/rc.d/$APP_NAME"
echo ". /etc/rc.subr" >> "/etc/rc.d/$APP_NAME"
echo "name=\"$APP_NAME\"" >> "/etc/rc.d/$APP_NAME"
echo "rcvar=\`set_rcvar\`" >> "/etc/rc.d/$APP_NAME"
echo "command=\"${REALPATH}\"" >> "/etc/rc.d/$APP_NAME"
echo 'start_cmd="${name}_start"' >> "/etc/rc.d/$APP_NAME"
echo 'load_rc_config $name' >> "/etc/rc.d/$APP_NAME"
echo 'status_cmd="${name}_status"' >> "/etc/rc.d/$APP_NAME"
echo 'stop_cmd="${name}_stop"' >> "/etc/rc.d/$APP_NAME"
echo "${APP_NAME}_status() {" >> "/etc/rc.d/$APP_NAME"
echo '${command} status' >> "/etc/rc.d/$APP_NAME"
echo '}' >> "/etc/rc.d/$APP_NAME"
echo "${APP_NAME}_stop() {" >> "/etc/rc.d/$APP_NAME"
echo '${command} stop' >> "/etc/rc.d/$APP_NAME"
echo '}' >> "/etc/rc.d/$APP_NAME"
echo "${APP_NAME}_start() {" >> "/etc/rc.d/$APP_NAME"
echo '${command} start' >> "/etc/rc.d/$APP_NAME"
echo '}' >> "/etc/rc.d/$APP_NAME"
echo 'run_rc_command "$1"' >> "/etc/rc.d/$APP_NAME"
fi
echo "${APP_NAME}_enable=\"YES\"" >> /etc/rc.conf
chmod 555 "/etc/rc.d/$APP_NAME"
fi
elif [ "$DIST_OS" = "macosx" ] ; then
eval echo `gettext 'Detected Mac OSX:'`
if [ $installedStatus -ne $SERVICE_NOT_INSTALLED ] ; then
eval echo `gettext ' The $APP_LONG_NAME daemon is already installed.'`
else
eval echo `gettext ' Installing the $APP_LONG_NAME daemon...'`
if [ -f "${REALDIR}/${APP_PLIST}" ] ; then
ln -s "${REALDIR}/${APP_PLIST}" "/Library/LaunchDaemons/${APP_PLIST}"
else
echo "" > "/Library/LaunchDaemons/${APP_PLIST}"
echo "> "/Library/LaunchDaemons/${APP_PLIST}"
echo "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">" >> "/Library/LaunchDaemons/${APP_PLIST}"
echo "" >> "/Library/LaunchDaemons/${APP_PLIST}"
echo " " >> "/Library/LaunchDaemons/${APP_PLIST}"
echo " Label" >> "/Library/LaunchDaemons/${APP_PLIST}"
echo " ${APP_PLIST_BASE}" >> "/Library/LaunchDaemons/${APP_PLIST}"
echo " ProgramArguments" >> "/Library/LaunchDaemons/${APP_PLIST}"
echo " " >> "/Library/LaunchDaemons/${APP_PLIST}"
echo " ${REALPATH}" >> "/Library/LaunchDaemons/${APP_PLIST}"
echo " launchdinternal" >> "/Library/LaunchDaemons/${APP_PLIST}"
echo " " >> "/Library/LaunchDaemons/${APP_PLIST}"
echo " ${KEY_KEEP_ALIVE}" >> "/Library/LaunchDaemons/${APP_PLIST}"
echo " <${MACOSX_KEEP_RUNNING}/>" >> "/Library/LaunchDaemons/${APP_PLIST}"
echo " RunAtLoad" >> "/Library/LaunchDaemons/${APP_PLIST}"
echo " " >> "/Library/LaunchDaemons/${APP_PLIST}"
if [ "X$RUN_AS_USER" != "X" ] ; then
echo " UserName" >> "/Library/LaunchDaemons/${APP_PLIST}"
echo " ${RUN_AS_USER}" >> "/Library/LaunchDaemons/${APP_PLIST}"
fi
echo " " >> "/Library/LaunchDaemons/${APP_PLIST}"
echo "" >> "/Library/LaunchDaemons/${APP_PLIST}"
fi
chmod 555 "/Library/LaunchDaemons/${APP_PLIST}"
fi
elif [ "$DIST_OS" = "zos" ] ; then
eval echo `gettext 'Detected z/OS:'`
if [ $installedStatus -ne $SERVICE_NOT_INSTALLED ] ; then
eval echo `gettext ' The $APP_LONG_NAME daemon is already installed.'`
else
eval echo `gettext ' Installing the $APP_LONG_NAME daemon...'`
cp /etc/rc /etc/rc.bak
sed "s:echo /etc/rc script executed, \`date\`::g" /etc/rc.bak > /etc/rc
echo "_BPX_JOBNAME='${APP_NAME}' \"${REALDIR}/${APP_NAME}\" start" >>/etc/rc
echo '/etc/rc script executed, `date`' >>/etc/rc
fi
else
eval echo `gettext 'Install not currently supported for $DIST_OS.'`
exit 1
fi
# Exit with 1 if the daemon was already installed when calling installdaemon().
# The test below requires $installedStatus to be unchanged since the call to
# checkInstalled() at the beginning of the function. If the script was launched
# with 'installstart' we want to start normally, so don't exit here.
if [ $installedStatus -ne $SERVICE_NOT_INSTALLED -a "$COMMAND" != 'installstart' ] ; then
exit 1
fi
# Check again the installation status. The script should exit with 1 if the service
# could not be installed (even if it was launched with 'installstart').
checkInstalled
if [ $installedStatus -eq $SERVICE_NOT_INSTALLED ] ; then
eval echo `gettext 'Service not installed.'`
exit 1
fi
}
startdaemon() {
getServiceControlMethod
if [ "$CTRL_WITH_LAUNCHD" = "true" ] ; then
macosxStart
elif [ "$CTRL_WITH_UPSTART" = "true" ] ; then
upstartStart
elif [ "$CTRL_WITH_SYSTEMD" = "true" ] ; then
systemdStart
elif [ "$CTRL_WITH_SRC" = "true" ] ; then
srcStart
else
if [ -n "$SYSD" ] ; then
shift
fi
checkRunUser touchlock "$@"
if [ ! -n "$FIXED_COMMAND" ] ; then
shift
fi
if [ "$SERVICE_MANAGEMENT_TOOL" != "auto" -a "$SERVICE_MANAGEMENT_TOOL" != "initd" ] ; then
eval echo `gettext 'Starting without using the configured service management tool \"$SERVICE_MANAGEMENT_TOOL\" because the service $APP_NAME is not installed.'`
fi
start "$@"
fi
}
restartdaemon() {
getServiceControlMethod
if [ "$CTRL_WITH_LAUNCHD" = "true" ] ; then
macosxRestart $1
elif [ "$CTRL_WITH_UPSTART" = "true" ] ; then
upstartRestart $1
elif [ "$CTRL_WITH_SYSTEMD" = "true" ] ; then
systemdRestart $1
elif [ "$CTRL_WITH_SRC" = "true" ] ; then
srcRestart $1
else
checkRunUser touchlock "$COMMAND"
checkRunning $1
if [ "X$pid" != "X" ] ; then
# The daemon was running. Stop it first.
eval echo `gettext 'Restarting $APP_LONG_NAME...'`
stopit $1
fi
shift
if [ ! -n "$FIXED_COMMAND" ] ; then
shift
fi
start "$@"
fi
}
isBitSet() {
if [ `expr \( $1 / $2 \) % 2` -eq 1 ]; then
return 1
else
return 0
fi
}
removedaemon() {
mustBeRootOrExit
checkInstalled
APP_NAME_LOWER=`echo "$APP_NAME" | $TR_BIN "[A-Z]" "[a-z]"`
if [ "$DIST_OS" = "solaris" ] ; then
eval echo `gettext 'Detected Solaris:'`
isBitSet $installedStatus $SERVICE_INSTALLED_DEFAULT
if [ $? -eq 1 ] ; then
stopit "0"
eval echo `gettext ' Removing the $APP_LONG_NAME daemon...'`
for i in `ls "/etc/rc3.d/K"??"$APP_NAME_LOWER" "/etc/rc3.d/S"??"$APP_NAME_LOWER" "/etc/init.d/$APP_NAME" 2>/dev/null` ; do
rm -f $i
done
else
eval echo `gettext ' The $APP_LONG_NAME daemon is not currently installed.'`
exit 1
fi
elif [ "$DIST_OS" = "linux" ] ; then
eval echo `gettext 'Detected Linux:'`
isBitSet $installedStatus $SERVICE_INSTALLED_SYSTEMD
if [ $? -eq 1 ] ; then
systemdRemove
# Always try to restore the SELinux context.
result=`restorecon $REALPATH 2>/dev/null`
if [ $? -ne 0 ] ; then
# Only print a warning if 'restorecon' exists or if SELinux is present.
getSELinuxStatus
result=`command -v restorecon 2>/dev/null`
if [ $? -eq 0 -o $SELINUX_STATUS -gt 0 ] ; then
SCRIPT_BASENAME=`basename "$REALDIR"`
eval echo `gettext ' WARNING: Could not restore the SELinux context of $SCRIPT_BASENAME.'`
fi
fi
fi
isBitSet $installedStatus $SERVICE_INSTALLED_UPSTART
if [ $? -eq 1 ] ; then
upstartRemove
fi
isBitSet $installedStatus $SERVICE_INSTALLED_DEFAULT
if [ $? -eq 1 ] ; then
stopit "0"
eval echo `gettext ' Removing the $APP_LONG_NAME daemon from init.d...'`
resolveInitdCommand
if [ -n "$USE_CHKCONFIG" ] ; then
$INITD_COMMAND "$APP_NAME" off
$INITD_COMMAND --del "$APP_NAME"
rm -f "/etc/init.d/$APP_NAME"
elif [ "$USE_INSSERV" ] ; then
$INITD_COMMAND -r "/etc/init.d/$APP_NAME"
rm -f "/etc/init.d/$APP_NAME"
elif [ "$USE_UPDATE_RC" ] ; then
$INITD_COMMAND -f "$APP_NAME" remove
rm -f "/etc/init.d/$APP_NAME"
else
for i in `ls "/etc/rc3.d/K"??"$APP_NAME_LOWER" "/etc/rc5.d/K"??"$APP_NAME_LOWER" "/etc/rc3.d/S"??"$APP_NAME_LOWER" "/etc/rc5.d/S"??"$APP_NAME_LOWER" "/etc/init.d/$APP_NAME" 2>/dev/null` ; do
rm -f $i
done
fi
fi
if [ $installedStatus -eq $SERVICE_NOT_INSTALLED ] ; then
eval echo `gettext ' The $APP_LONG_NAME daemon is not currently installed.'`
exit 1
fi
elif [ "$DIST_OS" = "hpux" ] ; then
eval echo `gettext 'Detected HP-UX:'`
isBitSet $installedStatus $SERVICE_INSTALLED_DEFAULT
if [ $? -eq 1 ] ; then
stopit "0"
eval echo `gettext ' Removing the $APP_LONG_NAME daemon...'`
for i in `ls "/sbin/rc3.d/K"??"$APP_NAME_LOWER" "/sbin/rc3.d/S"??"$APP_NAME_LOWER" "/sbin/init.d/$APP_NAME" 2>/dev/null` ; do
rm -f $i
done
else
eval echo `gettext ' The $APP_LONG_NAME daemon is not currently installed.'`
exit 1
fi
elif [ "$DIST_OS" = "aix" ] ; then
eval echo `gettext 'Detected AIX:'`
if [ $installedStatus -ne $SERVICE_NOT_INSTALLED ] ; then
stopit "0"
eval echo `gettext ' Removing the $APP_LONG_NAME daemon...'`
isBitSet $installedStatus $SERVICE_INSTALLED_DEFAULT
if [ $? -eq 1 ] ; then
for i in `ls "/etc/rc.d/rc2.d/K"??"$APP_NAME_LOWER" "/etc/rc.d/rc2.d/S"??"$APP_NAME_LOWER" "/etc/rc.d/init.d/$APP_NAME" 2>/dev/null` ; do
rm -f $i
done
fi
isBitSet $installedStatus $SERVICE_INSTALLED_SRC
isSrcSet=$?
isBitSet $installedStatus $SERVICE_INSTALLED_SRC_PARTIAL
isSrcPartialSet=$?
if [ $isSrcSet -eq 1 -o $isSrcPartialSet -eq 1 ] ; then
validateAppNameLength
/usr/sbin/rmitab $APP_NAME
/usr/bin/rmssys -s $APP_NAME
fi
else
eval echo `gettext ' The $APP_LONG_NAME daemon is not currently installed.'`
exit 1
fi
elif [ "$DIST_OS" = "freebsd" ] ; then
eval echo `gettext 'Detected FreeBSD:'`
if [ -f "/etc/rc.d/$APP_NAME" -o -L "/etc/rc.d/$APP_NAME" ] ; then
stopit "0"
eval echo `gettext ' Removing the $APP_LONG_NAME daemon...'`
for i in "/etc/rc.d/$APP_NAME"
do
rm -f $i
done
sed -i.bak "/${APP_NAME}_enable=\"YES\"/d" /etc/rc.conf
else
eval echo `gettext ' The $APP_LONG_NAME daemon is not currently installed.'`
exit 1
fi
elif [ "$DIST_OS" = "macosx" ] ; then
eval echo `gettext 'Detected Mac OSX:'`
if [ -f "/Library/LaunchDaemons/${APP_PLIST}" -o -L "/Library/LaunchDaemons/${APP_PLIST}" ] ; then
stopit "0"
eval echo `gettext ' Removing the $APP_LONG_NAME daemon...'`
# Make sure the plist is installed
LOADED_PLIST=`launchctl list | grep ${APP_PLIST_BASE}`
if [ "X${LOADED_PLIST}" != "X" ] ; then
launchctl unload "/Library/LaunchDaemons/${APP_PLIST}"
fi
rm -f "/Library/LaunchDaemons/${APP_PLIST}"
else
eval echo `gettext ' The $APP_LONG_NAME daemon is not currently installed.'`
exit 1
fi
elif [ "$DIST_OS" = "zos" ] ; then
eval echo `gettext 'Detected z/OS:'`
if [ -f /etc/rc.bak ] ; then
stopit "0"
eval echo `gettext ' Removing the $APP_LONG_NAME daemon...'`
cp /etc/rc /etc/rc.bak
sed "s/_BPX_JOBNAME=\'APP_NAME\'.*//g" /etc/rc.bak > /etc/rc
rm /etc/rc.bak
else
eval echo `gettext ' The $APP_LONG_NAME daemon is not currently installed.'`
exit 1
fi
else
eval echo `gettext 'Remove not currently supported for $DIST_OS.'`
exit 1
fi
}
dump() {
eval echo `gettext 'Dumping $APP_LONG_NAME...'`
getpid
if [ "X$pid" = "X" ]
then
eval echo `gettext '$APP_LONG_NAME was not running.'`
else
kill -3 $pid
if [ $? -ne 0 ]
then
eval echo `gettext 'Failed to dump $APP_LONG_NAME.'`
exit 1
else
eval echo `gettext 'Dumped $APP_LONG_NAME.'`
fi
fi
}
# Used by HP-UX init scripts.
startmsg() {
getpid
if [ "X$pid" = "X" ]
then
eval echo `gettext 'Starting $APP_LONG_NAME... Wrapper:Stopped'`
else
if [ "X$DETAIL_STATUS" = "X" ]
then
eval echo `gettext 'Starting $APP_LONG_NAME... Wrapper:Running'`
else
getstatus
eval echo `gettext 'Starting $APP_LONG_NAME... Wrapper:$STATUS, Java:$JAVASTATUS'`
fi
fi
}
# Used by HP-UX init scripts.
stopmsg() {
getpid
if [ "X$pid" = "X" ]
then
eval echo `gettext 'Stopping $APP_LONG_NAME... Wrapper:Stopped'`
else
if [ "X$DETAIL_STATUS" = "X" ]
then
eval echo `gettext 'Stopping $APP_LONG_NAME... Wrapper:Running'`
else
getstatus
eval echo `gettext 'Stopping $APP_LONG_NAME... Wrapper:$STATUS, Java:$JAVASTATUS'`
fi
fi
}
# 'source' files
sourceFiles() {
if [ -n "$FILES_TO_SOURCE" ] ; then
OIFS=$IFS
IFS=';'
files=$FILES_TO_SOURCE
for file in $files
do
. $file
done
IFS=$OIFS
fi
}
# Check if arguments are correct. This needs to be done after knowing the
# command, the application name and OS (to check the installation status).
# NOTE: When the validity of the arguments depends on the daemon installation,
# make sure to call setServiceManagementTool() before this function.
#
# $1 0: no parameter allowed
# -1: parameter allowed if not installed
# 1: parameter allowed
checkArguments() {
# If this is a systemd call (from the systemd service file), we don't want
# to check arguments ('sysd' itself should not be blocking and the user
# may also have edited the file and added additional args in it).
if [ -n "$SYSD" ] ; then
return
fi
if [ -n "$FIRST_ARG" ] ; then
if [ $1 = -1 ] ; then
checkInstalled "strict"
if [ $installedStatus -eq $SERVICE_NOT_INSTALLED ] ; then
PASS_THROUGH_ALLOWED=true
fi
elif [ $1 = 1 ] ; then
PASS_THROUGH_ALLOWED=true
fi
if [ "X${PASS_THROUGH_ALLOWED}" != "Xtrue" ] ; then
eval echo `gettext 'Additional arguments are not allowed with the ${COMMAND} command.'`
if [ -n "$FIXED_COMMAND" ] ; then
# The command can't be used with PASS_THROUGH, so disable it to show appropriate usage.
PASS_THROUGH=false
fi
showUsage
exit 2 # LSB - invalid or excess argument(s)
elif [ "X${PASS_THROUGH}" = "Xfalse" ] ; then
eval echo `gettext 'Additional arguments are not allowed when PASS_THROUGH is set to false.'`
showUsage
exit 2 # LSB - invalid or excess argument(s)
fi
fi
}
docommand() {
case "$COMMAND" in
'console')
checkArguments 1
# trap signals (this must be done before changing the user)
consoleTrapSignals
checkRunUser touchlock "$@"
if [ ! -n "$FIXED_COMMAND" ] ; then
shift
fi
console "$@"
;;
'start')
setServiceManagementTool
checkArguments -1
startdaemon "$@"
;;
'stop')
checkArguments 0
setServiceManagementTool
getServiceControlMethod
if [ "$CTRL_WITH_LAUNCHD" = "true" ] ; then
macosxStop
elif [ "$CTRL_WITH_UPSTART" = "true" ] ; then
upstartStop
elif [ "$CTRL_WITH_SYSTEMD" = "true" ] ; then
systemdStop
elif [ "$CTRL_WITH_SRC" = "true" ] ; then
srcStop
else
checkRunUser "" "$COMMAND"
stopit "0"
fi
;;
'restart')
setServiceManagementTool
checkArguments -1
restartdaemon "0" "$@"
;;
'condrestart')
setServiceManagementTool
checkArguments -1
restartdaemon "1" "$@"
;;
'pause')
checkArguments 0
setServiceManagementTool
if [ -n "$PAUSABLE" ]
then
pause
else
showUsage "$COMMAND"
fi
;;
'resume')
checkArguments 0
setServiceManagementTool
if [ -n "$PAUSABLE" ]
then
resume
else
showUsage "$COMMAND"
fi
;;
'status')
checkArguments 0
setServiceManagementTool
status
;;
'install')
checkArguments 0
setServiceManagementTool
installdaemon "$@"
;;
'installstart')
checkArguments 0
setServiceManagementTool
installdaemon "$@"
startdaemon "$@"
;;
'remove')
checkArguments 0
setServiceManagementTool
removedaemon
;;
'dump')
checkArguments 0
checkRunUser "" "$COMMAND"
dump
;;
'start_msg')
# Internal command called by launchd on HP-UX.
checkRunUser "" "$COMMAND"
startmsg
;;
'stop_msg')
# Internal command called by launchd on HP-UX.
checkRunUser "" "$COMMAND"
stopmsg
;;
'launchdinternal' | 'upstartinternal')
if [ ! "$DIST_OS" = "macosx" -o ! -f "/Library/LaunchDaemons/${APP_PLIST}" ] ; then
checkRunUser touchlock "$@"
fi
# Internal command called by launchd on Max OSX.
# We do not want to call checkRunUser here as it is handled in the launchd plist file. Doing it here would confuse launchd.
if [ ! -n "$FIXED_COMMAND" ] ; then
shift
fi
launchinternal "$@"
;;
*)
showUsage "$COMMAND"
;;
esac
}
sourceFiles
docommand "$@"
exit 0
wrapper_3.5.51_src/src/bin/App.shconf.in 100644 0 0 20376 14333053647 15273 0 ustar 0 0 #! /bin/sh
#
# Copyright (c) 1999, 2022 Tanuki Software, Ltd.
# http://www.tanukisoftware.com
# All rights reserved.
#
# This software is the proprietary information of Tanuki Software.
# You shall use it only in accordance with the terms of the
# license agreement you entered into with Tanuki Software.
# http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
#
# Java Service Wrapper shconf file. Suitable for overriding the default
# settings of the Wrapper Shell Script.
# Optimized for use with version 3.5.51 of the Wrapper.
#
#-----------------------------------------------------------------------------
# Having the customized settings in this file makes it easier to upgrade the
# Shell script which can then be replaced with minimal changes (just its
# 'INIT INFO' section needs to be updated).
# IMPORTANT - Please always stop and uninstall an application before making
# any changes to this file. Failure to do so could remove the
# script's ability to control the application.
# Application name and long name: If these variables are not set (or left to
# the default tokens), APP_NAME will default to the name of the script, then
# APP_LONG_NAME will default to the value of APP_NAME.
APP_NAME="@app.name@"
APP_LONG_NAME="@app.long.name@"
# If uncommented (and set to false), APP_NAME and APP_LONG_NAME will no longer
# be passed to the wrapper. See documentation for details.
#APP_NAME_PASS_TO_WRAPPER=false
# Wrapper
WRAPPER_CMD="./wrapper"
WRAPPER_CONF="../conf/wrapper.conf"
# Priority at which to run the wrapper. See "man nice" for valid priorities.
# nice is only used if a priority is specified.
PRIORITY=
# Location of the pid file.
PIDDIR="."
# PIDFILE_CHECK_PID tells the script to double check whether the pid in the pid
# file actually exists and belongs to this application. When not set, only
# check the pid, but not what it is. This is only needed when multiple
# applications need to share the same pid file.
PIDFILE_CHECK_PID=true
# FIXED_COMMAND tells the script to use a hard coded action rather than
# expecting the first parameter of the command line to be the command.
# By default the command will be expected to be the first parameter.
#FIXED_COMMAND=console
# PASS_THROUGH controls how the script arguments should be passed to the
# Wrapper. Possible values are:
# - commented or 'false': the arguments will be ignored (not passed).
# - 'app_args' or 'true': the arguments will be passed through the Wrapper as
# arguments for the Java Application.
# - 'both': both Wrapper properties and Application arguments can be passed to
# the Wrapper. The Wrapper properties come in first position. The
# user can optionally add a '--' separator followed by application
# arguments.
# NOTE - If FIXED_COMMAND is set to true the above applies to all arguments,
# otherwise it applies to arguments starting with the second.
# NOTE - Passing arguments is only valid with the following commands:
# - 'console'
# - 'start', 'restart', 'condrestart' (if not installed as a daemon)
#PASS_THROUGH=app_args
# If uncommented, causes the Wrapper to be shutdown using an anchor file.
# When launched with the 'start' command, it will also ignore all INT and
# TERM signals.
#IGNORE_SIGNALS=true
# Wrapper will start the JVM asynchronously. Your application may have some
# initialization tasks and it may be desirable to wait a few seconds
# before returning. For example, to delay the invocation of following
# startup scripts. Setting WAIT_AFTER_STARTUP to a positive number will
# cause the start command to delay for the indicated period of time
# (in seconds).
WAIT_AFTER_STARTUP=0
# If set, wait for the wrapper to report that the daemon has started
WAIT_FOR_STARTED_STATUS=true
WAIT_FOR_STARTED_TIMEOUT=120
# If set, the status, start_msg and stop_msg commands will print out detailed
# state information on the Wrapper and Java processes.
#DETAIL_STATUS=true
# If set, the 'pause' and 'resume' commands will be enabled. These make it
# possible to pause the JVM or Java application without completely stopping
# the Wrapper. See the wrapper.pausable and wrapper.pausable.stop_jvm
# properties for more information.
#PAUSABLE=true
# Set the mode used to 'pause' or 'resume' the Wrapper. Possible values are
# 'signals' which uses SIGUSR1 and SIGUSR2, and 'file' which uses the command
# file to communicate these actions. The default value is 'signals'.
# Be aware that depending on the mode, the properties wrapper.signal.mode.usr1,
# wrapper.signal.mode.usr2, or wrapper.commandfile of the configuration file may
# be overriden.
#PAUSABLE_MODE=signals
# If set, the Wrapper will be run as the specified user.
# IMPORTANT - Make sure that the user has the required privileges to write
# the PID file and wrapper.log files. Failure to be able to write the log
# file will cause the Wrapper to exit without any way to write out an error
# message.
# NOTES - This will set the user which is used to run the Wrapper as well as
# the JVM and is not useful in situations where a privileged resource or
# port needs to be allocated prior to the user being changed.
# - Setting this variable will cause stdin to be closed. While this
# should not be a problem when running as Daemon, it would disable ability
# for console applications to receive inputs.
#RUN_AS_USER=
# When RUN_AS_USER is set, the 'runuser' command will be used to substitute the
# user. If not present on the machine, 'su' will be used as a fallback.
# The parameter below lets you specify option(s) for the 'runuser' (or 'su')
# command.
# NOTES - The '-u' option is not allowed. Please set the user with RUN_AS_USER.
# - On GNU/Linux systems, if the user specified by RUN_AS_USER doesn't
# have a default shell please specify one with the '-s' option.
#SU_OPTS="-s /bin/bash"
# By default we show a detailed usage block. Uncomment to show brief usage.
#BRIEF_USAGE=true
# Set which service management tool to use.
# Possible values are:
# for linux...: auto, systemd, upstart, initd
# for aix.....: auto, src, initd
# When set to 'auto', this script file will try to detect in the order of the
# list for each platform which service management tool to use to install the Wrapper.
SERVICE_MANAGEMENT_TOOL=auto
# Specify how the Wrapper daemon and its child processes should be killed
# when using systemd.
# The default is 'control-group' which tells systemd to kill all child
# processes (including detached ones) in the control group of the daemon
# when it stops.
# Alternatively, 'process' can be specified to prevent systemd from
# killing the child processes leaving this responsibility to the Wrapper.
# In this case child processes marked as 'detached' will not be killed on shutdown.
# NOTE - the daemon must be reinstalled for any changes on this property to take effect.
SYSTEMD_KILLMODE=control-group
# When installing on Mac OSX platforms, the following domain will be used to
# prefix the plist file name.
PLIST_DOMAIN=org.tanukisoftware.wrapper
# When installing on Mac OSX platforms, this parameter controls whether the daemon
# is to be kept continuously running or to let demand and conditions control the
# invocation.
MACOSX_KEEP_RUNNING="false"
# The following two lines are used by the chkconfig command. Change as is
# appropriate for your application. They should remain commented.
# chkconfig: 2345 20 80
# description: @app.long.name@
# Set run level to use when installing the application to start and stop on
# system startup and shutdown. It is important that the application always
# be uninstalled before making any changes to the run levels.
# It is also possible to specify different run levels based on the individual
# platform. When doing so this script will look for defined run levels in
# the following order:
# 1) "RUN_LEVEL_S_$DIST_OS" or "RUN_LEVEL_K_$DIST_OS", where "$DIST_OS" is
# the value of DIST_OS. "RUN_LEVEL_S_solaris=20" for example.
# 2) RUN_LEVEL_S or RUN_LEVEL_K, to specify specify start or stop run levels.
# 3) RUN_LEVEL, to specify a general run level.
RUN_LEVEL=20
# List of files to source prior to executing any commands. Use ';' as delimiter.
# For example:
# FILES_TO_SOURCE="/home/user/.bashrc;anotherfile;../file3"
FILES_TO_SOURCE=
wrapper_3.5.51_src/src/bin/AppCommand.bat.in 100644 0 0 26430 14333053647 16055 0 ustar 0 0 @echo off
setlocal
rem
rem Copyright (c) 1999, 2022 Tanuki Software, Ltd.
rem http://www.tanukisoftware.com
rem All rights reserved.
rem
rem This software is the proprietary information of Tanuki Software.
rem You shall use it only in accordance with the terms of the
rem license agreement you entered into with Tanuki Software.
rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
rem
rem Java Service Wrapper command based script.
rem
rem -----------------------------------------------------------------------------
rem These settings can be modified to fit the needs of your application
rem Optimized for use with version 3.5.51 of the Wrapper.
rem The base name for the Wrapper binary.
set _WRAPPER_BASE=wrapper
rem The directory where the Wrapper binary (.exe) file is located. It can be
rem either an absolute or a relative path. If the path contains any special
rem characters, please make sure to quote the variable.
set _WRAPPER_DIR=
rem The name and location of the Wrapper configuration file. This will be used
rem if the user does not specify a configuration file as the first parameter to
rem this script.
set _WRAPPER_CONF="../conf/%_WRAPPER_BASE%.conf"
rem _FIXED_COMMAND tells the script to use a hard coded command rather than
rem expecting the first parameter of the command line to be the command.
rem By default the command will will be expected to be the first parameter.
rem set _FIXED_COMMAND=console
rem _PASS_THROUGH controls how the script arguments should be passed to the
rem Wrapper. Possible values are:
rem - commented or 'false': the arguments will be ignored (not passed).
rem - 'app_args' or 'true': the arguments will be passed through the Wrapper as
rem arguments for the Java Application.
rem - 'both': both Wrapper properties and Application arguments can be passed to
rem the Wrapper. The Wrapper properties come in first position. The
rem user can optionally add a '--' separator followed by application
rem arguments.
rem NOTE - If _FIXED_COMMAND is set to true the above applies to all arguments,
rem otherwise it applies to arguments starting with the second.
rem NOTE - Passing arguments is only valid with the 'console', 'install',
rem 'installstart' and 'update' commands.
set _PASS_THROUGH=app_args
rem If there are any errors, the script will pause for a specific number of seconds
rem or until the user presses a key. (0 not to wait, negative to wait forever).
set _WRAPPER_TIMEOUT=-1
rem Do not modify anything beyond this point
rem -----------------------------------------------------------------------------
if "%OS%"=="Windows_NT" goto nt
echo This script only works with NT-based versions of Windows.
goto :eof
:nt
rem Find the application home.
rem if no path path specified do the default action
IF not DEFINED _WRAPPER_DIR goto dir_undefined
set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%"
if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\"
rem check if absolute path
if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path
if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path
rem everythig else means relative path
set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%"
goto pathfound
:dir_undefined
rem Use a relative path to the wrapper %~dp0 is location of current script under NT
set _REALPATH="%~dp0"
goto pathfound
:absolute_path
rem Use an absolute path to the wrapper
set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%"
:pathfound
rem
rem Decide on the specific Wrapper binary to use (See delta-pack)
rem
if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64
if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64
:x86_32
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe"
set _BIN_BITS="32"
goto search
:amd64
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe"
set _BIN_BITS="64"
goto search
:ia64
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe"
set _BIN_BITS="64"
goto search
:search
set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%"
if exist %_WRAPPER_EXE% goto check_lic_bits
set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe"
if exist %_WRAPPER_EXE% goto conf
if %_BIN_BITS%=="64" goto x86_32
echo Unable to locate a Wrapper executable using any of the following names:
echo %_WRAPPER_L_EXE%
echo %_WRAPPER_EXE%
goto preexitpause
:check_lic_bits
rem The command should not be called inside a IF, else errorlevel would be 0
if not %_BIN_BITS%=="64" goto conf
%_WRAPPER_EXE% --request_delta_binary_bits %_WRAPPER_CONF% > nul 2>&1
if %errorlevel% equ 32 (
set _LIC32_OS64=true
goto x86_32
)
:conf
if [%_PASS_THROUGH%]==[true] (
set _PASS_THROUGH=app_args
)
if [%_PASS_THROUGH%]==[app_args] (
set _PARAMETERS=--
set ARGS_ARE_APP_PARAMS=true
set _PASS_THROUGH_ON=true
)
if [%_PASS_THROUGH%]==[both] (
set _PASS_THROUGH_ON=true
)
if not [%_PASS_THROUGH_ON%]==[true] (
set _PASS_THROUGH=false
)
set _SCRIPT_NAME=%~n0
if not [%_FIXED_COMMAND%]==[] (
set _COMMAND=%_FIXED_COMMAND%
) else (
set _COMMAND=%1
shift
)
rem Check the command
if [%_COMMAND%]==[console] goto args_allowed
if [%_COMMAND%]==[setup] goto args_not_allowed
if [%_COMMAND%]==[teardown] goto args_not_allowed
if [%_COMMAND%]==[start] goto args_not_allowed
if [%_COMMAND%]==[stop] goto args_not_allowed
if [%_COMMAND%]==[install] goto args_allowed
if [%_COMMAND%]==[installstart] goto args_allowed
if [%_COMMAND%]==[pause] goto args_not_allowed
if [%_COMMAND%]==[resume] goto args_not_allowed
if [%_COMMAND%]==[status] goto args_not_allowed
if [%_COMMAND%]==[remove] goto args_not_allowed
if [%_COMMAND%]==[restart] goto args_not_allowed
rem The command is invalid
if [%_FIXED_COMMAND%]==[] (
echo Unexpected command: %_COMMAND%
echo.
goto showusage
) else (
echo Invalid value '%_COMMAND%' for _FIXED_COMMAND.
goto preexitpause
)
:args_not_allowed
if not [%1]==[] (
echo Additional arguments are not allowed with the %_COMMAND% command.
if not [%_FIXED_COMMAND%]==[] (
rem The command can't be used with PASS_THROUGH, so disable it to show appropriate usage.
set _PASS_THROUGH=false
)
goto showusage
)
:args_allowed
if not [%1]==[] (
if [%_PASS_THROUGH%]==[false] (
echo Additional arguments are not allowed when _PASS_THROUGH is set to false.
goto preexitpause
)
)
rem Collect all parameters
:parameters
if [%1]==[] goto callcommand
if [%ARGS_ARE_APP_PARAMS%]==[true] goto append
if [%1]==[--] (
set ARGS_ARE_APP_PARAMS=true
goto append
)
rem So we are appending a wrapper property.
rem 1) Check it is wrapped inside double quotes.
if not ["%~1"]==[%1] (
if not [%_MISSING_QUOTES_REPORTED%]==[true] (
set _MISSING_QUOTES_REPORTED=true
echo WARNING: Any property assignment before '--' should be wrapped inside double quotes on Windows. In a powershell prompt command, double quotes should be escaped with backquote characters ^(^`^).
)
rem If not wrapped inside quotes, the following tests are not relevant, so skip them. Should we stop? We always used to continue.. but the Wrapper will probably fail.
goto append
)
rem 2) Check that the arg matches the pattern of a property (the command should be outside of a IF block for errorlevel to be correct)
echo %1 | findstr ^wrapper\..*\=.*$ > nul 2>&1
if %errorlevel% equ 0 goto append
echo %1 | findstr ^.*\=.*$ > nul 2>&1
if %errorlevel% equ 0 goto unkown_property
rem Not a valid assignment.
echo WARNING: Encountered an invalid configuration property assignment '%~1'. When PASS_THROUGH is set to 'both', any argument before '--' should be in the format '^=^'.
goto append
:unkown_property
rem The property name is not starting with 'wrapper.' so invalid.
rem Extract the property name (this should be outside of a IF-ELSE block)
for /f "tokens=1* delims==" %%a in ("%~1") do set _COMMAND_PROP=%%a
echo WARNING: Encountered an unknown configuration property '%_COMMAND_PROP%'. When PASS_THROUGH is set to 'both', any argument before '--' should target a valid Wrapper configuration property.
:append
set _PARAMETERS=%_PARAMETERS% %1
shift
goto parameters
rem
rem Run the Wrapper
rem
:callcommand
if [%_COMMAND%]==[console] (
%_WRAPPER_EXE% -c "%_WRAPPER_CONF%" %_PARAMETERS%
) else if [%_COMMAND%]==[setup] (
%_WRAPPER_EXE% -su "%_WRAPPER_CONF%"
) else if [%_COMMAND%]==[teardown] (
%_WRAPPER_EXE% -td "%_WRAPPER_CONF%"
) else if [%_COMMAND%]==[start] (
call :start
) else if [%_COMMAND%]==[stop] (
call :stop
) else if [%_COMMAND%]==[install] (
%_WRAPPER_EXE% -i "%_WRAPPER_CONF%" %_PARAMETERS%
) else if [%_COMMAND%]==[installstart] (
%_WRAPPER_EXE% -it "%_WRAPPER_CONF%" %_PARAMETERS%
) else if [%_COMMAND%]==[pause] (
%_WRAPPER_EXE% -a "%_WRAPPER_CONF%"
) else if [%_COMMAND%]==[resume] (
%_WRAPPER_EXE% -e "%_WRAPPER_CONF%"
) else if [%_COMMAND%]==[status] (
%_WRAPPER_EXE% -q "%_WRAPPER_CONF%"
) else if [%_COMMAND%]==[remove] (
%_WRAPPER_EXE% -r "%_WRAPPER_CONF%"
) else if [%_COMMAND%]==[restart] (
call :stop
call :start
)
if not errorlevel 1 goto :eof
goto preexitpause
:start
%_WRAPPER_EXE% -t "%_WRAPPER_CONF%"
goto :eof
:stop
%_WRAPPER_EXE% -p "%_WRAPPER_CONF%"
goto :eof
:showusage
if [%_PASS_THROUGH%]==[app_args] (
set ARGS= {JavaAppArgs}
) else if [%_PASS_THROUGH%]==[both] (
set ARGS= {WrapperProperties} [-- {JavaAppArgs}]
) else (
set ARGS=
)
if [%_FIXED_COMMAND%]==[] (
echo Usage: %_SCRIPT_NAME% [ console%ARGS% : start : stop : restart : pause : resume : status : install%ARGS% : installstart%ARGS% : remove : setup : teardown ]
echo.
echo Commands:
echo console Launch in the current console.
echo start Start the Service.
echo stop Stop the Service.
echo restart Stop the Service if running and then start.
echo pause Pause the Service if running.
echo resume Resume the Service if paused.
echo status Query the current status of the Service.
echo install Install the Service.
echo installstart Install the Service and then start running it.
echo remove Uninstall the Service.
echo setup Setup the Wrapper ^(for registration to the Windows Event Log^).
echo teardown Teardown the Wrapper ^(unregister from the Windows Event Log^).
echo.
) else (
echo Usage: %_SCRIPT_NAME%%ARGS%
)
if not [%_PASS_THROUGH%]==[false] (
if [%_PASS_THROUGH%]==[both] (
echo WrapperProperties:
echo Optional configuration properties which will be passed to the Wrapper.
echo.
)
echo JavaAppArgs:
echo Optional arguments which will be passed to the Java application.
echo.
)
rem Exit when there is a problem
:preexitpause
if %errorlevel% equ 0 (
set EXIT_CODE=1
) else (
set EXIT_CODE=%errorlevel%
)
if %_WRAPPER_TIMEOUT% gtr 0 (
timeout /t %_WRAPPER_TIMEOUT%
) else (
if %_WRAPPER_TIMEOUT% lss 0 (
pause
)
)
EXIT /B %EXIT_CODE%
wrapper_3.5.51_src/src/bin/AppNoWrapper.bat.in 100644 0 0 2032 14333053647 16364 0 ustar 0 0 @echo off
setlocal
rem
rem Copyright (c) 1999, 2022 Tanuki Software, Ltd.
rem http://www.tanukisoftware.com
rem All rights reserved.
rem
rem This software is the proprietary information of Tanuki Software.
rem You shall use it only in accordance with the terms of the
rem license agreement you entered into with Tanuki Software.
rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
rem
rem This script is an example of how to run your application without the Wrapper, but with the
rem Wrapper helper classes. You can obtain the actual command generated by the wrapper for
rem your application by running the Wrapper with the wrapper.java.command.loglevel=INFO
rem property set.
rem
rem The wrapper.key property MUST be removed from the resulting command or it will fail to
rem run correctly.
java -Xms16m -Xmx64m -Djava.library.path="../lib" -Djava.class.path="../lib/wrapper.jar;../lib/wrappertest.jar" -Dwrapper.native_library="wrapper" -Dwrapper.debug="TRUE" org.tanukisoftware.wrapper.test.Main
wrapper_3.5.51_src/src/bin/AppTemplate.bat.in 100644 0 0 11771 14333053647 16254 0 ustar 0 0 @echo off
setlocal
rem
rem Copyright (c) 1999, 2022 Tanuki Software, Ltd.
rem http://www.tanukisoftware.com
rem All rights reserved.
rem
rem This software is the proprietary information of Tanuki Software.
rem You shall use it only in accordance with the terms of the
rem license agreement you entered into with Tanuki Software.
rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
rem
rem @script.description@
rem
rem -----------------------------------------------------------------------------
rem These settings can be modified to fit the needs of your application
rem Optimized for use with version 3.5.51 of the Wrapper.
rem The base name for the Wrapper binary.
set _WRAPPER_BASE=wrapper
rem The directory where the Wrapper binary (.exe) file is located. It can be
rem either an absolute or a relative path. If the path contains any special
rem characters, please make sure to quote the variable.
set _WRAPPER_DIR=
rem The name and location of the Wrapper configuration file. This will be used
rem if the user does not specify a configuration file as the first parameter to
rem this script.
rem If a relative path is specified, please note that the location is based on the
rem location of the Wrapper executable.
set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf"
rem Makes it possible to override the Wrapper configuration file by specifying it
rem as the first parameter.
rem set _WRAPPER_CONF_OVERRIDE=true
rem If there are any errors, the script will pause for a specific number of seconds
rem or until the user presses a key. (0 not to wait, negative to wait forever).
set _WRAPPER_TIMEOUT=-1
rem Note that it is only possible to pass parameters through to the JVM when
rem installing the service, or when running in a console.
rem Do not modify anything beyond this point
rem -----------------------------------------------------------------------------
rem
rem Resolve the real path of the wrapper.exe
rem For non NT systems, the _REALPATH and _WRAPPER_CONF values
rem can be hard-coded below and the following test removed.
rem
if "%OS%"=="Windows_NT" goto nt
echo This script only works with NT-based versions of Windows.
goto :eof
:nt
rem Find the application home.
rem if no path path specified do the default action
IF not DEFINED _WRAPPER_DIR goto dir_undefined
set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%"
if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\"
rem check if absolute path
if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path
if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path
rem everythig else means relative path
set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%"
goto pathfound
:dir_undefined
rem Use a relative path to the wrapper %~dp0 is location of current script under NT
set _REALPATH="%~dp0"
goto pathfound
:absolute_path
rem Use an absolute path to the wrapper
set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%"
:pathfound
rem
rem Decide on the specific Wrapper binary to use (See delta-pack)
rem
if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64
if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64
:x86_32
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe"
set _BIN_BITS="32"
goto search
:amd64
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe"
set _BIN_BITS="64"
goto search
:ia64
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe"
set _BIN_BITS="64"
goto search
:search
set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%"
if exist %_WRAPPER_EXE% goto check_lic_bits
set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe"
if exist %_WRAPPER_EXE% goto conf
if %_BIN_BITS%=="64" goto x86_32
echo Unable to locate a Wrapper executable using any of the following names:
echo %_WRAPPER_L_EXE%
echo %_WRAPPER_EXE%
goto preexitpause
:check_lic_bits
if %_BIN_BITS%=="64" (
set _CHECK_LIC_BITS=true
)
rem
rem Find the wrapper.conf
rem
:conf
if [%_WRAPPER_CONF_OVERRIDE%]==[true] (
set _WRAPPER_CONF="%~f1"
if not [%_WRAPPER_CONF%]==[""] (
shift
goto callcommand
)
)
set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%"
rem The command should not be called inside a IF, else errorlevel would be 0
if not [%_CHECK_LIC_BITS%]==[true] goto callcommand
%_WRAPPER_EXE% --request_delta_binary_bits %_WRAPPER_CONF% > nul 2>&1
if %errorlevel% equ 32 (
set _LIC32_OS64=true
set _CHECK_LIC_BITS=false
goto x86_32
)
rem
rem Run the Wrapper
rem
:callcommand
if not [%1]==[] (
echo Additional arguments are not allowed.
goto preexitpause
)
%_WRAPPER_EXE% @wrapper.command@ %_WRAPPER_CONF%
if not errorlevel 1 goto :eof
rem Exit when there is a problem
:preexitpause
if %errorlevel% equ 0 (
set EXIT_CODE=1
) else (
set EXIT_CODE=%errorlevel%
)
if %_WRAPPER_TIMEOUT% gtr 0 (
timeout /t %_WRAPPER_TIMEOUT%
) else (
if %_WRAPPER_TIMEOUT% lss 0 (
pause
)
)
EXIT /B %EXIT_CODE%
wrapper_3.5.51_src/src/bin/AppTemplatePassThrough.bat.in 100644 0 0 17726 14333053647 20452 0 ustar 0 0 @echo off
setlocal
rem
rem Copyright (c) 1999, 2022 Tanuki Software, Ltd.
rem http://www.tanukisoftware.com
rem All rights reserved.
rem
rem This software is the proprietary information of Tanuki Software.
rem You shall use it only in accordance with the terms of the
rem license agreement you entered into with Tanuki Software.
rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
rem
rem @script.description@
rem
rem -----------------------------------------------------------------------------
rem These settings can be modified to fit the needs of your application
rem Optimized for use with version 3.5.51 of the Wrapper.
rem The base name for the Wrapper binary.
set _WRAPPER_BASE=wrapper
rem The directory where the Wrapper binary (.exe) file is located. It can be
rem either an absolute or a relative path. If the path contains any special
rem characters, please make sure to quote the variable.
set _WRAPPER_DIR=
rem The name and location of the Wrapper configuration file. This will be used
rem if the user does not specify a configuration file as the first parameter to
rem this script.
rem If a relative path is specified, please note that the location is based on the
rem location of the Wrapper executable.
set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf"
rem Makes it possible to override the Wrapper configuration file by specifying it
rem as the first parameter.
rem set _WRAPPER_CONF_OVERRIDE=true
rem _PASS_THROUGH controls how the script arguments should be passed to the
rem Wrapper. Possible values are:
rem - commented or 'false': the arguments will be ignored (not passed).
rem - 'app_args' or 'true': the arguments will be passed through the Wrapper as
rem arguments for the Java Application.
rem - 'both': both Wrapper properties and Application arguments can be passed to
rem the Wrapper. The Wrapper properties come in first position. The
rem user can optionally add a '--' separator followed by application
rem arguments.
rem NOTE - If _WRAPPER_CONF_OVERRIDE is set to true the above applies to arguments
rem starting with the second, otherwise it applies to all arguments.
rem set _PASS_THROUGH=app_args
rem If there are any errors, the script will pause for a specific number of seconds
rem or until the user presses a key. (0 not to wait, negative to wait forever).
set _WRAPPER_TIMEOUT=-1
rem Do not modify anything beyond this point
rem -----------------------------------------------------------------------------
rem
rem Resolve the real path of the wrapper.exe
rem For non NT systems, the _REALPATH and _WRAPPER_CONF values
rem can be hard-coded below and the following test removed.
rem
if "%OS%"=="Windows_NT" goto nt
echo This script only works with NT-based versions of Windows.
goto :eof
:nt
rem Find the application home.
rem if no path path specified do the default action
IF not DEFINED _WRAPPER_DIR goto dir_undefined
set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%"
if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\"
rem check if absolute path
if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path
if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path
rem everythig else means relative path
set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%"
goto pathfound
:dir_undefined
rem Use a relative path to the wrapper %~dp0 is location of current script under NT
set _REALPATH="%~dp0"
goto pathfound
:absolute_path
rem Use an absolute path to the wrapper
set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%"
:pathfound
rem
rem Decide on the specific Wrapper binary to use (See delta-pack)
rem
if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64
if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64
:x86_32
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe"
set _BIN_BITS="32"
goto search
:amd64
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe"
set _BIN_BITS="64"
goto search
:ia64
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe"
set _BIN_BITS="64"
goto search
:search
set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%"
if exist %_WRAPPER_EXE% goto check_lic_bits
set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe"
if exist %_WRAPPER_EXE% goto conf
if %_BIN_BITS%=="64" goto x86_32
echo Unable to locate a Wrapper executable using any of the following names:
echo %_WRAPPER_L_EXE%
echo %_WRAPPER_EXE%
goto preexitpause
:check_lic_bits
if %_BIN_BITS%=="64" (
set _CHECK_LIC_BITS=true
)
rem
rem Find the wrapper.conf
rem
:conf
if [%_WRAPPER_CONF_OVERRIDE%]==[true] (
set _WRAPPER_CONF="%~f1"
if not [%_WRAPPER_CONF%]==[""] (
shift
goto conf
)
)
set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%"
rem The command should not be called inside a IF, else errorlevel would be 0
if not [%_CHECK_LIC_BITS%]==[true] goto conf
%_WRAPPER_EXE% --request_delta_binary_bits %_WRAPPER_CONF% > nul 2>&1
if %errorlevel% equ 32 (
set _LIC32_OS64=true
set _CHECK_LIC_BITS=false
goto x86_32
)
:conf
if [%_PASS_THROUGH%]==[true] (
set _PASS_THROUGH=app_args
)
if [%_PASS_THROUGH%]==[app_args] (
set _PARAMETERS=--
set ARGS_ARE_APP_PARAMS=true
set _PASS_THROUGH_ON=true
)
if [%_PASS_THROUGH%]==[both] (
set _PASS_THROUGH_ON=true
)
if not [%_PASS_THROUGH_ON%]==[true] (
set _PASS_THROUGH=false
)
if not [%1]==[] (
if [%_PASS_THROUGH%]==[false] (
echo Additional arguments are not allowed when _PASS_THROUGH is set to false.
goto preexitpause
)
)
rem Collect all parameters
:parameters
if [%1]==[] goto callcommand
if [%ARGS_ARE_APP_PARAMS%]==[true] goto append
if [%1]==[--] (
set ARGS_ARE_APP_PARAMS=true
goto append
)
rem So we are appending a wrapper property.
rem 1) Check it is wrapped inside double quotes.
if not ["%~1"]==[%1] (
if not [%_MISSING_QUOTES_REPORTED%]==[true] (
set _MISSING_QUOTES_REPORTED=true
echo WARNING: Any property assignment before '--' should be wrapped inside double quotes on Windows. In a powershell prompt command, double quotes should be escaped with backquote characters ^(^`^).
)
rem If not wrapped inside quotes, the following tests are not relevant, so skip them. Should we stop? We always used to continue.. but the Wrapper will probably fail.
goto append
)
rem 2) Check that the arg matches the pattern of a property (the command should be outside of a IF block for errorlevel to be correct)
echo %1 | findstr ^wrapper\..*\=.*$ > nul 2>&1
if %errorlevel% equ 0 goto append
echo %1 | findstr ^.*\=.*$ > nul 2>&1
if %errorlevel% equ 0 goto unkown_property
rem Not a valid assignment.
echo WARNING: Encountered an invalid configuration property assignment '%~1'. When PASS_THROUGH is set to 'both', any argument before '--' should be in the format '^=^'.
goto append
:unkown_property
rem The property name is not starting with 'wrapper.' so invalid.
rem Extract the property name (this should be outside of a IF-ELSE block)
for /f "tokens=1* delims==" %%a in ("%~1") do set _COMMAND_PROP=%%a
echo WARNING: Encountered an unknown configuration property '%_COMMAND_PROP%'. When PASS_THROUGH is set to 'both', any argument before '--' should target a valid Wrapper configuration property.
:append
set _PARAMETERS=%_PARAMETERS% %1
shift
goto parameters
rem
rem Run the Wrapper
rem
:callcommand
if [%_PASS_THROUGH%]==[false] (
%_WRAPPER_EXE% @wrapper.command@ %_WRAPPER_CONF%
) else (
%_WRAPPER_EXE% @wrapper.command@ %_WRAPPER_CONF% %_PARAMETERS%
)
if not errorlevel 1 goto :eof
rem Exit when there is a problem
:preexitpause
if %errorlevel% equ 0 (
set EXIT_CODE=1
) else (
set EXIT_CODE=%errorlevel%
)
if %_WRAPPER_TIMEOUT% gtr 0 (
timeout /t %_WRAPPER_TIMEOUT%
) else (
if %_WRAPPER_TIMEOUT% lss 0 (
pause
)
)
EXIT /B %EXIT_CODE%
wrapper_3.5.51_src/src/bin/InstallApp-NT.bat.in 100644 0 0 17733 14333053647 16432 0 ustar 0 0 @echo off
setlocal
rem
rem Copyright (c) 1999, 2022 Tanuki Software, Ltd.
rem http://www.tanukisoftware.com
rem All rights reserved.
rem
rem This software is the proprietary information of Tanuki Software.
rem You shall use it only in accordance with the terms of the
rem license agreement you entered into with Tanuki Software.
rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
rem
rem Java Service Wrapper script - Install as an NT service.
rem
rem -----------------------------------------------------------------------------
rem These settings can be modified to fit the needs of your application
rem Optimized for use with version 3.5.51 of the Wrapper.
rem The base name for the Wrapper binary.
set _WRAPPER_BASE=wrapper
rem The directory where the Wrapper binary (.exe) file is located. It can be
rem either an absolute or a relative path. If the path contains any special
rem characters, please make sure to quote the variable.
set _WRAPPER_DIR=
rem The name and location of the Wrapper configuration file. This will be used
rem if the user does not specify a configuration file as the first parameter to
rem this script.
rem If a relative path is specified, please note that the location is based on the
rem location of the Wrapper executable.
set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf"
rem Makes it possible to override the Wrapper configuration file by specifying it
rem as the first parameter.
rem set _WRAPPER_CONF_OVERRIDE=true
rem _PASS_THROUGH controls how the script arguments should be passed to the
rem Wrapper. Possible values are:
rem - commented or 'false': the arguments will be ignored (not passed).
rem - 'app_args' or 'true': the arguments will be passed through the Wrapper as
rem arguments for the Java Application.
rem - 'both': both Wrapper properties and Application arguments can be passed to
rem the Wrapper. The Wrapper properties come in first position. The
rem user can optionally add a '--' separator followed by application
rem arguments.
rem NOTE - If _WRAPPER_CONF_OVERRIDE is set to true the above applies to arguments
rem starting with the second, otherwise it applies to all arguments.
rem set _PASS_THROUGH=app_args
rem If there are any errors, the script will pause for a specific number of seconds
rem or until the user presses a key. (0 not to wait, negative to wait forever).
set _WRAPPER_TIMEOUT=-1
rem Do not modify anything beyond this point
rem -----------------------------------------------------------------------------
rem
rem Resolve the real path of the wrapper.exe
rem For non NT systems, the _REALPATH and _WRAPPER_CONF values
rem can be hard-coded below and the following test removed.
rem
if "%OS%"=="Windows_NT" goto nt
echo This script only works with NT-based versions of Windows.
goto :eof
:nt
rem Find the application home.
rem if no path path specified do the default action
IF not DEFINED _WRAPPER_DIR goto dir_undefined
set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%"
if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\"
rem check if absolute path
if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path
if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path
rem everythig else means relative path
set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%"
goto pathfound
:dir_undefined
rem Use a relative path to the wrapper %~dp0 is location of current script under NT
set _REALPATH="%~dp0"
goto pathfound
:absolute_path
rem Use an absolute path to the wrapper
set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%"
:pathfound
rem
rem Decide on the specific Wrapper binary to use (See delta-pack)
rem
if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64
if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64
:x86_32
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe"
set _BIN_BITS="32"
goto search
:amd64
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe"
set _BIN_BITS="64"
goto search
:ia64
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe"
set _BIN_BITS="64"
goto search
:search
set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%"
if exist %_WRAPPER_EXE% goto check_lic_bits
set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe"
if exist %_WRAPPER_EXE% goto conf
if %_BIN_BITS%=="64" goto x86_32
echo Unable to locate a Wrapper executable using any of the following names:
echo %_WRAPPER_L_EXE%
echo %_WRAPPER_EXE%
goto preexitpause
:check_lic_bits
if %_BIN_BITS%=="64" (
set _CHECK_LIC_BITS=true
)
rem
rem Find the wrapper.conf
rem
:conf
if [%_WRAPPER_CONF_OVERRIDE%]==[true] (
set _WRAPPER_CONF="%~f1"
if not [%_WRAPPER_CONF%]==[""] (
shift
goto conf
)
)
set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%"
rem The command should not be called inside a IF, else errorlevel would be 0
if not [%_CHECK_LIC_BITS%]==[true] goto conf
%_WRAPPER_EXE% --request_delta_binary_bits %_WRAPPER_CONF% > nul 2>&1
if %errorlevel% equ 32 (
set _LIC32_OS64=true
set _CHECK_LIC_BITS=false
goto x86_32
)
:conf
if [%_PASS_THROUGH%]==[true] (
set _PASS_THROUGH=app_args
)
if [%_PASS_THROUGH%]==[app_args] (
set _PARAMETERS=--
set ARGS_ARE_APP_PARAMS=true
set _PASS_THROUGH_ON=true
)
if [%_PASS_THROUGH%]==[both] (
set _PASS_THROUGH_ON=true
)
if not [%_PASS_THROUGH_ON%]==[true] (
set _PASS_THROUGH=false
)
if not [%1]==[] (
if [%_PASS_THROUGH%]==[false] (
echo Additional arguments are not allowed when _PASS_THROUGH is set to false.
goto preexitpause
)
)
rem Collect all parameters
:parameters
if [%1]==[] goto callcommand
if [%ARGS_ARE_APP_PARAMS%]==[true] goto append
if [%1]==[--] (
set ARGS_ARE_APP_PARAMS=true
goto append
)
rem So we are appending a wrapper property.
rem 1) Check it is wrapped inside double quotes.
if not ["%~1"]==[%1] (
if not [%_MISSING_QUOTES_REPORTED%]==[true] (
set _MISSING_QUOTES_REPORTED=true
echo WARNING: Any property assignment before '--' should be wrapped inside double quotes on Windows. In a powershell prompt command, double quotes should be escaped with backquote characters ^(^`^).
)
rem If not wrapped inside quotes, the following tests are not relevant, so skip them. Should we stop? We always used to continue.. but the Wrapper will probably fail.
goto append
)
rem 2) Check that the arg matches the pattern of a property (the command should be outside of a IF block for errorlevel to be correct)
echo %1 | findstr ^wrapper\..*\=.*$ > nul 2>&1
if %errorlevel% equ 0 goto append
echo %1 | findstr ^.*\=.*$ > nul 2>&1
if %errorlevel% equ 0 goto unkown_property
rem Not a valid assignment.
echo WARNING: Encountered an invalid configuration property assignment '%~1'. When PASS_THROUGH is set to 'both', any argument before '--' should be in the format '^=^'.
goto append
:unkown_property
rem The property name is not starting with 'wrapper.' so invalid.
rem Extract the property name (this should be outside of a IF-ELSE block)
for /f "tokens=1* delims==" %%a in ("%~1") do set _COMMAND_PROP=%%a
echo WARNING: Encountered an unknown configuration property '%_COMMAND_PROP%'. When PASS_THROUGH is set to 'both', any argument before '--' should target a valid Wrapper configuration property.
:append
set _PARAMETERS=%_PARAMETERS% %1
shift
goto parameters
rem
rem Run the Wrapper
rem
:callcommand
if [%_PASS_THROUGH%]==[false] (
%_WRAPPER_EXE% -i %_WRAPPER_CONF%
) else (
%_WRAPPER_EXE% -i %_WRAPPER_CONF% %_PARAMETERS%
)
if not errorlevel 1 goto :eof
rem Exit when there is a problem
:preexitpause
if %errorlevel% equ 0 (
set EXIT_CODE=1
) else (
set EXIT_CODE=%errorlevel%
)
if %_WRAPPER_TIMEOUT% gtr 0 (
timeout /t %_WRAPPER_TIMEOUT%
) else (
if %_WRAPPER_TIMEOUT% lss 0 (
pause
)
)
EXIT /B %EXIT_CODE%
wrapper_3.5.51_src/src/bin/PauseApp-NT.bat.in 100644 0 0 12017 14333053647 16067 0 ustar 0 0 @echo off
setlocal
rem
rem Copyright (c) 1999, 2022 Tanuki Software, Ltd.
rem http://www.tanukisoftware.com
rem All rights reserved.
rem
rem This software is the proprietary information of Tanuki Software.
rem You shall use it only in accordance with the terms of the
rem license agreement you entered into with Tanuki Software.
rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
rem
rem Java Service Wrapper script - Pause a running NT service.
rem
rem -----------------------------------------------------------------------------
rem These settings can be modified to fit the needs of your application
rem Optimized for use with version 3.5.51 of the Wrapper.
rem The base name for the Wrapper binary.
set _WRAPPER_BASE=wrapper
rem The directory where the Wrapper binary (.exe) file is located. It can be
rem either an absolute or a relative path. If the path contains any special
rem characters, please make sure to quote the variable.
set _WRAPPER_DIR=
rem The name and location of the Wrapper configuration file. This will be used
rem if the user does not specify a configuration file as the first parameter to
rem this script.
rem If a relative path is specified, please note that the location is based on the
rem location of the Wrapper executable.
set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf"
rem Makes it possible to override the Wrapper configuration file by specifying it
rem as the first parameter.
rem set _WRAPPER_CONF_OVERRIDE=true
rem If there are any errors, the script will pause for a specific number of seconds
rem or until the user presses a key. (0 not to wait, negative to wait forever).
set _WRAPPER_TIMEOUT=-1
rem Note that it is only possible to pass parameters through to the JVM when
rem installing the service, or when running in a console.
rem Do not modify anything beyond this point
rem -----------------------------------------------------------------------------
rem
rem Resolve the real path of the wrapper.exe
rem For non NT systems, the _REALPATH and _WRAPPER_CONF values
rem can be hard-coded below and the following test removed.
rem
if "%OS%"=="Windows_NT" goto nt
echo This script only works with NT-based versions of Windows.
goto :eof
:nt
rem Find the application home.
rem if no path path specified do the default action
IF not DEFINED _WRAPPER_DIR goto dir_undefined
set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%"
if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\"
rem check if absolute path
if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path
if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path
rem everythig else means relative path
set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%"
goto pathfound
:dir_undefined
rem Use a relative path to the wrapper %~dp0 is location of current script under NT
set _REALPATH="%~dp0"
goto pathfound
:absolute_path
rem Use an absolute path to the wrapper
set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%"
:pathfound
rem
rem Decide on the specific Wrapper binary to use (See delta-pack)
rem
if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64
if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64
:x86_32
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe"
set _BIN_BITS="32"
goto search
:amd64
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe"
set _BIN_BITS="64"
goto search
:ia64
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe"
set _BIN_BITS="64"
goto search
:search
set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%"
if exist %_WRAPPER_EXE% goto check_lic_bits
set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe"
if exist %_WRAPPER_EXE% goto conf
if %_BIN_BITS%=="64" goto x86_32
echo Unable to locate a Wrapper executable using any of the following names:
echo %_WRAPPER_L_EXE%
echo %_WRAPPER_EXE%
goto preexitpause
:check_lic_bits
if %_BIN_BITS%=="64" (
set _CHECK_LIC_BITS=true
)
rem
rem Find the wrapper.conf
rem
:conf
if [%_WRAPPER_CONF_OVERRIDE%]==[true] (
set _WRAPPER_CONF="%~f1"
if not [%_WRAPPER_CONF%]==[""] (
shift
goto callcommand
)
)
set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%"
rem The command should not be called inside a IF, else errorlevel would be 0
if not [%_CHECK_LIC_BITS%]==[true] goto callcommand
%_WRAPPER_EXE% --request_delta_binary_bits %_WRAPPER_CONF% > nul 2>&1
if %errorlevel% equ 32 (
set _LIC32_OS64=true
set _CHECK_LIC_BITS=false
goto x86_32
)
rem
rem Run the Wrapper
rem
:callcommand
if not [%1]==[] (
echo Additional arguments are not allowed.
goto preexitpause
)
%_WRAPPER_EXE% -a %_WRAPPER_CONF%
if not errorlevel 1 goto :eof
rem Exit when there is a problem
:preexitpause
if %errorlevel% equ 0 (
set EXIT_CODE=1
) else (
set EXIT_CODE=%errorlevel%
)
if %_WRAPPER_TIMEOUT% gtr 0 (
timeout /t %_WRAPPER_TIMEOUT%
) else (
if %_WRAPPER_TIMEOUT% lss 0 (
pause
)
)
EXIT /B %EXIT_CODE%
wrapper_3.5.51_src/src/bin/QueryApp-NT.bat.in 100644 0 0 12032 14333053647 16114 0 ustar 0 0 @echo off
setlocal
rem
rem Copyright (c) 1999, 2022 Tanuki Software, Ltd.
rem http://www.tanukisoftware.com
rem All rights reserved.
rem
rem This software is the proprietary information of Tanuki Software.
rem You shall use it only in accordance with the terms of the
rem license agreement you entered into with Tanuki Software.
rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
rem
rem Java Service Wrapper script - Query the current status of a service.
rem
rem -----------------------------------------------------------------------------
rem These settings can be modified to fit the needs of your application
rem Optimized for use with version 3.5.51 of the Wrapper.
rem The base name for the Wrapper binary.
set _WRAPPER_BASE=wrapper
rem The directory where the Wrapper binary (.exe) file is located. It can be
rem either an absolute or a relative path. If the path contains any special
rem characters, please make sure to quote the variable.
set _WRAPPER_DIR=
rem The name and location of the Wrapper configuration file. This will be used
rem if the user does not specify a configuration file as the first parameter to
rem this script.
rem If a relative path is specified, please note that the location is based on the
rem location of the Wrapper executable.
set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf"
rem Makes it possible to override the Wrapper configuration file by specifying it
rem as the first parameter.
rem set _WRAPPER_CONF_OVERRIDE=true
rem If there are any errors, the script will pause for a specific number of seconds
rem or until the user presses a key. (0 not to wait, negative to wait forever).
set _WRAPPER_TIMEOUT=-1
rem Note that it is only possible to pass parameters through to the JVM when
rem installing the service, or when running in a console.
rem Do not modify anything beyond this point
rem -----------------------------------------------------------------------------
rem
rem Resolve the real path of the wrapper.exe
rem For non NT systems, the _REALPATH and _WRAPPER_CONF values
rem can be hard-coded below and the following test removed.
rem
if "%OS%"=="Windows_NT" goto nt
echo This script only works with NT-based versions of Windows.
goto :eof
:nt
rem Find the application home.
rem if no path path specified do the default action
IF not DEFINED _WRAPPER_DIR goto dir_undefined
set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%"
if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\"
rem check if absolute path
if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path
if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path
rem everythig else means relative path
set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%"
goto pathfound
:dir_undefined
rem Use a relative path to the wrapper %~dp0 is location of current script under NT
set _REALPATH="%~dp0"
goto pathfound
:absolute_path
rem Use an absolute path to the wrapper
set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%"
:pathfound
rem
rem Decide on the specific Wrapper binary to use (See delta-pack)
rem
if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64
if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64
:x86_32
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe"
set _BIN_BITS="32"
goto search
:amd64
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe"
set _BIN_BITS="64"
goto search
:ia64
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe"
set _BIN_BITS="64"
goto search
:search
set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%"
if exist %_WRAPPER_EXE% goto check_lic_bits
set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe"
if exist %_WRAPPER_EXE% goto conf
if %_BIN_BITS%=="64" goto x86_32
echo Unable to locate a Wrapper executable using any of the following names:
echo %_WRAPPER_L_EXE%
echo %_WRAPPER_EXE%
goto preexitpause
:check_lic_bits
if %_BIN_BITS%=="64" (
set _CHECK_LIC_BITS=true
)
rem
rem Find the wrapper.conf
rem
:conf
if [%_WRAPPER_CONF_OVERRIDE%]==[true] (
set _WRAPPER_CONF="%~f1"
if not [%_WRAPPER_CONF%]==[""] (
shift
goto callcommand
)
)
set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%"
rem The command should not be called inside a IF, else errorlevel would be 0
if not [%_CHECK_LIC_BITS%]==[true] goto callcommand
%_WRAPPER_EXE% --request_delta_binary_bits %_WRAPPER_CONF% > nul 2>&1
if %errorlevel% equ 32 (
set _LIC32_OS64=true
set _CHECK_LIC_BITS=false
goto x86_32
)
rem
rem Run the Wrapper
rem
:callcommand
if not [%1]==[] (
echo Additional arguments are not allowed.
goto preexitpause
)
%_WRAPPER_EXE% -q %_WRAPPER_CONF%
if not errorlevel 1 goto :eof
rem Exit when there is a problem
:preexitpause
if %errorlevel% equ 0 (
set EXIT_CODE=1
) else (
set EXIT_CODE=%errorlevel%
)
if %_WRAPPER_TIMEOUT% gtr 0 (
timeout /t %_WRAPPER_TIMEOUT%
) else (
if %_WRAPPER_TIMEOUT% lss 0 (
pause
)
)
EXIT /B %EXIT_CODE%
wrapper_3.5.51_src/src/bin/README.txt 100644 0 0 3047 14333053650 14410 0 ustar 0 0 -----------------------------------------------------------------------------
Java Service Wrapper Community Edition 3.5.51
Copyright (C) 1999-2022 Tanuki Software, Ltd. All Rights Reserved.
https://wrapper.tanukisoftware.com
-----------------------------------------------------------------------------
Depending on the security policy of your Windows installation, a popup window
titled "Windows protected your PC" may appear when trying to execute the batch
files located in the bin folder. The Wrapper binaries have been signed to
verify that they are unmodified as published by Tanuki Software. But batch
files by nature can't be signed in the same way.
The batch files are provided to ease launching the Wrapper binaries, and it is
perfectly safe to execute them if they were acquired from the official
links on the Tanuki Software Wrapper website or SourceForge.
Here is a simple workaround:
1. Right click on the bat file you want to execute and open the Properties
window from the contextual menu.
2. At the bottom of the "General" tab, you should see a "Security" section
with a "Unblock" checkbox or button. Click on the button or check the box.
3. Click OK.
4. You should now be able to execute the BAT file without warning.
It is also possible to do the same on the downloaded zip file before extracting
it. All of the extracted files will maintain the unblocked status.
For further explanation regarding this issue, please refer to the following
page of our website:
https://wrapper.tanukisoftware.com/doc/english/howto-windows-install.html#zip
wrapper_3.5.51_src/src/bin/ResumeApp-NT.bat.in 100644 0 0 12017 14333053647 16252 0 ustar 0 0 @echo off
setlocal
rem
rem Copyright (c) 1999, 2022 Tanuki Software, Ltd.
rem http://www.tanukisoftware.com
rem All rights reserved.
rem
rem This software is the proprietary information of Tanuki Software.
rem You shall use it only in accordance with the terms of the
rem license agreement you entered into with Tanuki Software.
rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
rem
rem Java Service Wrapper script - Resume a paused NT service.
rem
rem -----------------------------------------------------------------------------
rem These settings can be modified to fit the needs of your application
rem Optimized for use with version 3.5.51 of the Wrapper.
rem The base name for the Wrapper binary.
set _WRAPPER_BASE=wrapper
rem The directory where the Wrapper binary (.exe) file is located. It can be
rem either an absolute or a relative path. If the path contains any special
rem characters, please make sure to quote the variable.
set _WRAPPER_DIR=
rem The name and location of the Wrapper configuration file. This will be used
rem if the user does not specify a configuration file as the first parameter to
rem this script.
rem If a relative path is specified, please note that the location is based on the
rem location of the Wrapper executable.
set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf"
rem Makes it possible to override the Wrapper configuration file by specifying it
rem as the first parameter.
rem set _WRAPPER_CONF_OVERRIDE=true
rem If there are any errors, the script will pause for a specific number of seconds
rem or until the user presses a key. (0 not to wait, negative to wait forever).
set _WRAPPER_TIMEOUT=-1
rem Note that it is only possible to pass parameters through to the JVM when
rem installing the service, or when running in a console.
rem Do not modify anything beyond this point
rem -----------------------------------------------------------------------------
rem
rem Resolve the real path of the wrapper.exe
rem For non NT systems, the _REALPATH and _WRAPPER_CONF values
rem can be hard-coded below and the following test removed.
rem
if "%OS%"=="Windows_NT" goto nt
echo This script only works with NT-based versions of Windows.
goto :eof
:nt
rem Find the application home.
rem if no path path specified do the default action
IF not DEFINED _WRAPPER_DIR goto dir_undefined
set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%"
if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\"
rem check if absolute path
if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path
if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path
rem everythig else means relative path
set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%"
goto pathfound
:dir_undefined
rem Use a relative path to the wrapper %~dp0 is location of current script under NT
set _REALPATH="%~dp0"
goto pathfound
:absolute_path
rem Use an absolute path to the wrapper
set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%"
:pathfound
rem
rem Decide on the specific Wrapper binary to use (See delta-pack)
rem
if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64
if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64
:x86_32
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe"
set _BIN_BITS="32"
goto search
:amd64
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe"
set _BIN_BITS="64"
goto search
:ia64
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe"
set _BIN_BITS="64"
goto search
:search
set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%"
if exist %_WRAPPER_EXE% goto check_lic_bits
set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe"
if exist %_WRAPPER_EXE% goto conf
if %_BIN_BITS%=="64" goto x86_32
echo Unable to locate a Wrapper executable using any of the following names:
echo %_WRAPPER_L_EXE%
echo %_WRAPPER_EXE%
goto preexitpause
:check_lic_bits
if %_BIN_BITS%=="64" (
set _CHECK_LIC_BITS=true
)
rem
rem Find the wrapper.conf
rem
:conf
if [%_WRAPPER_CONF_OVERRIDE%]==[true] (
set _WRAPPER_CONF="%~f1"
if not [%_WRAPPER_CONF%]==[""] (
shift
goto callcommand
)
)
set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%"
rem The command should not be called inside a IF, else errorlevel would be 0
if not [%_CHECK_LIC_BITS%]==[true] goto callcommand
%_WRAPPER_EXE% --request_delta_binary_bits %_WRAPPER_CONF% > nul 2>&1
if %errorlevel% equ 32 (
set _LIC32_OS64=true
set _CHECK_LIC_BITS=false
goto x86_32
)
rem
rem Run the Wrapper
rem
:callcommand
if not [%1]==[] (
echo Additional arguments are not allowed.
goto preexitpause
)
%_WRAPPER_EXE% -e %_WRAPPER_CONF%
if not errorlevel 1 goto :eof
rem Exit when there is a problem
:preexitpause
if %errorlevel% equ 0 (
set EXIT_CODE=1
) else (
set EXIT_CODE=%errorlevel%
)
if %_WRAPPER_TIMEOUT% gtr 0 (
timeout /t %_WRAPPER_TIMEOUT%
) else (
if %_WRAPPER_TIMEOUT% lss 0 (
pause
)
)
EXIT /B %EXIT_CODE%
wrapper_3.5.51_src/src/bin/SetupApp.bat.in 100644 0 0 11771 14333053647 15601 0 ustar 0 0 @echo off
setlocal
rem
rem Copyright (c) 1999, 2022 Tanuki Software, Ltd.
rem http://www.tanukisoftware.com
rem All rights reserved.
rem
rem This software is the proprietary information of Tanuki Software.
rem You shall use it only in accordance with the terms of the
rem license agreement you entered into with Tanuki Software.
rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
rem
rem Java Service Wrapper setup script.
rem
rem -----------------------------------------------------------------------------
rem These settings can be modified to fit the needs of your application
rem Optimized for use with version 3.5.51 of the Wrapper.
rem The base name for the Wrapper binary.
set _WRAPPER_BASE=wrapper
rem The directory where the Wrapper binary (.exe) file is located. It can be
rem either an absolute or a relative path. If the path contains any special
rem characters, please make sure to quote the variable.
set _WRAPPER_DIR=
rem The name and location of the Wrapper configuration file. This will be used
rem if the user does not specify a configuration file as the first parameter to
rem this script.
rem If a relative path is specified, please note that the location is based on the
rem location of the Wrapper executable.
set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf"
rem Makes it possible to override the Wrapper configuration file by specifying it
rem as the first parameter.
rem set _WRAPPER_CONF_OVERRIDE=true
rem If there are any errors, the script will pause for a specific number of seconds
rem or until the user presses a key. (0 not to wait, negative to wait forever).
set _WRAPPER_TIMEOUT=-1
rem Note that it is only possible to pass parameters through to the JVM when
rem installing the service, or when running in a console.
rem Do not modify anything beyond this point
rem -----------------------------------------------------------------------------
rem
rem Resolve the real path of the wrapper.exe
rem For non NT systems, the _REALPATH and _WRAPPER_CONF values
rem can be hard-coded below and the following test removed.
rem
if "%OS%"=="Windows_NT" goto nt
echo This script only works with NT-based versions of Windows.
goto :eof
:nt
rem Find the application home.
rem if no path path specified do the default action
IF not DEFINED _WRAPPER_DIR goto dir_undefined
set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%"
if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\"
rem check if absolute path
if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path
if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path
rem everythig else means relative path
set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%"
goto pathfound
:dir_undefined
rem Use a relative path to the wrapper %~dp0 is location of current script under NT
set _REALPATH="%~dp0"
goto pathfound
:absolute_path
rem Use an absolute path to the wrapper
set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%"
:pathfound
rem
rem Decide on the specific Wrapper binary to use (See delta-pack)
rem
if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64
if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64
:x86_32
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe"
set _BIN_BITS="32"
goto search
:amd64
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe"
set _BIN_BITS="64"
goto search
:ia64
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe"
set _BIN_BITS="64"
goto search
:search
set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%"
if exist %_WRAPPER_EXE% goto check_lic_bits
set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe"
if exist %_WRAPPER_EXE% goto conf
if %_BIN_BITS%=="64" goto x86_32
echo Unable to locate a Wrapper executable using any of the following names:
echo %_WRAPPER_L_EXE%
echo %_WRAPPER_EXE%
goto preexitpause
:check_lic_bits
if %_BIN_BITS%=="64" (
set _CHECK_LIC_BITS=true
)
rem
rem Find the wrapper.conf
rem
:conf
if [%_WRAPPER_CONF_OVERRIDE%]==[true] (
set _WRAPPER_CONF="%~f1"
if not [%_WRAPPER_CONF%]==[""] (
shift
goto callcommand
)
)
set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%"
rem The command should not be called inside a IF, else errorlevel would be 0
if not [%_CHECK_LIC_BITS%]==[true] goto callcommand
%_WRAPPER_EXE% --request_delta_binary_bits %_WRAPPER_CONF% > nul 2>&1
if %errorlevel% equ 32 (
set _LIC32_OS64=true
set _CHECK_LIC_BITS=false
goto x86_32
)
rem
rem Run the Wrapper
rem
:callcommand
if not [%1]==[] (
echo Additional arguments are not allowed.
goto preexitpause
)
%_WRAPPER_EXE% -su %_WRAPPER_CONF%
if not errorlevel 1 goto :eof
rem Exit when there is a problem
:preexitpause
if %errorlevel% equ 0 (
set EXIT_CODE=1
) else (
set EXIT_CODE=%errorlevel%
)
if %_WRAPPER_TIMEOUT% gtr 0 (
timeout /t %_WRAPPER_TIMEOUT%
) else (
if %_WRAPPER_TIMEOUT% lss 0 (
pause
)
)
EXIT /B %EXIT_CODE%
wrapper_3.5.51_src/src/bin/StartApp-NT.bat.in 100644 0 0 12013 14333053647 16103 0 ustar 0 0 @echo off
setlocal
rem
rem Copyright (c) 1999, 2022 Tanuki Software, Ltd.
rem http://www.tanukisoftware.com
rem All rights reserved.
rem
rem This software is the proprietary information of Tanuki Software.
rem You shall use it only in accordance with the terms of the
rem license agreement you entered into with Tanuki Software.
rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
rem
rem Java Service Wrapper script - Start as an NT service.
rem
rem -----------------------------------------------------------------------------
rem These settings can be modified to fit the needs of your application
rem Optimized for use with version 3.5.51 of the Wrapper.
rem The base name for the Wrapper binary.
set _WRAPPER_BASE=wrapper
rem The directory where the Wrapper binary (.exe) file is located. It can be
rem either an absolute or a relative path. If the path contains any special
rem characters, please make sure to quote the variable.
set _WRAPPER_DIR=
rem The name and location of the Wrapper configuration file. This will be used
rem if the user does not specify a configuration file as the first parameter to
rem this script.
rem If a relative path is specified, please note that the location is based on the
rem location of the Wrapper executable.
set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf"
rem Makes it possible to override the Wrapper configuration file by specifying it
rem as the first parameter.
rem set _WRAPPER_CONF_OVERRIDE=true
rem If there are any errors, the script will pause for a specific number of seconds
rem or until the user presses a key. (0 not to wait, negative to wait forever).
set _WRAPPER_TIMEOUT=-1
rem Note that it is only possible to pass parameters through to the JVM when
rem installing the service, or when running in a console.
rem Do not modify anything beyond this point
rem -----------------------------------------------------------------------------
rem
rem Resolve the real path of the wrapper.exe
rem For non NT systems, the _REALPATH and _WRAPPER_CONF values
rem can be hard-coded below and the following test removed.
rem
if "%OS%"=="Windows_NT" goto nt
echo This script only works with NT-based versions of Windows.
goto :eof
:nt
rem Find the application home.
rem if no path path specified do the default action
IF not DEFINED _WRAPPER_DIR goto dir_undefined
set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%"
if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\"
rem check if absolute path
if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path
if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path
rem everythig else means relative path
set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%"
goto pathfound
:dir_undefined
rem Use a relative path to the wrapper %~dp0 is location of current script under NT
set _REALPATH="%~dp0"
goto pathfound
:absolute_path
rem Use an absolute path to the wrapper
set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%"
:pathfound
rem
rem Decide on the specific Wrapper binary to use (See delta-pack)
rem
if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64
if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64
:x86_32
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe"
set _BIN_BITS="32"
goto search
:amd64
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe"
set _BIN_BITS="64"
goto search
:ia64
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe"
set _BIN_BITS="64"
goto search
:search
set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%"
if exist %_WRAPPER_EXE% goto check_lic_bits
set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe"
if exist %_WRAPPER_EXE% goto conf
if %_BIN_BITS%=="64" goto x86_32
echo Unable to locate a Wrapper executable using any of the following names:
echo %_WRAPPER_L_EXE%
echo %_WRAPPER_EXE%
goto preexitpause
:check_lic_bits
if %_BIN_BITS%=="64" (
set _CHECK_LIC_BITS=true
)
rem
rem Find the wrapper.conf
rem
:conf
if [%_WRAPPER_CONF_OVERRIDE%]==[true] (
set _WRAPPER_CONF="%~f1"
if not [%_WRAPPER_CONF%]==[""] (
shift
goto callcommand
)
)
set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%"
rem The command should not be called inside a IF, else errorlevel would be 0
if not [%_CHECK_LIC_BITS%]==[true] goto callcommand
%_WRAPPER_EXE% --request_delta_binary_bits %_WRAPPER_CONF% > nul 2>&1
if %errorlevel% equ 32 (
set _LIC32_OS64=true
set _CHECK_LIC_BITS=false
goto x86_32
)
rem
rem Run the Wrapper
rem
:callcommand
if not [%1]==[] (
echo Additional arguments are not allowed.
goto preexitpause
)
%_WRAPPER_EXE% -t %_WRAPPER_CONF%
if not errorlevel 1 goto :eof
rem Exit when there is a problem
:preexitpause
if %errorlevel% equ 0 (
set EXIT_CODE=1
) else (
set EXIT_CODE=%errorlevel%
)
if %_WRAPPER_TIMEOUT% gtr 0 (
timeout /t %_WRAPPER_TIMEOUT%
) else (
if %_WRAPPER_TIMEOUT% lss 0 (
pause
)
)
EXIT /B %EXIT_CODE%
wrapper_3.5.51_src/src/bin/StopApp-NT.bat.in 100644 0 0 12016 14333053647 15736 0 ustar 0 0 @echo off
setlocal
rem
rem Copyright (c) 1999, 2022 Tanuki Software, Ltd.
rem http://www.tanukisoftware.com
rem All rights reserved.
rem
rem This software is the proprietary information of Tanuki Software.
rem You shall use it only in accordance with the terms of the
rem license agreement you entered into with Tanuki Software.
rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
rem
rem Java Service Wrapper script - Stop a started NT service.
rem
rem -----------------------------------------------------------------------------
rem These settings can be modified to fit the needs of your application
rem Optimized for use with version 3.5.51 of the Wrapper.
rem The base name for the Wrapper binary.
set _WRAPPER_BASE=wrapper
rem The directory where the Wrapper binary (.exe) file is located. It can be
rem either an absolute or a relative path. If the path contains any special
rem characters, please make sure to quote the variable.
set _WRAPPER_DIR=
rem The name and location of the Wrapper configuration file. This will be used
rem if the user does not specify a configuration file as the first parameter to
rem this script.
rem If a relative path is specified, please note that the location is based on the
rem location of the Wrapper executable.
set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf"
rem Makes it possible to override the Wrapper configuration file by specifying it
rem as the first parameter.
rem set _WRAPPER_CONF_OVERRIDE=true
rem If there are any errors, the script will pause for a specific number of seconds
rem or until the user presses a key. (0 not to wait, negative to wait forever).
set _WRAPPER_TIMEOUT=-1
rem Note that it is only possible to pass parameters through to the JVM when
rem installing the service, or when running in a console.
rem Do not modify anything beyond this point
rem -----------------------------------------------------------------------------
rem
rem Resolve the real path of the wrapper.exe
rem For non NT systems, the _REALPATH and _WRAPPER_CONF values
rem can be hard-coded below and the following test removed.
rem
if "%OS%"=="Windows_NT" goto nt
echo This script only works with NT-based versions of Windows.
goto :eof
:nt
rem Find the application home.
rem if no path path specified do the default action
IF not DEFINED _WRAPPER_DIR goto dir_undefined
set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%"
if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\"
rem check if absolute path
if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path
if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path
rem everythig else means relative path
set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%"
goto pathfound
:dir_undefined
rem Use a relative path to the wrapper %~dp0 is location of current script under NT
set _REALPATH="%~dp0"
goto pathfound
:absolute_path
rem Use an absolute path to the wrapper
set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%"
:pathfound
rem
rem Decide on the specific Wrapper binary to use (See delta-pack)
rem
if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64
if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64
:x86_32
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe"
set _BIN_BITS="32"
goto search
:amd64
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe"
set _BIN_BITS="64"
goto search
:ia64
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe"
set _BIN_BITS="64"
goto search
:search
set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%"
if exist %_WRAPPER_EXE% goto check_lic_bits
set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe"
if exist %_WRAPPER_EXE% goto conf
if %_BIN_BITS%=="64" goto x86_32
echo Unable to locate a Wrapper executable using any of the following names:
echo %_WRAPPER_L_EXE%
echo %_WRAPPER_EXE%
goto preexitpause
:check_lic_bits
if %_BIN_BITS%=="64" (
set _CHECK_LIC_BITS=true
)
rem
rem Find the wrapper.conf
rem
:conf
if [%_WRAPPER_CONF_OVERRIDE%]==[true] (
set _WRAPPER_CONF="%~f1"
if not [%_WRAPPER_CONF%]==[""] (
shift
goto callcommand
)
)
set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%"
rem The command should not be called inside a IF, else errorlevel would be 0
if not [%_CHECK_LIC_BITS%]==[true] goto callcommand
%_WRAPPER_EXE% --request_delta_binary_bits %_WRAPPER_CONF% > nul 2>&1
if %errorlevel% equ 32 (
set _LIC32_OS64=true
set _CHECK_LIC_BITS=false
goto x86_32
)
rem
rem Run the Wrapper
rem
:callcommand
if not [%1]==[] (
echo Additional arguments are not allowed.
goto preexitpause
)
%_WRAPPER_EXE% -p %_WRAPPER_CONF%
if not errorlevel 1 goto :eof
rem Exit when there is a problem
:preexitpause
if %errorlevel% equ 0 (
set EXIT_CODE=1
) else (
set EXIT_CODE=%errorlevel%
)
if %_WRAPPER_TIMEOUT% gtr 0 (
timeout /t %_WRAPPER_TIMEOUT%
) else (
if %_WRAPPER_TIMEOUT% lss 0 (
pause
)
)
EXIT /B %EXIT_CODE%
wrapper_3.5.51_src/src/bin/TeardownApp.bat.in 100644 0 0 11774 14333053647 16267 0 ustar 0 0 @echo off
setlocal
rem
rem Copyright (c) 1999, 2022 Tanuki Software, Ltd.
rem http://www.tanukisoftware.com
rem All rights reserved.
rem
rem This software is the proprietary information of Tanuki Software.
rem You shall use it only in accordance with the terms of the
rem license agreement you entered into with Tanuki Software.
rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
rem
rem Java Service Wrapper teardown script.
rem
rem -----------------------------------------------------------------------------
rem These settings can be modified to fit the needs of your application
rem Optimized for use with version 3.5.51 of the Wrapper.
rem The base name for the Wrapper binary.
set _WRAPPER_BASE=wrapper
rem The directory where the Wrapper binary (.exe) file is located. It can be
rem either an absolute or a relative path. If the path contains any special
rem characters, please make sure to quote the variable.
set _WRAPPER_DIR=
rem The name and location of the Wrapper configuration file. This will be used
rem if the user does not specify a configuration file as the first parameter to
rem this script.
rem If a relative path is specified, please note that the location is based on the
rem location of the Wrapper executable.
set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf"
rem Makes it possible to override the Wrapper configuration file by specifying it
rem as the first parameter.
rem set _WRAPPER_CONF_OVERRIDE=true
rem If there are any errors, the script will pause for a specific number of seconds
rem or until the user presses a key. (0 not to wait, negative to wait forever).
set _WRAPPER_TIMEOUT=-1
rem Note that it is only possible to pass parameters through to the JVM when
rem installing the service, or when running in a console.
rem Do not modify anything beyond this point
rem -----------------------------------------------------------------------------
rem
rem Resolve the real path of the wrapper.exe
rem For non NT systems, the _REALPATH and _WRAPPER_CONF values
rem can be hard-coded below and the following test removed.
rem
if "%OS%"=="Windows_NT" goto nt
echo This script only works with NT-based versions of Windows.
goto :eof
:nt
rem Find the application home.
rem if no path path specified do the default action
IF not DEFINED _WRAPPER_DIR goto dir_undefined
set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%"
if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\"
rem check if absolute path
if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path
if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path
rem everythig else means relative path
set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%"
goto pathfound
:dir_undefined
rem Use a relative path to the wrapper %~dp0 is location of current script under NT
set _REALPATH="%~dp0"
goto pathfound
:absolute_path
rem Use an absolute path to the wrapper
set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%"
:pathfound
rem
rem Decide on the specific Wrapper binary to use (See delta-pack)
rem
if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64
if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64
:x86_32
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe"
set _BIN_BITS="32"
goto search
:amd64
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe"
set _BIN_BITS="64"
goto search
:ia64
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe"
set _BIN_BITS="64"
goto search
:search
set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%"
if exist %_WRAPPER_EXE% goto check_lic_bits
set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe"
if exist %_WRAPPER_EXE% goto conf
if %_BIN_BITS%=="64" goto x86_32
echo Unable to locate a Wrapper executable using any of the following names:
echo %_WRAPPER_L_EXE%
echo %_WRAPPER_EXE%
goto preexitpause
:check_lic_bits
if %_BIN_BITS%=="64" (
set _CHECK_LIC_BITS=true
)
rem
rem Find the wrapper.conf
rem
:conf
if [%_WRAPPER_CONF_OVERRIDE%]==[true] (
set _WRAPPER_CONF="%~f1"
if not [%_WRAPPER_CONF%]==[""] (
shift
goto callcommand
)
)
set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%"
rem The command should not be called inside a IF, else errorlevel would be 0
if not [%_CHECK_LIC_BITS%]==[true] goto callcommand
%_WRAPPER_EXE% --request_delta_binary_bits %_WRAPPER_CONF% > nul 2>&1
if %errorlevel% equ 32 (
set _LIC32_OS64=true
set _CHECK_LIC_BITS=false
goto x86_32
)
rem
rem Run the Wrapper
rem
:callcommand
if not [%1]==[] (
echo Additional arguments are not allowed.
goto preexitpause
)
%_WRAPPER_EXE% -td %_WRAPPER_CONF%
if not errorlevel 1 goto :eof
rem Exit when there is a problem
:preexitpause
if %errorlevel% equ 0 (
set EXIT_CODE=1
) else (
set EXIT_CODE=%errorlevel%
)
if %_WRAPPER_TIMEOUT% gtr 0 (
timeout /t %_WRAPPER_TIMEOUT%
) else (
if %_WRAPPER_TIMEOUT% lss 0 (
pause
)
)
EXIT /B %EXIT_CODE%
wrapper_3.5.51_src/src/bin/UninstallApp-NT.bat.in 100644 0 0 12023 14333053647 16760 0 ustar 0 0 @echo off
setlocal
rem
rem Copyright (c) 1999, 2022 Tanuki Software, Ltd.
rem http://www.tanukisoftware.com
rem All rights reserved.
rem
rem This software is the proprietary information of Tanuki Software.
rem You shall use it only in accordance with the terms of the
rem license agreement you entered into with Tanuki Software.
rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
rem
rem Java Service Wrapper script - Uninstall/remove an NT service.
rem
rem -----------------------------------------------------------------------------
rem These settings can be modified to fit the needs of your application
rem Optimized for use with version 3.5.51 of the Wrapper.
rem The base name for the Wrapper binary.
set _WRAPPER_BASE=wrapper
rem The directory where the Wrapper binary (.exe) file is located. It can be
rem either an absolute or a relative path. If the path contains any special
rem characters, please make sure to quote the variable.
set _WRAPPER_DIR=
rem The name and location of the Wrapper configuration file. This will be used
rem if the user does not specify a configuration file as the first parameter to
rem this script.
rem If a relative path is specified, please note that the location is based on the
rem location of the Wrapper executable.
set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf"
rem Makes it possible to override the Wrapper configuration file by specifying it
rem as the first parameter.
rem set _WRAPPER_CONF_OVERRIDE=true
rem If there are any errors, the script will pause for a specific number of seconds
rem or until the user presses a key. (0 not to wait, negative to wait forever).
set _WRAPPER_TIMEOUT=-1
rem Note that it is only possible to pass parameters through to the JVM when
rem installing the service, or when running in a console.
rem Do not modify anything beyond this point
rem -----------------------------------------------------------------------------
rem
rem Resolve the real path of the wrapper.exe
rem For non NT systems, the _REALPATH and _WRAPPER_CONF values
rem can be hard-coded below and the following test removed.
rem
if "%OS%"=="Windows_NT" goto nt
echo This script only works with NT-based versions of Windows.
goto :eof
:nt
rem Find the application home.
rem if no path path specified do the default action
IF not DEFINED _WRAPPER_DIR goto dir_undefined
set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%"
if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\"
rem check if absolute path
if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path
if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path
rem everythig else means relative path
set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%"
goto pathfound
:dir_undefined
rem Use a relative path to the wrapper %~dp0 is location of current script under NT
set _REALPATH="%~dp0"
goto pathfound
:absolute_path
rem Use an absolute path to the wrapper
set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%"
:pathfound
rem
rem Decide on the specific Wrapper binary to use (See delta-pack)
rem
if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64
if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64
:x86_32
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe"
set _BIN_BITS="32"
goto search
:amd64
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe"
set _BIN_BITS="64"
goto search
:ia64
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe"
set _BIN_BITS="64"
goto search
:search
set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%"
if exist %_WRAPPER_EXE% goto check_lic_bits
set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe"
if exist %_WRAPPER_EXE% goto conf
if %_BIN_BITS%=="64" goto x86_32
echo Unable to locate a Wrapper executable using any of the following names:
echo %_WRAPPER_L_EXE%
echo %_WRAPPER_EXE%
goto preexitpause
:check_lic_bits
if %_BIN_BITS%=="64" (
set _CHECK_LIC_BITS=true
)
rem
rem Find the wrapper.conf
rem
:conf
if [%_WRAPPER_CONF_OVERRIDE%]==[true] (
set _WRAPPER_CONF="%~f1"
if not [%_WRAPPER_CONF%]==[""] (
shift
goto callcommand
)
)
set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%"
rem The command should not be called inside a IF, else errorlevel would be 0
if not [%_CHECK_LIC_BITS%]==[true] goto callcommand
%_WRAPPER_EXE% --request_delta_binary_bits %_WRAPPER_CONF% > nul 2>&1
if %errorlevel% equ 32 (
set _LIC32_OS64=true
set _CHECK_LIC_BITS=false
goto x86_32
)
rem
rem Run the Wrapper
rem
:callcommand
if not [%1]==[] (
echo Additional arguments are not allowed.
goto preexitpause
)
%_WRAPPER_EXE% -r %_WRAPPER_CONF%
if not errorlevel 1 goto :eof
rem Exit when there is a problem
:preexitpause
if %errorlevel% equ 0 (
set EXIT_CODE=1
) else (
set EXIT_CODE=%errorlevel%
)
if %_WRAPPER_TIMEOUT% gtr 0 (
timeout /t %_WRAPPER_TIMEOUT%
) else (
if %_WRAPPER_TIMEOUT% lss 0 (
pause
)
)
EXIT /B %EXIT_CODE%
wrapper_3.5.51_src/src/c/MSG00001.bin 100644 0 0 300 14333053647 14040 0 ustar 0 0 d d jvm1
jvm2
jvm3
jvm4
jvm5
jvm6
jvm7
jvm8
jvm9
jvmxx
wrapper
wrapperp
%2
wrapper_3.5.51_src/src/c/Makefile-aix-ppc-32.make 100644 0 0 2766 14333053647 16536 0 ustar 0 0 # Copyright (c) 1999, 2022 Tanuki Software, Ltd.
# http://www.tanukisoftware.com
# All rights reserved.
#
# This software is the proprietary information of Tanuki Software.
# You shall use it only in accordance with the terms of the
# license agreement you entered into with Tanuki Software.
# http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
COMPILE = gcc -O3 -fPIC --pedantic -DAIX -D_FILE_OFFSET_BITS=64 -liconv -DUNICODE -D_UNICODE
INCLUDE=$(JAVA_HOME)/include
DEFS = -I$(INCLUDE) -I$(INCLUDE)/aix
wrapper_SOURCE = wrapper.c wrapperinfo.c wrappereventloop.c wrapper_unix.c property.c logger.c logger_file.c wrapper_file.c wrapper_i18n.c wrapper_hashmap.c wrapper_ulimit.c wrapper_encoding.c wrapper_jvminfo.c
libwrapper_so_SOURCE = wrapper_i18n.c wrapperjni_unix.c wrapperinfo.c wrapperjni.c loggerjni.c
BIN = ../../bin
LIB = ../../lib
all: init wrapper libwrapper.so
clean:
rm -f *.o
cleanall: clean
rm -rf *~ .deps
rm -f $(BIN)/wrapper $(LIB)/libwrapper.so
init:
if test ! -d .deps; then mkdir .deps; fi
wrapper: $(wrapper_SOURCE)
$(COMPILE) -pthread $(wrapper_SOURCE) -lnsl -lm -o $(BIN)/wrapper
libwrapper.so: $(libwrapper_so_SOURCE)
${COMPILE} $(DEFS) -shared -pthread $(libwrapper_so_SOURCE) -o $(LIB)/libwrapper.so
%.o: %.c
@echo '$(COMPILE) -c $<'; \
$(COMPILE) $(DEFS) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
wrapper_3.5.51_src/src/c/Makefile-aix-ppc-64.make 100644 0 0 3006 14333053647 16527 0 ustar 0 0 # Copyright (c) 1999, 2022 Tanuki Software, Ltd.
# http://www.tanukisoftware.com
# All rights reserved.
#
# This software is the proprietary information of Tanuki Software.
# You shall use it only in accordance with the terms of the
# license agreement you entered into with Tanuki Software.
# http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
COMPILE = gcc -O3 -fPIC --pedantic -DAIX -DJSW64 -maix64 -D_FILE_OFFSET_BITS=64 -liconv -DUNICODE -D_UNICODE
INCLUDE=$(JAVA_HOME)/include
DEFS = -I$(INCLUDE) -I$(INCLUDE)/aix
wrapper_SOURCE = wrapper.c wrapperinfo.c wrappereventloop.c wrapper_unix.c property.c logger.c logger_file.c wrapper_file.c wrapper_i18n.c wrapper_hashmap.c wrapper_ulimit.c wrapper_encoding.c wrapper_jvminfo.c
libwrapper_so_SOURCE = wrapper_i18n.c wrapperjni_unix.c wrapperinfo.c wrapperjni.c loggerjni.c
BIN = ../../bin
LIB = ../../lib
all: init wrapper libwrapper.so
clean:
rm -f *.o
cleanall: clean
rm -rf *~ .deps
rm -f $(BIN)/wrapper $(LIB)/libwrapper.so
init:
if test ! -d .deps; then mkdir .deps; fi
wrapper: $(wrapper_SOURCE)
$(COMPILE) -pthread $(wrapper_SOURCE) -lnsl -lm -o $(BIN)/wrapper
libwrapper.so: $(libwrapper_so_SOURCE)
${COMPILE} $(DEFS) -shared -pthread $(libwrapper_so_SOURCE) -o $(LIB)/libwrapper.so
%.o: %.c
@echo '$(COMPILE) -c $<'; \
$(COMPILE) $(DEFS) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
wrapper_3.5.51_src/src/c/Makefile-freebsd-arm-64.gmake 100644 0 0 2471 14333053647 17531 0 ustar 0 0 # Copyright (c) 1999, 2022 Tanuki Software, Ltd.
# http://www.tanukisoftware.com
# All rights reserved.
#
# This software is the proprietary information of Tanuki Software.
# You shall use it only in accordance with the terms of the
# license agreement you entered into with Tanuki Software.
# http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
CC = gcc -Wall -pedantic -DFREEBSD -DJSW64 -fPIC -I/usr/local/include -L/usr/local/lib -DUNICODE -D_UNICODE
INCLUDE=$(JAVA_HOME)/include
CFLAGS = -I$(INCLUDE) -I$(INCLUDE)/freebsd
wrapper_SOURCE = wrapper.c wrapperinfo.c wrappereventloop.c wrapper_unix.c property.c logger.c logger_file.c wrapper_file.c wrapper_i18n.c wrapper_hashmap.c wrapper_ulimit.c wrapper_encoding.c wrapper_jvminfo.c
libwrapper_so_OBJECTS = wrapper_i18n.o wrapperjni_unix.o wrapperinfo.o wrapperjni.o loggerjni.o
BIN = ../../bin
LIB = ../../lib
all: init wrapper libwrapper.so
clean:
rm -f *.o
cleanall: clean
rm -rf *~ .deps
rm -f $(BIN)/wrapper $(LIB)/libwrapper.so
init:
if test ! -d .deps; then mkdir .deps; fi
wrapper: $(wrapper_SOURCE)
$(CC) $(wrapper_SOURCE) -lm -lcompat -rdynamic -lc -pthread -o $(BIN)/wrapper
libwrapper.so: $(libwrapper_so_OBJECTS)
$(CC) -shared -rdynamic -lc -pthread $(libwrapper_so_OBJECTS) -o $(LIB)/libwrapper.so
#%.o: %.c
# $(COMPILE) -c $(DEFS) $<
wrapper_3.5.51_src/src/c/Makefile-freebsd-x86-32.gmake 100644 0 0 2461 14333053647 17371 0 ustar 0 0 # Copyright (c) 1999, 2022 Tanuki Software, Ltd.
# http://www.tanukisoftware.com
# All rights reserved.
#
# This software is the proprietary information of Tanuki Software.
# You shall use it only in accordance with the terms of the
# license agreement you entered into with Tanuki Software.
# http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
CC = gcc -Wall -pedantic -DFREEBSD -fPIC -I/usr/local/include -L/usr/local/lib -DUNICODE -D_UNICODE
INCLUDE=$(JAVA_HOME)/include
CFLAGS = -I$(INCLUDE) -I$(INCLUDE)/freebsd
wrapper_SOURCE = wrapper.c wrapperinfo.c wrappereventloop.c wrapper_unix.c property.c logger.c logger_file.c wrapper_file.c wrapper_i18n.c wrapper_hashmap.c wrapper_ulimit.c wrapper_encoding.c wrapper_jvminfo.c
libwrapper_so_OBJECTS = wrapper_i18n.o wrapperjni_unix.o wrapperinfo.o wrapperjni.o loggerjni.o
BIN = ../../bin
LIB = ../../lib
all: init wrapper libwrapper.so
clean:
rm -f *.o
cleanall: clean
rm -rf *~ .deps
rm -f $(BIN)/wrapper $(LIB)/libwrapper.so
init:
if test ! -d .deps; then mkdir .deps; fi
wrapper: $(wrapper_SOURCE)
$(CC) $(wrapper_SOURCE) -lm -lcompat -rdynamic -lc -pthread -o $(BIN)/wrapper
libwrapper.so: $(libwrapper_so_OBJECTS)
$(CC) -shared -rdynamic -lc -pthread $(libwrapper_so_OBJECTS) -o $(LIB)/libwrapper.so
#%.o: %.c
# $(COMPILE) -c $(DEFS) $<
wrapper_3.5.51_src/src/c/Makefile-freebsd-x86-64.gmake 100644 0 0 2471 14333053647 17377 0 ustar 0 0 # Copyright (c) 1999, 2022 Tanuki Software, Ltd.
# http://www.tanukisoftware.com
# All rights reserved.
#
# This software is the proprietary information of Tanuki Software.
# You shall use it only in accordance with the terms of the
# license agreement you entered into with Tanuki Software.
# http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
CC = gcc -Wall -pedantic -DFREEBSD -DJSW64 -fPIC -I/usr/local/include -L/usr/local/lib -DUNICODE -D_UNICODE
INCLUDE=$(JAVA_HOME)/include
CFLAGS = -I$(INCLUDE) -I$(INCLUDE)/freebsd
wrapper_SOURCE = wrapper.c wrapperinfo.c wrappereventloop.c wrapper_unix.c property.c logger.c logger_file.c wrapper_file.c wrapper_i18n.c wrapper_hashmap.c wrapper_ulimit.c wrapper_encoding.c wrapper_jvminfo.c
libwrapper_so_OBJECTS = wrapper_i18n.o wrapperjni_unix.o wrapperinfo.o wrapperjni.o loggerjni.o
BIN = ../../bin
LIB = ../../lib
all: init wrapper libwrapper.so
clean:
rm -f *.o
cleanall: clean
rm -rf *~ .deps
rm -f $(BIN)/wrapper $(LIB)/libwrapper.so
init:
if test ! -d .deps; then mkdir .deps; fi
wrapper: $(wrapper_SOURCE)
$(CC) $(wrapper_SOURCE) -lm -lcompat -rdynamic -lc -pthread -o $(BIN)/wrapper
libwrapper.so: $(libwrapper_so_OBJECTS)
$(CC) -shared -rdynamic -lc -pthread $(libwrapper_so_OBJECTS) -o $(LIB)/libwrapper.so
#%.o: %.c
# $(COMPILE) -c $(DEFS) $<
wrapper_3.5.51_src/src/c/Makefile-hpux-ia-32.make 100644 0 0 2451 14333053647 16537 0 ustar 0 0 # Copyright (c) 1999, 2022 Tanuki Software, Ltd.
# http://www.tanukisoftware.com
# All rights reserved.
#
# This software is the proprietary information of Tanuki Software.
# You shall use it only in accordance with the terms of the
# license agreement you entered into with Tanuki Software.
# http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
COMPILE = gcc -O3 -fpic -Wall --pedantic -milp32 -DHPUX_IA -DHPUX -D_INCLUDE__STDC_A1_SOURCE -DUNICODE -D_UNICODE
INCLUDE=$(JAVA_HOME)/include
DEFS = -I$(INCLUDE) -I$(INCLUDE)/hp-ux
wrapper_SOURCE = wrapper.c wrapperinfo.c wrappereventloop.c wrapper_unix.c property.c logger.c logger_file.c wrapper_file.c wrapper_i18n.c wrapper_hashmap.c wrapper_ulimit.c wrapper_encoding.c wrapper_jvminfo.c
libwrapper_so_SOURCE = wrapper_i18n.c wrapperjni_unix.c wrapperinfo.c wrapperjni.c loggerjni.c
BIN = ../../bin
LIB = ../../lib
all: init wrapper libwrapper.so
clean:
rm -f *.o
cleanall: clean
rm -rf *~ .deps
rm -f $(BIN)/wrapper $(LIB)/libwrapper.so
init:
if test ! -d .deps; then mkdir .deps; fi
wrapper: $(wrapper_SOURCE)
$(COMPILE) $(wrapper_SOURCE) -lm -pthread -o $(BIN)/wrapper
libwrapper.so: $(libwrapper_so_SOURCE)
${COMPILE} ${DEFS} $(libwrapper_so_SOURCE) -shared -lm -pthread -o $(LIB)/libwrapper.so
%.o: %.c
${COMPILE} -c ${DEFS} $<
wrapper_3.5.51_src/src/c/Makefile-hpux-ia-64.make 100644 0 0 2457 14333053647 16552 0 ustar 0 0 # Copyright (c) 1999, 2022 Tanuki Software, Ltd.
# http://www.tanukisoftware.com
# All rights reserved.
#
# This software is the proprietary information of Tanuki Software.
# You shall use it only in accordance with the terms of the
# license agreement you entered into with Tanuki Software.
# http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
COMPILE = gcc -O3 -fpic -Wall --pedantic -mlp64 -DHPUX_IA -DHPUX -DJSW64 -D_INCLUDE__STDC_A1_SOURCE -DUNICODE -D_UNICODE
INCLUDE=$(JAVA_HOME)/include
DEFS = -I$(INCLUDE) -I$(INCLUDE)/hp-ux
wrapper_SOURCE = wrapper.c wrapperinfo.c wrappereventloop.c wrapper_unix.c property.c logger.c logger_file.c wrapper_file.c wrapper_i18n.c wrapper_hashmap.c wrapper_ulimit.c wrapper_encoding.c wrapper_jvminfo.c
libwrapper_so_SOURCE = wrapper_i18n.c wrapperjni_unix.c wrapperinfo.c wrapperjni.c loggerjni.c
BIN = ../../bin
LIB = ../../lib
all: init wrapper libwrapper.so
clean:
rm -f *.o
cleanall: clean
rm -rf *~ .deps
rm -f $(BIN)/wrapper $(LIB)/libwrapper.so
init:
if test ! -d .deps; then mkdir .deps; fi
wrapper: $(wrapper_SOURCE)
$(COMPILE) $(wrapper_SOURCE) -lm -pthread -o $(BIN)/wrapper
libwrapper.so: $(libwrapper_so_SOURCE)
${COMPILE} ${DEFS} $(libwrapper_so_SOURCE) -shared -lm -pthread -o $(LIB)/libwrapper.so
%.o: %.c
${COMPILE} -c ${DEFS} $<
wrapper_3.5.51_src/src/c/Makefile-hpux-parisc-32.make 100644 0 0 2435 14333053647 17431 0 ustar 0 0 # Copyright (c) 1999, 2022 Tanuki Software, Ltd.
# http://www.tanukisoftware.com
# All rights reserved.
#
# This software is the proprietary information of Tanuki Software.
# You shall use it only in accordance with the terms of the
# license agreement you entered into with Tanuki Software.
# http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
COMPILE = cc -DHPUX -Ae -D_INCLUDE__STDC_A1_SOURCE +Z +DAportable +DS1.1 -D_REENTRANT -DUNICODE -D_UNICODE
INCLUDE=$(JAVA_HOME)/include
DEFS = -I$(INCLUDE) -I$(INCLUDE)/hp-ux
wrapper_SOURCE = wrapper.c wrapperinfo.c wrappereventloop.c wrapper_unix.c property.c logger.c logger_file.c wrapper_file.c wrapper_i18n.c wrapper_hashmap.c wrapper_ulimit.c wrapper_encoding.c wrapper_jvminfo.c
libwrapper_sl_SOURCE = wrapper_i18n.c wrapperjni_unix.c wrapperinfo.c wrapperjni.c loggerjni.c
BIN = ../../bin
LIB = ../../lib
all: init wrapper libwrapper.sl
clean:
rm -f *.o
cleanall: clean
rm -rf *~ .deps
rm -f $(BIN)/wrapper $(LIB)/libwrapper.sl
init:
if test ! -d .deps; then mkdir .deps; fi
wrapper: $(wrapper_SOURCE)
$(COMPILE) $(wrapper_SOURCE) -lm -lpthread -o $(BIN)/wrapper
libwrapper.sl: $(libwrapper_sl_SOURCE)
${COMPILE} ${DEFS} $(libwrapper_sl_SOURCE) -b -lm -lpthread -o $(LIB)/libwrapper.sl
%.o: %.c
${COMPILE} -c ${DEFS} $<
wrapper_3.5.51_src/src/c/Makefile-hpux-parisc-64.make 100644 0 0 2436 14333053647 17437 0 ustar 0 0 # Copyright (c) 1999, 2022 Tanuki Software, Ltd.
# http://www.tanukisoftware.com
# All rights reserved.
#
# This software is the proprietary information of Tanuki Software.
# You shall use it only in accordance with the terms of the
# license agreement you entered into with Tanuki Software.
# http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
COMPILE = cc +z +DD64 -D_INCLUDE__STDC_A1_SOURCE -O3 -Wall -DHPUX -DJSW64 -D_REENTRANT -DUNICODE -D_UNICODE
INCLUDE=$(JAVA_HOME)/include
DEFS = -I$(INCLUDE) -I$(INCLUDE)/hp-ux
wrapper_SOURCE = wrapper.c wrapperinfo.c wrappereventloop.c wrapper_unix.c property.c logger.c logger_file.c wrapper_file.c wrapper_i18n.c wrapper_hashmap.c wrapper_ulimit.c wrapper_encoding.c wrapper_jvminfo.c
libwrapper_sl_SOURCE = wrapper_i18n.c wrapperjni_unix.c wrapperinfo.c wrapperjni.c loggerjni.c
BIN = ../../bin
LIB = ../../lib
all: init wrapper libwrapper.sl
clean:
rm -f *.o
cleanall: clean
rm -rf *~ .deps
rm -f $(BIN)/wrapper $(LIB)/libwrapper.sl
init:
if test ! -d .deps; then mkdir .deps; fi
wrapper: $(wrapper_SOURCE)
$(COMPILE) $(wrapper_SOURCE) -lm -lpthread -o $(BIN)/wrapper
libwrapper.sl: $(libwrapper_sl_SOURCE)
${COMPILE} ${DEFS} $(libwrapper_sl_SOURCE) -b -lm -lpthread -o $(LIB)/libwrapper.sl
%.o: %.c
${COMPILE} -c ${DEFS} $<
wrapper_3.5.51_src/src/c/Makefile-linux-arm-64.make 100644 0 0 3134 14333053647 17104 0 ustar 0 0 # Copyright (c) 1999, 2022 Tanuki Software, Ltd.
# http://www.tanukisoftware.com
# All rights reserved.
#
# This software is the proprietary information of Tanuki Software.
# You shall use it only in accordance with the terms of the
# license agreement you entered into with Tanuki Software.
# http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
COMPILE = gcc -O3 -fPIC -Wall --pedantic -DLINUX -D_FORTIFY_SOURCE=2 -DJSW64 -D_FILE_OFFSET_BITS=64 -fpic -D_GNU_SOURCE -DUNICODE -D_UNICODE
WRAPPER_LINK_OPTS = -Wl,-z,relro,-z,now
INCLUDE=$(JAVA_HOME)/include
DEFS = -I$(INCLUDE) -I$(INCLUDE)/linux
wrapper_SOURCE = wrapper.c wrapperinfo.c wrappereventloop.c wrapper_unix.c property.c logger.c logger_file.c wrapper_file.c wrapper_i18n.c wrapper_hashmap.c wrapper_ulimit.c wrapper_encoding.c wrapper_jvminfo.c
libwrapper_so_OBJECTS = wrapper_i18n.o wrapperjni_unix.o wrapperinfo.o wrapperjni.o loggerjni.o
BIN = ../../bin
LIB = ../../lib
all: init wrapper libwrapper.so
clean:
rm -f *.o
cleanall: clean
rm -rf *~ .deps
rm -f $(BIN)/wrapper $(LIB)/libwrapper.so
init:
if test ! -d .deps; then mkdir .deps; fi
wrapper: $(wrapper_SOURCE)
$(COMPILE) $(WRAPPER_LINK_OPTS) -pthread $(wrapper_SOURCE) -lm -o $(BIN)/wrapper
libwrapper.so: $(libwrapper_so_OBJECTS)
${COMPILE} -shared $(libwrapper_so_OBJECTS) -o $(LIB)/libwrapper.so
%.o: %.c
@echo '$(COMPILE) -c $<'; \
$(COMPILE) -pthread $(DEFS) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
wrapper_3.5.51_src/src/c/Makefile-linux-armel-32.make 100644 0 0 3124 14333053647 17417 0 ustar 0 0 # Copyright (c) 1999, 2022 Tanuki Software, Ltd.
# http://www.tanukisoftware.com
# All rights reserved.
#
# This software is the proprietary information of Tanuki Software.
# You shall use it only in accordance with the terms of the
# license agreement you entered into with Tanuki Software.
# http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
COMPILE = gcc -O3 -fPIC -Wall --pedantic -DLINUX -D_FORTIFY_SOURCE=2 -D_FILE_OFFSET_BITS=64 -fpic -D_GNU_SOURCE -DUNICODE -D_UNICODE
WRAPPER_LINK_OPTS = -Wl,-z,relro,-z,now
INCLUDE=$(JAVA_HOME)/include
DEFS = -I$(INCLUDE) -I$(INCLUDE)/linux
wrapper_SOURCE = wrapper.c wrapperinfo.c wrappereventloop.c wrapper_unix.c property.c logger.c logger_file.c wrapper_file.c wrapper_i18n.c wrapper_hashmap.c wrapper_ulimit.c wrapper_encoding.c wrapper_jvminfo.c
libwrapper_so_OBJECTS = wrapper_i18n.o wrapperjni_unix.o wrapperinfo.o wrapperjni.o loggerjni.o
BIN = ../../bin
LIB = ../../lib
all: init wrapper libwrapper.so
clean:
rm -f *.o
cleanall: clean
rm -rf *~ .deps
rm -f $(BIN)/wrapper $(LIB)/libwrapper.so
init:
if test ! -d .deps; then mkdir .deps; fi
wrapper: $(wrapper_SOURCE)
$(COMPILE) $(WRAPPER_LINK_OPTS) -pthread $(wrapper_SOURCE) -lm -o $(BIN)/wrapper
libwrapper.so: $(libwrapper_so_OBJECTS)
${COMPILE} -shared $(libwrapper_so_OBJECTS) -o $(LIB)/libwrapper.so
%.o: %.c
@echo '$(COMPILE) -c $<'; \
$(COMPILE) -pthread $(DEFS) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
wrapper_3.5.51_src/src/c/Makefile-linux-armhf-32.make 100644 0 0 3124 14333053647 17414 0 ustar 0 0 # Copyright (c) 1999, 2022 Tanuki Software, Ltd.
# http://www.tanukisoftware.com
# All rights reserved.
#
# This software is the proprietary information of Tanuki Software.
# You shall use it only in accordance with the terms of the
# license agreement you entered into with Tanuki Software.
# http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
COMPILE = gcc -O3 -fPIC -Wall --pedantic -DLINUX -D_FORTIFY_SOURCE=2 -D_FILE_OFFSET_BITS=64 -fpic -D_GNU_SOURCE -DUNICODE -D_UNICODE
WRAPPER_LINK_OPTS = -Wl,-z,relro,-z,now
INCLUDE=$(JAVA_HOME)/include
DEFS = -I$(INCLUDE) -I$(INCLUDE)/linux
wrapper_SOURCE = wrapper.c wrapperinfo.c wrappereventloop.c wrapper_unix.c property.c logger.c logger_file.c wrapper_file.c wrapper_i18n.c wrapper_hashmap.c wrapper_ulimit.c wrapper_encoding.c wrapper_jvminfo.c
libwrapper_so_OBJECTS = wrapper_i18n.o wrapperjni_unix.o wrapperinfo.o wrapperjni.o loggerjni.o
BIN = ../../bin
LIB = ../../lib
all: init wrapper libwrapper.so
clean:
rm -f *.o
cleanall: clean
rm -rf *~ .deps
rm -f $(BIN)/wrapper $(LIB)/libwrapper.so
init:
if test ! -d .deps; then mkdir .deps; fi
wrapper: $(wrapper_SOURCE)
$(COMPILE) $(WRAPPER_LINK_OPTS) -pthread $(wrapper_SOURCE) -lm -o $(BIN)/wrapper
libwrapper.so: $(libwrapper_so_OBJECTS)
${COMPILE} -shared $(libwrapper_so_OBJECTS) -o $(LIB)/libwrapper.so
%.o: %.c
@echo '$(COMPILE) -c $<'; \
$(COMPILE) -pthread $(DEFS) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
wrapper_3.5.51_src/src/c/Makefile-linux-ia-64.make 100644 0 0 3113 14333053647 16713 0 ustar 0 0 # Copyright (c) 1999, 2022 Tanuki Software, Ltd.
# http://www.tanukisoftware.com
# All rights reserved.
#
# This software is the proprietary information of Tanuki Software.
# You shall use it only in accordance with the terms of the
# license agreement you entered into with Tanuki Software.
# http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
COMPILE = gcc -O3 -fPIC -Wall --pedantic -DLINUX -DJSW64 -D_FILE_OFFSET_BITS=64 -fpic -D_GNU_SOURCE -DUNICODE -D_UNICODE
WRAPPER_LINK_OPTS = -Wl,-z,relro,-z,now
INCLUDE=$(JAVA_HOME)/include
DEFS = -I$(INCLUDE) -I$(INCLUDE)/linux
wrapper_SOURCE = wrapper.c wrapperinfo.c wrappereventloop.c wrapper_unix.c property.c logger.c logger_file.c wrapper_file.c wrapper_i18n.c wrapper_hashmap.c wrapper_ulimit.c wrapper_encoding.c wrapper_jvminfo.c
libwrapper_so_OBJECTS = wrapper_i18n.o wrapperjni_unix.o wrapperinfo.o wrapperjni.o loggerjni.o
BIN = ../../bin
LIB = ../../lib
all: init wrapper libwrapper.so
clean:
rm -f *.o
cleanall: clean
rm -rf *~ .deps
rm -f $(BIN)/wrapper $(LIB)/libwrapper.so
init:
if test ! -d .deps; then mkdir .deps; fi
wrapper: $(wrapper_SOURCE)
$(COMPILE) $(WRAPPER_LINK_OPTS) -lm -pthread $(wrapper_SOURCE) -o $(BIN)/wrapper
libwrapper.so: $(libwrapper_so_OBJECTS)
${COMPILE} -shared $(libwrapper_so_OBJECTS) -lm -o $(LIB)/libwrapper.so
%.o: %.c
@echo '$(COMPILE) -c $<'; \
$(COMPILE) -pthread $(DEFS) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
wrapper_3.5.51_src/src/c/Makefile-linux-ppcle-64.make 100644 0 0 3140 14333053647 17425 0 ustar 0 0 # Copyright (c) 1999, 2022 Tanuki Software, Ltd.
# http://www.tanukisoftware.com
# All rights reserved.
#
# This software is the proprietary information of Tanuki Software.
# You shall use it only in accordance with the terms of the
# license agreement you entered into with Tanuki Software.
# http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
COMPILE = gcc -O3 -m64 -fPIC -Wall --pedantic -DLINUX -D_FORTIFY_SOURCE=2 -DJSW64 -D_FILE_OFFSET_BITS=64 -fpic -D_GNU_SOURCE -DUNICODE -D_UNICODE
WRAPPER_LINK_OPTS = -Wl,-z,relro,-z,now
INCLUDE=$(JAVA_HOME)/include
DEFS = -I$(INCLUDE) -I$(INCLUDE)/linux
wrapper_SOURCE = wrapper.c wrapperinfo.c wrappereventloop.c wrapper_unix.c property.c logger.c logger_file.c wrapper_file.c wrapper_i18n.c wrapper_hashmap.c wrapper_ulimit.c wrapper_encoding.c wrapper_jvminfo.c
libwrapper_so_OBJECTS = wrapper_i18n.o wrapperjni_unix.o wrapperinfo.o wrapperjni.o loggerjni.o
BIN = ../../bin
LIB = ../../lib
all: init wrapper libwrapper.so
clean:
rm -f *.o
cleanall: clean
rm -rf *~ .deps
rm -f $(BIN)/wrapper $(LIB)/libwrapper.so
init:
if test ! -d .deps; then mkdir .deps; fi
wrapper: $(wrapper_SOURCE)
$(COMPILE) $(WRAPPER_LINK_OPTS) -lm -pthread $(wrapper_SOURCE) -o $(BIN)/wrapper
libwrapper.so: $(libwrapper_so_OBJECTS)
${COMPILE} -shared $(libwrapper_so_OBJECTS) -o $(LIB)/libwrapper.so
%.o: %.c
@echo '$(COMPILE) -c $<'; \
$(COMPILE) -pthread $(DEFS) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
wrapper_3.5.51_src/src/c/Makefile-linux-x86-32.make 100644 0 0 4034 14333053647 16745 0 ustar 0 0 # Copyright (c) 1999, 2022 Tanuki Software, Ltd.
# http://www.tanukisoftware.com
# All rights reserved.
#
# This software is the proprietary information of Tanuki Software.
# You shall use it only in accordance with the terms of the
# license agreement you entered into with Tanuki Software.
# http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
COMPILE = gcc -O3 -fPIC -Wall --pedantic -DLINUX -D_FORTIFY_SOURCE=2 -D_FILE_OFFSET_BITS=64 -fpic -D_GNU_SOURCE -DUNICODE -D_UNICODE
WRAPPER_LINK_OPTS = -Wl,-z,relro,-z,now
INCLUDE=$(JAVA_HOME)/include
DEFS = -I$(INCLUDE) -I$(INCLUDE)/linux
wrapper_SOURCE = wrapper.c wrapperinfo.c wrappereventloop.c wrapper_unix.c property.c logger.c logger_file.c wrapper_file.c wrapper_i18n.c wrapper_hashmap.c wrapper_ulimit.c wrapper_encoding.c wrapper_jvminfo.c
libwrapper_so_OBJECTS = wrapper_i18n.o wrapperjni_unix.o wrapperinfo.o wrapperjni.o loggerjni.o
testsuite_SOURCE = testsuite.c test_example.c test_javaadditionalparam.c test_hashmap.c test_filter.c wrapper.c wrapperinfo.c wrappereventloop.c wrapper_unix.c property.c logger.c logger_file.c wrapper_file.c wrapper_i18n.c wrapper_hashmap.c wrapper_ulimit.c wrapper_encoding.c wrapper_jvminfo.c
BIN = ../../bin
LIB = ../../lib
TEST = ../../test
all: init wrapper libwrapper.so
clean:
rm -f *.o
cleanall: clean
rm -rf *~ .deps
rm -f $(BIN)/wrapper $(LIB)/libwrapper.so
init:
if test ! -d .deps; then mkdir .deps; fi
wrapper: $(wrapper_SOURCE)
$(COMPILE) $(WRAPPER_LINK_OPTS) -pthread $(wrapper_SOURCE) -lm -o $(BIN)/wrapper
testsuite: $(testsuite_SOURCE)
$(COMPILE) -DCUNIT $(testsuite_SOURCE) -lm -pthread -L/usr/local/lib -lncurses -lcunit -o $(TEST)/testsuite
libwrapper.so: $(libwrapper_so_OBJECTS)
${COMPILE} -shared $(libwrapper_so_OBJECTS) -o $(LIB)/libwrapper.so
%.o: %.c
@echo '$(COMPILE) -c $<'; \
$(COMPILE) -pthread $(DEFS) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
wrapper_3.5.51_src/src/c/Makefile-linux-x86-64.make 100644 0 0 4056 14333053647 16756 0 ustar 0 0 # Copyright (c) 1999, 2022 Tanuki Software, Ltd.
# http://www.tanukisoftware.com
# All rights reserved.
#
# This software is the proprietary information of Tanuki Software.
# You shall use it only in accordance with the terms of the
# license agreement you entered into with Tanuki Software.
# http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
COMPILE = gcc -O3 -fPIC -Wall --pedantic -DLINUX -D_FORTIFY_SOURCE=2 -DJSW64 -D_FILE_OFFSET_BITS=64 -fpic -D_GNU_SOURCE -DUNICODE -D_UNICODE
WRAPPER_LINK_OPTS = -Wl,-z,relro,-z,now
INCLUDE=$(JAVA_HOME)/include
DEFS = -I$(INCLUDE) -I$(INCLUDE)/linux
wrapper_SOURCE = wrapper.c wrapperinfo.c wrappereventloop.c wrapper_unix.c property.c logger.c logger_file.c wrapper_file.c wrapper_i18n.c wrapper_hashmap.c wrapper_ulimit.c wrapper_encoding.c wrapper_jvminfo.c
libwrapper_so_OBJECTS = wrapper_i18n.o wrapperjni_unix.o wrapperinfo.o wrapperjni.o loggerjni.o
testsuite_SOURCE = testsuite.c test_example.c test_javaadditionalparam.c test_hashmap.c test_filter.c wrapper.c wrapperinfo.c wrappereventloop.c wrapper_unix.c property.c logger.c logger_file.c wrapper_file.c wrapper_i18n.c wrapper_hashmap.c wrapper_ulimit.c wrapper_encoding.c wrapper_jvminfo.c
BIN = ../../bin
LIB = ../../lib
TEST = ../../test
all: init wrapper libwrapper.so testsuite
clean:
rm -f *.o
cleanall: clean
rm -rf *~ .deps
rm -f $(BIN)/wrapper $(LIB)/libwrapper.so
init:
if test ! -d .deps; then mkdir .deps; fi
wrapper: $(wrapper_SOURCE)
$(COMPILE) $(WRAPPER_LINK_OPTS) -pthread $(wrapper_SOURCE) -lm -o $(BIN)/wrapper
testsuite: $(testsuite_SOURCE)
$(COMPILE) -DCUNIT $(testsuite_SOURCE) -lm -pthread -L/usr/local/lib -lncurses -lcunit -o $(TEST)/testsuite
libwrapper.so: $(libwrapper_so_OBJECTS)
${COMPILE} -shared $(libwrapper_so_OBJECTS) -o $(LIB)/libwrapper.so
%.o: %.c
@echo '$(COMPILE) -c $<'; \
$(COMPILE) -pthread $(DEFS) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
wrapper_3.5.51_src/src/c/Makefile-macosx-arm-64.make 100644 0 0 3037 14333053647 17241 0 ustar 0 0 # Copyright (c) 1999, 2022 Tanuki Software, Ltd.
# http://www.tanukisoftware.com
# All rights reserved.
#
# This software is the proprietary information of Tanuki Software.
# You shall use it only in accordance with the terms of the
# license agreement you entered into with Tanuki Software.
# http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
UNIVERSAL_SDK_HOME=/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk
ISYSROOT=-isysroot $(UNIVERSAL_SDK_HOME)
#DEFS=-I$(UNIVERSAL_SDK_HOME)/System/Library/Frameworks/JavaVM.framework/Headers
DEFS=-I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin
COMPILE = gcc -O3 -m64 -Wall -DUSE_NANOSLEEP -DMACOSX -D_FORTIFY_SOURCE=2 -DJSW64 -arch arm64 $(ISYSROOT) -mmacosx-version-min=11.1 -DUNICODE -D_UNICODE
wrapper_SOURCE = wrapper.c wrapperinfo.c wrappereventloop.c wrapper_unix.c property.c logger.c logger_file.c wrapper_file.c wrapper_i18n.c wrapper_hashmap.c wrapper_ulimit.c wrapper_encoding.c wrapper_jvminfo.c
libwrapper_so_OBJECTS = wrapper_i18n.o wrapperjni_unix.o wrapperinfo.o wrapperjni.o loggerjni.o
BIN = ../../bin
LIB = ../../lib
all: init wrapper libwrapper.dylib
clean:
rm -f *.o
cleanall: clean
rm -rf *~ .deps
rm -f $(BIN)/wrapper $(LIB)/libwrapper.dylib
init:
if test ! -d .deps; then mkdir .deps; fi
wrapper: $(wrapper_SOURCE)
$(COMPILE) -DMACOSX $(wrapper_SOURCE) -liconv -pthread -o $(BIN)/wrapper
libwrapper.dylib: $(libwrapper_so_OBJECTS)
$(COMPILE) -bundle -liconv -pthread -o $(LIB)/libwrapper.dylib $(libwrapper_so_OBJECTS)
%.o: %.c
$(COMPILE) -c $(DEFS) $<
wrapper_3.5.51_src/src/c/Makefile-macosx-universal-32.make 100644 0 0 4524 14333053647 20467 0 ustar 0 0 # Copyright (c) 1999, 2022 Tanuki Software, Ltd.
# http://www.tanukisoftware.com
# All rights reserved.
#
# This software is the proprietary information of Tanuki Software.
# You shall use it only in accordance with the terms of the
# license agreement you entered into with Tanuki Software.
# http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
UNIVERSAL_SDK_HOME=/Developer/SDKs/MacOSX10.5.sdk
INCLUDE = -I/opt/local/include
COMPILE = gcc -O3 -Wall -DUSE_NANOSLEEP -DMACOSX -D_FORTIFY_SOURCE=2 -arch ppc -arch i386 -isysroot $(UNIVERSAL_SDK_HOME) $(INCLUDE) -mmacosx-version-min=10.4 -DUNICODE -D_UNICODE
COMPILET = gcc -O3 -Wall -DUSE_NANOSLEEP -DMACOSX -isysroot $(UNIVERSAL_SDK_HOME) $(INCLUDE) -mmacosx-version-min=10.4 -DUNICODE -D_UNICODE
#COMPILE = gcc -ggdb -O1 -Wall -DUSE_NANOSLEEP -DMACOSX -DVALGRIND -isysroot $(UNIVERSAL_SDK_HOME) $(INCLUDE) -mmacosx-version-min=10.4 -DUNICODE -D_UNICODE
# To debug:
# 1) Add "-ggdb"
# 2) Remove "-arch ppc -arch i386"
# 3) Change "-O3" to "-O1"
DEFS = -I$(UNIVERSAL_SDK_HOME)/System/Library/Frameworks/JavaVM.framework/Headers
wrapper_SOURCE = wrapper.c wrapperinfo.c wrappereventloop.c wrapper_unix.c property.c logger.c logger_file.c wrapper_file.c wrapper_i18n.c wrapper_hashmap.c wrapper_ulimit.c wrapper_encoding.c wrapper_jvminfo.c
libwrapper_so_OBJECTS = wrapper_i18n.o wrapperjni_unix.o wrapperinfo.o wrapperjni.o loggerjni.o
testsuite_SOURCE = testsuite.c test_example.c test_javaadditionalparam.c test_hashmap.c test_filter.c wrapper.c wrapperinfo.c wrappereventloop.c wrapper_unix.c property.c logger.c logger_file.c wrapper_file.c wrapper_i18n.c wrapper_hashmap.c wrapper_ulimit.c wrapper_encoding.c wrapper_jvminfo.c
BIN = ../../bin
LIB = ../../lib
TEST = ../../test
#all: init testsuite wrapper libwrapper.jnilib
all: init wrapper libwrapper.jnilib
clean:
rm -f *.o
cleanall: clean
rm -rf *~ .deps
rm -f $(BIN)/wrapper $(LIB)/libwrapper.jnilib
init:
if test ! -d .deps; then mkdir .deps; fi
wrapper: $(wrapper_SOURCE)
$(COMPILE) -DMACOSX $(wrapper_SOURCE) -liconv -pthread -o $(BIN)/wrapper
libwrapper.jnilib: $(libwrapper_so_OBJECTS)
$(COMPILE) -bundle -liconv -pthread -o $(LIB)/libwrapper.jnilib $(libwrapper_so_OBJECTS)
testsuite: $(testsuite_SOURCE)
$(COMPILET) -DCUNIT $(testsuite_SOURCE) -liconv -lncurses -lcunit -pthread -o $(TEST)/testsuite
%.o: %.c
$(COMPILE) -c $(DEFS) $<
wrapper_3.5.51_src/src/c/Makefile-macosx-universal-64.make 100644 0 0 3764 14333053647 20501 0 ustar 0 0 # Copyright (c) 1999, 2022 Tanuki Software, Ltd.
# http://www.tanukisoftware.com
# All rights reserved.
#
# This software is the proprietary information of Tanuki Software.
# You shall use it only in accordance with the terms of the
# license agreement you entered into with Tanuki Software.
# http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
# Newer SDKs work differently so we don't want to specify where it is.
ifdef DEV_AUTOSDK
ISYSROOT=
DEV_NOPPC=true
DEFS=-I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin
else
ifdef DEV_NOPPC
UNIVERSAL_SDK_HOME=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk
else
UNIVERSAL_SDK_HOME=/Developer/SDKs/MacOSX10.5.sdk
endif
ISYSROOT=-isysroot $(UNIVERSAL_SDK_HOME)
DEFS=-I$(UNIVERSAL_SDK_HOME)/System/Library/Frameworks/JavaVM.framework/Headers
endif
# If you define DEV_NOPPC on your development machine then ppc64 will not be built. This is needed for newer XCode versions. This should never be done on release build machines.
ifdef DEV_NOPPC
ARCHPPC=
else
ARCHPPC=-arch ppc64
endif
COMPILE = gcc -O3 -m64 -Wall -DUSE_NANOSLEEP -DMACOSX -D_FORTIFY_SOURCE=2 -DJSW64 $(ARCHPPC) -arch x86_64 $(ISYSROOT) -mmacosx-version-min=10.4 -DUNICODE -D_UNICODE
wrapper_SOURCE = wrapper.c wrapperinfo.c wrappereventloop.c wrapper_unix.c property.c logger.c logger_file.c wrapper_file.c wrapper_i18n.c wrapper_hashmap.c wrapper_ulimit.c wrapper_encoding.c wrapper_jvminfo.c
libwrapper_so_OBJECTS = wrapper_i18n.o wrapperjni_unix.o wrapperinfo.o wrapperjni.o loggerjni.o
BIN = ../../bin
LIB = ../../lib
all: init wrapper libwrapper.jnilib
clean:
rm -f *.o
cleanall: clean
rm -rf *~ .deps
rm -f $(BIN)/wrapper $(LIB)/libwrapper.jnilib
init:
if test ! -d .deps; then mkdir .deps; fi
wrapper: $(wrapper_SOURCE)
$(COMPILE) -DMACOSX $(wrapper_SOURCE) -liconv -pthread -o $(BIN)/wrapper
libwrapper.jnilib: $(libwrapper_so_OBJECTS)
$(COMPILE) -bundle -liconv -pthread -o $(LIB)/libwrapper.jnilib $(libwrapper_so_OBJECTS)
%.o: %.c
$(COMPILE) -c $(DEFS) $<
wrapper_3.5.51_src/src/c/Makefile-solaris-sparc-32.gmake 100644 0 0 2473 14333053647 20121 0 ustar 0 0 # Copyright (c) 1999, 2022 Tanuki Software, Ltd.
# http://www.tanukisoftware.com
# All rights reserved.
#
# This software is the proprietary information of Tanuki Software.
# You shall use it only in accordance with the terms of the
# license agreement you entered into with Tanuki Software.
# http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
COMPILE = /opt/studio12/SUNWspro/bin/cc -mt -Kpic -O -DSOLARIS -DJSW64 -D_REENTRANT -DUNICODE -D_UNICODE
INCLUDE=$(JAVA_HOME)/include
DEFS = -I$(INCLUDE) -I$(INCLUDE)/solaris
wrapper_SOURCE = wrapper.c wrapperinfo.c wrappereventloop.c wrapper_unix.c property.c logger.c logger_file.c wrapper_file.c wrapper_i18n.c wrapper_hashmap.c wrapper_ulimit.c wrapper_encoding.c wrapper_jvminfo.c
libwrapper_so_OBJECTS = wrapper_i18n.o wrapperjni_unix.o wrapperinfo.o wrapperjni.o loggerjni.o
BIN = ../../bin
LIB = ../../lib
all: init wrapper libwrapper.so
clean:
rm -f *.o
cleanall: clean
rm -rf *~ .deps
rm -f $(BIN)/wrapper $(LIB)/libwrapper.so
init:
if test ! -d .deps; then mkdir .deps; fi
wrapper: $(wrapper_SOURCE)
$(COMPILE) $(wrapper_SOURCE) -lsocket -lpthread -lnsl -lm -lposix4 -o $(BIN)/wrapper
libwrapper.so: $(libwrapper_so_OBJECTS)
${COMPILE} -G -fPIC -lposix4 -lpthread $(libwrapper_so_OBJECTS) -o $(LIB)/libwrapper.so
%.o: %.c
${COMPILE} -c ${DEFS} $<
wrapper_3.5.51_src/src/c/Makefile-solaris-sparc-64.gmake 100644 0 0 2514 14333053647 20122 0 ustar 0 0 # Copyright (c) 1999, 2022 Tanuki Software, Ltd.
# http://www.tanukisoftware.com
# All rights reserved.
#
# This software is the proprietary information of Tanuki Software.
# You shall use it only in accordance with the terms of the
# license agreement you entered into with Tanuki Software.
# http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
COMPILE = /opt/studio12/SUNWspro/bin/cc -m64 -mt -O -DSOLARIS -DJSW64 -D_REENTRANT -DUNICODE -D_UNICODE
INCLUDE=$(JAVA_HOME)/include
DEFS = -I$(INCLUDE) -I$(INCLUDE)/solaris
wrapper_SOURCE = wrapper.c wrapperinfo.c wrappereventloop.c wrapper_unix.c property.c logger.c logger_file.c wrapper_file.c wrapper_i18n.c wrapper_hashmap.c wrapper_ulimit.c wrapper_encoding.c wrapper_jvminfo.c
libwrapper_so_OBJECTS = wrapper_i18n.o wrapperjni_unix.o wrapperinfo.o wrapperjni.o loggerjni.o
BIN = ../../bin
LIB = ../../lib
all: init wrapper libwrapper.so
clean:
rm -f *.o
cleanall: clean
rm -rf *~ .deps
rm -f $(BIN)/wrapper $(LIB)/libwrapper.so
init:
if test ! -d .deps; then mkdir .deps; fi
wrapper: $(wrapper_SOURCE)
$(COMPILE) -KPIC $(wrapper_SOURCE) -lsocket -lpthread -lnsl -lm -lposix4 -o $(BIN)/wrapper
libwrapper.so: $(libwrapper_so_OBJECTS)
${COMPILE} -Kpic -G -fPIC -lposix4 -lpthread $(libwrapper_so_OBJECTS) -o $(LIB)/libwrapper.so
%.o: %.c
${COMPILE} -Kpic -c ${DEFS} $<
wrapper_3.5.51_src/src/c/Makefile-solaris-x86-32.gmake 100644 0 0 2553 14333053647 17435 0 ustar 0 0 # Copyright (c) 1999, 2022 Tanuki Software, Ltd.
# http://www.tanukisoftware.com
# All rights reserved.
#
# This software is the proprietary information of Tanuki Software.
# You shall use it only in accordance with the terms of the
# license agreement you entered into with Tanuki Software.
# http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
# gcc -O3 -Wall --pedantic -DSOLARIS -liconv -DUNICODE -D_UNICODE
COMPILE = /opt/SUNWspro/bin/cc -mt -Kpic -O -DSOLARIS -DUNICODE -D_UNICODE -D_REENTRANT
INCLUDE=$(JAVA_HOME)/include
DEFS = -I$(INCLUDE) -I$(INCLUDE)/solaris
wrapper_SOURCE = wrapper.c wrapperinfo.c wrappereventloop.c wrapper_unix.c property.c logger.c logger_file.c wrapper_file.c wrapper_i18n.c wrapper_hashmap.c wrapper_ulimit.c wrapper_encoding.c wrapper_jvminfo.c
libwrapper_so_OBJECTS = wrapper_i18n.o wrapperjni_unix.o wrapperinfo.o wrapperjni.o loggerjni.o
BIN = ../../bin
LIB = ../../lib
all: init wrapper libwrapper.so
clean:
rm -f *.o
cleanall: clean
rm -rf *~ .deps
rm -f $(BIN)/wrapper $(LIB)/libwrapper.so
init:
if test ! -d .deps; then mkdir .deps; fi
wrapper: $(wrapper_SOURCE)
$(COMPILE) $(wrapper_SOURCE) -lsocket -lpthread -lnsl -lm -lposix4 -o $(BIN)/wrapper
libwrapper.so: $(libwrapper_so_OBJECTS)
${COMPILE} -G -fPIC -lposix4 -lpthread $(libwrapper_so_OBJECTS) -o $(LIB)/libwrapper.so
%.o: %.c
${COMPILE} -c ${DEFS} $<
wrapper_3.5.51_src/src/c/Makefile-solaris-x86-64.gmake 100644 0 0 3407 14333053647 17441 0 ustar 0 0 # Copyright (c) 1999, 2022 Tanuki Software, Ltd.
# http://www.tanukisoftware.com
# All rights reserved.
#
# This software is the proprietary information of Tanuki Software.
# You shall use it only in accordance with the terms of the
# license agreement you entered into with Tanuki Software.
# http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
# gcc - The JNI library generated with gcc does not work on 64-bit x86 systems
# due to a bug or simply a configuration problem. We need to use cc here.
# see Bug #1992039 for details.
# https://sourceforge.net/tracker/index.php?func=detail&aid=1992039&group_id=39428&atid=425187
#COMPILE = gcc -m64 -O3 -Wall --pedantic -DSOLARIS -DJSW64
COMPILE = /opt/SUNWspro/bin/cc -m64 -mt -Kpic -O -DSOLARIS -DJSW64 -DUNICODE -D_UNICODE -D_REENTRANT
INCLUDE=$(JAVA_HOME)/include
DEFS = -I$(INCLUDE) -I$(INCLUDE)/solaris
wrapper_SOURCE = wrapper.c wrapperinfo.c wrappereventloop.c wrapper_unix.c property.c logger.c logger_file.c wrapper_file.c wrapper_i18n.c wrapper_hashmap.c wrapper_ulimit.c wrapper_encoding.c wrapper_jvminfo.c
libwrapper_so_OBJECTS = wrapper_i18n.o wrapperjni_unix.o wrapperinfo.o wrapperjni.o loggerjni.o
BIN = ../../bin
LIB = ../../lib
all: init wrapper libwrapper.so
clean:
rm -f *.o
cleanall: clean
rm -rf *~ .deps
rm -f $(BIN)/wrapper $(LIB)/libwrapper.so
init:
if test ! -d .deps; then mkdir .deps; fi
wrapper: $(wrapper_SOURCE)
$(COMPILE) $(wrapper_SOURCE) -lsocket -lpthread -lnsl -lm -lposix4 -o $(BIN)/wrapper
#libwrapper.so: $(libwrapper_so_OBJECTS)
# ${COMPILE} -G -fPIC -lposix4 $(libwrapper_so_OBJECTS) -o $(LIB)/libwrapper.so
libwrapper.so: $(libwrapper_so_OBJECTS)
${COMPILE} -G -fPIC -lposix4 -lpthread $(libwrapper_so_OBJECTS) -o $(LIB)/libwrapper.so
%.o: %.c
${COMPILE} -c ${DEFS} $<
wrapper_3.5.51_src/src/c/Makefile-windows-x86-32.nmake 100644 0 0 7156 14333053647 17466 0 ustar 0 0 # Copyright (c) 1999, 2022 Tanuki Software, Ltd.
# http://www.tanukisoftware.com
# All rights reserved.
#
# This software is the proprietary information of Tanuki Software.
# You shall use it only in accordance with the terms of the
# license agreement you entered into with Tanuki Software.
# http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
!include makefile.inc
PROJ = wrapper
COMPILE = cl /D "WIN32" /D "NDEBUG" /FD /EHsc /MT /W3 /nologo /c /Zi /errorReport:prompt /D "_CRT_SECURE_NO_DEPRECATE" /D "UNICODE" /D "_UNICODE" /D "_WIN32_WINNT=0x0501"
LINK = link /NOLOGO /MANIFEST /DEBUG /MACHINE:X86 /ERRORREPORT:PROMPT DelayImp.lib
RC = rc
# EXE Definitions
EXE_OUTDIR = $(PROJ)32_VC8__Win32_Release
EXE_OBJS = $(EXE_OUTDIR)\wrapper.obj $(EXE_OUTDIR)\wrapperinfo.obj $(EXE_OUTDIR)\wrappereventloop.obj $(EXE_OUTDIR)\wrapper_win.obj $(EXE_OUTDIR)\property.obj $(EXE_OUTDIR)\logger.obj $(EXE_OUTDIR)\logger_file.obj $(EXE_OUTDIR)\wrapper_file.obj $(EXE_OUTDIR)\wrapper_i18n.obj $(EXE_OUTDIR)\wrapper_hashmap.obj $(EXE_OUTDIR)\wrapper_ulimit.obj $(EXE_OUTDIR)\wrapper_encoding.obj $(EXE_OUTDIR)\wrapper_jvminfo.obj
EXE_LIBS = mpr.lib shell32.lib netapi32.lib wsock32.lib Ws2_32.lib shlwapi.lib advapi32.lib user32.lib Crypt32.lib Wintrust.lib pdh.lib psapi.lib ole32.lib OleAut32.lib activeds.lib adsiid.lib
EXE_COMPILE_OPTS = /O2 /GL /D "_CONSOLE"
EXE_LINK_OPTS = /INCREMENTAL:NO /SUBSYSTEM:CONSOLE /MANIFESTFILE:"$(EXE_OUTDIR)\$(PROJ).exe.intermediate.manifest" /PDB:"$(EXE_OUTDIR)\$(PROJ).pdb" /OPT:REF /OPT:ICF /LTCG /DYNAMICBASE
# DLL Definitions
DLL_OUTDIR = $(PROJ)JNI32_VC8__Win32_Release
DLL_OBJS = $(DLL_OUTDIR)\wrapper_i18n.obj $(DLL_OUTDIR)\wrapperjni_win.obj $(DLL_OUTDIR)\wrapperinfo.obj $(DLL_OUTDIR)\wrapperjni.obj $(DLL_OUTDIR)\loggerjni.obj
DLL_LIBS = shell32.lib wsock32.lib advapi32.lib user32.lib Iphlpapi.lib
DLL_COMPILE_OPTS = /Od /I "..\" /I ".\" /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /D "_WINDOWS" /D "_USRDLL" /D "DECODERJNI_VC8_EXPORTS" /D "_WINDLL"
DLL_LINK_OPTS = /INCREMENTAL /DLL /SUBSYSTEM:WINDOWS /MANIFESTFILE:"$(DLL_OUTDIR)\$(PROJ).dll.intermediate.manifest" /PDB:"$(DLL_OUTDIR)\$(PROJ).pdb" /DYNAMICBASE /NXCOMPAT
all: $(EXE_OUTDIR) $(DLL_OUTDIR) $(PROJ).exe $(PROJ).dll
# Define project specific macros
#----- If OUTDIR does not exist, then create directory
$(EXE_OUTDIR) :
if not exist "$(EXE_OUTDIR)/$(NULL)" mkdir $(EXE_OUTDIR)
$(DLL_OUTDIR) :
if not exist "$(DLL_OUTDIR)/$(NULL)" mkdir $(DLL_OUTDIR)
# Inference rule for updating the object files
.c{$(EXE_OUTDIR)}.obj:
$(COMPILE) $(EXE_COMPILE_OPTS) /Fo"$(EXE_OUTDIR)\\" /Fd"$(EXE_OUTDIR)\\" $**
.c{$(DLL_OUTDIR)}.obj:
$(COMPILE) $(DLL_COMPILE_OPTS) /Fo"$(DLL_OUTDIR)\\" /Fd"$(DLL_OUTDIR)\\" $**
# Build rule for resource file
$(EXE_OUTDIR)\$(PROJ).res: $(PROJ).rc $(RC_DEP)
$(RC) /fo"$(EXE_OUTDIR)/$(PROJ).res" $(PROJ).rc
$(DLL_OUTDIR)\$(PROJ).res: $(PROJ).rc $(RC_DEP)
$(RC) /fo"$(DLL_OUTDIR)/$(PROJ).res" $(PROJ).rc
$(PROJ).exe: $(BASE_OBJS) $(EXE_OBJS) $(EXE_OUTDIR)\$(PROJ).res
$(LINK) $(EXE_LINK_OPTS) $(EXE_OBJS) $(EXE_LIBS) $(EXE_OUTDIR)\$(PROJ).res /OUT:"..\..\bin\$(PROJ).exe"
$(_VC_MANIFEST_EMBED_EXE)
$(PROJ).dll: $(BASE_OBJS) $(DLL_OBJS) $(DLL_OUTDIR)\$(PROJ).res
$(LINK) $(DLL_LINK_OPTS) $(DLL_OBJS) $(DLL_LIBS) $(DLL_OUTDIR)\$(PROJ).res /OUT:"..\..\lib\$(PROJ).dll"
$(_VC_MANIFEST_EMBED_DLL)
clean:
if exist $(EXE_OUTDIR)/$(NULL) rd /s /q $(EXE_OUTDIR)
if exist $(DLL_OUTDIR)/$(NULL) rd /s /q $(DLL_OUTDIR)
if exist ..\..\bin\$(PROJ).exe del /q ..\..\bin\$(PROJ).exe
if exist ..\..\lib\$(PROJ).dll del /q ..\..\lib\$(PROJ).dll
$(_VC_MANIFEST_CLEAN)
!include makefile.targ.inc
wrapper_3.5.51_src/src/c/Wrapper.rc 100644 0 0 7557 14333053647 14352 0 ustar 0 0 //Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// { resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN)
#ifdef _WIN32
LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT
#pragma code_page(932)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include \r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
// http://msdn.microsoft.com/en-us/library/aa381058%28VS.85%29.aspx
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,5,51,0
PRODUCTVERSION 3,5,51,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "000904b0"
BEGIN
VALUE "CompanyName", "Tanuki Software, Ltd."
VALUE "FileDescription", "Java Service Wrapper Community Edition 3.5.51"
VALUE "FileVersion", "3, 5, 51, 0"
VALUE "LegalCopyright", "Copyright (C) 1999, 2022 Tanuki Software, Ltd. All rights reserved."
VALUE "InternalName", "wrapper"
VALUE "OriginalFilename", "wrapper.exe"
VALUE "ProductName", "Java Service Wrapper Community"
VALUE "ProductVersion", "3, 5, 51, 0"
END
END
BLOCK "VarFileInfo"
BEGIN
/* The following line should only be modified for localized versions. */
/* It consists of any number of WORD,WORD pairs, with each pair */
/* describing a language,codepage combination supported by the file. */
/* */
/* For example, a file might have values "0x409,1252" indicating that it */
/* supports English language (0x409) in the Windows ANSI codepage (1252). */
VALUE "Translation", 0x9, 1200
//VALUE "Translation", 0x409, 1252
//VALUE "Translation", 0x411, 932
END
END
#endif // { resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// p (ض) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_WRAPPER ICON DISCARDABLE "wrapper.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Messages
//
1 11 DISCARDABLE "MSG00001.bin"
#endif // p (ض) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
wrapper_3.5.51_src/src/c/Wrapper32.dep.in 100644 0 0 1415 14333053647 15253 0 ustar 0 0 # Microsoft Developer Studio Generated Dependency File, included by Wrapper32.mak
.\logger.c : \
".\logger.h"\
".\messages.h"\
"@msvc.home@\vc98\include\basetsd.h"\
.\property.c : \
".\logger.h"\
".\property.h"\
"@msvc.home@\vc98\include\basetsd.h"\
.\wrapper.c : \
".\logger.h"\
".\property.h"\
".\wrapper.h"\
".\wrapperinfo.h"\
"@msvc.home@\vc98\include\basetsd.h"\
.\wrapper_win.c : \
".\logger.h"\
".\property.h"\
".\psapi.h"\
".\wrapper.h"\
".\wrapperinfo.h"\
"@msvc.home@\vc98\include\basetsd.h"\
.\wrappereventloop.c : \
".\logger.h"\
".\property.h"\
".\wrapper.h"\
"@msvc.home@\vc98\include\basetsd.h"\
.\wrapperinfo.c : \
".\wrapperinfo.h"\
.\messages.rc : \
".\MSG00001.bin"\
wrapper_3.5.51_src/src/c/Wrapper32.dsp 100644 0 0 12262 14333053647 14706 0 ustar 0 0 # Microsoft Developer Studio Project File - Name="Wrapper" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** ҏWȂł **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=Wrapper - Win32 Debug
!MESSAGE ͗LҲ̧قł͂܂B ۼުĂނ邽߂ɂ NMAKE gpĂB
!MESSAGE [Ҳ̧ق̴߰] ނgpĎsĂ
!MESSAGE
!MESSAGE NMAKE /f "Wrapper32.mak".
!MESSAGE
!MESSAGE NMAKE ̎sɍ\wł܂
!MESSAGE ײݏϸۂ̐ݒ`܂B:
!MESSAGE
!MESSAGE NMAKE /f "Wrapper32.mak" CFG="Wrapper - Win32 Debug"
!MESSAGE
!MESSAGE I\ Ӱ:
!MESSAGE
!MESSAGE "Wrapper - Win32 Release" ("Win32 (x86) Console Application" p)
!MESSAGE "Wrapper - Win32 Debug" ("Win32 (x86) Console Application" p)
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "Wrapper - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release32"
# PROP Intermediate_Dir "Release32"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x411 /d "NDEBUG"
# ADD RSC /l 0x411 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib shlwapi.lib /nologo /subsystem:console /machine:I386 /out:"../../bin/wrapper.exe"
!ELSEIF "$(CFG)" == "Wrapper - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug32"
# PROP Intermediate_Dir "Debug32"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "DEBUG" /FR /YX /FD /GZ /c
# ADD BASE RSC /l 0x411 /d "_DEBUG"
# ADD RSC /l 0x411 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib shlwapi.lib /nologo /subsystem:console /debug /machine:I386 /out:"../../bin/wrapper.exe" /pdbtype:sept
!ENDIF
# Begin Target
# Name "Wrapper - Win32 Release"
# Name "Wrapper - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\logger.c
# End Source File
# Begin Source File
SOURCE=.\property.c
# End Source File
# Begin Source File
SOURCE=.\wrapper.c
# End Source File
# Begin Source File
SOURCE=.\wrapper_unix.c
# End Source File
# Begin Source File
SOURCE=.\wrapper_win.c
# End Source File
# Begin Source File
SOURCE=.\wrappereventloop.c
# End Source File
# Begin Source File
SOURCE=.\wrapperinfo.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\logger.h
# End Source File
# Begin Source File
SOURCE=.\messages.h
# End Source File
# Begin Source File
SOURCE=.\property.h
# End Source File
# Begin Source File
SOURCE=.\psapi.h
# End Source File
# Begin Source File
SOURCE=.\resource.h
# End Source File
# Begin Source File
SOURCE=.\wrapper.h
# End Source File
# Begin Source File
SOURCE=.\wrapperinfo.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\MSG00001.bin
# End Source File
# Begin Source File
SOURCE=.\wrapper.ico
# End Source File
# Begin Source File
SOURCE=.\Wrapper32.rc
# PROP Exclude_From_Build 1
# End Source File
# End Group
# Begin Source File
SOURCE=.\messages.mc
# End Source File
# End Target
# End Project
wrapper_3.5.51_src/src/c/Wrapper32.dsw 100644 0 0 1342 14333053647 14672 0 ustar 0 0 Microsoft Developer Studio Workspace File, Format Version 6.00
# x: ܰ߰ ̧ ҏW܂͍폜Ȃł!
###############################################################################
Project: "Wrapper"=.\Wrapper.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "WrapperJNI"=.\WrapperJNI.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################
wrapper_3.5.51_src/src/c/Wrapper32.mak 100644 0 0 17036 14333053647 14674 0 ustar 0 0 # Microsoft Developer Studio Generated NMAKE File, Based on Wrapper32.dsp
!IF "$(CFG)" == ""
CFG=Wrapper - Win32 Debug
!MESSAGE Build mode not specified. Defaulting to "Wrapper - Win32 Debug".
!ENDIF
!IF "$(CFG)" != "Wrapper - Win32 Release" && "$(CFG)" != "Wrapper - Win32 Debug"
!MESSAGE The build target "$(CFG)" is invalid.
!MESSAGE Usage:
!MESSAGE
!MESSAGE NMAKE /f "Wrapper32.mak" CFG="Wrapper - Win32 Debug"
!MESSAGE
!MESSAGE Valid build modes:
!MESSAGE
!MESSAGE "Wrapper - Win32 Release" ("Win32 (x86) Console Application")
!MESSAGE "Wrapper - Win32 Debug" ("Win32 (x86) Console Application")
!MESSAGE
!ERROR Ivalid build mode.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "Wrapper - Win32 Release"
OUTDIR=.\Release32
INTDIR=.\Release32
ALL : "..\..\bin\wrapper.exe"
CLEAN :
-@erase "$(INTDIR)\logger.obj"
-@erase "$(INTDIR)\property.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(INTDIR)\wrapper.obj"
-@erase "$(INTDIR)\Wrapper.res"
-@erase "$(INTDIR)\wrapper_unix.obj"
-@erase "$(INTDIR)\wrapper_win.obj"
-@erase "$(INTDIR)\wrappereventloop.obj"
-@erase "$(INTDIR)\wrapperinfo.obj"
-@erase "..\..\bin\wrapper.exe"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"$(INTDIR)\Wrapper32.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\Wrapper.res" /d "NDEBUG"
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\Wrapper32.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib shlwapi.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\wrapper.pdb" /machine:I386 /out:"../../bin/wrapper.exe"
LINK32_OBJS= \
"$(INTDIR)\logger.obj" \
"$(INTDIR)\property.obj" \
"$(INTDIR)\wrapper.obj" \
"$(INTDIR)\wrapper_unix.obj" \
"$(INTDIR)\wrapper_win.obj" \
"$(INTDIR)\wrappereventloop.obj" \
"$(INTDIR)\wrapperinfo.obj" \
"$(INTDIR)\Wrapper.res"
"..\..\bin\wrapper.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "Wrapper - Win32 Debug"
OUTDIR=.\Debug32
INTDIR=.\Debug32
# Begin Custom Macros
OutDir=.\Debug32
# End Custom Macros
ALL : "..\..\bin\wrapper.exe" "$(OUTDIR)\Wrapper32.bsc"
CLEAN :
-@erase "$(INTDIR)\logger.obj"
-@erase "$(INTDIR)\logger.sbr"
-@erase "$(INTDIR)\property.obj"
-@erase "$(INTDIR)\property.sbr"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(INTDIR)\vc60.pdb"
-@erase "$(INTDIR)\wrapper.obj"
-@erase "$(INTDIR)\Wrapper.res"
-@erase "$(INTDIR)\wrapper.sbr"
-@erase "$(INTDIR)\wrapper_unix.obj"
-@erase "$(INTDIR)\wrapper_unix.sbr"
-@erase "$(INTDIR)\wrapper_win.obj"
-@erase "$(INTDIR)\wrapper_win.sbr"
-@erase "$(INTDIR)\wrappereventloop.obj"
-@erase "$(INTDIR)\wrappereventloop.sbr"
-@erase "$(INTDIR)\wrapperinfo.obj"
-@erase "$(INTDIR)\wrapperinfo.sbr"
-@erase "$(OUTDIR)\wrapper.pdb"
-@erase "$(OUTDIR)\Wrapper32.bsc"
-@erase "..\..\bin\wrapper.exe"
-@erase "..\..\bin\wrapper.ilk"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP_PROJ=/nologo /MLd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "DEBUG" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\Wrapper32.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\Wrapper.res" /d "_DEBUG"
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\Wrapper32.bsc"
BSC32_SBRS= \
"$(INTDIR)\logger.sbr" \
"$(INTDIR)\property.sbr" \
"$(INTDIR)\wrapper.sbr" \
"$(INTDIR)\wrapper_unix.sbr" \
"$(INTDIR)\wrapper_win.sbr" \
"$(INTDIR)\wrappereventloop.sbr" \
"$(INTDIR)\wrapperinfo.sbr"
"$(OUTDIR)\Wrapper32.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
$(BSC32) @<<
$(BSC32_FLAGS) $(BSC32_SBRS)
<<
LINK32=link.exe
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib shlwapi.lib /nologo /subsystem:console /incremental:yes /pdb:"$(OUTDIR)\wrapper.pdb" /debug /machine:I386 /out:"../../bin/wrapper.exe" /pdbtype:sept
LINK32_OBJS= \
"$(INTDIR)\logger.obj" \
"$(INTDIR)\property.obj" \
"$(INTDIR)\wrapper.obj" \
"$(INTDIR)\wrapper_unix.obj" \
"$(INTDIR)\wrapper_win.obj" \
"$(INTDIR)\wrappereventloop.obj" \
"$(INTDIR)\wrapperinfo.obj" \
"$(INTDIR)\Wrapper.res"
"..\..\bin\wrapper.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
.c{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
!IF "$(NO_EXTERNAL_DEPS)" != "1"
!IF EXISTS("Wrapper32.dep")
!INCLUDE "Wrapper32.dep"
!ELSE
!MESSAGE Warning: cannot find "Wrapper32.dep"
!ENDIF
!ENDIF
!IF "$(CFG)" == "Wrapper - Win32 Release" || "$(CFG)" == "Wrapper - Win32 Debug"
SOURCE=.\logger.c
!IF "$(CFG)" == "Wrapper - Win32 Release"
"$(INTDIR)\logger.obj" : $(SOURCE) "$(INTDIR)"
!ELSEIF "$(CFG)" == "Wrapper - Win32 Debug"
"$(INTDIR)\logger.obj" "$(INTDIR)\logger.sbr" : $(SOURCE) "$(INTDIR)"
!ENDIF
SOURCE=.\property.c
!IF "$(CFG)" == "Wrapper - Win32 Release"
"$(INTDIR)\property.obj" : $(SOURCE) "$(INTDIR)"
!ELSEIF "$(CFG)" == "Wrapper - Win32 Debug"
"$(INTDIR)\property.obj" "$(INTDIR)\property.sbr" : $(SOURCE) "$(INTDIR)"
!ENDIF
SOURCE=.\wrapper.c
!IF "$(CFG)" == "Wrapper - Win32 Release"
"$(INTDIR)\wrapper.obj" : $(SOURCE) "$(INTDIR)"
!ELSEIF "$(CFG)" == "Wrapper - Win32 Debug"
"$(INTDIR)\wrapper.obj" "$(INTDIR)\wrapper.sbr" : $(SOURCE) "$(INTDIR)"
!ENDIF
SOURCE=.\wrapper_unix.c
!IF "$(CFG)" == "Wrapper - Win32 Release"
"$(INTDIR)\wrapper_unix.obj" : $(SOURCE) "$(INTDIR)"
!ELSEIF "$(CFG)" == "Wrapper - Win32 Debug"
"$(INTDIR)\wrapper_unix.obj" "$(INTDIR)\wrapper_unix.sbr" : $(SOURCE) "$(INTDIR)"
!ENDIF
SOURCE=.\wrapper_win.c
!IF "$(CFG)" == "Wrapper - Win32 Release"
"$(INTDIR)\wrapper_win.obj" : $(SOURCE) "$(INTDIR)"
!ELSEIF "$(CFG)" == "Wrapper - Win32 Debug"
"$(INTDIR)\wrapper_win.obj" "$(INTDIR)\wrapper_win.sbr" : $(SOURCE) "$(INTDIR)"
!ENDIF
SOURCE=.\wrappereventloop.c
!IF "$(CFG)" == "Wrapper - Win32 Release"
"$(INTDIR)\wrappereventloop.obj" : $(SOURCE) "$(INTDIR)"
!ELSEIF "$(CFG)" == "Wrapper - Win32 Debug"
"$(INTDIR)\wrappereventloop.obj" "$(INTDIR)\wrappereventloop.sbr" : $(SOURCE) "$(INTDIR)"
!ENDIF
SOURCE=.\wrapperinfo.c
!IF "$(CFG)" == "Wrapper - Win32 Release"
"$(INTDIR)\wrapperinfo.obj" : $(SOURCE) "$(INTDIR)"
!ELSEIF "$(CFG)" == "Wrapper - Win32 Debug"
"$(INTDIR)\wrapperinfo.obj" "$(INTDIR)\wrapperinfo.sbr" : $(SOURCE) "$(INTDIR)"
!ENDIF
SOURCE=.\Wrapper.rc
!IF "$(CFG)" == "Wrapper - Win32 Release"
"$(INTDIR)\Wrapper.res" : $(SOURCE) "$(INTDIR)"
$(RSC) /l 0x409 /fo"$(INTDIR)\Wrapper.res" /d "NDEBUG" $(SOURCE)
!ELSEIF "$(CFG)" == "Wrapper - Win32 Debug"
"$(INTDIR)\Wrapper.res" : $(SOURCE) "$(INTDIR)"
$(RSC) /l 0x411 /fo"$(INTDIR)\Wrapper.res" /d "_DEBUG" $(SOURCE)
!ENDIF
!ENDIF
wrapper_3.5.51_src/src/c/Wrapper32.plg 100644 0 0 2745 14333053647 14667 0 ustar 0 0
ނ۸
--------------------\: Wrapper - Win32 Debug--------------------
ײ
ꎞ̧ "C:\DOCUME~1\leif\LOCALS~1\Temp\RSP3E.tmp" 쐬A̓eL^܂
[
/nologo /MLd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "DEBUG" /FR"Debug32/" /Fp"Debug32/Wrapper32.pch" /YX /Fo"Debug32/" /Fd"Debug32/" /FD /GZ /c
"C:\SourceForge\wrapper\src\c\wrapper.c"
"C:\SourceForge\wrapper\src\c\wrapper_unix.c"
"C:\SourceForge\wrapper\src\c\wrapper_win.c"
"C:\SourceForge\wrapper\src\c\wrappereventloop.c"
]
Creating command line "cl.exe @C:\DOCUME~1\leif\LOCALS~1\Temp\RSP3E.tmp"
ꎞ̧ "C:\DOCUME~1\leif\LOCALS~1\Temp\RSP3F.tmp" 쐬A̓eL^܂
[
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib shlwapi.lib /nologo /subsystem:console /incremental:yes /pdb:"Debug32/wrapper.pdb" /debug /machine:I386 /out:"../../bin/wrapper.exe" /pdbtype:sept
.\Debug32\logger.obj
.\Debug32\property.obj
.\Debug32\wrapper.obj
.\Debug32\wrapper_unix.obj
.\Debug32\wrapper_win.obj
.\Debug32\wrappereventloop.obj
.\Debug32\wrapperinfo.obj
]
ײ "link.exe @C:\DOCUME~1\leif\LOCALS~1\Temp\RSP3F.tmp" ̍쐬
߯
ْ߲...
wrapper.c
wrapper_unix.c
wrapper_win.c
wrappereventloop.c
ݸ...
wrapper.exe - װ 0Ax 0
wrapper_3.5.51_src/src/c/WrapperJNI32.dep.in 100644 0 0 764 14333053647 15602 0 ustar 0 0 # Microsoft Developer Studio Generated Dependency File, included by WrapperJNI32.mak
.\wrapperinfo.c : \
".\wrapperinfo.h"\
.\wrapperjni.c : \
".\org_tanukisoftware_wrapper_WrapperManager.h"\
".\wrapperinfo.h"\
".\wrapperjni.h"\
"@msvc.home@\vc98\include\basetsd.h"\
"@jni.h@"\
"@jni_md.h@"\
.\wrapperjni_win.c : \
".\org_tanukisoftware_wrapper_WrapperManager.h"\
".\wrapperjni.h"\
"@msvc.home@\vc98\include\basetsd.h"\
"@jni.h@"\
"@jni_md.h@"\
wrapper_3.5.51_src/src/c/WrapperJNI32.dsp 100644 0 0 11527 14333053647 15252 0 ustar 0 0 # Microsoft Developer Studio Project File - Name="WrapperJNI" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** ҏWȂł **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=WrapperJNI - Win32 Debug
!MESSAGE ͗LҲ̧قł͂܂B ۼުĂނ邽߂ɂ NMAKE gpĂB
!MESSAGE [Ҳ̧ق̴߰] ނgpĎsĂ
!MESSAGE
!MESSAGE NMAKE /f "WrapperJNI.mak".
!MESSAGE
!MESSAGE NMAKE ̎sɍ\wł܂
!MESSAGE ײݏϸۂ̐ݒ`܂B:
!MESSAGE
!MESSAGE NMAKE /f "WrapperJNI.mak" CFG="WrapperJNI - Win32 Debug"
!MESSAGE
!MESSAGE I\ Ӱ:
!MESSAGE
!MESSAGE "WrapperJNI - Win32 Release" ("Win32 (x86) Dynamic-Link Library" p)
!MESSAGE "WrapperJNI - Win32 Debug" ("Win32 (x86) Dynamic-Link Library" p)
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "WrapperJNI - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "WrapperJNI___Win32_Release"
# PROP BASE Intermediate_Dir "WrapperJNI___Win32_Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "WrapperJNI___Win32_Release32"
# PROP Intermediate_Dir "WrapperJNI___Win32_Release32"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WRAPPERJNI_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "D:\Sun\j2sdk1.4.0_03\include\\" /I "D:\Sun\j2sdk1.4.0_03\include\win32\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WRAPPERJNI_EXPORTS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x411 /d "NDEBUG"
# ADD RSC /l 0x411 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"../../lib/wrapper.dll"
!ELSEIF "$(CFG)" == "WrapperJNI - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "WrapperJNI___Win32_Debug"
# PROP BASE Intermediate_Dir "WrapperJNI___Win32_Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "WrapperJNI___Win32_Debug32"
# PROP Intermediate_Dir "WrapperJNI___Win32_Debug32"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WRAPPERJNI_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "D:\Sun\j2sdk1.4.0_03\include\\" /I "D:\Sun\j2sdk1.4.0_03\include\win32\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WRAPPERJNI_EXPORTS" /FR /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x411 /d "_DEBUG"
# ADD RSC /l 0x411 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"../../lib/wrapper.dll" /pdbtype:sept
!ENDIF
# Begin Target
# Name "WrapperJNI - Win32 Release"
# Name "WrapperJNI - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\wrapperinfo.c
# End Source File
# Begin Source File
SOURCE=.\wrapperjni.c
# End Source File
# Begin Source File
SOURCE=.\wrapperjni_unix.c
# End Source File
# Begin Source File
SOURCE=.\wrapperjni_win.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\org_tanukisoftware_wrapper_WrapperManager.h
# End Source File
# Begin Source File
SOURCE=.\wrapperinfo.h
# End Source File
# Begin Source File
SOURCE=.\wrapperjni.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
wrapper_3.5.51_src/src/c/WrapperJNI32.mak.in 100644 0 0 14340 14333053647 15635 0 ustar 0 0 # Microsoft Developer Studio Generated NMAKE File, Based on WrapperJNI32.dsp
!IF "$(CFG)" == ""
CFG=WrapperJNI - Win32 Debug
!MESSAGE Build mode not specified. Defaulting to "WrapperJNI - Win32 Debug".
!ENDIF
!IF "$(CFG)" != "WrapperJNI - Win32 Release" && "$(CFG)" != "WrapperJNI - Win32 Debug"
!MESSAGE The build target "$(CFG)" is invalid.
!MESSAGE Usage:
!MESSAGE
!MESSAGE NMAKE /f "WrapperJNI32.mak" CFG="WrapperJNI - Win32 Debug"
!MESSAGE
!MESSAGE Valid build modes:
!MESSAGE
!MESSAGE "WrapperJNI - Win32 Release" ("Win32 (x86) Dynamic-Link Library")
!MESSAGE "WrapperJNI - Win32 Debug" ("Win32 (x86) Dynamic-Link Library")
!MESSAGE
!ERROR Ivalid build mode.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "WrapperJNI - Win32 Release"
OUTDIR=.\WrapperJNI___Win32_Release32
INTDIR=.\WrapperJNI___Win32_Release32
ALL : "..\..\lib\wrapper.dll"
CLEAN :
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(INTDIR)\wrapperinfo.obj"
-@erase "$(INTDIR)\wrapperjni.obj"
-@erase "$(INTDIR)\wrapperjni_unix.obj"
-@erase "$(INTDIR)\wrapperjni_win.obj"
-@erase "$(OUTDIR)\wrapper.exp"
-@erase "$(OUTDIR)\wrapper.lib"
-@erase "..\..\lib\wrapper.dll"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "@java.home@\include\\" /I "@java.home@\include\win32\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WRAPPERJNI_EXPORTS" /Fp"$(INTDIR)\WrapperJNI32.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\WrapperJNI32.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:no /pdb:"$(OUTDIR)\wrapper.pdb" /machine:I386 /out:"../../lib/wrapper.dll" /implib:"$(OUTDIR)\wrapper.lib"
LINK32_OBJS= \
"$(INTDIR)\wrapperinfo.obj" \
"$(INTDIR)\wrapperjni.obj" \
"$(INTDIR)\wrapperjni_unix.obj" \
"$(INTDIR)\wrapperjni_win.obj"
"..\..\lib\wrapper.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "WrapperJNI - Win32 Debug"
OUTDIR=.\WrapperJNI___Win32_Debug32
INTDIR=.\WrapperJNI___Win32_Debug32
# Begin Custom Macros
OutDir=.\WrapperJNI___Win32_Debug32
# End Custom Macros
ALL : "..\..\lib\wrapper.dll" "$(OUTDIR)\WrapperJNI32.bsc"
CLEAN :
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(INTDIR)\vc60.pdb"
-@erase "$(INTDIR)\wrapperinfo.obj"
-@erase "$(INTDIR)\wrapperinfo.sbr"
-@erase "$(INTDIR)\wrapperjni.obj"
-@erase "$(INTDIR)\wrapperjni.sbr"
-@erase "$(INTDIR)\wrapperjni_unix.obj"
-@erase "$(INTDIR)\wrapperjni_unix.sbr"
-@erase "$(INTDIR)\wrapperjni_win.obj"
-@erase "$(INTDIR)\wrapperjni_win.sbr"
-@erase "$(OUTDIR)\wrapper.exp"
-@erase "$(OUTDIR)\wrapper.lib"
-@erase "$(OUTDIR)\wrapper.pdb"
-@erase "$(OUTDIR)\WrapperJNI32.bsc"
-@erase "..\..\lib\wrapper.dll"
-@erase "..\..\lib\wrapper.ilk"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "@java.home@\include\\" /I "@java.home@\include\win32\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WRAPPERJNI_EXPORTS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\WrapperJNI32.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\WrapperJNI32.bsc"
BSC32_SBRS= \
"$(INTDIR)\wrapperinfo.sbr" \
"$(INTDIR)\wrapperjni.sbr" \
"$(INTDIR)\wrapperjni_unix.sbr" \
"$(INTDIR)\wrapperjni_win.sbr"
"$(OUTDIR)\WrapperJNI32.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
$(BSC32) @<<
$(BSC32_FLAGS) $(BSC32_SBRS)
<<
LINK32=link.exe
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /pdb:"$(OUTDIR)\wrapper.pdb" /debug /machine:I386 /out:"../../lib/wrapper.dll" /implib:"$(OUTDIR)\wrapper.lib" /pdbtype:sept
LINK32_OBJS= \
"$(INTDIR)\wrapperinfo.obj" \
"$(INTDIR)\wrapperjni.obj" \
"$(INTDIR)\wrapperjni_unix.obj" \
"$(INTDIR)\wrapperjni_win.obj"
"..\..\lib\wrapper.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
.c{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
!IF "$(NO_EXTERNAL_DEPS)" != "1"
!IF EXISTS("WrapperJNI32.dep")
!INCLUDE "WrapperJNI32.dep"
!ELSE
!MESSAGE Warning: cannot find "WrapperJNI32.dep"
!ENDIF
!ENDIF
!IF "$(CFG)" == "WrapperJNI - Win32 Release" || "$(CFG)" == "WrapperJNI - Win32 Debug"
SOURCE=.\wrapperinfo.c
!IF "$(CFG)" == "WrapperJNI - Win32 Release"
"$(INTDIR)\wrapperinfo.obj" : $(SOURCE) "$(INTDIR)"
!ELSEIF "$(CFG)" == "WrapperJNI - Win32 Debug"
"$(INTDIR)\wrapperinfo.obj" "$(INTDIR)\wrapperinfo.sbr" : $(SOURCE) "$(INTDIR)"
!ENDIF
SOURCE=.\wrapperjni.c
!IF "$(CFG)" == "WrapperJNI - Win32 Release"
"$(INTDIR)\wrapperjni.obj" : $(SOURCE) "$(INTDIR)"
!ELSEIF "$(CFG)" == "WrapperJNI - Win32 Debug"
"$(INTDIR)\wrapperjni.obj" "$(INTDIR)\wrapperjni.sbr" : $(SOURCE) "$(INTDIR)"
!ENDIF
SOURCE=.\wrapperjni_unix.c
!IF "$(CFG)" == "WrapperJNI - Win32 Release"
"$(INTDIR)\wrapperjni_unix.obj" : $(SOURCE) "$(INTDIR)"
!ELSEIF "$(CFG)" == "WrapperJNI - Win32 Debug"
"$(INTDIR)\wrapperjni_unix.obj" "$(INTDIR)\wrapperjni_unix.sbr" : $(SOURCE) "$(INTDIR)"
!ENDIF
SOURCE=.\wrapperjni_win.c
!IF "$(CFG)" == "WrapperJNI - Win32 Release"
"$(INTDIR)\wrapperjni_win.obj" : $(SOURCE) "$(INTDIR)"
!ELSEIF "$(CFG)" == "WrapperJNI - Win32 Debug"
"$(INTDIR)\wrapperjni_win.obj" "$(INTDIR)\wrapperjni_win.sbr" : $(SOURCE) "$(INTDIR)"
!ENDIF
!ENDIF
wrapper_3.5.51_src/src/c/WrapperJNI32.plg 100644 0 0 3475 14333053647 15231 0 ustar 0 0
ނ۸
--------------------\: WrapperJNI - Win32 Debug--------------------
ײ
ꎞ̧ "C:\DOCUME~1\leif\LOCALS~1\Temp\RSP321.tmp" 쐬A̓eL^܂
[
/nologo /MTd /W3 /Gm /GX /ZI /Od /I "C:\Sun\j2sdk1.4.2_08\include\\" /I "C:\Sun\j2sdk1.4.2_08\include\win32\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WRAPPERJNI_EXPORTS" /FR"WrapperJNI___Win32_Debug32/" /Fp"WrapperJNI___Win32_Debug32/WrapperJNI32.pch" /YX /Fo"WrapperJNI___Win32_Debug32/" /Fd"WrapperJNI___Win32_Debug32/" /FD /GZ /c
"D:\SourceForge\wrapper\src\c\wrapperinfo.c"
"D:\SourceForge\wrapper\src\c\wrapperjni.c"
"D:\SourceForge\wrapper\src\c\wrapperjni_unix.c"
"D:\SourceForge\wrapper\src\c\wrapperjni_win.c"
]
Creating command line "cl.exe @C:\DOCUME~1\leif\LOCALS~1\Temp\RSP321.tmp"
ꎞ̧ "C:\DOCUME~1\leif\LOCALS~1\Temp\RSP322.tmp" 쐬A̓eL^܂
[
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /pdb:"WrapperJNI___Win32_Debug32/wrapper.pdb" /debug /machine:I386 /out:"../../lib/wrapper.dll" /implib:"WrapperJNI___Win32_Debug32/wrapper.lib" /pdbtype:sept
.\WrapperJNI___Win32_Debug32\wrapperinfo.obj
.\WrapperJNI___Win32_Debug32\wrapperjni.obj
.\WrapperJNI___Win32_Debug32\wrapperjni_unix.obj
.\WrapperJNI___Win32_Debug32\wrapperjni_win.obj
]
ײ "link.exe @C:\DOCUME~1\leif\LOCALS~1\Temp\RSP322.tmp" ̍쐬
߯
ْ߲...
wrapperinfo.c
wrapperjni.c
wrapperjni_unix.c
wrapperjni_win.c
ݸ...
ײ WrapperJNI___Win32_Debug32/wrapper.lib Ƶު WrapperJNI___Win32_Debug32/wrapper.exp 쐬
wrapper.dll - װ 0Ax 0
wrapper_3.5.51_src/src/c/logger.c 100644 0 0 506706 14333053650 14061 0 ustar 0 0 /*
* Copyright (c) 1999, 2022 Tanuki Software, Ltd.
* http://www.tanukisoftware.com
* All rights reserved.
*
* This software is the proprietary information of Tanuki Software.
* You shall use it only in accordance with the terms of the
* license agreement you entered into with Tanuki Software.
* http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
*
*
* Portions of the Software have been derived from source code
* developed by Silver Egg Technology under the following license:
*
* Copyright (c) 2001 Silver Egg Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sub-license, and/or
* sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*/
/**
* Author:
* Johan Sorlin
* Leif Mortenson
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include "logger_file.h"
#ifdef WIN32
#include
#include
#include
#include
#include
#include
#include "messages.h"
/* MS Visual Studio 8 went and deprecated the POXIX names for functions.
* Fixing them all would be a big headache for UNIX versions. */
#pragma warning(disable : 4996)
/* Defines for MS Visual Studio 6 */
#ifndef _INTPTR_T_DEFINED
typedef long intptr_t;
#define _INTPTR_T_DEFINED
#endif
#else
#include
#include
#include
#include
#include
#if defined(SOLARIS)
#include
#include
#elif defined(AIX) || defined(HPUX) || defined(MACOSX)
#elif defined(FREEBSD)
#include
#include
#else /* LINUX */
#include
#include
#endif
#endif
#include "wrapper_i18n.h"
#include "logger.h"
#ifndef TRUE
#define TRUE -1
#endif
#ifndef FALSE
#define FALSE 0
#endif
TCHAR* defaultLogFile;
#ifdef WIN32
const TCHAR* syslogName = TEXT("Event Log");
#else
const TCHAR* syslogName = TEXT("syslog");
#endif
/* Global data for logger */
/* Maximum number of milliseconds that a log write can take before we show a warning. */
int logPrintfWarnThreshold = 0;
/* Number of millisecoonds which the previous log message took to process. */
time_t previousLogLag;
/* Keep track of when the last log entry was made so we can show the information in the log. */
time_t previousNow;
int previousNowMillis;
/* Initialize all log levels to unknown until they are set */
int currentConsoleLevel = LEVEL_UNKNOWN;
int currentLogfileLevel = LEVEL_UNKNOWN;
int currentLoginfoLevel = LEVEL_UNKNOWN;
int currentLogSplitMessages = FALSE;
int currentLogRegister = TRUE;
/* Default syslog facility is LOG_USER */
int currentLogfacilityLevel = LOG_USER;
/* Callback notified whenever the active logfile changes. */
void (*logFileChangedCallback)(const TCHAR *logFile);
/* Callback to support additional logging format. */
int (*logFormatCountCallback)(const TCHAR format, size_t *reqSize);
int (*logFormatPrintCallback)(const TCHAR format, size_t printSize, TCHAR** pBuffer);
/* Stores a carefully malloced filename of the most recent log file change. This value is only set in log_printf(), and only cleared in maintainLogger(). */
TCHAR *pendingLogFileChange = NULL;
int logPauseTime = -1;
int logBufferGrowth = FALSE;
TCHAR *logFilePath;
int logFilePathHasDateToken = FALSE;
/* Keep track if the log file path has changed since we last opened the log file. */
int logFilePathChanged;
/* Keep track if the configured log file path has changed since we last opened the log file. */
int confLogFilePathChanged;
/* Keep track if the log file was set from the configuration file or generated by the logging. */
int logFilePathSetFromConf = FALSE;
/* Size of the currentLogFileName and workLogFileName buffers. */
size_t currentLogFileNameSize;
TCHAR *currentLogFileName;
TCHAR *workLogFileName;
size_t confLogFileNameSize;
TCHAR *confLogFileName;
TCHAR *workConfLogFileName;
int confLogFileLevelInt = LEVEL_UNKNOWN;
int whichLogFile;
#define LOG_FILE_UNSET 0
#define LOG_FILE_CONFIGURED 1
#define LOG_FILE_DEFAULT 2
#define LOG_FILE_DISABLED 3
int logFileRollMode = ROLL_MODE_SIZE;
int confLogFileRollMode = ROLL_MODE_SIZE;
int logFileUmask = 0022;
#ifndef WIN32
int logFileGroup = -1; /* -1 means the group is unchanged */
#endif
TCHAR *logLevelNames[] = { TEXT("NONE "), TEXT("DEBUG "), TEXT("INFO "), TEXT("STATUS"), TEXT("WARN "), TEXT("ERROR "), TEXT("FATAL "), TEXT("ADVICE"), TEXT("NOTICE") };
#ifdef WIN32
TCHAR *defaultLoginfoSourceName = TEXT("wrapper");
TCHAR *loginfoSourceName = NULL;
#else
char *defaultLoginfoSourceName = "wrapper";
char *loginfoSourceName = NULL;
#endif
int logFileMaxSize = -1;
int confLogFileMaxSize = -1;
int logFileMaxLogFiles = -1;
int confLogFileMaxLogFiles = -1;
TCHAR *logFilePurgePattern = NULL;
int logFilePurgeSortMode = LOGGER_FILE_SORT_MODE_TIMES;
TCHAR logFileLastNowDate[9];
int enabledDestinationsMask = LOG_DESTINATION_ALL;
static int savedLogfileLevel;
static int savedConsoleLevel;
static int savedLoginfoLevel;
/* Defualt formats (Must be 4 chars) */
TCHAR consoleFormat[32];
TCHAR logfileFormat[32];
/* Flag to keep track of whether the console output should be flushed or not. */
int consoleFlush = FALSE;
#ifdef WIN32
/* Flag to keep track of whether we should write directly to the console or not. */
int consoleDirect = TRUE;
#endif
/* Flags to contol where error log level output goes to the console. */
int consoleFatalToStdErr = TRUE;
int consoleErrorToStdErr = TRUE;
int consoleWarnToStdErr = FALSE;
/* Number of seconds since the Wrapper was launched. */
int uptimeSeconds = 0;
/* TRUE once the uptime is so large that it is meaningless. */
int uptimeFlipped = FALSE;
int isPreload = FALSE;
/* Internal function declaration */
#ifdef WIN32
void sendEventlogMessage( int source_id, int level, const TCHAR *szBuff );
#else
void sendLoginfoMessage( int source_id, int level, const TCHAR *szBuff );
#endif
#ifdef WIN32
int writeToConsole( HANDLE hdl, const TCHAR *lpszFmt, ...);
#endif
int doesFtellCauseMemoryLeak();
void checkAndRollLogs(const TCHAR *nowDate, size_t printBufferSize);
int lockLoggingMutex();
int releaseLoggingMutex();
#if defined(UNICODE) && !defined(WIN32)
TCHAR formatMessages[WRAPPER_THREAD_COUNT][QUEUED_BUFFER_SIZE];
#endif
int queueWrapped[WRAPPER_THREAD_COUNT];
int queueWriteIndex[WRAPPER_THREAD_COUNT];
int queueReadIndex[WRAPPER_THREAD_COUNT];
TCHAR queueMessages[WRAPPER_THREAD_COUNT][QUEUE_SIZE][QUEUED_BUFFER_SIZE];
int queueSourceIds[WRAPPER_THREAD_COUNT][QUEUE_SIZE];
int queueLevels[WRAPPER_THREAD_COUNT][QUEUE_SIZE];
/* Thread specific work buffers. */
int threadSets[WRAPPER_THREAD_COUNT];
#ifdef WIN32
DWORD threadIds[WRAPPER_THREAD_COUNT];
#else
pthread_t threadIds[WRAPPER_THREAD_COUNT];
#endif
TCHAR *threadMessageBuffer = NULL;
size_t threadMessageBufferSize = 0;
size_t threadMessageBufferInitialSize = 100;
TCHAR *threadPrintBuffer = NULL;
size_t threadPrintBufferSize = 0;
#ifdef WIN32
int launcherSource = FALSE;
#endif
/* Flag which gets set when a log entry is written to the log file. */
int logFileAccessed = FALSE;
/* Logger file pointer. It is kept open under high log loads but closed whenever it has been idle. */
FILE *logfileFP = NULL;
/** Flag which controls whether or not the logfile is auto flushed after each line. */
int autoFlushLogfile = TRUE;
/** Flag which controls whether or not the logfile is auto closed after each line. */
int autoCloseLogfile = 0;
/* The number of lines sent to the log file since the getLogfileActivity method was last called. */
DWORD logfileActivityCount = 0;
/* Mutex for synchronization of the log_printf function. */
#ifdef WIN32
HANDLE log_printfMutexHandle = NULL;
#else
pthread_mutex_t log_printfMutex = PTHREAD_MUTEX_INITIALIZER;
#endif
void outOfMemory(const TCHAR *context, int id) {
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_FATAL, TEXT("Out of memory (%s%02d). %s"),
context, id, getLastErrorText());
}
/* This can be called from within logging code that would otherwise get stuck in recursion.
* Log to the console exactly when it happens and then also try to get it into the log
* file at the next oportunity. */
void outOfMemoryQueued(const TCHAR *context, int id) {
_tprintf(TEXT("Out of memory (%s%02d). %s\n"), context, id, getLastErrorText());
log_printf_queue(TRUE, WRAPPER_SOURCE_WRAPPER, LEVEL_FATAL, TEXT("Out of memory (%s%02d). %s"),
context, id, getLastErrorText());
}
#ifdef _DEBUG
/**
* Used to dump memory directly to the log file in both HEX and readable format.
* Useful in debugging applications to track down memory overflows etc.
*
* @param label A label that will be prepended on all lines of output.
* @param memory The memory to be dumped.
* @param len The length of the memory to be dumped.
*/
void log_dumpHex(TCHAR *label, TCHAR *memory, size_t len) {
TCHAR *buffer;
TCHAR *pos;
size_t i;
int c;
buffer = malloc(sizeof(TCHAR) * (len * 3 + 1));
if (!buffer) {
outOfMemory(TEXT("DH"), 1);
}
pos = buffer;
for (i = 0; i < len; i++) {
c = memory[i] & 0xff;
_sntprintf(pos, 4, TEXT("%02x "), c);
pos += 3;
}
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_INFO, TEXT("%s (HEX) = %s"), label, buffer);
pos = buffer;
for (i = 0; i < len; i++) {
c = memory[i] & 0xff;
if (c == 0) {
_sntprintf(pos, 4, TEXT("\\0 "));
} else if (c <= 26) {
_sntprintf(pos, 4, TEXT("\\%c "), TEXT('a') + c - 1);
} else if (c < 127) {
_sntprintf(pos, 4, TEXT("%c "), c);
} else {
_sntprintf(pos, 4, TEXT(". "));
}
pos += 3;
}
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_INFO, TEXT("%s (CHAR) = %s"), label, buffer);
free(buffer);
}
#endif
void invalidMultiByteSequence(const TCHAR *context, int id) {
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_ERROR, TEXT("Invalid multibyte Sequence found in (%s%02d). %s"),
context, id, getLastErrorText());
}
/**
* Replaces one token with another. The length of the new token must be equal
* to or less than that of the old token.
*
* newToken may be null, implying "".
*/
TCHAR *replaceStringLongWithShort(TCHAR *string, const TCHAR *oldToken, const TCHAR *newToken) {
size_t oldLen = _tcslen(oldToken);
size_t newLen;
TCHAR *in = string;
TCHAR *out = string;
if (newToken) {
newLen = _tcslen(newToken);
} else {
newLen = 0;
}
/* Assertion check. */
if (newLen > oldLen) {
return string;
}
while (in[0] != L'\0') {
if (_tcsncmp(in, oldToken, oldLen) == 0) {
/* Found the oldToken. Replace it with the new. */
if (newLen > 0) {
_tcsncpy(out, newToken, newLen);
}
in += oldLen;
out += newLen;
}
else
{
out[0] = in[0];
in++;
out++;
}
}
out[0] = L'\0';
return string;
}
static int isInitialized = FALSE;
/**
* Return TRUE if the logging is initialized, FALSE otherwise.
*/
int isLogInitialized() {
return isInitialized;
}
/**
* Initializes the logger. Returns 0 if the operation was successful.
*/
int initLogging(void (*logFileChanged)(const TCHAR *logFile)) {
int threadId, i;
logFileChangedCallback = logFileChanged;
#ifdef WIN32
if (!(log_printfMutexHandle = CreateMutex(NULL, FALSE, NULL))) {
_tprintf(TEXT("Failed to create logging mutex. %s\n"), getLastErrorText());
return 1;
}
#endif
defaultLogFile = malloc(sizeof(TCHAR) * 12);
if (!defaultLogFile) {
_tprintf(TEXT("Out of memory in logging code (%s)\n"), TEXT("IL1"));
return 1;
}
_tcsncpy(defaultLogFile, TEXT("wrapper.log"), 12);
defaultLogFile[11] = TEXT('\0');
logPauseTime = -1;
loginfoSourceName = defaultLoginfoSourceName;
logFileAccessed = FALSE;
logFileLastNowDate[0] = L'\0';
for ( threadId = 0; threadId < WRAPPER_THREAD_COUNT; threadId++ ) {
threadSets[threadId] = FALSE;
/* threadIds[threadId] = 0; */
#if defined(UNICODE) && !defined(WIN32)
formatMessages[threadId][0] = TEXT('\0');
#endif
for ( i = 0; i < QUEUE_SIZE; i++ )
{
queueWrapped[threadId] = 0;
queueWriteIndex[threadId] = 0;
queueReadIndex[threadId] = 0;
queueMessages[threadId][i][0] = TEXT('\0');
queueSourceIds[threadId][i] = 0;
queueLevels[threadId][i] = 0;
}
}
isInitialized = TRUE;
return 0;
}
/**
* Disposes of any logging resouces prior to shutdown.
*/
int disposeLogging() {
isInitialized = FALSE;
#ifdef WIN32
if (log_printfMutexHandle) {
if (!CloseHandle(log_printfMutexHandle)) {
_tprintf(TEXT("Unable to close Logging Mutex handle. %s\n"), getLastErrorText());
return 1;
}
}
#endif
if (threadPrintBuffer && threadPrintBufferSize > 0) {
free(threadPrintBuffer);
threadPrintBuffer = NULL;
threadPrintBufferSize = 0;
}
if (threadMessageBuffer && threadMessageBufferSize > 0) {
free(threadMessageBuffer);
threadMessageBuffer = NULL;
threadMessageBufferSize = 0;
}
if (defaultLogFile) {
free(defaultLogFile);
defaultLogFile = NULL;
}
if (logFilePath) {
free(logFilePath);
logFilePath = NULL;
}
if (currentLogFileName) {
free(currentLogFileName);
currentLogFileName = NULL;
}
if (confLogFileName) {
free(confLogFileName);
confLogFileName = NULL;
}
if (workLogFileName) {
free(workLogFileName);
workLogFileName = NULL;
}
if (workConfLogFileName) {
free(workConfLogFileName);
workConfLogFileName = NULL;
}
if (pendingLogFileChange) {
free(pendingLogFileChange);
pendingLogFileChange = NULL;
}
if ((loginfoSourceName != defaultLoginfoSourceName) && (loginfoSourceName != NULL)) {
free(loginfoSourceName);
loginfoSourceName = NULL;
}
if (logFilePurgePattern) {
free(logFilePurgePattern);
logFilePurgePattern = NULL;
}
if (logfileFP) {
fclose(logfileFP);
logfileFP = NULL;
}
return 0;
}
void logRegisterFormatCallbacks(int (*countCallback)(const TCHAR format, size_t *reqSize),
int (*printCallback)(const TCHAR format, size_t printSize, TCHAR** pBuffer)) {
logFormatCountCallback = countCallback;
logFormatPrintCallback = printCallback;
}
/** Registers the calling thread so it can be recognized when it calls
* again later. */
void logRegisterThread( int thread_id ) {
#ifdef WIN32
DWORD threadId;
threadId = GetCurrentThreadId();
#else
pthread_t threadId;
threadId = pthread_self();
#endif
#ifdef _DEBUG
_tprintf(TEXT("logRegisterThread(%d)\n"), thread_id);
#endif
if ( thread_id >= 0 && thread_id < WRAPPER_THREAD_COUNT )
{
threadSets[thread_id] = TRUE;
threadIds[thread_id] = threadId;
#ifdef _DEBUG
_tprintf(TEXT("logRegisterThread(%d) found\n"), thread_id);
#endif
}
}
int getThreadId() {
int i;
#ifdef WIN32
DWORD threadId;
threadId = GetCurrentThreadId();
#else
pthread_t threadId;
threadId = pthread_self();
#endif
/*_tprintf(TEXT("threadId=%lu\n"), threadId );*/
for ( i = 0; i < WRAPPER_THREAD_COUNT; i++ ) {
#ifdef WIN32
if (threadSets[i] && (threadIds[i] == threadId)) {
#else
if (threadSets[i] && pthread_equal(threadIds[i], threadId)) {
#endif
return i;
}
}
_tprintf( TEXT("WARNING - Encountered an unknown thread %ld in getThreadId().\n"),
(long int)threadId
);
return 0; /* WRAPPER_THREAD_SIGNAL */
}
int getLogfileRollModeForName( const TCHAR *logfileRollName ) {
if (strcmpIgnoreCase(logfileRollName, TEXT("NONE")) == 0) {
return ROLL_MODE_NONE;
} else if (strcmpIgnoreCase(logfileRollName, TEXT("SIZE")) == 0) {
return ROLL_MODE_SIZE;
} else if (strcmpIgnoreCase(logfileRollName, TEXT("WRAPPER")) == 0) {
return ROLL_MODE_WRAPPER;
} else if (strcmpIgnoreCase(logfileRollName, TEXT("JVM")) == 0) {
return ROLL_MODE_JVM;
} else if (strcmpIgnoreCase(logfileRollName, TEXT("SIZE_OR_WRAPPER")) == 0) {
return ROLL_MODE_SIZE_OR_WRAPPER;
} else if (strcmpIgnoreCase(logfileRollName, TEXT("SIZE_OR_JVM")) == 0) {
return ROLL_MODE_SIZE_OR_JVM;
} else if (strcmpIgnoreCase(logfileRollName, TEXT("DATE")) == 0) {
return ROLL_MODE_DATE;
} else {
return ROLL_MODE_UNKNOWN;
}
}
int getLogLevelForName( const TCHAR *logLevelName ) {
if (strcmpIgnoreCase(logLevelName, TEXT("NONE")) == 0) {
return LEVEL_NONE;
} else if (strcmpIgnoreCase(logLevelName, TEXT("NOTICE")) == 0) {
return LEVEL_NOTICE;
} else if (strcmpIgnoreCase(logLevelName, TEXT("ADVICE")) == 0) {
return LEVEL_ADVICE;
} else if (strcmpIgnoreCase(logLevelName, TEXT("FATAL")) == 0) {
return LEVEL_FATAL;
} else if (strcmpIgnoreCase(logLevelName, TEXT("ERROR")) == 0) {
return LEVEL_ERROR;
} else if (strcmpIgnoreCase(logLevelName, TEXT("WARN")) == 0) {
return LEVEL_WARN;
} else if (strcmpIgnoreCase(logLevelName, TEXT("STATUS")) == 0) {
return LEVEL_STATUS;
} else if (strcmpIgnoreCase(logLevelName, TEXT("INFO")) == 0) {
return LEVEL_INFO;
} else if (strcmpIgnoreCase(logLevelName, TEXT("DEBUG")) == 0) {
return LEVEL_DEBUG;
} else {
return LEVEL_UNKNOWN;
}
}
#ifndef WIN32
int getLogFacilityForName( const TCHAR *logFacilityName ) {
if (strcmpIgnoreCase(logFacilityName, TEXT("USER")) == 0) {
return LOG_USER;
} else if (strcmpIgnoreCase(logFacilityName, TEXT("LOCAL0")) == 0) {
return LOG_LOCAL0;
} else if (strcmpIgnoreCase(logFacilityName, TEXT("LOCAL1")) == 0) {
return LOG_LOCAL1;
} else if (strcmpIgnoreCase(logFacilityName, TEXT("LOCAL2")) == 0) {
return LOG_LOCAL2;
} else if (strcmpIgnoreCase(logFacilityName, TEXT("LOCAL3")) == 0) {
return LOG_LOCAL3;
} else if (strcmpIgnoreCase(logFacilityName, TEXT("LOCAL4")) == 0) {
return LOG_LOCAL4;
} else if (strcmpIgnoreCase(logFacilityName, TEXT("LOCAL5")) == 0) {
return LOG_LOCAL5;
} else if (strcmpIgnoreCase(logFacilityName, TEXT("LOCAL6")) == 0) {
return LOG_LOCAL6;
} else if (strcmpIgnoreCase(logFacilityName, TEXT("LOCAL7")) == 0) {
return LOG_LOCAL7;
} else {
return LOG_USER;
}
}
#endif
/**
* Sets the number of milliseconds to allow logging to take before a warning is logged.
* Defaults to 0 for no limit. Possible values 0 to 3600000.
*
* @param threshold Warning threashold.
*/
void setLogWarningThreshold(int threshold) {
logPrintfWarnThreshold = __max(__min(threshold, 3600000), 0);
}
/**
* Enable or disable log destinations.
* At any time, the logging can be turned off for all or a set of destinations.
* Even when a destination is disabled, the code can continue to set its log level but
* the value will be stored without re-enabling it. This allows the configuration to
* be loaded normally and to be used later when the destination will be reactivated.
* The same function can be used to re-enable a set of destinations.
*
* @param currentDestinationsMask Mask of destinations to toggle.
* @param enable Wether the destinations should be enabled or disabled.
*/
void toggleLogDestinations(int currentDestinationsMask, int enable) {
int prevEnabledDestinationsMask;
int prevEnabled;
/* First keep a copy of enabledDestinationsMask, which is a global variable used to toggle the set*LevelInt() functions.
* This will allow us to only toggle when the state is changed. */
prevEnabledDestinationsMask = enabledDestinationsMask;
if (enable) {
/* Add the bits to 'enabledDestinationsMask' for each destination that need to be enabled.
* This needs to be done in the beginning so that the set*LevelInt() functions used below work correctly. */
enabledDestinationsMask |= currentDestinationsMask;
}
/* Now actually toggle each destination. */
if (currentDestinationsMask & LOG_DESTINATION_FILE) {
prevEnabled = (prevEnabledDestinationsMask & LOG_DESTINATION_FILE);
if ((enable && !prevEnabled) || (!enable && prevEnabled)) {
if (enable) {
setLogfileLevelInt(savedLogfileLevel);
} else {
savedLogfileLevel = getLogfileLevelInt();
setLogfileLevelInt(LEVEL_NONE);
}
}
}
if (currentDestinationsMask & LOG_DESTINATION_CONSOLE) {
prevEnabled = (prevEnabledDestinationsMask & LOG_DESTINATION_CONSOLE);
if ((enable && !prevEnabled) || (!enable && prevEnabled)) {
if (enable) {
setConsoleLogLevelInt(savedConsoleLevel);
} else {
savedConsoleLevel = getConsoleLogLevelInt();
setConsoleLogLevelInt(LEVEL_NONE);
}
}
}
if (currentDestinationsMask & LOG_DESTINATION_SYSLOG) {
prevEnabled = (prevEnabledDestinationsMask & LOG_DESTINATION_SYSLOG);
if ((enable && !prevEnabled) || (!enable && prevEnabled)) {
if (enable) {
setSyslogLevelInt(savedLoginfoLevel);
} else {
savedLoginfoLevel = getSyslogLevelInt();
setSyslogLevelInt(LEVEL_NONE);
}
}
}
if (!enable) {
/* Remove the bits from 'enabledDestinationsMask' for each destination that need to be disabled.
* This needs to be done in the end so that the set*LevelInt() functions used above work correctly. */
enabledDestinationsMask &= ~currentDestinationsMask;
}
}
/**
* Sets the console log levels to a simple format for help and usage messages.
*/
void setSimpleLogLevels() {
/* Force the log levels to control output. */
setConsoleLogFormat(TEXT("M"));
setConsoleLogLevelInt(LEVEL_INFO);
setLogfileLevelInt(LEVEL_NONE);
setSyslogLevelInt(LEVEL_NONE);
}
#ifdef WIN32
/**
* This sets a flag which tells the logger that alternate source labels should be used to indicate that the current process is a launcher.
*/
void setLauncherSource() {
launcherSource = TRUE;
}
#endif
int getLoggingIsPreload() {
return isPreload;
}
void setLoggingIsPreload(int value) {
isPreload = value;
}
/* Logfile functions */
int isLogfileAccessed() {
return logFileAccessed;
}
/**
* Set the default log file name to an absolute path using the working directory.
* This function must be called after setting the working directory.
*/
int resolveDefaultLogFilePath() {
TCHAR* resolved_log_file_path;
if (defaultLogFile) {
resolved_log_file_path = getAbsolutePathOfFile(defaultLogFile, TEXT("default log file path"), LEVEL_WARN, TRUE);
#ifdef _DEBUG
log_printf_queue(TRUE, WRAPPER_SOURCE_WRAPPER, LEVEL_DEBUG, TEXT("Absolute path to the default log file resolved to %s."), resolved_log_file_path);
#endif
if (resolved_log_file_path) {
free(defaultLogFile);
/* defaultLogFile now points to resolved_log_file_path which was malloced. */
defaultLogFile = resolved_log_file_path;
return FALSE;
}
}
return TRUE;
}
int hasDuplicateToken(const TCHAR *log_file_path, const TCHAR* token) {
TCHAR* ptr;
ptr = _tcsstr(log_file_path, token);
if (ptr && _tcsstr(ptr + 1, token)) {
log_printf_queue(TRUE, WRAPPER_SOURCE_WRAPPER, LEVEL_ERROR, TEXT("Only one '%s' token is allowed in the name of configured log file."), token);
return TRUE;
}
return FALSE;
}
int validateLogfilePath(const TCHAR *log_file_path) {
if (hasDuplicateToken(log_file_path, TEXT("ROLLNUM"))) {
return TRUE;
}
if (hasDuplicateToken(log_file_path, TEXT("YYYYMMDD"))) {
return TRUE;
}
return FALSE;
}
/**
* Sets the log file to be used. If the specified file is not absolute then
* it will be resolved into an absolute path. If there are any problems with
* the path, like a directory not existing then the call will fail and the
* cause will be written to the existing log.
*
* @param log_file_path Path to the logfile.
* @param isConfigured The value comes from the configuration file.
* @param preload TRUE if this is a preload pass.
*
* @return TRUE if there were any problems.
*/
int setLogfilePath(const TCHAR *log_file_path, int isConfigured, int preload) {
size_t len;
TCHAR* prevLogFilePath = NULL;
TCHAR* fixed_log_file_path;
#ifndef WIN32
int backslashesChanged = FALSE;
#endif
if (!log_file_path) {
return TRUE;
}
if (!preload && isConfigured && validateLogfilePath(logFilePath)) {
return TRUE;
}
/* Save a copy of logFilePath and free it up. */
if (logFilePath) {
len = _tcslen(logFilePath);
prevLogFilePath = malloc(sizeof(TCHAR) * (len + 1));
if (!prevLogFilePath) {
outOfMemoryQueued(TEXT("SLP"), 1);
return TRUE;
}
_tcsncpy(prevLogFilePath, logFilePath, len + 1);
free(logFilePath);
logFilePath = NULL;
}
/* Create a copy of log_file_path and fix '/' and '\' depending on whether it is UNIX or Windows. */
len = _tcslen(log_file_path);
fixed_log_file_path = malloc(sizeof(TCHAR) * (len + 1));
if (!fixed_log_file_path) {
outOfMemoryQueued(TEXT("SLP"), 2);
return TRUE;
}
_tcsncpy(fixed_log_file_path, log_file_path, len + 1);
if (len > 0) {
/* An empty value means that the file logging should be disabled. Skip any conversion and keep the value as is. */
#ifdef WIN32
wrapperCorrectWindowsPath(fixed_log_file_path);
#else
backslashesChanged = wrapperCorrectNixPath(fixed_log_file_path);
#endif
/* Convert the path to an absolute path.
* Log in DEBUG here. We will later show a warning with checkLogfileDir() if the directory does not exist. */
logFilePath = getAbsolutePathOfFile(fixed_log_file_path, TEXT("log file path"), getLoggingIsPreload() ? LEVEL_NONE : LEVEL_DEBUG, FALSE);
#ifdef _DEBUG
log_printf_queue(TRUE, WRAPPER_SOURCE_WRAPPER, LEVEL_DEBUG, TEXT("Absolute path to the configured log file resolved to %s."), logFilePath);
#endif
}
if (!logFilePath) {
/* Continue with the relative path. */
logFilePath = fixed_log_file_path;
} else {
len = _tcslen(logFilePath);
free(fixed_log_file_path);
}
if (prevLogFilePath) {
if (_tcscmp(prevLogFilePath, logFilePath) == 0) {
/* The path is unchanged. We don't want to reset currentLogFileName and other variables, so return here. */
free(prevLogFilePath);
return FALSE;
}
free(prevLogFilePath);
}
/* The currentLogFileNameSize is the size of logFilePath + 10 ("." + a roll number) + 1 (NULL). */
currentLogFileNameSize = len + 10 + 1;
if (currentLogFileName) {
free(currentLogFileName);
}
currentLogFileName = malloc(sizeof(TCHAR) * currentLogFileNameSize);
if (!currentLogFileName) {
outOfMemoryQueued(TEXT("SLP"), 3);
free(logFilePath);
logFilePath = NULL;
return TRUE;
}
currentLogFileName[0] = TEXT('\0');
if (workLogFileName) {
free(workLogFileName);
}
workLogFileName = malloc(sizeof(TCHAR) * currentLogFileNameSize);
if (!workLogFileName) {
outOfMemoryQueued(TEXT("SLP"), 4);
free(logFilePath);
logFilePath = NULL;
free(currentLogFileName);
currentLogFileNameSize = 0;
currentLogFileName = NULL;
return TRUE;
}
workLogFileName[0] = TEXT('\0');
if (_tcsstr(logFilePath, TEXT("YYYYMMDD"))) {
logFilePathHasDateToken = TRUE;
} else {
logFilePathHasDateToken = FALSE;
}
logFilePathSetFromConf = isConfigured;
if (isConfigured) {
if ((confLogFileName == NULL) || (strcmpIgnoreCase(logFilePath, confLogFileName) != 0)) {
#ifndef WIN32
if (backslashesChanged) {
log_printf_queue(TRUE, WRAPPER_SOURCE_WRAPPER, LEVEL_WARN, TEXT("Configured wrapper.logfile contained backslashes converted to forward slashes."));
}
#endif
if (confLogFileName) {
/* This message will be printed in the new configured log file because it is queued. */
log_printf_queue(TRUE, WRAPPER_SOURCE_WRAPPER, LEVEL_STATUS, TEXT("Configured log file changed from '%s' to '%s'."), confLogFileName, logFilePath);
free(confLogFileName);
} else {
log_printf_queue(TRUE, WRAPPER_SOURCE_WRAPPER, LEVEL_DEBUG, TEXT("Configured log file set to '%s'."), logFilePath);
}
confLogFileNameSize = currentLogFileNameSize;
confLogFileName = malloc(sizeof(TCHAR) * confLogFileNameSize);
if (!confLogFileName) {
outOfMemoryQueued(TEXT("SLP"), 5);
free(logFilePath);
logFilePath = NULL;
free(currentLogFileName);
confLogFileNameSize = 0;
currentLogFileName = NULL;
free(workLogFileName);
workLogFileName = NULL;
return TRUE;
}
_tcsncpy(confLogFileName, logFilePath, confLogFileNameSize);
if (workConfLogFileName) {
free(workConfLogFileName);
}
workConfLogFileName = malloc(sizeof(TCHAR) * confLogFileNameSize);
if (!confLogFileName) {
outOfMemoryQueued(TEXT("SLP"), 6);
free(logFilePath);
logFilePath = NULL;
free(currentLogFileName);
confLogFileNameSize = 0;
currentLogFileName = NULL;
free(workLogFileName);
workLogFileName = NULL;
free(confLogFileName);
confLogFileName = NULL;
return TRUE;
}
workConfLogFileName[0] = TEXT('\0');
confLogFilePathChanged = TRUE;
}
}
logFilePathChanged = TRUE;
return FALSE;
}
/**
* Returns the default logfile.
*/
const TCHAR *getDefaultLogfilePath() {
return defaultLogFile;
}
/**
* Returns a reference to the currect log file path.
* This return value may be changed at any time if the log file is rolled.
*/
const TCHAR *getLogfilePath()
{
return logFilePath;
}
/**
* Returns a snapshot of the current log file path. This call safely gets the current path
* and returns a copy. It is the responsibility of the caller to free up the memory on
* return. Could return null if there was an error.
*/
TCHAR *getCurrentLogfilePath() {
TCHAR *logFileCopy;
/* Lock the logging mutex. */
if (lockLoggingMutex()) {
return NULL;
}
/* We should always have a current log file name here because there will be at least one line of log output before this is called.
* If that is false then we will return an empty length, but valid, string. */
logFileCopy = malloc(sizeof(TCHAR) * (_tcslen(currentLogFileName) + 1));
if (!logFileCopy) {
_tprintf(TEXT("Out of memory in logging code (%s)\n"), TEXT("CLFP1"));
} else {
_tcsncpy(logFileCopy, currentLogFileName, _tcslen(currentLogFileName) + 1);
}
/* Release the lock we have on the logging mutex so that other threads can get in. */
if (releaseLoggingMutex()) {
if (logFileCopy) {
free(logFileCopy);
}
return NULL;
}
return logFileCopy;
}
#ifndef WIN32
/**
* Check the directory of the current logfile path to make sure it is writable.
* If there are any problems, log a warning.
*
* @param checkDefaultDir TRUE to check the directory of the default log file (always silent),
* FALSE to check the directory of the configured file.
*
* @return FALSE if the directory is confirmed writable, TRUE otherwise.
*/
int checkLogfileDir(int checkDefaultDir) {
size_t len;
TCHAR *c;
TCHAR *logFileDir;
TCHAR *testfile;
int fd;
int result = TRUE;
len = _tcslen(checkDefaultDir ? defaultLogFile : logFilePath) + 1;
if (len > 1) {
logFileDir = malloc(len * sizeof(TCHAR));
if (!logFileDir) {
outOfMemory(TEXT("CLD"), 1);
return TRUE;
}
_tcsncpy(logFileDir, checkDefaultDir ? defaultLogFile : logFilePath, len);
c = _tcsrchr(logFileDir, FILE_SEPARATOR_C);
if (c) {
c[0] = TEXT('\0');
} else {
/* (len > 1) */
logFileDir[0] = TEXT('.');
logFileDir[1] = TEXT('\0');
}
/* We want to try writing a test file to the configured log directory to make sure it is writable. */
len = _tcslen(logFileDir) + 23 + 1 + 1000;
testfile = malloc(len * sizeof(TCHAR));
if (!testfile) {
outOfMemory(TEXT("CLD"), 2);
free(logFileDir);
return TRUE;
}
_sntprintf(testfile, len, TEXT("%s%c.wrapper_test-%.4d%.4d"), logFileDir, FILE_SEPARATOR_C, rand() % 9999, rand() % 9999);
/* Keep #ifdef WIN32 even though the function is currently not used on this platform. */
if ((fd = _topen(testfile, O_WRONLY | O_CREAT | O_EXCL
#ifdef WIN32
, _S_IWRITE
#else
, S_IRUSR | S_IWUSR
#endif
)) != -1) {
/* Successfully wrote the temp file. */
#ifdef WIN32
_close(fd);
#else
close(fd);
#endif
if (_tremove(testfile) == 0) {
/* writable! */
result = FALSE;
}
}
free(testfile);
free(logFileDir);
}
return result;
}
#endif
/**
* This method will wiat for the specified number of seconds. It is only meant for special
* uses within the logging code as it does not itself log any output in a correct way.
*/
void logSleep(int ms) {
#ifdef WIN32
Sleep(ms);
#else
/* We want to use nanosleep if it is available, but make it possible for the
user to build a version that uses usleep if they want.
usleep does not behave nicely with signals thrown while sleeping. This
was the believed cause of a hang experienced on one Solaris system. */
#ifdef USE_USLEEP
wrapperUsleep(ms * 1000); /* microseconds */
#else
struct timespec ts;
struct timespec tsRemaining;
int result;
if (ms >= 1000) {
ts.tv_sec = ms / 1000;
ts.tv_nsec = (ms % 1000) * 1000000; /* nanoseconds */
} else {
ts.tv_sec = 0;
ts.tv_nsec = ms * 1000000; /* nanoseconds */
}
while (((result = nanosleep(&ts, &tsRemaining)) == -1) && (errno == EINTR)) {
ts.tv_sec = tsRemaining.tv_sec;
ts.tv_nsec = tsRemaining.tv_nsec;
}
if (result) {
if (errno == EAGAIN) {
/* On 64-bit AIX this happens once on shutdown. */
return;
} else {
_tprintf(TEXT("nanosleep(%dms) failed. \n"), ms, getLastErrorText());
}
}
#endif
#endif
}
/**
* Used for testing to set a pause into the next log entry made.
*
* @param pauseTime Number of seconds to pause, 0 pauses indefinitely.
*/
void setPauseTime(int pauseTime)
{
logPauseTime = pauseTime;
}
/**
* Set to true to cause changes in internal buffer sizes to be logged. Useful for debugging.
*
* @param log TRUE if changes should be logged.
*/
void setLogBufferGrowth(int log) {
logBufferGrowth = log;
}
void setLogfileRollMode( int log_file_roll_mode ) {
logFileRollMode = log_file_roll_mode;
confLogFileRollMode = log_file_roll_mode;
}
int getLogfileRollMode() {
return logFileRollMode;
}
void setLogfileUmask( int log_file_umask ) {
logFileUmask = log_file_umask;
}
#ifndef WIN32
void setLogfileGroup(gid_t log_file_group) {
logFileGroup = log_file_group;
}
#endif
void setLogfileFormat( const TCHAR *log_file_format ) {
if ( log_file_format != NULL ) {
_tcsncpy( logfileFormat, log_file_format, 32 );
/* We only want to time logging if it is needed. */
if ((logPrintfWarnThreshold <= 0) && (_tcschr(log_file_format, TEXT('G')))) {
logPrintfWarnThreshold = 99999999;
}
}
}
void setLogfileLevelInt( int log_file_level ) {
/* Update the configured log level in case the log file was disabled while reloading the configuration. */
if (enabledDestinationsMask & LOG_DESTINATION_FILE) {
confLogFileLevelInt = log_file_level;
currentLogfileLevel = log_file_level;
} else {
savedLogfileLevel = log_file_level;
}
}
int getLogfileLevelInt() {
return currentLogfileLevel;
}
void setLogfileLevel( const TCHAR *log_file_level ) {
setLogfileLevelInt(getLogLevelForName(log_file_level));
}
void setLogfileMaxFileSize( const TCHAR *max_file_size ) {
int multiple, i, newLength;
TCHAR *tmpFileSizeBuff;
TCHAR chr;
if ( max_file_size != NULL ) {
/* Allocate buffer */
tmpFileSizeBuff = malloc(sizeof(TCHAR) * (_tcslen( max_file_size ) + 1));
if (!tmpFileSizeBuff) {
outOfMemoryQueued(TEXT("SLMFS"), 1);
return;
}
/* Generate multiple and remove unwanted chars */
multiple = 1;
newLength = 0;
for( i = 0; i < (int)_tcslen(max_file_size); i++ ) {
chr = max_file_size[i];
switch( chr ) {
case TEXT('k'): /* Kilobytes */
case TEXT('K'):
multiple = 1024;
break;
case TEXT('M'): /* Megabytes */
case TEXT('m'):
multiple = 1048576;
break;
}
if( (chr >= TEXT('0') && chr <= TEXT('9')) || (chr == TEXT('-')) )
tmpFileSizeBuff[newLength++] = max_file_size[i];
}
tmpFileSizeBuff[newLength] = TEXT('\0');/* Crop string */
logFileMaxSize = _ttoi( tmpFileSizeBuff );
if( logFileMaxSize > 0 )
logFileMaxSize *= multiple;
/* Free memory */
free( tmpFileSizeBuff );
tmpFileSizeBuff = NULL;
if ((logFileMaxSize > 0) && (logFileMaxSize < 1024)) {
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_WARN, TEXT(
"wrapper.logfile.maxsize must be 0 or at least 1024. Changing to %d."), logFileMaxSize);
logFileMaxSize = 1024;
}
confLogFileMaxSize = logFileMaxSize;
}
}
void setLogfileMaxLogFiles( int max_log_files ) {
logFileMaxLogFiles = max_log_files;
confLogFileMaxLogFiles = max_log_files;
}
void generateLogFilePattern(TCHAR *buffer, size_t bufferSize);
/**
* Set the file pattern used to purge old log files.
* Every time the log file is rolled, all files matching the specified pattern
* will be selected and sorted using the sort mode. The files that exceed the
* maximum number of log files will be deleted.
* NOTE: This function should always be called after setLogfilePurgeSortMode()
*
* @param pattern file pattern with wildcard characters.
* @param outIsGenerated Boolean out parameter which indicates if the pattern is generated.
* When the pattern is generated the first parameter is ignored.
*/
void setLogfilePurgePattern(const TCHAR *pattern, int* outIsGenerated) {
size_t len;
TCHAR* newPattern;
TCHAR* generatedPattern = NULL;
if (logFilePurgePattern) {
free(logFilePurgePattern);
logFilePurgePattern = NULL;
}
if (logFilePurgeSortMode == LOGGER_FILE_SORT_MODE_NAMES_SMART) {
/* In this mode the pattern needs to be generated. */
generatedPattern = malloc(sizeof(TCHAR) * currentLogFileNameSize);
if (!generatedPattern) {
outOfMemoryQueued(TEXT("SLPP"), 1);
return;
}
generateLogFilePattern(generatedPattern, currentLogFileNameSize);
newPattern = generatedPattern;
*outIsGenerated = TRUE;
} else {
newPattern = (TCHAR*)pattern;
}
len = _tcslen(newPattern);
if (len > 0) {
logFilePurgePattern = malloc(sizeof(TCHAR) * (len + 1));
if (!logFilePurgePattern) {
free(generatedPattern);
outOfMemoryQueued(TEXT("SLPP"), 2);
return;
}
_tcsncpy(logFilePurgePattern, newPattern, len + 1);
}
free(generatedPattern);
}
void setLogfilePurgeSortMode(int sortMode) {
logFilePurgeSortMode = sortMode;
}
/**
* Disable the logfile.
*/
void disableLogFile() {
/* Don't use setLogfileLevelInt() as it would overwrite confLogFileLevelInt. */
currentLogfileLevel = LEVEL_NONE;
whichLogFile = LOG_FILE_DISABLED;
}
/**
* Restore the log level of the logfile. It is the responsibility
* of the caller to specify which log file will be used after that.
*/
void enableLogFile() {
/* Restore the log level. */
currentLogfileLevel = confLogFileLevelInt;
}
/** Returns the number of lines of log file activity since the last call. */
DWORD getLogfileActivity() {
DWORD logfileLines;
/* Don't worry about synchronization here. Any errors are not critical the way this is used. */
logfileLines = logfileActivityCount;
logfileActivityCount = 0;
return logfileLines;
}
/** Obtains a lock on the logging mutex. */
int lockLoggingMutex() {
#ifdef WIN32
switch (WaitForSingleObject(log_printfMutexHandle, INFINITE)) {
case WAIT_ABANDONED:
_tprintf(TEXT("Logging mutex was abandoned.\n"));
return -1;
case WAIT_FAILED:
_tprintf(TEXT("Logging mutex wait failed.\n"));
return -1;
case WAIT_TIMEOUT:
_tprintf(TEXT("Logging mutex wait timed out.\n"));
return -1;
default:
/* Ok */
break;
}
#else
if (pthread_mutex_lock(&log_printfMutex)) {
_tprintf(TEXT("Failed to lock the Logging mutex. %s\n"), getLastErrorText());
return -1;
}
#endif
return 0;
}
/** Releases a lock on the logging mutex. */
int releaseLoggingMutex() {
#ifdef WIN32
if (!ReleaseMutex(log_printfMutexHandle)) {
_tprintf( TEXT("Failed to release logging mutex. %s\n"), getLastErrorText());
return -1;
}
#else
if (pthread_mutex_unlock(&log_printfMutex)) {
_tprintf(TEXT("Failed to unlock the Logging mutex. %s\n"), getLastErrorText());
return -1;
}
#endif
return 0;
}
/** Sets the auto flush log file flag. */
void setLogfileAutoFlush(int autoFlush) {
autoFlushLogfile = autoFlush;
}
/** Sets the auto close log file flag. */
void setLogfileAutoClose(int autoClose) {
autoCloseLogfile = autoClose;
}
/** Closes the logfile if it is open. */
void closeLogfile() {
/* We need to be very careful that only one thread is allowed in here
* at a time. On Windows this is done using a Mutex object that is
* initialized in the initLogging function. */
if (lockLoggingMutex()) {
return;
}
if (logfileFP != NULL) {
#ifdef _DEBUG
_tprintf(TEXT("Closing logfile by request...\n"));
#endif
fclose(logfileFP);
logfileFP = NULL;
/* Do not clean the currentLogFileName here as the name is not actually changing. */
}
/* Release the lock we have on this function so that other threads can get in. */
if (releaseLoggingMutex()) {
return;
}
}
/** Flushes any buffered logfile output to the disk. */
void flushLogfile() {
/* We need to be very careful that only one thread is allowed in here
* at a time. On Windows this is done using a Mutex object that is
* initialized in the initLogging function. */
if (lockLoggingMutex()) {
return;
}
if (logfileFP != NULL) {
#ifdef _DEBUG
_tprintf(TEXT("Flushing logfile by request...\n"));
#endif
fflush(logfileFP);
}
/* Release the lock we have on this function so that other threads can get in. */
if (releaseLoggingMutex()) {
return;
}
}
/* Console functions */
void setConsoleLogFormat( const TCHAR *console_log_format ) {
if ( console_log_format != NULL ) {
_tcsncpy( consoleFormat, console_log_format, 32 );
/* We only want to time logging if it is needed. */
if ((logPrintfWarnThreshold <= 0) && (_tcschr(console_log_format, TEXT('G')))) {
logPrintfWarnThreshold = 99999999;
}
}
}
void setConsoleLogLevelInt( int console_log_level ) {
if (enabledDestinationsMask & LOG_DESTINATION_CONSOLE) {
currentConsoleLevel = console_log_level;
} else {
savedConsoleLevel = console_log_level;
}
}
int getConsoleLogLevelInt() {
return currentConsoleLevel;
}
void setConsoleLogLevel( const TCHAR *console_log_level ) {
setConsoleLogLevelInt(getLogLevelForName(console_log_level));
}
void setConsoleFlush( int flush ) {
consoleFlush = flush;
}
#ifdef WIN32
void setConsoleDirect( int direct ) {
consoleDirect = direct;
}
#endif
void setConsoleFatalToStdErr(int toStdErr) {
consoleFatalToStdErr = toStdErr;
}
void setConsoleErrorToStdErr(int toStdErr) {
consoleErrorToStdErr = toStdErr;
}
void setConsoleWarnToStdErr(int toStdErr) {
consoleWarnToStdErr = toStdErr;
}
/* Syslog/eventlog functions */
void setSyslogLevelInt( int loginfo_level ) {
if (enabledDestinationsMask & LOG_DESTINATION_SYSLOG) {
currentLoginfoLevel = loginfo_level;
} else {
savedLoginfoLevel = loginfo_level;
}
}
int getSyslogLevelInt() {
return currentLoginfoLevel;
}
void setSyslogLevel( const TCHAR *loginfo_level ) {
setSyslogLevelInt(getLogLevelForName(loginfo_level));
}
void setSyslogSplitMessages(int splitMessages) {
currentLogSplitMessages = splitMessages;
}
#ifdef WIN32
void setSyslogRegister(int sysRegister) {
currentLogRegister = sysRegister;
}
int getSyslogRegister() {
return currentLogRegister;
}
TCHAR* getSyslogEventSourceName() {
return loginfoSourceName;
}
#endif
#ifndef WIN32
void setSyslogFacilityInt( int logfacility_level ) {
currentLogfacilityLevel = logfacility_level;
}
void setSyslogFacility( const TCHAR *loginfo_level ) {
setSyslogFacilityInt(getLogFacilityForName(loginfo_level));
}
#endif
void setSyslogEventSourceName( const TCHAR *event_source_name ) {
size_t size;
if (event_source_name != NULL) {
if (loginfoSourceName != defaultLoginfoSourceName) {
if (loginfoSourceName != NULL) {
free(loginfoSourceName);
}
}
#ifdef WIN32
size = sizeof(TCHAR) * (_tcslen(event_source_name) + 1);
#else
size = wcstombs(NULL, event_source_name, 0);
if (size == (size_t)-1) {
return;
}
size++;
#endif
loginfoSourceName = malloc(size);
if (!loginfoSourceName) {
_tprintf(TEXT("Out of memory in logging code (%s)\n"), TEXT("SSESN"));
loginfoSourceName = defaultLoginfoSourceName;
return;
}
#ifdef WIN32
_tcsncpy(loginfoSourceName, event_source_name, _tcslen(event_source_name) + 1);
if (_tcslen(loginfoSourceName) > 32) {
loginfoSourceName[32] = TEXT('\0');
}
#else
wcstombs(loginfoSourceName, event_source_name, size);
if (strlen(loginfoSourceName) > 32) {
loginfoSourceName[32] = '\0';
}
#endif
}
}
void resetDuration() {
#ifdef WIN32
struct _timeb timebNow;
#else
struct timeval timevalNow;
#endif
time_t now;
int nowMillis;
#ifdef WIN32
_ftime(&timebNow);
now = (time_t)timebNow.time;
nowMillis = timebNow.millitm;
#else
gettimeofday(&timevalNow, NULL);
now = (time_t)timevalNow.tv_sec;
nowMillis = timevalNow.tv_usec / 1000;
#endif
previousNow = now;
previousNowMillis = nowMillis;
}
int getLowLogLevel() {
int lowLogLevel = (currentLogfileLevel < currentConsoleLevel ? currentLogfileLevel : currentConsoleLevel);
lowLogLevel = (currentLoginfoLevel < lowLogLevel ? currentLoginfoLevel : lowLogLevel);
return lowLogLevel;
}
void setThreadMessageBufferInitialSize(int initialValue) {
/* do not allow too big and too small values */
threadMessageBufferInitialSize = __min(__max(initialValue, 100), 32768);
}
TCHAR* preparePrintBuffer(size_t reqSize) {
if (threadPrintBuffer == NULL) {
threadPrintBuffer = malloc(sizeof(TCHAR) * reqSize);
if (!threadPrintBuffer) {
_tprintf(TEXT("Out of memory in logging code (%s)\n"), TEXT("PPB1"));
threadPrintBufferSize = 0;
return NULL;
}
threadPrintBufferSize = reqSize;
} else if (threadPrintBufferSize < reqSize) {
free(threadPrintBuffer);
threadPrintBuffer = malloc(sizeof(TCHAR) * reqSize);
if (!threadPrintBuffer) {
_tprintf(TEXT("Out of memory in logging code (%s)\n"), TEXT("PPB2"));
threadPrintBufferSize = 0;
return NULL;
}
threadPrintBufferSize = reqSize;
}
return threadPrintBuffer;
}
/* Returns the number of columns and come up with a required length for the printBuffer. */
int GetColumnsAndReqSizeForPrintBuffer(const TCHAR *format, const TCHAR *message, size_t *reqSize) {
int i;
int numColumns;
*reqSize = 0;
for( i = 0, numColumns = 0; i < (int)_tcslen( format ); i++ ) {
switch( format[i] ) {
#ifdef LOGGER_TEST_NULL_FORMAT
case TEXT('0'):
*reqSize += 1 + 3;
numColumns++;
break;
#endif
case TEXT('P'):
case TEXT('p'):
*reqSize += 8 + 3;
numColumns++;
break;
case TEXT('L'):
case TEXT('l'):
*reqSize += 6 + 3;
numColumns++;
break;
case TEXT('D'):
case TEXT('d'):
*reqSize += 7 + 3;
numColumns++;
break;
case TEXT('Q'):
case TEXT('q'):
*reqSize += 1 + 3;
numColumns++;
break;
case TEXT('T'):
case TEXT('t'):
*reqSize += 19 + 3;
numColumns++;
break;
case TEXT('Z'):
case TEXT('z'):
*reqSize += 23 + 3;
numColumns++;
break;
case TEXT('U'):
case TEXT('u'):
*reqSize += 8 + 3;
numColumns++;
break;
case TEXT('R'):
case TEXT('r'):
*reqSize += 8 + 3;
numColumns++;
break;
case TEXT('G'):
case TEXT('g'):
*reqSize += 10 + 3;
numColumns++;
break;
case TEXT('M'):
case TEXT('m'):
*reqSize += _tcslen( message ) + 3;
numColumns++;
break;
default:
if (logFormatCountCallback && logFormatCountCallback(format[i], reqSize)) {
numColumns++;
}
}
}
return numColumns;
}
/* Writes to and then returns a buffer that is reused by the current thread.
* It should not be released. */
TCHAR* buildPrintBuffer( int source_id, int level, int threadId, int queued, struct tm *nowTM, int nowMillis, time_t durationMillis, const TCHAR *format, const TCHAR *defaultFormat, const TCHAR *message) {
int i;
size_t reqSize;
int numColumns;
TCHAR *pos;
int currentColumn;
int handledFormat;
int temp;
int len;
numColumns = GetColumnsAndReqSizeForPrintBuffer(format, message, &reqSize);
if ((reqSize == 0) && (defaultFormat != NULL)) {
/* This means that the specified format was completely invalid.
* Recurse using the defaultFormat instead.
* The alternative would be to log an empty line, which is useless to everyone. */
return buildPrintBuffer( source_id, level, threadId, queued, nowTM, nowMillis, durationMillis, defaultFormat, NULL /* No default. Prevent further recursion. */, message );
}
/* Always add room for the null. */
reqSize += 1;
if ( !preparePrintBuffer(reqSize)) {
return NULL;
}
/* Always start with a null terminated string in case there are no formats specified. */
threadPrintBuffer[0] = TEXT('\0');
/* Create a pointer to the beginning of the print buffer, it will be advanced
* as the formatted message is build up. */
pos = threadPrintBuffer;
/* We now have a buffer large enough to store the entire formatted message. */
for( i = 0, currentColumn = 0, len = 0, temp = 0; i < (int)_tcslen( format ); i++ ) {
handledFormat = TRUE;
switch( format[i] ) {
#ifdef LOGGER_TEST_NULL_FORMAT
case TEXT('0'):
pos[0] = TEXT('\0');
temp = 1;
currentColumn++;
break;
#endif
case TEXT('P'):
case TEXT('p'):
switch ( source_id ) {
case WRAPPER_SOURCE_WRAPPER:
#ifdef WIN32
if (launcherSource) {
temp = _sntprintf( pos, reqSize - len, TEXT("wrapperm") );
} else {
temp = _sntprintf( pos, reqSize - len, TEXT("wrapper ") );
}
#else
temp = _sntprintf( pos, reqSize - len, TEXT("wrapper ") );
#endif
break;
case WRAPPER_SOURCE_PROTOCOL:
temp = _sntprintf( pos, reqSize - len, TEXT("wrapperp") );
break;
case WRAPPER_SOURCE_JVM_VERSION:
temp = _sntprintf( pos, reqSize - len, TEXT("jvm ver.") );
break;
default:
temp = _sntprintf( pos, reqSize - len, TEXT("jvm %-4d"), source_id );
break;
}
currentColumn++;
break;
case TEXT('L'):
case TEXT('l'):
temp = _sntprintf( pos, reqSize - len, TEXT("%s"), logLevelNames[ level ] );
currentColumn++;
break;
case TEXT('D'):
case TEXT('d'):
switch ( threadId )
{
case WRAPPER_THREAD_SIGNAL:
temp = _sntprintf( pos, reqSize - len, TEXT("signal ") );
break;
case WRAPPER_THREAD_MAIN:
temp = _sntprintf( pos, reqSize - len, TEXT("main ") );
break;
case WRAPPER_THREAD_SRVMAIN:
temp = _sntprintf( pos, reqSize - len, TEXT("srvmain") );
break;
case WRAPPER_THREAD_TIMER:
temp = _sntprintf( pos, reqSize - len, TEXT("timer ") );
break;
#ifdef WIN32
case WRAPPER_THREAD_MESSAGE:
temp = _sntprintf( pos, reqSize - len, TEXT("message") );
break;
#else
case WRAPPER_THREAD_JAVAIN:
temp = _sntprintf( pos, reqSize - len, TEXT("javain ") );
break;
#endif
case WRAPPER_THREAD_JAVAIO:
temp = _sntprintf( pos, reqSize - len, TEXT("javaio ") );
break;
case WRAPPER_THREAD_STARTUP:
temp = _sntprintf( pos, reqSize - len, TEXT("startup") );
break;
default:
temp = _sntprintf( pos, reqSize - len, TEXT("unknown") );
break;
}
currentColumn++;
break;
case TEXT('Q'):
case TEXT('q'):
temp = _sntprintf( pos, reqSize - len, TEXT("%c"), ( queued ? TEXT('Q') : TEXT(' ')));
currentColumn++;
break;
case TEXT('T'):
case TEXT('t'):
temp = _sntprintf( pos, reqSize - len, TEXT("%04d/%02d/%02d %02d:%02d:%02d"),
nowTM->tm_year + 1900, nowTM->tm_mon + 1, nowTM->tm_mday,
nowTM->tm_hour, nowTM->tm_min, nowTM->tm_sec );
currentColumn++;
break;
case TEXT('Z'):
case TEXT('z'):
temp = _sntprintf( pos, reqSize - len, TEXT("%04d/%02d/%02d %02d:%02d:%02d.%03d"),
nowTM->tm_year + 1900, nowTM->tm_mon + 1, nowTM->tm_mday,
nowTM->tm_hour, nowTM->tm_min, nowTM->tm_sec, nowMillis );
currentColumn++;
break;
case TEXT('U'):
case TEXT('u'):
if (uptimeFlipped) {
temp = _sntprintf( pos, reqSize - len, TEXT("--------") );
} else {
temp = _sntprintf( pos, reqSize - len, TEXT("%8d"), uptimeSeconds);
}
currentColumn++;
break;
case TEXT('R'):
case TEXT('r'):
if (durationMillis == (time_t)-1) {
temp = _sntprintf( pos, reqSize - len, TEXT(" ") );
} else if (durationMillis > 99999999) {
temp = _sntprintf( pos, reqSize - len, TEXT("99999999") );
} else {
temp = _sntprintf( pos, reqSize - len, TEXT("%8d"), durationMillis);
}
currentColumn++;
break;
case TEXT('G'):
case TEXT('g'):
temp = _sntprintf( pos, reqSize - len, TEXT("%8d"), __min(previousLogLag, 99999999));
currentColumn++;
break;
case TEXT('M'):
case TEXT('m'):
temp = _sntprintf( pos, reqSize - len, TEXT("%s"), message );
currentColumn++;
break;
default:
if (logFormatPrintCallback && (temp = logFormatPrintCallback(format[i], reqSize - len, &pos))) {
currentColumn++;
} else {
handledFormat = FALSE;
}
}
if (handledFormat) {
pos += temp;
len += temp;
/* Add separator chars */
if (currentColumn != numColumns) {
temp = _sntprintf(pos, reqSize - len, TEXT(" | "));
pos += temp;
len += temp;
}
}
}
/* Return the print buffer to the caller. */
return threadPrintBuffer;
}
/**
* Generates a log file name given.
*
* buffer - Buffer into which to _sntprintf the generated name.
* bufferSize - Size of the buffer.
* template - Template from which the name is generated.
* nowDate - Optional date used to replace any YYYYMMDD tokens.
* rollNum - Optional roll number used to replace any ROLLNUM tokens.
*/
void generateLogFileName(TCHAR *buffer, size_t bufferSize, const TCHAR *template, const TCHAR *nowDate, const TCHAR *rollNum ) {
size_t bufferLen;
/* Copy the template to the buffer to get started. */
_tcsncpy(buffer, template, _tcslen(template) + 1);
/* Handle the date token. */
if (_tcsstr(buffer, TEXT("YYYYMMDD"))) {
/* The token needs to be replaced. */
replaceStringLongWithShort(buffer, TEXT("YYYYMMDD"), nowDate);
}
/* Handle the roll number token. */
if (_tcsstr(buffer, TEXT("ROLLNUM"))) {
if (rollNum == NULL ) {
/* The token needs to be removed. */
replaceStringLongWithShort(buffer, TEXT("-ROLLNUM"), NULL);
replaceStringLongWithShort(buffer, TEXT("_ROLLNUM"), NULL);
replaceStringLongWithShort(buffer, TEXT(".ROLLNUM"), NULL);
replaceStringLongWithShort(buffer, TEXT("ROLLNUM"), NULL);
} else {
/* The token needs to be replaced. */
replaceStringLongWithShort(buffer, TEXT("ROLLNUM"), rollNum);
}
} else {
/* The name did not contain a ROLLNUM token. */
if (rollNum != NULL ) {
bufferLen = _tcslen(buffer);
if (_tcscmp(rollNum, TEXT("*")) == 0) {
/* Append the '*' at the end. */
_sntprintf(buffer + bufferLen, bufferSize - bufferLen, TEXT("%s"), rollNum);
} else {
/* Generate the name as if ".ROLLNUM" was appended to the template. */
_sntprintf(buffer + bufferLen, bufferSize - bufferLen, TEXT(".%s"), rollNum);
}
buffer[bufferSize - 1] = TEXT('\0');
}
}
}
void generateLogFilePattern(TCHAR *buffer, size_t bufferSize) {
generateLogFileName(buffer, bufferSize, logFilePath, TEXT("????????"), TEXT("*"));
}
#ifndef WIN32
void generateCurrentLogFileName(TCHAR** pFileName) {
struct stat fileStat;
struct timeval timevalNow;
struct tm *nowTM;
time_t now;
TCHAR nowDate[9];
TCHAR *buffer;
size_t size;
size = _tcslen(*pFileName) + 1;
buffer = malloc(sizeof(TCHAR) * size);
if (buffer) {
gettimeofday(&timevalNow, NULL);
now = (time_t)timevalNow.tv_sec;
nowTM = localtime(&now);
_sntprintf(nowDate, 9, TEXT("%04d%02d%02d"), nowTM->tm_year + 1900, nowTM->tm_mon + 1, nowTM->tm_mday);
generateLogFileName(buffer, size, *pFileName, nowDate, NULL);
if (_tcsstr(*pFileName, TEXT("YYYYMMDD")) && (nowTM->tm_hour == 0) && (nowTM->tm_min == 0)) {
/* We are close to midnight... check if the file exists, if not try to get the file from the previous day. */
if (_tstat(buffer, &fileStat) != 0) {
now -= 3600; /* -1h (though -1min would be enough). */
nowTM = localtime(&now);
_sntprintf(nowDate, 9, TEXT("%04d%02d%02d"), nowTM->tm_year + 1900, nowTM->tm_mon + 1, nowTM->tm_mday);
generateLogFileName(buffer, size, *pFileName, nowDate, NULL);
}
}
free(*pFileName);
*pFileName = buffer;
}
}
#endif
/**
* Prints the contents of a buffer to the sysLog target. The log level is
* tested prior to this function being called.
*
* Must be called while locked.
*/
void log_printf_message_sysLogInner(int source_id, int level, TCHAR *message, struct tm *nowTM) {
#ifdef WIN32
sendEventlogMessage(source_id, level, message);
#else
sendLoginfoMessage(source_id, level, message);
#endif
}
/**
* @param invertLogLevelCheck There is a special case where we want to log to
* the syslog IF and only if the normal log output
* would not go to the syslog. This flag makes it
* possible to log it if we normally would not.
*/
void log_printf_message_sysLog(int source_id, int level, TCHAR *message, struct tm *nowTM, int invertLogLevelCheck) {
switch (level) {
case LEVEL_NOTICE:
case LEVEL_ADVICE:
/* Advice and Notice level messages are special in that they never get logged to the
* EventLog / SysLog. */
break;
default:
if (invertLogLevelCheck) {
/* Log if we normally should not log. */
if (level < currentLoginfoLevel) {
log_printf_message_sysLogInner(source_id, level, message, nowTM);
}
} else {
if (level >= currentLoginfoLevel) {
log_printf_message_sysLogInner(source_id, level, message, nowTM);
}
}
}
}
static void setDefaultRolling() {
logFileRollMode = ROLL_MODE_SIZE;
logFileMaxSize = 5 * 1048576;
logFileMaxLogFiles = 1;
}
static void restoreConfiguredRolling() {
logFileRollMode = confLogFileRollMode;
logFileMaxSize = confLogFileMaxSize;
logFileMaxLogFiles = confLogFileMaxLogFiles;
}
static void printFailoverFileHeader(TCHAR* confFileName) {
_ftprintf(logfileFP, TEXT("********************************************************************************\n"));
_ftprintf(logfileFP, TEXT("* This is a Java Service Wrapper failover log file.\n* Was unable to write to %s.\n"), confFileName);
_ftprintf(logfileFP, TEXT("********************************************************************************\n\n"));
}
#ifndef WIN32
void changeLogFileGroup(const TCHAR* path) {
if (_tchown(path, -1, logFileGroup) == -1) {
log_printf_queue(TRUE, WRAPPER_SOURCE_WRAPPER, LEVEL_ERROR, TEXT("Unable to change the group of %s. %s"),
TEXT("the log file"), getLastErrorText());
}
}
#endif
/**
* Open log file in the following order of priority: configured log file, default log file, no log file.
* This function will also try to resume logging in a file with a higher priority as soon as it becomes
* available.
*
* Must be called while locked.
*
* @return True if the logfile name changed.
*/
int openLogFile(struct tm *nowTM, TCHAR *message) {
static TCHAR confLogFileStopDateStr[20];
int logFileChanged = FALSE;
TCHAR nowDate[9];
int old_umask;
const TCHAR *tempBufferFormat;
TCHAR tempBufferLastErrorText1[1024];
TCHAR tempBufferLastErrorText2[1024];
size_t tempBufferLen;
TCHAR *tempBuffer;
TCHAR tempConfLogFileResumeDateStr[20];
size_t reqSize = 0;
char *messageMB;
size_t messageMBMaxLen = 0;
FILE *tempLogfileFP = NULL;
int dummyReset = FALSE;
int reset = FALSE;
#if defined(WIN32) && !defined(WIN64)
struct _stat64i32 fileStat;
#else
struct stat fileStat;
#endif
/* If the log file was set to a blank value then it will not be used. */
if (logFilePath && (_tcslen(logFilePath) > 0)) {
/* If this the roll mode is date then we need a nowDate for this log entry. */
_sntprintf(nowDate, 9, TEXT("%04d%02d%02d"), nowTM->tm_year + 1900, nowTM->tm_mon + 1, nowTM->tm_mday );
/* If ftell() can't be used, we need the size of the logging message in order to calculate the size of the buffered data that is not flushed. */
if (doesFtellCauseMemoryLeak()) {
/* We will not use ftell(), so we have to take into account the size of the buffered data that have not been flushed yet. */
GetColumnsAndReqSizeForPrintBuffer(logfileFormat, message, &reqSize);
/* The previous function will process the length of message in number of characters. We want it in bytes. */
messageMBMaxLen = _tcslen(message) * sizeof(TCHAR);
if (messageMBMaxLen > 0) {
messageMB = malloc(messageMBMaxLen);
if (!messageMB) {
outOfMemoryQueued(TEXT("OLF"), 1);
} else {
wcstombs(messageMB, message, messageMBMaxLen);
reqSize -= _tcslen(message);
reqSize += strlen(messageMB);
/* Actually GetColumnsAndReqSizeForPrintBuffer() return 3 characters more than needed, but we need to add 2 more caracters for carriage return. */
reqSize -= 1;
}
free(messageMB);
}
}
/* Make sure that the log file does not need to be rolled. */
checkAndRollLogs(nowDate, reqSize);
if (confLogFileName) {
/* The logging configuration is now loaded and the configured log file is known. */
workConfLogFileName[0] = TEXT('\0');
/* Check if the log file path has changed since the last call. */
if (logFilePathChanged && (whichLogFile != LOG_FILE_UNSET)) {
if (confLogFilePathChanged) {
if (whichLogFile == LOG_FILE_CONFIGURED) {
/* We are moving from one configured log file to another. We need to reinit. */
reset = TRUE;
} else {
old_umask = umask( logFileUmask );
generateLogFileName(workConfLogFileName, confLogFileNameSize, confLogFileName, nowDate, NULL);
if ((tempLogfileFP = _tfopen(workConfLogFileName, TEXT("a"))) == NULL) {
/* The configured log file has changed but is not accessible. Reset the file opening
* system in its original state to clearly show that the new file is not accessible. */
dummyReset = TRUE;
#ifndef WIN32
} else if (logFileGroup != -1) {
changeLogFileGroup(workConfLogFileName);
#endif
}
umask(old_umask);
}
if (reset || dummyReset) {
/* Now actually reset the file opening system */
if (logfileFP != NULL) {
/* Close the previous log file. We can do this safely because we are already locked. */
fclose(logfileFP);
logfileFP = NULL;
}
if (whichLogFile == LOG_FILE_DISABLED) {
/* We previously disabled file logging. Reactivate it. */
enableLogFile();
}
whichLogFile = LOG_FILE_UNSET;
}
}
if (whichLogFile == LOG_FILE_DEFAULT) {
/* Continue with the default file. If the configured log file changed, we will resume logging in it just below. */
setLogfilePath(defaultLogFile, FALSE, FALSE);
_sntprintf(currentLogFileName, currentLogFileNameSize, TEXT("%s"), defaultLogFile);
setDefaultRolling();
}
}
/* If we previously fell back to the default log file or disabled log file, try to return to the configured log file */
if ((whichLogFile != LOG_FILE_UNSET) && (whichLogFile != LOG_FILE_CONFIGURED) && (confLogFileName != NULL)) {
/* Check if the configured log file is available */
old_umask = umask( logFileUmask );
/* Generate the log file name if it is not already set. */
if (workConfLogFileName[0] == TEXT('\0')) {
generateLogFileName(workConfLogFileName, confLogFileNameSize, confLogFileName, nowDate, NULL);
}
tempLogfileFP = _tfopen(workConfLogFileName, TEXT("a"));
if (!tempLogfileFP) {
_tcsncpy(tempBufferLastErrorText1, getLastErrorText(), 1023);
tempBufferLastErrorText1[1023] = 0;
} else {
#ifndef WIN32
if (logFileGroup != -1) {
changeLogFileGroup(workConfLogFileName);
}
#endif
if (logfileFP != NULL) {
/* Make sure to close the default log file (we have not set logfileFP yet). */
/* We are already locked. */
fclose(logfileFP);
logfileFP = NULL;
}
if (whichLogFile == LOG_FILE_DISABLED) {
/* We previously disabled file logging. Reactivate it. */
enableLogFile();
}
/* We need to write our message into a buffer manually so we can use it
* both for the log_printf_queue and log_printf_message_sysLog calls below. */
tempBufferFormat = TEXT("The messages could not be logged in the configured log file (%s) between %s and %s.\n The missing log entries may be found in the default log file (%s) of the current working directory or in the %s.");
_sntprintf(tempConfLogFileResumeDateStr, 20, TEXT("%04d/%02d/%02d %02d:%02d:%02d"),
nowTM->tm_year + 1900, nowTM->tm_mon + 1, nowTM->tm_mday,
nowTM->tm_hour, nowTM->tm_min, nowTM->tm_sec );
tempConfLogFileResumeDateStr[19] = 0;
tempBufferLen = _tcslen(tempBufferFormat) - 2 - 2 - 2 - 2 - 2 + _tcslen(workConfLogFileName) + _tcslen(confLogFileStopDateStr) + _tcslen(tempConfLogFileResumeDateStr) + _tcslen(defaultLogFile) + _tcslen(syslogName) + 1;
tempBuffer = malloc(sizeof(TCHAR) * tempBufferLen);
if (!tempBuffer) {
outOfMemoryQueued(TEXT("OLF"), 2);
} else {
_sntprintf(tempBuffer, tempBufferLen, tempBufferFormat, workConfLogFileName, confLogFileStopDateStr, tempConfLogFileResumeDateStr, defaultLogFile, syslogName);
log_printf_queue(TRUE, WRAPPER_SOURCE_WRAPPER, LEVEL_WARN, TEXT("%s"), tempBuffer);
/* This is critical for debugging problems. If the above message would not have shown
* up in the syslog then send it there manually. We are already locked here so this
* can be done safely. */
log_printf_message_sysLog(WRAPPER_SOURCE_WRAPPER, LEVEL_WARN, tempBuffer, nowTM, TRUE);
free(tempBuffer);
}
/* Set the log file path */
setLogfilePath(confLogFileName, FALSE, FALSE);
_sntprintf(currentLogFileName, currentLogFileNameSize, TEXT("%s"), workConfLogFileName);
restoreConfiguredRolling();
logFileChanged = TRUE;
whichLogFile = LOG_FILE_CONFIGURED;
logfileFP = tempLogfileFP;
}
umask(old_umask);
}
}
/* If the file needs to be opened then do so. */
if (logfileFP == NULL) {
old_umask = umask( logFileUmask );
/* Generate the log file name if it is not already set. */
if (whichLogFile != LOG_FILE_DISABLED) {
if (currentLogFileName[0] == TEXT('\0')) {
generateLogFileName(currentLogFileName, currentLogFileNameSize, logFilePath, nowDate, NULL);
logFileChanged = TRUE;
}
logfileFP = _tfopen(currentLogFileName, TEXT("a"));
if (!logfileFP) {
if (whichLogFile == LOG_FILE_DEFAULT) {
_tcsncpy(tempBufferLastErrorText2, getLastErrorText(), 1023);
tempBufferLastErrorText2[1023] = 0;
} else {
_tcsncpy(tempBufferLastErrorText1, getLastErrorText(), 1023);
tempBufferLastErrorText1[1023] = 0;
}
#ifndef WIN32
} else if (logFileGroup != -1) {
changeLogFileGroup(currentLogFileName);
#endif
}
}
if (logfileFP != NULL) {
if (whichLogFile == LOG_FILE_UNSET) {
whichLogFile = LOG_FILE_CONFIGURED;
} else if ((whichLogFile == LOG_FILE_DEFAULT) && (_tstat(logFilePath, &fileStat) == 0) && (fileStat.st_size == 0)) {
/* Generate the log file name if it is not already set. */
if (workConfLogFileName[0] == TEXT('\0')) {
generateLogFileName(workConfLogFileName, confLogFileNameSize, confLogFileName, nowDate, NULL);
}
/* This is a new default log file, so add a header. */
printFailoverFileHeader(workConfLogFileName);
}
} else {
if (whichLogFile != LOG_FILE_DEFAULT) {
logfileFP = _tfopen(defaultLogFile, TEXT("a"));
if (!logfileFP) {
_tcsncpy(tempBufferLastErrorText2, getLastErrorText(), 1023);
tempBufferLastErrorText2[1023] = 0;
#ifndef WIN32
} else if (logFileGroup != -1) {
changeLogFileGroup(defaultLogFile);
#endif
}
if (whichLogFile == LOG_FILE_DISABLED) {
if (logfileFP != NULL) {
enableLogFile();
} else {
/* The logging was disabled and both the default file and the configured file could not be opened. */
confLogFilePathChanged = FALSE;
logFilePathChanged = FALSE;
return FALSE;
}
} else if (!dummyReset) {
/* Save the date in string format so that we don't need to worry about time changes. */
_sntprintf(confLogFileStopDateStr, 20, TEXT("%04d/%02d/%02d %02d:%02d:%02d"),
nowTM->tm_year + 1900, nowTM->tm_mon + 1, nowTM->tm_mday,
nowTM->tm_hour, nowTM->tm_min, nowTM->tm_sec );
confLogFileStopDateStr[19] = 0;
}
/* We need to write our error message into a buffer manually so we can use it
* both for the log_printf_queue and log_printf_message_sysLog calls below. */
tempBufferFormat = TEXT("Unable to write to the configured log file: %s (%s)\n Falling back to the default file in the current working directory: %s");
tempBufferLen = _tcslen(tempBufferFormat) - 2 - 2 - 2 + _tcslen(currentLogFileName) + _tcslen(tempBufferLastErrorText1) + _tcslen(defaultLogFile) + 1;
tempBuffer = malloc(sizeof(TCHAR) * tempBufferLen);
if (!tempBuffer) {
outOfMemoryQueued(TEXT("OLF"), 3);
} else {
_sntprintf(tempBuffer, tempBufferLen, tempBufferFormat, currentLogFileName, tempBufferLastErrorText1, defaultLogFile);
log_printf_queue(TRUE, WRAPPER_SOURCE_WRAPPER, LEVEL_WARN, TEXT("%s"), tempBuffer);
/* This is critical for debugging problems. If the above message would not have shown
* up in the syslog then send it there manually. We are already locked here so this
* can be done safely. */
log_printf_message_sysLog(WRAPPER_SOURCE_WRAPPER, LEVEL_WARN, tempBuffer, nowTM, TRUE);
free(tempBuffer);
}
setLogfilePath(defaultLogFile, FALSE, FALSE);
_sntprintf(currentLogFileName, currentLogFileNameSize, TEXT("%s"), defaultLogFile);
setDefaultRolling();
logFileChanged = TRUE;
}
if (logfileFP != NULL) {
whichLogFile = LOG_FILE_DEFAULT;
if ((_tstat(logFilePath, &fileStat) == 0) && (fileStat.st_size == 0)) {
/* Generate the log file name if it is not already set. */
if (workConfLogFileName[0] == TEXT('\0')) {
generateLogFileName(workConfLogFileName, confLogFileNameSize, confLogFileName, nowDate, NULL);
}
/* This is a new default log file, so add a header. */
printFailoverFileHeader(workConfLogFileName);
}
} else {
/* Still unable to write. */
/* We need to write our error message into a buffer manually so we can use it
* both for the log_printf_queue and log_printf_message_sysLog calls below. */
tempBufferFormat = TEXT("Unable to write to the default log file: %s (%s)\n Disabling log file.");
tempBufferLen = _tcslen(tempBufferFormat) - 2 - 2 + _tcslen(currentLogFileName) + _tcslen(tempBufferLastErrorText2) + 1;
tempBuffer = malloc(sizeof(TCHAR) * tempBufferLen);
if (!tempBuffer) {
outOfMemoryQueued(TEXT("OLF"), 4);
} else {
_sntprintf(tempBuffer, tempBufferLen, tempBufferFormat, currentLogFileName, tempBufferLastErrorText2);
log_printf_queue(TRUE, WRAPPER_SOURCE_WRAPPER, LEVEL_WARN, TEXT("%s"), tempBuffer);
/* This is critical for debugging problems. If the above message would not have shown
* up in the syslog then send it there manually. We are already locked here so this
* can be done safely. */
log_printf_message_sysLog(WRAPPER_SOURCE_WRAPPER, LEVEL_WARN, tempBuffer, nowTM, TRUE);
free(tempBuffer);
}
disableLogFile();
logFileChanged = FALSE;
}
}
umask(old_umask);
#ifdef _DEBUG
if (logfileFP != NULL) {
_tprintf(TEXT("Opened logfile\n"));
}
#endif
}
if (logfileFP == NULL) {
currentLogFileName[0] = TEXT('\0');
/* Failure to write to logfile already reported. */
} else if (whichLogFile == LOG_FILE_CONFIGURED) {
/* Store the time at which the configured file was opened.
* The default log file is not rolled by date and doesn't need this info. */
_tcsncpy(logFileLastNowDate, nowDate, 9);
}
}
confLogFilePathChanged = FALSE;
logFilePathChanged = FALSE;
return logFileChanged;
}
/**
* Prints the contents of a buffer to the logfile target. The log level is
* tested prior to this function being called.
*
* Must be called while locked.
*/
void log_printf_message_logFileInner(int source_id, int level, int threadId, int queued, TCHAR *message, struct tm *nowTM, int nowMillis, time_t durationMillis) {
TCHAR *printBuffer;
if (logfileFP != NULL) {
/* Build up the printBuffer. */
printBuffer = buildPrintBuffer(source_id, level, threadId, queued, nowTM, nowMillis, durationMillis, logfileFormat, LOG_FORMAT_LOGFILE_DEFAULT, message);
if (printBuffer) {
_ftprintf(logfileFP, TEXT("%s\n"), printBuffer);
logFileAccessed = TRUE;
/* Increment the activity counter. */
logfileActivityCount++;
/* Decide whether we want to close or flush the log file immediately after each line.
* If not then flushing and closing will be handled externally by calling flushLogfile() or closeLogfile(). */
if (autoCloseLogfile) {
/* Close the log file immediately. */
#ifdef _DEBUG
_tprintf(TEXT("Closing logfile immediately...\n"));
#endif
fclose(logfileFP);
logfileFP = NULL;
/* Do not clear the currentLogFileName here as we are not changing its name. */
} else if (autoFlushLogfile) {
/* Flush the log file immediately. */
#ifdef _DEBUG
_tprintf(TEXT("Flushing logfile immediately...\n"));
#endif
fflush(logfileFP);
}
/* Leave the file open. It will be closed later after a period of inactivity. */
}
}
}
int log_printf_message_logFile(int source_id, int level, int threadId, int queued, TCHAR *message, struct tm *nowTM, int nowMillis, time_t durationMillis) {
int logFileChanged = FALSE;
if ((level >= currentLogfileLevel) || (whichLogFile == LOG_FILE_DISABLED)) {
logFileChanged = openLogFile(nowTM, message);
if (level >= currentLogfileLevel) {
log_printf_message_logFileInner(source_id, level, threadId, queued, message, nowTM, nowMillis, durationMillis);
}
}
return logFileChanged;
}
/* Write the print buffer to the console. */
void printToConsoleInner(const TCHAR *printBuffer, FILE *target, int newLine) {
const TCHAR* fmt = newLine ? TEXT("%s\n") : TEXT("%s");
#ifdef WIN32
HANDLE targetH;
int complete = FALSE;
/* Using the WinAPI function WriteConsole would make it impossible to pipe the console output.
* We never want to allow direct console writing if this is a launcher instance.*/
if (consoleDirect) {
if (target == stderr) {
targetH = GetStdHandle(STD_ERROR_HANDLE);
} else {
targetH = GetStdHandle(STD_OUTPUT_HANDLE);
}
if (targetH != NULL) {
complete = writeToConsole(targetH, fmt, printBuffer);
} else {
/* Should not happen. But just in case. */
_tprintf(TEXT("Failed to find standard handle. Disabled direct console output.\n"));
consoleDirect = FALSE;
}
}
if (!complete) {
#endif
_ftprintf(target, fmt, printBuffer);
if (consoleFlush) {
fflush(target);
}
#ifdef WIN32
}
#endif
}
void printToConsole(const TCHAR *printBuffer, FILE *target) {
if (lockLoggingMutex()) {
return;
}
printToConsoleInner(printBuffer, target, FALSE);
if (releaseLoggingMutex()) {
return;
}
}
void printToConsoleLn(const TCHAR *printBuffer, FILE *target) {
if (lockLoggingMutex()) {
return;
}
printToConsoleInner(printBuffer, target, TRUE);
if (releaseLoggingMutex()) {
return;
}
}
/**
* Prints the contents of a buffer to the console target. The log level is
* tested prior to this function being called.
*
* Must be called while locked.
*/
void log_printf_message_consoleInner(int source_id, int level, int threadId, int queued, TCHAR *message, struct tm *nowTM, int nowMillis, time_t durationMillis) {
TCHAR *printBuffer;
FILE *target;
/* Build up the printBuffer. */
printBuffer = buildPrintBuffer(source_id, level, threadId, queued, nowTM, nowMillis, durationMillis, consoleFormat, LOG_FORMAT_CONSOLE_DEFAULT, message);
if (printBuffer) {
/* Decide where to send the output. */
switch (level) {
case LEVEL_FATAL:
if (consoleFatalToStdErr) {
target = stderr;
} else {
target = stdout;
}
break;
case LEVEL_ERROR:
if (consoleErrorToStdErr) {
target = stderr;
} else {
target = stdout;
}
break;
case LEVEL_WARN:
if (consoleWarnToStdErr) {
target = stderr;
} else {
target = stdout;
}
break;
default:
target = stdout;
break;
}
printToConsoleInner(printBuffer, target, TRUE);
}
}
void log_printf_message_console(int source_id, int level, int threadId, int queued, TCHAR *message, struct tm *nowTM, int nowMillis, time_t durationMillis) {
if (level >= currentConsoleLevel) {
log_printf_message_consoleInner(source_id, level, threadId, queued, message, nowTM, nowMillis, durationMillis);
}
}
/**
* Prints the contents of a buffer to all configured targets.
*
* Must be called while locked.
*
* @param message The message to log. This is not a message format, but may contain format characters.
* The content of the message buffer may be modified by this call if it contains line feeds.
* @param sysLogEnabled A flag that is used to help with recursion to control
* whether or not the syslog should be considered as a log
* target for this call. It is always disabled when we
* recurse.
*
* @return True if the logfile name changed.
*/
int log_printf_message(int source_id, int level, int threadId, int queued, TCHAR *message, int sysLogEnabled) {
#ifndef WIN32
TCHAR *printBuffer;
FILE *target;
#endif
int logFileChanged = FALSE;
TCHAR *subMessage;
TCHAR *nextLF;
#ifdef WIN32
struct _timeb timebNow;
#else
size_t reqSize;
struct timeval timevalNow;
TCHAR intBuffer[3];
TCHAR* pos;
#endif
time_t now;
int nowMillis;
struct tm *nowTM;
time_t durationMillis;
#ifndef WIN32
if ((_tcsstr(message, LOG_SPECIAL_MARKER) == message) && (_tcslen(message) >= _tcslen(LOG_SPECIAL_MARKER) + 10)) {
/* Got a special encoded log message from the child Wrapper process.
* Parse it and continue as if the log message came from this process.
* These should never be multi-line messages as the forked child
* process will have already broken them up. */
pos = (TCHAR *)(message + _tcslen(LOG_SPECIAL_MARKER) + 1);
/* source_id */
_tcsncpy(intBuffer, pos, 2);
intBuffer[2] = TEXT('\0');
source_id = _ttoi(intBuffer);
pos += 3;
/* level */
_tcsncpy(intBuffer, pos, 2);
intBuffer[2] = TEXT('\0');
level = _ttoi(intBuffer);
pos += 3;
/* threadId */
_tcsncpy(intBuffer, pos, 2);
intBuffer[2] = TEXT('\0');
threadId = _ttoi(intBuffer);
pos += 3;
/* message */
message = pos;
}
#endif
/* Build a timestamp */
#ifdef WIN32
_ftime( &timebNow );
now = (time_t)timebNow.time;
nowMillis = timebNow.millitm;
#else
gettimeofday( &timevalNow, NULL );
now = (time_t)timevalNow.tv_sec;
nowMillis = timevalNow.tv_usec / 1000;
#endif
nowTM = localtime( &now );
/* Calculate the number of milliseconds which have passed since the previous log entry.
* We only need to display up to 8 digits, so if the result is going to be larger than
* that, set it to 100000000.
* We only want to do this for output coming from the JVM. Any other log output should
* be set to (time_t)-1. */
switch(source_id) {
case WRAPPER_SOURCE_WRAPPER:
case WRAPPER_SOURCE_PROTOCOL:
durationMillis = (time_t)-1;
break;
default:
if (now - previousNow > 100000) {
/* Without looking at the millis, we know it is already too long. */
durationMillis = 100000000;
} else {
durationMillis = (now - previousNow) * 1000 + nowMillis - previousNowMillis;
}
previousNow = now;
previousNowMillis = nowMillis;
break;
}
if (!currentLogSplitMessages) {
/* Syslog messages are printed first so we can print them including line feeds as is.
* This must be done before we break up multi-line messages into individual lines. */
#ifdef WIN32
if (sysLogEnabled) {
#else
/* On UNIX we never want to log to the syslog here if this is in a forked thread.
* In this case, any lines will be broken up into individual lines and then logged
* as usual by the main process. But this can't be helped and is very rare anyway. */
if (sysLogEnabled && (_tcsstr(message, LOG_FORK_MARKER) != message)) {
#endif
/* syslog/Eventlog. */
log_printf_message_sysLog(source_id, level, message, nowTM, FALSE);
}
}
/* If the message contains line feeds then break up the line into substrings and recurse. */
subMessage = message;
nextLF = _tcschr(subMessage, TEXT('\n'));
if (nextLF) {
/* This string contains more than one line. Loop over the strings. It is Ok to corrupt this string because it is only used once. */
while (nextLF) {
nextLF[0] = TEXT('\0');
logFileChanged |= log_printf_message(source_id, level, threadId, queued, subMessage, FALSE);
/* Locate the next one. */
subMessage = &(nextLF[1]);
nextLF = _tcschr(subMessage, TEXT('\n'));
}
/* The rest of the buffer will be the final line. */
logFileChanged |= log_printf_message(source_id, level, threadId, queued, subMessage, FALSE);
return logFileChanged;
}
#ifndef WIN32
/* See if this is a special case log entry from the forked child. */
if (_tcsstr(message, LOG_FORK_MARKER) == message) {
/* Found the marker. We only want to log the message as is to the console with a special prefix.
* This is used to pass the log output through the pipe to the parent Wrapper process where it
* will be decoded below and displayed appropriately. */
reqSize = _tcslen(LOG_SPECIAL_MARKER) + 1 + 2 + 1 + 2 + 1 + 2 + 1 + _tcslen(message) - _tcslen(LOG_FORK_MARKER) + 1;
if (!(printBuffer = preparePrintBuffer(reqSize))) {
return FALSE;
}
_sntprintf(printBuffer, reqSize, TEXT("%s|%02d|%02d|%02d|%s"), LOG_SPECIAL_MARKER, source_id, level, threadId, message + _tcslen(LOG_FORK_MARKER));
/* Decide where to send the output. */
switch (level) {
case LEVEL_FATAL:
if (consoleFatalToStdErr) {
target = stderr;
} else {
target = stdout;
}
break;
case LEVEL_ERROR:
if (consoleErrorToStdErr) {
target = stderr;
} else {
target = stdout;
}
break;
case LEVEL_WARN:
if (consoleWarnToStdErr) {
target = stderr;
} else {
target = stdout;
}
break;
default:
target = stdout;
break;
}
_ftprintf(target, TEXT("%s\n"), printBuffer);
if (consoleFlush) {
fflush(target);
}
return FALSE;
}
#endif
/* Get the current threadId. */
if ( threadId < 0 )
{
/* The current thread was specified. Resolve what thread this actually is. */
threadId = getThreadId();
}
/* Syslog outbut by format (If messages splitting is enabled. Otherwise done above.) */
if (currentLogSplitMessages) {
log_printf_message_sysLog(source_id, level, message, nowTM, FALSE);
}
/* Console output by format */
log_printf_message_console(source_id, level, threadId, queued, message, nowTM, nowMillis, durationMillis);
/* Logfile output by format */
logFileChanged = log_printf_message_logFile(source_id, level, threadId, queued, message, nowTM, nowMillis, durationMillis);
return logFileChanged;
}
/**
* Used for testing to pause the current thread for the specified number of seconds.
* This can only be called when logging is locked.
*
* @param pauseTime Number of seconds to pause, 0 pauses indefinitely.
*/
void pauseThread(int pauseTime) {
int i;
if (pauseTime > 0) {
for (i = 0; i < pauseTime; i++) {
logSleep(1000);
}
} else {
while (TRUE) {
logSleep(1000);
}
}
}
/**
* General log function
*
* @param source_id The source constant or JVM number, negative values are one of the WRAPPER_SOURCE_* constants.
* If the constant is positive then it is a JVM launch number, and the output is from the JVM.
* If the constant is 0, the output is from 'java -version'.
* @param level Level at which to log the output.
* @param lpszFmt Format control.
*/
void log_printf( int source_id, int level, const TCHAR *lpszFmt, ... ) {
va_list vargs;
int count;
int threadId;
int logFileChanged;
TCHAR *logFileCopy;
#if defined(UNICODE) && !defined(WIN32)
TCHAR *msg = NULL;
int i;
int msgMalloced;
#endif
#ifdef WIN32
struct _timeb timebNow;
#else
struct timeval timevalNow;
#endif
time_t startNow;
int startNowMillis;
time_t endNow;
int endNowMillis;
if (level == LEVEL_NONE) {
/* Some APIs allow the user to potentially configure the NONE log level. Skip it as it means no logging in this case. */
return;
}
/* If we are checking on the log time then store the start time. */
if (logPrintfWarnThreshold > 0) {
#ifdef WIN32
_ftime(&timebNow);
startNow = (time_t)timebNow.time;
startNowMillis = timebNow.millitm;
#else
gettimeofday(&timevalNow, NULL);
startNow = (time_t)timevalNow.tv_sec;
startNowMillis = timevalNow.tv_usec / 1000;
#endif
} else {
startNow = 0;
startNowMillis = 0;
}
/* We need to be very careful that only one thread is allowed in here
* at a time. On Windows this is done using a Mutex object that is
* initialized in the initLogging function. */
if (lockLoggingMutex()) {
return;
}
/* If there is a queued pause then do so. */
if ((logPauseTime >= 0) && (level > LEVEL_DEBUG) && (source_id < 0)) {
pauseThread(logPauseTime);
logPauseTime = -1;
}
#if defined(UNICODE) && !defined(WIN32)
if ((source_id < 0) && (wcsstr(lpszFmt, TEXT("%s")) != NULL)) {
msg = malloc(sizeof(wchar_t) * (wcslen(lpszFmt) + 1));
if (msg) {
/* Loop over the format and convert all '%s' patterns to %S' so the UNICODE displays correctly. */
if (wcslen(lpszFmt) > 0) {
for (i = 0; i < _tcslen(lpszFmt); i++){
msg[i] = lpszFmt[i];
if ((lpszFmt[i] == TEXT('%')) && (i < _tcslen(lpszFmt)) && (lpszFmt[i + 1] == TEXT('s')) && ((i == 0) || (lpszFmt[i - 1] != TEXT('%')))){
msg[i+1] = TEXT('S'); i++;
}
}
}
msg[wcslen(lpszFmt)] = TEXT('\0');
} else {
_tprintf(TEXT("Out of memory in logging code (%s)\n"), TEXT("P1"));
return;
}
msgMalloced = TRUE;
} else {
msg = (TCHAR*) lpszFmt;
msgMalloced = FALSE;
}
#endif
threadId = getThreadId();
if (source_id < 0) {
/* Loop until the buffer is large enough that we are able to successfully
* print into it. Once the buffer has grown to the largest message size,
* smaller messages will pass through this code without looping. */
do {
if ( threadMessageBufferSize == 0 )
{
/* No buffer yet. Allocate one to get started. */
threadMessageBufferSize = threadMessageBufferInitialSize;
#if defined(HPUX)
/* Due to a bug in the HPUX libc (version < 1403), the buffer passed to _vsntprintf must have a length of 1 + N, where N is a multiple of 8. Adjust it as necessary. */
threadMessageBufferSize = threadMessageBufferSize + (((threadMessageBufferSize - 1) % 8) == 0 ? 0 : 8 - ((threadMessageBufferSize - 1) % 8));
#endif
threadMessageBuffer = malloc(sizeof(TCHAR) * threadMessageBufferSize);
if (!threadMessageBuffer) {
_tprintf(TEXT("Out of memory in logging code (%s)\n"), TEXT("P2"));
threadMessageBufferSize = 0;
#if defined(UNICODE) && !defined(WIN32)
if (msgMalloced) {
free(msg);
}
#endif
return;
}
}
/* Try writing to the buffer. */
va_start( vargs, lpszFmt );
#if defined(UNICODE) && !defined(WIN32)
count = _vsntprintf( threadMessageBuffer, threadMessageBufferSize, msg, vargs );
#else
count = _vsntprintf( threadMessageBuffer, threadMessageBufferSize, lpszFmt, vargs );
#endif
va_end( vargs );
/*
_tprintf(TEXT(" vsnprintf->%d, size=%d\n"), count, threadMessageBufferSize );
*/
if ( ( count < 0 ) || ( count >= (int)threadMessageBufferSize ) ) {
/* If the count is exactly equal to the buffer size then a null TCHAR was not written.
* It must be larger.
* Windows will return -1 if the buffer is too small. If the number is
* exact however, we still need to expand it to have room for the null.
* UNIX will return the required size. */
/* Free the old buffer for starters. */
free( threadMessageBuffer );
/* Decide on a new buffer size.
* We can't tell how long the resulting string will be without expanding because the
* results are stored in the vargs.
* Most messages will be short, but there is a possibility that some will be very
* long. To minimize the number of times that we need to loop, while at the same
* time trying to avoid using too much memory, increase the size by the maximum of
* 1024 or 10% of the current length.
* Some platforms will return the required size as count. Use that if available. */
threadMessageBufferSize = __max(threadMessageBufferSize + 1024, __max(threadMessageBufferSize + threadMessageBufferSize / 10, (size_t)count + 1));
#if defined(HPUX)
/* Due to a bug in the HPUX libc (version < 1403), the buffer passed to _vsntprintf must have a length of 1 + N, where N is a multiple of 8. Adjust it as necessary. */
threadMessageBufferSize = threadMessageBufferSize + (((threadMessageBufferSize - 1) % 8) == 0 ? 0 : 8 - ((threadMessageBufferSize - 1) % 8));
#endif
threadMessageBuffer = malloc(sizeof(TCHAR) * threadMessageBufferSize);
if (!threadMessageBuffer) {
_tprintf(TEXT("Out of memory in logging code (%s)\n"), TEXT("P3"));
threadMessageBufferSize = 0;
#if defined(UNICODE) && !defined(WIN32)
if (msgMalloced) {
free(msg);
}
#endif
return;
}
/* Always set the count to -1 so we will loop again. */
count = -1;
}
} while ( count < 0 );
}
#if defined(UNICODE) && !defined(WIN32)
if (msgMalloced) {
free(msg);
}
#endif
logFileCopy = NULL;
if (source_id >= 0) {
/* As this is content from the JVM, the msg or lpszFmt is direct message, not a message format. */
#if defined(UNICODE) && !defined(WIN32)
logFileChanged = log_printf_message(source_id, level, threadId, FALSE, msg, TRUE);
#else
logFileChanged = log_printf_message(source_id, level, threadId, FALSE, (TCHAR*)lpszFmt, TRUE);
#endif
} else {
/* The lpszFmt parameter was treated as a message format, and was expanded into the threadMessageBuffer buffer. */
logFileChanged = log_printf_message(source_id, level, threadId, FALSE, threadMessageBuffer, TRUE);
}
if (logFileChanged) {
/* We need to enqueue a notification that the log file name was changed.
* We can NOT directly send the notification here as that could cause a deadlock,
* depending on where exactly this function was called from. (See Wrapper protocol mutex.) */
logFileCopy = malloc(sizeof(TCHAR) * (_tcslen(currentLogFileName) + 1));
if (!logFileCopy) {
_tprintf(TEXT("Out of memory in logging code (%s)\n"), TEXT("P4"));
} else {
_tcsncpy(logFileCopy, currentLogFileName, _tcslen(currentLogFileName) + 1);
/* Now after we have 100% prepared the log file name. Put into the queue variable
* so the maintainLogging() function can safely grab it at any time.
* The reading code is also in a semaphore so we can do a quick test here safely as well. */
if (pendingLogFileChange) {
/* The previous file was still in the queue. Free it up to avoid a memory leak.
* This can happen if the log file size is 1k or something like that. We will always
* keep the most recent file however, so this should not be that big a problem. */
#ifdef _DEBUG
_tprintf(TEXT("Log file name change was overwritten in queue: %s\n"), pendingLogFileChange);
#endif
free(pendingLogFileChange);
}
pendingLogFileChange = logFileCopy;
}
}
/* Release the lock we have on this function so that other threads can get in. */
if (releaseLoggingMutex()) {
return;
}
/* If we are checking on the log time then store the stop time.
* It is Ok that some of the error paths don't make it this far. */
if (logPrintfWarnThreshold > 0) {
#ifdef WIN32
_ftime(&timebNow);
endNow = (time_t)timebNow.time;
endNowMillis = timebNow.millitm;
#else
gettimeofday(&timevalNow, NULL);
endNow = (time_t)timevalNow.tv_sec;
endNowMillis = timevalNow.tv_usec / 1000;
#endif
previousLogLag = __min(endNow - startNow, 3600) * 1000 + endNowMillis - startNowMillis;
if (previousLogLag >= logPrintfWarnThreshold) {
log_printf_queue(TRUE, WRAPPER_SOURCE_WRAPPER, LEVEL_WARN, TEXT("Write to log took %d milliseconds."), previousLogLag);
}
}
}
/* Internal functions */
#ifdef WIN32
static int sysLangId = LANG_NEUTRAL;
/**
* Sets the language id to use to format system messages.
* This function should be called when resolving the locale.
*
* @param id Language Identifier (16-bit value that consists of a
* primary language identifier and a sublanguage identifier)
*/
void setLogSysLangId(int id) {
sysLangId = id;
}
#endif
#define LAST_ERROR_TEXT_BUFFER_SIZE 1024
/** Buffer holding the last error message.
* TODO: This needs to be made thread safe, meaning that we need a buffer for each thread. */
TCHAR lastErrorTextBufferW[LAST_ERROR_TEXT_BUFFER_SIZE];
/**
* Returns a textual error message of a given error number.
*
* @param errorNum Error code.
* @param handle (for Windows only) A module handle containing the message-table resource(s) to search. If NULL, the current process's application image file will be searched.
*
* @return The error message.
*/
const TCHAR* getErrorText(int errorNum, void* handle) {
#ifdef WIN32
DWORD dwRet;
TCHAR* lpszTemp = NULL;
DWORD dwFlags;
int formatError;
#else
char* lastErrorTextMB;
size_t req;
#endif
#ifdef WIN32
if (handle) {
/* Some system messages in ntdll.dll (ntstatus.h) contain arguments, but we actually never pass arguments to FormatMessage().
* FORMAT_MESSAGE_IGNORE_INSERTS specifies that any arguments should be left in the message for later formatting.
* We use this flag when a handle is specified to be able to check whether there are arguments. However, we don't use
* it when just formatting from system messages as those should not contain arguments (if they do, it is better to not
* specify the flag as this would cause the percentages to be skipped instead of producing a corrupted string). */
dwFlags = FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ARGUMENT_ARRAY | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_HMODULE;
} else {
dwFlags = FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ARGUMENT_ARRAY;
}
dwRet = FormatMessage(dwFlags,
handle,
errorNum,
sysLangId,
(TCHAR*)&lpszTemp,
0,
NULL);
if (!dwRet) {
/* There was an error calling FormatMessage. */
formatError = getLastError();
if ((formatError == ERROR_MUI_FILE_NOT_FOUND) ||
(formatError == ERROR_MUI_INVALID_FILE) ||
(formatError == ERROR_MUI_INVALID_RC_CONFIG) ||
(formatError == ERROR_MUI_INVALID_LOCALE_NAME) ||
(formatError == ERROR_MUI_INVALID_ULTIMATEFALLBACK_NAME) ||
(formatError == ERROR_MUI_FILE_NOT_LOADED) ||
(formatError == ERROR_RESOURCE_LANG_NOT_FOUND)) {
/* The following condition is important to not fall into an infinite loop. */
if (sysLangId != LANG_NEUTRAL) {
/* Fall back to the system language. */
setLogSysLangId(LANG_NEUTRAL);
return getErrorText(errorNum, handle);
}
}
_sntprintf(lastErrorTextBufferW, LAST_ERROR_TEXT_BUFFER_SIZE, TEXT("Failed to format system error message (Error: %d) (Original Error: 0x%x)"), formatError, errorNum);
} else if ((long)LAST_ERROR_TEXT_BUFFER_SIZE - 1 < (long)dwRet + 14) {
/* supplied buffer is not long enough (14 is for the length of the error code in hexadecimal notation (12)+ space + null termination character) */
_sntprintf(lastErrorTextBufferW, LAST_ERROR_TEXT_BUFFER_SIZE, TEXT("System error message is too large to convert (Required size: %d) (Original Error: 0x%x)"), dwRet, errorNum);
formatError = ERROR_BUFFER_OVERFLOW;
} else {
lpszTemp[lstrlen(lpszTemp)-2] = TEXT('\0'); /* remove cr and newline character */
_sntprintf(lastErrorTextBufferW, LAST_ERROR_TEXT_BUFFER_SIZE, TEXT("%s (0x%x)"), lpszTemp, errorNum);
formatError = ERROR_SUCCESS;
}
/* following the documentation of FormatMessage, LocalFree should be called to free the output buffer. */
if (lpszTemp) {
LocalFree(lpszTemp);
}
#else
lastErrorTextMB = strerror(errorNum);
req = mbstowcs(NULL, lastErrorTextMB, MBSTOWCS_QUERY_LENGTH);
if (req == (size_t)-1) {
invalidMultiByteSequence(TEXT("GLET"), 1);
_sntprintf(lastErrorTextBufferW, LAST_ERROR_TEXT_BUFFER_SIZE, TEXT("System error message could not be decoded (Error 0x%x)"), errorNum);
} else if (req >= LAST_ERROR_TEXT_BUFFER_SIZE) {
_sntprintf(lastErrorTextBufferW, LAST_ERROR_TEXT_BUFFER_SIZE, TEXT("System error message too large to convert (Require size: %d) (Original Error: 0x%x)"), req, errorNum);
} else {
mbstowcs(lastErrorTextBufferW, lastErrorTextMB, LAST_ERROR_TEXT_BUFFER_SIZE);
}
#endif
/* Always reterminate the buffer just to be sure it is safe because badly encoded characters can cause issues. */
lastErrorTextBufferW[LAST_ERROR_TEXT_BUFFER_SIZE - 1] = TEXT('\0');
#ifdef WIN32
SetLastError(formatError);
#endif
return lastErrorTextBufferW;
}
/**
* Returns a textual error message of the last error encountered.
*
* @return The last error message.
*/
const TCHAR* getLastErrorText() {
return getErrorText(getLastError(), NULL);
}
/**
* Returns the last error number.
*
* @return The last error number.
*/
int getLastError() {
#ifdef WIN32
return GetLastError();
#else
return errno;
#endif
}
#ifdef WIN32
static int eventLogSourceInstalled = FALSE;
/**
* Disable Event Log.
* This function has to be called if the registration could not be completed.
*/
void disableSysLog(int silent) {
if (getSyslogLevelInt() != LEVEL_NONE) {
setSyslogLevelInt(LEVEL_NONE);
if (!silent) {
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_WARN,
TEXT("Disabling Event Log because the application is not registered.\n Run the wrapper with the '--setup' option to register."));
}
}
}
/**
* Check if the Event Log source was registered successfully.
* There are 2 ways to register:
* CASE 1: If we need elevated privileges, it should be done through the setup process (see --setup argument).
* CASE 2: On older versions of windows where running elevated was not needed, registerSyslogMessageFile() can be called when the wrapper runs.
*
* Returns TRUE if registered, FALSE if not registered.
*/
int syslogMessageFileRegistered(int silent) {
static int checked = FALSE;
TCHAR bufferPath[_MAX_PATH];
TCHAR bufferKVal[_MAX_PATH];
TCHAR regPath[1024];
DWORD cbData = _MAX_PATH;
DWORD usedLen;
DWORD error;
HKEY hKey;
/* first check if the function was called before */
if (checked || eventLogSourceInstalled) { /* || eventLogSourceInstalled: just in case we would have run registerSyslogMessageFile(TRUE) before this function (should not happen) */
return eventLogSourceInstalled;
}
/* if the registry key exist, and the path to the wrapper is ok, lets assume the registration was done successfully. No need to check the other values of the key */
/* Get absolute path to service manager */
/* Important : For win XP getLastError() is unchanged if the buffer is too small, so if we don't reset the last error first, we may actually test an old pending error. */
SetLastError(ERROR_SUCCESS);
usedLen = GetModuleFileName(NULL, bufferPath, _MAX_PATH);
if (usedLen == 0) {
if (!silent) {
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_ERROR,
TEXT("Unable to obtain the full path to the Wrapper. %s"), getLastErrorText());
}
} else if ((usedLen == _MAX_PATH) || (getLastError() == ERROR_INSUFFICIENT_BUFFER)) {
if (!silent) {
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_ERROR,
TEXT("Unable to obtain the full path to the Wrapper. Path to Wrapper binary too long."));
}
} else {
_sntprintf( regPath, 1024, TEXT("SYSTEM\\CurrentControlSet\\Services\\Eventlog\\Application\\%s"), loginfoSourceName );
/* check that the registry key exists. */
if ((error = RegOpenKeyEx( HKEY_LOCAL_MACHINE, regPath, 0, KEY_READ, (PHKEY) &hKey )) == ERROR_SUCCESS ) {
/* check that the path to the wrapper is correct. */
if ((error = RegQueryValueEx( hKey, TEXT("EventMessageFile"), NULL, NULL, (LPBYTE) bufferKVal, &cbData)) == ERROR_SUCCESS ) {
if (strcmpIgnoreCase(bufferPath, bufferKVal) == 0) {
eventLogSourceInstalled = TRUE;
} else if (!silent) {
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_DEBUG,
TEXT("The path registered for the Event Log (%s) did not match the location of the Wrapper binary (%s)."), bufferKVal, bufferPath);
}
} else if (!silent) {
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_DEBUG,
TEXT("The path registered for the Event Log could not be read (0x%x)."), error);
}
RegCloseKey( hKey );
} else if ((error != ERROR_FILE_NOT_FOUND) && !silent) {
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_DEBUG,
TEXT("The Event Log source could not be found (0x%x)."), error);
}
}
checked = TRUE;
return eventLogSourceInstalled;
}
#endif
/**
* Register to the Log Event System
* There are 2 ways to register:
* CASE 1: If we need elevated privileges, it should be done through the setup process (see --setup argument).
* CASE 2: On older versions of windows where running elevated was not needed, registerSyslogMessageFile() can called when the wrapper runs.
*/
int registerSyslogMessageFile(int forceInstall, int silent) {
#ifdef WIN32
TCHAR buffer[_MAX_PATH];
DWORD usedLen;
TCHAR regPath[1024];
TCHAR regValueName[32];
HKEY hKey;
DWORD categoryCount, typesSupported;
DWORD error;
if (!forceInstall && syslogMessageFileRegistered(silent)) {
return 0;
}
/* Get absolute path to service manager */
/* Important : For win XP getLastError() is unchanged if the buffer is too small, so if we don't reset the last error first, we may actually test an old pending error. */
SetLastError(ERROR_SUCCESS);
usedLen = GetModuleFileName(NULL, buffer, _MAX_PATH);
if (usedLen == 0) {
if (!silent) {
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_ERROR,
TEXT("Unable to obtain the full path to the Wrapper. %s"), getLastErrorText());
}
} else if ((usedLen == _MAX_PATH) || (getLastError() == ERROR_INSUFFICIENT_BUFFER)) {
if (!silent) {
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_ERROR,
TEXT("Unable to obtain the full path to the Wrapper. Path to Wrapper binary too long."));
}
} else {
_sntprintf( regPath, 1024, TEXT("SYSTEM\\CurrentControlSet\\Services\\Eventlog\\Application\\%s"), loginfoSourceName );
if( RegCreateKey( HKEY_LOCAL_MACHINE, regPath, (PHKEY) &hKey ) == ERROR_SUCCESS ) {
RegCloseKey( hKey );
if( RegOpenKeyEx( HKEY_LOCAL_MACHINE, regPath, 0, KEY_WRITE, (PHKEY) &hKey ) == ERROR_SUCCESS ) {
/* Set EventMessageFile */
_tcsncpy(regValueName, TEXT("EventMessageFile"), 32);
if ((error = RegSetValueEx(hKey, regValueName, 0, REG_SZ, (LPBYTE) buffer, (DWORD)(sizeof(TCHAR) * (_tcslen(buffer) + 1)))) == ERROR_SUCCESS) {
/* Set CategoryMessageFile */
_tcsncpy(regValueName, TEXT("CategoryMessageFile"), 32);
if ((error = RegSetValueEx(hKey, regValueName, 0, REG_SZ, (LPBYTE) buffer, (DWORD)(sizeof(TCHAR) * (_tcslen(buffer) + 1)))) == ERROR_SUCCESS) {
/* Set CategoryCount */
_tcsncpy(regValueName, TEXT("CategoryCount"), 32);
categoryCount = 12;
if ((error = RegSetValueEx(hKey, regValueName, 0, REG_DWORD, (LPBYTE) &categoryCount, sizeof(DWORD))) == ERROR_SUCCESS) {
/* Set TypesSupported */
_tcsncpy(regValueName, TEXT("TypesSupported"), 32);
typesSupported = 7;
if ((error = RegSetValueEx(hKey, regValueName, 0, REG_DWORD, (LPBYTE) &typesSupported, sizeof(DWORD))) == ERROR_SUCCESS) {
eventLogSourceInstalled = TRUE;
}
}
}
}
RegCloseKey( hKey );
if (error != ERROR_SUCCESS) {
if (!silent) {
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_DEBUG,
TEXT("Failed to set '%s' when registering to the Event Log (0x%x)."), regValueName, error);
}
}
}
}
}
if (!eventLogSourceInstalled) {
/* not registered or failed to register correctly */
disableSysLog(silent);
return 1;
}
return 0;
#else
return 0;
#endif
}
/**
* Unregister from the Log Event System
*/
int unregisterSyslogMessageFile(int silent) {
#ifdef WIN32
DWORD error;
/* If we deregister this application, then the event viewer will not work when the program is not running. */
/* Don't want to clutter up the Registry, but is there another way? */
/* From 3.5.28 we want to allow the user to never register. */
TCHAR regPath[ 1024 ];
/* Get absolute path to service manager */
_sntprintf( regPath, 1024, TEXT("SYSTEM\\CurrentControlSet\\Services\\Eventlog\\Application\\%s"), loginfoSourceName );
error = RegDeleteKey(HKEY_LOCAL_MACHINE, regPath);
if((error == ERROR_SUCCESS) || (error == ERROR_FILE_NOT_FOUND)) {
eventLogSourceInstalled = FALSE;
disableSysLog(silent);
return 0;
}
return 1; /* Failure */
#else
return 0;
#endif
}
#ifdef WIN32
void sendEventlogMessage( int source_id, int level, const TCHAR *szBuff ) {
TCHAR header[16];
const TCHAR **strings;
WORD eventType;
HANDLE handle;
WORD eventID, categoryID;
int result;
strings = malloc(sizeof(TCHAR *) * 3);
if (!strings) {
_tprintf(TEXT("Out of memory in logging code (%s)\n"), TEXT("SEM1"));
return;
}
/* Build the source header */
switch(source_id) {
case WRAPPER_SOURCE_WRAPPER:
#ifdef WIN32
if (launcherSource) {
_sntprintf( header, 16, TEXT("wrapperm") );
} else {
_sntprintf( header, 16, TEXT("wrapper") );
}
#else
_sntprintf( header, 16, TEXT("wrapper") );
#endif
break;
case WRAPPER_SOURCE_PROTOCOL:
_sntprintf( header, 16, TEXT("wrapperp") );
break;
case WRAPPER_SOURCE_JVM_VERSION:
_sntprintf( header, 16, TEXT("jvm ver.") );
break;
default:
_sntprintf( header, 16, TEXT("jvm %d"), source_id );
header[15] = TEXT('\0'); /* Just in case we get lots of restarts. */
break;
}
/* Build event type by level */
switch(level) {
case LEVEL_NOTICE: /* Will not get in here. */
case LEVEL_ADVICE: /* Will not get in here. */
case LEVEL_FATAL:
eventType = EVENTLOG_ERROR_TYPE;
break;
case LEVEL_ERROR:
case LEVEL_WARN:
eventType = EVENTLOG_WARNING_TYPE;
break;
case LEVEL_STATUS:
case LEVEL_INFO:
case LEVEL_DEBUG:
eventType = EVENTLOG_INFORMATION_TYPE;
break;
}
/* Set the category id to the appropriate resource id. */
if ( source_id == WRAPPER_SOURCE_WRAPPER ) {
categoryID = MSG_EVENT_LOG_CATEGORY_WRAPPER;
} else if ( source_id == WRAPPER_SOURCE_PROTOCOL ) {
categoryID = MSG_EVENT_LOG_CATEGORY_PROTOCOL;
} else {
/* Source is a JVM. */
switch ( source_id ) {
case 1:
categoryID = MSG_EVENT_LOG_CATEGORY_JVM1;
break;
case 2:
categoryID = MSG_EVENT_LOG_CATEGORY_JVM2;
break;
case 3:
categoryID = MSG_EVENT_LOG_CATEGORY_JVM3;
break;
case 4:
categoryID = MSG_EVENT_LOG_CATEGORY_JVM4;
break;
case 5:
categoryID = MSG_EVENT_LOG_CATEGORY_JVM5;
break;
case 6:
categoryID = MSG_EVENT_LOG_CATEGORY_JVM6;
break;
case 7:
categoryID = MSG_EVENT_LOG_CATEGORY_JVM7;
break;
case 8:
categoryID = MSG_EVENT_LOG_CATEGORY_JVM8;
break;
case 9:
categoryID = MSG_EVENT_LOG_CATEGORY_JVM9;
break;
default:
categoryID = MSG_EVENT_LOG_CATEGORY_JVMXX;
break;
}
}
/* Place event in eventlog */
strings[0] = header;
strings[1] = szBuff;
strings[2] = 0;
eventID = level;
handle = RegisterEventSource( NULL, loginfoSourceName );
if( !handle )
return;
result = ReportEvent(
handle, /* handle to event log */
eventType, /* event type */
categoryID, /* event category */
MSG_EVENT_LOG_MESSAGE, /* event identifier */
NULL, /* user security identifier */
2, /* number of strings to merge */
0, /* size of binary data */
(const TCHAR**) strings, /* array of strings to merge */
NULL /* binary data buffer */
);
if (result == 0) {
/* If there are any errors accessing the event log, like it is full, then disable its output. */
setSyslogLevelInt(LEVEL_NONE);
/* Recurse so this error gets set in the log file and console. The syslog
* output has been disabled so we will not get back here. */
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_ERROR, TEXT("Unable to write to the EventLog due to: %s"), getLastErrorText());
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_ERROR, TEXT("Internally setting wrapper.syslog.loglevel=NONE to prevent further messages."));
}
DeregisterEventSource( handle );
free( (void *) strings );
strings = NULL;
}
#else
void sendLoginfoMessage( int source_id, int level, const TCHAR *szBuff ) {
int eventType;
/* Build event type by level */
switch( level ) {
case LEVEL_FATAL:
eventType = LOG_CRIT;
break;
case LEVEL_ERROR:
eventType = LOG_ERR;
break;
case LEVEL_WARN:
case LEVEL_STATUS:
eventType = LOG_NOTICE;
break;
case LEVEL_INFO:
eventType = LOG_INFO;
break;
case LEVEL_DEBUG:
eventType = LOG_DEBUG;
break;
default:
eventType = LOG_DEBUG;
}
/* openlog, closelog, and syslog all return void. */
openlog( loginfoSourceName, LOG_PID | LOG_NDELAY, currentLogfacilityLevel );
_tsyslog( eventType, szBuff );
closelog( );
}
#endif
#ifdef WIN32
#define CONSOLE_BLOCK_SIZE 1024
/* The following is an initial (max) size for the number of characters to try writing to WriteConsole at once.
* See notes on the WriteConsole function below for details. */
size_t vWriteToConsoleMaxHeapBufferSize = 30000;
size_t vWriteToConsoleBufferSize = 0;
TCHAR *vWriteToConsoleBuffer = NULL;
/**
* Write a line of output to the console.
*
* @param hdl The handle to write to. Must be a valid handle.
*
* @return TRUE if successful, FALSE if the line was not written.
*/
int writeToConsole(HANDLE hdl, const TCHAR *lpszFmt, ...) {
va_list vargs;
int cnt;
size_t fullLen;
size_t remainLen;
size_t offset;
size_t thisLen;
DWORD wrote;
#ifdef DEBUG_CONSOLE_OUTPUT
_tprintf(TEXT("writeToConsole BEGIN\n"));
#endif
if (vWriteToConsoleBuffer == NULL) {
vWriteToConsoleBufferSize = CONSOLE_BLOCK_SIZE * 2;
vWriteToConsoleBuffer = malloc(sizeof(TCHAR) * vWriteToConsoleBufferSize);
if (!vWriteToConsoleBuffer) {
_tprintf(TEXT("Out of memory in logging code (%s)\n"), TEXT("WTC1"));
return FALSE;
}
#ifdef DEBUG_CONSOLE_OUTPUT
_tprintf(TEXT("Console Buffer Size = %d (Initial Size)\n"), vWriteToConsoleBufferSize);
#endif
if (logBufferGrowth) {
/* This is queued as we can't use direct logging here. */
log_printf_queue(TRUE, WRAPPER_SOURCE_WRAPPER, LEVEL_STATUS, TEXT("Console Buffer Size initially set to %d characters."), vWriteToConsoleBufferSize);
}
}
va_start(vargs, lpszFmt);
/* The only way I could figure out how to write to the console
* returned by AllocConsole when running as a service was to
* do all of this special casing and use the handle to the new
* console's stdout and the WriteConsole function. If anyone
* puzzling over this code knows a better way of doing this
* let me know.
* WriteConsole takes a fixed buffer and does not do any expansions
* We need to prepare the string to be displayed ahead of time.
* This means storing the message into a temporary buffer. The
* following loop will expand the global buffer to hold the current
* message. It will grow as needed to handle any arbitrarily large
* user message. The buffer needs to be able to hold all available
* characters + a null TCHAR.
* The _vsntprintf function will fill all available space and only
* terminate the string if there is room. Because of this we need
* to make sure and reserve room for the null terminator and add it
* if needed below. */
while ((cnt = _vsntprintf(vWriteToConsoleBuffer, vWriteToConsoleBufferSize - 1, lpszFmt, vargs)) < 0) {
#ifdef DEBUG_CONSOLE_OUTPUT
_tprintf(TEXT("writeToConsole ProcessCount=%d\n"), cnt);
#endif
/* Expand the size of the buffer */
free(vWriteToConsoleBuffer);
/* Increase the buffer by the CONSOLE_BLOCK_SIZE or an additional 10%, which ever is larger.
* The goal here is to grow the buffer size quickly, but not waste too much memory. */
vWriteToConsoleBufferSize = __max(vWriteToConsoleBufferSize + CONSOLE_BLOCK_SIZE, vWriteToConsoleBufferSize + vWriteToConsoleBufferSize / 10);
vWriteToConsoleBuffer = malloc(sizeof(TCHAR) * vWriteToConsoleBufferSize);
if (!vWriteToConsoleBuffer) {
_tprintf(TEXT("Out of memory in logging code (%s)\n"), TEXT("WTC2"));
va_end( vargs );
return FALSE;
}
#ifdef DEBUG_CONSOLE_OUTPUT
_tprintf(TEXT("Console Buffer Size = %d (Increased Size) ****************************************\n"), vWriteToConsoleBufferSize);
#endif
if (logBufferGrowth) {
/* This is queued as we can't use direct logging here. */
log_printf_queue(TRUE, WRAPPER_SOURCE_WRAPPER, LEVEL_STATUS, TEXT("Console Buffer Size increased to %d characters."), vWriteToConsoleBufferSize);
}
}
#ifdef DEBUG_CONSOLE_OUTPUT
_tprintf(TEXT("writeToConsole ProcessCount=%d\n"), cnt);
#endif
if (cnt == (vWriteToConsoleBufferSize - 1)) {
/* The maximum number of characters were read. All of the characters fit in the available space, but because of the way the API works, the string was not null terminated. */
vWriteToConsoleBuffer[vWriteToConsoleBufferSize - 1] = '\0';
}
va_end(vargs);
#ifdef DEBUG_CONSOLE_OUTPUT
_tprintf(TEXT("writeToConsole BufferSize=%d, MessageLen=%d, Message=[%s]\n"), vWriteToConsoleBufferSize, _tcslen(vWriteToConsoleBuffer), vWriteToConsoleBuffer);
#endif
/* The WriteConsole API is a nasty little beast.
* It can accept a buffer that is up to 64KB in size, but they can't tell us exactly how much before hand.
* The size on tests on a 64-bit XP system appear to be around 25000 characters.
* Windows 7 returns success, but starts writing garbled characters after around 31397 characters. (Not sure if this number is system specific however.)
* The problem is that this is highly dependent on the current system state.
* We used to start with 32000, but now use 30000 to avoid problems on Windows 7. (Not sure if this is small enough to avoid the issue on all systems.)
* Start with a large size for efficiency, but then reduce it automatically in a sticky way in 5% increments to get to a size that works. */
fullLen = _tcslen(vWriteToConsoleBuffer);
remainLen = fullLen;
offset = 0;
while (remainLen > 0) {
thisLen = __min(remainLen, vWriteToConsoleMaxHeapBufferSize);
#ifdef DEBUG_CONSOLE_OUTPUT
_tprintf(TEXT("writeToConsole write %d of %d characters\n"), thisLen, fullLen);
#endif
if (WriteConsole(hdl, &(vWriteToConsoleBuffer[offset]), (DWORD)thisLen, &wrote, NULL)) {
#ifdef DEBUG_CONSOLE_OUTPUT
_tprintf(TEXT("\nwriteToConsole (WriteConsole wrote %d of requested %d characters)\n"), wrote, thisLen);
#endif
/* Success. */
offset += thisLen;
remainLen -= thisLen;
#ifdef DEBUG_CONSOLE_OUTPUT
if (remainLen > 0) {
/* We have not written out the whole line which means there was no line feed. Add one or the debug output will be hard to read. */
_tprintf(TEXT("\nwriteToConsole (Previous line was incomplete)\n"));
}
#endif
} else {
/* Failed. */
#ifdef DEBUG_CONSOLE_OUTPUT
_tprintf(TEXT("\nwriteToConsole (Fail WriteConsole wrote %d of requested %d characters)\n"), wrote, thisLen);
#endif
switch (getLastError()) {
case ERROR_NOT_ENOUGH_MEMORY:
/* This means that the max heap buffer size is too large and needs to be reduced. */
if (vWriteToConsoleMaxHeapBufferSize < 100) {
_tprintf(TEXT("Not enough available HEAP to write to console.\n"));
return FALSE;
}
vWriteToConsoleMaxHeapBufferSize = vWriteToConsoleMaxHeapBufferSize - vWriteToConsoleMaxHeapBufferSize / 20;
#ifdef DEBUG_CONSOLE_OUTPUT
_tprintf(TEXT("Usable Console HEAP Buffer Size reduced to = %d ****************************************\n"), vWriteToConsoleMaxHeapBufferSize);
#endif
if (logBufferGrowth) {
/* This is queued as we can't use direct logging here. */
log_printf_queue(TRUE, WRAPPER_SOURCE_WRAPPER, LEVEL_STATUS, TEXT("Usable Console HEAP Buffer Size decreased to %d characters."), vWriteToConsoleMaxHeapBufferSize);
}
break;
case ERROR_INVALID_FUNCTION:
case ERROR_INVALID_HANDLE:
/* This is a fairly normal thing to happen if the Wrapper is run without an actual console.
* ERROR_INVALID_FUNCTION happens when we launch a forked elevated Wrapper.
* ERROR_INVALID_HANDLE happens when the Wrapper is launched without its own console.
* Log to debug so there is a note, but it is fine if this does not show up in commands where debug output can't be enabled. */
if (currentConsoleLevel <= LEVEL_DEBUG) {
_tprintf(TEXT("A console does not exist. Disabling direct console output and falling back to using pipes.\n"));
}
consoleDirect = FALSE;
return FALSE;
default:
_tprintf(TEXT("Failed to write to console: %s\n"), getLastErrorText());
return FALSE;
}
}
}
#ifdef DEBUG_CONSOLE_OUTPUT
_tprintf(TEXT("writeToConsole END\n"));
#endif
return TRUE;
}
#endif
/**
* Does a search for all files matching the specified pattern and deletes all
* but the most recent 'count' files. The files are sorted by their names.
*/
void limitLogFileCount(const TCHAR *current, const TCHAR *pattern, int sortMode, int count) {
TCHAR **files;
int index;
int foundCurrent;
#ifdef _DEBUG
_tprintf(TEXT("limitLogFileCount(%s, %s, %d, %d)\n"), current, pattern, sortMode, count);
#endif
files = loggerFileGetFiles(pattern, sortMode);
if (!files) {
/* Failed */
return;
}
/* When this loop runs we keep the first COUNT files in the list and everything thereafter is deleted. */
foundCurrent = FALSE;
index = 0;
while (files[index]) {
if (index < count) {
#ifdef _DEBUG
_tprintf(TEXT("Keep files[%d] %s\n"), index, files[index]);
#endif
if (_tcscmp(current, files[index]) == 0) {
/* This is the current file, as expected. */
#ifdef _DEBUG
_tprintf(TEXT(" Current\n"));
#endif
foundCurrent = TRUE;
}
} else {
#ifdef _DEBUG
_tprintf(TEXT("Delete files[%d] %s\n"), index, files[index]);
#endif
if (_tcscmp(current, files[index]) == 0) {
/* This is the current file, we don't want to delete it. */
_tprintf(TEXT("Log file sort order would result in current log file being deleted: %s\n"), current);
foundCurrent = TRUE;
} else if (_tremove(files[index])) {
_tprintf(TEXT("Unable to delete old log file: %s (%s)\n"), files[index], getLastErrorText());
}
}
index++;
}
/* Now if we did not find the current file, and there are files
still in the directory, then we want to also delete the oldest one.
Otherwise, the addition of the current file would result in too many
files. */
if (!foundCurrent) {
if (index >= count) {
#ifdef _DEBUG
_tprintf(TEXT("Delete files[%d] %s\n"), count - 1, files[count - 1]);
#endif
if (_tremove(files[count - 1])) {
_tprintf(TEXT("Unable to delete old log file: %s (%s)\n"), files[count - 1], getLastErrorText());
}
}
}
loggerFileFreeFiles(files);
}
/**
* Sets the current uptime in seconds.
*
* @param uptime Uptime in seconds.
* @param flipped TRUE when the uptime is no longer meaningful.
*/
void setUptime(int uptime, int flipped) {
uptimeSeconds = uptime;
uptimeFlipped = flipped;
}
/**
* Rolls log files using the ROLLNUM system.
*
* @param nowStr String representation of the date at the format 'YYYYMMDD'.
* If NULL, the current date will be used.
*/
void rollLogs(const TCHAR *nowStr) {
static int failureLogged = FALSE;
int i;
TCHAR rollNum[11];
#if defined(WIN32) && !defined(WIN64)
struct _stat64i32 fileStat;
#else
struct stat fileStat;
#endif
int result;
struct tm *nowTM;
TCHAR nowDateBuff[9];
const TCHAR* nowDate;
time_t now;
#ifdef WIN32
struct _timeb timebNow;
#else
struct timeval timevalNow;
#endif
#ifdef _DEBUG
_tprintf(TEXT("rollLogs()\n"));
#endif
if (!logFilePath) {
return;
}
if (!nowStr) {
#ifdef WIN32
_ftime(&timebNow);
now = (time_t)timebNow.time;
#else
gettimeofday(&timevalNow, NULL);
now = (time_t)timevalNow.tv_sec;
#endif
nowTM = localtime(&now);
_sntprintf(nowDateBuff, 9, TEXT("%04d%02d%02d"), nowTM->tm_year + 1900, nowTM->tm_mon + 1, nowTM->tm_mday);
nowDate = (const TCHAR*)nowDateBuff;
} else {
nowDate = nowStr;
}
/* If the log file is currently open, it needs to be closed. */
if (logfileFP != NULL) {
#ifdef _DEBUG
_tprintf(TEXT("Closing logfile so it can be rolled...\n"));
#endif
fclose(logfileFP);
logfileFP = NULL;
currentLogFileName[0] = TEXT('\0');
} else {
/* Don't roll if the current log file doesn't exist or can't be accessed. */
generateLogFileName(currentLogFileName, currentLogFileNameSize, logFilePath, nowDate, NULL);
if (_tstat(currentLogFileName, &fileStat) != 0) {
currentLogFileName[0] = TEXT('\0');
return;
}
}
#ifdef _DEBUG
_tprintf(TEXT("Rolling log files... (failureLogged=%d)\n"), failureLogged);
#endif
/* We don't know how many log files need to be rotated yet, so look. */
i = 0;
do {
i++;
_sntprintf(rollNum, 11, TEXT("%d"), i);
generateLogFileName(workLogFileName, currentLogFileNameSize, logFilePath, nowDate, rollNum);
result = _tstat(workLogFileName, &fileStat);
#ifdef _DEBUG
if (result == 0) {
_tprintf(TEXT("Rolled log file %s exists.\n"), workLogFileName);
}
#endif
} while (result == 0);
/* Now, starting at the highest file rename them up by one index. */
for (; i > 1; i--) {
_tcsncpy(currentLogFileName, workLogFileName, _tcslen(logFilePath) + 11);
_sntprintf(rollNum, 11, TEXT("%d"), i - 1);
generateLogFileName(workLogFileName, currentLogFileNameSize, logFilePath, nowDate, rollNum);
if ((logFileMaxLogFiles > 0) && (i > logFileMaxLogFiles) && (!logFilePurgePattern)) {
/* The file needs to be deleted rather than rolled. If a purge pattern was not specified,
* then the files will be deleted here. Otherwise they will be deleted below. */
#ifdef _DEBUG
_tprintf(TEXT("Remove old log file %s\n"), workLogFileName);
#endif
if (_tremove(workLogFileName)) {
#ifdef _DEBUG
_tprintf(TEXT("Failed to remove old log file %s. err=%d\n"), workLogFileName, getLastError());
#endif
if (getLastError() == 2) {
/* The file did not exist. */
} else if (getLastError() == 3) {
/* The path did not exist. */
} else {
if (!failureLogged) {
log_printf_queue(TRUE, WRAPPER_SOURCE_WRAPPER, LEVEL_WARN, TEXT("Unable to delete old log file: %s (%s)"), workLogFileName, getLastErrorText());
failureLogged = TRUE;
}
generateLogFileName(currentLogFileName, currentLogFileNameSize, logFilePath, nowDate, NULL); /* Set the name back so we don't cause a logfile name changed event. */
return;
}
} else {
/* On Windows, in some cases if the file can't be deleted, we still get here without an error. Double check. */
if (_tstat(workLogFileName, &fileStat) == 0) {
/* The file still existed. */
#ifdef _DEBUG
_tprintf(TEXT("Failed to remove old log file %s\n"), workLogFileName);
#endif
if (!failureLogged) {
log_printf_queue(TRUE, WRAPPER_SOURCE_WRAPPER, LEVEL_WARN, TEXT("Unable to delete old log file: %s"), workLogFileName);
failureLogged = TRUE;
}
generateLogFileName(currentLogFileName, currentLogFileNameSize, logFilePath, nowDate, NULL); /* Set the name back so we don't cause a logfile name changed event. */
return;
}
#ifdef _DEBUG
else {
_tprintf(TEXT("Deleted %s\n"), workLogFileName);
}
#endif
}
} else {
if (_trename(workLogFileName, currentLogFileName) != 0) {
if (!failureLogged) {
#ifdef WIN32
if (errno == EACCES) {
/* This access denied message is treated as a special case, but the use by other applications issue only happens on Windows. */
/* Don't log this as with other errors as that would cause recursion. */
log_printf_queue(TRUE, WRAPPER_SOURCE_WRAPPER, LEVEL_WARN, TEXT("Unable to rename log file %s to %s. File is in use by another application."),
workLogFileName, currentLogFileName);
} else {
#endif
/* Don't log this as with other errors as that would cause recursion. */
log_printf_queue(TRUE, WRAPPER_SOURCE_WRAPPER, LEVEL_WARN, TEXT("Unable to rename log file %s to %s. (%s)"),
workLogFileName, currentLogFileName, getLastErrorText());
#ifdef WIN32
}
#endif
failureLogged = TRUE;
}
generateLogFileName(currentLogFileName, currentLogFileNameSize, logFilePath, nowDate, NULL); /* Set the name back so we don't cause a logfile name changed event. */
return;
}
#ifdef _DEBUG
else {
_tprintf(TEXT("Renamed %s to %s\n"), workLogFileName, currentLogFileName);
}
#endif
}
}
/* Rename the current file to the #1 index position */
generateLogFileName(currentLogFileName, currentLogFileNameSize, logFilePath, nowDate, NULL);
if (_trename(currentLogFileName, workLogFileName) != 0) {
if (!failureLogged) {
if (getLastError() == 2) {
/* File does not yet exist. */
} else if (getLastError() == 3) {
/* Path does not yet exist. */
} else if (errno == 13) {
/* Don't log this as with other errors as that would cause recursion. */
log_printf_queue(TRUE, WRAPPER_SOURCE_WRAPPER, LEVEL_WARN,
TEXT("Unable to rename log file %s to %s. File is in use by another application."),
currentLogFileName, workLogFileName);
} else {
/* Don't log this as with other errors as that would cause recursion. */
log_printf_queue(TRUE, WRAPPER_SOURCE_WRAPPER, LEVEL_WARN, TEXT("Unable to rename log file %s to %s. (%s)"),
currentLogFileName, workLogFileName, getLastErrorText());
}
failureLogged = TRUE;
}
generateLogFileName(currentLogFileName, currentLogFileNameSize, logFilePath, nowDate, NULL); /* Set the name back so we don't cause a logfile name changed event. */
return;
}
#ifdef _DEBUG
else {
_tprintf(TEXT("Renamed %s to %s\n"), currentLogFileName, workLogFileName);
}
#endif
/* Now limit the number of files using the standard method. */
if (logFileMaxLogFiles > 0) {
if (logFilePurgePattern) {
limitLogFileCount(currentLogFileName, logFilePurgePattern, logFilePurgeSortMode, logFileMaxLogFiles + 1);
}
}
if (failureLogged) {
/* We made it here, but the failureLogged flag had been previously set. Make a note that we are back and then continue. */
log_printf_queue(TRUE, WRAPPER_SOURCE_WRAPPER, LEVEL_DEBUG,
TEXT("Logfile rolling is working again."));
failureLogged = FALSE;
}
/* Reset the current log file name as it is not being used yet. */
currentLogFileName[0] = TEXT('\0'); /* Log file was rolled, so we want to cause a logfile change event. */
}
#ifdef LINUX
/**
* Get description found in a release file.
* This function will only check for the first line because there is only one line in these files.
*
* @return TRUE if the description could be found.
*/
int getReleaseDescription(TCHAR **description, const TCHAR *releaseFile) {
#if defined(WIN32) && !defined(WIN64)
struct _stat64i32 fileStat;
#else
struct stat fileStat;
#endif
FILE *file = NULL;
int result = FALSE;
/* check if the file exists */
if (_tstat(releaseFile, &fileStat) == 0) {
file = _tfopen(releaseFile, TEXT("r"));
if (file != NULL) {
*description = malloc(100 * sizeof(TCHAR));
if (*description == NULL) {
outOfMemoryQueued(TEXT("GRD"), 1);
} else if (_fgetts(*description, 100, file) != NULL) {
/* got the release description inside the file */
result = TRUE;
} else {
/* _fgetts failed but *description remains unchanged. Free it up. */
free(*description);
*description = NULL;
}
fclose(file);
}
}
return result;
}
static TCHAR distroDescription[100];
const TCHAR *centosPattern = TEXT("CentOS Linux");
const TCHAR *amiPattern = TEXT("Amazon Linux AMI");
const TCHAR *rhelPattern = TEXT("Red Hat Enterprise Linux");
const TCHAR *fedoraPattern = TEXT("Fedora release");
const TCHAR *linuxPattern = TEXT("Linux");
/**
* Get a description of the linux distribution.
*/
const TCHAR *getDistro() {
static int firstCall = TRUE;
TCHAR *sysDescription = NULL;
TCHAR *rhelDescription = NULL;
int foundSysDescription;
int foundRhDescription;
if (firstCall) {
firstCall = FALSE;
foundSysDescription = getReleaseDescription(&sysDescription, TEXT("/etc/system-release"));
foundRhDescription = getReleaseDescription(&rhelDescription, TEXT("/etc/redhat-release"));
if ((foundRhDescription && _tcsstr(rhelDescription, centosPattern) != NULL) ||
(foundSysDescription && _tcsstr(sysDescription, centosPattern) != NULL)) {
_tcsncpy(distroDescription, centosPattern, 100);
} else if ((foundRhDescription && _tcsstr(rhelDescription, rhelPattern) != NULL) ||
(foundSysDescription && _tcsstr(sysDescription, rhelPattern) != NULL)) {
_tcsncpy(distroDescription, rhelPattern, 100);
} else if ((foundRhDescription && _tcsstr(rhelDescription, fedoraPattern) != NULL) ||
(foundSysDescription && _tcsstr(sysDescription, fedoraPattern) != NULL)) {
_tcsncpy(distroDescription, fedoraPattern, 100);
} else if (foundSysDescription && _tcsstr(sysDescription, amiPattern) != NULL) {
_tcsncpy(distroDescription, amiPattern, 100);
} else {
_tcsncpy(distroDescription, linuxPattern, 100);
}
if (sysDescription) {
free(sysDescription);
}
if (rhelDescription) {
free(rhelDescription);
}
}
return distroDescription;
}
int isCentos() {
static int result = -1;
return result != -1 ? result : (result = (_tcsicmp(getDistro(), centosPattern) == 0));
}
int isAMI() {
static int result = -1;
return result != -1 ? result : (result = (_tcsicmp(getDistro(), amiPattern) == 0));
}
int isRHEL() {
static int result = -1;
return result != -1 ? result : (result = (_tcsicmp(getDistro(), rhelPattern) == 0));
}
int isFedora() {
static int result = -1;
return result != -1 ? result : (result = (_tcsicmp(getDistro(), fedoraPattern) == 0));
}
/**
* Check if the glibc version of the user is upper to given numbers.
*/
int wrapperAssertGlibcUserBis(unsigned int maj, unsigned int min, unsigned int rev) {
unsigned int vmaj=0;
unsigned int vmin=0;
unsigned int vrev=0;
TCHAR versionW[10];
mbstowcs(versionW, gnu_get_libc_version(), 10);
_stscanf(versionW, TEXT("%d.%d.%d"), &vmaj, &vmin, &vrev);
return ((vmaj == maj && vmin == min && vrev >= rev) || (vmaj == maj && vmin > min) || vmaj > maj);
}
#endif
/**
* Check if the system is Centos with glibc < 2.21 as there is a memory leak issue under these conditions.
*/
int doesFtellCauseMemoryLeak() {
static int result = -1;
#ifdef LINUX
if (result == -1) {
if ((isCentos() || isAMI() || isRHEL() || isFedora()) && !wrapperAssertGlibcUserBis(2, 21, 0)){
result = 1;
} else {
result = 0;
}
}
#endif
return (result > 0);
}
/**
* Check to see whether or not the log file needs to be rolled.
* This is only called when synchronized.
*/
void checkAndRollLogs(const TCHAR *nowDate, size_t printBufferSize) {
size_t position;
int result;
#if defined(WIN32) && !defined(WIN64)
struct _stat64i32 fileStat;
#else
struct stat fileStat;
#endif
static size_t unflushedBufferSize = 0;
static size_t previousFileSize = 0;
/* Depending on the roll mode, decide how to roll the log file. */
if (logFileRollMode & ROLL_MODE_SIZE) {
/* Roll based on the size of the file. */
if (logFileMaxSize <= 0) {
return;
}
/* Find out the current size of the file. If the file is currently open then we need to
* use ftell to make sure that the buffered data is also included. */
if (logfileFP != NULL && !doesFtellCauseMemoryLeak()) {
/* File is open */
if ((result = ftell(logfileFP)) < 0) {
_tprintf(TEXT("Unable to get the current logfile size with ftell: %s\n"), getLastErrorText());
return;
}
position = (size_t)result;
} else {
/* File is not open or we can't use ftell because of memory leak issue */
generateLogFileName(currentLogFileName, currentLogFileNameSize, logFilePath, nowDate, NULL);
if (_tstat(currentLogFileName, &fileStat) != 0) {
if (getLastError() == 2) {
/* File does not yet exist. */
position = 0;
} else if (getLastError() == 3) {
/* Path does not exist. */
position = 0;
} else {
_tprintf(TEXT("Unable to get the current logfile size with stat: %s\n"), getLastErrorText());
return;
}
} else {
position = fileStat.st_size;
if (doesFtellCauseMemoryLeak()) {
if (previousFileSize != position) {
/* the file has been flushed */
previousFileSize = position;
unflushedBufferSize = 0;
}
unflushedBufferSize += printBufferSize;
position += unflushedBufferSize;
}
}
}
/* Does the log file need to rotated? */
if ((int)position - 2 >= logFileMaxSize) { /* -2: no carriage return for the last message being logged. */
rollLogs(nowDate);
}
}
/* Roll based on the date of the log entry. */
if (logFilePathHasDateToken && _tcscmp(nowDate, logFileLastNowDate) != 0) {
/* The date has changed. Close the file. */
if (logfileFP != NULL) {
#ifdef _DEBUG
_tprintf(TEXT("Closing logfile because the date changed...\n"));
#endif
fclose(logfileFP);
logfileFP = NULL;
}
/* Always reset the name so the the log file name will be regenerated correctly. */
currentLogFileName[0] = TEXT('\0');
/* This will happen just before a new log file is created.
* Check the maximum file count. */
if (logFileMaxLogFiles > 0) {
/* We will check for too many files here and then clear the current log file name so it will be set later. */
generateLogFileName(currentLogFileName, currentLogFileNameSize, logFilePath, nowDate, NULL);
/* If logFilePurgeSortMode = NAMES_SMART, then logFilePurgePattern should not be NULL (see setLogfilePurgePattern()). */
if (logFilePurgePattern) {
limitLogFileCount(currentLogFileName, logFilePurgePattern, logFilePurgeSortMode, logFileMaxLogFiles + 1);
} else {
/* This case can happen if wrapper.logfile.purge.pattern was left empty and wrapper.logfile.purge.sort is not NAMES_SMART.
* We still need to remove old files, so generate a purge pattern and clean them using the default NAMES_SMART method. */
generateLogFilePattern(workLogFileName, currentLogFileNameSize);
limitLogFileCount(currentLogFileName, workLogFileName, LOGGER_FILE_SORT_MODE_NAMES_SMART, logFileMaxLogFiles + 1);
}
currentLogFileName[0] = TEXT('\0');
workLogFileName[0] = TEXT('\0');
}
}
}
void log_printf_queue( int useQueue, int source_id, int level, const TCHAR *lpszFmt, ... ) {
int threadId;
int localWriteIndex;
int localReadIndex;
va_list vargs;
int count;
#if defined(UNICODE) && !defined(WIN32)
TCHAR *format;
size_t i;
size_t len;
#endif
TCHAR *buffer;
/* Start by processing any arguments so that we can store a simple string. */
#ifdef _DEBUG_QUEUE
_tprintf(TEXT("log_printf_queue(%d, %d, %d, %S)\n"), useQueue, source_id, level, lpszFmt);
#endif
#if defined(UNICODE) && !defined(WIN32)
if (wcsstr(lpszFmt, TEXT("%s")) != NULL) {
/* On UNIX platforms string tokens must always use "%S" variables and not "%s". We can
* not safely use malloc here as the call may have originated from a signal handler.
* Copy the template into the formatMessages string reserved for this thread, replace
* the tokens and then continue using that. This is a bit of overhead, but these async
* messages are fairly rare and this greatly simplifies the code throughout the rest of
* the application by making it possible to always use the "%s" syntax. */
threadId = getThreadId();
_tcsncpy(formatMessages[threadId], lpszFmt, QUEUED_BUFFER_SIZE);
/* Terminate just in case the format was too long. */
formatMessages[threadId][QUEUED_BUFFER_SIZE - 1] = TEXT('\0');
format = formatMessages[threadId];
/* Replace the tokens. */
#ifdef _DEBUG_QUEUE
_tprintf(TEXT("Replacing string tokens.\n"));
_tprintf(TEXT(" From: %S\n"), format);
#endif
len = wcslen(format);
if (len > 0) {
for (i = 0; i < len; i++) {
if ((i > 0) && (format[i - 1] == TEXT('%')) && (format[i] == TEXT('s'))) {
/* Make sure the '%' was not escaped. */
if ((i > 1) && (format[i - 2] == TEXT('%'))) {
/* Escaped. Do nothing. */
} else {
/* 's' needs to be changed to 'S' */
format[i] = TEXT('S');
}
}
}
}
#ifdef _DEBUG_QUEUE
_tprintf(TEXT(" To: %S\n"), format);
#endif
lpszFmt = format;
}
#endif
if (!isLogInitialized()) {
useQueue = FALSE;
}
/** For queued logging, we have a fixed length buffer to work with. Just to make it easy to catch
* problems, always use the same sized fixed buffer even if we will be using the non-queued logging. */
if (useQueue) {
/* Care needs to be taken both with this code and the code below to get done as quick as possible.
* It is generally safe because each thread has its own queue. The only danger is if a message is
* being queued while that thread is interrupted by a signal. If things are setup correctly however
* then non-signal threads should not be here in the first place. */
threadId = getThreadId();
localWriteIndex = queueWriteIndex[threadId];
localReadIndex = queueReadIndex[threadId];
if ((localWriteIndex == localReadIndex - 1) || ((localWriteIndex == QUEUE_SIZE - 1) && (localReadIndex == 0))) {
_tprintf(TEXT("WARNING log queue overflow for thread[%d]:%d:%d dropping entry: %s\n"), threadId, localWriteIndex, localReadIndex, lpszFmt);
return;
}
/* Get a reference to the message buffer we will use. */
buffer = queueMessages[threadId][queueWriteIndex[threadId]];
} else {
/* This will not be queued so we can use malloc to create a new buffer. */
buffer = malloc(sizeof(TCHAR) * QUEUED_BUFFER_SIZE);
if (!buffer) {
_tprintf(TEXT("Out of memory in logging code (%s)\n"), TEXT("PQ1"));
return;
}
/* For compiler */
threadId = -1;
localWriteIndex = -1;
}
/* Now actually generate our buffer. */
va_start(vargs, lpszFmt);
count = _vsntprintf(buffer, QUEUED_BUFFER_SIZE_USABLE, lpszFmt, vargs);
va_end(vargs);
/* vswprintf returns -1 on overflow. */
if ((count < 0) || (count >= QUEUED_BUFFER_SIZE_USABLE - 1)) {
/* The expanded message was too big to fit into the buffer.
* On Windows, it writes as much as it can so we can make it look pretty.
* But on other platforms, nothing is written so we need a message.
* It is illegal to do any mallocs in here, so there is nothing we can really do on UNIX. */
#if defined(WIN32)
/* To be safe, make sure we are null terminated. */
buffer[QUEUED_BUFFER_SIZE_USABLE - 1] = 0;
_tcsncat(buffer, TEXT("..."), QUEUED_BUFFER_SIZE);
#else
/* Write an error string that we know will fit. This doesn't need to be localized as it should be caught in testing. */
_sntprintf(buffer, QUEUED_BUFFER_SIZE, TEXT("(Message too long to be logged as a queued message. Please report this.)"));
#endif
}
if (useQueue) {
#ifdef _DEBUG_QUEUE
_tprintf(TEXT("LOG ENQUEUE[%d] Thread[%d]: %s\n"), localWriteIndex, threadId, buffer);
#endif
/* Store additional information about the call. */
queueSourceIds[threadId][localWriteIndex] = source_id;
queueLevels[threadId][localWriteIndex] = level;
/* Lastly increment and wrap the write index. */
queueWriteIndex[threadId]++;
if (queueWriteIndex[threadId] >= QUEUE_SIZE) {
queueWriteIndex[threadId] = 0;
queueWrapped[threadId] = 1;
}
} else {
if (isLogInitialized()) {
/* Make a normal logging call with our new buffer. Parameters are already expanded. */
log_printf(source_id, level,
#if defined(UNICODE) && !defined(WIN32)
TEXT("%S"),
#else
TEXT("%s"),
#endif
buffer);
} else {
/* The best we can do is print something on the screen. */
_tprintf(
#if defined(UNICODE) && !defined(WIN32)
TEXT("%S\n"),
#else
TEXT("%s\n"),
#endif
buffer);
}
free(buffer);
}
}
/**
* Perform any required logger maintenance at regular intervals.
*
* One operation is to log any queued messages. This must be done very
* carefully as it is possible that a signal handler could be thrown at
* any time as this function is being executed.
*/
void maintainLogger() {
int localWriteIndex;
int source_id;
int level;
int threadId;
TCHAR *buffer;
int logFileChanged;
TCHAR *logFileCopy;
/* Check to see if there is a pending log file change notification. Do this first as we could
* generate our own here as well. It is important that we do our best to keep them in order.
* Grab it and clear the reference quick in case another is set. This order is thread safe. */
if (pendingLogFileChange) {
/* Lock the logging mutex. */
if (lockLoggingMutex()) {
return;
}
logFileCopy = pendingLogFileChange;
pendingLogFileChange = NULL;
/* Release the lock we have on the logging mutex so that other threads can get in. */
if (releaseLoggingMutex()) {
return;
}
/* Now see if a log file name was queued, using our local copy. */
if (logFileCopy) {
#ifdef _DEBUG
_tprintf(TEXT("Sending notification of queued log file name change: %s\n"), logFileCopy);
#endif
if (!logFilePathSetFromConf) {
logFileChangedCallback(logFileCopy);
}
free(logFileCopy);
logFileCopy = NULL;
}
}
for (threadId = 0; threadId < WRAPPER_THREAD_COUNT; threadId++) {
/* NOTE - The queue variables are not synchronized so we need to access them
* carefully and assume that data could possibly be corrupted. */
localWriteIndex = queueWriteIndex[threadId]; /* Snapshot the value to maintain a constant reference. */
if ( queueReadIndex[threadId] != localWriteIndex ) {
logFileCopy = NULL;
/* Lock the logging mutex. */
if (lockLoggingMutex()) {
return;
}
/* Empty the queue of any logged messages. */
localWriteIndex = queueWriteIndex[threadId]; /* Snapshot the value to maintain a constant reference. */
while (queueReadIndex[threadId] != localWriteIndex) {
/* Snapshot the values in the queue at that index. */
source_id = queueSourceIds[threadId][queueReadIndex[threadId]];
level = queueLevels[threadId][queueReadIndex[threadId]];
buffer = queueMessages[threadId][queueReadIndex[threadId]];
/* The buffer is static in the queue and will be reused. */
#ifdef _DEBUG_QUEUE
_tprintf(TEXT("LOG QUEUED[%d]: %s\n"), queueReadIndex[threadId], buffer );
#endif
logFileChanged = log_printf_message(source_id, level, threadId, TRUE, buffer, TRUE);
if (logFileChanged) {
if (logFileCopy) {
/* This can happen if there are multiple changes while printing the queued messages
* (for example if the files are rolled with a very low size limit).
* To keep it simple, we will reuse logFileCopy and report only the last change. */
free(logFileCopy);
}
/* We need to make a copy of currentLogFileName because we will call logFileChangedCallback() outside of the semaphore. */
logFileCopy = malloc(sizeof(TCHAR) * (_tcslen(currentLogFileName) + 1));
if (!logFileCopy) {
_tprintf(TEXT("Out of memory in logging code (%s)\n"), TEXT("ML1"));
} else {
_tcsncpy(logFileCopy, currentLogFileName, _tcslen(currentLogFileName) + 1);
}
}
#ifdef _DEBUG_QUEUE
_tprintf(TEXT(" Queue lw=%d, qw=%d, qr=%d\n"), localWriteIndex, queueWriteIndex[threadId], queueReadIndex[threadId]);
#endif
/* Clear the string we just wrote. */
buffer[0] = TEXT('\0');
queueReadIndex[threadId]++;
if ( queueReadIndex[threadId] >= QUEUE_SIZE ) {
queueReadIndex[threadId] = 0;
}
}
/* Release the lock we have on the logging mutex so that other threads can get in. */
if (releaseLoggingMutex()) {
if (logFileCopy) {
free(logFileCopy);
}
return;
}
/* Register the change of the logfile. This can be a long operation so do it when we are no longer in the semaphore. */
if (logFileCopy) {
if (!logFilePathSetFromConf) {
logFileChangedCallback(logFileCopy);
}
free(logFileCopy);
}
}
}
}
wrapper_3.5.51_src/src/c/logger.h 100644 0 0 32530 14333053650 14033 0 ustar 0 0 /*
* Copyright (c) 1999, 2022 Tanuki Software, Ltd.
* http://www.tanukisoftware.com
* All rights reserved.
*
* This software is the proprietary information of Tanuki Software.
* You shall use it only in accordance with the terms of the
* license agreement you entered into with Tanuki Software.
* http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
*
*
* Portions of the Software have been derived from source code
* developed by Silver Egg Technology under the following license:
*
* Copyright (c) 2001 Silver Egg Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sub-license, and/or
* sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*/
/**
* Author:
* Johan Sorlin
* Leif Mortenson
*/
#ifndef _LOGGER_H
#define _LOGGER_H
/* If defined, output debug information about console output. */
/*#define DEBUG_CONSOLE_OUTPUT*/
#ifdef _DEBUG
#define _DEBUG_QUEUE
#endif
#ifdef WIN32
#include
#define LOG_USER (1<<3)
#endif
#ifndef DWORD
#define DWORD unsigned long
#endif
/* Define constants that may not exist in WinError.h (e.g. on Windows IA). */
#ifndef ERROR_MUI_FILE_NOT_FOUND
#define ERROR_MUI_FILE_NOT_FOUND 0x3AFC
#endif
#ifndef ERROR_MUI_INVALID_FILE
#define ERROR_MUI_INVALID_FILE 0x3AFD
#endif
#ifndef ERROR_MUI_INVALID_RC_CONFIG
#define ERROR_MUI_INVALID_RC_CONFIG 0x3AFE
#endif
#ifndef ERROR_MUI_INVALID_LOCALE_NAME
#define ERROR_MUI_INVALID_LOCALE_NAME 0x3AFF
#endif
#ifndef ERROR_MUI_INVALID_ULTIMATEFALLBACK_NAME
#define ERROR_MUI_INVALID_ULTIMATEFALLBACK_NAME 0x3B00
#endif
#ifndef ERROR_MUI_FILE_NOT_LOADED
#define ERROR_MUI_FILE_NOT_LOADED 0x3B01
#endif
#include "logger_base.h"
/* * * Log source constants * * */
#define WRAPPER_SOURCE_WRAPPER -1
#define WRAPPER_SOURCE_PROTOCOL -2
#define WRAPPER_SOURCE_JVM -3
#define WRAPPER_SOURCE_JVM_VERSION 0 /* The value '0' is important for log_printf to print this output as a direct message (otherwise any '%' in the output will cause memory issues) */
/* * * Log thread constants * * */
/* These are indexes in an array so they must be sequential, start
* with zero and be one less than the final WRAPPER_THREAD_COUNT */
#define WRAPPER_THREAD_CURRENT -1
#define WRAPPER_THREAD_SIGNAL 0
#define WRAPPER_THREAD_MAIN 1
#define WRAPPER_THREAD_SRVMAIN 2
#define WRAPPER_THREAD_TIMER 3
#ifdef WIN32
#define WRAPPER_THREAD_MESSAGE 4
#define WRAPPER_THREAD_JAVAIO 5
#else
#define WRAPPER_THREAD_JAVAIN 4
#define WRAPPER_THREAD_JAVAIO 5
#endif
#define WRAPPER_THREAD_STARTUP (WRAPPER_THREAD_JAVAIO+1)
#define WRAPPER_THREAD_COUNT (WRAPPER_THREAD_STARTUP+1)
#define MAX_LOG_SIZE 4096
#ifdef WIN32
#else
/* A special prefix on log messages that can be bassed through from a forked process
so the parent will handle the log message correctly. */
#define LOG_FORK_MARKER TEXT("#!#WrApPeR#!#")
#define LOG_SPECIAL_MARKER TEXT("#!#WrApPeRsPeCiAl#!#")
#endif
/* Default log formats */
#define LOG_FORMAT_LOGFILE_DEFAULT TEXT("LPTM")
#define LOG_FORMAT_CONSOLE_DEFAULT TEXT("PM")
#define LOG_DESTINATION_FILE 0x01
#define LOG_DESTINATION_CONSOLE 0x02
#define LOG_DESTINATION_SYSLOG 0x04
#define LOG_DESTINATION_ALL 0xFF
/* * * Log file roll mode constants * * */
#define ROLL_MODE_UNKNOWN 0
#define ROLL_MODE_NONE 1
#define ROLL_MODE_SIZE 2
#define ROLL_MODE_WRAPPER 4
#define ROLL_MODE_JVM 8
#define ROLL_MODE_SIZE_OR_WRAPPER ROLL_MODE_SIZE + ROLL_MODE_WRAPPER
#define ROLL_MODE_SIZE_OR_JVM ROLL_MODE_SIZE + ROLL_MODE_JVM
#define ROLL_MODE_DATE 16
#define ROLL_MODE_DATE_TOKEN TEXT("YYYYMMDD")
/* Any log messages generated within signal handlers must be stored until we
* have left the signal handler to avoid deadlocks in the logging code.
* Messages are stored in a round robin buffer of log messages until
* maintainLogger is next called.
* When we are inside of a signal, and thus when calling log_printf_queue,
* we know that it is safe to modify the queue as needed. But it is possible
* that a signal could be fired while we are in maintainLogger, so case is
* taken to make sure that volatile changes are only made in log_printf_queue.
*/
#define QUEUE_SIZE 20
/* The size of QUEUED_BUFFER_SIZE_USABLE is arbitrary as the largest size which can be logged in full,
* but to avoid crashes due to a bug in the HPUX libc (version < 1403), the length of the buffer passed to _vsntprintf must have a length of 1 + N, where N is a multiple of 8. */
#define QUEUED_BUFFER_SIZE_USABLE (512 + 1)
#define QUEUED_BUFFER_SIZE (QUEUED_BUFFER_SIZE_USABLE + 4)
/* This can be called from within logging code that would otherwise get stuck in recursion.
* Log to the console exactly when it happens and then also try to get it into the log
* file at the next oportunity. */
extern void outOfMemoryQueued(const TCHAR *context, int id);
extern void outOfMemory(const TCHAR *context, int id);
#ifdef _DEBUG
/**
* Used to dump memory directly to the log file in both HEX and readable format.
* Useful in debugging applications to track down memory overflows etc.
*
* @param label A label that will be prepended on all lines of output.
* @param memory The memory to be dumped.
* @param len The length of the memory to be dumped.
*/
extern void log_dumpHex(TCHAR *label, TCHAR *memory, size_t len);
#endif
/**
* Sets the number of milliseconds to allow logging to take before a warning is logged.
* Defaults to 0 for no limit. Possible values 0 to 3600000.
*
* @param threshold Warning threashold.
*/
extern void setLogWarningThreshold(int threshold);
/**
* Enable or disable log destinations.
* At any time, the logging can be turned off for all or a set of destinations.
* Even when a destination is disabled, the code can continue to set its log level but
* the value will be stored without re-enabling it. This allows the configuration to
* be loaded normally and to be used later when the destination will be reactivated.
* The same function can be used to re-enable a set of destinations.
*
* @param currentDestinationsMask Mask of destinations to toggle.
* @param enable Wether the destinations should be enabled or disabled.
*/
extern void toggleLogDestinations(int currentDestinationsMask, int enable);
/**
* Sets the console log levels to a simple format for help and usage messages.
*/
extern void setSimpleLogLevels();
#ifdef WIN32
/**
* This sets a flag which tells the logger that alternate source labels should be used to indicate that the current process is a launcher.
*/
extern void setLauncherSource();
#endif
/**
* Used for testing to set a pause into the next log entry made.
*
* @param pauseTime Number of seconds to pause, 0 pauses indefinitely.
*/
extern void setPauseTime(int pauseTime);
/**
* Set to true to cause changes in internal buffer sizes to be logged. Useful for debugging.
*
* @param log TRUE if changes should be logged.
*/
void setLogBufferGrowth(int log);
extern int getLoggingIsPreload();
extern void setLoggingIsPreload(int value);
/* * Logfile functions * */
extern int isLogfileAccessed();
extern int resolveDefaultLogFilePath();
/**
* Sets the log file to be used. If the specified file is not absolute then
* it will be resolved into an absolute path. If there are any problems with
* the path, like a directory not existing then the call will fail and the
* cause will be written to the existing log.
*
* @param log_file_path Log file to start using.
* @param isConfigured The value comes from the configuration file.
* @param preload TRUE if this is a preload pass.
*
* @return TRUE if there were any problems.
*/
extern int setLogfilePath( const TCHAR *log_file_path, int isConfigured, int preload);
/**
* Returns the default logfile.
*/
extern const TCHAR *getDefaultLogfilePath();
/**
* Returns a reference to the currect log file path.
* This return value may be changed at any time if the log file is rolled.
*/
extern const TCHAR *getLogfilePath();
/**
* Returns a snapshot of the current log file path. This call safely gets the current path
* and returns a copy. It is the responsibility of the caller to free up the memory on
* return. Could return null if there was an error.
*/
extern TCHAR *getCurrentLogfilePath();
#ifndef WIN32
extern int checkLogfileDir(int checkDefaultDir);
#endif
extern int getLogfileRollModeForName( const TCHAR *logfileRollName );
extern void setLogfileRollMode(int log_file_roll_mode);
extern int getLogfileRollMode();
extern void setLogfileUmask(int log_file_umask);
#ifndef WIN32
extern void setLogfileGroup(gid_t log_file_group);
#endif
extern void setLogfileFormat( const TCHAR *log_file_format );
extern void setLogfileLevelInt(int log_file_level);
extern int getLogfileLevelInt();
extern void setLogfileLevel( const TCHAR *log_file_level );
extern void setLogfileMaxFileSize( const TCHAR *max_file_size );
extern void setLogfileMaxLogFiles(int max_log_files);
extern void setLogfilePurgePattern(const TCHAR *pattern, int* outIsGenerated);
extern void setLogfilePurgeSortMode(int sortMode);
extern DWORD getLogfileActivity();
/** Sets the auto flush log file flag. */
extern void setLogfileAutoFlush(int autoFlush);
/** Sets the auto close log file flag. */
extern void setLogfileAutoClose(int autoClose);
/** Closes the logfile if it is open. */
extern void closeLogfile();
/** Flushes any buffered logfile output to the disk. */
extern void flushLogfile();
/* * Console functions * */
extern void setConsoleLogFormat( const TCHAR *console_log_format );
extern void setConsoleLogLevelInt(int console_log_level);
extern int getConsoleLogLevelInt();
extern void setConsoleLogLevel( const TCHAR *console_log_level );
extern void setConsoleFlush(int flush);
#ifdef WIN32
extern void setConsoleDirect(int direct);
#endif
extern void setConsoleFatalToStdErr(int toStdErr);
extern void setConsoleErrorToStdErr(int toStdErr);
extern void setConsoleWarnToStdErr(int toStdErr);
/* * Syslog/eventlog functions * */
extern void setSyslogLevelInt(int loginfo_level);
extern int getSyslogLevelInt();
extern void setSyslogLevel( const TCHAR *loginfo_level );
extern void setSyslogSplitMessages(int splitMessages);
#ifdef WIN32
extern void setSyslogRegister(int sysRegister);
extern int getSyslogRegister();
extern TCHAR* getSyslogEventSourceName();
#endif
#ifndef WIN32
extern void setSyslogFacility( const TCHAR *loginfo_level );
#endif
extern void setSyslogEventSourceName( const TCHAR *event_source_name );
extern void setThreadMessageBufferInitialSize(int initialValue);
extern void disableSysLog(int silent);
extern int syslogMessageFileRegistered(int silent);
extern int registerSyslogMessageFile(int forceInstall, int silent);
extern int unregisterSyslogMessageFile(int silent);
extern void resetDuration();
extern int getLowLogLevel();
/* * General log functions * */
extern int isLogInitialized();
extern int initLogging(void (*logFileChanged)(const TCHAR *logFile));
extern int disposeLogging();
extern void setUptime(int uptime, int flipped);
extern void rollLogs(const TCHAR *nowStr);
extern int getLogLevelForName( const TCHAR *logLevelName );
#ifndef WIN32
extern int getLogFacilityForName( const TCHAR *logFacilityName );
extern void generateCurrentLogFileName(TCHAR** pFileName);
#endif
extern void logRegisterThread(int thread_id);
extern void logRegisterFormatCallbacks(int (*countCallback)(const TCHAR format, size_t *reqSize),
int (*printCallback)(const TCHAR format, size_t printSize, TCHAR** pBuffer));
void printToConsole(const TCHAR *printBuffer, FILE *target);
void printToConsoleLn(const TCHAR *printBuffer, FILE *target);
/**
* The log_printf function logs a message to the configured log targets.
*
* This method can be used safely in most cases. See the log_printf_queue
* funtion for the exceptions.
*/
extern void log_printf( int source_id, int level, const TCHAR *lpszFmt, ... );
/**
* The log_printf_queue function is less efficient than the log_printf
* function and will cause logged messages to be logged out of order from
* those logged with log_printf because the messages are queued and then
* logged from another thread.
*
* Use of this function is required in cases where the thread may possibly
* be a signal callback. In these cases, it is possible for the original
* thread to have been suspended within a log_printf call. If the signal
* thread then attempted to call log_printf, it would result in a deadlock.
*/
extern void log_printf_queue( int useQueue, int source_id, int level, const TCHAR *lpszFmt, ... );
extern void maintainLogger();
extern void invalidMultiByteSequence(const TCHAR *context, int id);
#ifdef WIN32
extern void setLogSysLangId(int id);
#endif
#endif
wrapper_3.5.51_src/src/c/logger_base.h 100644 0 0 4013 14333053650 15000 0 ustar 0 0 /*
* Copyright (c) 1999, 2022 Tanuki Software, Ltd.
* http://www.tanukisoftware.com
* All rights reserved.
*
* This software is the proprietary information of Tanuki Software.
* You shall use it only in accordance with the terms of the
* license agreement you entered into with Tanuki Software.
* http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
*/
#ifndef _LOGGER_BASE_H
#define _LOGGER_BASE_H
#include "wrapper_i18n.h"
/* * * Log level constants * * */
/* No logging at all. */
#define LEVEL_NONE 9
/* Notice messages which should always be displayed. These never go to the syslog. */
#define LEVEL_NOTICE 8
/* Advisor messages which should always be displayed. These never go to the syslog. */
#define LEVEL_ADVICE 7
/* Too many restarts, unable to start etc. Case when the Wrapper is forced to exit. */
#define LEVEL_FATAL 6
/* JVM died, hung messages */
#define LEVEL_ERROR 5
/* Warning messages. */
#define LEVEL_WARN 4
/* Started, Stopped, Restarted messages. */
#define LEVEL_STATUS 3
/* Copyright message. and logged console output. */
#define LEVEL_INFO 2
/* Current debug messages */
#define LEVEL_DEBUG 1
/* Unknown level */
#define LEVEL_UNKNOWN 0
/* The maximum length of a source string, not including the null character. */
#define MAX_SOURCE_LENGTH 8
/* * * Function predeclaration * * */
/**
* Returns a textual error message of the last error encountered.
*
* @return The last error message.
*/
extern const TCHAR* getLastErrorText();
/**
* Returns a textual error message of a given error number.
*
* @param errorNum Error code.
* @param handle (for Windows only) A module handle containing the message-table resource(s) to search. If NULL, the current process's application image file will be searched.
*
* @return The error message.
*/
extern const TCHAR* getErrorText(int errorNum, void* handle);
/**
* Returns the last error number.
*
* @return The last error number.
*/
extern int getLastError();
extern void outOfMemory(const TCHAR *context, int id);
#endif
wrapper_3.5.51_src/src/c/logger_file.c 100644 0 0 73450 14333053650 15033 0 ustar 0 0 /*
* Copyright (c) 1999, 2022 Tanuki Software, Ltd.
* http://www.tanukisoftware.com
* All rights reserved.
*
* This software is the proprietary information of Tanuki Software.
* You shall use it only in accordance with the terms of the
* license agreement you entered into with Tanuki Software.
* http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
*/
/**
* Author:
* Tanuki Software Development Team
*/
#ifdef WIN32
#include
#include
#else
#include
#include
#include
#endif
#ifdef WIN32
#include
#endif
#include "logger.h"
#include "logger_file.h"
#include "wrapper_i18n.h"
#define FILES_CHUNK 5
#ifndef TRUE
#define TRUE -1
#endif
#ifndef FALSE
#define FALSE 0
#endif
/**
* Returns a valid sort mode given a name: "TIMES", "NAMES_ASC", "NAMES_DEC", "NAMES_SMART".
* In the event of an invalid value, TIMES will be returned.
*/
int loggerFileGetSortMode(const TCHAR *modeName) {
if (strcmpIgnoreCase(modeName, TEXT("NAMES_ASC")) == 0) {
return LOGGER_FILE_SORT_MODE_NAMES_ASC;
} else if (strcmpIgnoreCase(modeName, TEXT("NAMES_DEC")) == 0) {
return LOGGER_FILE_SORT_MODE_NAMES_DEC;
} else if (strcmpIgnoreCase(modeName, TEXT("NAMES_SMART")) == 0) {
return LOGGER_FILE_SORT_MODE_NAMES_SMART;
} else {
return LOGGER_FILE_SORT_MODE_TIMES;
}
}
#ifdef WIN32
int sortFilesTimes(TCHAR **files, __time64_t *fileTimes, int cnt) {
#else
int sortFilesTimes(TCHAR **files, time_t *fileTimes, int cnt) {
#endif
int i, j;
TCHAR *temp;
#ifdef WIN32
__time64_t tempTime;
#else
time_t tempTime;
#endif
for (i = 0; i < cnt; i++) {
for (j = 0; j < cnt - 1; j++) {
if (fileTimes[j] < fileTimes[j + 1]) {
temp = files[j + 1];
tempTime = fileTimes[j + 1];
files[j + 1] = files[j];
fileTimes[j + 1] = fileTimes[j];
files[j] = temp;
fileTimes[j] = tempTime;
}
}
}
return TRUE;
}
/**
* Compares two strings. Returns 0 if they are equal, -1 if file1 is bigger, 1 if file2 is bigger.
*/
int compareFileNames(const TCHAR *file1, const TCHAR *file2) {
int pos1, pos2;
TCHAR c1, c2;
int numeric1, numeric2;
long int num1, num2;
int afterNumber = FALSE;
pos1 = 0;
pos2 = 0;
while (TRUE) {
c1 = file1[pos1];
c2 = file2[pos2];
/*printf(" file1[%d]=%d, file2[%d]=%d\n", pos1, c1, pos2, c2);*/
/* Did we find the null. */
if (c1 == 0) {
if (c2 == 0) {
return 0;
} else {
return 1;
}
} else {
if (c2 == 0) {
return -1;
} else {
/* Continue. */
}
}
/* We have two characters. */
numeric1 = ((c1 >= TEXT('0')) && (c1 <= TEXT('9')));
numeric2 = ((c2 >= TEXT('0')) && (c2 <= TEXT('9')));
/* See if one or both of the strings is numeric. */
if (numeric1) {
if (numeric2) {
/* Both are numeric, we need to start comparing the two file names as integer values. */
num1 = c1 - TEXT('0');
c1 = file1[pos1 + 1];
while ((c1 >= TEXT('0')) && (c1 <= TEXT('9'))) {
num1 = num1 * 10 + (c1 - TEXT('0'));
pos1++;
c1 = file1[pos1 + 1];
}
num2 = c2 - TEXT('0');
c2 = file2[pos2 + 1];
while ((c2 >= TEXT('0')) && (c2 <= TEXT('9'))) {
num2 = num2 * 10 + (c2 - TEXT('0'));
pos2++;
c2 = file2[pos2 + 1];
}
/*printf(" num1=%ld, num2=%ld\n", num1, num2);*/
if (num1 > num2) {
return -1;
} else if (num2 > num1) {
return 1;
} else {
/* Equal, continue. */
}
afterNumber = TRUE;
} else {
/* 1 is numeric, 2 is not. */
if (afterNumber) {
return -1;
} else {
return 1;
}
}
} else {
if (numeric2) {
/* 1 is not, 2 is numeric. */
if (afterNumber) {
return 1;
} else {
return -1;
}
} else {
/* Neither is numeric. */
}
}
/* Compare the characters as is. */
if (c1 > c2) {
return -1;
} else if (c2 > c1) {
return 1;
} else {
/* Equal, continue. */
if ((c1 == TEXT('.')) || (c1 == TEXT('-')) || (c1 == TEXT('_'))) {
} else {
afterNumber = FALSE;
}
}
pos1++;
pos2++;
}
}
int compareFileNamesIndex(const TCHAR *file1, const TCHAR *file2, int startIndex, int stopIndex, int startCountFromEnd, int stopCountFromEnd) {
TCHAR *file1_;
TCHAR *file2_;
int start;
int len;
int result;
start = (startCountFromEnd ? (int)_tcslen(file1) - startIndex : startIndex);
len = (stopCountFromEnd ? (int)_tcslen(file1) - stopIndex : stopIndex) - start;
file1_ = malloc(sizeof(TCHAR) * (len + 1));
if (!file1_) {
outOfMemoryQueued(TEXT("CFNI"), 1);
return 0;
}
_tcsncpy(file1_, file1 + start, len);
file1_[len] = 0;
start = (startCountFromEnd ? (int)_tcslen(file2) - startIndex : startIndex);
len = (stopCountFromEnd ? (int)_tcslen(file2) - stopIndex : stopIndex) - start;
file2_ = malloc(sizeof(TCHAR) * (len + 1));
if (!file2_) {
free(file1_);
outOfMemoryQueued(TEXT("CFNI"), 2);
return 0;
}
_tcsncpy(file2_, file2 + start, len);
file2_[len] = 0;
result = compareFileNames(file1_, file2_);
free(file1_);
free(file2_);
return result;
}
int sortFilesNamesAsc(TCHAR **files, int cnt) {
int i, j;
TCHAR *temp;
int cmp;
for (i = 0; i < cnt; i++) {
for (j = 0; j < cnt - 1; j++) {
cmp = compareFileNames(files[j], files[j+1]);
if (cmp < 0) {
temp = files[j + 1];
files[j + 1] = files[j];
files[j] = temp;
}
}
}
return TRUE;
}
int sortFilesNamesDec(TCHAR **files, int cnt) {
int i, j;
TCHAR *temp;
int cmp;
for (i = 0; i < cnt; i++) {
for (j = 0; j < cnt - 1; j++) {
cmp = compareFileNames(files[j], files[j+1]);
if (cmp > 0) {
temp = files[j + 1];
files[j + 1] = files[j];
files[j] = temp;
}
}
}
return TRUE;
}
int sortFilesNamesDecIndex(TCHAR **files, int cnt, int startIndex, int stopIndex, int startCountFromEnd, int stopCountFromEnd) {
int i, j;
TCHAR *temp;
int cmp;
for (i = 0; i < cnt; i++) {
for (j = 0; j < cnt - 1; j++) {
cmp = compareFileNamesIndex(files[j], files[j+1], startIndex, stopIndex, startCountFromEnd, stopCountFromEnd);
if (cmp > 0) {
temp = files[j + 1];
files[j + 1] = files[j];
files[j] = temp;
}
}
}
return TRUE;
}
/**
* This function allows to sort filenames with the following logic:
* - if the given pattern contains a ???????? (date) token, the files are first sorted by date descending.
* - if the given pattern contains a * (num) token, the files are sorted by ascending numbers (for equivalent dates).
* The first file being the one without number.
* NOTE: The function assumes that there is at most one token of each!
*
* @param pattern pattern used to figure out how to sort the files.
* @param files list of files to sort.
* @param cnt number of files to sort.
*/
int sortFilesNamesSmart(const TCHAR* pattern, TCHAR **files, int cnt) {
int i, j;
TCHAR *temp;
int cmp;
TCHAR* numToken;
TCHAR* dateToken;
int numStartIndex, numStopIndex;
int dateStartIndex = 0;
int dateStopIndex = 0;
int startCountFromEnd = 0;
int stopCountFromEnd = 0;
/* First sort by date. */
dateToken = _tcsstr(pattern, TEXT("?"));
numToken = _tcsstr(pattern, TEXT("*"));
if (dateToken) {
if (!numToken || (dateToken < numToken)) {
dateStartIndex = (int)(dateToken - pattern);
dateStopIndex = dateStartIndex + 8;
startCountFromEnd = FALSE;
stopCountFromEnd = FALSE;
} else {
/* There is a num token before the date. So the length before the date is not fixed. Calculate the index from the end. */
dateStartIndex = (int)_tcslen(pattern) - (int)(dateToken - pattern);
dateStopIndex = dateStartIndex - 8;
startCountFromEnd = TRUE;
stopCountFromEnd = TRUE;
}
sortFilesNamesDecIndex(files, cnt, dateStartIndex, dateStopIndex, startCountFromEnd, stopCountFromEnd);
}
if (numToken) {
numStartIndex = (int)(numToken - pattern);
numStopIndex = (int)_tcslen(pattern) - (numStartIndex + 1);
for (i = 0; i < cnt; i++) {
for (j = 0; j < cnt - 1; j++) {
if (dateToken) {
/* Make sure that the dates are equals. */
cmp = compareFileNamesIndex(files[j], files[j+1], dateStartIndex, dateStopIndex, startCountFromEnd, stopCountFromEnd);
if (cmp != 0) {
continue;
}
}
/* Sort by ascending name. */
cmp = compareFileNamesIndex(files[j], files[j+1], numStartIndex, numStopIndex, FALSE, TRUE);
if (cmp < 0) {
temp = files[j + 1];
files[j + 1] = files[j];
files[j] = temp;
}
}
}
}
return TRUE;
}
/**
* Returns a NULL terminated list of file names within the specified pattern.
* The files will be sorted new to old for TIMES. Then incremental ordering
* for NAMES. The numeric components of the names will be treated as
* numbers and sorted accordingly.
*/
TCHAR** loggerFileGetFiles(const TCHAR* pattern, int sortMode) {
int cnt;
int filesSize;
TCHAR **files;
#ifdef WIN32
int i;
size_t dirLen;
TCHAR *c;
TCHAR *dirPart;
intptr_t handle;
struct _tfinddata64_t fblock;
size_t fileLen;
TCHAR **newFiles;
__time64_t *fileTimes;
__time64_t *newFileTimes;
#else
#ifdef WRAPPER_FILE_DEBUG
int i;
#endif
int result;
glob_t g;
int findex;
time_t *fileTimes;
struct stat fileStat;
#endif
#ifdef WRAPPER_FILE_DEBUG
_tprintf(TEXT("loggerFileGetFiles(%s, %d)\n"), pattern, sortMode);
#endif
#ifdef WIN32
cnt = 0;
/* Initialize the files array. */
filesSize = FILES_CHUNK;
files = malloc(sizeof(TCHAR *) * filesSize);
if (!files) {
outOfMemoryQueued(TEXT("WFGF"), 1);
return NULL;
}
memset(files, 0, sizeof(TCHAR *) * filesSize);
fileTimes = malloc(sizeof(__time64_t) * filesSize);
if (!fileTimes) {
outOfMemoryQueued(TEXT("WFGF"), 2);
free(files);
return NULL;
}
memset(fileTimes, 0, sizeof(__time64_t) * filesSize);
/* Extract any path information from the beginning of the file */
c = max(_tcsrchr(pattern, TEXT('\\')), _tcsrchr(pattern, TEXT('/')));
if (c == NULL) {
/* No directory component */
dirPart = malloc(sizeof(TCHAR) * 1);
if (!dirPart) {
outOfMemoryQueued(TEXT("WFGF"), 3);
return NULL;
}
dirPart[0] = TEXT('\0');
dirLen = 0;
} else {
/* extract the directory. */
dirLen = c - pattern + 1;
dirPart = malloc(sizeof(TCHAR) * (dirLen + 1));
if (!dirPart) {
outOfMemoryQueued(TEXT("WFGF"), 4);
return NULL;
}
_tcsncpy(dirPart, pattern, dirLen);
dirPart[dirLen] = TEXT('\0');
}
#ifdef WRAPPER_FILE_DEBUG
_tprintf(TEXT(" dirPart=[%s]\n"), dirPart);
#endif
/* Get the first file. */
#ifdef _IA64_
/* On Itanium, the first parameter is not a "const". If you don't cast it, then you have a warning */
if ((handle = _tfindfirst64((TCHAR *)pattern, &fblock)) > 0) {
#else
if ((handle = _tfindfirst64(pattern, &fblock)) > 0) {
#endif
if ((_tcscmp(fblock.name, TEXT(".")) != 0) && (_tcscmp(fblock.name, TEXT("..")) != 0)) {
fileLen = _tcslen(fblock.name);
files[cnt] = malloc((_tcslen(dirPart) + _tcslen(fblock.name) + 1) * sizeof(TCHAR));
if (!files[cnt]) {
outOfMemoryQueued(TEXT("WFGF"), 5);
free(fileTimes);
loggerFileFreeFiles(files);
free(dirPart);
return NULL;
}
_sntprintf(files[cnt], _tcslen(dirPart) + _tcslen(fblock.name) + 1, TEXT("%s%s"), dirPart, fblock.name);
fileTimes[cnt] = fblock.time_write;
#ifdef WRAPPER_FILE_DEBUG
_tprintf(TEXT(" files[%d]=%s, %ld\n"), cnt, files[cnt], fileTimes[cnt]);
#endif
cnt++;
}
/* Look for additional files. */
while (_tfindnext64(handle, &fblock) == 0) {
if ((_tcscmp(fblock.name, TEXT(".")) != 0) && (_tcscmp(fblock.name, TEXT("..")) != 0)) {
/* Make sure we have enough room in the files array. */
if (cnt >= filesSize - 1) {
newFiles = malloc(sizeof(TCHAR *) * (filesSize + FILES_CHUNK));
if (!newFiles) {
outOfMemoryQueued(TEXT("WFGF"), 6);
free(fileTimes);
loggerFileFreeFiles(files);
free(dirPart);
return NULL;
}
memset(newFiles, 0, sizeof(TCHAR *) * (filesSize + FILES_CHUNK));
newFileTimes = malloc(sizeof(__time64_t) * (filesSize + FILES_CHUNK));
if (!newFileTimes) {
outOfMemoryQueued(TEXT("WFGF"), 7);
free(newFiles);
free(fileTimes);
loggerFileFreeFiles(files);
free(dirPart);
return NULL;
}
memset(newFileTimes, 0, sizeof(__time64_t) * (filesSize + FILES_CHUNK));
for (i = 0; i < filesSize; i++) {
newFiles[i] = files[i];
newFileTimes[i] = fileTimes[i];
}
free(files);
free(fileTimes);
files = newFiles;
fileTimes = newFileTimes;
filesSize += FILES_CHUNK;
#ifdef WRAPPER_FILE_DEBUG
_tprintf(TEXT(" increased files to %d\n"), filesSize);
#endif
}
fileLen = _tcslen(fblock.name);
files[cnt] = malloc((_tcslen(dirPart) + _tcslen(fblock.name) + 1) * sizeof(TCHAR));
if (!files[cnt]) {
outOfMemoryQueued(TEXT("WFGF"), 8);
free(fileTimes);
loggerFileFreeFiles(files);
free(dirPart);
return NULL;
}
_sntprintf(files[cnt], _tcslen(dirPart) + _tcslen(fblock.name) + 1, TEXT("%s%s"), dirPart, fblock.name);
fileTimes[cnt] = fblock.time_write;
#ifdef WRAPPER_FILE_DEBUG
_tprintf(TEXT(" files[%d]=%s, %ld\n"), cnt, files[cnt], fileTimes[cnt]);
#endif
cnt++;
}
}
/* Close the file search */
_findclose(handle);
}
if (cnt <= 0) {
if (errno == ENOENT) {
/* No files matched. */
#ifdef WRAPPER_FILE_DEBUG
_tprintf(TEXT(" No files matched.\n"));
#endif
} else {
/* Encountered an error of some kind. */
log_printf_queue(TRUE, WRAPPER_SOURCE_WRAPPER, LEVEL_ERROR, TEXT("Error listing files, %s: %s"), pattern, getLastErrorText());
free(fileTimes);
loggerFileFreeFiles(files);
return NULL;
}
}
#else /* Unix */
#ifdef UNICODE
char* cPattern;
size_t req;
req = wcstombs(NULL, pattern, 0) + 1;
cPattern = malloc(req);
if(!cPattern) {
outOfMemoryQueued(TEXT("WFGF"), 8);
return NULL;
}
wcstombs(cPattern, pattern, req);
result = glob(cPattern, GLOB_MARK | GLOB_NOSORT, NULL, &g);
free(cPattern);
#else
result = glob(pattern, GLOB_MARK | GLOB_NOSORT, NULL, &g);
#endif
cnt = 0;
if (!result) {
if (g.gl_pathc > 0) {
filesSize = g.gl_pathc + 1;
files = malloc(sizeof(TCHAR *) * filesSize);
if (!files) {
outOfMemoryQueued(TEXT("WFGF"), 9);
return NULL;
}
memset(files, 0, sizeof(TCHAR *) * filesSize);
fileTimes = malloc(sizeof(time_t) * filesSize);
if (!fileTimes) {
outOfMemoryQueued(TEXT("WFGF"), 10);
loggerFileFreeFiles(files);
return NULL;
}
memset(fileTimes, 0, sizeof(time_t) * filesSize);
for (findex = 0; findex < g.gl_pathc; findex++) {
#ifdef UNICODE
req = mbstowcs(NULL, g.gl_pathv[findex], 0);
if (req == (size_t)-1) {
invalidMultiByteSequence(TEXT("GLET"), 1);
}
files[cnt] = malloc((req + 1) * sizeof(TCHAR));
if (!files[cnt]) {
outOfMemoryQueued(TEXT("WFGF"), 11);
free(fileTimes);
loggerFileFreeFiles(files);
return NULL;
}
mbstowcs(files[cnt], g.gl_pathv[findex], req + 1);
#else
files[cnt] = malloc((strlen(g.gl_pathv[findex]) + 1));
if (!files[cnt]) {
outOfMemoryQueued(TEXT("WFGF"), 11);
free(fileTimes);
loggerFileFreeFiles(files);
return NULL;
}
strncpy(files[cnt], g.gl_pathv[findex], strlen(g.gl_pathv[findex]) + 1);
#endif
/* Only try to get the modified time if it is really necessary. */
if (sortMode == LOGGER_FILE_SORT_MODE_TIMES) {
if (!_tstat(files[cnt], &fileStat)) {
fileTimes[cnt] = fileStat.st_mtime;
} else {
log_printf_queue(TRUE, WRAPPER_SOURCE_WRAPPER, LEVEL_WARN, TEXT("Failed to stat %s: %s"), files[cnt], getLastErrorText());
}
}
#ifdef WRAPPER_FILE_DEBUG
_tprintf(TEXT(" files[%d]=%s, %ld\n"), cnt, files[cnt], fileTimes[cnt]);
#endif
cnt++;
}
} else {
#ifdef WRAPPER_FILE_DEBUG
printf(" No files matched.\n");
#endif
/* No files, but we still need the array. */
filesSize = 1;
files = malloc(sizeof(TCHAR *) * filesSize);
if (!files) {
outOfMemoryQueued(TEXT("WFGF"), 12);
return NULL;
}
memset(files, 0, sizeof(TCHAR *) * filesSize);
fileTimes = malloc(sizeof(time_t) * filesSize);
if (!fileTimes) {
free(files);
outOfMemoryQueued(TEXT("WFGF"), 13);
return NULL;
}
memset(fileTimes, 0, sizeof(time_t) * filesSize);
}
globfree(&g);
} else if (result == GLOB_NOMATCH) {
#ifdef WRAPPER_FILE_DEBUG
_tprintf(TEXT(" No files matched.\n"));
#endif
/* No files, but we still need the array. */
filesSize = 1;
files = malloc(sizeof(TCHAR *) * filesSize);
if (!files) {
outOfMemoryQueued(TEXT("WFGF"), 14);
return NULL;
}
memset(files, 0, sizeof(TCHAR *) * filesSize);
fileTimes = malloc(sizeof(time_t) * filesSize);
if (!fileTimes) {
free(files);
outOfMemoryQueued(TEXT("WFGF"), 15);
return NULL;
}
memset(fileTimes, 0, sizeof(time_t) * filesSize);
} else {
/* Encountered an error of some kind. */
log_printf_queue(TRUE, WRAPPER_SOURCE_WRAPPER, LEVEL_ERROR, TEXT("Error listing files, %s: %s"), pattern, getLastErrorText());
return NULL;
}
#endif
if (sortMode == LOGGER_FILE_SORT_MODE_TIMES) {
if (!sortFilesTimes(files, fileTimes, cnt)) {
/* Failed. Reported. */
free(fileTimes);
loggerFileFreeFiles(files);
return NULL;
}
} else if (sortMode == LOGGER_FILE_SORT_MODE_NAMES_SMART) {
if (!sortFilesNamesSmart(pattern, files, cnt)) {
/* Failed. Reported. */
free(fileTimes);
loggerFileFreeFiles(files);
return NULL;
}
} else if (sortMode == LOGGER_FILE_SORT_MODE_NAMES_DEC) {
if (!sortFilesNamesDec(files, cnt)) {
/* Failed. Reported. */
free(fileTimes);
loggerFileFreeFiles(files);
return NULL;
}
} else { /* LOGGER_FILE_SORT_MODE_NAMES_ASC */
if (!sortFilesNamesAsc(files, cnt)) {
/* Failed. Reported. */
free(fileTimes);
loggerFileFreeFiles(files);
return NULL;
}
}
#ifdef WRAPPER_FILE_DEBUG
_tprintf(TEXT(" Sorted:\n"));
for (i = 0; i < cnt; i++) {
_tprintf(TEXT(" files[%d]=%s, %ld\n"), i, files[i], fileTimes[i]);
}
_tprintf(TEXT("loggerFileGetFiles(%s, %d) END\n"), pattern, sortMode);
#endif
free(fileTimes);
return files;
}
/**
* Frees the array of file names returned by loggerFileGetFiles()
*/
void loggerFileFreeFiles(TCHAR** files) {
int i;
i = 0;
while (files[i]) {
free(files[i]);
i++;
}
free(files);
}
/**
* Combines two paths and take care to add only one separator between them.
*
* The returned string must be freed by the caller.
*
* @param path1 base path
* @param path2 relative path.
*
* @return The resulting path, or NULL if there were any problems.
*/
TCHAR *combinePath(const TCHAR *path1, const TCHAR *path2) {
TCHAR* result;
TCHAR* tempPath1 = NULL;
TCHAR* tempPath2 = NULL;
TCHAR* tempPath2Ptr;
TCHAR c1;
TCHAR c2;
size_t len1 = _tcslen(path1);
size_t len2 = _tcslen(path2);
size_t len = len1 + len2;
int i = 0;
#ifdef WIN32
const TCHAR bad_sep = TEXT('/');
const TCHAR good_sep = TEXT('\\');
#else
const TCHAR bad_sep = TEXT('\\');
const TCHAR good_sep = TEXT('/');
#endif
if (len1 > 0) {
tempPath1 = malloc(sizeof(TCHAR) * (len1 + 1));
if (!tempPath1) {
outOfMemoryQueued(TEXT("CP"), 1);
return NULL;
}
_tcsncpy(tempPath1, path1, len1 + 1);
}
if (len2 > 0) {
tempPath2 = malloc(sizeof(TCHAR) * (len2 + 1));
if (!tempPath2) {
outOfMemoryQueued(TEXT("CP"), 2);
free(tempPath1);
return NULL;
}
_tcsncpy(tempPath2, path2, len2 + 1);
}
if (!tempPath1 && !tempPath2) {
result = NULL;
} else if (tempPath1 && !tempPath2) {
result = tempPath1;
} else if (!tempPath1 && tempPath2) {
result = tempPath2;
} else {
tempPath2Ptr = tempPath2;
/* first replace all directory separators by their standard according to the platform.
* we want to avoid that the two paths use different separators. */
while (tempPath1[i] != TEXT('\0')) {
if (tempPath1[i] == bad_sep) {
tempPath1[i] = good_sep;
}
i++;
}
i = 0;
while (tempPath2[i] != TEXT('\0')) {
if (tempPath2[i] == bad_sep) {
tempPath2[i] = good_sep;
}
i++;
}
c1 = tempPath1[len1 - 1];
c2 = tempPath2[0];
if (c1 == good_sep) {
if (c2 == good_sep) {
tempPath2Ptr++;
} else {
len += 1;
}
result = malloc(sizeof(TCHAR) * len);
if (!result) {
outOfMemoryQueued(TEXT("CP"), 3);
free(tempPath1);
free(tempPath2);
return NULL;
}
_sntprintf(result, len, TEXT("%s%s"), tempPath1, tempPath2Ptr);
} else {
if (c2 == good_sep) {
tempPath2Ptr++;
len += 1;
} else {
len += 2;
}
result = malloc(sizeof(TCHAR) * len);
if (!result) {
outOfMemoryQueued(TEXT("CP"), 4);
free(tempPath1);
free(tempPath2);
return NULL;
}
_sntprintf(result, len, TEXT("%s%c%s"), tempPath1, good_sep, tempPath2Ptr);
}
free(tempPath1);
free(tempPath2);
}
return result;
}
/**
* Given a path, resolve a real absolute path which has resolved all relative and symbolic links.
*
* The returned string must be freed by the caller.
*
* @param path The source path.
* @param pathDesc A description of the path used for error messages.
* @param errorLevel Level to log errors at.
*
* @return The absolute path, or NULL if there were any problems.
*/
TCHAR *getRealPath(const TCHAR *path, const TCHAR *pathDesc, int errorLevel, int useQueue) {
TCHAR *realPath;
#ifdef WIN32
DWORD len;
#else
size_t len;
TCHAR *tempPath;
#endif
#ifdef WIN32
len = GetFullPathName(path, 0, NULL, NULL);
if (!len) {
if (errorLevel != LEVEL_NONE) {
log_printf_queue(useQueue, WRAPPER_SOURCE_WRAPPER, errorLevel, TEXT("Unable to resolve the %s '%s': %s"), pathDesc, path, getLastErrorText());
}
return NULL;
}
realPath = malloc(sizeof(TCHAR) * len);
if (!realPath) {
if (useQueue) {
outOfMemoryQueued(TEXT("GRP"), 1);
} else {
outOfMemory(TEXT("GRP"), 1);
}
return NULL;
}
if (!GetFullPathName(path, len, realPath, NULL)) {
if (errorLevel != LEVEL_NONE) {
log_printf_queue(useQueue, WRAPPER_SOURCE_WRAPPER, errorLevel, TEXT("Unable to resolve the %s '%s': %s"), pathDesc, path, getLastErrorText());
}
free(realPath);
return NULL;
}
#else
/* The solaris implementation of realpath will return a relative path if a relative
* path is provided. We always need an absolute path here. So build up one and
* then use realpath to remove any .. or other relative references. */
tempPath = malloc(sizeof(TCHAR) * (PATH_MAX + 1));
if (!tempPath) {
if (useQueue) {
outOfMemoryQueued(TEXT("GRP"), 2);
} else {
outOfMemory(TEXT("GRP"), 2);
}
return NULL;
}
if (_trealpathN(path, tempPath, PATH_MAX + 1) == NULL) {
if (errorLevel != LEVEL_NONE) {
log_printf_queue(useQueue, WRAPPER_SOURCE_WRAPPER, errorLevel, TEXT("Unable to resolve the %s '%s': %s"), pathDesc, path, getLastErrorText());
}
free(tempPath);
return NULL;
}
/* Now that we know how big the resulting string is, put it into a buffer of the correct size to avoid waste. */
len = _tcslen(tempPath) + 1;
realPath = malloc(sizeof(TCHAR) * len);
if (!realPath) {
if (useQueue) {
outOfMemoryQueued(TEXT("GRP"), 3);
} else {
outOfMemory(TEXT("GRP"), 3);
}
free(tempPath);
return NULL;
}
_tcsncpy(realPath, tempPath, len);
free(tempPath);
#endif
return realPath;
}
/**
* Returns the absolute path of a file even if the file is not yet created.
* The folder containing the file must exist.
*
* The returned string must be freed by the caller.
*
* @param path The source path.
* @param pathDesc A description of the path used for error messages.
* @param errorLevel Level to log errors at.
*
* @return The absolute path, or NULL if there were any problems.
*/
TCHAR* getAbsolutePathOfFile(const TCHAR* path, const TCHAR *pathDesc, int errorLevel, int useQueue) {
TCHAR* ptr;
TCHAR* dir;
const TCHAR* file;
TCHAR* result = NULL;
TCHAR* pathCpy;
pathCpy = malloc(sizeof(TCHAR) * (_tcslen(path) + 1));
if (!pathCpy) {
outOfMemoryQueued(TEXT("GAPOF"), 1);
} else {
_tcsncpy(pathCpy, path, _tcslen(path) + 1);
ptr = __max(_tcsrchr(pathCpy, TEXT('\\')), _tcsrchr(pathCpy, TEXT('/')));
if (ptr) {
*ptr = 0;
ptr++;
dir = getRealPath(pathCpy, pathDesc, errorLevel, useQueue);
file = ptr;
} else {
dir = getRealPath(TEXT("."), pathDesc, errorLevel, useQueue);
file = pathCpy;
}
if (dir) {
result = combinePath(dir, file);
free(dir);
}
free(pathCpy);
}
return result;
}
#ifdef LOGGER_FILE_DEBUG
void loggerFileTests() {
TCHAR** files;
printf("Start loggerFileTests\n");
files = loggerFileGetFiles((TEXT("../logs/*.log*"), LOGGER_FILE_SORT_MODE_TIMES);
if (files) {
loggerFileFreeFiles(files);
}
files = loggerFileGetFiles(TEXT("../logs/*.log*"), LOGGER_FILE_SORT_MODE_NAMES_ASC);
if (files) {
loggerFileFreeFiles(files);
}
files = loggerFileGetFiles(TEXT("../logs/*.log*"), LOGGER_FILE_SORT_MODE_NAMES_DEC);
if (files) {
loggerFileFreeFiles(files);
}
printf("End loggerFileTests\n");
}
#endif
wrapper_3.5.51_src/src/c/logger_file.h 100644 0 0 3325 14333053650 15012 0 ustar 0 0 /*
* Copyright (c) 1999, 2022 Tanuki Software, Ltd.
* http://www.tanukisoftware.com
* All rights reserved.
*
* This software is the proprietary information of Tanuki Software.
* You shall use it only in accordance with the terms of the
* license agreement you entered into with Tanuki Software.
* http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
*/
/**
* Author:
* Tanuki Software Development Team
*/
#ifndef _LOGGER_FILE_H
#define _LOGGER_FILE_H
#ifdef WIN32
#include
#endif
#include "wrapper_i18n.h"
/*#define LOGGER_FILE_DEBUG*/
#define LOGGER_FILE_SORT_MODE_TIMES 100
#define LOGGER_FILE_SORT_MODE_NAMES_ASC 101
#define LOGGER_FILE_SORT_MODE_NAMES_DEC 102
#define LOGGER_FILE_SORT_MODE_NAMES_SMART 103
/**
* Returns a valid sort mode given a name: "TIMES", "NAMES_ASC", "NAMES_DEC", "NAMES_SMART".
* In the event of an invalid value, TIMES will be returned.
*/
extern int loggerFileGetSortMode(const TCHAR *modeName);
/**
* Returns a NULL terminated list of file names within the specified pattern.
* The files will be sorted new to old for TIMES. Then incremental ordering
* for NAMES. The numeric components of the names will be treated as
* numbers and sorted accordingly.
*/
extern TCHAR** loggerFileGetFiles(const TCHAR* pattern, int sortMode);
/**
* Frees the array of file names returned by wrapperFileGetFiles()
*/
extern void loggerFileFreeFiles(TCHAR** files);
extern TCHAR *combinePath(const TCHAR *path1, const TCHAR *path2);
extern TCHAR *getRealPath(const TCHAR *path, const TCHAR *pathDesc, int errorLevel, int useQueue);
TCHAR* getAbsolutePathOfFile(const TCHAR* path, const TCHAR *pathDesc, int errorLevel, int useQueue);
#endif
wrapper_3.5.51_src/src/c/loggerjni.c 100644 0 0 21745 14333053650 14535 0 ustar 0 0 /*
* Copyright (c) 1999, 2022 Tanuki Software, Ltd.
* http://www.tanukisoftware.com
* All rights reserved.
*
* This software is the proprietary information of Tanuki Software.
* You shall use it only in accordance with the terms of the
* license agreement you entered into with Tanuki Software.
* http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
*/
#include
#include
#ifdef WIN32
#include
#include
#else
#include
#endif
#include
#include "loggerjni.h"
void outOfMemory(const TCHAR *context, int id) {
log_printf(TEXT("WrapperJNI Error: Out of memory (%s%02d). %s"), context, id, getLastErrorText());
}
void invalidMultiByteSequence(const TCHAR *context, int id) {
log_printf(TEXT("WrapperJNI Error: Invalid multibyte Sequence found in (%s%02d). %s"), context, id, getLastErrorText());
}
#define LAST_ERROR_TEXT_BUFFER_SIZE 1024
/** Buffer holding the last error message.
* TODO: This needs to be made thread safe, meaning that we need a buffer for each thread. */
TCHAR lastErrorTextBufferW[LAST_ERROR_TEXT_BUFFER_SIZE];
/**
* Returns a textual error message of the last error encountered.
*
* @return The last error message.
*/
const TCHAR* getLastErrorText() {
int errorNum;
#ifdef WIN32
DWORD dwRet;
TCHAR* lpszTemp = NULL;
#else
char* lastErrorTextMB;
size_t req;
#endif
#ifdef WIN32
errorNum = GetLastError();
dwRet = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ARGUMENT_ARRAY,
NULL,
GetLastError(),
LANG_NEUTRAL,
(TCHAR*)&lpszTemp,
0,
NULL);
/* supplied buffer is not long enough */
if (!dwRet) {
/* There was an error calling FormatMessage. */
_sntprintf(lastErrorTextBufferW, LAST_ERROR_TEXT_BUFFER_SIZE, TEXT("Failed to format system error message (Error: %d) (Original Error: 0x%x)"), GetLastError(), errorNum);
} else if ((long)LAST_ERROR_TEXT_BUFFER_SIZE - 1 < (long)dwRet + 14) {
_sntprintf(lastErrorTextBufferW, LAST_ERROR_TEXT_BUFFER_SIZE, TEXT("System error message is too large to convert (Required size: %d) (Original Error: 0x%x)"), dwRet, errorNum);
} else {
lpszTemp[lstrlen(lpszTemp)-2] = TEXT('\0'); /*remove cr and newline character */
_sntprintf(lastErrorTextBufferW, LAST_ERROR_TEXT_BUFFER_SIZE, TEXT("%s (0x%x)"), lpszTemp, errorNum);
}
/* following the documentation of FormatMessage, LocalFree should be called to free the output buffer. */
if (lpszTemp) {
LocalFree(lpszTemp);
}
#else
errorNum = errno;
lastErrorTextMB = strerror(errorNum);
req = mbstowcs(NULL, lastErrorTextMB, MBSTOWCS_QUERY_LENGTH);
if (req == (size_t)-1) {
invalidMultiByteSequence(TEXT("GLET"), 1);
_sntprintf(lastErrorTextBufferW, LAST_ERROR_TEXT_BUFFER_SIZE, TEXT("System error message could not be decoded (Error 0x%x)"), errorNum);
} else if (req >= LAST_ERROR_TEXT_BUFFER_SIZE) {
_sntprintf(lastErrorTextBufferW, LAST_ERROR_TEXT_BUFFER_SIZE, TEXT("System error message too large to convert (Require size: %d) (Original Error: 0x%x)"), req, errorNum);
} else {
mbstowcs(lastErrorTextBufferW, lastErrorTextMB, LAST_ERROR_TEXT_BUFFER_SIZE);
}
#endif
/* Always reterminate the buffer just to be sure it is safe because badly encoded characters can cause issues. */
lastErrorTextBufferW[LAST_ERROR_TEXT_BUFFER_SIZE - 1] = TEXT('\0');
return lastErrorTextBufferW;
}
/**
* Returns the last error number.
*
* @return The last error number.
*/
int getLastError() {
#ifdef WIN32
return GetLastError();
#else
return errno;
#endif
}
static int (*printMessageCallback)(const TCHAR* message) = NULL;
/**
* Set a method to print log messages.
*
* @param callback the method to call to print the message.
*/
void setPrintMessageCallback(int (*callback)(const TCHAR* message)) {
printMessageCallback = callback;
}
/**
* Prints the contents of a buffer to all configured targets.
*
* Must be called while locked.
*/
void log_printf_message(TCHAR *message) {
TCHAR *subMessage;
TCHAR *nextLF;
FILE *target;
/* If the message contains line feeds then break up the line into substrings and recurse. */
subMessage = message;
nextLF = _tcschr(subMessage, TEXT('\n'));
if (nextLF) {
/* This string contains more than one line. Loop over the strings. It is Ok to corrupt this string because it is only used once. */
while (nextLF) {
nextLF[0] = TEXT('\0');
log_printf_message(subMessage);
/* Locate the next one. */
subMessage = &(nextLF[1]);
nextLF = _tcschr(subMessage, TEXT('\n'));
}
/* The rest of the buffer will be the final line. */
log_printf_message(subMessage);
return;
}
if (!printMessageCallback || printMessageCallback(message)) {
/* We failed at some point. Print the message even if the encoding may be wrong. The string is already localized. Can we get the original string? */
target = stdout;
_ftprintf(target, TEXT("%s\n"), message);
/* As this is JNI, we always need to flush the output. */
fflush(target);
}
}
/**
* The tLog_printf function logs a message to the configured log targets.
*
* This method can be used safely in most cases. See the tLog_printf_queue
* funtion for the exceptions.
*/
void log_printf(const TCHAR *lpszFmt, ...) {
va_list vargs;
int count;
#ifndef WIN32
TCHAR *msg = NULL;
int i, flag;
#endif
TCHAR* messageBuffer = NULL;
size_t messageBufferSize = 1024;
#ifndef WIN32
if (wcsstr(lpszFmt, TEXT("%s")) != NULL) {
msg = malloc(sizeof(wchar_t) * (wcslen(lpszFmt) + 1));
if (msg) {
/* Loop over the format and convert all '%s' patterns to %S' so the UNICODE displays correctly. */
if (wcslen(lpszFmt) > 0) {
for (i = 0; i < _tcslen(lpszFmt); i++) {
msg[i] = lpszFmt[i];
if ((lpszFmt[i] == TEXT('%')) && (i < _tcslen(lpszFmt)) && (lpszFmt[i + 1] == TEXT('s')) && ((i == 0) || (lpszFmt[i - 1] != TEXT('%')))) {
msg[i+1] = TEXT('S'); i++;
}
}
}
msg[wcslen(lpszFmt)] = TEXT('\0');
} else {
_tprintf(TEXT("Out of memory (P1)\n"));
return;
}
flag = TRUE;
} else {
msg = (TCHAR*) lpszFmt;
flag = FALSE;
}
#endif
/* Loop until the buffer is large enough that we are able to successfully
* print into it. Once the buffer has grown to the largest message size,
* smaller messages will pass through this code without looping. */
do {
if (messageBuffer == 0) {
/* No buffer yet. Allocate one to get started. */
messageBuffer = malloc(sizeof(TCHAR) * messageBufferSize);
if (!messageBuffer) {
_tprintf(TEXT("Out of memory (P2)\n"));
messageBufferSize = 0;
#ifndef WIN32
if (flag == TRUE) {
free(msg);
}
#endif
return;
}
}
/* Try writing to the buffer. */
va_start(vargs, lpszFmt);
#ifndef WIN32
count = _vsntprintf(messageBuffer, messageBufferSize, msg, vargs);
#else
count = _vsntprintf(messageBuffer, messageBufferSize, lpszFmt, vargs);
#endif
va_end(vargs);
if ((count < 0) || (count >= (int)messageBufferSize)) {
/* If the count is exactly equal to the buffer size then a null TCHAR was not written.
* It must be larger.
* Windows will return -1 if the buffer is too small. If the number is
* exact however, we still need to expand it to have room for the null.
* UNIX will return the required size. */
/* Free the old buffer for starters. */
free(messageBuffer);
/* Decide on a new buffer size. */
if (count <= (int)messageBufferSize) {
messageBufferSize += 100;
} else {
messageBufferSize = count + 1;
}
messageBuffer = malloc(sizeof(TCHAR) * messageBufferSize);
if (!messageBuffer) {
_tprintf(TEXT("Out of memory (P3)\n"));
messageBufferSize = 0;
#ifndef WIN32
if (flag == TRUE) {
free(msg);
}
#endif
return;
}
/* Always set the count to -1 so we will loop again. */
count = -1;
}
} while (count < 0);
#ifndef WIN32
if (flag == TRUE) {
free(msg);
}
#endif
/* Actually log the message. */
log_printf_message(messageBuffer);
free(messageBuffer);
}
wrapper_3.5.51_src/src/c/loggerjni.h 100644 0 0 1070 14333053650 14507 0 ustar 0 0 /*
* Copyright (c) 1999, 2022 Tanuki Software, Ltd.
* http://www.tanukisoftware.com
* All rights reserved.
*
* This software is the proprietary information of Tanuki Software.
* You shall use it only in accordance with the terms of the
* license agreement you entered into with Tanuki Software.
* http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
*/
#ifndef _LOGGERJNI_H
#define _LOGGERJNI_H
#include "logger_base.h"
void setPrintMessageCallback(int (*callback)(const TCHAR* message));
void log_printf(const TCHAR *lpszFmt, ...);
#endif
wrapper_3.5.51_src/src/c/makefile.inc 100644 0 0 4511 14333053647 14637 0 ustar 0 0 # makefile.inc -- Include this file into existing makefile at the very top.
# _VC_MANIFEST_INC specifies whether build is incremental (1 - incremental).
# _VC_MANIFEST_BASENAME specifies name of a temporary resource file.
_VC_BIN_DIR=..\..\bin\\
_VC_LIB_DIR=..\..\lib\\
!if "$(DEBUG)" == "1"
CPPFLAGS=$(CPPFLAGS) /MDd
LFLAGS=$(LFLAGS) /INCREMENTAL
_VC_MANIFEST_INC=1
_VC_MANIFEST_BASENAME=__VC90.Debug
!else
CPPFLAGS=$(CPPFLAGS) /MD
_VC_MANIFEST_INC=0
_VC_MANIFEST_BASENAME=__VC90
!endif
####################################################
# _VC_MANIFEST_EMBED_EXE - command to embed manifest in wrapper.EXE:
# _VC_MANIFEST_EMBED_DLL - command to embed manifest in wrapper.DLL:
!if "$(_VC_MANIFEST_INC)" == "1"
#MT_SPECIAL_RETURN=1090650113
#MT_SPECIAL_SWITCH=-notify_resource_update
MT_SPECIAL_RETURN=0
MT_SPECIAL_SWITCH=
_VC_MANIFEST_EMBED_EXE= \
if exist $@.manifest mt.exe -manifest $@.manifest -out:$(_VC_BIN_DIR)$(_VC_MANIFEST_BASENAME).auto.manifest $(MT_SPECIAL_SWITCH) & \
if "%ERRORLEVEL%" == "$(MT_SPECIAL_RETURN)" \
rc /r $(_VC_BIN_DIR)$(_VC_MANIFEST_BASENAME).auto.rc & \
link $** /out:$(_VC_BIN_DIR)$@ $(LFLAGS)
_VC_MANIFEST_EMBED_DLL= \
if exist $@.manifest mt.exe -manifest $@.manifest -out:$(_VC_LIB_DIR)$(_VC_MANIFEST_BASENAME).auto.manifest $(MT_SPECIAL_SWITCH) & \
if "%ERRORLEVEL%" == "$(MT_SPECIAL_RETURN)" \
rc /r $(_VC_LIB_DIR)$(_VC_MANIFEST_BASENAME).auto.rc & \
link $** /out:$(_VC_LIB_DIR)$@ $(LFLAGS)
!else
_VC_MANIFEST_EMBED_EXE= \
if exist $@.manifest mt.exe -manifest $@.manifest -outputresource:$(_VC_BIN_DIR)$@;1
_VC_MANIFEST_EMBED_DLL= \
if exist $@.manifest mt.exe -manifest $@.manifest -outputresource:$(_VC_LIB_DIR)$@;2
!endif
####################################################
# _VC_MANIFEST_CLEAN - command to clean resources files generated temporarily:
!if "$(_VC_MANIFEST_INC)" == "1"
_VC_MANIFEST_CLEAN=-del $(_VC_BIN_DIR)$(_VC_MANIFEST_BASENAME).auto.res \
$(_VC_BIN_DIR)$(_VC_MANIFEST_BASENAME).auto.rc \
$(_VC_BIN_DIR)$(_VC_MANIFEST_BASENAME).auto.manifest \
$(_VC_LIB_DIR)$(_VC_MANIFEST_BASENAME).auto.res \
$(_VC_LIB_DIR)$(_VC_MANIFEST_BASENAME).auto.rc \
$(_VC_LIB_DIR)$(_VC_MANIFEST_BASENAME).auto.manifest
!else
_VC_MANIFEST_CLEAN=
!endif
# End of makefile.inc
#################################################### wrapper_3.5.51_src/src/c/makefile.targ.inc 100644 0 0 2753 14333053647 15601 0 ustar 0 0 # makefile.targ.inc - include this at the very bottom of the existing makefile
####################################################
# Commands to generate initial empty manifest file and the RC file
# that references it, and for generating the .res file:
$(_VC_BIN_DIR)$(_VC_MANIFEST_BASENAME).auto.res : $(_VC_BIN_DIR)$(_VC_MANIFEST_BASENAME).auto.rc
$(_VC_BIN_DIR)$(_VC_MANIFEST_BASENAME).auto.rc : $(_VC_BIN_DIR)$(_VC_MANIFEST_BASENAME).auto.manifest
type <<$@
#include
1RT_MANIFEST"$(_VC_BIN_DIR)$(_VC_MANIFEST_BASENAME).auto.manifest"
1RT_MANIFEST"$(_VC_BIN_DIR)$(_VC_MANIFEST_BASENAME).auto.manifest"
<< KEEP
$(_VC_BIN_DIR)$(_VC_MANIFEST_BASENAME).auto.manifest :
type <<$@
<< KEEP
$(_VC_LIB_DIR)$(_VC_MANIFEST_BASENAME).auto.res : $(_VC_LIB_DIR)$(_VC_MANIFEST_BASENAME).auto.rc
$(_VC_LIB_DIR)$(_VC_MANIFEST_BASENAME).auto.rc : $(_VC_LIB_DIR)$(_VC_MANIFEST_BASENAME).auto.manifest
type <<$@
#include
1RT_MANIFEST"$(_VC_LIB_DIR)$(_VC_MANIFEST_BASENAME).auto.manifest"
1RT_MANIFEST"$(_VC_LIB_DIR)$(_VC_MANIFEST_BASENAME).auto.manifest"
<< KEEP
$(_VC_LIB_DIR)$(_VC_MANIFEST_BASENAME).auto.manifest :
type <<$@
<< KEEP
# end of makefile.targ.inc wrapper_3.5.51_src/src/c/messages.h 100644 0 0 4732 14333053650 14346 0 ustar 0 0 //
// Values are 32 bit values layed out as follows:
//
// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
// +---+-+-+-----------------------+-------------------------------+
// |Sev|C|R| Facility | Code |
// +---+-+-+-----------------------+-------------------------------+
//
// where
//
// Sev - is the severity code
//
// 00 - Success
// 01 - Informational
// 10 - Warning
// 11 - Error
//
// C - is the Customer code flag
//
// R - is a reserved bit
//
// Facility - is the facility code
//
// Code - is the facility's status code
//
//
// Define the facility codes
//
//
// Define the severity codes
//
//
// MessageId: MSG_EVENT_LOG_MESSAGE
//
// MessageText:
//
// %2
//
#define MSG_EVENT_LOG_MESSAGE 0x00000064L
//
// MessageId: MSG_EVENT_LOG_CATEGORY_JVM1
//
// MessageText:
//
// jvm1
//
#define MSG_EVENT_LOG_CATEGORY_JVM1 0x00000001L
//
// MessageId: MSG_EVENT_LOG_CATEGORY_JVM2
//
// MessageText:
//
// jvm2
//
#define MSG_EVENT_LOG_CATEGORY_JVM2 0x00000002L
//
// MessageId: MSG_EVENT_LOG_CATEGORY_JVM3
//
// MessageText:
//
// jvm3
//
#define MSG_EVENT_LOG_CATEGORY_JVM3 0x00000003L
//
// MessageId: MSG_EVENT_LOG_CATEGORY_JVM4
//
// MessageText:
//
// jvm4
//
#define MSG_EVENT_LOG_CATEGORY_JVM4 0x00000004L
//
// MessageId: MSG_EVENT_LOG_CATEGORY_JVM5
//
// MessageText:
//
// jvm5
//
#define MSG_EVENT_LOG_CATEGORY_JVM5 0x00000005L
//
// MessageId: MSG_EVENT_LOG_CATEGORY_JVM6
//
// MessageText:
//
// jvm6
//
#define MSG_EVENT_LOG_CATEGORY_JVM6 0x00000006L
//
// MessageId: MSG_EVENT_LOG_CATEGORY_JVM7
//
// MessageText:
//
// jvm7
//
#define MSG_EVENT_LOG_CATEGORY_JVM7 0x00000007L
//
// MessageId: MSG_EVENT_LOG_CATEGORY_JVM8
//
// MessageText:
//
// jvm8
//
#define MSG_EVENT_LOG_CATEGORY_JVM8 0x00000008L
//
// MessageId: MSG_EVENT_LOG_CATEGORY_JVM9
//
// MessageText:
//
// jvm9
//
#define MSG_EVENT_LOG_CATEGORY_JVM9 0x00000009L
//
// MessageId: MSG_EVENT_LOG_CATEGORY_JVMXX
//
// MessageText:
//
// jvmxx
//
#define MSG_EVENT_LOG_CATEGORY_JVMXX 0x0000000AL
//
// MessageId: MSG_EVENT_LOG_CATEGORY_WRAPPER
//
// MessageText:
//
// wrapper
//
#define MSG_EVENT_LOG_CATEGORY_WRAPPER 0x0000000BL
//
// MessageId: MSG_EVENT_LOG_CATEGORY_PROTOCOL
//
// MessageText:
//
// wrapperp
//
#define MSG_EVENT_LOG_CATEGORY_PROTOCOL 0x0000000CL
wrapper_3.5.51_src/src/c/org_tanukisoftware_wrapper_WrapperManager.h 100644 0 0 52171 14333053650 23227 0 ustar 0 0 /* DO NOT EDIT THIS FILE - it is machine generated */
#include
/* Header for class org_tanukisoftware_wrapper_WrapperManager */
#ifndef _Included_org_tanukisoftware_wrapper_WrapperManager
#define _Included_org_tanukisoftware_wrapper_WrapperManager
#ifdef __cplusplus
extern "C" {
#endif
#undef org_tanukisoftware_wrapper_WrapperManager_DEFAULT_PORT
#define org_tanukisoftware_wrapper_WrapperManager_DEFAULT_PORT 15003L
#undef org_tanukisoftware_wrapper_WrapperManager_DEFAULT_CPU_TIMEOUT
#define org_tanukisoftware_wrapper_WrapperManager_DEFAULT_CPU_TIMEOUT 10000L
#undef org_tanukisoftware_wrapper_WrapperManager_TICK_MS
#define org_tanukisoftware_wrapper_WrapperManager_TICK_MS 100L
#undef org_tanukisoftware_wrapper_WrapperManager_TIMER_FAST_THRESHOLD
#define org_tanukisoftware_wrapper_WrapperManager_TIMER_FAST_THRESHOLD 1728000L
#undef org_tanukisoftware_wrapper_WrapperManager_TIMER_SLOW_THRESHOLD
#define org_tanukisoftware_wrapper_WrapperManager_TIMER_SLOW_THRESHOLD 1728000L
#undef org_tanukisoftware_wrapper_WrapperManager_BACKEND_TYPE_UNKNOWN
#define org_tanukisoftware_wrapper_WrapperManager_BACKEND_TYPE_UNKNOWN 0L
#undef org_tanukisoftware_wrapper_WrapperManager_BACKEND_TYPE_SOCKET_V4
#define org_tanukisoftware_wrapper_WrapperManager_BACKEND_TYPE_SOCKET_V4 1L
#undef org_tanukisoftware_wrapper_WrapperManager_BACKEND_TYPE_SOCKET_V6
#define org_tanukisoftware_wrapper_WrapperManager_BACKEND_TYPE_SOCKET_V6 2L
#undef org_tanukisoftware_wrapper_WrapperManager_BACKEND_TYPE_PIPE
#define org_tanukisoftware_wrapper_WrapperManager_BACKEND_TYPE_PIPE 4L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_START
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_START 100L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_STOP
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_STOP 101L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_RESTART
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_RESTART 102L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_PING
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_PING 103L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_STOP_PENDING
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_STOP_PENDING 104L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_START_PENDING
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_START_PENDING 105L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_STARTED
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_STARTED 106L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_STOPPED
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_STOPPED 107L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_JAVA_PID
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_JAVA_PID 108L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_KEY
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_KEY 110L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_BADKEY
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_BADKEY 111L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_LOW_LOG_LEVEL
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_LOW_LOG_LEVEL 112L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_PING_TIMEOUT
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_PING_TIMEOUT 113L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_SERVICE_CONTROL_CODE
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_SERVICE_CONTROL_CODE 114L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_PROPERTIES
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_PROPERTIES 115L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_LOG
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_LOG 116L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_CHILD_LAUNCH
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_CHILD_LAUNCH -124L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_CHILD_TERM
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_CHILD_TERM -123L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_LOGFILE
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_LOGFILE -122L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_CHECK_DEADLOCK
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_CHECK_DEADLOCK -121L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_DEADLOCK
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_DEADLOCK -120L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_APPEAR_ORPHAN
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_APPEAR_ORPHAN -119L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_PAUSE
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_PAUSE -118L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_RESUME
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_RESUME -117L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_GC
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_GC -116L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_FIRE_USER_EVENT
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_FIRE_USER_EVENT -115L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_SECOND_INVOCATION_EVENT
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_SECOND_INVOCATION_EVENT -114L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_FIRE_CTRL_EVENT
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_FIRE_CTRL_EVENT -113L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_SUSPEND_TIMEOUTS
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_SUSPEND_TIMEOUTS -112L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_RESUME_TIMEOUTS
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_MSG_RESUME_TIMEOUTS -111L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_CTRL_C_EVENT
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_CTRL_C_EVENT 200L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_CTRL_CLOSE_EVENT
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_CTRL_CLOSE_EVENT 201L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_CTRL_LOGOFF_EVENT
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_CTRL_LOGOFF_EVENT 202L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_CTRL_SHUTDOWN_EVENT
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_CTRL_SHUTDOWN_EVENT 203L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_CTRL_TERM_EVENT
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_CTRL_TERM_EVENT 204L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_CTRL_HUP_EVENT
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_CTRL_HUP_EVENT 205L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_CTRL_USR1_EVENT
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_CTRL_USR1_EVENT 206L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_CTRL_USR2_EVENT
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_CTRL_USR2_EVENT 207L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_LOG_LEVEL_DEBUG
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_LOG_LEVEL_DEBUG 1L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_LOG_LEVEL_INFO
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_LOG_LEVEL_INFO 2L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_LOG_LEVEL_STATUS
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_LOG_LEVEL_STATUS 3L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_LOG_LEVEL_WARN
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_LOG_LEVEL_WARN 4L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_LOG_LEVEL_ERROR
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_LOG_LEVEL_ERROR 5L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_LOG_LEVEL_FATAL
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_LOG_LEVEL_FATAL 6L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_LOG_LEVEL_ADVICE
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_LOG_LEVEL_ADVICE 7L
#undef org_tanukisoftware_wrapper_WrapperManager_WRAPPER_LOG_LEVEL_NOTICE
#define org_tanukisoftware_wrapper_WrapperManager_WRAPPER_LOG_LEVEL_NOTICE 8L
#undef org_tanukisoftware_wrapper_WrapperManager_SERVICE_CONTROL_CODE_START
#define org_tanukisoftware_wrapper_WrapperManager_SERVICE_CONTROL_CODE_START 65536L
#undef org_tanukisoftware_wrapper_WrapperManager_SERVICE_CONTROL_CODE_STOP
#define org_tanukisoftware_wrapper_WrapperManager_SERVICE_CONTROL_CODE_STOP 1L
#undef org_tanukisoftware_wrapper_WrapperManager_SERVICE_CONTROL_CODE_PAUSE
#define org_tanukisoftware_wrapper_WrapperManager_SERVICE_CONTROL_CODE_PAUSE 2L
#undef org_tanukisoftware_wrapper_WrapperManager_SERVICE_CONTROL_CODE_CONTINUE
#define org_tanukisoftware_wrapper_WrapperManager_SERVICE_CONTROL_CODE_CONTINUE 3L
#undef org_tanukisoftware_wrapper_WrapperManager_SERVICE_CONTROL_CODE_INTERROGATE
#define org_tanukisoftware_wrapper_WrapperManager_SERVICE_CONTROL_CODE_INTERROGATE 4L
#undef org_tanukisoftware_wrapper_WrapperManager_SERVICE_CONTROL_CODE_SHUTDOWN
#define org_tanukisoftware_wrapper_WrapperManager_SERVICE_CONTROL_CODE_SHUTDOWN 5L
#undef org_tanukisoftware_wrapper_WrapperManager_SERVICE_CONTROL_CODE_POWEREVENT_QUERYSUSPEND
#define org_tanukisoftware_wrapper_WrapperManager_SERVICE_CONTROL_CODE_POWEREVENT_QUERYSUSPEND 3328L
#undef org_tanukisoftware_wrapper_WrapperManager_SERVICE_CONTROL_CODE_POWEREVENT_QUERYSUSPENDFAILED
#define org_tanukisoftware_wrapper_WrapperManager_SERVICE_CONTROL_CODE_POWEREVENT_QUERYSUSPENDFAILED 3330L
#undef org_tanukisoftware_wrapper_WrapperManager_SERVICE_CONTROL_CODE_POWEREVENT_SUSPEND
#define org_tanukisoftware_wrapper_WrapperManager_SERVICE_CONTROL_CODE_POWEREVENT_SUSPEND 3332L
#undef org_tanukisoftware_wrapper_WrapperManager_SERVICE_CONTROL_CODE_POWEREVENT_RESUMECRITICAL
#define org_tanukisoftware_wrapper_WrapperManager_SERVICE_CONTROL_CODE_POWEREVENT_RESUMECRITICAL 3334L
#undef org_tanukisoftware_wrapper_WrapperManager_SERVICE_CONTROL_CODE_POWEREVENT_RESUMESUSPEND
#define org_tanukisoftware_wrapper_WrapperManager_SERVICE_CONTROL_CODE_POWEREVENT_RESUMESUSPEND 3335L
#undef org_tanukisoftware_wrapper_WrapperManager_SERVICE_CONTROL_CODE_POWEREVENT_BATTERYLOW
#define org_tanukisoftware_wrapper_WrapperManager_SERVICE_CONTROL_CODE_POWEREVENT_BATTERYLOW 3337L
#undef org_tanukisoftware_wrapper_WrapperManager_SERVICE_CONTROL_CODE_POWEREVENT_POWERSTATUSCHANGE
#define org_tanukisoftware_wrapper_WrapperManager_SERVICE_CONTROL_CODE_POWEREVENT_POWERSTATUSCHANGE 3338L
#undef org_tanukisoftware_wrapper_WrapperManager_SERVICE_CONTROL_CODE_POWEREVENT_OEMEVENT
#define org_tanukisoftware_wrapper_WrapperManager_SERVICE_CONTROL_CODE_POWEREVENT_OEMEVENT 3339L
#undef org_tanukisoftware_wrapper_WrapperManager_SERVICE_CONTROL_CODE_POWEREVENT_RESUMEAUTOMATIC
#define org_tanukisoftware_wrapper_WrapperManager_SERVICE_CONTROL_CODE_POWEREVENT_RESUMEAUTOMATIC 3346L
/* Inaccessible static: m_out */
/* Inaccessible static: m_err */
/* Inaccessible static: m_outInfo */
/* Inaccessible static: m_outError */
/* Inaccessible static: m_outDebug */
/* Inaccessible static: m_os */
/* Inaccessible static: m_arch */
/* Inaccessible static: m_windows */
/* Inaccessible static: m_macosx */
/* Inaccessible static: m_aix */
/* Inaccessible static: m_zos */
/* Inaccessible static: m_securityManagerChecked */
/* Inaccessible static: m_disposed */
/* Inaccessible static: m_starting */
/* Inaccessible static: m_started */
/* Inaccessible static: m_instance */
/* Inaccessible static: m_hook */
/* Inaccessible static: m_hookTriggered */
/* Inaccessible static: m_hookRemoveFailed */
/* Inaccessible static: m_shutdownJVMComplete */
/* Inaccessible static: m_shutdownLockMap */
/* Inaccessible static: m_shutdownLocks */
/* Inaccessible static: m_runningExecs */
/* Inaccessible static: m_args */
/* Inaccessible static: m_backendType */
/* Inaccessible static: m_backendConnected */
/* Inaccessible static: m_backendOS */
/* Inaccessible static: m_backendIS */
/* Inaccessible static: m_port */
/* Inaccessible static: m_jvmPort */
/* Inaccessible static: m_jvmPortMin */
/* Inaccessible static: m_jvmPortMax */
/* Inaccessible static: m_wrapperPortAddress */
/* Inaccessible static: m_key */
/* Inaccessible static: m_soTimeout */
/* Inaccessible static: m_cpuTimeout */
/* Inaccessible static: m_startedTicks */
/* Inaccessible static: m_lowLogLevel */
/* Inaccessible static: m_ignoreSignals */
/* Inaccessible static: m_detachStarted */
/* Inaccessible static: m_commRunner */
/* Inaccessible static: m_commRunnerStarted */
/* Inaccessible static: m_eventRunner */
/* Inaccessible static: m_eventRunnerTicks */
/* Inaccessible static: m_startupRunner */
/* Inaccessible static: m_useSystemTime */
/* Inaccessible static: m_timerFastThreshold */
/* Inaccessible static: m_timerSlowThreshold */
/* Inaccessible static: m_disableTests */
/* Inaccessible static: m_listenerForceStop */
/* Inaccessible static: m_jvmBits */
/* Inaccessible static: m_ticks */
/* Inaccessible static: m_listener */
/* Inaccessible static: m_lastPingTicks */
/* Inaccessible static: m_backendSocket */
/* Inaccessible static: m_appearHung */
/* Inaccessible static: m_slowSeconds */
/* Inaccessible static: m_ignoreUserLogoffs */
/* Inaccessible static: m_service */
/* Inaccessible static: m_debug */
/* Inaccessible static: m_logFinalizer */
/* Inaccessible static: m_jvmId */
/* Inaccessible static: m_stoppingInit */
/* Inaccessible static: m_stopping */
/* Inaccessible static: m_stoppingThread */
/* Inaccessible static: m_stopped */
/* Inaccessible static: m_pendingStopMessage */
/* Inaccessible static: m_exitCode */
/* Inaccessible static: m_libraryOK */
/* Inaccessible static: m_libraryLoaded */
/* Inaccessible static: m_libraryVersionOk */
/* Inaccessible static: m_wrapperVersionOk */
/* Inaccessible static: m_commandBuffer */
/* Inaccessible static: m_logFile */
/* Inaccessible static: m_properties */
/* Inaccessible static: m_wrapperEventListenerMaskList */
/* Inaccessible static: m_wrapperEventListenerMasks */
/* Inaccessible static: m_produceCoreEvents */
/* Inaccessible static: m_res */
/* Inaccessible static: m_professionalEdition */
/* Inaccessible static: m_standardEdition */
/* Inaccessible static: PROPERTY_SEPARATOR */
/* Inaccessible static: m_backendReadBuffer */
/* Inaccessible static: class_00024org_00024tanukisoftware_00024wrapper_00024WrapperManager */
/* Inaccessible static: class_00024java_00024lang_00024String */
/* Inaccessible static: class_00024java_00024lang_00024Object */
/*
* Class: org_tanukisoftware_wrapper_WrapperManager
* Method: nativeInit
* Signature: (Z)V
*/
JNIEXPORT void JNICALL Java_org_tanukisoftware_wrapper_WrapperManager_nativeInit
(JNIEnv *, jclass, jboolean);
/*
* Class: org_tanukisoftware_wrapper_WrapperManager
* Method: nativeLoadWrapperProperties
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_tanukisoftware_wrapper_WrapperManager_nativeLoadWrapperProperties
(JNIEnv *, jclass);
/*
* Class: org_tanukisoftware_wrapper_WrapperManager
* Method: nativeDispose
* Signature: (Z)V
*/
JNIEXPORT void JNICALL Java_org_tanukisoftware_wrapper_WrapperManager_nativeDispose
(JNIEnv *, jclass, jboolean);
/*
* Class: org_tanukisoftware_wrapper_WrapperManager
* Method: nativeGetLibraryVersion
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_tanukisoftware_wrapper_WrapperManager_nativeGetLibraryVersion
(JNIEnv *, jclass);
/*
* Class: org_tanukisoftware_wrapper_WrapperManager
* Method: nativeGetJavaPID
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_tanukisoftware_wrapper_WrapperManager_nativeGetJavaPID
(JNIEnv *, jclass);
/*
* Class: org_tanukisoftware_wrapper_WrapperManager
* Method: nativeIsProfessionalEdition
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_tanukisoftware_wrapper_WrapperManager_nativeIsProfessionalEdition
(JNIEnv *, jclass);
/*
* Class: org_tanukisoftware_wrapper_WrapperManager
* Method: nativeIsStandardEdition
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_tanukisoftware_wrapper_WrapperManager_nativeIsStandardEdition
(JNIEnv *, jclass);
/*
* Class: org_tanukisoftware_wrapper_WrapperManager
* Method: nativeGetControlEvent
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_tanukisoftware_wrapper_WrapperManager_nativeGetControlEvent
(JNIEnv *, jclass);
/*
* Class: org_tanukisoftware_wrapper_WrapperManager
* Method: nativeRedirectPipes
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_tanukisoftware_wrapper_WrapperManager_nativeRedirectPipes
(JNIEnv *, jclass);
/*
* Class: org_tanukisoftware_wrapper_WrapperManager
* Method: nativeRequestThreadDump
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_tanukisoftware_wrapper_WrapperManager_nativeRequestThreadDump
(JNIEnv *, jclass);
/*
* Class: org_tanukisoftware_wrapper_WrapperManager
* Method: accessViolationInner
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_tanukisoftware_wrapper_WrapperManager_accessViolationInner
(JNIEnv *, jclass);
/*
* Class: org_tanukisoftware_wrapper_WrapperManager
* Method: nativeRaiseExceptionInner
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_org_tanukisoftware_wrapper_WrapperManager_nativeRaiseExceptionInner
(JNIEnv *, jclass, jint);
/*
* Class: org_tanukisoftware_wrapper_WrapperManager
* Method: nativeRaiseFailFastExceptionInner
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_tanukisoftware_wrapper_WrapperManager_nativeRaiseFailFastExceptionInner
(JNIEnv *, jclass);
/*
* Class: org_tanukisoftware_wrapper_WrapperManager
* Method: nativeSetConsoleTitle
* Signature: (Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_org_tanukisoftware_wrapper_WrapperManager_nativeSetConsoleTitle
(JNIEnv *, jclass, jstring);
/*
* Class: org_tanukisoftware_wrapper_WrapperManager
* Method: nativeGetUser
* Signature: (Z)Lorg/tanukisoftware/wrapper/WrapperUser;
*/
JNIEXPORT jobject JNICALL Java_org_tanukisoftware_wrapper_WrapperManager_nativeGetUser
(JNIEnv *, jclass, jboolean);
/*
* Class: org_tanukisoftware_wrapper_WrapperManager
* Method: nativeGetInteractiveUser
* Signature: (Z)Lorg/tanukisoftware/wrapper/WrapperUser;
*/
JNIEXPORT jobject JNICALL Java_org_tanukisoftware_wrapper_WrapperManager_nativeGetInteractiveUser
(JNIEnv *, jclass, jboolean);
/*
* Class: org_tanukisoftware_wrapper_WrapperManager
* Method: nativeListServices
* Signature: ()[Lorg/tanukisoftware/wrapper/WrapperWin32Service;
*/
JNIEXPORT jobjectArray JNICALL Java_org_tanukisoftware_wrapper_WrapperManager_nativeListServices
(JNIEnv *, jclass);
/*
* Class: org_tanukisoftware_wrapper_WrapperManager
* Method: nativeSendServiceControlCode
* Signature: (Ljava/lang/String;I)Lorg/tanukisoftware/wrapper/WrapperWin32Service;
*/
JNIEXPORT jobject JNICALL Java_org_tanukisoftware_wrapper_WrapperManager_nativeSendServiceControlCode
(JNIEnv *, jclass, jstring, jint);
/*
* Class: org_tanukisoftware_wrapper_WrapperManager
* Method: nativeExec
* Signature: ([Ljava/lang/String;Ljava/lang/String;Lorg/tanukisoftware/wrapper/WrapperProcessConfig;Z)Lorg/tanukisoftware/wrapper/WrapperProcess;
*/
JNIEXPORT jobject JNICALL Java_org_tanukisoftware_wrapper_WrapperManager_nativeExec
(JNIEnv *, jclass, jobjectArray, jstring, jobject, jboolean);
/*
* Class: org_tanukisoftware_wrapper_WrapperManager
* Method: nativeWrapperGetEnv
* Signature: (Ljava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_tanukisoftware_wrapper_WrapperManager_nativeWrapperGetEnv
(JNIEnv *, jclass, jstring);
/*
* Class: org_tanukisoftware_wrapper_WrapperManager
* Method: nativeLoadWrapperResources
* Signature: (Ljava/lang/String;Ljava/lang/String;Z)Lorg/tanukisoftware/wrapper/WrapperResources;
*/
JNIEXPORT jobject JNICALL Java_org_tanukisoftware_wrapper_WrapperManager_nativeLoadWrapperResources
(JNIEnv *, jclass, jstring, jstring, jboolean);
/*
* Class: org_tanukisoftware_wrapper_WrapperManager
* Method: nativeCheckDeadLocks
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_tanukisoftware_wrapper_WrapperManager_nativeCheckDeadLocks
(JNIEnv *, jclass);
/*
* Class: org_tanukisoftware_wrapper_WrapperManager
* Method: nativeGetPortStatus
* Signature: (ILjava/lang/String;I)I
*/
JNIEXPORT jint JNICALL Java_org_tanukisoftware_wrapper_WrapperManager_nativeGetPortStatus
(JNIEnv *, jclass, jint, jstring, jint);
/*
* Class: org_tanukisoftware_wrapper_WrapperManager
* Method: nativeGetDpiScale
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_tanukisoftware_wrapper_WrapperManager_nativeGetDpiScale
(JNIEnv *, jclass);
/*
* Class: org_tanukisoftware_wrapper_WrapperManager
* Method: nativeGetDpiAwareness
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_tanukisoftware_wrapper_WrapperManager_nativeGetDpiAwareness
(JNIEnv *, jclass);
/*
* Class: org_tanukisoftware_wrapper_WrapperManager
* Method: nativeSetDpiAwareness
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_org_tanukisoftware_wrapper_WrapperManager_nativeSetDpiAwareness
(JNIEnv *, jclass, jint);
#ifdef __cplusplus
}
#endif
#endif
wrapper_3.5.51_src/src/c/property.c 100644 0 0 307751 14333053650 14465 0 ustar 0 0 /*
* Copyright (c) 1999, 2022 Tanuki Software, Ltd.
* http://www.tanukisoftware.comment
* All rights reserved.
*
* This software is the proprietary information of Tanuki Software.
* You shall use it only in accordance with the terms of the
* license agreement you entered into with Tanuki Software.
* http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
*
*
* Portions of the Software have been derived from source code
* developed by Silver Egg Technology under the following license:
*
* Copyright (c) 2001 Silver Egg Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sub-license, and/or
* sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*/
#include
#include
#include
#include
#ifdef WIN32
#include
/* MS Visual Studio 8 went and deprecated the POXIX names for functions.
* Fixing them all would be a big headache for UNIX versions. */
#pragma warning(disable : 4996)
#else
#include
#include
#include
#include
#endif
#include "wrapper_i18n.h"
#include "logger.h"
#include "logger_file.h"
#include "property.h"
#include "wrapper.h"
#include "wrapper_file.h"
#define MAX_INCLUDE_DEPTH 10
/* The largest possible "name+'='+value" property pair length on Windows. */
#define MAX_ENV_PAIR_LEN 32767
EnvSrc *baseEnvSrc = NULL;
/** Stores the time that the property file began to be loaded. */
struct tm loadPropertiesTM;
const TCHAR **escapedPropertyNames = NULL;
void setInnerProperty(Properties *properties, Property *property, const TCHAR *propertyValue, int warnUndefinedVars);
/**
* @param warnUndefinedVars Log warnings about missing environment variables.
*/
void prepareProperty(Properties *properties, Property *property, int warnUndefinedVars) {
TCHAR *oldValue;
if (_tcsstr(property->value_inner, TEXT("%"))) {
/* Reset the property. If the unreplaced environment variables are now available
* setting it again will cause it to be replaced correctly. If not this will
* only waste time. The value will be freed in the process so we need to
* keep it around. */
#ifdef _DEBUG
_tprintf( TEXT("Unreplaced property %s=%s\n"), property->name, property->value_inner );
#endif
oldValue = malloc(sizeof(TCHAR) * (_tcslen(property->value_inner) + 1));
if (!oldValue) {
outOfMemory(TEXT("PP"), 1);
} else {
_tcsncpy(oldValue, property->value_inner, _tcslen(property->value_inner) + 1);
setInnerProperty(properties, property, oldValue, warnUndefinedVars);
free(oldValue);
}
#ifdef _DEBUG
_tprintf( TEXT(" -> property %s=%s\n"), property->name, property->value_inner );
#endif
}
}
/**
* Private function to find a Property structure.
*/
Property* getInnerProperty(Properties *properties, const TCHAR *propertyName, int warnUndefinedVars) {
Property *property;
int cmp;
/* Loop over the properties which are in order and look for the specified property. */
property = properties->first;
while (property != NULL) {
cmp = strcmpIgnoreCase(property->name, propertyName);
if (cmp > 0) {
/* This property would be after the one being looked for, so it does not exist. */
return NULL;
} else if (cmp == 0) {
/* We found it. */
prepareProperty(properties, property, warnUndefinedVars && properties->logWarnings);
return property;
}
/* Keep looking */
property = property->next;
}
/* We did not find the property being looked for. */
return NULL;
}
void addInnerProperty(Properties *properties, Property *newProperty) {
newProperty->previous = properties->last;
if (properties->last == NULL) {
/* This will be the first property. */
properties->first = newProperty;
} else {
/* Point the old last property to the new last property. */
properties->last->next = newProperty;
}
properties->last = newProperty;
newProperty->next = NULL;
}
void insertInnerProperty(Properties *properties, Property *newProperty) {
Property *property;
int cmp;
/* Loop over the properties which are in order and look for the specified property. */
/* This function assumes that Property is not already in properties. */
property = properties->first;
while (property != NULL) {
cmp = strcmpIgnoreCase(property->name, newProperty->name);
if (cmp > 0) {
/* This property would be after the new property, so insert it here. */
newProperty->previous = property->previous;
newProperty->next = property;
if (property->previous == NULL) {
/* This was the first property */
properties->first = newProperty;
} else {
property->previous->next = newProperty;
}
property->previous = newProperty;
/* We are done, so return */
return;
}
property = property->next;
}
/* The new property needs to be added at the end */
addInnerProperty(properties, newProperty);
}
Property* createInnerProperty() {
Property *property;
property = malloc(sizeof(Property));
if (!property) {
outOfMemory(TEXT("CIP"), 1);
return NULL;
}
property->name = NULL;
property->next = NULL;
property->previous = NULL;
property->value = NULL;
property->value_inner = NULL;
property->filePath = NULL;
property->lineNumber = 0;
property->definitions = 1;
property->isGenerated = FALSE;
property->isVariable = FALSE;
property->lastDefinitionDepth = -1;
return property;
}
/**
* Private function to dispose a Property structure. Assumes that the
* Property is disconnected already.
*/
void disposeInnerProperty(Property *property) {
if (property->name) {
free(property->name);
}
if (property->value) {
/* The memory may contain sensitive data or passwords and must be erased. */
wrapperSecureFreeStrW(property->value);
}
if (property->value_inner) {
/* The memory may contain sensitive data or passwords and must be erased. */
wrapperSecureFreeStrW(property->value_inner);
}
if (property->filePath) {
free(property->filePath);
}
free(property);
}
TCHAR generateValueBuffer[256];
/**
* This function returns a reference to a static buffer and is NOT thread safe.
* It is currently called only when loading a property file and when firing an event.
* Both happen in the main thread.
* The largest return value can be 15+1 characters.
*/
TCHAR* generateTimeValue(const TCHAR* format, struct tm *timeTM) {
if (strcmpIgnoreCase(format, TEXT("YYYYMMDDHHIISS")) == 0) {
_sntprintf(generateValueBuffer, 256, TEXT("%04d%02d%02d%02d%02d%02d"),
timeTM->tm_year + 1900, timeTM->tm_mon + 1, timeTM->tm_mday,
timeTM->tm_hour, timeTM->tm_min, timeTM->tm_sec );
} else if (strcmpIgnoreCase(format, TEXT("YYYYMMDD_HHIISS")) == 0) {
_sntprintf(generateValueBuffer, 256, TEXT("%04d%02d%02d_%02d%02d%02d"),
timeTM->tm_year + 1900, timeTM->tm_mon + 1, timeTM->tm_mday,
timeTM->tm_hour, timeTM->tm_min, timeTM->tm_sec );
} else if (strcmpIgnoreCase(format, TEXT("YYYYMMDDHHII")) == 0) {
_sntprintf(generateValueBuffer, 256, TEXT("%04d%02d%02d%02d%02d"),
timeTM->tm_year + 1900, timeTM->tm_mon + 1, timeTM->tm_mday,
timeTM->tm_hour, timeTM->tm_min );
} else if (strcmpIgnoreCase(format, TEXT("YYYYMMDDHH")) == 0) {
_sntprintf(generateValueBuffer, 256, TEXT("%04d%02d%02d%02d"),
timeTM->tm_year + 1900, timeTM->tm_mon + 1, timeTM->tm_mday,
timeTM->tm_hour );
} else if (strcmpIgnoreCase(format, TEXT("YYYYMMDD")) == 0) {
_sntprintf(generateValueBuffer, 256, TEXT("%04d%02d%02d"),
timeTM->tm_year + 1900, timeTM->tm_mon + 1, timeTM->tm_mday);
} else {
_sntprintf(generateValueBuffer, 256, TEXT("{INVALID}"));
}
return generateValueBuffer;
}
/**
* This function returns a reference to a static buffer and is NOT thread safe.
* It is currently called only when loading a property file and when firing an event.
* Both happen in the main thread.
* The largest return value can be 9+1 characters.
*/
TCHAR* generateRandValue(const TCHAR* format) {
if (strcmpIgnoreCase(format, TEXT("N")) == 0) {
_sntprintf(generateValueBuffer, 256, TEXT("%01d"), rand() % 10);
} else if (strcmpIgnoreCase(format, TEXT("NN")) == 0) {
_sntprintf(generateValueBuffer, 256, TEXT("%02d"), rand() % 100);
} else if (strcmpIgnoreCase(format, TEXT("NNN")) == 0) {
_sntprintf(generateValueBuffer, 256, TEXT("%03d"), rand() % 1000);
} else if (strcmpIgnoreCase(format, TEXT("NNNN")) == 0) {
_sntprintf(generateValueBuffer, 256, TEXT("%04d"), rand() % 10000);
} else if (strcmpIgnoreCase(format, TEXT("NNNNN")) == 0) {
_sntprintf(generateValueBuffer, 256, TEXT("%04d%01d"), rand() % 10000, rand() % 10);
} else if (strcmpIgnoreCase(format, TEXT("NNNNNN")) == 0) {
_sntprintf(generateValueBuffer, 256, TEXT("%04d%02d"), rand() % 10000, rand() % 100);
} else {
_sntprintf(generateValueBuffer, 256, TEXT("{INVALID}"));
}
return generateValueBuffer;
}
/**
* Parses a property value and populates any environment variables. If the expanded
* environment variable would result in a string that is longer than bufferLength
* the value is truncated.
*
* @param propertyValue The property value to be parsed.
* @param buffer output buffer where the expanded string will be copied.
* @param bufferLength size of the buffer.
* @param warnUndefinedVars Log warnings about missing environment variables.
* @param warnedUndefVarMap Map of variables which have previously been logged, may be NULL if warnUndefinedVars false.
* @param warnLogLevel Log level at which any warnings will be logged.
* @param ignoreVarMap Map of environment variables that should not be expanded.
* @param pHasPercentage Pointer to a variable which will be set to TRUE if a %WRAPPER_PERCENTAGE% variable was found.
* - If a non-NULL pointer is passed, the variable will not be expanded and no warning will be reported.
* - If NULL is passed, the variable will be expanded to '%'.
*/
void evaluateEnvironmentVariables(const TCHAR *propertyValue, TCHAR *buffer, int bufferLength, int warnUndefinedVars, PHashMap warnedUndefVarMap, int warnLogLevel, PHashMap ignoreVarMap, int *pHasPercentage) {
const TCHAR *in;
TCHAR *out;
TCHAR *envName;
TCHAR *envValue;
int envValueNeedFree;
TCHAR *start;
TCHAR *end;
size_t len;
size_t outLen;
size_t bufferAvailable;
const TCHAR* ignore;
#ifdef _DEBUG
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_STATUS, TEXT("evaluateEnvironmentVariables(properties, '%s', buffer, %d, %d)"), propertyValue, bufferLength, warnUndefinedVars);
#endif
buffer[0] = TEXT('\0');
in = propertyValue;
out = buffer;
bufferAvailable = bufferLength - 1; /* Reserver room for the null terminator */
/* Loop until we hit the end of string. */
while (in[0] != TEXT('\0')) {
#ifdef _DEBUG
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_STATUS, TEXT(" initial='%s', buffer='%s'"), propertyValue, buffer);
#endif
start = _tcschr(in, TEXT('%'));
if (start != NULL) {
end = _tcschr(start + 1, TEXT('%'));
if (end != NULL) {
/* A pair of '%' characters was found. An environment */
/* variable name should be between the two. */
len = (int)(end - start - 1);
envName = malloc(sizeof(TCHAR) * (len + 1));
if (envName == NULL) {
outOfMemory(TEXT("EEV"), 1);
return;
}
_tcsncpy(envName, start + 1, len);
envName[len] = TEXT('\0');
/* See if it is a special dynamic environment variable */
envValueNeedFree = FALSE;
if (_tcsstr(envName, TEXT("WRAPPER_TIME_")) == envName) {
/* Found a time value. */
envValue = generateTimeValue(envName + 13, &loadPropertiesTM);
} else if (_tcsstr(envName, TEXT("WRAPPER_RAND_")) == envName) {
/* Found a time value. */
envValue = generateRandValue(envName + 13);
} else if (_tcsstr(envName, TEXT("WRAPPER_PERCENTAGE")) == envName) {
envValue = NULL;
if (pHasPercentage) {
/* Do not warn about this variable. Do not expand it. We will expand it later. */
hashMapPutKWVW(warnedUndefVarMap, envName, envName);
*pHasPercentage = TRUE;
} else {
envValue = TEXT("%");
}
} else {
if (ignoreVarMap) {
/* Can return NULL if missing or "TRUE" or "FALSE". */
ignore = hashMapGetKWVW(ignoreVarMap, envName);
} else {
ignore = NULL;
}
if (!ignore || strcmpIgnoreCase(ignore, TEXT("TRUE")) != 0) {
/* Try looking up the environment variable. */
envValue = _tgetenv(envName);
#if !defined(WIN32) && defined(UNICODE)
envValueNeedFree = TRUE;
#endif
} else {
envValue = NULL;
envValueNeedFree = FALSE;
}
}
if (envValue != NULL) {
/* An envvar value was found. */
/* Copy over any text before the envvar */
outLen = (int)(start - in);
if (bufferAvailable < outLen) {
outLen = bufferAvailable;
}
if (outLen > 0) {
_tcsncpy(out, in, outLen);
out += outLen;
bufferAvailable -= outLen;
}
/* Copy over the env value */
outLen = _tcslen(envValue);
if (bufferAvailable < outLen) {
outLen = bufferAvailable;
}
if (outLen > 0) {
_tcsncpy(out, envValue, outLen);
out += outLen;
bufferAvailable -= outLen;
}
if (envValueNeedFree) {
free(envValue);
}
/* Terminate the string */
out[0] = TEXT('\0');
/* Set the new in pointer */
in = end + 1;
} else {
/* Not found. So copy over the input up until the */
/* second '%'. Leave it in case it is actually the */
/* start of an environment variable name */
outLen = len = end - in + 1;
if (bufferAvailable < outLen) {
outLen = bufferAvailable;
}
if (outLen > 0) {
_tcsncpy(out, in, outLen);
out += outLen;
bufferAvailable -= outLen;
}
in += len;
/* Terminate the string */
out[0] = TEXT('\0');
if (warnUndefinedVars) {
if (hashMapGetKWVW(warnedUndefVarMap, envName) == NULL) {
/* This is the first time this environment variable was noticed, so report it to the user then remember so we don't report it again. */
log_printf(WRAPPER_SOURCE_WRAPPER, warnLogLevel, TEXT("The '%s' environment variable was referenced but has not been defined."), envName);
hashMapPutKWVW(warnedUndefVarMap, envName, envName);
}
}
}
free(envName);
} else {
/* Only a single '%' TCHAR was found. Leave it as is. */
outLen = len = _tcslen(in);
if (bufferAvailable < outLen) {
outLen = bufferAvailable;
}
if (outLen > 0) {
_tcsncpy(out, in, outLen);
out += outLen;
bufferAvailable -= outLen;
}
in += len;
/* Terminate the string */
out[0] = TEXT('\0');
}
} else {
/* No more '%' chars in the string. Copy over the rest. */
outLen = len = _tcslen(in);
if (bufferAvailable < outLen) {
outLen = bufferAvailable;
}
if (outLen > 0) {
_tcsncpy(out, in, outLen);
out += outLen;
bufferAvailable -= outLen;
}
in += len;
/* Terminate the string */
out[0] = TEXT('\0');
}
}
#ifdef _DEBUG
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_STATUS, TEXT(" final buffer='%s'"), buffer);
#endif
}
/**
*
* @param warnUndefinedVars Log warnings about missing environment variables.
*/
void setInnerProperty(Properties *properties, Property *property, const TCHAR *propertyValue, int warnUndefinedVars) {
int i, count;
/* The property value is expanded into a large buffer once, but that is temporary. The actual
* value is stored in the minimum required size. */
TCHAR *buffer;
int hasPercentage = FALSE;
/* Free any existing value */
if (property->value != NULL) {
free(property->value);
property->value = NULL;
}
if (property->value_inner != NULL) {
free(property->value_inner);
property->value_inner = NULL;
}
/* Set the new value using a copy of the provided value. */
if (propertyValue != NULL) {
buffer = malloc(MAX_PROPERTY_VALUE_LENGTH * sizeof(TCHAR));
if (buffer) {
evaluateEnvironmentVariables(propertyValue, buffer, MAX_PROPERTY_VALUE_LENGTH, warnUndefinedVars, properties->warnedVarMap, properties->logWarningLogLevel, properties->ignoreVarMap, &hasPercentage);
/* We need to keep a copy of the value without expanding %WRAPPER_PERCENTAGE% (see the function description of evaluateEnvironmentVariables()) */
property->value_inner = malloc(sizeof(TCHAR) * (_tcslen(buffer) + 1));
if (!property->value_inner) {
outOfMemoryQueued(TEXT("SIP"), 1);
} else {
/* Strip any non valid characters like control characters. Some valid characters are
* less than 0 when the TCHAR is unsigned. */
for (i = 0, count = 0; i < (int)_tcslen(buffer); i++) {
/* Only add valid characters, skipping any control characters EXCEPT for a line feed. */
if ((buffer[i] == TEXT('\n')) || (!_istcntrl(buffer[i]))) {
property->value_inner[count++] = buffer[i];
}
}
/* Crop string to new size */
property->value_inner[count] = TEXT('\0');
if (hasPercentage) {
/* Now expand the percentages */
evaluateEnvironmentVariables(property->value_inner, buffer, MAX_PROPERTY_VALUE_LENGTH, warnUndefinedVars, properties->warnedVarMap, properties->logWarningLogLevel, properties->ignoreVarMap, NULL);
property->value = malloc(sizeof(TCHAR) * (_tcslen(buffer) + 1));
if (!property->value) {
outOfMemoryQueued(TEXT("SIP"), 2);
} else {
_tcsncpy(property->value, buffer, _tcslen(buffer) + 1);
}
}
if (!property->value) {
property->value = malloc(sizeof(TCHAR) * (_tcslen(property->value_inner) + 1));
if (!property->value) {
outOfMemoryQueued(TEXT("SIP"), 3);
} else {
_tcsncpy(property->value, property->value_inner, _tcslen(property->value_inner) + 1);
}
}
}
free(buffer);
} else {
outOfMemoryQueued(TEXT("SIP"), 4);
}
}
}
/**
* Check if the given buffer matches the syntax of a property (to be used before actually creating the property).
* The buffer should contain a '=' and the name on its left should not contain any space once it has been trimmed.
* A null termination character will be inserted before the first '=' in the line.
*
* @param buffer The full line to be checked.
*
* @return a pointer to the string representation of the value (i.e the part of the buffer after the '=')
* or NULL if the line did not match the syntax of a property.
*/
static TCHAR* checkPropertySyntax(TCHAR* buffer) {
TCHAR *keyTrim;
TCHAR *d;
/* The buffer should contain a '='. */
if ((d = _tcschr(buffer, TEXT('='))) != NULL) {
*d = TEXT('\0');
d++;
keyTrim = malloc(sizeof(TCHAR) * (_tcslen(buffer) + 1));
if (!keyTrim) {
outOfMemory(TEXT("CPS"), 1);
return NULL;
}
trim(buffer, keyTrim);
/* The trimmed key should not contain any space. */
if (_tcschr(keyTrim, TEXT(' ')) == NULL) {
free(keyTrim);
return d;
}
free(keyTrim);
}
return NULL;
}
static int loadPropertiesCallback(void *callbackParam, const TCHAR *fileName, int lineNumber, int depth, TCHAR *config, int exitOnOverwrite, int logLevelOnOverwrite) {
Properties *properties = (Properties *)callbackParam;
TCHAR *d;
properties->exitOnOverwrite = exitOnOverwrite;
properties->logLevelOnOverwrite = logLevelOnOverwrite;
/* special case where the callback should only update the properties structure */
if ((fileName == NULL) && (lineNumber == -1) && (config == NULL)) {
return TRUE;
}
if (_tcsstr(config, TEXT("include")) == config) {
/* Users sometimes remove the '#' from include statements.
Add a warning to help them notice the problem. */
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_ADVICE,
TEXT("Include file reference missing leading '#': %s"), config);
} else if ((d = checkPropertySyntax(config))) {
addProperty(properties, fileName, lineNumber, depth, config, d, FALSE, FALSE, TRUE, FALSE);
}
return TRUE;
}
/**
* Create a Properties structure loaded in from the specified file.
* Must call disposeProperties to free up allocated memory.
*
* @param properties Properties structure to load into.
* @param filename File to load the properties from.
* @param preload TRUE if this is a preload call that should have supressed error output.
* @param originalWorkingDir Working directory of the binary at the moment it was launched.
* @param fileRequired TRUE if the file specified by filename is required, FALSE if a missing
* file will silently fail.
* @param readFilterCallback Pointer to a callback funtion which will be used to filter some
* lines that should not be processed.
*
* @return CONFIG_FILE_READER_SUCCESS if the file was read successfully,
* CONFIG_FILE_READER_OPEN_FAIL if the file could not be found or opened.
* CONFIG_FILE_READER_FAIL if there were any problems at all, or
* CONFIG_FILE_READER_HARD_FAIL if the problem should cascaded all the way up.
*/
int loadProperties(Properties *properties,
const TCHAR* filename,
int preload,
const TCHAR *originalWorkingDir,
int fileRequired,
ConfigFileReader_ReadFilterCallbackMB readFilterCallback) {
/* Store the time that the property file began to be loaded. */
#ifdef WIN32
struct _timeb timebNow;
#else
struct timeval timevalNow;
#endif
time_t now;
struct tm *nowTM;
#ifdef WIN32
_ftime(&timebNow);
now = (time_t)timebNow.time;
#else
gettimeofday(&timevalNow, NULL);
now = (time_t)timevalNow.tv_sec;
#endif
nowTM = localtime(&now);
memcpy(&loadPropertiesTM, nowTM, sizeof(struct tm));
return configFileReader(filename, fileRequired, loadPropertiesCallback, properties, readFilterCallback, TRUE, preload, originalWorkingDir, properties->warnedVarMap, properties->ignoreVarMap, properties->logWarnings, properties->logWarningLogLevel);
}
/**
* Get the log level of the messages reported when properties are overwritten.
*
* @param properties
*
* @return log level, or -1 if AUTO
*/
int GetLogLevelOnOverwrite(Properties *properties) {
/* Should be at least LEVEL_FATAL if exitOnOverwrite is set to TRUE */
if (properties) {
if (properties->exitOnOverwrite) {
return __max(properties->logLevelOnOverwrite, LEVEL_FATAL);
}
return properties->logLevelOnOverwrite;
}
return LEVEL_UNKNOWN;
}
Properties* createProperties(int debug, int logLevelOnOverwrite, int exitOnOverwrite) {
Properties *properties = malloc(sizeof(Properties));
if (!properties) {
outOfMemory(TEXT("CP"), 1);
return NULL;
}
properties->debugProperties = debug;
properties->exitOnOverwrite = exitOnOverwrite;
properties->logLevelOnOverwrite = logLevelOnOverwrite;
properties->overwrittenPropertyCausedExit = FALSE;
properties->logWarnings = TRUE;
properties->logWarningLogLevel = LEVEL_WARN;
properties->first = NULL;
properties->last = NULL;
properties->warnedVarMap = newHashMap(8);
properties->ignoreVarMap = newHashMap(8);
properties->dumpFormat = NULL;
if ((!properties->warnedVarMap) || (!properties->ignoreVarMap)) {
outOfMemory(TEXT("CP"), 2);
disposeProperties(properties);
return NULL;
}
return properties;
}
void disposeProperties(Properties *properties) {
/* Loop and dispose any Property structures */
Property *tempProperty;
Property *property;
if (properties) {
property = properties->first;
properties->first = NULL;
properties->last = NULL;
while (property != NULL) {
/* Save the next property */
tempProperty = property->next;
/* Clean up the current property */
disposeInnerProperty(property);
property = NULL;
/* set the current property to the next. */
property = tempProperty;
}
if (properties->dumpFormat) {
free(properties->dumpFormat);
}
if (properties->warnedVarMap) {
freeHashMap(properties->warnedVarMap);
}
if (properties->ignoreVarMap) {
freeHashMap(properties->ignoreVarMap);
}
/* Dispose the Properties structure */
free(properties);
properties = NULL;
}
}
/**
* This method cleans the environment at shutdown.
*/
void disposeEnvironment() {
EnvSrc *current, *previous;
if (baseEnvSrc) {
current = baseEnvSrc;
while (current != NULL) {
free(current->name);
previous = current;
current = current->next;
free(previous);
}
baseEnvSrc = NULL;
}
}
void disconnectProperty(Properties *properties, Property *property) {
Property *next;
Property *previous;
next = property->next;
previous = property->previous;
if (next == NULL) {
/* This was the last property */
properties->last = previous;
} else {
next->previous = property->previous;
}
if (previous == NULL) {
/* This was the first property */
properties->first = next;
} else {
previous->next = property->next;
}
}
/**
* Remove a single Property from a Properties. All associated memory is
* freed up.
*
* @return TRUE if the property was found, FALSE otherwise.
*/
int removeProperty(Properties *properties, const TCHAR *propertyName) {
Property *property;
/* Look up the property */
property = getInnerProperty(properties, propertyName, FALSE);
if (property == NULL) {
/* The property did not exist, so nothing to do. */
} else {
/* Disconnect the property */
disconnectProperty(properties, property);
/* Now that property is disconnected, if can be disposed. */
disposeInnerProperty(property);
return TRUE;
}
return FALSE;
}
/**
* Sets an environment variable with the specified value.
* The function will only set the variable if its value is changed, but if
* it does, the call will result in a memory leak the size of the string:
* "name=value".
*
* For Windows, the putenv_s funcion looks better, but it is not available
* on some older SDKs and non-pro versions of XP.
*
* @param name Name of the variable being set.
* @param value Value to be set, NULL to clear it.
*
* Return TRUE if there were any problems, FALSE otherwise.
*/
int setEnvInner(const TCHAR *name, const TCHAR *value) {
int result = FALSE;
TCHAR *oldVal;
#ifdef WIN32
#if !defined(WRAPPER_USE_PUTENV_S)
size_t len;
TCHAR *envBuf;
#endif
#endif
#if defined(WRAPPER_USE_PUTENV)
size_t len;
TCHAR *envBuf;
#endif
/* Get the current environment variable value so we can avoid allocating and
* setting the variable if it has not changed its value. */
#ifdef _DEBUG
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_STATUS, TEXT("setEnvInner '%s=%s'."), name, value);
#endif
oldVal = _tgetenv(name);
if (value == NULL) {
/*_tprintf("clear %s=\n", name);*/
/* Only clear the variable if it is actually set to avoid unnecessary leaks. */
if (oldVal != NULL) {
#ifdef _DEBUG
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_STATUS, TEXT("setEnvInner (CLEAR) '%s=%s'."), name, value);
#endif
#ifdef WIN32
#if defined(WRAPPER_USE_PUTENV_S)
if (_tputenv_s(name, TEXT("")) == EINVAL) {
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_FATAL, TEXT("Unable to clear the '%s' environment variable."), name);
result = TRUE;
}
#else
len = _tcslen(name) + 1 + 1;
envBuf = malloc(sizeof(TCHAR) * len);
if (!envBuf) {
outOfMemory(TEXT("SEI"), 1);
result = TRUE;
} else {
_sntprintf(envBuf, len, TEXT("%s="), name);
/* The memory pointed to by envBuf should only be freed if this is UNICODE. */
if (_tputenv(envBuf)) {
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_FATAL, TEXT("Unable to clear the '%s' environment variable."), name);
result = TRUE;
}
}
#endif
#else
#if defined(WRAPPER_USE_PUTENV)
len = _tcslen(name) + 1 + 1;
envBuf = malloc(sizeof(TCHAR) * len);
if (!envBuf) {
outOfMemory(TEXT("SEI"), 1);
result = TRUE;
} else {
_sntprintf(envBuf, len, TEXT("%s="), name);
/* The memory pointed to by envBuf should only be freed if this is UNICODE. */
if (_tputenv(envBuf)) {
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_FATAL, TEXT("Unable to clear the '%s' environment variable."), name);
result = TRUE;
}
#ifdef UNICODE
free(envBuf);
#endif
}
#else
_tunsetenv(name);
#endif
#endif
}
} else {
/*_tprintf("set %s=%s\n", name, value);*/
if ((oldVal == NULL) || (_tcscmp(oldVal, value) != 0)) {
#ifdef _DEBUG
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_STATUS, TEXT("setEnvInner (SET) '%s=%s'."), name, value);
#endif
#ifdef WIN32
#if defined(WRAPPER_USE_PUTENV_S)
if (_tputenv_s(name, value) == EINVAL) {
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_FATAL, TEXT("Unable to set the '%s' environment variable to: %s"), name, value);
result = TRUE;
}
#else
len = _tcslen(name) + 1 + _tcslen(value) + 1;
if (len > MAX_ENV_PAIR_LEN) {
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_FATAL, TEXT("Unable to set the '%s' environment variable because total pair length of %d is longer than maximum for the OS of %d."), name, len, MAX_ENV_PAIR_LEN);
result = TRUE;
} else {
envBuf = malloc(sizeof(TCHAR) * len);
if (!envBuf) {
outOfMemory(TEXT("SEI"), 2);
result = TRUE;
} else {
_sntprintf(envBuf, len, TEXT("%s=%s"), name, value);
/* The memory pointed to by envBuf should only be freed if this is UNICODE. */
if (_tputenv(envBuf)) {
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_FATAL, TEXT("Unable to set environment variable: %s=%s"), name, value);
result = TRUE;
}
}
}
#endif
#else
#if defined(WRAPPER_USE_PUTENV)
len = _tcslen(name) + 1 + _tcslen(value) + 1;
envBuf = malloc(sizeof(TCHAR) * len);
if (!envBuf) {
outOfMemory(TEXT("SEI"), 2);
result = TRUE;
} else {
_sntprintf(envBuf, len, TEXT("%s=%s"), name, value);
/* The memory pointed to by envBuf should only be freed if this is UNICODE. */
if (_tputenv(envBuf)) {
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_FATAL, TEXT("Unable to set the '%s' environment variable to: %s"), name, value);
result = TRUE;
}
#ifdef UNICODE
free(envBuf);
#endif
}
#else
if (_tsetenv(name, value, TRUE)) {
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_FATAL, TEXT("Unable to set the '%s' environment variable to: %s"), name, value);
result = TRUE;
}
#endif
#endif
}
}
#if !defined(WIN32) && defined(UNICODE)
if (oldVal != NULL) {
free(oldVal);
}
#endif
return result;
}
/**
* Sets an environment variable with the specified value.
* The function will only set the variable if its value is changed, but if
* it does, the call will result in a memory leak the size of the string:
* "name=value".
*
* @param name Name of the variable being set.
* @param value Value to be set, NULL to clear it.
* @param source Where the variable came from.
* Must be one of ENV_SOURCE_PARENT, ENV_SOURCE_APPLICATION, ENV_SOURCE_CONFIG,
* or ENV_SOURCE_REG_SYSTEM or ENV_SOURCE_REG_ACCOUNT on Windows.
* If value is ENV_SOURCE_PARENT then the value may be NULL and will never be
* set to the environment.
*
* Return TRUE if there were any problems, FALSE otherwise.
*/
int setEnv(const TCHAR *name, const TCHAR *value, int source) {
EnvSrc **thisEnvSrcRef;
EnvSrc *thisEnvSrc;
size_t len;
TCHAR *nameCopy;
EnvSrc *newEnvSrc;
int cmpRes;
#ifdef _DEBUG
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_STATUS, TEXT("setEnv(%s, %s, %d)"), name, value, source);
#endif
thisEnvSrcRef = &baseEnvSrc;
thisEnvSrc = baseEnvSrc;
/* Create a copy of the name so we can store it. */
len = _tcslen(name) + 1;
nameCopy = malloc(sizeof(TCHAR) * len);
if (!nameCopy) {
outOfMemory(TEXT("SE"), 1);
return TRUE;
}
_sntprintf(nameCopy, len, TEXT("%s"), name);
/* Figure out where we want to set the value. */
while (thisEnvSrc) {
cmpRes = strcmpIgnoreCase(thisEnvSrc->name, name);
if (cmpRes == 0) {
/* This is the same value. It is being changed. */
/* The nameCopy is not needed so free it up. */
free(nameCopy);
thisEnvSrc->source |= source;
if (source != ENV_SOURCE_PARENT) {
return setEnvInner(name, value);
}
return FALSE;
} else if (cmpRes > 0) {
/* This EnvSrc would be after the one being set, so we need to insert it. */
newEnvSrc = malloc(sizeof(EnvSrc));
if (!newEnvSrc) {
outOfMemory(TEXT("SEV"), 2);
return TRUE;
}
newEnvSrc->source = source;
newEnvSrc->name = nameCopy;
newEnvSrc->next = thisEnvSrc;
*thisEnvSrcRef = newEnvSrc;
if (source != ENV_SOURCE_PARENT) {
return setEnvInner(name, value);
}
return FALSE;
} else {
/* This EnvSrc would be before the one being set, so keep looking. */
thisEnvSrcRef = &(thisEnvSrc->next);
thisEnvSrc = thisEnvSrc->next;
}
}
/* If we get here then we are at the end of the list. */
thisEnvSrc = malloc(sizeof(EnvSrc));
if (!thisEnvSrc) {
outOfMemory(TEXT("SEV"), 3);
return TRUE;
}
thisEnvSrc->source = source;
thisEnvSrc->name = nameCopy;
thisEnvSrc->next = NULL;
*thisEnvSrcRef = thisEnvSrc;
if (source != ENV_SOURCE_PARENT) {
return setEnvInner(name, value);
}
return FALSE;
}
/**
* Used to set a NULL terminated list of property names whose values should be
* escaped when read in from a file. '\\' will become '\' and '\n' will
* become '^J', all other characters following '\' will be left as is.
*
* @param propertyNames NULL terminated list of property names. Property names
* can contain a single '*' wildcard which will match 0 or
* more characters.
*/
void setEscapedProperties(const TCHAR **propertyNames) {
escapedPropertyNames = propertyNames;
}
/**
* Returns true if the specified property matches one of the property names
* previously set in a call to setEscapedProperties()
*
* @param propertyName Property name to test.
*
* @return TRUE if the property should be escaped. FALSE otherwise.
*/
int isEscapedProperty(const TCHAR *propertyName) {
size_t nameLen;
size_t i;
const TCHAR *pattern;
TCHAR *wildPos;
size_t headLen;
size_t tailLen;
int matched;
size_t patternI;
size_t nameI;
if (escapedPropertyNames) {
nameLen = _tcslen(propertyName);
i = 0;
while (escapedPropertyNames[i]) {
pattern = escapedPropertyNames[i];
if (strcmpIgnoreCase(pattern, propertyName) == 0) {
/* Direct Match. */
#ifdef _DEBUG
_tprintf(TEXT("Property %s matched pattern %s\n"), propertyName, pattern);
#endif
return TRUE;
} else {
wildPos = _tcschr(pattern, TEXT('*'));
if (wildPos) {
/* The string contains a wildcard. */
/* Try to match the head of the property name. */
headLen = wildPos - pattern;
if (headLen < nameLen) {
matched = TRUE;
patternI = 0;
nameI = 0;
while (patternI < headLen) {
if (pattern[patternI] != propertyName[nameI]) {
matched = FALSE;
break;
}
patternI++;
nameI++;
}
if (matched) {
tailLen = _tcslen(pattern) - headLen - 1;
if (tailLen < nameLen - headLen) {
matched = TRUE;
patternI = headLen + 1;
nameI = nameLen - tailLen;
while (nameI < nameLen) {
if (pattern[patternI] != propertyName[nameI]) {
matched = FALSE;
break;
}
patternI++;
nameI++;
}
if (matched) {
#ifdef _DEBUG
_tprintf(TEXT("Property %s matched pattern %s\n"), propertyName, pattern);
#endif
return TRUE;
}
}
}
}
}
}
i++;
}
}
return FALSE;
}
/**
* Expands escaped characters and returns a newly malloced string with the result.
* '\n' replaced with '^J'
* '\\' replaced with '\'
* Other escaped characters will show as is.
*
* @param buffer Original buffer containing escaped characters.
*
* @return The new expanded buffer. It is the responsibility of the caller to free memory later.
*/
TCHAR *expandEscapedCharacters(const TCHAR* buffer) {
size_t inPos;
size_t outPos;
TCHAR *outBuffer;
int i;
TCHAR c1, c2;
/* First count the length of the required output buffer to hold the current line. Use the same code twice to avoid maintenance problems. */
outBuffer = NULL;
for (i = 0; i < 2; i++) {
inPos = 0;
outPos = 0;
do {
c1 = buffer[inPos];
/* The real backslash is #92. The yen mark from files loaded from ShiftJIS is #165. */
if ((c1 == TEXT('\\')) || (c1 == 165)) {
/* Escape. */
c2 = buffer[inPos + 1];
if (c2 == TEXT('n')) {
/* Line feed. */
inPos++;
if (outBuffer) {
outBuffer[outPos] = TEXT('\n');
}
outPos++;
} else if ((c2 == TEXT('\\')) || (c2 == 165)) {
/* Back slash. */
inPos++;
if (outBuffer) {
outBuffer[outPos] = c1;
}
outPos++;
} else if (c2 == 0) {
/* Premature End of buffer. Show the backslash. */
if (outBuffer) {
outBuffer[outPos] = c1;
}
outPos++;
c1 = 0;
} else {
/* Unknown char, show the unescaped backslash. */
inPos++;
if (outBuffer) {
outBuffer[outPos] = c1;
outBuffer[outPos + 1] = c2;
}
outPos += 2;
}
inPos++;
} else if (c1 == 0) {
/* End of buffer. */
} else {
/* Normal character. */
if (outBuffer) {
outBuffer[outPos] = c1;
}
outPos++;
inPos++;
}
} while (c1 != 0);
/* string terminator. */
if (outBuffer) {
outBuffer[outPos] = TEXT('\0');
}
outPos++;
if (outBuffer) {
/* We have have full outBuffer. Fall through. */
} else {
/* First pass. We need to allocate the outBuffer. */
outBuffer = malloc(outPos * sizeof(TCHAR));
if (!outBuffer) {
outOfMemory(TEXT("ELF"), 1);
return NULL;
}
}
}
return outBuffer;
}
/**
* Return TRUE if the value of the property should be displayed as '' when printed in the logs.
*
* @property property to check.
*
* @return TRUE if the value should be hidden.
*/
int isSecretValue(Property *property) {
TCHAR* propName;
int result = TRUE;
propName = toLower(property->name);
if (propName) {
result = (_tcsstr(propName, TEXT(".password")) == (propName + ((int)_tcslen(propName) - 9)));
free(propName);
}
return result;
}
/**
* Allocate a string which is used to display the value of a property in the logs.
*
* @value property value.
* @hidden whether the value should be hidden or not.
*
* @return the allocated value. Should be freed by the caller.
*/
TCHAR* getDisplayValue(const TCHAR *value, int hidden) {
int i, j;
TCHAR* buffer;
size_t len;
/* We need to malloc the buffer! Before, the buffer was received as an argument, but its big
* size caused the stack to overflow on certain platforms (I experienced this on HPUX-IA).
* I could have used static variables to force creating the buffers on the heap, but they
* would remain in memory all the time the Wrapper is running. */
if (hidden) {
buffer = malloc(sizeof(TCHAR) * 9);
if (!buffer) {
outOfMemory(TEXT("GDV"), 1);
return NULL;
}
_tcsncpy(buffer, TEXT(""), 9);
} else {
/* Count all newlines if any. */
for(i = 0, j = 0; i < (int)_tcslen(value); i++) {
if ((value)[i] == TEXT('\n')) {
j++;
}
}
len = _tcslen(value) + j + 1;
buffer = malloc(sizeof(TCHAR) * len);
if (!buffer) {
outOfMemory(TEXT("GDV"), 2);
return NULL;
}
if (j > 0) {
/* Replace all newlines with '\n'. */
for(i = 0, j = 0; i < (int)_tcslen(value) + 1; i++) {
if ((value)[i] == TEXT('\n')) {
buffer[j++] = TEXT('\\');
buffer[j++] = TEXT('n');
} else {
buffer[j++] = value[i];
}
}
} else {
_tcsncpy(buffer, value, len);
}
}
return buffer;
}
/**
* Adds a single property to the properties structure.
*
* @param properties Properties structure to add to.
* @param filename Name of the file from which the property was loaded. NULL, if not from a file.
* @param lineNum Line number of the property declaration in the file. Ignored if filename is NULL.
* @param depth Depth of the configuration file where the property was declared. Ignored if filename is NULL.
* @param propertyName Name of the new Property.
* @param propertyValue Initial property value.
* @param finalValue TRUE if the property should be set as static.
* @param quotable TRUE if the property could contain quotes.
* @param escapable TRUE if the propertyValue can be escaped if its propertyName
* is in the list set with setEscapedProperties().
* @param internal TRUE if the property is a Wrapper internal property.
*
* @return The newly created Property, or NULL if there was a reported error.
*/
Property* addProperty(Properties *properties, const TCHAR* filename, int lineNum, int depth, const TCHAR *propertyName, const TCHAR *propertyValue, int finalValue, int quotable, int escapable, int internal) {
int setValue;
Property *property;
TCHAR *oldVal;
TCHAR *propertyNameTrim;
const TCHAR *propertyValueNotNull;
TCHAR *propertyValueTrim;
TCHAR *propertyExpandedValue;
int logLevelOnOverwrite;
int hidden;
TCHAR *dispValue1;
TCHAR *dispValue2;
int overwriteWarnId;
int isShownAsInternal;
propertyValueNotNull = propertyValue ? propertyValue : TEXT("");
#ifdef _DEBUG
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_STATUS, TEXT("addProperty(properties, %s, '%s', '%s', %d, %d, %d, %d)"),
(filename ? filename : TEXT("")), propertyName, propertyValue, finalValue, quotable, escapable, internal);
#endif
/* It is possible that the propertyName and or properyValue contains extra spaces. */
propertyNameTrim = malloc(sizeof(TCHAR) * (_tcslen(propertyName) + 1));
if (!propertyNameTrim) {
outOfMemory(TEXT("AP"), 1);
return NULL;
}
trim(propertyName, propertyNameTrim);
propertyValueTrim = malloc(sizeof(TCHAR) * ( _tcslen(propertyValueNotNull) + 1));
if (!propertyValueTrim) {
outOfMemory(TEXT("AP"), 2);
free(propertyNameTrim);
return NULL;
}
trim(propertyValueNotNull, propertyValueTrim);
#ifdef _DEBUG
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_STATUS, TEXT(" trimmed name='%s', value='%s'"),
propertyNameTrim, propertyValueTrim);
#endif
/* See if the property already exists */
setValue = TRUE;
property = getInnerProperty(properties, propertyNameTrim, FALSE);
if (property == NULL) {
/* This is a new property */
property = createInnerProperty();
if (!property) {
free(propertyNameTrim);
free(propertyValueTrim);
return NULL;
}
/* Store a copy of the name */
property->name = malloc(sizeof(TCHAR) * (_tcslen(propertyNameTrim) + 1));
if (!property->name) {
outOfMemory(TEXT("AP"), 3);
disposeInnerProperty(property);
free(propertyNameTrim);
free(propertyValueTrim);
return NULL;
}
_tcsncpy(property->name, propertyNameTrim, _tcslen(propertyNameTrim) + 1);
/* Insert this property at the correct location. Value will still be null. */
insertInnerProperty(properties, property);
} else {
/* The property was already set. Only change it if non final and non internal */
if (property->finalValue || (property->internal && !internal)) {
setValue = FALSE;
}
property->definitions++;
/* On preload we set properties->debugProperties to false as we don't want to log anything nor to stop the Wrapper at this stage. */
if (properties->debugProperties) {
/* Preload was already done so the logging system is ready. */
logLevelOnOverwrite = GetLogLevelOnOverwrite(properties);
isShownAsInternal = property->internal;
if (logLevelOnOverwrite == -1) {
/* Log level on overwrite is AUTO. */
if (((property->lastDefinitionDepth >= depth) && (!property->finalValue)) || /* if the new property is referenced in a file with a lower inclusion depth and not overriding a command property. */
(finalValue && (!setValue)) || /* if the new property is a command property that can't be set. */
(isShownAsInternal && (!internal))) { /* if there is any attempt to override an internal property. */
logLevelOnOverwrite = LEVEL_WARN;
} else {
logLevelOnOverwrite = LEVEL_DEBUG;
}
}
if (property->isVariable) {
if (internal) {
/* Never show a warning when the property is overriden internally. */
logLevelOnOverwrite = LEVEL_NONE;
} else if (property->internal && (logLevelOnOverwrite < LEVEL_WARN)) {
/* Always show a warning when the user is overriding an internal variable. */
logLevelOnOverwrite = LEVEL_WARN;
}
}
if ((getLowLogLevel() <= logLevelOnOverwrite) && (logLevelOnOverwrite != LEVEL_NONE)) {
overwriteWarnId = 0;
/* From version 3.5.27, the Wrapper will also log messages if the command line contains duplicated properties or attempts to set an internal environment variable. */
if (finalValue) {
if (isShownAsInternal) {
overwriteWarnId = 1;
} else if (property->finalValue) {
overwriteWarnId = 2;
}
} else {
if (isShownAsInternal) {
overwriteWarnId = 4;
} else if (property->finalValue) {
overwriteWarnId = 5;
} else {
overwriteWarnId = 6;
}
}
if (overwriteWarnId > 0) {
hidden = isSecretValue(property);
dispValue1 = getDisplayValue(property->value, hidden);
if (!dispValue1) {
free(propertyNameTrim);
free(propertyValueTrim);
return NULL;
}
dispValue2 = getDisplayValue(propertyValueTrim, hidden);
if (!dispValue2) {
free(dispValue1);
free(propertyNameTrim);
free(propertyValueTrim);
return NULL;
}
switch (overwriteWarnId) {
case 1:
log_printf(WRAPPER_SOURCE_WRAPPER, logLevelOnOverwrite,
TEXT("The \"%s\" property is defined by the Wrapper internally and can not be overwritten.\n Ignoring redefinition on the Wrapper command line.\n Fixed Value %s=%s\n Ignored Value %s=%s"),
propertyNameTrim, propertyNameTrim, dispValue1, propertyNameTrim, dispValue2);
break;
case 2:
log_printf(WRAPPER_SOURCE_WRAPPER, logLevelOnOverwrite,
TEXT("The \"%s\" property was already defined on the Wrapper command line and can not be overwritten.\n Ignoring redefinition on the Wrapper command line.\n Fixed Value %s=%s\n Ignored Value %s=%s"),
propertyNameTrim, propertyNameTrim, dispValue1, propertyNameTrim, dispValue2);
break;
case 4:
log_printf(WRAPPER_SOURCE_WRAPPER, logLevelOnOverwrite,
TEXT("The \"%s\" property is defined by the Wrapper internally and can not be overwritten.\n Ignoring redefinition on line #%d of configuration file: %s\n Fixed Value %s=%s\n Ignored Value %s=%s"),
propertyNameTrim, lineNum, (filename ? filename : TEXT("")), propertyNameTrim, dispValue1, propertyNameTrim, dispValue2);
break;
case 5:
log_printf(WRAPPER_SOURCE_WRAPPER, logLevelOnOverwrite,
TEXT("The \"%s\" property was defined on the Wrapper command line and can not be overwritten.\n Ignoring redefinition on line #%d of configuration file: %s\n Fixed Value %s=%s\n Ignored Value %s=%s"),
propertyNameTrim, lineNum, (filename ? filename : TEXT("")), propertyNameTrim, dispValue1, propertyNameTrim, dispValue2);
break;
case 6:
log_printf(WRAPPER_SOURCE_WRAPPER, logLevelOnOverwrite,
TEXT("The \"%s\" property was redefined on line #%d of configuration file: %s\n Old Value %s=%s\n New Value %s=%s"),
propertyNameTrim, lineNum, (filename ? filename : TEXT("")), propertyNameTrim, dispValue1, propertyNameTrim, dispValue2);
break;
}
free(dispValue1);
free(dispValue2);
}
}
if (properties->exitOnOverwrite) {
properties->overwrittenPropertyCausedExit = TRUE;
}
}
}
free(propertyNameTrim);
if (setValue) {
if (escapable && isEscapedProperty(property->name)) {
/* Expand the value. */
#ifdef _DEBUG
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_STATUS, TEXT("expanding value of %s"), property->name);
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_STATUS, TEXT(" value : %s"), propertyValueTrim);
#endif
propertyExpandedValue = expandEscapedCharacters(propertyValueTrim);
if (!propertyExpandedValue) {
free(propertyValueTrim);
return NULL;
}
#ifdef _DEBUG
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_STATUS, TEXT(" expanded: %s"), propertyExpandedValue);
#endif
/* Set the property value. */
setInnerProperty(properties, property, propertyExpandedValue, FALSE);
free(propertyExpandedValue);
} else {
/* Set the property value. */
setInnerProperty(properties, property, propertyValueTrim, FALSE);
}
if (property->value == NULL) {
free(propertyValueTrim);
return NULL;
}
/* Store the final flag */
property->finalValue = finalValue;
/* Store the quotable flag. */
property->quotable = quotable;
/* Store the internal flag. */
property->internal = internal;
/* Store the include depth. */
property->lastDefinitionDepth = depth;
/* Prepare the property by expanding any environment variables that are defined. */
prepareProperty(properties, property, FALSE);
/* Store the file name if any. */
if (property->filePath != NULL) {
free(property->filePath);
property->filePath = NULL;
}
if (filename) {
property->filePath = malloc(sizeof(TCHAR) * (_tcslen(filename) + 1));
_tcsncpy(property->filePath, filename, _tcslen(filename) + 1);
}
/* Store the line number. */
property->lineNumber = lineNum;
/* See if this is a variable definition */
if ((_tcslen(property->name) > 12) && (_tcsstr(property->name, TEXT("set.default.")) == property->name)) {
/* This property is an environment variable definition that should only
* be set if the environment variable does not already exist. Get the
* value back out of the property as it may have had environment
* replacements. */
property->isVariable = TRUE;
oldVal = _tgetenv(property->name + 12);
if (oldVal == NULL) {
/* Only set the variable if the new value is not NULL. */
if (propertyValue) {
#ifdef _DEBUG
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_STATUS, TEXT("set default env('%s', '%s')"),
property->name + 12, property->value);
#endif
setEnv(property->name + 12, property->value, (internal ? ENV_SOURCE_APPLICATION : ENV_SOURCE_CONFIG));
}
} else {
#ifdef _DEBUG
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_STATUS, TEXT(
"not setting default env('%s', '%s'), already set to '%s'"),
property->name + 12, property->value, oldVal);
#endif
#if !defined(WIN32) && defined(UNICODE)
free(oldVal);
#endif
}
} else if ((_tcslen(property->name) > 4) && (_tcsstr(property->name, TEXT("set.")) == property->name)) {
/* This property is an environment variable definition. Get the
* value back out of the property as it may have had environment
* replacements. */
property->isVariable = TRUE;
if (propertyValue) {
/* Set the variable if the new value is not NULL. */
#ifdef _DEBUG
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_STATUS, TEXT("set env('%s', '%s')"),
property->name + 4, property->value);
#endif
setEnv(property->name + 4, property->value, (internal ? ENV_SOURCE_APPLICATION : ENV_SOURCE_CONFIG));
} else {
oldVal = _tgetenv(property->name + 4);
if (oldVal) {
/* Clear the variable if the new value is NULL and the environment was not NULL. */
#ifdef _DEBUG
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_STATUS, TEXT("set env('%s', '')"),
property->name + 4);
#endif
setEnv(property->name + 4, NULL, (internal ? ENV_SOURCE_APPLICATION : ENV_SOURCE_CONFIG));
#if !defined(WIN32) && defined(UNICODE)
free(oldVal);
#endif
}
}
}
}
free(propertyValueTrim);
return property;
}
/**
* Takes a name/value pair in the form = and attempts to add
* it to the specified properties table.
*
* @param properties Properties structure to add to.
* @param filename Name of the file from which the property was loaded. NULL, if not from a file.
* @param lineNum Line number of the property declaration in the file. Ignored if filename is NULL.
* @param propertyNameValue The "name=value" pair to create the property from.
* @param finalValue TRUE if the property should be set as static.
* @param quotable TRUE if the property could contain quotes.
* @param internal TRUE if the property is a Wrapper internal property.
*
* Returns 0 if successful, otherwise 1
*/
int addPropertyPair(Properties *properties, const TCHAR* filename, int lineNum, const TCHAR *propertyNameValue, int finalValue, int quotable, int internal) {
TCHAR buffer[MAX_PROPERTY_NAME_VALUE_LENGTH];
TCHAR *d;
/* Make a copy of the pair that we can edit */
if (_tcslen(propertyNameValue) + 1 >= MAX_PROPERTY_NAME_VALUE_LENGTH) {
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_FATAL,
TEXT("The following property name value pair is too large. Need to increase the internal buffer size: %s"), propertyNameValue);
return 1;
}
_tcsncpy(buffer, propertyNameValue, MAX_PROPERTY_NAME_VALUE_LENGTH);
if ((d = checkPropertySyntax(buffer))) {
if (addProperty(properties, filename, lineNum, 0, buffer, d, finalValue, quotable, FALSE, internal) != NULL) {
return 0;
}
}
return 1;
}
/**
* Register an internal variable and add it to the properties structure in order to get correct warnings.
*
* @param properties The Properties structure.
* @param varName The variable name.
* @param varValue The value of the variable.
* @param finalValue TRUE if the variable can be changed after the configuration is loaded.
* @param ignore TRUE if the variable should be added to properties->ignoreVarMap
* which means it should not be expanded until its value is turned to FALSE.
*/
void setInternalVarProperty(Properties *properties, const TCHAR *varName, const TCHAR *varValue, int finalValue, int ignore) {
TCHAR* propertyName;
/* A variable that was never set as ignored does not need to be added in the Hashmap.
* A variable that was previously set as ignored can be kept in the Hashmap but we need to set the hash value to "FALSE". */
if (ignore) {
hashMapPutKWVW(properties->ignoreVarMap, varName, TEXT("TRUE"));
} else if (hashMapGetKWVW(properties->ignoreVarMap, varName)) {
hashMapPutKWVW(properties->ignoreVarMap, varName, TEXT("FALSE"));
}
/* Do not warn about this variable */
hashMapPutKWVW(properties->warnedVarMap, varName, TEXT("INTERNAL"));
propertyName = malloc(sizeof(TCHAR) * (4 + _tcslen(varName) + 1));
if (!propertyName) {
outOfMemory(TEXT("SIVP"), 1);
return;
}
_sntprintf(propertyName, 4 + _tcslen(varName) + 1, TEXT("set.%s"), varName);
/* Always add the variable as a property to prevent user from overriding it and to get the correct warning, but pass a NULL value if the variable should not be set or cleared. */
addProperty(properties, NULL, 0, 0, propertyName, varValue, finalValue, FALSE, FALSE, TRUE);
free(propertyName);
}
const TCHAR* getStringProperty(Properties *properties, const TCHAR *propertyName, const TCHAR *defaultValue) {
Property *property;
property = getInnerProperty(properties, propertyName, TRUE);
if (property == NULL) {
if (defaultValue != NULL) {
property = addProperty(properties, NULL, 0, 0, propertyName, defaultValue, FALSE, FALSE, FALSE, FALSE);
if (property) {
property->isGenerated = TRUE;
return property->value;
} else {
/* We failed to add the property, but still return the default. */
return defaultValue;
}
} else {
return NULL;
}
} else {
return property->value;
}
}
const TCHAR* getNotEmptyStringProperty(Properties *properties, const TCHAR *propertyName, const TCHAR *defaultValue) {
const TCHAR* result = getStringProperty(properties, propertyName, defaultValue);
if (result && (_tcslen(result) > 0)) {
return result;
}
return defaultValue;
}
const TCHAR* getFileSafeStringProperty(Properties *properties, const TCHAR *propertyName, const TCHAR *defaultValue) {
Property *property;
TCHAR *buffer;
int i;
property = getInnerProperty(properties, propertyName, TRUE);
if (property == NULL) {
if (defaultValue != NULL) {
property = addProperty(properties, NULL, 0, 0, propertyName, defaultValue, FALSE, FALSE, FALSE, FALSE);
if (property) {
property->isGenerated = TRUE;
}
}
return defaultValue;
} else {
buffer = property->value;
if (_tcschr(buffer, TEXT('%'))) {
i = 0;
while (buffer[i]) {
if (buffer[i] == TEXT('%')) {
buffer[i] = TEXT('_');
}
i++;
}
}
return buffer;
}
}
/**
* Does a quick sort of the property values, keeping the values together.
*/
void sortStringProperties(long unsigned int *propertyIndices, TCHAR **propertyNames, TCHAR **propertyValues, int low, int high) {
int i = low;
int j = high;
long int tempIndex;
TCHAR *tempName;
TCHAR *tempValue;
long unsigned int x = propertyIndices[(low + high) / 2];
do {
while (propertyIndices[i] < x) {
i++;
}
while (propertyIndices[j] > x) {
j--;
}
if (i <= j) {
/* Swap i and j values. */
tempIndex = propertyIndices[i];
tempName = propertyNames[i];
tempValue = propertyValues[i];
propertyIndices[i] = propertyIndices[j];
propertyNames[i] = propertyNames[j];
propertyValues[i] = propertyValues[j];
propertyIndices[j] = tempIndex;
propertyNames[j] = tempName;
propertyValues[j] = tempValue;
i++;
j--;
}
} while (i <= j);
/* Recurse */
if (low < j) {
sortStringProperties(propertyIndices, propertyNames, propertyValues, low, j);
}
if (i < high) {
sortStringProperties(propertyIndices, propertyNames, propertyValues, i, high);
}
}
/**
* Returns a sorted array of all properties beginning with {propertyNameBase}.
* Only numerical characters can be returned between the two.
*
* The calling code must always call freeStringProperties to make sure that the
* malloced propertyNames, propertyValues, and propertyIndices arrays are freed
* up correctly. This is only necessary if the function returns 0.
*
* @param properties The full properties structure.
* @param propertyNameHead All matching properties must begin with this value.
* @param propertyNameTail All matching properties must end with this value.
* @param all If FALSE then the array will start with #1 and loop up until the
* next property is not found, if TRUE then all properties will be
* returned, even if there are gaps in the series.
* @param matchAny If FALSE only numbers are allowed as placeholder,
* If TRUE any strings (including empty string) are allowed and
* propertyIndices is not set.
* @param propertyNames Returns a pointer to a NULL terminated array of
* property names.
* @param propertyValues Returns a pointer to a NULL terminated array of
* property values.
* @param propertyIndices Returns a pointer to a 0 terminated array of
* the index numbers used in each property name of
* the propertyNames array.
*
* @return 0 if successful, -1 if there was an error.
*/
int getStringProperties(Properties *properties, const TCHAR *propertyNameHead, const TCHAR *propertyNameTail, int all, int matchAny, TCHAR ***propertyNames, TCHAR ***propertyValues, long unsigned int **propertyIndices) {
int j;
int k;
size_t headLen;
size_t tailLen;
size_t thisLen;
TCHAR *thisHead;
TCHAR *thisTail;
size_t i;
Property *property;
size_t indexLen;
TCHAR indexS[16];
int ok;
TCHAR c;
int count;
int firstPass = TRUE;
if (!matchAny) {
*propertyIndices = NULL;
}
headLen = _tcslen(propertyNameHead);
tailLen = _tcslen(propertyNameTail);
for (j = 0; j < 2; j++) {
count = 0;
property = properties->first;
while (property != NULL) {
thisLen = _tcslen(property->name);
if (matchAny && (thisLen < headLen + tailLen)) {
/* Too short, not what we are looking for. */
} else if (!matchAny && (thisLen < headLen + tailLen + 1)) {
/* Too short, not what we are looking for. */
} else {
thisHead = malloc(sizeof(TCHAR) * (headLen + 1));
if (!thisHead) {
outOfMemory(TEXT("GSPS"), 1);
} else {
_tcsncpy(thisHead, property->name, headLen);
thisHead[headLen] = 0;
if (strcmpIgnoreCase(thisHead, propertyNameHead) == 0) {
/* Head matches. */
thisTail = malloc(sizeof(TCHAR) * (tailLen + 1));
if (!thisTail) {
outOfMemory(TEXT("GSPS"), 2);
} else {
_tcsncpy(thisTail, property->name + thisLen - tailLen, tailLen + 1);
if (strcmpIgnoreCase(thisTail, propertyNameTail) == 0) {
/* Tail matches. */
indexLen = thisLen - headLen - tailLen;
if (indexLen <= 15) {
ok = TRUE;
if (!matchAny) {
_tcsncpy(indexS, property->name + headLen, indexLen);
indexS[indexLen] = 0;
for (i = 0; i < indexLen; i++) {
c = indexS[i];
if ((c < '0') || (c > '9')) {
ok = FALSE;
break;
}
}
}
if (ok) {
if (!firstPass) {
prepareProperty(properties, property, FALSE);
if (!matchAny) {
(*propertyIndices)[count] = _tcstoul(indexS, NULL, 10);
}
(*propertyNames)[count] = property->name;
(*propertyValues)[count] = property->value;
}
count++;
}
}
}
free(thisTail);
}
}
free(thisHead);
}
}
/* Keep looking */
property = property->next;
}
if (firstPass) {
firstPass = FALSE;
*propertyNames = malloc(sizeof(TCHAR *) * (count + 1));
if (!(*propertyNames)) {
outOfMemory(TEXT("GSPS"), 3);
*propertyNames = NULL;
*propertyValues = NULL;
if (!matchAny) {
*propertyIndices = NULL;
}
return -1;
}
*propertyValues = malloc(sizeof(TCHAR *) * (count + 1));
if (!(*propertyValues)) {
outOfMemory(TEXT("GSPS"), 4);
free(*propertyNames);
*propertyNames = NULL;
*propertyValues = NULL;
if (!matchAny) {
*propertyIndices = NULL;
}
return -1;
}
if (!matchAny) {
*propertyIndices = malloc(sizeof(long unsigned int) * (count + 1));
if (!(*propertyIndices)) {
outOfMemory(TEXT("GSPS"), 5);
free(*propertyNames);
free(*propertyValues);
*propertyNames = NULL;
*propertyValues = NULL;
*propertyIndices = NULL;
return -1;
}
}
if (count == 0) {
/* The count is 0 so no need to continue through the loop again. */
(*propertyNames)[0] = NULL;
(*propertyValues)[0] = NULL;
if (!matchAny) {
(*propertyIndices)[0] = 0;
}
return 0;
}
} else {
/* Second pass */
(*propertyNames)[count] = NULL;
(*propertyValues)[count] = NULL;
if (!matchAny) {
(*propertyIndices)[count] = 0;
sortStringProperties(*propertyIndices, *propertyNames, *propertyValues, 0, count - 1);
/* If we don't want all of the properties then we need to remove the extra ones.
* Names and values are not allocated, so setting them to NULL is fine.*/
if (!all) {
for (k = 0; k < count; k++) {
if ((*propertyIndices)[k] != k + 1) {
(*propertyNames)[k] = NULL;
(*propertyValues)[k] = NULL;
(*propertyIndices)[k] = 0;
}
}
}
}
/*
for (k = 0; k < count; k++) {
if ((*propertyNames)[k]) {
_tprintf("[%d] #%lu: %s=%s\n", k, (*propertyIndices)[k], (*propertyNames)[k], (*propertyValues)[k]);
}
}
*/
return 0;
}
}
/* For compiler */
return 0;
}
/**
* Frees up an array of properties previously returned by getStringProperties().
*/
void freeStringProperties(TCHAR **propertyNames, TCHAR **propertyValues, long unsigned int *propertyIndices) {
/* The property names are not malloced. */
free(propertyNames);
/* The property values are not malloced. */
free(propertyValues);
free(propertyIndices);
}
int getIntProperty(Properties *properties, const TCHAR *propertyName, int defaultValue) {
TCHAR buffer[16];
Property *property;
int i;
TCHAR c;
int value;
property = getInnerProperty(properties, propertyName, TRUE);
if (property == NULL) {
_sntprintf(buffer, 16, TEXT("%d"), defaultValue);
property = addProperty(properties, NULL, 0, 0, propertyName, buffer, FALSE, FALSE, FALSE, FALSE);
if (property) {
property->isGenerated = TRUE;
}
return defaultValue;
} else {
value = (int)_tcstol(property->value, NULL, 0);
/* Make sure that the property does not contain invalid characters. */
i = 0;
do {
c = property->value[i];
if ((i > 0) && (c == TEXT('\0'))) {
/* Fall through */
} else if ((i == 0) && (c == TEXT('-'))) {
/* Negative number. This is Ok. */
} else if ((c < TEXT('0')) || (c > TEXT('9'))) {
if (i == 0) {
/* If the bad character is the first character then use the default value. */
value = defaultValue;
}
if (properties->logWarnings) {
log_printf(WRAPPER_SOURCE_WRAPPER, properties->logWarningLogLevel,
TEXT("Encountered an invalid numerical value for configuration property %s=%s. Resolving to %d."),
propertyName, property->value, value);
}
break;
}
i++;
} while (c != TEXT('\0'));
return value;
}
}
int getBooleanProperty(Properties *properties, const TCHAR *propertyName, int defaultValue) {
const TCHAR *defaultValueS;
Property *property;
const TCHAR *propertyValue;
if (defaultValue) {
defaultValueS = TEXT("TRUE");
} else {
defaultValueS = TEXT("FALSE");
}
property = getInnerProperty(properties, propertyName, TRUE);
if (property == NULL) {
property = addProperty(properties, NULL, 0, 0, propertyName, defaultValueS, FALSE, FALSE, FALSE, FALSE);
if (property) {
property->isGenerated = TRUE;
}
propertyValue = defaultValueS;
} else {
propertyValue = property->value;
}
if (strcmpIgnoreCase(propertyValue, TEXT("TRUE")) == 0) {
return TRUE;
} else if (strcmpIgnoreCase(propertyValue, TEXT("FALSE")) == 0) {
return FALSE;
} else {
if (properties->logWarnings) {
log_printf(WRAPPER_SOURCE_WRAPPER, properties->logWarningLogLevel,
TEXT("Encountered an invalid boolean value for configuration property %s=%s. Resolving to %s."),
propertyName, propertyValue, defaultValueS);
}
return defaultValue;
}
}
/**
* Build sorted arrays of all boolean properties beginning with {propertyNameBase}.
* Only numerical characters can be returned between the two.
*
* The calling code must always call freeBooleanProperties to make sure that the
* malloced propertyNames, propertyValues, and propertyIndices arrays are freed
* up correctly. This is only necessary if the function returns 0.
*
* @param properties The full properties structure.
* @param propertyNameHead All matching properties must begin with this value.
* @param propertyNameTail All matching properties must end with this value.
* @param all If FALSE then the array will start with #1 and loop up until the
* next property is not found, if TRUE then all properties will be
* returned, even if there are gaps in the series.
* @param matchAny If FALSE only numbers are allowed as placeholder
* @param propertyNames Returns a pointer to a NULL terminated array of
* property names.
* @param propertyValues Returns a pointer to a NULL terminated array of
* property values.
* @param propertyIndices Returns a pointer to a 0 terminated array of
* the index numbers used in each property name of
* the propertyNames array.
*
* @return 0 if successful, -1 if there was an error.
*/
int getBooleanProperties(Properties *properties, const TCHAR *propertyNameHead, const TCHAR *propertyNameTail, int all, int matchAny, TCHAR ***propertyNames, int **propertyValues, long unsigned int **propertyIndices, int defaultValue) {
TCHAR **strPropertyValues;
int i = 0;
int count = 0;
int result;
result = getStringProperties(properties, propertyNameHead, propertyNameTail, all, matchAny, propertyNames, &strPropertyValues, propertyIndices);
if (result == -1)
return result;
while (strPropertyValues[i]) {
count++;
i++;
}
*propertyValues = malloc(sizeof(TCHAR *) * (count + 1));
i = 0;
while (strPropertyValues[i]) {
if (strcmpIgnoreCase(strPropertyValues[i], TEXT("TRUE")) == 0) {
(*propertyValues)[i] = TRUE;
} else if (strcmpIgnoreCase(strPropertyValues[i], TEXT("FALSE")) == 0) {
(*propertyValues)[i] = FALSE;
} else {
if (properties->logWarnings) {
log_printf(WRAPPER_SOURCE_WRAPPER, properties->logWarningLogLevel,
TEXT("Encountered an invalid boolean value for configuration property %s=%s. Resolving to %s."),
(*propertyNames)[i], strPropertyValues[i], defaultValue ? TEXT("TRUE") : TEXT("FALSE"));
}
(*propertyValues)[i] = defaultValue;
}
i++;
}
free(strPropertyValues);
return 0;
}
void freeBooleanProperties(TCHAR **propertyNames, int *propertyValues, long unsigned int *propertyIndices) {
/* The property names are not malloced. */
free(propertyNames);
free(propertyValues);
free(propertyIndices);
}
const TCHAR* getPropertyFilePath(Properties *properties, const TCHAR* propertyName) {
Property* property;
property = getInnerProperty(properties, propertyName, FALSE);
if (property) {
return property->filePath;
}
return NULL;
}
static const TCHAR* getStatusStr(int status) {
TCHAR *name;
switch (status) {
case STATUS_ENABLED:
name = TEXT("ENABLED");
break;
case STATUS_DISABLED:
name = TEXT("DISABLED");
break;
default:
name = TEXT("UNCHANGED");
break;
}
return name;
}
int getStatusProperty(Properties *properties, const TCHAR *propertyName, int defaultValue) {
const TCHAR* valueStr = getStringProperty(properties, propertyName, NULL);
if (valueStr) {
if (strcmpIgnoreCase(valueStr, TEXT("UNCHANGED")) == 0) {
return STATUS_UNCHANGED;
} else if (strcmpIgnoreCase(valueStr, TEXT("ENABLED")) == 0) {
return STATUS_ENABLED;
} else if (strcmpIgnoreCase(valueStr, TEXT("DISABLED")) == 0) {
return STATUS_DISABLED;
} else if (properties->logWarnings) {
log_printf(WRAPPER_SOURCE_WRAPPER, properties->logWarningLogLevel,
TEXT("Encountered an invalid value for configuration property %s=%s. Resolving to %s."),
propertyName, valueStr, getStatusStr(defaultValue));
}
}
return defaultValue;
}
/**
* Indicates if a property was generated by the Wrapper or written in the configuration.
* ATTENTION: The value returned by this function should never be used in a condition
* that will affect the Wrapper behaviour. We want the configuration to be
* loaded the same way if a property is set with a default value or not set.
* This function should only be used for logging purpose, for example to print
* a property name making sure it actually exists in the configuration file.
*
* @param properties The full properties structure.
* @param propertyName The name of the property to check.
*
* @return TRUE if the property was generated by the Wrapper, FALSE if it exists in the configuration.
*/
int isGeneratedProperty(Properties *properties, const TCHAR *propertyName) {
Property *property;
property = getInnerProperty(properties, propertyName, FALSE);
if (property == NULL) {
return FALSE;
} else {
return property->isGenerated;
}
}
int isQuotableProperty(Properties *properties, const TCHAR *propertyName) {
Property *property;
property = getInnerProperty(properties, propertyName, FALSE);
if (property == NULL) {
return FALSE;
} else {
return property->quotable;
}
}
/**
* Return a code indicating how the property can be dumped.
*
* @property property to check.
*
* @return 0 if the property should not be dumped.
* 1 if the property can be logged normally.
*/
int propertyDumpFilter(Property *property) {
if (property->isGenerated || property->internal) {
return 0;
}
/*
if (_tcsstr(propName, TEXT(".license."))) {
free(propName);
return 0;
}
*/
return 1;
}
const TCHAR* getPropertySourceName(Property *property) {
if (property->finalValue) {
return TEXT("COMMAND ");
} else if (property->isGenerated) {
return TEXT("WRAPPER ");
} else {
return TEXT("FILE ");
}
}
TCHAR getPropertySourceShortName(Property *property) {
if (property->finalValue) {
return TEXT('C');
} else if (property->isGenerated) {
return TEXT('W');
} else {
return TEXT('F');
}
}
/* Returns the number of columns with variable sizes and the required size. */
int getColumnsAndReqVarSizeForPropertyDump(TCHAR* value, TCHAR* format, size_t *reqSize) {
int numColumns;
int i;
for(i = 0, numColumns = 0; i < (int)_tcslen(format); i++ ) {
switch(format[i]) {
case TEXT('V'):
case TEXT('v'):
*reqSize += _tcslen(value) + 3;
numColumns++;
break;
}
}
return numColumns;
}
/* Returns the number of columns with constant sizes, and retrieve the sizes that should be calculated taking into account all properties. */
int getColumnsAndReqConstSizesForPropertyDump(Properties *properties, TCHAR* format, size_t *reqSize, size_t *reqPropNameSize, size_t *reqConfPathSize, size_t *reqConfNameSize) {
Property *property;
int dumpFilter;
int addPropNameSize = FALSE;
int addConfPathSize = FALSE;
int addConfNameSize = FALSE;
int numColumns;
int i;
*reqSize = 0;
*reqPropNameSize = 0;
*reqConfPathSize = 0;
*reqConfNameSize = 0;
for(i = 0, numColumns = 0; i < (int)_tcslen(format); i++ ) {
switch(format[i]) {
case TEXT('S'):
case TEXT('s'):
*reqSize += 1 + 3;
numColumns++;
break;
case TEXT('Z'):
case TEXT('z'):
*reqSize += 8 + 3; /* FILE|EMBEDDED|COMMAND|WRAPPER */
numColumns++;
break;
case TEXT('F'):
case TEXT('f'):
*reqSize += 1 + 3;
numColumns++;
break;
case TEXT('P'):
case TEXT('p'):
addConfPathSize = TRUE;
numColumns++;
break;
case TEXT('C'):
case TEXT('c'):
addConfNameSize = TRUE;
numColumns++;
break;
case TEXT('L'):
case TEXT('l'):
*reqSize += 4 + 3;
numColumns++;
break;
case TEXT('I'):
case TEXT('i'):
*reqSize += 1 + 3;
numColumns++;
break;
case TEXT('N'):
case TEXT('n'):
addPropNameSize = TRUE;
numColumns++;
break;
}
}
if (addPropNameSize || addConfPathSize || addConfNameSize) {
property = properties->first;
while (property != NULL) {
dumpFilter = propertyDumpFilter(property);
if (dumpFilter > 0) {
if (addPropNameSize) {
*reqPropNameSize = __max(_tcslen(property->name), *reqPropNameSize);
}
/* We assume that the conf file name and path are written with characters that display on a single char width.
* We would need a smarter function to calculate the length of strings containing full width Japanese characters. */
if (addConfPathSize && property->filePath) {
*reqConfPathSize = __max(_tcslen(property->filePath), *reqConfPathSize);
}
if (addConfNameSize && property->filePath) {
*reqConfNameSize = __max(_tcslen(getFileName(property->filePath)), *reqConfNameSize);
}
}
property = property->next;
}
if (addPropNameSize) {
*reqSize += *reqPropNameSize + 3;
}
if (addConfPathSize) {
*reqSize += *reqConfPathSize + 3;
}
if (addConfNameSize) {
*reqSize += *reqConfNameSize + 3;
}
}
return numColumns;
}
TCHAR* buildPropertyDumpBuffer(Property *property, TCHAR* format, int numConstColumns, size_t reqConstTotSize, size_t reqPropNameSize, size_t reqConfPathSize, size_t reqConfNameSize) {
int i;
size_t reqSize;
int numColumns;
TCHAR *pos;
int currentColumn;
int handledFormat;
int temp = 0;
int len = 0;
TCHAR* printBuffer;
TCHAR* propValue;
#if defined(UNICODE) && !defined(WIN32)
const TCHAR* leftAlignStrFormat = TEXT("%-*S");
#else
const TCHAR* leftAlignStrFormat = TEXT("%-*s");
#endif
propValue = getDisplayValue(property->value, isSecretValue(property));
if (!propValue) {
return NULL;
}
/* The required size for the columns with a constant width, as well as their number, are calculated once and for all properties. */
reqSize = reqConstTotSize;
numColumns = numConstColumns;
/* Then add the variable columns. */
numColumns += getColumnsAndReqVarSizeForPropertyDump(propValue, format, &reqSize);
if (reqSize == 0) {
free(propValue);
/* Invalid format - this should not happen because we checked that the format was correct before calling this function. */
return NULL;
}
/* Always add room for the null. */
reqSize += 1;
printBuffer = malloc(sizeof(TCHAR) * reqSize);
if (!printBuffer) {
outOfMemory(TEXT("BPDB"), 1);
free(propValue);
return NULL;
}
pos = printBuffer;
/* Indent with two characters to display like when dumping environment variables. */
temp = _sntprintf(pos, 3, TEXT(" "));
pos += temp;
len += temp;
reqSize += len;
for(i = 0, currentColumn = 0; i < (int)_tcslen(format); i++) {
handledFormat = TRUE;
switch(format[i]) {
case TEXT('S'):
case TEXT('s'):
temp = _sntprintf(pos, reqSize - len, TEXT("%c"), getPropertySourceShortName(property));
currentColumn++;
break;
case TEXT('Z'):
case TEXT('z'):
temp = _sntprintf(pos, reqSize - len, TEXT("%s"), getPropertySourceName(property));
currentColumn++;
break;
case TEXT('F'):
case TEXT('f'):
temp = _sntprintf(pos, reqSize - len, TEXT("%c"), (property->finalValue ? TEXT('F') : TEXT(' ')));
currentColumn++;
break;
case TEXT('P'):
case TEXT('p'):
temp = _sntprintf(pos, reqSize - len, leftAlignStrFormat, reqConfPathSize, property->filePath ? property->filePath : TEXT(""));
currentColumn++;
break;
case TEXT('C'):
case TEXT('c'):
temp = _sntprintf(pos, reqSize - len, leftAlignStrFormat, reqConfNameSize, property->filePath ? getFileName(property->filePath) : TEXT(""));
currentColumn++;
break;
case TEXT('L'):
case TEXT('l'):
if (getPropertySourceShortName(property) != TEXT('F')) {
temp = _sntprintf(pos, reqSize - len, TEXT(" "));
} else if (property->lineNumber > 9999) {
temp = _sntprintf(pos, reqSize - len, TEXT("****"));
} else {
temp = _sntprintf(pos, reqSize - len, TEXT("%4d"), property->lineNumber);
}
currentColumn++;
break;
case TEXT('I'):
case TEXT('i'):
if (property->definitions > 9) {
temp = _sntprintf(pos, reqSize - len, TEXT("*"));
} else if (property->definitions > 1) {
/* Only show the number of definitions if it's more than 1, to make those cases appear clearly. */
temp = _sntprintf(pos, reqSize - len, TEXT("%d"), property->definitions);
} else {
/* In the future we may want to show a '-' if the property is not defined anywhere (0 definitions). For now it is just not listed. */
temp = _sntprintf(pos, reqSize - len, TEXT(" "));
}
currentColumn++;
break;
case TEXT('N'):
case TEXT('n'):
temp = _sntprintf(pos, reqSize - len, leftAlignStrFormat, reqPropNameSize, property->name);
currentColumn++;
break;
case TEXT('V'):
case TEXT('v'):
temp = _sntprintf(pos, reqSize - len, TEXT("%s"), propValue);
currentColumn++;
break;
default:
handledFormat = FALSE;
}
if (handledFormat) {
pos += temp;
len += temp;
/* Add separator chars */
if (currentColumn != numColumns) {
temp = _sntprintf(pos, reqSize - len, TEXT(" | "));
pos += temp;
len += temp;
}
}
}
free(propValue);
/* Return the print buffer to the caller. */
return printBuffer;
}
void dumpProperties(Properties *properties) {
Property *property;
int dumpFilter;
int numConstColumns;
size_t reqConstTotSize;
size_t reqPropNameSize;
size_t reqConfPathSize;
size_t reqConfNameSize;
TCHAR* printBuffer;
if ((getLowLogLevel() <= properties->dumpLogLevel) && (properties->dumpLogLevel != LEVEL_NONE)) {
property = properties->first;
/* The required size for the columns with a constant width, as well as their number, are calculated once and for all properties. */
numConstColumns = getColumnsAndReqConstSizesForPropertyDump(properties, properties->dumpFormat, &reqConstTotSize, &reqPropNameSize, &reqConfPathSize, &reqConfNameSize);
if ((numConstColumns == 0) && (getColumnsAndReqVarSizeForPropertyDump(TEXT(""), properties->dumpFormat, &reqConstTotSize) == 0)) {
/* No columns or invalid format - use the default format instead. */
log_printf(WRAPPER_SOURCE_WRAPPER, properties->logWarningLogLevel,
TEXT("Encountered an invalid format for configuration property %s=%s. Resolving to '%s'."),
TEXT("wrapper.properties.dump.format"),
properties->dumpFormat,
PROPERTIES_DUMP_FORMAT_DEFAULT);
setPropertiesDumpFormat(properties, PROPERTIES_DUMP_FORMAT_DEFAULT);
/* Recalculate the size for the columns with a constant width and their number. */
numConstColumns = getColumnsAndReqConstSizesForPropertyDump(properties, properties->dumpFormat, &reqConstTotSize, &reqPropNameSize, &reqConfPathSize, &reqConfNameSize);
}
log_printf(WRAPPER_SOURCE_WRAPPER, properties->dumpLogLevel, TEXT(""));
log_printf(WRAPPER_SOURCE_WRAPPER, properties->dumpLogLevel, TEXT("Wrapper configuration properties BEGIN:"));
while (property != NULL) {
dumpFilter = propertyDumpFilter(property);
if (dumpFilter > 0) {
printBuffer = buildPropertyDumpBuffer(property, properties->dumpFormat, numConstColumns, reqConstTotSize, reqPropNameSize, reqConfPathSize, reqConfNameSize);
if (printBuffer) {
log_printf(WRAPPER_SOURCE_WRAPPER, properties->dumpLogLevel, TEXT("%s"), printBuffer);
free(printBuffer);
}
}
property = property->next;
}
log_printf(WRAPPER_SOURCE_WRAPPER, properties->dumpLogLevel, TEXT("Wrapper configuration properties END:"));
log_printf(WRAPPER_SOURCE_WRAPPER, properties->dumpLogLevel, TEXT(""));
}
}
/**
* Level at which properties will be dumped.
*/
void setPropertiesDumpLogLevel(Properties *properties, int logLevel) {
properties->dumpLogLevel = logLevel;
}
/**
* Format used when dumping properties.
*/
void setPropertiesDumpFormat(Properties *properties, const TCHAR* format) {
if (properties->dumpFormat) {
free(properties->dumpFormat);
}
properties->dumpFormat = malloc(sizeof(TCHAR) * (_tcslen(format) + 1));
_tcsncpy(properties->dumpFormat, format, (_tcslen(format) + 1));
}
/**
* Set to TRUE if warnings about property values should be logged.
*/
void setLogPropertyWarnings(Properties *properties, int logWarnings) {
properties->logWarnings = logWarnings;
}
/**
* Level at which any property warnings are logged.
*/
void setLogPropertyWarningLogLevel(Properties *properties, int logLevel) {
properties->logWarningLogLevel = logLevel;
}
/**
* Returns the minimum value. This is used in place of the __min macro when the parameters should not be called more than once.
*/
int propIntMin(int value1, int value2) {
if (value1 < value2) {
return value1;
} else {
return value2;
}
}
/**
* Returns the maximum value. This is used in place of the __max macro when the parameters should not be called more than once.
*/
int propIntMax(int value1, int value2) {
if (value1 > value2) {
return value1;
} else {
return value2;
}
}
/** Creates a linearized representation of all of the properties.
* The returned buffer must be freed by the calling code. */
TCHAR *linearizeProperties(Properties *properties, TCHAR separator) {
Property *property;
size_t size;
TCHAR *c;
TCHAR *fullBuffer;
TCHAR *work, *buffer;
/* First we need to figure out how large a buffer will be needed to linearize the properties. */
size = 0;
property = properties->first;
while (property != NULL) {
/* Add the length of the basic property. */
size += _tcslen(property->name);
size++; /* '=' */
size += _tcslen(property->value);
/* Handle any characters that will need to be escaped. */
c = property->name;
while ((c = _tcschr(c, separator)) != NULL) {
size++;
c++;
}
c = property->value;
while ((c = _tcschr(c, separator)) != NULL) {
size++;
c++;
}
size++; /* separator */
property = property->next;
}
size++; /* null terminated. */
/* Now that we know how much space this will all take up, allocate a buffer. */
fullBuffer = buffer = calloc(sizeof(TCHAR) , size);
if (!fullBuffer) {
outOfMemory(TEXT("LP"), 1);
return NULL;
}
/* Now actually build up the output. Any separator characters need to be escaped with themselves. */
property = properties->first;
while (property != NULL) {
/* name */
work = property->name;
while ((c = _tcschr(work, separator)) != NULL) {
_tcsncpy(buffer, work, c - work + 1);
buffer += c - work + 1;
buffer[0] = separator;
buffer++;
work = c + 1;
}
_tcsncpy(buffer, work, size - _tcslen(fullBuffer));
buffer += _tcslen(work);
/* equals */
buffer[0] = TEXT('=');
buffer++;
/* value */
work = property->value;
while ((c = _tcschr(work, separator)) != NULL) {
_tcsncpy(buffer, work, c - work + 1);
buffer += c - work + 1;
buffer[0] = separator;
buffer++;
work = c + 1;
}
_tcsncpy(buffer, work, size - _tcslen(fullBuffer));
buffer += _tcslen(work);
/* separator */
buffer[0] = separator;
buffer++;
property = property->next;
}
/* null terminate. */
buffer[0] = 0;
buffer++;
return fullBuffer;
}
wrapper_3.5.51_src/src/c/property.h 100644 0 0 42160 14333053650 14440 0 ustar 0 0 /*
* Copyright (c) 1999, 2022 Tanuki Software, Ltd.
* http://www.tanukisoftware.com
* All rights reserved.
*
* This software is the proprietary information of Tanuki Software.
* You shall use it only in accordance with the terms of the
* license agreement you entered into with Tanuki Software.
* http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
*
*
* Portions of the Software have been derived from source code
* developed by Silver Egg Technology under the following license:
*
* Copyright (c) 2001 Silver Egg Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sub-license, and/or
* sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*/
#ifndef _PROPERTY_H
#define _PROPERTY_H
#include "wrapper_hashmap.h"
#ifndef TRUE
#define TRUE -1
#endif
#ifndef FALSE
#define FALSE 0
#endif
/* This defines the largest environment variable that we are able
* to work with. It can be expanded if needed. */
#define MAX_PROPERTY_NAME_LENGTH 512
#define MAX_PROPERTY_VALUE_LENGTH 16384
#define MAX_PROPERTY_NAME_VALUE_LENGTH MAX_PROPERTY_NAME_LENGTH + 1 + MAX_PROPERTY_VALUE_LENGTH
#define ENV_SOURCE_PARENT 1
#define ENV_SOURCE_APPLICATION 2
#define ENV_SOURCE_CONFIG 4
#ifdef WIN32
#define ENV_SOURCE_REG_SYSTEM 8
#define ENV_SOURCE_REG_ACCOUNT 16
#endif
#define PROPERTIES_DUMP_FORMAT_DEFAULT TEXT("SFNV")
typedef struct EnvSrc EnvSrc;
struct EnvSrc {
int source; /* Source of the variable. */
TCHAR* name; /* Name of the environment variable. */
EnvSrc *next; /* Next variable in the chain. */
};
extern EnvSrc *baseEnvSrc;
typedef struct Property Property;
struct Property {
TCHAR *name; /* The name of the property. */
TCHAR *value; /* The value of the property. */
TCHAR *value_inner; /* The value of the property (with %WRAPPER_PERCENTAGE% kept unexpanded). */
TCHAR *filePath; /* The file in which the property was declared. NULL is not defined in a conf file. */
int lineNumber; /* The line number at which the property was declared. 0 if not defined in a conf file. */
int definitions; /* Counter for the number of time the property was defined. */
int finalValue; /* TRUE if the Property can not be changed. */
int quotable; /* TRUE if quotes can be optionally added around the value. */
int internal; /* TRUE if the Property is internal. */
int isGenerated; /* TRUE if the property did not exist in the configuration and was generated using a default value. */
int isVariable; /* TRUE if the property the definition of a variable (starting with 'set.'). */
int lastDefinitionDepth; /* Depth of the configuration file in which the property was previously defined, or -1 if not yet defined. */
Property *next; /* Pointer to the next Property in a linked list */
Property *previous; /* Pointer to the previous Property in a linked list */
};
typedef struct Properties Properties;
struct Properties {
int debugProperties; /* TRUE if debug information on Properties should be shown. */
int exitOnOverwrite; /* If TRUE, causes the wrapper to exit when any property is overwritten in the config files. */
int logLevelOnOverwrite; /* Defines the log level of the messages reported when properties are overwritten (the value may change each time a directive is encountered as the configuration is loading). */
int overwrittenPropertyCausedExit; /* Flag to keep trace whether at least one property was overridden */
int logWarnings; /* Flag that controls whether or not warnings will be logged. */
int logWarningLogLevel; /* Log level at which any log warnings will be logged. */
int dumpLogLevel; /* Log level at which properties will be dumped. */
TCHAR* dumpFormat; /* Format used when dumping properties. */
Property *first; /* Pointer to the first property. */
Property *last; /* Pointer to the last property. */
PHashMap warnedVarMap; /* Map of undefined environment variables for which the user was warned. */
PHashMap ignoreVarMap; /* Map of environment variables that should not be expanded. */
};
/**
* Get the log level of the messages reported when properties are overwritten.
*
* @param properties
*
* @return log level
*/
extern int GetLogLevelOnOverwrite(Properties *properties);
/**
* Sets an environment variable with the specified value.
* The function will only set the variable if its value is changed, but if
* it does, the call will result in a memory leak the size of the string:
* "name=value".
*
* @param name Name of the variable being set.
* @param value Value to be set, NULL to clear it.
* @param source Where the variable came from.
* Must be one of ENV_SOURCE_PARENT, ENV_SOURCE_APPLICATION, ENV_SOURCE_CONFIG,
* or ENV_SOURCE_REG_SYSTEM or ENV_SOURCE_REG_ACCOUNT on Windows.
* If value is ENV_SOURCE_PARENT then the value may be NULL and will never be
* set to the environment.
*
* Return TRUE if there were any problems, FALSE otherwise.
*/
extern int setEnv(const TCHAR *name, const TCHAR *value, int source);
/**
* Parses a property value and populates any environment variables. If the expanded
* environment variable would result in a string that is longer than bufferLength
* the value is truncated.
*
* @param propertyValue The property value to be parsed.
* @param buffer output buffer where the expanded string will be copied.
* @param bufferLength size of the buffer.
* @param warnUndefinedVars Log warnings about missing environment variables.
* @param warnedUndefVarMap Map of variables which have previously been logged, may be NULL if warnUndefinedVars false.
* @param warnLogLevel Log level at which any warnings will be logged.
* @param ignoreVarMap Map of environment variables that should not be expanded.
* @param pHasPercentage Pointer to a variable which will be set to TRUE if a %WRAPPER_PERCENTAGE% variable was found.
* - If a non-NULL pointer is passed, the variable will not be expanded and no warning will be reported.
* - If NULL is passed, the variable will be expanded to '%'.
*/
extern void evaluateEnvironmentVariables(const TCHAR *propertyValue, TCHAR *buffer, int bufferLength, int warnUndefinedVars, PHashMap warnedUndefVarMap, int warnLogLevel, PHashMap ignoreVarMap, int *hasPercentage);
/**
* This function returns a reference to a static buffer and is NOT thread safe.
* Check implementation notes before using.
*/
extern TCHAR* generateTimeValue(const TCHAR* format, struct tm *timeTM);
/**
* This function returns a reference to a static buffer and is NOT thread safe.
* Check implementation notes before using.
*/
extern TCHAR* generateRandValue(const TCHAR* format);
/**
* Callback declaration of a function to filter lines read from the configuration file.
*/
typedef int (*ConfigFileReader_ReadFilterCallbackMB)(const char *bufferMB);
/**
* Callback declaration of a function to filter lines read from the configuration file.
*/
typedef int (*ConfigFileReader_ReadFilterCallbackW)(const TCHAR *bufferMB);
/**
* Create a Properties structure loaded in from the specified file.
* Must call disposeProperties to free up allocated memory.
*
* @param properties Properties structure to load into.
* @param filename File to load the properties from.
* @param preload TRUE if this is a preload call that should have supressed error output.
* @param originalWorkingDir Working directory of the binary at the moment it was launched.
* @param fileRequired TRUE if the file specified by filename is required, FALSE if a missing
* file will silently fail.
* @param readFilterCallback Pointer to a callback funtion which will be used to filter some
* lines that should not be processed.
*
* @return CONFIG_FILE_READER_SUCCESS if the file was read successfully,
* CONFIG_FILE_READER_OPEN_FAIL if the file could not be found or opened.
* CONFIG_FILE_READER_FAIL if there were any problems at all, or
* CONFIG_FILE_READER_HARD_FAIL if the problem should cascaded all the way up.
*/
extern int loadProperties(Properties *properties,
const TCHAR* filename,
int preload,
const TCHAR *originalWorkingDir,
int fileRequired,
ConfigFileReader_ReadFilterCallbackMB readFilterCallback);
/**
* Create a Properties structure. Must call disposeProperties to free up
* allocated memory.
*/
extern Properties* createProperties(int debug, int logLevelOnOverwrite, int exitOnOverwrite);
/**
* Free all memory allocated by a Properties structure. The properties
* pointer will no longer be valid.
*/
extern void disposeProperties(Properties *properties);
/**
* Free all memory allocated by a Properties structure. The properties
* pointer will no longer be valid.
*/
extern void disposeEnvironment();
/**
* Remove a single Property from a Properties. All associated memory is
* freed up.
*
* @return TRUE if the property was found, FALSE otherwise.
*/
extern int removeProperty(Properties *properties, const TCHAR *propertyName);
/**
* Used to set a NULL terminated list of property names whose values should be
* escaped when read in from a file. '\\' will become '\' and '\n' will
* become '^J', all other characters following '\' will be left as is.
*
* @param propertyNames NULL terminated list of property names. Property names
* can contain a single '*' wildcard which will match 0 or
* more characters.
*/
extern void setEscapedProperties(const TCHAR **propertyNames);
/**
* Returns true if the specified property matches one of the property names
* previously set in a call to setEscapedProperties()
*
* @param propertyName Property name to test.
*
* @return TRUE if the property should be escaped. FALSE otherwise.
*/
extern int isEscapedProperty(const TCHAR *propertyName);
/**
* Adds a single property to the properties structure.
*
* @param properties Properties structure to add to.
* @param filename Name of the file from which the property was loaded. NULL, if not from a file.
* @param lineNum Line number of the property declaration in the file. Ignored if filename is NULL.
* @param depth Depth of the configuration file where the property was declared. Ignored if filename is NULL.
* @param propertyName Name of the new Property.
* @param propertyValue Initial property value.
* @param finalValue TRUE if the property should be set as static.
* @param quotable TRUE if the property could contain quotes.
* @param escapable TRUE if the propertyValue can be escaped if its propertyName
* is in the list set with setEscapedProperties().
* @param internal TRUE if the property is a Wrapper internal property.
*
* @return The newly created Property, or NULL if there was a reported error.
*/
extern Property* addProperty(Properties *properties, const TCHAR* filename, int lineNum, int depth, const TCHAR *propertyName, const TCHAR *propertyValue, int finalValue, int quotable, int escapable, int internal);
/**
* Takes a name/value pair in the form = and attempts to add
* it to the specified properties table.
*
* @param properties Properties structure to add to.
* @param filename Name of the file from which the property was loaded. NULL, if not from a file.
* @param lineNum Line number of the property declaration in the file. Ignored if filename is NULL.
* @param propertyNameValue The "name=value" pair to create the property from.
* @param finalValue TRUE if the property should be set as static.
* @param quotable TRUE if the property could contain quotes.
* @param internal TRUE if the property is a Wrapper internal property.
*
* Returns 0 if successful, otherwise 1
*/
extern int addPropertyPair(Properties *properties, const TCHAR* filename, int lineNum, const TCHAR *propertyNameValue, int finalValue, int quotable, int internal);
extern void setInternalVarProperty(Properties *properties, const TCHAR *varName, const TCHAR *varValue, int finalValue, int ignore);
extern const TCHAR* getStringProperty(Properties *properties, const TCHAR *propertyName, const TCHAR *defaultValue);
extern const TCHAR* getNotEmptyStringProperty(Properties *properties, const TCHAR *propertyName, const TCHAR *defaultValue);
extern const TCHAR* getFileSafeStringProperty(Properties *properties, const TCHAR *propertyName, const TCHAR *defaultValue);
/**
* Returns a sorted array of all properties beginning with {propertyNameBase}.
* Only numerical characters can be returned between the two.
*
* The calling code must always call freeStringProperties to make sure that the
* malloced propertyNames, propertyValues, and propertyIndices arrays are freed
* up correctly. This is only necessary if the function returns 0.
*
* @param properties The full properties structure.
* @param propertyNameHead All matching properties must begin with this value.
* @param propertyNameTail All matching properties must end with this value.
* @param all If FALSE then the array will start with #1 and loop up until the
* next property is not found, if TRUE then all properties will be
* returned, even if there are gaps in the series.
* @param matchAny If FALSE only numbers are allowed as placeholder
* @param propertyNames Returns a pointer to a NULL terminated array of
* property names.
* @param propertyValues Returns a pointer to a NULL terminated array of
* property values.
* @param propertyIndices Returns a pointer to a 0 terminated array of
* the index numbers used in each property name of
* the propertyNames array.
*
* @return 0 if successful, -1 if there was an error.
*/
extern int getStringProperties(Properties *properties, const TCHAR *propertyNameHead, const TCHAR *propertyNameTail, int all, int matchAny, TCHAR ***propertyNames, TCHAR ***propertyValues, long unsigned int **propertyIndices);
/**
* Frees up an array of properties previously returned by getStringProperties().
*/
extern void freeStringProperties(TCHAR **propertyNames, TCHAR **propertyValues, long unsigned int *propertyIndices);
extern int getIntProperty(Properties *properties, const TCHAR *propertyName, int defaultValue);
extern int getBooleanProperty(Properties *properties, const TCHAR *propertyName, int defaultValue);
extern int getBooleanProperties(Properties *properties, const TCHAR *propertyNameHead, const TCHAR *propertyNameTail, int all, int matchAny, TCHAR ***propertyNames, int **propertyValues, long unsigned int **propertyIndices, int defaultValue);
extern void freeBooleanProperties(TCHAR **propertyNames, int *propertyValues, long unsigned int *propertyIndices);
extern const TCHAR* getPropertyFilePath(Properties *properties, const TCHAR* propertyName);
extern int getStatusProperty(Properties *properties, const TCHAR *propertyName, int defaultValue);
extern int isGeneratedProperty(Properties *properties, const TCHAR *propertyName);
extern int isQuotableProperty(Properties *properties, const TCHAR *propertyName);
extern void dumpProperties(Properties *properties);
/**
* Level at which properties will be dumped.
*/
extern void setPropertiesDumpLogLevel(Properties *properties, int logLevel);
/**
* Format used when dumping properties.
*/
extern void setPropertiesDumpFormat(Properties *properties, const TCHAR* format);
/**
* Set to TRUE if warnings about property values should be logged.
*/
extern void setLogPropertyWarnings(Properties *properties, int logWarnings);
/**
* Level at which any property warnings are logged.
*/
extern void setLogPropertyWarningLogLevel(Properties *properties, int logLevel);
/**
* Returns the minimum value. This is used in place of the __min macro when the parameters should not be called more than once.
*/
extern int propIntMin(int value1, int value2);
/**
* Returns the maximum value. This is used in place of the __max macro when the parameters should not be called more than once.
*/
extern int propIntMax(int value1, int value2);
/** Creates a linearized representation of all of the properties.
* The returned buffer must be freed by the calling code. */
extern TCHAR *linearizeProperties(Properties *properties, TCHAR separator);
#endif
wrapper_3.5.51_src/src/c/resource.h 100644 0 0 667 14333053650 14351 0 ustar 0 0 //{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by Wrapper.rc
//
#define IDI_WRAPPER 102
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 106
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1002
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
wrapper_3.5.51_src/src/c/runnmake.bat 100644 0 0 1044 14333053647 14675 0 ustar 0 0 @echo off
setlocal
rem Copyright (c) 1999, 2022 Tanuki Software Inc.
rem
rem Java Service Wrapper windows build script. This script is designed to be
rem called by the ant build.xml file.
rem
rem %1 Makefile name
rem %2 Visual Studio environment script
rem %3 script argument
rem %4 script argument
rem %5 script argument
echo Configuring the Visual Studio environment...
echo call %2 %3 %4 %5
call %2 %3 %4 %5
echo Using SDK in %WindowsSdkDir%
echo.
echo Run the make file...
echo nmake /f %1 /c all
nmake /f %1 /c all
wrapper_3.5.51_src/src/c/test_example.c 100644 0 0 3007 14333053650 15216 0 ustar 0 0 /*
* Copyright (c) 1999, 2022 Tanuki Software, Ltd.
* http://www.tanukisoftware.com
* All rights reserved.
*
* This software is the proprietary information of Tanuki Software.
* You shall use it only in accordance with the terms of the
* license agreement you entered into with Tanuki Software.
* http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
*/
#include
#include
#include
#include "CUnit/Basic.h"
#include "property.h"
/********************************************************************
* Example Tests
*******************************************************************/
/**
* The suite initialization function.
* Opens the temporary file used by the tests.
* Returns zero on success, non-zero otherwise.
*/
int tsEX_init_suite1(void) {
return 0;
}
/**
* The suite cleanup function.
* Closes the temporary file used by the tests.
* Returns zero on success, non-zero otherwise.
*/
int tsEX_clean_suite1(void) {
return 0;
}
/**
* Simple test that passes.
*/
void tsEX_testPass(void) {
CU_ASSERT_EQUAL(0, 0);
}
/**
* Simple test that passes.
*/
void tsEX_testFail(void) {
CU_ASSERT_NOT_EQUAL(0, 1);
}
int tsEX_suiteExample() {
CU_pSuite exampleSuite;
exampleSuite = CU_add_suite("Example Suite", tsEX_init_suite1, tsEX_clean_suite1);
if (NULL == exampleSuite) {
return CU_get_error();
}
CU_add_test(exampleSuite, "Pass", tsEX_testPass);
CU_add_test(exampleSuite, "Fail", tsEX_testFail);
return FALSE;
}
wrapper_3.5.51_src/src/c/test_filter.c 100644 0 0 13063 14333053650 15073 0 ustar 0 0 /*
* Copyright (c) 1999, 2022 Tanuki Software, Ltd.
* http://www.tanukisoftware.com
* All rights reserved.
*
* This software is the proprietary information of Tanuki Software.
* You shall use it only in accordance with the terms of the
* license agreement you entered into with Tanuki Software.
* http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
*/
#include
#include
#include
#include "CUnit/Basic.h"
#include "logger.h"
#include "property.h"
#include "wrapper.h"
/********************************************************************
* Filter Tests
*******************************************************************/
#define TSFLTR_WORK_BUFFER_LEN 4096
TCHAR tsFLTR_workBuffer[TSFLTR_WORK_BUFFER_LEN];
void tsFLTR_dummyLogFileChanged(const TCHAR *logFile) {
}
int tsFLTR_init_wrapper(void) {
initLogging(tsFLTR_dummyLogFileChanged);
logRegisterThread(WRAPPER_THREAD_MAIN);
setLogfileLevelInt(LEVEL_NONE);
setConsoleLogFormat(TEXT("LPM"));
setConsoleLogLevelInt(LEVEL_DEBUG);
setConsoleFlush(TRUE);
setSyslogLevelInt(LEVEL_NONE);
return 0;
}
int tsFLTR_clean_wrapper(void) {
disposeLogging();
return 0;
}
void tsFLTR_subTestWrapperWildcardMatch(const TCHAR *pattern, const TCHAR *text, size_t expectedMinLen, int expectedMatch) {
size_t minLen;
int matched;
minLen = wrapperGetMinimumTextLengthForPattern(pattern);
if (minLen != expectedMinLen) {
_sntprintf(tsFLTR_workBuffer, TSFLTR_WORK_BUFFER_LEN, TEXT("wrapperGetMinimumTextLengthForPattern(\"%s\") returned %d rather than expected %d."), pattern, minLen, expectedMinLen);
_tprintf(TEXT("%s\n"), tsFLTR_workBuffer);
CU_FAIL(tsFLTR_workBuffer);
} else {
_sntprintf(tsFLTR_workBuffer, TSFLTR_WORK_BUFFER_LEN, TEXT("wrapperGetMinimumTextLengthForPattern(\"%s\") returned %d."), pattern, minLen);
CU_PASS(tsFLTR_workBuffer);
}
matched = wrapperWildcardMatch(text, pattern, expectedMinLen);
if (matched != expectedMatch) {
_sntprintf(tsFLTR_workBuffer, TSFLTR_WORK_BUFFER_LEN, TEXT("wrapperWildcardMatch(\"%s\", \"%s\", %d) returned %s rather than expected %s."),
text, pattern, expectedMinLen, (matched ? TEXT("TRUE") : TEXT("FALSE")), (expectedMatch ? TEXT("TRUE") : TEXT("FALSE")));
_tprintf(TEXT("%s\n"), tsFLTR_workBuffer);
CU_FAIL(tsFLTR_workBuffer);
} else {
_sntprintf(tsFLTR_workBuffer, TSFLTR_WORK_BUFFER_LEN, TEXT("wrapperWildcardMatch(\"%s\", \"%s\", %d) returned %s."),
text, pattern, expectedMinLen, (matched ? TEXT("TRUE") : TEXT("FALSE")));
CU_PASS(tsFLTR_workBuffer);
}
}
void tsFLTR_testWrapperWildcardMatch() {
tsFLTR_subTestWrapperWildcardMatch(TEXT("a"), TEXT("a"), 1, TRUE);
tsFLTR_subTestWrapperWildcardMatch(TEXT("a"), TEXT("b"), 1, FALSE);
tsFLTR_subTestWrapperWildcardMatch(TEXT("a"), TEXT(""), 1, FALSE);
tsFLTR_subTestWrapperWildcardMatch(TEXT("a"), TEXT("abc"), 1, TRUE);
tsFLTR_subTestWrapperWildcardMatch(TEXT("b"), TEXT("abc"), 1, TRUE);
tsFLTR_subTestWrapperWildcardMatch(TEXT("c"), TEXT("abc"), 1, TRUE);
tsFLTR_subTestWrapperWildcardMatch(TEXT("d"), TEXT("abc"), 1, FALSE);
tsFLTR_subTestWrapperWildcardMatch(TEXT("?"), TEXT("a"), 1, TRUE);
tsFLTR_subTestWrapperWildcardMatch(TEXT("?"), TEXT(""), 1, FALSE);
tsFLTR_subTestWrapperWildcardMatch(TEXT("*"), TEXT(""), 0, TRUE);
tsFLTR_subTestWrapperWildcardMatch(TEXT("*"), TEXT("a"), 0, TRUE);
tsFLTR_subTestWrapperWildcardMatch(TEXT("*"), TEXT("abc"), 0, TRUE);
tsFLTR_subTestWrapperWildcardMatch(TEXT("*a"), TEXT("a"), 1, TRUE);
tsFLTR_subTestWrapperWildcardMatch(TEXT("*a"), TEXT("abc"), 1, TRUE);
tsFLTR_subTestWrapperWildcardMatch(TEXT("*b"), TEXT("abc"), 1, TRUE);
tsFLTR_subTestWrapperWildcardMatch(TEXT("a*"), TEXT("a"), 1, TRUE);
tsFLTR_subTestWrapperWildcardMatch(TEXT("a*"), TEXT("abc"), 1, TRUE);
tsFLTR_subTestWrapperWildcardMatch(TEXT("b*"), TEXT("abc"), 1, TRUE);
tsFLTR_subTestWrapperWildcardMatch(TEXT("*a*"), TEXT("a"), 1, TRUE);
tsFLTR_subTestWrapperWildcardMatch(TEXT("*a*"), TEXT("abc"), 1, TRUE);
tsFLTR_subTestWrapperWildcardMatch(TEXT("*b*"), TEXT("abc"), 1, TRUE);
tsFLTR_subTestWrapperWildcardMatch(TEXT("HEAD*TAIL"), TEXT("This is the HEAD and this is the TAIL....."), 8, TRUE);
tsFLTR_subTestWrapperWildcardMatch(TEXT("HEAD**TAIL"), TEXT("This is the HEAD and this is the TAIL....."), 8, TRUE);
tsFLTR_subTestWrapperWildcardMatch(TEXT("*HEAD*TAIL*"), TEXT("This is the HEAD and this is the TAIL....."), 8, TRUE);
tsFLTR_subTestWrapperWildcardMatch(TEXT("HEAD*TAIL"), TEXT("This is the HEAD and this is the TaIL....."), 8, FALSE);
tsFLTR_subTestWrapperWildcardMatch(TEXT("HEAD**TAIL"), TEXT("This is the HEAD and this is the TaIL....."), 8, FALSE);
tsFLTR_subTestWrapperWildcardMatch(TEXT("*HEAD*TAIL*"), TEXT("This is the HEAD and this is the TaIL....."), 8, FALSE);
tsFLTR_subTestWrapperWildcardMatch(TEXT("HEAD*TA?L"), TEXT("This is the HEAD and this is the TAIL....."), 8, TRUE);
tsFLTR_subTestWrapperWildcardMatch(TEXT("HEAD**TA?L"), TEXT("This is the HEAD and this is the TAIL....."), 8, TRUE);
tsFLTR_subTestWrapperWildcardMatch(TEXT("*HEAD*TA?L*"), TEXT("This is the HEAD and this is the TAIL....."), 8, TRUE);
}
int tsFLTR_suiteFilter() {
CU_pSuite filterSuite;
filterSuite = CU_add_suite("Filter Suite", tsFLTR_init_wrapper, tsFLTR_clean_wrapper);
if (NULL == filterSuite) {
return CU_get_error();
}
CU_add_test(filterSuite, "wrapperWildcardMatch", tsFLTR_testWrapperWildcardMatch);
return FALSE;
}
wrapper_3.5.51_src/src/c/test_hashmap.c 100644 0 0 17174 14333053650 15236 0 ustar 0 0 /*
* Copyright (c) 1999, 2022 Tanuki Software, Ltd.
* http://www.tanukisoftware.com
* All rights reserved.
*
* This software is the proprietary information of Tanuki Software.
* You shall use it only in accordance with the terms of the
* license agreement you entered into with Tanuki Software.
* http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
*/
#include
#include
#include
#include "CUnit/Basic.h"
#include "logger.h"
#include "property.h"
#include "wrapper_hashmap.h"
/********************************************************************
* Hash Map Tests
*******************************************************************/
TCHAR *tsHASH_randomChars = TEXT("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-");
#define TSHASH_WORK_BUFFER_LEN 4096
TCHAR tsHASH_workBuffer[TSHASH_WORK_BUFFER_LEN];
int tsHASH_getRandom(int min, int max) {
int num;
int rNum;
num = max + 1 - min;
if (num <= 0) {
return min;
}
/* Some platforms use very large RAND_MAX values that cause overflow problems in our math */
if (RAND_MAX > 0x10000) {
rNum = (int)((rand() >> 8) * num / (RAND_MAX >> 8));
} else {
rNum = (int)(rand() * num / RAND_MAX);
}
return min + rNum;
}
/**
* Creates a string of random characters that is within the specified range of lengths.
* It is the responsibility of the caller to free up the string.
*
* @param minLen Minimum Length of the string.
* @param maxLen Maximum Length of the string.
*
* @return the requested string, or NULL if out of memory.
*/
TCHAR *tsHASH_buildRandomString(int minLen, int maxLen) {
int num;
int len;
TCHAR *str;
int i;
num = _tcslen(tsHASH_randomChars);
len = tsHASH_getRandom(minLen, maxLen);
str = malloc(sizeof(TCHAR) * (len + 1));
if (!str) {
return NULL;
}
for (i = 0; i < len; i++) {
str[i] = tsHASH_randomChars[tsHASH_getRandom(0, num - 1)];
}
str[len] = TEXT('\0');
return str;
}
/**
* Creates a string of random characters that is within the specified range of lengths.
* It is the responsibility of the caller to free up the string.
*
* @param minLen Minimum Length of the string.
* @param maxLen Maximum Length of the string.
*
* @return the requested string, or NULL if out of memory.
*/
TCHAR *tsHASH_buildRandomStringWithTail(int minLen, int maxLen, int tail) {
int num;
size_t len;
size_t strLen;
TCHAR *str;
size_t i;
TCHAR tailStr[32];
_sntprintf(tailStr, 32, TEXT("-%d"), tail);
num = _tcslen(tsHASH_randomChars);
len = tsHASH_getRandom(minLen, maxLen);
strLen = len + _tcslen(tailStr) + 1;
str = malloc(sizeof(TCHAR) * strLen);
if (!str) {
return NULL;
}
for (i = 0; i < len; i++) {
str[i] = tsHASH_randomChars[tsHASH_getRandom(0, num - 1)];
}
str[len] = TEXT('\0');
_tcsncat(str, tailStr, strLen);
return str;
}
/**
* Frees up an array and its contents. Depends on the values being NULL if they are not allocated.
*
* @param array Array to be freed.
*/
void tsHASH_freeTCHARArray(TCHAR **array, int len) {
int i;
if (array) {
for (i = 0; i < len; i++) {
if (array[i]) {
free(array[i]);
}
}
free(array);
}
}
void tsHASH_hashMapCommon(int buckets, int valueCount) {
PHashMap hashMap;
int i;
TCHAR **keys = NULL;
TCHAR **values = NULL;
const TCHAR *value;
hashMap = newHashMap(buckets);
if (valueCount > 0) {
keys = malloc(sizeof(TCHAR*) * valueCount);
if (!keys) {
CU_FAIL(TEXT("Out of memory HMC1"));
freeHashMap(hashMap);
return;
}
memset(keys, 0, sizeof(TCHAR*) * valueCount);
values = malloc(sizeof(TCHAR*) * valueCount);
if (!values) {
CU_FAIL(TEXT("Out of memory HMC2"));
tsHASH_freeTCHARArray(keys, valueCount);
freeHashMap(hashMap);
return;
}
memset(values, 0, sizeof(TCHAR*) * valueCount);
/* Generate and add key-value pairs. */
for (i = 0; i < valueCount; i++) {
keys[i] = tsHASH_buildRandomStringWithTail(1, 20, i);
if (!keys[i]) {
CU_FAIL(TEXT("Out of memory HMC3"));
tsHASH_freeTCHARArray(keys, valueCount);
tsHASH_freeTCHARArray(values, valueCount);
freeHashMap(hashMap);
return;
}
values[i] = tsHASH_buildRandomString(1, 255);
if (!values[i]) {
CU_FAIL(TEXT("Out of memory HMC3"));
tsHASH_freeTCHARArray(keys, valueCount);
tsHASH_freeTCHARArray(values, valueCount);
freeHashMap(hashMap);
return;
}
hashMapPutKWVW(hashMap, keys[i], values[i]);
}
#ifdef _DEBUG_HASHMAP
dumpHashMapStats(hashMap);
#endif
/* Now check to make sure all of the values were set correctly. */
for (i = 0; i < valueCount; i++) {
value = hashMapGetKWVW(hashMap, keys[i]);
if (value) {
if (_tcscmp(values[i], value) != 0) {
_sntprintf(tsHASH_workBuffer, TSHASH_WORK_BUFFER_LEN, TEXT("hashMapGetKWVW(map, \"%s\") returned \"%s\" rather than expected \"%s\"."), keys[i], value, values[i]);
_tprintf(TEXT("%s\n"), tsHASH_workBuffer);
CU_FAIL(tsHASH_workBuffer);
} else {
_sntprintf(tsHASH_workBuffer, TSHASH_WORK_BUFFER_LEN, TEXT("hashMapGetKWVW(map, \"%s\") returned \"%s\" as expected."), keys[i], value);
CU_PASS(tsHASH_workBuffer);
}
} else {
_sntprintf(tsHASH_workBuffer, TSHASH_WORK_BUFFER_LEN, TEXT("hashMapGetKWVW(map, \"%s\") returned NULL rather than expected \"%s\"."), keys[i], values[i]);
_tprintf(TEXT("%s\n"), tsHASH_workBuffer);
CU_FAIL(tsHASH_workBuffer);
}
}
/* Check for a value that will not be in the map. */
value = hashMapGetKWVW(hashMap, TEXT("$"));
if (value) {
_sntprintf(tsHASH_workBuffer, TSHASH_WORK_BUFFER_LEN, TEXT("hashMapGetKWVW(map, \"$\") returned \"%s\" rather than expected NULL."), value);
_tprintf(TEXT("%s\n"), tsHASH_workBuffer);
CU_FAIL(tsHASH_workBuffer);
} else {
_sntprintf(tsHASH_workBuffer, TSHASH_WORK_BUFFER_LEN, TEXT("hashMapGetKWVW(map, \"$\") returned NULL as expected."));
CU_PASS(tsHASH_workBuffer);
}
tsHASH_freeTCHARArray(keys, valueCount);
tsHASH_freeTCHARArray(values, valueCount);
}
freeHashMap(hashMap);
}
/**
* Make sure we can create and destroy an empty hash map.
*/
void tsHASH_testHashMapEmpty() {
tsHASH_hashMapCommon(100, 0);
}
/**
* Make sure we can create and destroy an sparsely filled hash map that has many empty buckets.
*/
void tsHASH_testHashMapSparse() {
tsHASH_hashMapCommon(100, 10);
}
/**
* Make sure we can create and destroy an sparsely filled hash map that has many empty buckets.
*/
void tsHASH_testHashMapLarge() {
tsHASH_hashMapCommon(100, 10000);
}
int tsHASH_suiteHashMap() {
CU_pSuite hashMapSuite;
hashMapSuite = CU_add_suite("HashMap Suite", NULL, NULL);
if (NULL == hashMapSuite) {
return CU_get_error();
}
CU_add_test(hashMapSuite, "empty HashMap", tsHASH_testHashMapEmpty);
CU_add_test(hashMapSuite, "sparce HashMap", tsHASH_testHashMapSparse);
CU_add_test(hashMapSuite, "large HashMap", tsHASH_testHashMapLarge);
return FALSE;
}
wrapper_3.5.51_src/src/c/test_javaadditionalparam.c 100644 0 0 3407 14333053650 17562 0 ustar 0 0 /*
* Copyright (c) 1999, 2022 Tanuki Software, Ltd.
* http://www.tanukisoftware.com
* All rights reserved.
*
* This software is the proprietary information of Tanuki Software.
* You shall use it only in accordance with the terms of the
* license agreement you entered into with Tanuki Software.
* http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
*/
#include
#include
#include
#include "CUnit/Basic.h"
#include "logger.h"
#include "property.h"
#include "wrapper.h"
/********************************************************************
* JavaAdditionalParam Utilities
*******************************************************************/
/* TODO: Currently the source of tsJAP_testJavaAdditionalParamSuite is in wrapper.c Should we move it in here? */
void tsJAP_dummyLogFileChanged(const TCHAR *logFile) {
}
int tsJAP_init_properties(void) {
initLogging(tsJAP_dummyLogFileChanged);
logRegisterThread(WRAPPER_THREAD_MAIN);
setLogfileLevelInt(LEVEL_NONE);
setConsoleLogFormat(TEXT("LPM"));
setConsoleLogLevelInt(LEVEL_DEBUG);
setConsoleFlush(TRUE);
setSyslogLevelInt(LEVEL_NONE);
properties = createProperties(FALSE, LEVEL_NONE, FALSE);
return properties ? 0 : 1;
}
int tsJAP_clean_properties(void) {
disposeLogging();
disposeProperties(properties);
return 0;
}
int tsJAP_suiteJavaAdditionalParam() {
CU_pSuite javaAdditionalParamSuite;
javaAdditionalParamSuite = CU_add_suite("Java Additional Parameter Suite", tsJAP_init_properties, tsJAP_clean_properties);
if (NULL == javaAdditionalParamSuite) {
return CU_get_error();
}
CU_add_test(javaAdditionalParamSuite, "loadJavaAdditionalCallback()", tsJAP_testJavaAdditionalParamSuite);
return FALSE;
}
wrapper_3.5.51_src/src/c/testsuite.c 100644 0 0 10460 14333053650 14576 0 ustar 0 0 /*
* Copyright (c) 1999, 2022 Tanuki Software, Ltd.
* http://www.tanukisoftware.com
* All rights reserved.
*
* This software is the proprietary information of Tanuki Software.
* You shall use it only in accordance with the terms of the
* license agreement you entered into with Tanuki Software.
* http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
*/
/* NOTES:
*
* See for ASSERTS:
* http://cunit.sourceforge.net/doc/writing_tests.html#tests
*/
#include
#include
#include
#include "CUnit/Automated.h"
#include "CUnit/Basic.h"
#include
#include "testsuite.h"
#include "logger.h"
/********************************************************************
* Main
*******************************************************************/
static void showHelp(TCHAR *app) {
_tprintf(TEXT("Wrapper testsuite help.\n"));
_tprintf(TEXT("%s \n"), app);
_tprintf(TEXT("\n"));
_tprintf(TEXT("Commands:\n"));
_tprintf(TEXT(" --basic : Runs all tests in basic mode. Only summaries visible.\n"));
_tprintf(TEXT(" --auto : Runs all tests in automatic mode. Output visible but results output to file.\n"));
_tprintf(TEXT(" See CUnitAutomated-Results.xml for results.\n"));
_tprintf(TEXT(" --console : Interactive mode.\n"));
_tprintf(TEXT(" --help : This help.\n"));
_tprintf(TEXT("\n"));
}
/* The main() function for setting up and running the tests.
* Returns a CUE_SUCCESS on successful running, another
* CUnit error code on failure.
*/
int main(int argc, char **cargv) {
TCHAR **argv;
int i;
size_t req;
int errorCode;
argv = malloc(argc * sizeof * argv);
if (!argv) {
_tprintf(TEXT("Out of Memory in Main\n"));
return 1;
}
for (i = 0; i < argc; i++) {
req = mbstowcs(NULL, cargv[i], MBSTOWCS_QUERY_LENGTH);
if (req == (size_t)-1) {
_tprintf(TEXT("Encoding problem with arguments in Main\n"));
while (--i > 0) {
free(argv[i]);
}
free(argv);
return 1;
}
argv[i] = malloc(sizeof(TCHAR) * (req + 1));
if (!argv[i]) {
_tprintf(TEXT("Out of Memory in Main\n"));
while (--i > 0) {
free(argv[i]);
}
free(argv);
return 1;
}
mbstowcs(argv[i], cargv[i], req + 1);
argv[i][req] = TEXT('\0'); /* Avoid bufferflows caused by badly encoded characters. */
}
/* Initialize the random seed. */
srand((unsigned)time(NULL));
/* initialize the CUnit test registry */
if (CUE_SUCCESS != CU_initialize_registry())
{
errorCode = CU_get_error();
goto error;
}
/* add a suite to the registry */
if (tsEX_suiteExample()) {
CU_cleanup_registry();
errorCode = CU_get_error();
goto error;
}
if (tsFLTR_suiteFilter()) {
CU_cleanup_registry();
errorCode = CU_get_error();
goto error;
}
if (tsJAP_suiteJavaAdditionalParam()) {
CU_cleanup_registry();
errorCode = CU_get_error();
goto error;
}
if (tsHASH_suiteHashMap()) {
CU_cleanup_registry();
errorCode = CU_get_error();
goto error;
}
if (argc < 2) {
showHelp(argv[0]);
errorCode = 1;
} else if (strcmpIgnoreCase(argv[1], TEXT("--basic")) == 0) {
/* Run all tests using the CUnit Basic interface */
CU_set_output_filename("testsuite");
CU_basic_set_mode(CU_BRM_VERBOSE);
CU_basic_run_tests();
CU_cleanup_registry();
errorCode = CU_get_error();
} else if (strcmpIgnoreCase(argv[1], TEXT("--auto")) == 0) {
/* Run all tests using the CUnit Automated interface */
CU_list_tests_to_file();
CU_automated_run_tests();
CU_cleanup_registry();
errorCode = CU_get_error();
} else if (strcmpIgnoreCase(argv[1], TEXT("--console")) == 0) {
/* Run all tests using the CUnit Console interface */
CU_console_run_tests();
CU_cleanup_registry();
errorCode = CU_get_error();
} else {
showHelp(argv[0]);
errorCode = 1;
}
error:
for (i = 0; i < argc; i++) {
free(argv[i]);
}
free(argv);
return errorCode;
}
wrapper_3.5.51_src/src/c/testsuite.h 100644 0 0 1160 14333053650 14560 0 ustar 0 0 /*
* Copyright (c) 1999, 2022 Tanuki Software, Ltd.
* http://www.tanukisoftware.com
* All rights reserved.
*
* This software is the proprietary information of Tanuki Software.
* You shall use it only in accordance with the terms of the
* license agreement you entered into with Tanuki Software.
* http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
*/
#ifndef _TESTSUITE_H
#define _TESTSUITE_H
#include "CUnit/Basic.h"
#include "wrapper_i18n.h"
extern int tsEX_suiteExample();
extern int tsFLTR_suiteFilter();
extern int tsJAP_suiteJavaAdditionalParam();
extern int tsHASH_suiteHashMap();
#endif
wrapper_3.5.51_src/src/c/wrapper.c 100644 0 0 1642110 14333053650 14271 0 ustar 0 0 /*
* Copyright (c) 1999, 2022 Tanuki Software, Ltd.
* http://www.tanukisoftware.com
* All rights reserved.
*
* This software is the proprietary information of Tanuki Software.
* You shall use it only in accordance with the terms of the
* license agreement you entered into with Tanuki Software.
* http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
*
*
* Portions of the Software have been derived from source code
* developed by Silver Egg Technology under the following license:
*
* Copyright (c) 2001 Silver Egg Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sub-license, and/or
* sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*/
/**
* Author:
* Leif Mortenson
* Ryan Shaw
*/
#ifdef WIN32
/* need the 2 following includes to use IPv6 and need wsock32.lib in the makefile */
#include
#include
#include
#endif
#include
#include
#include
#include
#include
#include
#include
#ifdef CUNIT
#include "CUnit/Basic.h"
#endif
#include "wrapper_i18n.h"
#include "wrapperinfo.h"
#include "wrapper.h"
#include "logger.h"
#include "logger_file.h"
#include "wrapper_jvminfo.h"
#include "wrapper_encoding.h"
#include "wrapper_file.h"
#ifndef WIN32
#include "wrapper_ulimit.h"
#endif
#ifdef WIN32
#include
#include
#include
#include
#include
#include
/* MS Visual Studio 8 went and deprecated the POXIX names for functions.
* Fixing them all would be a big headache for UNIX versions. */
#pragma warning(disable : 4996)
/* Defines for MS Visual Studio 6 */
#ifndef _INTPTR_T_DEFINED
typedef long intptr_t;
#define _INTPTR_T_DEFINED
#endif
#else /* UNIX */
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define SOCKET int
#define HANDLE int
#define INVALID_HANDLE_VALUE -1
#define INVALID_SOCKET -1
#define SOCKET_ERROR -1
#if defined(SOLARIS)
#include
#include
#elif defined(AIX) || defined(HPUX) || defined(MACOSX)
#elif defined(FREEBSD)
#include
#include
#else /* LINUX */
#include
#endif
#endif /* WIN32 */
/* Define some common defines to make cross platform code a bit cleaner. */
#ifdef WIN32
#define WRAPPER_EADDRINUSE WSAEADDRINUSE
#define WRAPPER_EWOULDBLOCK WSAEWOULDBLOCK
#define WRAPPER_EACCES WSAEACCES
#else
#define WRAPPER_EADDRINUSE EADDRINUSE
#define WRAPPER_EWOULDBLOCK EWOULDBLOCK
#define WRAPPER_EACCES EACCES
#endif
WrapperConfig *wrapperData;
char packetBufferMB[MAX_LOG_SIZE + 1];
TCHAR packetBufferW[MAX_LOG_SIZE + 1];
TCHAR *keyChars = TEXT("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-");
/* Properties structure loaded in from the configuration file. */
Properties *properties = NULL;
/* Mutex for synchronization of the tick timer. */
#ifdef WIN32
HANDLE tickMutexHandle = NULL;
#else
pthread_mutex_t tickMutex = PTHREAD_MUTEX_INITIALIZER;
#endif
/* Server Pipe Handles. */
HANDLE protocolActiveServerPipeIn = INVALID_HANDLE_VALUE;
HANDLE protocolActiveServerPipeOut = INVALID_HANDLE_VALUE;
/* Flag for indicating the connected pipes */
int protocolActiveServerPipeConnected = FALSE;
/* Server Socket. */
SOCKET protocolActiveServerSD = INVALID_SOCKET;
/* Client Socket. */
SOCKET protocolActiveBackendSD = INVALID_SOCKET;
#ifndef IN6ADDR_LOOPBACK_INIT
/* even if I include ws2ipdef.h, it doesn't define IN6ADDR_LOOPBACK_INIT,
so that's why I define it here */
#define IN6ADDR_LOOPBACK_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 }
#endif
#define LOOPBACK_IPv4 "127.0.0.1"
#ifdef HPUX_IA
/* on HPUX ia, gcc reports a warning "missing braces around initializer"
when using IN6ADDR_LOOPBACK_INIT (/usr/include/netinet/in6.h:241).
So I add braces for the struct and braces for the union. */
struct in6_addr LOOPBACK_IPv6 = {{IN6ADDR_LOOPBACK_INIT}};
#else
struct in6_addr LOOPBACK_IPv6 = IN6ADDR_LOOPBACK_INIT;
#endif
int disposed = FALSE;
int handleSignals = TRUE;
int loadConfiguration();
#define READ_BUFFER_BLOCK_SIZE 1024
static char *wrapperChildWorkBuffer = NULL;
static size_t wrapperChildWorkBufferSize = 0;
static size_t wrapperChildWorkBufferLen = 0;
static time_t wrapperChildWorkLastDataTime = 0;
static int wrapperChildWorkLastDataTimeMillis = 0;
static int wrapperChildWorkIsNewLine = TRUE;
/**
* Constructs a tm structure from a pair of Strings like "20091116" and "1514".
* The time returned will be in the local time zone. This is not 100% accurate
* as it doesn't take into account the time zone in which the dates were
* originally set.
*/
struct tm getInfoTime(const TCHAR *date, const TCHAR *time) {
struct tm buildTM;
TCHAR temp[5];
memset(&buildTM, 0, sizeof(struct tm));
/* Year */
_tcsncpy( temp, date, 4 );
temp[4] = 0;
buildTM.tm_year = _ttoi( temp ) - 1900;
/* Month */
_tcsncpy( temp, date + 4, 2 );
temp[2] = 0;
buildTM.tm_mon = _ttoi( temp ) - 1;
/* Day */
_tcsncpy( temp, date + 6, 2 );
temp[2] = 0;
buildTM.tm_mday = _ttoi( temp );
/* Hour */
_tcsncpy( temp, time, 2 );
temp[2] = 0;
buildTM.tm_hour = _ttoi( temp );
/* Minute */
_tcsncpy( temp, time + 2, 2 );
temp[2] = 0;
buildTM.tm_min = _ttoi( temp );
return buildTM;
}
struct tm wrapperGetReleaseTime() {
return getInfoTime(wrapperReleaseDate, wrapperReleaseTime);
}
struct tm wrapperGetBuildTime() {
return getInfoTime(wrapperBuildDate, wrapperBuildTime);
}
/**
* Adds default properties used to set global environment variables.
*
* These are done by setting properties rather than call setEnv directly
* so that it will be impossible for users to override their values by
* creating a "set.XXX=NNN" property in the configuration file.
*/
void wrapperAddDefaultProperties(Properties *props) {
TCHAR buffer[11]; /* should be large enough to contain the pid and lang (increase the buffer size if more variables are needed) */
TCHAR* confDirTemp;
#ifdef WIN32
int work, pos2;
TCHAR pathSep = TEXT('\\');
#else
TCHAR pathSep = TEXT('/');
#endif
int pos;
#ifdef WIN32
const TCHAR* fileSeparator = TEXT("\\");
const TCHAR* pathSeparator = TEXT(";");
#else
const TCHAR* fileSeparator = TEXT("/");
const TCHAR* pathSeparator = TEXT(":");
#endif
if (wrapperData->confDir == NULL) {
if (_tcsrchr(wrapperData->argConfFile, pathSep) != NULL) {
pos = (int)(_tcsrchr(wrapperData->argConfFile, pathSep) - wrapperData->argConfFile);
} else {
pos = -1;
}
#ifdef WIN32
if (_tcsrchr(wrapperData->argConfFile, TEXT('/')) != NULL) {
pos2 = (int)(_tcsrchr(wrapperData->argConfFile, TEXT('/')) - wrapperData->argConfFile);
} else {
pos2 = -1;
}
pos = __max(pos, pos2);
#endif
if (pos == -1) {
confDirTemp = malloc(sizeof(TCHAR) * 2);
if (!confDirTemp) {
outOfMemory(TEXT("WADP"), 1);
return;
}
_tcsncpy(confDirTemp, TEXT("."), 2);
} else if (pos == 0) {
confDirTemp = malloc(sizeof(TCHAR) * 2);
if (!confDirTemp) {
outOfMemory(TEXT("WADP"), 2);
return;
}
_sntprintf(confDirTemp, 2, TEXT("%c"), pathSep);
} else {
confDirTemp = malloc(sizeof(TCHAR) * (pos + 1));
if (!confDirTemp) {
outOfMemory(TEXT("WADP"), 3);
return;
}
_tcsncpy(confDirTemp, wrapperData->argConfFile, pos);
confDirTemp[pos] = TEXT('\0');
}
#ifdef WIN32
/* Get buffer size, including '\0' */
work = GetFullPathName(confDirTemp, 0, NULL, NULL);
if (!work) {
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_FATAL,
TEXT("Unable to resolve the conf directory: %s"), getLastErrorText());
free(confDirTemp);
return;
}
wrapperData->confDir = malloc(sizeof(TCHAR) * work);
if (!wrapperData->confDir) {
outOfMemory(TEXT("WADP"), 4);
free(confDirTemp);
return;
}
if (!GetFullPathName(confDirTemp, work, wrapperData->confDir, NULL)) {
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_FATAL,
TEXT("Unable to resolve the conf directory: %s"), getLastErrorText());
free(confDirTemp);
return;
}
#else
/* The solaris implementation of realpath will return a relative path if a relative
* path is provided. We always need an absolute path here. So build up one and
* then use realpath to remove any .. or other relative references. */
wrapperData->confDir = malloc(sizeof(TCHAR) * (PATH_MAX + 1));
if (!wrapperData->confDir) {
outOfMemory(TEXT("WADP"), 5);
free(confDirTemp);
return;
}
if (_trealpathN(confDirTemp, wrapperData->confDir, PATH_MAX + 1) == NULL) {
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_FATAL,
TEXT("Unable to resolve the original working directory: %s"), getLastErrorText());
free(confDirTemp);
return;
}
#endif
setEnv(TEXT("WRAPPER_CONF_DIR"), wrapperData->confDir, ENV_SOURCE_APPLICATION);
free(confDirTemp);
}
_sntprintf(buffer, 3, TEXT("en"));
setInternalVarProperty(props, TEXT("WRAPPER_LANG"), buffer, TRUE, FALSE);
_sntprintf(buffer, 11, TEXT("%d"), wrapperData->wrapperPID);
setInternalVarProperty(props, TEXT("WRAPPER_PID"), buffer, TRUE, FALSE);
setInternalVarProperty(props, TEXT("WRAPPER_BASE_NAME"), wrapperData->baseName, TRUE, FALSE);
setInternalVarProperty(props, TEXT("WRAPPER_BITS"), wrapperBits, TRUE, FALSE);
setInternalVarProperty(props, TEXT("WRAPPER_ARCH"), wrapperArch, TRUE, FALSE);
setInternalVarProperty(props, TEXT("WRAPPER_OS"), wrapperOS, TRUE, FALSE);
setInternalVarProperty(props, TEXT("WRAPPER_VERSION"), wrapperVersionRoot, TRUE, FALSE);
setInternalVarProperty(props, TEXT("WRAPPER_EDITION"), TEXT("Community"), TRUE, FALSE);
setInternalVarProperty(props, TEXT("WRAPPER_HOSTNAME"), wrapperData->hostName, TRUE, FALSE);
setInternalVarProperty(props, TEXT("WRAPPER_HOST_NAME"), wrapperData->hostName, TRUE, FALSE);
setInternalVarProperty(props, TEXT("WRAPPER_RUN_MODE"), wrapperData->isConsole ? TEXT("console") : TEXT("service"), TRUE, FALSE);
setInternalVarProperty(props, TEXT("WRAPPER_FILE_SEPARATOR"), fileSeparator, TRUE, FALSE);
setInternalVarProperty(props, TEXT("WRAPPER_PATH_SEPARATOR"), pathSeparator, TRUE, FALSE);
/* These variables don't need be set as an environment variables, but we should still register them to prevent users from defining them on their own. */
setInternalVarProperty(props, TEXT("WRAPPER_PERCENTAGE"), NULL, TRUE, FALSE);
setInternalVarProperty(props, TEXT("WRAPPER_RAND_N"), NULL, TRUE, FALSE);
setInternalVarProperty(props, TEXT("WRAPPER_RAND_NN"), NULL, TRUE, FALSE);
setInternalVarProperty(props, TEXT("WRAPPER_RAND_NNN"), NULL, TRUE, FALSE);
setInternalVarProperty(props, TEXT("WRAPPER_RAND_NNNN"), NULL, TRUE, FALSE);
setInternalVarProperty(props, TEXT("WRAPPER_RAND_NNNNN"), NULL, TRUE, FALSE);
setInternalVarProperty(props, TEXT("WRAPPER_RAND_NNNNNN"), NULL, TRUE, FALSE);
/* NOTE: currently possible for the user to set WRAPPER_SYSTEM_