| 1 |
|
# |
| 2 |
|
# i-scream pystatgrab |
| 3 |
< |
# http://www.i-scream.org |
| 3 |
> |
# http://www.i-scream.org/pystatgrab/ |
| 4 |
|
# Copyright (C) 2000-2004 i-scream |
| 5 |
|
# |
| 6 |
|
# This program is free software; you can redistribute it and/or |
| 62 |
|
SG_ERROR_XSW_VER_MISMATCH |
| 63 |
|
|
| 64 |
|
cdef extern void sg_set_error(sg_error code, char *arg) |
| 65 |
+ |
cdef extern void sg_set_error_with_errno(sg_error code, char *arg) |
| 66 |
|
cdef extern sg_error sg_get_error() |
| 67 |
|
cdef extern char *sg_get_error_arg() |
| 68 |
+ |
cdef extern int sg_get_error_errno() |
| 69 |
|
cdef extern char *sg_str_error(sg_error code) |
| 70 |
|
|
| 71 |
|
ctypedef struct sg_host_info: |
| 140 |
|
long long total_inodes |
| 141 |
|
long long used_inodes |
| 142 |
|
long long free_inodes |
| 143 |
+ |
long long avail_inodes |
| 144 |
+ |
long long io_size |
| 145 |
+ |
long long block_size |
| 146 |
+ |
long long total_blocks |
| 147 |
+ |
long long free_blocks |
| 148 |
+ |
long long used_blocks |
| 149 |
+ |
long long avail_blocks |
| 150 |
|
|
| 151 |
|
cdef extern sg_fs_stats *sg_get_fs_stats(int *entries) |
| 152 |
|
|
| 181 |
|
ctypedef struct sg_network_iface_stats: |
| 182 |
|
char *interface_name |
| 183 |
|
int speed |
| 184 |
< |
sg_iface_duplex dup |
| 184 |
> |
sg_iface_duplex duplex |
| 185 |
|
int up |
| 186 |
|
|
| 187 |
|
cdef extern sg_network_iface_stats *sg_get_network_iface_stats(int *entries) |
| 304 |
|
def py_sg_set_error(code, arg): |
| 305 |
|
sg_set_error(code, arg) |
| 306 |
|
|
| 307 |
+ |
def py_sg_set_error_with_errno(code, arg): |
| 308 |
+ |
sg_set_error_with_errno(code, arg) |
| 309 |
+ |
|
| 310 |
|
def py_sg_get_error(): |
| 311 |
|
cdef sg_error s |
| 312 |
|
s = sg_get_error() |
| 316 |
|
s = sg_get_error_arg() |
| 317 |
|
return s |
| 318 |
|
|
| 319 |
+ |
def py_sg_get_error_errno(): |
| 320 |
+ |
s = sg_get_error_errno() |
| 321 |
+ |
return s |
| 322 |
+ |
|
| 323 |
|
def py_sg_str_error(code): |
| 324 |
|
s = sg_str_error(code) |
| 325 |
|
return s |
| 455 |
|
'total_inodes': s.total_inodes, |
| 456 |
|
'used_inodes': s.used_inodes, |
| 457 |
|
'free_inodes': s.free_inodes, |
| 458 |
+ |
'avail_inodes': s.avail_inodes, |
| 459 |
+ |
'io_size': s.io_size, |
| 460 |
+ |
'block_size': s.block_size, |
| 461 |
+ |
'total_blocks': s.total_blocks, |
| 462 |
+ |
'free_blocks': s.free_blocks, |
| 463 |
+ |
'used_blocks': s.used_blocks, |
| 464 |
+ |
'avail_blocks': s.avail_blocks, |
| 465 |
|
} |
| 466 |
|
)) |
| 467 |
|
s = s + 1 |
| 560 |
|
list.append(Result( |
| 561 |
|
{'interface_name': s.interface_name, |
| 562 |
|
'speed': s.speed, |
| 563 |
< |
'dup': s.dup, |
| 563 |
> |
'duplex': s.duplex, |
| 564 |
|
'up' : s.up, |
| 565 |
|
} |
| 566 |
|
)) |
| 597 |
|
raise StatgrabException, 'sg_get_process_stats() returned NULL' |
| 598 |
|
list = [] |
| 599 |
|
for i from 0 <= i < entries: |
| 600 |
< |
if s.process_name == NULL: |
| 601 |
< |
s.process_name = '' |
| 602 |
< |
if s.proctitle == NULL: |
| 603 |
< |
s.proctitle = '' |
| 600 |
> |
if s.process_name is NULL: |
| 601 |
> |
process_name = '' |
| 602 |
> |
else: |
| 603 |
> |
process_name = s.process_name |
| 604 |
> |
if s.proctitle is NULL: |
| 605 |
> |
proctitle = '' |
| 606 |
> |
else: |
| 607 |
> |
proctitle = s.proctitle |
| 608 |
|
list.append(Result( |
| 609 |
< |
{'process_name': s.process_name, |
| 610 |
< |
'proctitle' : s.proctitle, |
| 609 |
> |
{'process_name': process_name, |
| 610 |
> |
'proctitle' : proctitle, |
| 611 |
|
'pid' : s.pid, |
| 612 |
|
'parent' : s.parent, |
| 613 |
|
'pgid' : s.pgid, |