fdtrack: add wrapper for eventfd.
Bug: https://issuetracker.google.com/154450436 Test: bionic-unit-tests Change-Id: I59013f0c4da0debbcc50269c64ae9db0cdc4eaa0
This commit is contained in:
parent
a38331d833
commit
7de412443d
|
@ -1022,8 +1022,7 @@ cc_library_static {
|
|||
"bionic/dup.cpp",
|
||||
"bionic/environ.cpp",
|
||||
"bionic/error.cpp",
|
||||
"bionic/eventfd_read.cpp",
|
||||
"bionic/eventfd_write.cpp",
|
||||
"bionic/eventfd.cpp",
|
||||
"bionic/exec.cpp",
|
||||
"bionic/faccessat.cpp",
|
||||
"bionic/fchmod.cpp",
|
||||
|
|
|
@ -312,7 +312,7 @@ int __epoll_create1:epoll_create1(int) all
|
|||
int epoll_ctl(int, int op, int, struct epoll_event*) all
|
||||
int __epoll_pwait:epoll_pwait(int, struct epoll_event*, int, int, const sigset64_t*, size_t) all
|
||||
|
||||
int eventfd:eventfd2(unsigned int, int) all
|
||||
int __eventfd:eventfd2(unsigned int, int) all
|
||||
|
||||
void _exit|_Exit:exit_group(int) all
|
||||
void __exit:exit(int) all
|
||||
|
|
|
@ -29,6 +29,18 @@
|
|||
#include <sys/eventfd.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "private/bionic_fdtrack.h"
|
||||
|
||||
extern "C" int __eventfd(unsigned int initval, int flags);
|
||||
|
||||
int eventfd(unsigned int initval, int flags) {
|
||||
return FDTRACK_CREATE(__eventfd(initval, flags));
|
||||
}
|
||||
|
||||
int eventfd_read(int fd, eventfd_t* value) {
|
||||
return (read(fd, value, sizeof(*value)) == sizeof(*value)) ? 0 : -1;
|
||||
}
|
||||
|
||||
int eventfd_write(int fd, eventfd_t value) {
|
||||
return (write(fd, &value, sizeof(value)) == sizeof(value)) ? 0 : -1;
|
||||
}
|
|
@ -29,6 +29,3 @@
|
|||
#include <sys/eventfd.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int eventfd_write(int fd, eventfd_t value) {
|
||||
return (write(fd, &value, sizeof(value)) == sizeof(value)) ? 0 : -1;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <netinet/in.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/epoll.h>
|
||||
#include <sys/eventfd.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
@ -205,6 +206,8 @@ FDTRACK_TEST(pipe2, ({
|
|||
FDTRACK_TEST(epoll_create, epoll_create(1));
|
||||
FDTRACK_TEST(epoll_create1, epoll_create1(0));
|
||||
|
||||
FDTRACK_TEST(eventfd, eventfd(0, 0));
|
||||
|
||||
#if 0
|
||||
// Why is this generating an extra socket/close event?
|
||||
FDTRACK_TEST(accept, ({
|
||||
|
|
Loading…
Reference in New Issue