Skip to content

Commit

Permalink
use block comment for C code
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewkroh committed Apr 10, 2024
1 parent d15622f commit dcb12a4
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 57 deletions.
5 changes: 0 additions & 5 deletions providers/freebsd/host_freebsd_cgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@

package freebsd

// #cgo LDFLAGS: -lkvm
//#include <kvm.h>
//#include <sys/vmmeter.h>
import "C"

import (
"context"
"errors"
Expand Down
18 changes: 10 additions & 8 deletions providers/freebsd/memory_freebsd_cgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@

package freebsd

// #cgo LDFLAGS: -lkvm
//#include <sys/cdefs.h>
//#include <sys/types.h>
//#include <sys/sysctl.h>

//#include <paths.h>
//#include <kvm.h>
//#include <stdlib.h>
/*
#cgo LDFLAGS: -lkvm
#include <sys/cdefs.h>
#include <sys/types.h>
#include <sys/sysctl.h>
#include <paths.h>
#include <kvm.h>
#include <stdlib.h>
*/
import "C"

import (
Expand Down
96 changes: 52 additions & 44 deletions providers/freebsd/process_freebsd_cgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,50 +19,58 @@

package freebsd

// #cgo LDFLAGS: -lkvm -lprocstat
//#include <sys/types.h>
//#include <sys/sysctl.h>
//#include <sys/time.h>
//#include <sys/param.h>
//#include <sys/queue.h>
//#include <sys/socket.h>
//#include <sys/user.h>
//
//#include <libprocstat.h>
//#include <string.h>
//struct kinfo_proc getProcInfoAt(struct kinfo_proc *procs, unsigned int index) {
// return procs[index];
//}
//unsigned int countArrayItems(char **items) {
// unsigned int i = 0;
// for (i = 0; items[i] != NULL; ++i);
// return i;
//}
//char * itemAtIndex(char **items, unsigned int index) {
// return items[index];
//}
//unsigned int countFileStats(struct filestat_list *head) {
// unsigned int count = 0;
// struct filestat *fst;
// STAILQ_FOREACH(fst, head, next) {
// ++count;
// }
//
// return count;
//}
//void copyFileStats(struct filestat_list *head, struct filestat *out, unsigned int size) {
// unsigned int index = 0;
// struct filestat *fst;
// STAILQ_FOREACH(fst, head, next) {
// if (!size) {
// break;
// }
// memcpy(out, fst, sizeof(*fst));
// ++out;
// --size;
// }
//}
//
import "C"

/*
#cgo LDFLAGS: -lprocstat
#include <sys/types.h>
#include <sys/sysctl.h>
#include <sys/time.h>
#include <sys/param.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/user.h>
#include <libprocstat.h>
#include <string.h>
struct kinfo_proc getProcInfoAt(struct kinfo_proc *procs, unsigned int index) {
return procs[index];
}
unsigned int countArrayItems(char **items) {
unsigned int i = 0;
for (i = 0; items[i] != NULL; ++i);
return i;
}
char * itemAtIndex(char **items, unsigned int index) {
return items[index];
}
unsigned int countFileStats(struct filestat_list *head) {
unsigned int count = 0;
struct filestat *fst;
STAILQ_FOREACH(fst, head, next) {
++count;
}
return count;
}
void copyFileStats(struct filestat_list *head, struct filestat *out, unsigned int size) {
unsigned int index = 0;
struct filestat *fst;
STAILQ_FOREACH(fst, head, next) {
if (!size) {
break;
}
memcpy(out, fst, sizeof(*fst));
++out;
--size;
}
}
*/
import "C"

import (
Expand Down

0 comments on commit dcb12a4

Please sign in to comment.