]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/spdk/lib/ut_mock/mock.c
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / spdk / lib / ut_mock / mock.c
index 8bee1c4ac4cd5e104f77f5b5ddbc5b182d3d3be8..cfe51c1d5b6871d51d4f4148b3b07bebb9a39126 100644 (file)
@@ -41,3 +41,31 @@ DEFINE_WRAPPER(pthread_mutex_init, int,
 
 DEFINE_WRAPPER(pthread_mutexattr_init, int,
               (pthread_mutexattr_t *attr), (attr))
+
+DEFINE_WRAPPER(recvmsg, ssize_t, (int sockfd, struct msghdr *msg, int flags), (sockfd, msg, flags))
+
+DEFINE_WRAPPER(sendmsg, ssize_t, (int sockfd, const struct msghdr *msg, int flags), (sockfd, msg,
+               flags))
+
+DEFINE_WRAPPER(writev, ssize_t, (int fd, const struct iovec *iov, int iovcnt), (fd, iov, iovcnt))
+
+char *g_unlink_path;
+void (*g_unlink_callback)(void);
+
+int
+__attribute__((used))
+__wrap_unlink(const char *path)
+{
+       if (g_unlink_path == NULL) {
+               return ENOENT;
+       }
+
+       if (strcmp(g_unlink_path, path) != 0) {
+               return ENOENT;
+       }
+
+       if (g_unlink_callback) {
+               g_unlink_callback();
+       }
+       return 0;
+}