sdm: Add sys wrappers for read, write, eventfd system calls
Add function pointers for read, write, and eventfd in Sys
wrapper and call these instead of directly calling system calls.
CRs-Fixed: 814136
Change-Id: I9964df85be2f6eaa83371b71971c642a768830f8
diff --git a/sdm/include/utils/sys.h b/sdm/include/utils/sys.h
index dc45696..ed9b75c 100644
--- a/sdm/include/utils/sys.h
+++ b/sdm/include/utils/sys.h
@@ -25,6 +25,8 @@
#ifndef __SYS_H__
#define __SYS_H__
+#include <sys/eventfd.h>
+#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <poll.h>
@@ -46,6 +48,9 @@
typedef ssize_t (*getline)(char **lineptr, size_t *linelen, FILE *stream);
typedef int (*pthread_cancel)(pthread_t thread);
typedef int (*dup)(int fd);
+ typedef ssize_t (*read)(int, void *, size_t);
+ typedef ssize_t (*write)(int, const void *, size_t);
+ typedef int (*eventfd)(unsigned int, int);
static ioctl ioctl_;
static open open_;
@@ -58,6 +63,9 @@
static getline getline_;
static pthread_cancel pthread_cancel_;
static dup dup_;
+ static read read_;
+ static write write_;
+ static eventfd eventfd_;
};
} // namespace sdm