Skip to content

Commit

Permalink
feat: resolve compile errors in x-pack/audibeat without cgo
Browse files Browse the repository at this point in the history
only enable af_packet module if cgo is enabled
drop cgo dependency from system module
  • Loading branch information
kruskall committed Jan 25, 2025
1 parent e0ef169 commit 3f2526f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
// or more contributor license agreements. Licensed under the Elastic License;
// you may not use this file except in compliance with the Elastic License.

//go:build linux
// +build linux
//go:build linux && cgo

package afpacket

Expand Down
22 changes: 9 additions & 13 deletions x-pack/auditbeat/module/system/socket/guess/creds.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,12 @@ import (
"github.com/elastic/elastic-agent-libs/mapstr"
)

/*
struct mq_attr {
long mq_flags;
long mq_maxmsg;
long mq_msgsize;
long mq_curmsgs;
long __reserved[4];
};
*/
import "C"
type MqAttr struct {
_ int
Maxmsg int
Msgsize int
_ int
}

/*
creds guess discovers the offsets of (E)UID/(E)GID fields within a
Expand Down Expand Up @@ -157,9 +153,9 @@ func (g *guessStructCreds) Trigger() error {
if err != nil {
return err
}
attr := C.struct_mq_attr{
mq_maxmsg: 1,
mq_msgsize: 8,
attr := MqAttr{
Maxmsg: 1,
Msgsize: 8,
}
mqd, _, errno := syscall.Syscall6(unix.SYS_MQ_OPEN,
uintptr(unsafe.Pointer(name)),
Expand Down

0 comments on commit 3f2526f

Please sign in to comment.