diff --git a/bindings/java/src/jni/generate.pl b/bindings/java/src/jni/generate.pl index f56bb9fd..83d67f96 100644 --- a/bindings/java/src/jni/generate.pl +++ b/bindings/java/src/jni/generate.pl @@ -818,6 +818,15 @@ my %classes = ( plat => 'LFS' }, ], + #only for jfieldId cache/setters + NetStat => [ + { + name => 'tcp_inbound_total', type => 'Int', + }, + { + name => 'tcp_outbound_total', type => 'Int', + }, + ], ResourceLimit => [ { name => 'cpu_cur', @@ -1202,8 +1211,8 @@ EOF my %has_name_arg = map { $_, 1 } qw(FileSystemUsage FileAttrs DirStat DirUsage NetInterfaceConfig NetInterfaceStat); my %proc_no_arg = map { $_, 1 } qw(stat); -my %get_not_impl = map { $_, 1 } qw(net_address net_route net_connection who - cpu_info file_system); #list funcs only +my %get_not_impl = map { $_, 1 } qw(net_address net_route net_connection net_stat + who cpu_info file_system); #list funcs only my %field_cache; my $i = 0; diff --git a/bindings/java/src/jni/javasigar.c b/bindings/java/src/jni/javasigar.c index fbd6e156..6ce875ae 100644 --- a/bindings/java/src/jni/javasigar.c +++ b/bindings/java/src/jni/javasigar.c @@ -843,11 +843,7 @@ JNIEXPORT void SIGAR_JNI(NetStat_nstat) cls = JENV->GetObjectClass(env, obj); - id = JENV->GetFieldID(env, cls, "tcpInboundTotal", "I"); - JENV->SetIntField(env, obj, id, netstat.tcp_inbound_total); - - id = JENV->GetFieldID(env, cls, "tcpOutboundTotal", "I"); - JENV->SetIntField(env, obj, id, netstat.tcp_outbound_total); + JAVA_SIGAR_SET_FIELDS_NETSTAT(cls, obj, netstat); if (sizeof(tcp_states[0]) == sizeof(netstat.tcp_states[0])) { memcpy(&tcp_states[0], &netstat.tcp_states[0],