[jbossnative-commits] JBoss Native SVN: r1023 - trunk/sight/native/os/linux.
jbossnative-commits at lists.jboss.org
jbossnative-commits at lists.jboss.org
Wed Sep 12 14:10:32 EDT 2007
Author: mladen.turk at jboss.com
Date: 2007-09-12 14:10:32 -0400 (Wed, 12 Sep 2007)
New Revision: 1023
Modified:
trunk/sight/native/os/linux/netadapter.c
trunk/sight/native/os/linux/network.c
trunk/sight/native/os/linux/tcpstat.c
trunk/sight/native/os/linux/udpstat.c
trunk/sight/native/os/linux/volume.c
Log:
Fix formating
Modified: trunk/sight/native/os/linux/netadapter.c
===================================================================
--- trunk/sight/native/os/linux/netadapter.c 2007-09-12 17:57:27 UTC (rev 1022)
+++ trunk/sight/native/os/linux/netadapter.c 2007-09-12 18:10:32 UTC (rev 1023)
@@ -189,7 +189,7 @@
for (i = 0; i < IFHWADDRLEN; i++) {
if (buf[i]) {
j = 1;
- break;
+ break;
}
}
if (!j)
@@ -212,7 +212,7 @@
memset(&ifi, 0, sizeof(struct ifreq));
strcpy(ifi.ifr_name, name);
- if (!ioctl(sd, SIOCGIFINDEX, (char *)&ifi))
+ if (!ioctl(sd, SIOCGIFINDEX, (char *)&ifi))
id->index = ifi.ifr_ifindex;
else
id->index = -1;
@@ -229,7 +229,7 @@
}
if ((id->flags & IFF_BROADCAST) &&
- !ioctl(sd, SIOCGIFBRDADDR, (char *)&ifi)) {
+ !ioctl(sd, SIOCGIFBRDADDR, (char *)&ifi)) {
sa = (struct sockaddr_in *)&ifi.ifr_broadaddr;
inet_ntop(AF_INET, &sa->sin_addr, id->badr, 64);
}
@@ -267,7 +267,7 @@
goto cleanup;
}
- ifc.ifc_buf = NULL;
+ ifc.ifc_buf = NULL;
if (ioctl(e->sd, SIOCGIFCONF, (char *)&ifc) < 0) {
throwAprException(_E, apr_get_os_error());
goto cleanup;
@@ -290,7 +290,7 @@
sa = (struct sockaddr_in *)&ifr->ifr_addr;
inet_ntop(AF_INET, &sa->sin_addr, las, 64);
ce = cache_add(e->ifc, ifr->ifr_name);
- if (!(id = (net_ifc_data_t *)ce->data)) {
+ if (!(id = (net_ifc_data_t *)ce->data)) {
if (!(id = (net_ifc_data_t *)sight_calloc(_E,
sizeof(net_ifc_data_t),
THROW_FMARK))) {
@@ -307,7 +307,7 @@
}
}
-
+
free(ifc.ifc_buf);
/* Add missing interfaces from /proc/net/dev */
if ((i4a = sight_arr_rload(PROC_NET_DEV)) != NULL) {
@@ -328,7 +328,7 @@
do_ifrec(id, e->sd, i4a->arr.ca[i]);
id->type = AF_INET;
ce->data = id;
- }
+ }
}
sight_arr_free(i4a);
}
@@ -375,7 +375,7 @@
}
else {
strcpy(id->ip6a, las);
- }
+ }
}
sight_arr_free(i6a);
}
@@ -419,7 +419,7 @@
/* TODO: Figure out the Description */
SET_IFIELD_S(0001, thiz, e->ifc->list[e->idx]->key);
SET_IFIELD_S(0002, thiz, e->ifc->list[e->idx]->key);
-
+
if (id->maca[0]) {
addr = sight_new_netaddr_class(_E, _O);
if (!addr || (*_E)->ExceptionCheck(_E))
@@ -442,7 +442,7 @@
/* Set adapter status */
if (id->flags & IFF_UP) {
CALL_METHOD1(0001, thiz, SIGHT_IFO_UP);
- }
+ }
else {
CALL_METHOD1(0001, thiz, SIGHT_IFO_DOWN);
}
@@ -466,7 +466,7 @@
if (id->mask[0])
sight_netaddr_set_mask(_E, addr, id->mask);
(*_E)->SetObjectArrayElement(_E, aarr, idx++, addr);
- (*_E)->DeleteLocalRef(_E, addr);
+ (*_E)->DeleteLocalRef(_E, addr);
}
if (id->ip6a[0]) {
addr = sight_new_netaddr_class(_E, _O);
@@ -475,14 +475,14 @@
sight_netaddr_set_addr(_E, addr, id->ip6a);
sight_netaddr_set_family(_E, addr, AF_INET6);
(*_E)->SetObjectArrayElement(_E, aarr, idx++, addr);
- (*_E)->DeleteLocalRef(_E, addr);
+ (*_E)->DeleteLocalRef(_E, addr);
}
SET_IFIELD_O(0006, thiz, aarr);
(*_E)->DeleteLocalRef(_E, aarr);
}
SET_IFIELD_I(0009, thiz, id->mtu);
-cleanup:
+cleanup:
e->idx++;
}
Modified: trunk/sight/native/os/linux/network.c
===================================================================
--- trunk/sight/native/os/linux/network.c 2007-09-12 17:57:27 UTC (rev 1022)
+++ trunk/sight/native/os/linux/network.c 2007-09-12 18:10:32 UTC (rev 1023)
@@ -85,7 +85,7 @@
char *pd;
jsize len = 0, idx = 0;
UNREFERENCED_O;
-
+
if (gethostname(buf, SIGHT_SBUFFER_LEN)) {
throwAprException(_E, apr_get_os_error());
return;
@@ -109,7 +109,7 @@
if (strstr(tdns->arr.ca[i], "nameserver")) {
len++;
}
- }
+ }
if (len) {
jobject addr;
jobjectArray aaddr;
@@ -129,10 +129,10 @@
(*_E)->SetObjectArrayElement(_E, aaddr, idx++, addr);
(*_E)->DeleteLocalRef(_E, addr);
}
- }
+ }
SET_IFIELD_O(0002, thiz, aaddr);
(*_E)->DeleteLocalRef(_E, aaddr);
- }
+ }
}
cleanup:
if (tdns)
Modified: trunk/sight/native/os/linux/tcpstat.c
===================================================================
--- trunk/sight/native/os/linux/tcpstat.c 2007-09-12 17:57:27 UTC (rev 1022)
+++ trunk/sight/native/os/linux/tcpstat.c 2007-09-12 18:10:32 UTC (rev 1023)
@@ -174,7 +174,7 @@
0,
0,
0,
- 0
+ 0
};
/* Initialize volume enumeration */
@@ -195,6 +195,7 @@
if (iftype == 1) {
if (!(tnet = sight_arr_rload(PROC_NET_FS "sockstat"))) {
throwAprException(_E, apr_get_os_error());
+ return;
}
for (i = 0; i < tnet->siz; i++) {
if (memcmp(tnet->arr.ca[i], "TCP: inuse ", 11) == 0) {
@@ -206,6 +207,7 @@
else if (iftype == 2) {
if (!(tnet = sight_arr_rload(PROC_NET_FS "sockstat6"))) {
throwAprException(_E, apr_get_os_error());
+ return;
}
for (i = 0; i < tnet->siz; i++) {
if (memcmp(tnet->arr.ca[i], "TCP6: inuse ", 12) == 0) {
@@ -222,6 +224,7 @@
if (!(tnet = sight_arr_rload(PROC_NET_FS "snmp"))) {
throwAprException(_E, apr_get_os_error());
+ return;
}
/* Get the information corresponding to the second entry Tcp: */
@@ -347,13 +350,13 @@
&d, las, &lp, ras, &rp, &state,
&txq, &rxq, &timer_run, &timelen, &retr,
&uid, &timeout, &inode, more);
-
+
if (e->type == 1) {
/* IPV4 entries */
int al;
struct in_addr in4;
- al = sscanf(las, "%X", &in4.s_addr);
+ al = sscanf(las, "%X", &in4.s_addr);
if (al == 1)
inet_ntop(AF_INET, &in4, las, 64);
else
Modified: trunk/sight/native/os/linux/udpstat.c
===================================================================
--- trunk/sight/native/os/linux/udpstat.c 2007-09-12 17:57:27 UTC (rev 1022)
+++ trunk/sight/native/os/linux/udpstat.c 2007-09-12 18:10:32 UTC (rev 1023)
@@ -139,6 +139,7 @@
if (!(tnet = sight_arr_rload("/proc/net/snmp"))) {
throwAprException(_E, apr_get_os_error());
+ return;
}
/* Get the information corresponding to the second entry Tcp: */
@@ -254,13 +255,13 @@
&d, las, &lp, ras, &rp, &state,
&txq, &rxq, &timer_run, &timelen, &retr,
&uid, &timeout, &inode, more);
-
+
if (e->type == 1) {
/* IPV4 entries */
int al;
struct in_addr in4;
- al = sscanf(las, "%X", &in4.s_addr);
+ al = sscanf(las, "%X", &in4.s_addr);
if (al == 1)
inet_ntop(AF_INET, &in4, las, 64);
else
@@ -309,7 +310,7 @@
sight_udpconn_set_cts(_E, conn, apr_time_as_msec(ctime));
}
sight_udpconn_set_pid(_E, conn, pid);
-
+
switch (state) {
case TCP_ESTABLISHED:
sight_tcpconn_set_state(_E, conn, 2);
Modified: trunk/sight/native/os/linux/volume.c
===================================================================
--- trunk/sight/native/os/linux/volume.c 2007-09-12 17:57:27 UTC (rev 1022)
+++ trunk/sight/native/os/linux/volume.c 2007-09-12 18:10:32 UTC (rev 1023)
@@ -207,9 +207,9 @@
int flags = 0;
int dtype = sight_get_fs_type(ent.mnt_type);
SET_IFIELD_S(0000, thiz, ent.mnt_fsname);
- SET_IFIELD_S(0002, thiz, ent.mnt_dir);
+ SET_IFIELD_S(0002, thiz, ent.mnt_dir);
CALL_METHOD1(0000, thiz, dtype);
-
+
if (!statvfs(ent.mnt_dir, &sv)) {
SET_IFIELD_I(0004, thiz, sv.f_bsize);
SET_IFIELD_J(0005, thiz, sv.f_frsize * sv.f_bavail);
@@ -221,30 +221,30 @@
if (hasmntopt(&ent, MNTOPT_RO))
flags |= SIGHT_READ_ONLY_VOLUME;
if (hasmntopt(&ent, MNTOPT_SUID))
- flags |= SIGHT_SUID_VOLUME;
+ flags |= SIGHT_SUID_VOLUME;
CALL_METHOD1(0001, thiz, flags);
switch (dtype) {
case SIGHT_FS_UNKNOWN:
- CALL_METHOD1(0002, thiz, SIGHT_DRIVE_UNKNOWN);
+ CALL_METHOD1(0002, thiz, SIGHT_DRIVE_UNKNOWN);
break;
case SIGHT_FS_ISO9660:
- CALL_METHOD1(0002, thiz, SIGHT_DRIVE_CDROM);
+ CALL_METHOD1(0002, thiz, SIGHT_DRIVE_CDROM);
break;
case SIGHT_FS_DEV:
case SIGHT_FS_PROC:
case SIGHT_FS_SYSFS:
case SIGHT_FS_TMPFS:
- CALL_METHOD1(0002, thiz, SIGHT_DRIVE_RAMDISK);
+ CALL_METHOD1(0002, thiz, SIGHT_DRIVE_RAMDISK);
break;
case SIGHT_FS_NFS:
case SIGHT_FS_RPC:
- CALL_METHOD1(0002, thiz, SIGHT_DRIVE_REMOTE);
+ CALL_METHOD1(0002, thiz, SIGHT_DRIVE_REMOTE);
break;
case SIGHT_FS_USBFS:
- CALL_METHOD1(0002, thiz, SIGHT_DRIVE_REMOVABLE);
+ CALL_METHOD1(0002, thiz, SIGHT_DRIVE_REMOVABLE);
break;
default:
- CALL_METHOD1(0002, thiz, SIGHT_DRIVE_FIXED);
+ CALL_METHOD1(0002, thiz, SIGHT_DRIVE_FIXED);
break;
}
More information about the jbossnative-commits
mailing list