64 |
|
#include <sys/fcntl.h> |
65 |
|
#include <dirent.h> |
66 |
|
#endif |
67 |
+ |
#ifdef WIN32 |
68 |
+ |
#include "win32.h" |
69 |
+ |
#endif |
70 |
|
|
71 |
|
#if defined(SOLARIS) && defined(HAVE_LIBDEVINFO_H) |
72 |
|
struct map{ |
249 |
|
if (x>=BIG_ENOUGH){ |
250 |
|
/* We've got bigger than we thought was massive */ |
251 |
|
/* If we hit this.. Make big enough bigger */ |
252 |
+ |
kstat_close(kc); |
253 |
|
return -1; |
254 |
|
} |
255 |
|
if( !strncmp(driver_list[x], device_name, BIG_ENOUGH)){ |
260 |
|
|
261 |
|
if(!found){ |
262 |
|
if((get_alias(device_name)) != 0){ |
263 |
+ |
kstat_close(kc); |
264 |
|
return -1; |
265 |
|
} |
266 |
|
strncpy(driver_list[x], device_name, BIG_ENOUGH); |
269 |
|
} |
270 |
|
} |
271 |
|
|
272 |
+ |
kstat_close(kc); |
273 |
+ |
|
274 |
|
return 0; |
275 |
|
} |
276 |
|
|
451 |
|
return 0; |
452 |
|
} |
453 |
|
|
454 |
+ |
/* join two strings together */ |
455 |
+ |
int sg_concat_string(char **dest, const char *src) { |
456 |
+ |
char *new; |
457 |
+ |
int len = strlen(*dest) + strlen(src) + 1; |
458 |
+ |
|
459 |
+ |
new = sg_realloc(*dest, len); |
460 |
+ |
if (new == NULL) { |
461 |
+ |
return -1; |
462 |
+ |
} |
463 |
+ |
|
464 |
+ |
*dest = new; |
465 |
+ |
strcat(*dest, src); |
466 |
+ |
return 0; |
467 |
+ |
} |
468 |
+ |
|
469 |
|
#if (defined(FREEBSD) && !defined(FREEBSD5)) || defined(DFBSD) |
470 |
|
kvm_t *sg_get_kvm() { |
471 |
|
static kvm_t *kvmd = NULL; |
553 |
|
build_mapping(); |
554 |
|
#endif |
555 |
|
#endif |
556 |
+ |
#ifdef WIN32 |
557 |
+ |
return sg_win32_start_capture(); |
558 |
+ |
#endif |
559 |
|
return 0; |
560 |
|
} |
561 |
|
|
562 |
+ |
int sg_shutdown() { |
563 |
+ |
#ifdef WIN32 |
564 |
+ |
sg_win32_end_capture(); |
565 |
+ |
#endif |
566 |
+ |
return 0; |
567 |
+ |
} |
568 |
+ |
|
569 |
+ |
int sg_snapshot() { |
570 |
+ |
#ifdef WIN32 |
571 |
+ |
return sg_win32_snapshot(); |
572 |
+ |
#else |
573 |
+ |
return 0; |
574 |
+ |
#endif |
575 |
+ |
} |
576 |
+ |
|
577 |
|
int sg_drop_privileges() { |
578 |
+ |
#ifndef WIN32 |
579 |
|
#ifdef HAVE_SETEGID |
580 |
|
if (setegid(getgid()) != 0) { |
581 |
|
#elif defined(HAVE_SETRESGID) |
596 |
|
sg_set_error_with_errno(SG_ERROR_SETEUID, NULL); |
597 |
|
return -1; |
598 |
|
} |
599 |
+ |
#endif /* WIN32 */ |
600 |
|
return 0; |
601 |
|
} |
602 |
|
|