link start!

This commit is contained in:
cherubin
2026-03-17 13:31:18 -07:00
commit 08abe87cfb
5910 changed files with 386288 additions and 0 deletions
@@ -0,0 +1,548 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.sys.station.Station
* com.tridium.sys.station.Station$SaveListener
* javax.baja.file.FileUtil
* javax.baja.nre.util.Array
* javax.baja.spy.SpyWriter
* javax.baja.sys.Action
* javax.baja.sys.BComponent
* javax.baja.sys.BFacets
* javax.baja.sys.BInteger
* javax.baja.sys.BRelTime
* javax.baja.sys.BString
* javax.baja.sys.BValue
* javax.baja.sys.Clock
* javax.baja.sys.Context
* javax.baja.sys.Property
* javax.baja.sys.ServiceNotFoundException
* javax.baja.sys.SlotCursor
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform.qnx;
import com.tridium.platform.BOperatingSystemEnum;
import com.tridium.platform.BSystemPlatformService;
import com.tridium.platform.ntp.BNtpPlatformService;
import com.tridium.platform.ntp.BNtpServer;
import com.tridium.platform.ntp.BNtpServerVector;
import com.tridium.platform.posix.NtpConfUtil;
import com.tridium.platform.qnx.BNtpServerQnx;
import com.tridium.platform.qnx.BSystemPlatformServiceQnx;
import com.tridium.sys.station.Station;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import javax.baja.file.FileUtil;
import javax.baja.nre.util.Array;
import javax.baja.spy.SpyWriter;
import javax.baja.sys.Action;
import javax.baja.sys.BComponent;
import javax.baja.sys.BFacets;
import javax.baja.sys.BInteger;
import javax.baja.sys.BRelTime;
import javax.baja.sys.BString;
import javax.baja.sys.BValue;
import javax.baja.sys.Clock;
import javax.baja.sys.Context;
import javax.baja.sys.Property;
import javax.baja.sys.ServiceNotFoundException;
import javax.baja.sys.SlotCursor;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BNtpPlatformServiceQnx
extends BNtpPlatformService {
public static final Property timeServers = BNtpPlatformServiceQnx.newProperty((int)3, (BValue)new BNtpServerVector(), (BFacets)BFacets.make((String)"elementType", (String)"platform:NtpServerQnx"));
public static final Property statistics = BNtpPlatformServiceQnx.newProperty((int)3, (boolean)false, null);
public static final Property ntp = BNtpPlatformServiceQnx.newProperty((int)3, (boolean)true, null);
public static final Property localBackup = BNtpPlatformServiceQnx.newProperty((int)3, (boolean)true, null);
public static final Property panic = BNtpPlatformServiceQnx.newProperty((int)7, (int)(BOperatingSystemEnum.isOS(BOperatingSystemEnum.qnx) ? 0 : 1000), null);
public static final Property syncAtBoot = BNtpPlatformServiceQnx.newProperty((int)3, (boolean)false, null);
public static final Action syncRTC = BNtpPlatformServiceQnx.newAction((int)4, null);
public static final Action syncNow = BNtpPlatformServiceQnx.newAction((int)0, (BValue)BString.DEFAULT, null);
public static final Type TYPE;
protected boolean allowUpdate;
private final NtpServiceSaveListener saveListener;
static /* synthetic */ Class class$com$tridium$platform$qnx$BNtpPlatformServiceQnx;
static /* synthetic */ Class class$java$lang$String;
public boolean getStatistics() {
return this.getBoolean(statistics);
}
public void setStatistics(boolean bl) {
this.setBoolean(statistics, bl, null);
}
public boolean getNtp() {
return this.getBoolean(ntp);
}
public void setNtp(boolean bl) {
this.setBoolean(ntp, bl, null);
}
public boolean getLocalBackup() {
return this.getBoolean(localBackup);
}
public void setLocalBackup(boolean bl) {
this.setBoolean(localBackup, bl, null);
}
public int getPanic() {
return this.getInt(panic);
}
public void setPanic(int n) {
this.setInt(panic, n, null);
}
public boolean getSyncAtBoot() {
return this.getBoolean(syncAtBoot);
}
public void setSyncAtBoot(boolean bl) {
this.setBoolean(syncAtBoot, bl, null);
}
public BInteger syncRTC() {
return (BInteger)this.invoke(syncRTC, null, null);
}
public BInteger syncNow(BString bString) {
return (BInteger)this.invoke(syncNow, (BValue)bString, null);
}
public Type getType() {
return TYPE;
}
public final void stationStarted() throws Exception {
Station.addSaveListener((Station.SaveListener)this.saveListener);
if (this.isServiceStarted()) {
Clock.schedulePeriodically((BComponent)this, (BRelTime)BRelTime.makeHours((int)6), (Action)syncRTC, null);
}
}
public final void serviceStopped() throws Exception {
super.serviceStopped();
Station.removeSaveListener((Station.SaveListener)this.saveListener);
}
public boolean isValidPlatform() {
return BOperatingSystemEnum.isOS(BOperatingSystemEnum.qnx);
}
public int getSlotFlags() {
return 0;
}
public void loadPlatformServiceProperties() {
super.loadPlatformServiceProperties();
this.allowUpdate = false;
this.setEnabled(NtpConfUtil.isEnabled());
this.setPanic(NtpConfUtil.getPanic());
this.setSyncAtBoot(NtpConfUtil.getSyncAtBoot());
String string = NtpConfUtil.getDisabledString();
boolean bl = false;
if (string.indexOf("ntp") == -1) {
bl = true;
}
this.setNtp(bl);
this.setLocalBackup(NtpConfUtil.getUseLocalBackup());
boolean bl2 = false;
if (string.indexOf("stats") == -1) {
bl2 = true;
}
this.setStatistics(bl2);
this.getTimeServers().sync(NtpConfUtil.getNtpServers());
this.allowUpdate = true;
}
public void doPoll(Context context) {
super.doPoll(context);
if (!this.isRunning()) {
return;
}
this.allowUpdate = false;
this.setEnabled(NtpConfUtil.isEnabled());
this.setPanic(NtpConfUtil.getPanic());
this.setSyncAtBoot(NtpConfUtil.getSyncAtBoot());
String string = NtpConfUtil.getDisabledString();
boolean bl = false;
if (string.indexOf("ntp") == -1) {
bl = true;
}
this.setNtp(bl);
this.setLocalBackup(NtpConfUtil.getUseLocalBackup());
boolean bl2 = false;
if (string.indexOf("stats") == -1) {
bl2 = true;
}
this.setStatistics(bl2);
this.getTimeServers().sync(NtpConfUtil.getNtpServers());
this.allowUpdate = true;
}
public void doSavePlatformServiceProperties() throws Exception {
if (!this.isRunning()) {
return;
}
super.doSavePlatformServiceProperties();
NtpConfUtil.setEnabled(this.getEnabled());
NtpConfUtil.setPanic(this.getPanic());
NtpConfUtil.setSyncAtBoot(this.getSyncAtBoot());
StringBuffer stringBuffer = new StringBuffer("enable");
StringBuffer stringBuffer2 = new StringBuffer("disable");
(this.getNtp() ? stringBuffer : stringBuffer2).append(" ntp");
(this.getStatistics() ? stringBuffer : stringBuffer2).append(" stats");
NtpConfUtil.setEnabledString(stringBuffer.toString());
NtpConfUtil.setDisabledString(stringBuffer2.toString());
Class clazz = class$java$lang$String;
if (clazz == null) {
clazz = class$java$lang$String = BNtpPlatformServiceQnx.class("[Ljava.lang.String;", false);
}
Array array = new Array(clazz);
SlotCursor slotCursor = this.getTimeServers().getProperties();
while (slotCursor.next()) {
array.add((Object)((BNtpServer)slotCursor.get()).getServerString());
}
NtpConfUtil.setNtpServers((String[])array.trim());
NtpConfUtil.setLocalBackup(this.getLocalBackup());
NtpConfUtil.write();
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public void spy(SpyWriter spyWriter) throws Exception {
Process process;
Object var6_13;
super.spy(spyWriter);
if (!BOperatingSystemEnum.isOS(BOperatingSystemEnum.qnx)) {
return;
}
BufferedReader bufferedReader = null;
BufferedReader bufferedReader2 = null;
String string = null;
spyWriter.startTable(false);
spyWriter.trTitle((Object)"NTP Configuration File", 1);
try {
try {
bufferedReader = new BufferedReader(new FileReader("/niagara/lib/ntp.conf"));
while ((string = bufferedReader.readLine()) != null) {
spyWriter.tr((Object)string.trim());
}
}
catch (IOException iOException) {
spyWriter.tr((Object)("Error reading /niagara/lib/ntp.conf: " + iOException.getMessage()));
}
var6_13 = null;
}
catch (Throwable throwable) {
Object var6_12 = null;
try {
bufferedReader.close();
throw throwable;
}
catch (Exception exception) {}
throw throwable;
}
try {}
catch (Exception exception) {}
bufferedReader.close();
spyWriter.endTable();
spyWriter.startTable(true);
spyWriter.trTitle((Object)"NTP Daemon Log", 1);
try {
try {
process = Runtime.getRuntime().exec("/proc/boot/slogin");
bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
while ((string = bufferedReader.readLine()) != null) {
if (string.indexOf("ntpd") == -1) continue;
spyWriter.tr((Object)string.trim());
}
}
catch (IOException iOException) {
spyWriter.tr((Object)("Error reading NTP Daemon Log: " + iOException.getMessage()));
}
var6_13 = null;
}
catch (Throwable throwable) {
var6_13 = null;
try {
bufferedReader.close();
throw throwable;
}
catch (IOException iOException) {}
throw throwable;
}
try {}
catch (IOException iOException) {}
bufferedReader.close();
spyWriter.endTable();
spyWriter.startTable(true);
spyWriter.trTitle((Object)"NTP Daemon Drift", 1);
try {
block57: {
try {
bufferedReader = new BufferedReader(new FileReader("/var/run/ntp.drift.TEMP"));
while ((string = bufferedReader.readLine()) != null) {
spyWriter.tr((Object)string.trim());
}
break block57;
}
catch (IOException iOException) {
try {
try {
bufferedReader2 = new BufferedReader(new FileReader("/var/run/ntp.drift"));
while ((string = bufferedReader2.readLine()) != null) {
spyWriter.tr((Object)string.trim());
}
}
catch (IOException iOException2) {
spyWriter.tr((Object)("Error reading /var/run/ntp.drift: " + iOException.getMessage()));
}
Object var10_17 = null;
}
catch (Throwable throwable) {
Object var10_16 = null;
try {
bufferedReader2.close();
throw throwable;
}
catch (Exception exception) {}
throw throwable;
}
}
try {}
catch (Exception exception) {}
bufferedReader2.close();
}
var6_13 = null;
}
catch (Throwable throwable) {
var6_13 = null;
try {
bufferedReader.close();
throw throwable;
}
catch (Exception exception) {}
throw throwable;
}
try {}
catch (Exception exception) {}
bufferedReader.close();
spyWriter.endTable();
if (!this.getStatistics()) return;
spyWriter.startTable(true);
spyWriter.trTitle((Object)"NTP Daemon Clock Stats", 1);
spyWriter.tr((Object)"Modified Julian Day | Secs. Past UTC Midnight | Clock Address | Last Time Code");
try {
try {
bufferedReader = new BufferedReader(new FileReader("/var/run/ntpdstats/clockstats"));
while ((string = bufferedReader.readLine()) != null) {
spyWriter.tr((Object)string.trim());
}
}
catch (IOException iOException) {
spyWriter.tr((Object)("Error reading /var/run/ntpdstats/clockstats: " + iOException.getMessage()));
}
process = null;
}
catch (Throwable throwable) {
process = null;
try {
bufferedReader.close();
throw throwable;
}
catch (IOException iOException) {}
throw throwable;
}
try {}
catch (IOException iOException) {}
bufferedReader.close();
spyWriter.endTable();
spyWriter.startTable(true);
spyWriter.trTitle((Object)"NTP Daemon Loop Stats", 1);
spyWriter.tr((Object)"Modified Julian Day | Secs. Past UTC Midnight | Time Offset Secs. | Drift Compenstation | Estimated Error | Stability | Polling Interval");
try {
try {
bufferedReader = new BufferedReader(new FileReader("/var/run/ntpdstats/loopstats"));
while ((string = bufferedReader.readLine()) != null) {
spyWriter.tr((Object)string.trim());
}
}
catch (IOException iOException) {
spyWriter.tr((Object)("Error reading /var/run/ntpdstats/loopstats: " + iOException.getMessage()));
}
process = null;
}
catch (Throwable throwable) {
process = null;
try {
bufferedReader.close();
throw throwable;
}
catch (IOException iOException) {}
throw throwable;
}
try {}
catch (IOException iOException) {}
bufferedReader.close();
spyWriter.endTable();
}
public BInteger doSyncNow(BString bString) {
Object object;
if (!new File("/proc/boot/ntpdate").exists()) {
return BInteger.make((int)2);
}
String string = null;
String string2 = null;
String string3 = null;
if (bString != null && bString.toString().trim().length() > 0) {
string = bString.toString().trim();
} else {
object = this.getTimeServers().getProperties();
while (object.next()) {
if (!((BNtpServerQnx)object.get()).getServerPreferred()) continue;
string2 = ((BNtpServerQnx)object.get()).getAddress().trim();
break;
}
if (string2 == null) {
object = this.getTimeServers().getProperties();
while (object.next()) {
if (((BNtpServerQnx)object.get()).getPeerMode().getOrdinal() != 2 && ((BNtpServerQnx)object.get()).getPeerMode().getOrdinal() != 1) continue;
string3 = ((BNtpServerQnx)object.get()).getAddress().trim();
break;
}
}
if (string2 != null) {
string = string2;
} else if (string3 != null) {
string = string3;
} else {
return BInteger.make((int)1);
}
}
object = new DoSyncThread();
DoSyncThread.targetServer = string;
((Thread)object).setDaemon(true);
((Thread)object).start();
return BInteger.make((int)0);
}
public BInteger doSyncRTC() {
if (NtpConfUtil.isEnabled()) {
try {
BSystemPlatformServiceQnx bSystemPlatformServiceQnx = (BSystemPlatformServiceQnx)Sys.getService((Type)BSystemPlatformService.TYPE);
bSystemPlatformServiceQnx.setPlatformSystemTime(0L);
}
catch (ServiceNotFoundException serviceNotFoundException) {
serviceNotFoundException.printStackTrace();
return BInteger.make((int)-1);
}
}
return BInteger.make((int)0);
}
static /* synthetic */ Class class(String string, boolean bl) {
try {
Class<?> clazz = Class.forName(string);
if (!bl) {
clazz = clazz.getComponentType();
}
return clazz;
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
private final /* synthetic */ void this() {
this.allowUpdate = true;
this.saveListener = new NtpServiceSaveListener();
}
public BNtpPlatformServiceQnx() {
this.this();
}
static {
Class clazz = class$com$tridium$platform$qnx$BNtpPlatformServiceQnx;
if (clazz == null) {
clazz = class$com$tridium$platform$qnx$BNtpPlatformServiceQnx = BNtpPlatformServiceQnx.class("[Lcom.tridium.platform.qnx.BNtpPlatformServiceQnx;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
public static class DoSyncThread
extends Thread {
public static String targetServer;
public void run() {
try {
String string = "/proc/boot/ntpdate -u -s " + targetServer;
Runtime.getRuntime().exec(string);
}
catch (Exception exception) {}
}
public DoSyncThread() {
super("NtpPlatformService:DoSyncThread");
}
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
private final class NtpServiceSaveListener
implements Station.SaveListener {
public final void stationSave() {
try {
File file = new File("/var/run/ntp.drift");
File file2 = new File("/var/run/ntp.drift.TEMP");
File file3 = new File("/var/run/ntp.drift");
if (file.exists()) {
FileUtil.delete((File)file);
}
if (file2.exists()) {
FileUtil.copy((File)file2, (File)file);
} else if (file3.exists()) {
FileUtil.copy((File)file3, (File)file);
}
BNtpPlatformServiceQnx.this.syncRTC();
}
catch (Exception exception) {
exception.printStackTrace();
}
}
public final void stationSaveOk() {
}
public final void stationSaveFail(String string) {
}
public final String toString() {
return "NtpServiceSaveListener " + BNtpPlatformServiceQnx.this.getNavOrd();
}
private NtpServiceSaveListener() {
}
}
}
@@ -0,0 +1,231 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.data.BIDataValue
* javax.baja.naming.SlotPath
* javax.baja.sys.BEnumRange
* javax.baja.sys.BFacets
* javax.baja.sys.BInteger
* javax.baja.sys.BValue
* javax.baja.sys.Context
* javax.baja.sys.Property
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform.qnx;
import com.tridium.platform.ntp.BNtpPlatformService;
import com.tridium.platform.ntp.BNtpServer;
import com.tridium.platform.posix.BNtpModePosix;
import java.util.StringTokenizer;
import javax.baja.data.BIDataValue;
import javax.baja.naming.SlotPath;
import javax.baja.sys.BEnumRange;
import javax.baja.sys.BFacets;
import javax.baja.sys.BInteger;
import javax.baja.sys.BValue;
import javax.baja.sys.Context;
import javax.baja.sys.Property;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BNtpServerQnx
extends BNtpServer {
public static final Property useBurst = BNtpServerQnx.newProperty((int)3, (boolean)false, null);
public static final Property serverPreferred = BNtpServerQnx.newProperty((int)3, (boolean)false, null);
public static final Property minPollInterval = BNtpServerQnx.newProperty((int)3, (int)6, (BFacets)BFacets.make((String[])new String[]{"min", "max", "fieldWidth", "units"}, (BIDataValue[])new BIDataValue[]{BInteger.make((int)4), BInteger.make((int)16), BInteger.make((int)3), BNtpPlatformService.LOG_2_SEC_UNIT}));
public static final Property maxPollInterval = BNtpServerQnx.newProperty((int)3, (int)10, (BFacets)BFacets.make((String[])new String[]{"min", "max", "fieldWidth", "units"}, (BIDataValue[])new BIDataValue[]{BInteger.make((int)5), BInteger.make((int)17), BInteger.make((int)3), BNtpPlatformService.LOG_2_SEC_UNIT}));
public static final Property peerMode = BNtpServerQnx.newProperty((int)3, (BValue)BNtpModePosix.server, (BFacets)BFacets.make((String)"range", (BIDataValue)BEnumRange.make(null, (int[])new int[]{2, 1, 3, 4}, (String[])new String[]{BNtpModePosix.server.getTag(), BNtpModePosix.peer.getTag(), BNtpModePosix.broadcast.getTag(), BNtpModePosix.manycastclient.getTag()})));
public static final Type TYPE;
protected String serverString;
static /* synthetic */ Class class$com$tridium$platform$qnx$BNtpServerQnx;
public boolean getUseBurst() {
return this.getBoolean(useBurst);
}
public void setUseBurst(boolean bl) {
this.setBoolean(useBurst, bl, null);
}
public boolean getServerPreferred() {
return this.getBoolean(serverPreferred);
}
public void setServerPreferred(boolean bl) {
this.setBoolean(serverPreferred, bl, null);
}
public int getMinPollInterval() {
return this.getInt(minPollInterval);
}
public void setMinPollInterval(int n) {
this.setInt(minPollInterval, n, null);
}
public int getMaxPollInterval() {
return this.getInt(maxPollInterval);
}
public void setMaxPollInterval(int n) {
this.setInt(maxPollInterval, n, null);
}
public BNtpModePosix getPeerMode() {
return (BNtpModePosix)this.get(peerMode);
}
public void setPeerMode(BNtpModePosix bNtpModePosix) {
this.set(peerMode, (BValue)bNtpModePosix, null);
}
public Type getType() {
return TYPE;
}
public BNtpServer makeServer(String string) {
return new BNtpServerQnx(string);
}
public void updateServerString(String string) {
this.serverString = string;
StringTokenizer stringTokenizer = new StringTokenizer(string);
String string2 = stringTokenizer.nextToken();
if (string2.equals("server")) {
this.setPeerMode(BNtpModePosix.server);
} else if (string2.equals("peer")) {
this.setPeerMode(BNtpModePosix.peer);
} else if (string2.equals("broadcast")) {
this.setPeerMode(BNtpModePosix.broadcast);
} else if (string2.equals("manycastclient")) {
this.setPeerMode(BNtpModePosix.manycastclient);
}
this.setAddress(stringTokenizer.nextToken());
this.setUseBurst(false);
this.setMaxPollInterval(10);
this.setMinPollInterval(6);
this.setServerPreferred(false);
string2 = null;
block5: while (stringTokenizer.hasMoreTokens()) {
string2 = stringTokenizer.nextToken();
switch (string2.charAt(0)) {
case 'b': {
if (!string2.equals("burst")) continue block5;
this.setUseBurst(true);
break;
}
case 'm': {
if (string2.equals("minpoll")) {
this.setMinPollInterval(Integer.valueOf(stringTokenizer.nextToken()));
break;
}
if (!string2.equals("maxpoll")) continue block5;
this.setMaxPollInterval(Integer.valueOf(stringTokenizer.nextToken()));
break;
}
case 'p': {
if (!string2.equals("prefer")) continue block5;
this.setServerPreferred(true);
break;
}
}
}
}
public String getServerString() {
if (this.serverString == null) {
this.serverString = this.getServerString(this.getPeerMode(), this.getAddress(), this.getUseBurst(), this.getServerPreferred(), this.getMinPollInterval(), this.getMaxPollInterval());
}
return this.serverString;
}
public String getServerString(BNtpModePosix bNtpModePosix, String string, boolean bl, boolean bl2, int n, int n2) {
StringBuffer stringBuffer = null;
if (bNtpModePosix == BNtpModePosix.server) {
stringBuffer = new StringBuffer("server");
} else if (bNtpModePosix == BNtpModePosix.peer) {
stringBuffer = new StringBuffer("peer");
} else if (bNtpModePosix == BNtpModePosix.manycastclient) {
stringBuffer = new StringBuffer("manycastclient");
} else if (bNtpModePosix == BNtpModePosix.broadcast) {
stringBuffer = new StringBuffer("broadcast");
} else {
return null;
}
stringBuffer.append(" " + string);
if (bl) {
stringBuffer.append(" burst");
}
if (bl2 && bNtpModePosix != BNtpModePosix.manycastclient && bNtpModePosix != BNtpModePosix.broadcast) {
stringBuffer.append(" prefer");
}
if (n != 6 && n >= 4 && n < 17 && n < n2) {
stringBuffer.append(" minpoll " + n);
}
if (n2 != 10 && n2 <= 17 && n2 > 4 && n2 > n) {
stringBuffer.append(" maxpoll " + n2);
}
return stringBuffer.toString();
}
public String getPropertyName(String string) {
return SlotPath.escape((String)string);
}
public synchronized boolean equivalent(Object object) {
if (object instanceof String) {
return this.getServerString().equals(object);
}
if (object instanceof BNtpServerQnx) {
return ((BNtpServerQnx)((Object)object)).getServerString().equals(this.getServerString());
}
return false;
}
public void changed(Property property, Context context) {
super.changed(property, context);
if (property == address || property == useBurst || property == maxPollInterval || property == minPollInterval || property == serverPreferred || property == peerMode) {
this.serverString = null;
}
}
static /* synthetic */ Class class(String string, boolean bl) {
try {
Class<?> clazz = Class.forName(string);
if (!bl) {
clazz = clazz.getComponentType();
}
return clazz;
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
private final /* synthetic */ void this() {
this.serverString = null;
}
public BNtpServerQnx() {
this.this();
}
public BNtpServerQnx(String string) {
this.this();
this.updateServerString(string);
}
static {
Class clazz = class$com$tridium$platform$qnx$BNtpServerQnx;
if (clazz == null) {
clazz = class$com$tridium$platform$qnx$BNtpServerQnx = BNtpServerQnx.class("[Lcom.tridium.platform.qnx.BNtpServerQnx;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,892 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.sys.NreLib
* com.tridium.sys.resource.ResourceReport
* com.tridium.sys.station.Station
* javax.baja.agent.AgentList
* javax.baja.data.BIDataValue
* javax.baja.file.BFileSystem
* javax.baja.file.FilePath
* javax.baja.naming.SlotPath
* javax.baja.spy.Spy
* javax.baja.spy.SpyWriter
* javax.baja.sys.BBoolean
* javax.baja.sys.BFacets
* javax.baja.sys.BInteger
* javax.baja.sys.BRelTime
* javax.baja.sys.BValue
* javax.baja.sys.BajaRuntimeException
* javax.baja.sys.Clock
* javax.baja.sys.Context
* javax.baja.sys.Property
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.units.BUnit
* javax.baja.xml.XElem
* javax.baja.xml.XParser
*/
package com.tridium.platform.qnx;
import com.tridium.platform.BFilesystemAttributes;
import com.tridium.platform.BOperatingSystemEnum;
import com.tridium.platform.BPlatform;
import com.tridium.platform.BSystemPlatformService;
import com.tridium.platform.IPlatformLibrary;
import com.tridium.platform.NativePlatformLibraryTridium;
import com.tridium.platform.archive.FileArchive;
import com.tridium.platform.archive.NullFileArchive;
import com.tridium.platform.archive.ZipArchive;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.platform.daemon.BHostProperties;
import com.tridium.platform.daemon.LocalSessionUtil;
import com.tridium.platform.daemon.message.DaemonMessage;
import com.tridium.platform.daemon.message.UpdateStationMessage;
import com.tridium.platform.daemon.message.XmlResponseMessage;
import com.tridium.platform.qnx.QnxDiagnosticsPage;
import com.tridium.platform.timezone.BDstSupportLevel;
import com.tridium.sys.NreLib;
import com.tridium.sys.resource.ResourceReport;
import com.tridium.sys.station.Station;
import java.io.File;
import java.io.InputStream;
import javax.baja.agent.AgentList;
import javax.baja.data.BIDataValue;
import javax.baja.file.BFileSystem;
import javax.baja.file.FilePath;
import javax.baja.naming.SlotPath;
import javax.baja.spy.Spy;
import javax.baja.spy.SpyWriter;
import javax.baja.sys.BBoolean;
import javax.baja.sys.BFacets;
import javax.baja.sys.BInteger;
import javax.baja.sys.BRelTime;
import javax.baja.sys.BValue;
import javax.baja.sys.BajaRuntimeException;
import javax.baja.sys.Clock;
import javax.baja.sys.Context;
import javax.baja.sys.Property;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.units.BUnit;
import javax.baja.xml.XElem;
import javax.baja.xml.XParser;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BSystemPlatformServiceQnx
extends BSystemPlatformService {
public static final Property stationAutoSaveFrequency = BSystemPlatformServiceQnx.newProperty((int)1, (BValue)BRelTime.DAY, (BFacets)BSystemPlatformService.stationAutoSaveFrequency.getFacets());
public static final Property stationSaveBackupCount = BSystemPlatformServiceQnx.newProperty((int)1, (int)0, null);
public static final Property serialNumber = BSystemPlatformServiceQnx.newProperty((int)3, (String)"", null);
public static final Property hardwareRevision = BSystemPlatformServiceQnx.newProperty((int)3, (String)"", null);
public static final Property ramDiskSize = BSystemPlatformServiceQnx.newProperty((int)1, (int)16, (BFacets)BFacets.make((String)"min", (BIDataValue)BInteger.make((int)1)));
public static final Property minFreeRamDiskPercentage = BSystemPlatformServiceQnx.newProperty((int)0, (int)5, (BFacets)BFacets.make((String)"units", (BIDataValue)BUnit.getUnit((String)"percent"), (String)"min", (BIDataValue)BInteger.make((int)0), (String)"max", (BIDataValue)BInteger.make((int)100)));
public static final Property lowRamDiskSpace = BSystemPlatformServiceQnx.newProperty((int)3, (boolean)false, null);
public static final Property minFreeHeap = BSystemPlatformServiceQnx.newProperty((int)1, (int)8, null);
public static final Property lowHeap = BSystemPlatformServiceQnx.newProperty((int)3, (boolean)false, null);
public static final Property freeHeap = BSystemPlatformServiceQnx.newProperty((int)3, (int)0, null);
public static final Property maxHeap = BSystemPlatformServiceQnx.newProperty((int)3, (int)0, null);
public static final Property minFreeDiskPercentage = BSystemPlatformServiceQnx.newProperty((int)0, (int)10, (BFacets)BFacets.make((String)"units", (BIDataValue)BUnit.getUnit((String)"percent"), (String)"min", (BIDataValue)BInteger.make((int)0), (String)"max", (BIDataValue)BInteger.make((int)100)));
public static final Property lowDiskSpace = BSystemPlatformServiceQnx.newProperty((int)3, (boolean)false, null);
public static final Property minFreeFileDescriptors = BSystemPlatformServiceQnx.newProperty((int)0, (int)50, (BFacets)BFacets.make((String)"min", (BIDataValue)BInteger.make((int)50)));
public static final Property openFileDescriptors = BSystemPlatformServiceQnx.newProperty((int)3, (int)0, null);
public static final Property maxOpenFileDescriptors = BSystemPlatformServiceQnx.newProperty((int)3, (int)1000, null);
public static final Property tooManyOpenFiles = BSystemPlatformServiceQnx.newProperty((int)3, (boolean)false, null);
public static final Property lowAvailableFiles = BSystemPlatformServiceQnx.newProperty((int)3, (boolean)false, null);
public static final Property minAvailableFiles = BSystemPlatformServiceQnx.newProperty((int)3, (int)50, (BFacets)BFacets.make((String)"min", (BIDataValue)BInteger.make((int)50)));
public static final Property minFreePhysicalMemory = BSystemPlatformServiceQnx.newProperty((int)0, (int)1024, (BFacets)BFacets.make((String)"min", (BIDataValue)BInteger.make((int)512)));
public static final Property lowMemory = BSystemPlatformServiceQnx.newProperty((int)3, (boolean)false, null);
public static final Property factroyDefaultCredentials = BSystemPlatformServiceQnx.newProperty((int)3, (boolean)false, null);
public static final Property failureRebootLimit = BSystemPlatformServiceQnx.newProperty((int)3, (int)3, (BFacets)BFacets.make((String[])new String[]{"min"}, (BIDataValue[])new BIDataValue[]{BInteger.make((int)1)}));
public static final Property failureRebootLimitPeriod = BSystemPlatformServiceQnx.newProperty((int)3, (BValue)BRelTime.HOUR, (BFacets)BFacets.make((String[])new String[]{"units", "min", "showSeconds"}, (BIDataValue[])new BIDataValue[]{BUnit.getUnit((String)"minute"), BRelTime.make((long)0L), BBoolean.FALSE}));
public static final Type TYPE;
private static long lastFileCheck;
private static final IPlatformLibrary _PLATFORM_LIBRARY_INSTANCE;
private boolean ramDiskCreated;
private String[] fileSystems;
private Property[] filesystemProps;
private int ramFsNdx;
private boolean allowRebootLimitUpdate;
private boolean rebootLimitUpdated;
private AgentList agentList;
UpdateRebootLimitsThread rebootLimitsThread;
static /* synthetic */ Class class$com$tridium$platform$qnx$BSystemPlatformServiceQnx;
public String getSerialNumber() {
return this.getString(serialNumber);
}
public void setSerialNumber(String string) {
this.setString(serialNumber, string, null);
}
public String getHardwareRevision() {
return this.getString(hardwareRevision);
}
public void setHardwareRevision(String string) {
this.setString(hardwareRevision, string, null);
}
public int getRamDiskSize() {
return this.getInt(ramDiskSize);
}
public void setRamDiskSize(int n) {
this.setInt(ramDiskSize, n, null);
}
public int getMinFreeRamDiskPercentage() {
return this.getInt(minFreeRamDiskPercentage);
}
public void setMinFreeRamDiskPercentage(int n) {
this.setInt(minFreeRamDiskPercentage, n, null);
}
public boolean getLowRamDiskSpace() {
return this.getBoolean(lowRamDiskSpace);
}
public void setLowRamDiskSpace(boolean bl) {
this.setBoolean(lowRamDiskSpace, bl, null);
}
public int getMinFreeHeap() {
return this.getInt(minFreeHeap);
}
public void setMinFreeHeap(int n) {
this.setInt(minFreeHeap, n, null);
}
public boolean getLowHeap() {
return this.getBoolean(lowHeap);
}
public void setLowHeap(boolean bl) {
this.setBoolean(lowHeap, bl, null);
}
public int getFreeHeap() {
return this.getInt(freeHeap);
}
public void setFreeHeap(int n) {
this.setInt(freeHeap, n, null);
}
public int getMaxHeap() {
return this.getInt(maxHeap);
}
public void setMaxHeap(int n) {
this.setInt(maxHeap, n, null);
}
public int getMinFreeDiskPercentage() {
return this.getInt(minFreeDiskPercentage);
}
public void setMinFreeDiskPercentage(int n) {
this.setInt(minFreeDiskPercentage, n, null);
}
public boolean getLowDiskSpace() {
return this.getBoolean(lowDiskSpace);
}
public void setLowDiskSpace(boolean bl) {
this.setBoolean(lowDiskSpace, bl, null);
}
public int getMinFreeFileDescriptors() {
return this.getInt(minFreeFileDescriptors);
}
public void setMinFreeFileDescriptors(int n) {
this.setInt(minFreeFileDescriptors, n, null);
}
public int getOpenFileDescriptors() {
return this.getInt(openFileDescriptors);
}
public void setOpenFileDescriptors(int n) {
this.setInt(openFileDescriptors, n, null);
}
public int getMaxOpenFileDescriptors() {
return this.getInt(maxOpenFileDescriptors);
}
public void setMaxOpenFileDescriptors(int n) {
this.setInt(maxOpenFileDescriptors, n, null);
}
public boolean getTooManyOpenFiles() {
return this.getBoolean(tooManyOpenFiles);
}
public void setTooManyOpenFiles(boolean bl) {
this.setBoolean(tooManyOpenFiles, bl, null);
}
public boolean getLowAvailableFiles() {
return this.getBoolean(lowAvailableFiles);
}
public void setLowAvailableFiles(boolean bl) {
this.setBoolean(lowAvailableFiles, bl, null);
}
public int getMinAvailableFiles() {
return this.getInt(minAvailableFiles);
}
public void setMinAvailableFiles(int n) {
this.setInt(minAvailableFiles, n, null);
}
public int getMinFreePhysicalMemory() {
return this.getInt(minFreePhysicalMemory);
}
public void setMinFreePhysicalMemory(int n) {
this.setInt(minFreePhysicalMemory, n, null);
}
public boolean getLowMemory() {
return this.getBoolean(lowMemory);
}
public void setLowMemory(boolean bl) {
this.setBoolean(lowMemory, bl, null);
}
public boolean getFactroyDefaultCredentials() {
return this.getBoolean(factroyDefaultCredentials);
}
public void setFactroyDefaultCredentials(boolean bl) {
this.setBoolean(factroyDefaultCredentials, bl, null);
}
public int getFailureRebootLimit() {
return this.getInt(failureRebootLimit);
}
public void setFailureRebootLimit(int n) {
this.setInt(failureRebootLimit, n, null);
}
public BRelTime getFailureRebootLimitPeriod() {
return (BRelTime)this.get(failureRebootLimitPeriod);
}
public void setFailureRebootLimitPeriod(BRelTime bRelTime) {
this.set(failureRebootLimitPeriod, (BValue)bRelTime, null);
}
public Type getType() {
return TYPE;
}
public void serviceStarted() throws Exception {
super.serviceStarted();
this.rebootLimitsThread = new UpdateRebootLimitsThread();
this.rebootLimitsThread.start();
}
public void serviceStopped() throws Exception {
super.serviceStopped();
if (this.rebootLimitsThread != null && this.rebootLimitsThread.isAlive()) {
this.rebootLimitsThread.requestStop();
this.rebootLimitsThread.join(3000L);
}
}
public boolean isValidPlatform() {
return false;
}
public void loadPlatformServiceProperties() {
super.loadPlatformServiceProperties();
if (!NativePlatformLibraryTridium.load()) {
return;
}
IPlatformLibrary iPlatformLibrary = this.getPlatformLibrary();
this.createRamDisk();
this.fileSystems = iPlatformLibrary.getAllFileSystemNames();
this.filesystemProps = new Property[this.fileSystems.length];
this.getFilesystemAttributes().removeAll();
int n = 0;
while (n < this.fileSystems.length) {
BFilesystemAttributes bFilesystemAttributes = new BFilesystemAttributes(iPlatformLibrary.getTotalBytes(this.fileSystems[n]) / 1024L, iPlatformLibrary.getFreeBytes(this.fileSystems[n]) / 1024L, iPlatformLibrary.getBlockSize(this.fileSystems[n]), iPlatformLibrary.getMaxFileCount(this.fileSystems[n]), iPlatformLibrary.getCurrentFileCount(this.fileSystems[n]), iPlatformLibrary.isFlash(this.fileSystems[n]));
if (this.fileSystems[n].equals("/aram0")) {
this.ramFsNdx = n;
if (NreLib.getHostModel().equalsIgnoreCase("TITAN")) {
this.setRamDiskSize((int)(bFilesystemAttributes.getTotalSpace() / 1024L) + 1);
}
}
this.filesystemProps[n] = this.getFilesystemAttributes().add(SlotPath.escape((String)this.fileSystems[n]), (BValue)bFilesystemAttributes, 3);
++n;
}
this.setTotalPhysicalMemory((int)(iPlatformLibrary.getTotalPhysicalMemoryBytes() / 1024L));
this.setFreePhysicalMemory((int)(iPlatformLibrary.getFreePhysicalMemoryBytes() / 1024L));
this.setCurrentCpuUsage(iPlatformLibrary.getCurrentCPUUtilization());
this.setOverallCpuUsage(iPlatformLibrary.getOverallCPUUtilization());
this.setNumCpus(iPlatformLibrary.getNumberCPUs());
this.setHardwareRevision(BSystemPlatformServiceQnx.getHardwareRevision0());
this.setSerialNumber(BSystemPlatformServiceQnx.getSerialNumber0());
this.setMaxOpenFileDescriptors(BSystemPlatformServiceQnx.getMaxOpenFds0());
String string = System.getProperty("platform.maxHeap");
int n2 = 0;
n2 = string == null ? 0 : (string.endsWith("M") ? Integer.parseInt(string.substring(0, string.length() - 1)) : (string.endsWith("K") ? Integer.parseInt(string.substring(0, string.length() - 1)) / 1024 : 0));
this.setMaxHeap(n2);
}
public void doSavePlatformServiceProperties() throws Exception {
if (!this.isRunning()) {
return;
}
super.doSavePlatformServiceProperties();
this.checkPropertiesLoaded();
if (this.rebootLimitUpdated) {
this.allowRebootLimitUpdate = false;
BDaemonSession bDaemonSession = LocalSessionUtil.getLocalSession();
String string = bDaemonSession.getErrorText(new UpdateRebootLimits(this.getFailureRebootLimit(), this.getFailureRebootLimitPeriod()));
if (string != null) {
throw new BajaRuntimeException(string);
}
this.rebootLimitUpdated = false;
this.allowRebootLimitUpdate = true;
}
}
public static final String getSystemDirectory() {
return "/";
}
public String makeRootName(String string) {
return "/" + string;
}
public final void doRestartStation() throws Exception {
this.doReboot();
}
public final void doReboot() throws Exception {
this.savePlatformServiceProperties();
new Thread(new Runnable(){
public final void run() {
try {
Thread.sleep(3000L);
}
catch (InterruptedException interruptedException) {}
if (LocalSessionUtil.localDaemonIsAvailable()) {
try {
if (!LocalSessionUtil.getLocalSession().sendRebootRequest(false)) {
BPlatform.log.error("niagarad reboot request failed, rebooting manually");
BSystemPlatformServiceQnx.this.rebootManually();
}
}
catch (Exception exception) {
BPlatform.log.error("niagarad reboot request failed(2), rebooting manually");
BSystemPlatformServiceQnx.this.rebootManually();
}
} else {
BPlatform.log.message("niagarad not available, rebooting manually");
BSystemPlatformServiceQnx.this.rebootManually();
}
}
}, "BSystemPlatformServiceQnx::doReboot()").start();
}
private final void rebootManually() {
try {
Station.shutdown((boolean)false);
}
catch (Exception exception) {
BPlatform.log.error("Failed to shut station", (Throwable)exception);
}
try {
Runtime.getRuntime().exec("/proc/boot/shutdown");
}
catch (Exception exception) {
BPlatform.log.error("Failed to execute QNX shutdown command", (Throwable)exception);
}
}
public void doPoll(Context context) {
if (!this.isRunning()) {
return;
}
if (!NativePlatformLibraryTridium.load()) {
return;
}
IPlatformLibrary iPlatformLibrary = this.getPlatformLibrary();
this.setTotalPhysicalMemory((int)(iPlatformLibrary.getTotalPhysicalMemoryBytes() / 1024L));
this.setFreePhysicalMemory((int)(iPlatformLibrary.getFreePhysicalMemoryBytes() / 1024L));
this.setCurrentCpuUsage(iPlatformLibrary.getCurrentCPUUtilization());
this.setOverallCpuUsage(iPlatformLibrary.getOverallCPUUtilization());
this.setFreeHeap((int)(Runtime.getRuntime().freeMemory() / 0x100000L));
long l = Clock.ticks();
if (l - lastFileCheck > 15000L) {
lastFileCheck = l;
if (this.fileSystems != null) {
int n = 0;
while (n < this.fileSystems.length) {
BFilesystemAttributes bFilesystemAttributes = (BFilesystemAttributes)this.getFilesystemAttributes().get(this.filesystemProps[n]);
bFilesystemAttributes.setFreeSpace(iPlatformLibrary.getFreeBytes(this.fileSystems[n]) / 1024L);
bFilesystemAttributes.setTotalSpace(iPlatformLibrary.getTotalBytes(this.fileSystems[n]) / 1024L);
bFilesystemAttributes.setBlockSize(iPlatformLibrary.getBlockSize(this.fileSystems[n]));
bFilesystemAttributes.setMaxFileCount((int)iPlatformLibrary.getMaxFileCount(this.fileSystems[n]));
bFilesystemAttributes.setCurrentFileCount((int)iPlatformLibrary.getCurrentFileCount(this.fileSystems[n]));
if (n == this.ramFsNdx) {
bFilesystemAttributes.setIsRamDisk(true);
}
++n;
}
}
this.setOpenFileDescriptors(BSystemPlatformServiceQnx.getFdUsageCount0());
}
if (context != null && context.getFacets().getb("resourceOnly", false)) {
return;
}
super.doPoll(context);
if (!this.rebootLimitUpdated && this.rebootLimitsThread != null && this.rebootLimitsThread.isAlive()) {
this.rebootLimitsThread.requestUpdate();
}
}
protected boolean isLowJavaHeap() {
long l = (long)this.getMinFreeHeap() * 1024L * 1024L;
long l2 = (long)this.getMaxHeap() * 1024L * 1024L;
boolean bl = false;
boolean bl2 = this.getLowHeap();
long l3 = Runtime.getRuntime().totalMemory();
if (l == 0L || l3 < l2) {
bl = false;
} else {
long l4 = Runtime.getRuntime().freeMemory();
if (l4 < l) {
BPlatform.log.trace("Low Heap Monitor forcing GC, heapFree " + l4 + " < minFree " + l);
System.gc();
l4 = Runtime.getRuntime().freeMemory();
if (l4 < l) {
if (!bl2) {
BPlatform.log.warning("Low Heap: heapFree " + l4 + " < minFree " + l);
}
bl = true;
}
}
BPlatform.log.trace("Low Heap Monitor: heapFree " + l4 + " minFree " + l);
}
this.setLowHeap(bl);
return bl;
}
protected boolean isLowRamDisk() {
boolean bl;
if (this.filesystemProps == null || this.ramFsNdx < 0) {
return false;
}
int n = this.getMinFreeRamDiskPercentage();
BFilesystemAttributes bFilesystemAttributes = (BFilesystemAttributes)this.getFilesystemAttributes().get(this.filesystemProps[this.ramFsNdx]);
int n2 = (int)(bFilesystemAttributes.getFreeSpace() * 100L / bFilesystemAttributes.getTotalSpace());
if (n2 < n) {
bl = true;
if (!this.getLowRamDiskSpace()) {
BPlatform.log.warning("Low RAM Disk Space: " + n2 + "% free, minimum " + n + '%');
}
} else {
bl = false;
}
this.setLowRamDiskSpace(bl);
return bl;
}
protected boolean isFactoryDefaultCredentials() {
boolean bl = false;
if (LocalSessionUtil.localDaemonIsAvailable()) {
BDaemonSession bDaemonSession = LocalSessionUtil.getLocalSession();
try {
XElem xElem;
XElem xElem2 = XParser.make((InputStream)bDaemonSession.getInputStream((DaemonMessage)new XmlResponseMessage(){
public final String getMessageString() {
return "auth";
}
}, "text/xml")).parse();
XElem xElem3 = xElem2.elem("auth");
if (xElem3 != null && (xElem = xElem3.elem("user")) != null) {
bl = xElem.getb("default", false);
}
if (bl && !this.getFactroyDefaultCredentials()) {
BPlatform.log.warning("Factory default platform credentials detected");
}
}
catch (Exception exception) {}
}
this.setFactroyDefaultCredentials(bl);
return bl;
}
protected boolean isLowDisk() {
boolean bl;
if (this.filesystemProps == null) {
return false;
}
int n = this.getMinFreeDiskPercentage();
BFilesystemAttributes bFilesystemAttributes = (BFilesystemAttributes)this.getFilesystemAttributes().get(this.filesystemProps[0]);
int n2 = (int)(bFilesystemAttributes.getFreeSpace() * 100L / bFilesystemAttributes.getTotalSpace());
if (n2 < n) {
bl = true;
if (!this.getLowDiskSpace()) {
BPlatform.log.warning("Low Disk Space " + n2 + "% free, minimum " + n + '%');
}
} else {
bl = false;
}
this.setLowDiskSpace(bl);
return bl;
}
private final boolean isFdUsageHigh() {
boolean bl;
int n;
int n2 = this.getOpenFileDescriptors();
int n3 = this.getMaxOpenFileDescriptors();
if (n3 - n2 < (n = this.getMinFreeFileDescriptors())) {
bl = true;
if (!this.getTooManyOpenFiles()) {
BPlatform.log.warning("Too many open files or sockets: " + n2 + " in use, maximum available is " + n3);
}
} else {
bl = false;
}
this.setTooManyOpenFiles(bl);
return bl;
}
private final boolean isFileCountHigh() {
if (this.filesystemProps == null) {
return false;
}
int n = this.getMinAvailableFiles();
boolean bl = false;
long l = 0L;
long l2 = 0L;
BFilesystemAttributes bFilesystemAttributes = (BFilesystemAttributes)this.getFilesystemAttributes().get(this.filesystemProps[0]);
l2 = bFilesystemAttributes.getMaxFileCount();
if (l2 - (l = bFilesystemAttributes.getCurrentFileCount()) < (long)n) {
bl = true;
if (!this.getLowAvailableFiles()) {
BPlatform.log.warning("Too many files: " + l + " on file system: " + this.fileSystems[0] + ", maximum available is " + l2);
}
} else {
bl = false;
}
this.setLowAvailableFiles(bl);
return bl;
}
private final boolean isLowMemory() {
boolean bl;
int n;
int n2 = this.getFreePhysicalMemory();
if (n2 < (n = this.getMinFreePhysicalMemory())) {
bl = true;
if (!this.getLowMemory()) {
BPlatform.log.warning("Low System Memory " + n2 + " KB available");
}
} else {
bl = false;
}
this.setLowMemory(bl);
return bl;
}
public String checkForStationFault() {
if (this.isLowMemory()) {
return "stationFault.lowSystemMemory";
}
if (this.isLowJavaHeap()) {
return "stationFault.lowHeap";
}
if (this.isLowDisk()) {
return "stationFault.diskSpace";
}
if (this.isLowRamDisk()) {
return "stationFault.ramDiskSpace";
}
if (this.isFdUsageHigh()) {
return "stationFault.fdUsage";
}
if (this.isFileCountHigh()) {
return "stationFault.fileUsage";
}
return null;
}
public void queryResources(ResourceReport resourceReport) {
resourceReport.put("fd.open", "" + this.getOpenFileDescriptors());
resourceReport.put("fd.max", "" + this.getMaxOpenFileDescriptors());
}
public boolean archiveEnabled(String string) {
return true;
}
public FileArchive createFileArchive(String string) {
if (this.getRamDiskSize() == 0) {
return new NullFileArchive();
}
String string2 = Sys.getStationHome().getPath() + '/' + string;
String string3 = string + ".zip";
File file = new File(Sys.getStationHome().getPath() + '/' + string);
file.mkdir();
return new ZipArchive(string2, string3, 1);
}
public synchronized void extractArchive(String string) {
if (this.getRamDiskSize() != 0) {
this.createRamDisk();
try {
ZipArchive.unzip(Sys.getStationHome().getPath() + '/' + string, string + ".zip", "/" + string);
}
catch (Exception exception) {
exception.printStackTrace();
BPlatform.log.error("Failed to extrace archive \"" + string + "\" to RAM disk", (Throwable)exception);
}
}
}
private final synchronized void createRamDisk() {
if (!this.ramDiskCreated) {
try {
String string = System.getProperty("os.arch", "").equals("x86") ? "/bin/ksh /niagara/bin/ramdisk.sh " + this.getRamDiskSize() * 2 * 1024 : "/proc/boot/ksh /niagara/bin/ramdisk.sh " + this.getRamDiskSize() * 2 * 1024;
Process process = Runtime.getRuntime().exec(string);
process.waitFor();
if (process.exitValue() != 0) {
BPlatform.log.error("Unable to create archive RAM disk");
}
}
catch (Exception exception) {
exception.printStackTrace();
BPlatform.log.error("Failed to initialize RAM disk", (Throwable)exception);
}
this.ramDiskCreated = true;
}
}
public String getRuntimeDirectory(String string) {
if (this.getRamDiskSize() == 0) {
return super.getRuntimeDirectory(string);
}
return "/" + string;
}
public AgentList getAgents(Context context) {
if (this.agentList == null) {
this.agentList = super.getAgents(context);
this.agentList.remove("platform:SystemPlatformServicePlugin");
}
return this.agentList;
}
public void spy(SpyWriter spyWriter) throws Exception {
super.spy(spyWriter);
spyWriter.startProps();
spyWriter.trTitle((Object)"SystemPlatformServiceQnx", 2);
if (this.isProxy()) {
spyWriter.prop((Object)"lastErrorMessage", (Object)"remote");
} else if (NativePlatformLibraryTridium.load()) {
spyWriter.prop((Object)"lastErrorMessage", (Object)this.getPlatformLibrary().getLastErrorMessage());
}
spyWriter.endProps();
}
public void changed(Property property, Context context) {
super.changed(property, context);
if (this.allowRebootLimitUpdate && this.platformServicePropertiesLoaded && (property == failureRebootLimit || property == failureRebootLimitPeriod)) {
this.rebootLimitUpdated = true;
}
}
protected void doRenameAndRestart(BDaemonSession bDaemonSession, String string, String string2) throws Exception {
Station.shutdown((boolean)false);
FilePath filePath = new FilePath("!stations");
BFileSystem.INSTANCE.delete(filePath.merge(string2));
BFileSystem.INSTANCE.move(filePath.merge(string), filePath.merge(string2));
XmlResponseMessage[] xmlResponseMessageArray = new XmlResponseMessage[]{new UpdateStationMessage(), new UpdateStationMessage(string2, false, true, true, true)};
bDaemonSession.sendMessages(xmlResponseMessageArray, BDaemonSession.DEFAULT_TIMEOUT);
bDaemonSession.sendForceRebootRequest();
}
public IPlatformLibrary getPlatformLibrary() {
if (!NativePlatformLibraryTridium.load()) {
return null;
}
return _PLATFORM_LIBRARY_INSTANCE;
}
private static final native String getHardwareRevision0();
private static final native String getSerialNumber0();
private static final native int getFdUsageCount0();
private static final native int getMaxOpenFds0();
public static void main(String[] stringArray) {
try {
System.out.println("Platform Service Test");
NativePlatformLibraryTridium.load();
System.out.println("Natives loaded");
}
catch (Exception exception) {
exception.printStackTrace();
}
}
static /* synthetic */ boolean access$1(BSystemPlatformServiceQnx bSystemPlatformServiceQnx) {
return bSystemPlatformServiceQnx.allowRebootLimitUpdate;
}
static /* synthetic */ Class class(String string, boolean bl) {
try {
Class<?> clazz = Class.forName(string);
if (!bl) {
clazz = clazz.getComponentType();
}
return clazz;
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
private final /* synthetic */ void this() {
this.ramDiskCreated = NreLib.getHostModel().equalsIgnoreCase("TITAN");
this.ramFsNdx = -1;
this.allowRebootLimitUpdate = true;
this.rebootLimitUpdated = false;
this.agentList = null;
}
public BSystemPlatformServiceQnx() {
this.this();
this.setTimezoneDayModeSupport(BDstSupportLevel.exact);
}
static {
Class clazz = class$com$tridium$platform$qnx$BSystemPlatformServiceQnx;
if (clazz == null) {
clazz = class$com$tridium$platform$qnx$BSystemPlatformServiceQnx = BSystemPlatformServiceQnx.class("[Lcom.tridium.platform.qnx.BSystemPlatformServiceQnx;", false);
}
TYPE = Sys.loadType((Class)clazz);
if (BOperatingSystemEnum.getOS() == BOperatingSystemEnum.qnx) {
Spy.ROOT.add("platform diagnostics", (Spy)new QnxDiagnosticsPage());
}
lastFileCheck = 0L;
_PLATFORM_LIBRARY_INSTANCE = new NativePlatformLibraryTridium();
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
private class UpdateRebootLimitsThread
extends Thread {
boolean updateRequested;
boolean stopRequested;
/*
* WARNING - Removed try catching itself - possible behaviour change.
* WARNING - Removed back jump from a try to a catch block - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
* Converted monitor instructions to comments
* Lifted jumps to return sites
*/
public void run() {
while (!this.stopRequested) {
UpdateRebootLimitsThread updateRebootLimitsThread = this;
// MONITORENTER : updateRebootLimitsThread
{
try {
this.wait();
}
catch (InterruptedException interruptedException) {}
if (this.stopRequested) {
return;
}
if (!this.updateRequested) continue;
this.updateRequested = false;
}
BSystemPlatformServiceQnx.this.allowRebootLimitUpdate = false;
try {
if (LocalSessionUtil.localDaemonIsAvailable()) {
BDaemonSession bDaemonSession = LocalSessionUtil.getLocalSession();
bDaemonSession.reloadHostProperties();
BHostProperties bHostProperties = bDaemonSession.getHostProperties();
BSystemPlatformServiceQnx.this.setFailureRebootLimit(bHostProperties.getFailureRebootLimit());
BSystemPlatformServiceQnx.this.setFailureRebootLimitPeriod(bHostProperties.getFailureRebootLimitPeriod());
}
}
catch (Exception exception) {
BPlatform.log.warning("Failed to update reboot limits", (Throwable)exception);
exception.printStackTrace();
}
BSystemPlatformServiceQnx.this.allowRebootLimitUpdate = true;
}
}
public synchronized void requestStop() {
this.stopRequested = true;
this.notify();
}
public synchronized void requestUpdate() {
this.updateRequested = true;
this.notify();
}
private final /* synthetic */ void this() {
this.updateRequested = false;
this.stopRequested = false;
}
public UpdateRebootLimitsThread() {
super("BSystemPlatformServiceQnx::failureRebootUpdateThread");
this.this();
}
}
private static class UpdateRebootLimits
extends XmlResponseMessage {
private int limit;
private BRelTime period;
public String getMessageString() {
StringBuffer stringBuffer = new StringBuffer("updatedaemon");
stringBuffer.append("?failureRebootLimit=");
stringBuffer.append(String.valueOf(this.limit));
stringBuffer.append("&failureRebootLimitPeriod=");
stringBuffer.append(String.valueOf(this.period.getMillis()));
return stringBuffer.toString();
}
public UpdateRebootLimits(int n, BRelTime bRelTime) {
this.limit = n;
this.period = bRelTime;
}
}
}
@@ -0,0 +1,233 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.data.BIDataValue
* javax.baja.log.Log
* javax.baja.sys.Action
* javax.baja.sys.BBoolean
* javax.baja.sys.BComponent
* javax.baja.sys.BFacets
* javax.baja.sys.BInteger
* javax.baja.sys.BRelTime
* javax.baja.sys.BStation
* javax.baja.sys.BString
* javax.baja.sys.BValue
* javax.baja.sys.Clock
* javax.baja.sys.Clock$Ticket
* javax.baja.sys.Property
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.util.BFormat
*/
package com.tridium.platform.qnx;
import com.tridium.platform.NativePlatformLibraryTridium;
import com.tridium.platform.alarm.BPlatformAlarmProxy;
import com.tridium.platform.alarm.BPlatformAlarmSupport;
import com.tridium.platform.alarm.BPlatformServiceAlarmRecord;
import com.tridium.platform.alarm.PlatformServiceAlarmListener;
import com.tridium.platform.qnx.BSystemPlatformServiceQnxLegacy;
import java.util.HashMap;
import javax.baja.data.BIDataValue;
import javax.baja.log.Log;
import javax.baja.sys.Action;
import javax.baja.sys.BBoolean;
import javax.baja.sys.BComponent;
import javax.baja.sys.BFacets;
import javax.baja.sys.BInteger;
import javax.baja.sys.BRelTime;
import javax.baja.sys.BStation;
import javax.baja.sys.BString;
import javax.baja.sys.BValue;
import javax.baja.sys.Clock;
import javax.baja.sys.Property;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.util.BFormat;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BSystemPlatformServiceQnxJavelina
extends BSystemPlatformServiceQnxLegacy {
public static final Property ramDiskSize = BSystemPlatformServiceQnxJavelina.newProperty((int)0, (int)48, (BFacets)BFacets.make((String)"min", (BIDataValue)BInteger.make((int)1), (String)"max", (BIDataValue)BInteger.make((int)96)));
public static final Property minFreeHeap = BSystemPlatformServiceQnxJavelina.newProperty((int)1, (int)8, null);
public static final Property tamperSwitchEnabled = BSystemPlatformServiceQnxJavelina.newProperty((int)0, (boolean)false, null);
public static final Property tamperSwitchOk = BSystemPlatformServiceQnxJavelina.newProperty((int)3, (boolean)false, null);
public static final Property tamperSwitchAlarmSupport = BSystemPlatformServiceQnxJavelina.newProperty((int)0, (BValue)BSystemPlatformServiceQnxJavelina.initTamperSwitchAlarmSupport(), null);
public static final Property tamperSwitchAlarmProxy = BSystemPlatformServiceQnxJavelina.newProperty((int)6, (BValue)new BPlatformAlarmProxy(), null);
public static final Action tamperSwitchTimerExpired = BSystemPlatformServiceQnxJavelina.newAction((int)4, null);
public static final Type TYPE;
private static BBoolean dataRecoveryServiceFound;
private static boolean tamperLibraryLoaded;
private static boolean tamperErrorPrinted;
private static int tamperHandle;
private static final String ALARM_TYPE_TAMPER_SWITCH = "tamperSwitch";
public static Log log;
private Clock.Ticket tamperSwitchTicket;
boolean firstPass;
static /* synthetic */ Class class$com$tridium$platform$qnx$BSystemPlatformServiceQnxJavelina;
public boolean getTamperSwitchEnabled() {
return this.getBoolean(tamperSwitchEnabled);
}
public void setTamperSwitchEnabled(boolean bl) {
this.setBoolean(tamperSwitchEnabled, bl, null);
}
public boolean getTamperSwitchOk() {
return this.getBoolean(tamperSwitchOk);
}
public void setTamperSwitchOk(boolean bl) {
this.setBoolean(tamperSwitchOk, bl, null);
}
public BPlatformAlarmSupport getTamperSwitchAlarmSupport() {
return (BPlatformAlarmSupport)this.get(tamperSwitchAlarmSupport);
}
public void setTamperSwitchAlarmSupport(BPlatformAlarmSupport bPlatformAlarmSupport) {
this.set(tamperSwitchAlarmSupport, (BValue)bPlatformAlarmSupport, null);
}
public BPlatformAlarmProxy getTamperSwitchAlarmProxy() {
return (BPlatformAlarmProxy)this.get(tamperSwitchAlarmProxy);
}
public void setTamperSwitchAlarmProxy(BPlatformAlarmProxy bPlatformAlarmProxy) {
this.set(tamperSwitchAlarmProxy, (BValue)bPlatformAlarmProxy, null);
}
public void tamperSwitchTimerExpired() {
this.invoke(tamperSwitchTimerExpired, null, null);
}
public Type getType() {
return TYPE;
}
public void doStationStarted(BStation bStation) {
super.doStationStarted(bStation);
BSystemPlatformServiceQnxJavelina.tamperOpen();
this.getTamperSwitchAlarmProxy().setAlarmSupport(this.getTamperSwitchAlarmSupport());
this.doTamperSwitchTimerExpired();
this.tamperSwitchTicket = Clock.schedulePeriodically((BComponent)this, (BRelTime)BRelTime.SECOND, (Action)tamperSwitchTimerExpired, null);
}
public void doTamperSwitchTimerExpired() {
if (this.getTamperSwitchEnabled()) {
boolean bl = BSystemPlatformServiceQnxJavelina.getTamperSwitchState();
boolean bl2 = this.getTamperSwitchOk();
this.setTamperSwitchOk(bl);
if (!bl) {
if (bl2 || this.firstPass) {
log.warning("tamper switch triggered");
BPlatformServiceAlarmRecord bPlatformServiceAlarmRecord = this.getTamperSwitchAlarmSupport().makeNewFaultAlarm();
this.getTamperSwitchAlarmProxy().firePlatformServiceAlarmEvent(bPlatformServiceAlarmRecord);
}
} else if (bl && !bl2) {
log.warning("tamper switch ok");
BPlatformServiceAlarmRecord bPlatformServiceAlarmRecord = this.getTamperSwitchAlarmSupport().makeToNormal();
this.getTamperSwitchAlarmProxy().firePlatformServiceAlarmEvent(bPlatformServiceAlarmRecord);
}
this.firstPass = false;
}
}
public void addPlatformServiceAlarmListener(PlatformServiceAlarmListener platformServiceAlarmListener) {
super.addPlatformServiceAlarmListener(platformServiceAlarmListener);
this.getTamperSwitchAlarmProxy().addPlatformServiceAlarmListener(platformServiceAlarmListener);
}
public void removePlatformServiceAlarmListener(PlatformServiceAlarmListener platformServiceAlarmListener) {
super.removePlatformServiceAlarmListener(platformServiceAlarmListener);
this.getTamperSwitchAlarmProxy().removePlatformServiceAlarmListener(platformServiceAlarmListener);
}
public void firePlatformServiceAlarmEvent(BPlatformServiceAlarmRecord bPlatformServiceAlarmRecord) {
throw new IllegalStateException();
}
public BBoolean ackAlarm(BPlatformServiceAlarmRecord bPlatformServiceAlarmRecord) {
throw new IllegalStateException();
}
static BPlatformAlarmSupport initTamperSwitchAlarmSupport() {
BPlatformAlarmSupport bPlatformAlarmSupport = new BPlatformAlarmSupport();
bPlatformAlarmSupport.setToFaultText(BFormat.make((String)"%lexicon(platform:tamperSwitchFailed)%"));
bPlatformAlarmSupport.setToNormalText(BFormat.make((String)"%lexicon(platform:tamperSwitchOk)%"));
HashMap<String, BString> hashMap = new HashMap<String, BString>();
hashMap.put("alarmType", BString.make((String)ALARM_TYPE_TAMPER_SWITCH));
bPlatformAlarmSupport.setMetaData(BFacets.make(hashMap));
return bPlatformAlarmSupport;
}
private static final boolean getTamperSwitchState() {
if (!NativePlatformLibraryTridium.load()) {
return false;
}
return BSystemPlatformServiceQnxJavelina.getTamperSwitchState0(tamperHandle);
}
private static final void tamperOpen() {
if (!NativePlatformLibraryTridium.load()) {
throw new UnsupportedOperationException();
}
if (tamperHandle != -1) {
return;
}
tamperHandle = BSystemPlatformServiceQnxJavelina.tamperOpen0();
}
private static final void tamperClose() {
if (!NativePlatformLibraryTridium.load()) {
throw new UnsupportedOperationException();
}
BSystemPlatformServiceQnxJavelina.tamperClose0(tamperHandle);
tamperHandle = -1;
}
private static final native int tamperOpen0();
private static final native void tamperClose0(int var0);
private static final native boolean getTamperSwitchState0(int var0);
static /* synthetic */ Class class(String string, boolean bl) {
try {
Class<?> clazz = Class.forName(string);
if (!bl) {
clazz = clazz.getComponentType();
}
return clazz;
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
private final /* synthetic */ void this() {
this.firstPass = true;
}
public BSystemPlatformServiceQnxJavelina() {
this.this();
}
static {
Class clazz = class$com$tridium$platform$qnx$BSystemPlatformServiceQnxJavelina;
if (clazz == null) {
clazz = class$com$tridium$platform$qnx$BSystemPlatformServiceQnxJavelina = BSystemPlatformServiceQnxJavelina.class("[Lcom.tridium.platform.qnx.BSystemPlatformServiceQnxJavelina;", false);
}
TYPE = Sys.loadType((Class)clazz);
dataRecoveryServiceFound = null;
tamperLibraryLoaded = false;
tamperErrorPrinted = false;
tamperHandle = -1;
log = Log.getLog((String)"platform");
}
}
@@ -0,0 +1,84 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.sys.Property
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform.qnx;
import com.tridium.platform.BPlatform;
import com.tridium.platform.qnx.BSystemPlatformServiceQnx;
import com.tridium.platform.qnx.QnxNativeUtil;
import java.io.File;
import javax.baja.sys.Property;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public abstract class BSystemPlatformServiceQnxLegacy
extends BSystemPlatformServiceQnx {
public static final Property isJumperPresent = BSystemPlatformServiceQnxLegacy.newProperty((int)3, (boolean)false, null);
public static final Property isBatteryPresent = BSystemPlatformServiceQnxLegacy.newProperty((int)1, (boolean)true, null);
public static final Type TYPE;
static /* synthetic */ Class class$com$tridium$platform$qnx$BSystemPlatformServiceQnxLegacy;
public boolean getIsJumperPresent() {
return this.getBoolean(isJumperPresent);
}
public void setIsJumperPresent(boolean bl) {
this.setBoolean(isJumperPresent, bl, null);
}
public boolean getIsBatteryPresent() {
return this.getBoolean(isBatteryPresent);
}
public void setIsBatteryPresent(boolean bl) {
this.setBoolean(isBatteryPresent, bl, null);
}
public Type getType() {
return TYPE;
}
public void serviceStarted() throws Exception {
super.serviceStarted();
if (!this.getIsBatteryPresent()) {
BPlatform.log.trace("battery is not present, slaying powerd");
QnxNativeUtil.slay("powerd", 3);
}
}
public void loadPlatformServiceProperties() {
super.loadPlatformServiceProperties();
File file = new File("/dev/shmem/jumper0");
this.setIsJumperPresent(file.exists());
}
static /* synthetic */ Class class(String string, boolean bl) {
try {
Class<?> clazz = Class.forName(string);
if (!bl) {
clazz = clazz.getComponentType();
}
return clazz;
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
static {
Class clazz = class$com$tridium$platform$qnx$BSystemPlatformServiceQnxLegacy;
if (clazz == null) {
clazz = class$com$tridium$platform$qnx$BSystemPlatformServiceQnxLegacy = BSystemPlatformServiceQnxLegacy.class("[Lcom.tridium.platform.qnx.BSystemPlatformServiceQnxLegacy;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,57 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.data.BIDataValue
* javax.baja.sys.BFacets
* javax.baja.sys.BInteger
* javax.baja.sys.Property
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform.qnx;
import com.tridium.platform.qnx.BSystemPlatformServiceQnx;
import javax.baja.data.BIDataValue;
import javax.baja.sys.BFacets;
import javax.baja.sys.BInteger;
import javax.baja.sys.Property;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BSystemPlatformServiceQnxNpm2xx
extends BSystemPlatformServiceQnx {
public static final Property ramDiskSize = BSystemPlatformServiceQnxNpm2xx.newProperty((int)0, (int)6, (BFacets)BFacets.make((String)"min", (BIDataValue)BInteger.make((int)1), (String)"max", (BIDataValue)BInteger.make((int)12)));
public static final Property minFreeHeap = BSystemPlatformServiceQnxNpm2xx.newProperty((int)1, (int)3, null);
public static final Type TYPE;
static /* synthetic */ Class class$com$tridium$platform$qnx$BSystemPlatformServiceQnxNpm2xx;
public Type getType() {
return TYPE;
}
static /* synthetic */ Class class(String string, boolean bl) {
try {
Class<?> clazz = Class.forName(string);
if (!bl) {
clazz = clazz.getComponentType();
}
return clazz;
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
static {
Class clazz = class$com$tridium$platform$qnx$BSystemPlatformServiceQnxNpm2xx;
if (clazz == null) {
clazz = class$com$tridium$platform$qnx$BSystemPlatformServiceQnxNpm2xx = BSystemPlatformServiceQnxNpm2xx.class("[Lcom.tridium.platform.qnx.BSystemPlatformServiceQnxNpm2xx;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,57 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.data.BIDataValue
* javax.baja.sys.BFacets
* javax.baja.sys.BInteger
* javax.baja.sys.Property
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform.qnx;
import com.tridium.platform.qnx.BSystemPlatformServiceQnxLegacy;
import javax.baja.data.BIDataValue;
import javax.baja.sys.BFacets;
import javax.baja.sys.BInteger;
import javax.baja.sys.Property;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BSystemPlatformServiceQnxNpm3xx
extends BSystemPlatformServiceQnxLegacy {
public static final Property ramDiskSize = BSystemPlatformServiceQnxNpm3xx.newProperty((int)0, (int)12, (BFacets)BFacets.make((String)"min", (BIDataValue)BInteger.make((int)1), (String)"max", (BIDataValue)BInteger.make((int)24)));
public static final Property minFreeHeap = BSystemPlatformServiceQnxNpm3xx.newProperty((int)1, (int)5, null);
public static final Type TYPE;
static /* synthetic */ Class class$com$tridium$platform$qnx$BSystemPlatformServiceQnxNpm3xx;
public Type getType() {
return TYPE;
}
static /* synthetic */ Class class(String string, boolean bl) {
try {
Class<?> clazz = Class.forName(string);
if (!bl) {
clazz = clazz.getComponentType();
}
return clazz;
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
static {
Class clazz = class$com$tridium$platform$qnx$BSystemPlatformServiceQnxNpm3xx;
if (clazz == null) {
clazz = class$com$tridium$platform$qnx$BSystemPlatformServiceQnxNpm3xx = BSystemPlatformServiceQnxNpm3xx.class("[Lcom.tridium.platform.qnx.BSystemPlatformServiceQnxNpm3xx;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,57 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.data.BIDataValue
* javax.baja.sys.BFacets
* javax.baja.sys.BInteger
* javax.baja.sys.Property
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform.qnx;
import com.tridium.platform.qnx.BSystemPlatformServiceQnxLegacy;
import javax.baja.data.BIDataValue;
import javax.baja.sys.BFacets;
import javax.baja.sys.BInteger;
import javax.baja.sys.Property;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BSystemPlatformServiceQnxNpm6xx
extends BSystemPlatformServiceQnxLegacy {
public static final Property ramDiskSize = BSystemPlatformServiceQnxNpm6xx.newProperty((int)0, (int)32, (BFacets)BFacets.make((String)"min", (BIDataValue)BInteger.make((int)1), (String)"max", (BIDataValue)BInteger.make((int)64)));
public static final Property minFreeHeap = BSystemPlatformServiceQnxNpm6xx.newProperty((int)1, (int)8, null);
public static final Type TYPE;
static /* synthetic */ Class class$com$tridium$platform$qnx$BSystemPlatformServiceQnxNpm6xx;
public Type getType() {
return TYPE;
}
static /* synthetic */ Class class(String string, boolean bl) {
try {
Class<?> clazz = Class.forName(string);
if (!bl) {
clazz = clazz.getComponentType();
}
return clazz;
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
static {
Class clazz = class$com$tridium$platform$qnx$BSystemPlatformServiceQnxNpm6xx;
if (clazz == null) {
clazz = class$com$tridium$platform$qnx$BSystemPlatformServiceQnxNpm6xx = BSystemPlatformServiceQnxNpm6xx.class("[Lcom.tridium.platform.qnx.BSystemPlatformServiceQnxNpm6xx;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,53 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.sys.BFacets
* javax.baja.sys.Property
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform.qnx;
import com.tridium.platform.qnx.BSystemPlatformServiceQnx;
import javax.baja.sys.BFacets;
import javax.baja.sys.Property;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BSystemPlatformServiceQnxTitan
extends BSystemPlatformServiceQnx {
public static final Property ramDiskSize = BSystemPlatformServiceQnxTitan.newProperty((int)0, (int)384, (BFacets)BFacets.NULL);
public static final Property minFreeHeap = BSystemPlatformServiceQnxTitan.newProperty((int)1, (int)16, null);
public static final Type TYPE;
static /* synthetic */ Class class$com$tridium$platform$qnx$BSystemPlatformServiceQnxTitan;
public Type getType() {
return TYPE;
}
static /* synthetic */ Class class(String string, boolean bl) {
try {
Class<?> clazz = Class.forName(string);
if (!bl) {
clazz = clazz.getComponentType();
}
return clazz;
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
static {
Class clazz = class$com$tridium$platform$qnx$BSystemPlatformServiceQnxTitan;
if (clazz == null) {
clazz = class$com$tridium$platform$qnx$BSystemPlatformServiceQnxTitan = BSystemPlatformServiceQnxTitan.class("[Lcom.tridium.platform.qnx.BSystemPlatformServiceQnxTitan;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,98 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.spy.SpyDir
* javax.baja.spy.SpyWriter
*/
package com.tridium.platform.qnx;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.reflect.Method;
import javax.baja.spy.SpyDir;
import javax.baja.spy.SpyWriter;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class QnxCmdPage
extends SpyDir {
private String name;
private String cmd;
static /* synthetic */ Class class$javax$baja$spy$SpyWriter;
public void write(SpyWriter spyWriter) throws Exception {
try {
if (this.cmd.equalsIgnoreCase("jmxinfo")) {
try {
Class<?> clazz = Class.forName("com.tridium.platform.qnx.se.QnxJmxInfo");
Class[] classArray = new Class[1];
Class clazz2 = class$javax$baja$spy$SpyWriter;
if (clazz2 == null) {
clazz2 = class$javax$baja$spy$SpyWriter = QnxCmdPage.class("[Ljavax.baja.spy.SpyWriter;", false);
}
classArray[0] = clazz2;
Method method = clazz.getMethod("dumpJmxInfo", classArray);
method.invoke(clazz, spyWriter);
}
catch (Throwable throwable) {}
} else {
Runtime runtime = Runtime.getRuntime();
Process process = runtime.exec(this.cmd);
InputStream inputStream = process.getInputStream();
InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
spyWriter.startTable(false);
spyWriter.trTitle((Object)this.name, 1);
spyWriter.endTable();
spyWriter.w((Object)"<pre>\n");
String string = bufferedReader.readLine();
while (string != null) {
spyWriter.safe(this.convertBogusChars(string)).w((Object)"\n");
string = bufferedReader.readLine();
}
spyWriter.w((Object)"</pre>\n");
bufferedReader.close();
inputStreamReader.close();
inputStream.close();
}
}
catch (Exception exception) {}
}
private final String convertBogusChars(String string) {
StringBuffer stringBuffer = new StringBuffer();
char[] cArray = string.toCharArray();
int n = 0;
while (n < cArray.length) {
if (cArray[n] == '\t') {
stringBuffer.append(" ");
} else if (cArray[n] != '\u0000') {
stringBuffer.append(cArray[n]);
}
++n;
}
return stringBuffer.toString();
}
static /* synthetic */ Class class(String string, boolean bl) {
try {
Class<?> clazz = Class.forName(string);
if (!bl) {
clazz = clazz.getComponentType();
}
return clazz;
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
public QnxCmdPage(String string, String string2) {
this.name = string;
this.cmd = string2;
}
}
@@ -0,0 +1,73 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.sys.NreLib
* javax.baja.spy.Spy
* javax.baja.spy.SpyDir
* javax.baja.spy.SpyWriter
*/
package com.tridium.platform.qnx;
import com.tridium.platform.qnx.QnxCmdPage;
import com.tridium.sys.NreLib;
import javax.baja.spy.Spy;
import javax.baja.spy.SpyDir;
import javax.baja.spy.SpyWriter;
public class QnxDiagnosticsPage
extends SpyDir {
public void write(SpyWriter spyWriter) throws Exception {
spyWriter.startTable(false);
spyWriter.trTitle((Object)"Platform Diagnostics", 1);
String[] stringArray = this.list();
int n = 0;
while (n < stringArray.length) {
String string = stringArray[n];
String string2 = this.find(string).getTitle();
if (string2 == null) {
string2 = string;
}
spyWriter.w((Object)"<tr><td>").a(stringArray[n], string2).w((Object)"</td></tr>\n");
++n;
}
spyWriter.endTable();
}
public QnxDiagnosticsPage() {
this.add("df -k", (Spy)new QnxCmdPage("df -k", "/proc/boot/df -k"));
this.add("cpu", (Spy)new QnxCmdPage("cpu", "/proc/boot/cat /dev/qspy"));
this.add("ifconfig -a", (Spy)new QnxCmdPage("ifconfig -a", "/proc/boot/ifconfig -a"));
String string = NreLib.getHostModel();
if (string.equalsIgnoreCase("NPM3") || string.equalsIgnoreCase("NPM6") || string.equalsIgnoreCase("NPM6E")) {
this.add("ndio status", (Spy)new QnxCmdPage("ndio status", "/proc/boot/ndioc status"));
}
this.add("log", (Spy)new QnxCmdPage("log", "/proc/boot/slogin"));
this.add("log log1", (Spy)new QnxCmdPage("log log1", "/proc/boot/slogin /var/slog/log1"));
this.add("log log2", (Spy)new QnxCmdPage("log log2", "/proc/boot/slogin /var/slog/log2"));
this.add("nicinfo", (Spy)new QnxCmdPage("nicinfo", "/proc/boot/nicinfo"));
this.add("pidin", (Spy)new QnxCmdPage("pidin", "/proc/boot/pidin"));
this.add("pidin arg", (Spy)new QnxCmdPage("pidin arg", "/proc/boot/pidin arg"));
this.add("pidin env", (Spy)new QnxCmdPage("pidin env", "/proc/boot/pidin env"));
this.add("pidin family", (Spy)new QnxCmdPage("pidin family", "/proc/boot/pidin family"));
this.add("pidin in", (Spy)new QnxCmdPage("pidin in", "/proc/boot/pidin in"));
this.add("pidin mem", (Spy)new QnxCmdPage("pidin mem", "/proc/boot/pidin mem"));
this.add("pidin pmem", (Spy)new QnxCmdPage("pidin pmem", "/proc/boot/pidin pmem"));
this.add("pidin times", (Spy)new QnxCmdPage("pidin times", "/proc/boot/pidin times"));
this.add("pidin ttimes", (Spy)new QnxCmdPage("pidin ttimes", "/proc/boot/pidin ttimes"));
this.add("netstat -A", (Spy)new QnxCmdPage("netstat -A", "/proc/boot/netstat -A"));
this.add("fd usage", (Spy)new QnxCmdPage("fdcount", "/proc/boot/fdcount -a"));
this.add("tfpdump", (Spy)new QnxCmdPage("tfpdump", "/proc/boot/tfpdump"));
this.add("ffs0 disk usage", (Spy)new QnxCmdPage("ffs0 disk usage", "/proc/boot/du -k /ffs0"));
if (System.getProperty("os.arch").equalsIgnoreCase("ppc")) {
this.add("flash statistics", (Spy)new QnxCmdPage("flash statistics", "/proc/boot/etfsctl -i"));
}
try {
if (Class.forName("com.tridium.platform.qnx.se.QnxJmxInfo") != null) {
this.add("JMX Info", (Spy)new QnxCmdPage("JMX info", "jmxinfo"));
}
}
catch (Throwable throwable) {}
}
}
@@ -0,0 +1,54 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platform.qnx;
import com.tridium.platform.qnx.WaitPidResponse;
import java.io.File;
import java.io.FileNotFoundException;
public class QnxNativeUtil {
public static final int WCONTINUED = 8;
public static final int WEXITED = 1;
public static final int WNOHANG = 64;
public static final int WNOWAIT = 128;
public static final int WSTOPPED = 4;
public static final int WUNTRACED = 4;
public static final int ECHILD = 10;
public static final int EINTR = 4;
public static final int EINVAL = 22;
public static final int EAGAIN = 11;
public static final int EPERM = 1;
public static final int ESRCH = 3;
public static final int SIGHUP = 1;
public static final int SIGINT = 2;
public static final int SIGQUIT = 3;
public static final int SIGKILL = 9;
public static final int SIGTERM = 15;
public static final int SIGUSR1 = 16;
public static final int SIGUSR2 = 17;
public static final void waitFor(File file, int n) throws FileNotFoundException {
int n2 = n;
while (n2 > 0) {
if (file.exists()) {
return;
}
--n2;
try {
Thread.sleep(1000L);
}
catch (Exception exception) {}
}
throw new FileNotFoundException("timeout: " + file + " not available");
}
public static final native int spawn(String var0);
public static final native int kill(int var0, int var1);
public static final native void slay(String var0, int var1);
public static final native WaitPidResponse waitPid(int var0, int var1);
}
@@ -0,0 +1,19 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platform.qnx;
class TimeZoneEntry {
String tz_name;
String tz_str;
String tz_dst_suffix;
String etcTimezone;
TimeZoneEntry(String string, String string2, String string3) {
this.tz_name = string;
this.tz_str = string2;
this.tz_dst_suffix = string3;
this.etcTimezone = string2 + string3;
}
}
@@ -0,0 +1,104 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platform.qnx;
import com.tridium.platform.qnx.TimeZoneEntry;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Hashtable;
import java.util.Vector;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class TzUtil {
TimeZoneEntry lastTzNameLookup;
TimeZoneEntry lastEtcTimezoneLookup;
private boolean loaded;
private Hashtable byEtcTimezone;
private Hashtable byTzName;
private String[] tz_names;
public void load(String string) throws IOException {
String string2;
BufferedReader bufferedReader = new BufferedReader(new FileReader(string));
this.byEtcTimezone = new Hashtable(350);
this.byTzName = new Hashtable(350);
Vector<String> vector = new Vector<String>(350);
while ((string2 = bufferedReader.readLine()) != null) {
if (!string2.startsWith("tz")) continue;
string2 = string2.replace('\t', ' ');
int n = string2.indexOf(34);
int n2 = string2.indexOf(34, n + 1);
String string3 = string2.substring(n + 1, n2).trim();
String string4 = string2.substring(n2);
n = string4.indexOf(44);
n2 = string4.indexOf(44, n + 1);
String string5 = string4.substring(n + 1, n2).trim();
String string6 = string4.substring(n2 + 1).trim();
if (!string6.equals("")) {
n = string6.indexOf(34);
n2 = string6.indexOf(34, n + 1);
string6 = string6.substring(n + 1, n2).trim();
}
TimeZoneEntry timeZoneEntry = new TimeZoneEntry(string3, string5, string6);
this.byEtcTimezone.put(timeZoneEntry.etcTimezone, timeZoneEntry);
this.byTzName.put(string3, timeZoneEntry);
vector.add(string3);
}
try {
bufferedReader.close();
}
catch (Exception exception) {}
this.tz_names = new String[vector.size()];
vector.toArray(this.tz_names);
this.loaded = true;
}
public String getTzName(String string) {
if (!this.loaded && this.lastTzNameLookup != null && this.lastTzNameLookup.etcTimezone.equals(string)) {
return this.lastTzNameLookup.tz_name;
}
TimeZoneEntry timeZoneEntry = (TimeZoneEntry)this.byEtcTimezone.get(string);
if (timeZoneEntry == null) {
return "Unknown timezone";
}
this.lastTzNameLookup = timeZoneEntry;
return timeZoneEntry.tz_name;
}
public String getEtcTimezone(String string) {
if (this.lastEtcTimezoneLookup != null && this.lastEtcTimezoneLookup.tz_name.equals(string)) {
return this.lastEtcTimezoneLookup.etcTimezone;
}
TimeZoneEntry timeZoneEntry = (TimeZoneEntry)this.byTzName.get(string);
if (timeZoneEntry == null) {
return "UTC";
}
this.lastEtcTimezoneLookup = timeZoneEntry;
return timeZoneEntry.etcTimezone;
}
public String[] getTzNames() {
return this.tz_names;
}
private final /* synthetic */ void this() {
this.lastTzNameLookup = null;
this.lastEtcTimezoneLookup = null;
this.loaded = false;
}
public TzUtil() throws IOException {
this.this();
this.load("/etc/timezone/uc_tz_t");
}
public TzUtil(String string) throws IOException {
this.this();
this.load(string);
}
}
@@ -0,0 +1,77 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platform.qnx;
public class WaitPidResponse {
private int rc;
private int errno;
private int status;
public int getRc() {
return this.rc;
}
public int getErrno() {
return this.errno;
}
public int getStatus() {
return this.status;
}
public int WEXITSTATUS() {
return this.status >> 8 & 0xFF;
}
public boolean WIFCONTINUED() {
boolean bl = false;
if ((this.status & (char)-1) == (char)-1) {
bl = true;
}
return bl;
}
public boolean WIFEXITED() {
boolean bl = false;
if ((this.status & 0xFF) == 0) {
bl = true;
}
return bl;
}
public boolean WIFSIGNALED() {
boolean bl = false;
if ((this.status & 0xFF) != 0 && (this.status & 0xFF00) == 0) {
bl = true;
}
return bl;
}
public boolean WIFSTOPPED() {
boolean bl = false;
if ((this.status & 0xFF) == 127 && (this.status & 0xFF00) != 0) {
bl = true;
}
return bl;
}
public int WSTOPSIG() {
return this.status >> 8 & 0xFF;
}
public int WTERMSIG() {
return this.status & 0x7F;
}
public String toString() {
return "rc=" + this.rc + ", errno = " + this.errno + ", status = " + this.status;
}
private WaitPidResponse(int n, int n2, int n3) {
this.rc = n;
this.errno = n2;
this.status = n3;
}
}
@@ -0,0 +1,50 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.spy.SpyWriter
*/
package com.tridium.platform.qnx.se;
import java.lang.management.ClassLoadingMXBean;
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryPoolMXBean;
import java.lang.management.MemoryUsage;
import java.lang.management.ThreadMXBean;
import java.util.List;
import javax.baja.spy.SpyWriter;
public class QnxJmxInfo {
public static int dumpJmxInfo(SpyWriter spyWriter) {
spyWriter.startTable(false);
spyWriter.trTitle((Object)"JMX Thread Info", 1);
spyWriter.endTable();
spyWriter.w((Object)"<pre>\n");
spyWriter.write("\nJMX Thread Info\n");
ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
spyWriter.write("\tpeak thread count " + threadMXBean.getPeakThreadCount() + '\n');
spyWriter.write("\tcurrent thread count " + threadMXBean.getThreadCount() + '\n');
spyWriter.write("\ttotal started count " + threadMXBean.getTotalStartedThreadCount() + '\n');
spyWriter.write("\nJMX Class Loading Info\n");
ClassLoadingMXBean classLoadingMXBean = ManagementFactory.getClassLoadingMXBean();
spyWriter.write("\tloaded class " + classLoadingMXBean.getLoadedClassCount() + '\n');
spyWriter.write("\ttotal loaded " + classLoadingMXBean.getTotalLoadedClassCount() + '\n');
spyWriter.write("\tunloaded " + classLoadingMXBean.getUnloadedClassCount() + '\n');
spyWriter.write("\nJMX Memory Pool Info\n\n");
List<MemoryPoolMXBean> list = ManagementFactory.getMemoryPoolMXBeans();
int n = 0;
while (n < list.size()) {
MemoryPoolMXBean memoryPoolMXBean = list.get(n);
MemoryUsage memoryUsage = memoryPoolMXBean.getUsage();
MemoryUsage memoryUsage2 = memoryPoolMXBean.getPeakUsage();
spyWriter.write(memoryPoolMXBean.getName() + '\n');
spyWriter.write("\tcurrent " + memoryUsage + '\n');
spyWriter.write("\tpeak " + memoryUsage2 + "\n\n");
++n;
}
spyWriter.w((Object)"</pre>\n");
spyWriter.flush();
return 0;
}
}