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{ |
447 |
|
return 0; |
448 |
|
} |
449 |
|
|
450 |
+ |
/* join two strings together */ |
451 |
+ |
int sg_concat_string(char **dest, const char *src) { |
452 |
+ |
char *new; |
453 |
+ |
int len = strlen(*dest) + strlen(src) + 1; |
454 |
+ |
|
455 |
+ |
new = sg_realloc(*dest, len); |
456 |
+ |
if (new == NULL) { |
457 |
+ |
return -1; |
458 |
+ |
} |
459 |
+ |
|
460 |
+ |
*dest = new; |
461 |
+ |
strcat(*dest, src); |
462 |
+ |
return 0; |
463 |
+ |
} |
464 |
+ |
|
465 |
|
#if (defined(FREEBSD) && !defined(FREEBSD5)) || defined(DFBSD) |
466 |
|
kvm_t *sg_get_kvm() { |
467 |
|
static kvm_t *kvmd = NULL; |
549 |
|
build_mapping(); |
550 |
|
#endif |
551 |
|
#endif |
552 |
+ |
#ifdef WIN32 |
553 |
+ |
return sg_win32_start_capture(); |
554 |
+ |
#endif |
555 |
|
return 0; |
556 |
|
} |
557 |
|
|
558 |
+ |
int sg_shutdown() { |
559 |
+ |
#ifdef WIN32 |
560 |
+ |
sg_win32_end_capture(); |
561 |
+ |
#endif |
562 |
+ |
return 0; |
563 |
+ |
} |
564 |
+ |
|
565 |
+ |
int sg_snapshot() { |
566 |
+ |
#ifdef WIN32 |
567 |
+ |
return sg_win32_snapshot(); |
568 |
+ |
#else |
569 |
+ |
return 0; |
570 |
+ |
#endif |
571 |
+ |
} |
572 |
+ |
|
573 |
|
int sg_drop_privileges() { |
574 |
+ |
#ifndef WIN32 |
575 |
|
#ifdef HAVE_SETEGID |
576 |
|
if (setegid(getgid()) != 0) { |
577 |
|
#elif defined(HAVE_SETRESGID) |
592 |
|
sg_set_error_with_errno(SG_ERROR_SETEUID, NULL); |
593 |
|
return -1; |
594 |
|
} |
595 |
+ |
#endif /* WIN32 */ |
596 |
|
return 0; |
597 |
|
} |
598 |
|
|