Merge pull request #195 from cyphar/fix-c-formatting-epoll-arm64
archutils: aarch64: fix build and improve C formatting
This commit is contained in:
commit
4e54940c10
2 changed files with 22 additions and 21 deletions
|
@ -1,4 +1,5 @@
|
|||
//+build !arm64,linux
|
||||
// +build linux,!aarch64
|
||||
|
||||
package archutils
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// +build arm64,linux
|
||||
// +build linux,aarch64
|
||||
|
||||
package archutils
|
||||
|
||||
|
@ -8,21 +8,21 @@ int EpollCreate1(int flag) {
|
|||
return epoll_create1(flag);
|
||||
}
|
||||
|
||||
int EpollCtl(int efd, int op, int sfd, int Events, int Fd) {
|
||||
int EpollCtl(int efd, int op,int sfd, int events, int fd) {
|
||||
struct epoll_event event;
|
||||
event.events = Events;
|
||||
event.data.fd = Fd;
|
||||
event.events = events;
|
||||
event.data.fd = fd;
|
||||
|
||||
return epoll_ctl(efd, op, sfd, &event);
|
||||
}
|
||||
|
||||
typedef struct Event{
|
||||
struct event_t {
|
||||
uint32_t events;
|
||||
int fd;
|
||||
};
|
||||
|
||||
struct epoll_event events[128];
|
||||
int run_epoll_wait(int fd, struct Event *event) {
|
||||
int run_epoll_wait(int fd, struct event_t *event) {
|
||||
int n, i;
|
||||
n = epoll_wait(fd, events, 128, -1);
|
||||
for (i = 0; i < n; i++) {
|
||||
|
@ -57,8 +57,8 @@ func EpollCtl(epfd int, op int, fd int, event *syscall.EpollEvent) error {
|
|||
}
|
||||
|
||||
func EpollWait(epfd int, events []syscall.EpollEvent, msec int) (int, error) {
|
||||
var c_events [128]C.struct_Event
|
||||
n := int(C.run_epoll_wait(C.int(epfd), (*C.struct_Event)(unsafe.Pointer(&c_events))))
|
||||
var c_events [128]C.struct_event_t
|
||||
n := int(C.run_epoll_wait(C.int(epfd), (*C.struct_event_t)(unsafe.Pointer(&c_events))))
|
||||
if n < 0 {
|
||||
return int(n), fmt.Errorf("Failed to wait epoll")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue