45 |
|
#endif |
46 |
|
|
47 |
|
#include "tools.h" |
48 |
+ |
#include "statgrab.h" |
49 |
|
|
50 |
|
#ifdef SOLARIS |
51 |
|
#ifdef HAVE_LIBDEVINFO_H |
172 |
|
char *value; |
173 |
|
int instance; |
174 |
|
if ((root_node = di_init("/", DINFOCPYALL)) == DI_NODE_NIL) { |
175 |
< |
return 1; |
175 |
> |
return -1; |
176 |
|
} |
177 |
|
node = di_drv_first_node(alias, root_node); |
178 |
|
while (node != DI_NODE_NIL) { |
214 |
|
int found; |
215 |
|
|
216 |
|
if ((kc = kstat_open()) == NULL) { |
217 |
< |
return 1; |
217 |
> |
return -1; |
218 |
|
} |
219 |
|
|
220 |
|
for (ksp = kc->kc_chain; ksp; ksp = ksp->ks_next) { |
236 |
|
if (x>=BIG_ENOUGH){ |
237 |
|
/* We've got bigger than we thought was massive */ |
238 |
|
/* If we hit this.. Make big enough bigger */ |
239 |
< |
return 1; |
239 |
> |
return -1; |
240 |
|
} |
241 |
|
if( !strncmp(driver_list[x], device_name, BIG_ENOUGH)){ |
242 |
|
found = 1; |
246 |
|
|
247 |
|
if(!found){ |
248 |
|
if((get_alias(device_name)) != 0){ |
249 |
< |
return 1; |
249 |
> |
return -1; |
250 |
|
} |
251 |
|
strncpy(driver_list[x], device_name, BIG_ENOUGH); |
252 |
|
list_entries++; |
480 |
|
int sg_init(){ |
481 |
|
#if (defined(FREEBSD) && !defined(FREEBSD5)) || defined(DFBSD) |
482 |
|
if (sg_get_kvm() == NULL) { |
483 |
< |
return 1; |
483 |
> |
return -1; |
484 |
|
} |
485 |
|
if (sg_get_kvm2() == NULL) { |
486 |
< |
return 1; |
486 |
> |
return -1; |
487 |
|
} |
488 |
|
#endif |
489 |
|
#ifdef SOLARIS |
502 |
|
if (setegid(getgid()) != 0) return -1; |
503 |
|
if (seteuid(getuid()) != 0) return -1; |
504 |
|
return 0; |
505 |
+ |
} |
506 |
+ |
|
507 |
+ |
void *sg_realloc(void *ptr, size_t size) { |
508 |
+ |
void *tmp = NULL; |
509 |
+ |
tmp = realloc(ptr, size); |
510 |
+ |
if(tmp == NULL) { |
511 |
+ |
sg_set_error(SG_ERROR_MALLOC_FAILED, NULL); |
512 |
+ |
} |
513 |
+ |
return tmp; |
514 |
|
} |
515 |
|
|