type
stringclasses
5 values
content
stringlengths
9
163k
functions
void update_set_update_update_get_branch2(void) { update_ops = 0; void *env = sp_env(); t( env != NULL ); t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 ); t( sp_setint(env, "scheduler.threads", 0) == 0 ); t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 ); t( sp_setstring(env, "log.path"...
functions
void update_set_update_update_get_compact(void) { update_ops = 0; void *env = sp_env(); t( env != NULL ); t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 ); t( sp_setint(env, "scheduler.threads", 0) == 0 ); t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 ); t( sp_setstring(env, "log.path"...
functions
void update_set_update_update_get_cursor(void) { update_ops = 0; void *env = sp_env(); t( env != NULL ); t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 ); t( sp_setint(env, "scheduler.threads", 0) == 0 ); t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 ); t( sp_setstring(env, "log.path",...
functions
int update_operator_delete(int a_flags, void *a, int a_size, int b_flags, void *b, int b_size, void *arg, void **result, int *result_size) { assert(a == NULL); assert(a_flags == 0); assert(b_flags == SVUPDATE); assert(b != NULL); (void)arg; char *c = malloc(b_size); ...
functions
void update_set_delete_update_get_index(void) { update_ops = 0; void *env = sp_env(); t( env != NULL ); t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 ); t( sp_setint(env, "scheduler.threads", 0) == 0 ); t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 ); t( sp_setstring(env, "log.path", ...
functions
void update_set_delete_update_get_branch0(void) { update_ops = 0; void *env = sp_env(); t( env != NULL ); t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 ); t( sp_setint(env, "scheduler.threads", 0) == 0 ); t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 ); t( sp_setstring(env, "log.path"...
functions
void update_set_delete_update_get_branch1(void) { update_ops = 0; void *env = sp_env(); t( env != NULL ); t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 ); t( sp_setint(env, "scheduler.threads", 0) == 0 ); t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 ); t( sp_setstring(env, "log.path"...
functions
void update_set_delete_update_get_compact(void) { update_ops = 0; void *env = sp_env(); t( env != NULL ); t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 ); t( sp_setint(env, "scheduler.threads", 0) == 0 ); t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 ); t( sp_setstring(env, "log.path"...
functions
void update_delete_update_get_index(void) { update_ops = 0; void *env = sp_env(); t( env != NULL ); t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 ); t( sp_setint(env, "scheduler.threads", 0) == 0 ); t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 ); t( sp_setstring(env, "log.path", st_r...
functions
void update_delete_update_get_branch0(void) { update_ops = 0; void *env = sp_env(); t( env != NULL ); t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 ); t( sp_setint(env, "scheduler.threads", 0) == 0 ); t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 ); t( sp_setstring(env, "log.path", st...
functions
void update_delete_update_get_branch1(void) { update_ops = 0; void *env = sp_env(); t( env != NULL ); t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 ); t( sp_setint(env, "scheduler.threads", 0) == 0 ); t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 ); t( sp_setstring(env, "log.path", st...
functions
void update_delete_update_get_compact(void) { update_ops = 0; void *env = sp_env(); t( env != NULL ); t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 ); t( sp_setint(env, "scheduler.threads", 0) == 0 ); t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 ); t( sp_setstring(env, "log.path", st...
functions
void update_sx_set_update_get(void) { update_ops = 0; void *env = sp_env(); t( env != NULL ); t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 ); t( sp_setint(env, "scheduler.threads", 0) == 0 ); t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 ); t( sp_setstring(env, "log.path", st_r.conf-...
functions
void update_sx_update_update(void) { update_ops = 0; void *env = sp_env(); t( env != NULL ); t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 ); t( sp_setint(env, "scheduler.threads", 0) == 0 ); t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 ); t( sp_setstring(env, "log.path", st_r.conf->...
functions
void update_cursor0(void) { update_ops = 0; void *env = sp_env(); t( env != NULL ); t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 ); t( sp_setint(env, "scheduler.threads", 0) == 0 ); t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 ); t( sp_setstring(env, "log.path", st_r.conf->log_dir, ...
functions
void update_cursor1(void) { update_ops = 0; void *env = sp_env(); t( env != NULL ); t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 ); t( sp_setint(env, "scheduler.threads", 0) == 0 ); t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 ); t( sp_setstring(env, "log.path", st_r.conf->log_dir, ...
functions
void update_cursor2(void) { update_ops = 0; void *env = sp_env(); t( env != NULL ); t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 ); t( sp_setint(env, "scheduler.threads", 0) == 0 ); t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 ); t( sp_setstring(env, "log.path", st_r.conf->log_dir, ...
functions
void update_cursor3(void) { update_ops = 0; void *env = sp_env(); t( env != NULL ); t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 ); t( sp_setint(env, "scheduler.threads", 0) == 0 ); t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 ); t( sp_setstring(env, "log.path", st_r.conf->log_dir, ...
functions
int update_operator2(int a_flags, void *a, int a_size, int b_flags, void *b, int b_size, void *arg, void **result, int *result_size) { assert(b_flags == SVUPDATE); assert(b != NULL); (void)arg; char *c = malloc(b_size); memcpy(c, b, b_size); *result = c; *result_size = b_size; ...
functions
void update_cursor4(void) { update_ops = 0; void *env = sp_env(); t( env != NULL ); t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 ); t( sp_setint(env, "scheduler.threads", 0) == 0 ); t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 ); t( sp_setstring(env, "log.path", st_r.conf->log_dir, ...
functions
void update_cursor5(void) { update_ops = 0; void *env = sp_env(); t( env != NULL ); t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 ); t( sp_setint(env, "scheduler.threads", 0) == 0 ); t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 ); t( sp_setstring(env, "log.path", st_r.conf->log_dir, ...
functions
void update_cursor6(void) { update_ops = 0; void *env = sp_env(); t( env != NULL ); t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 ); t( sp_setint(env, "scheduler.threads", 0) == 0 ); t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 ); t( sp_setstring(env, "log.path", st_r.conf->log_dir, ...
includes
#include <assert.h>
includes
#include <stdio.h>
includes
#include <stdlib.h>
includes
#include <string.h>
functions
void VARZRandReseed() { FILE *infile; unsigned seed; infile = fopen("/dev/random", "rb"); assert(infile); assert(fread(&seed, 1, sizeof(seed), infile) == 1); fclose(infile); srand(seed); }
functions
uint64_t VARZRand64() { return (((uint64_t) rand()) << 34) | (((uint64_t) rand()) << 2) | ((uint64_t) rand() % 4); }
functions
void VARZRandReseed() { return; // NOOP }
functions
uint64_t VARZRand64() { assert(varz_rand64_stub_cur_idx < varz_rand64_stub_num_values); return varz_rand64_stub_values[varz_rand64_stub_cur_idx++]; }
functions
void VARZRand64StubValues(uint64_t *values, unsigned int num_values) { if (varz_rand64_stub_values) { free(varz_rand64_stub_values); }
includes
#include <stdio.h>
includes
#include <windows.h>
includes
#include <setupapi.h>
includes
#include <ntddkbd.h>
includes
#include <hidsdi.h>
defines
#define INITGUID
defines
#define EXPECT_SIZE 8
defines
#define FEATURE_BUF_SIZE 9
functions
int _ykusb_start(void) { return 1; }
functions
int _ykusb_stop(void) { return 1; }
functions
int _ykusb_close_device(void *yk) { HANDLE h = yk; CloseHandle(h); return 1; }
functions
int _ykusb_read(void *dev, int report_type, int report_number, char *buffer, int buffer_size) { HANDLE h = dev; BYTE buf[FEATURE_BUF_SIZE]; if (buffer_size != EXPECT_SIZE) { yk_errno = YK_EUSBERR; return 0; }
functions
int _ykusb_write(void *dev, int report_type, int report_number, char *buffer, int buffer_size) { HANDLE h = dev; BYTE buf[FEATURE_BUF_SIZE]; if (buffer_size != EXPECT_SIZE) { yk_errno = YK_EUSBERR; return 0; }
functions
int _ykusb_get_vid_pid(void *yk, int *vid, int *pid) { HIDD_ATTRIBUTES devInfo; int rc = HidD_GetAttributes(yk, &devInfo); if (rc) { *vid = devInfo.VendorID; *pid = devInfo.ProductID; return 1; }
includes
#include <unistd.h>
functions
void dynld_printf(const char *fmt, ...) { va_list ap; va_start(ap, fmt); dynld_vprintf(fmt, ap); va_end(ap); }
functions
void dynld_print_p(uint64_t val) { static char hexd[16] = "0123456789abcdef"; char buffer[64]; char *put = buffer + 64; size_t sz = 0; do { *--put = hexd[val & 0xF]; val >>= 4; sz++; }
functions
void dynld_print_d(int val) { char buffer[64]; char *put = buffer + 64; size_t sz = 0; do { *--put = '0' + (val % 10); val /= 10; sz++; }
functions
void dynld_vprintf(const char *fmt, va_list ap) { while (*fmt != 0) { if (*fmt != '%') { write(2, fmt, 1); fmt++; }
includes
#include <stdio.h>
includes
#include <stdint.h>
includes
#include <string.h>
includes
#include <stdlib.h>
includes
#include <stdarg.h>
includes
#include <errno.h>
includes
#include <netinet/in.h>
includes
#include <termios.h>
includes
#include <sys/epoll.h>
includes
#include <assert.h>
includes
#include <unistd.h>
includes
#include <sys/types.h>
includes
#include <sys/socket.h>
includes
#include <arpa/inet.h>
includes
#include <sys/socket.h>
includes
#include <net/socket.h>
includes
#include <sys/time.h>
includes
#include <unistd.h>
includes
#include <sys/types.h>
includes
#include <fcntl.h>
includes
#include <sys/syscall.h>
includes
#include <dlfcn.h>
defines
#define _GNU_SOURCE
defines
#define __USE_GNU
defines
#define ANS_FD_BASE 2000
defines
#define ANS_FD_DEBUG( fmt, args...) \
defines
#define INIT_FUNCTION(func) \
functions
void ans_mod_init(char *file_prefix) { int rc; real_##func = dlsym(RTLD_NEXT, #func); \ assert(real_##func) INIT_FUNCTION(socket); INIT_FUNCTION(socketpair); INIT_FUNCTION(bind); INIT_FUNCTION(connect); INIT_FUNCTION(close); INIT_FUNCTION(listen); INIT_FUNCTION(accept);...
functions
int socket(int domain, int type, int protocol) { int rc; ANS_FD_DEBUG("socket create start , domain %d, type %d \n", domain, type); if ((inited == 0) || (AF_INET != domain) || (SOCK_STREAM != type && SOCK_DGRAM != type)) { rc = real_socket(domain, type, protocol); ANS_FD_DEBUG...
functions
int socketpair(int domain, int type, int protocol, int sv[2]) { if (inited) { return -1; }
functions
int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen) { struct sockaddr_in *in_addr; in_addr = (struct sockaddr_in *)addr; ANS_FD_DEBUG("bind ip: %x , port %d, family:%d \n", in_addr->sin_addr.s_addr, ntohs(in_addr->sin_port), in_addr->sin_family); if(inited && sockfd > ANS_FD_BASE) ...
functions
int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen) { ANS_FD_DEBUG("fd(%d) start to connect \n", sockfd); if(inited && sockfd > ANS_FD_BASE) { sockfd -= ANS_FD_BASE; return anssock_connect(sockfd, addr, addrlen); }
functions
ssize_t send (int sockfd, const void *buf, size_t len, int flags) { ssize_t n; ANS_FD_DEBUG("send data fd %d , len %lu \n", sockfd, len); if(inited && sockfd > ANS_FD_BASE) { sockfd -= ANS_FD_BASE; ANS_FD_DEBUG("ans send data fd %d , len %lu \n", sockfd, len); n = anssock...
functions
ssize_t write(int fd, const void *buf, size_t count) { ssize_t n; // ANS_FD_DEBUG("write data fd %d , len %lu \n", fd, count); if(inited && fd > ANS_FD_BASE) { fd -= ANS_FD_BASE; n = anssock_write(fd, buf, count); ANS_FD_DEBUG("ans write: fd %d , len %lu, return value...
functions
ssize_t recv(int sockfd, void *buf, size_t len, int flags) { ssize_t rc; if(inited && sockfd > ANS_FD_BASE) { sockfd -= ANS_FD_BASE; rc = anssock_recv(sockfd, buf, len, flags); if (-1 == rc && ANS_EAGAIN == errno) { errno = EAGAIN; }
functions
ssize_t read(int fd, void *buf, size_t count) { ssize_t rc; if(inited && fd > ANS_FD_BASE) { fd -= ANS_FD_BASE; rc = anssock_read(fd, buf, count); ANS_FD_DEBUG("ans fd %d read data len %ld, %d \n", fd, rc, errno); return rc; }
functions
int getsockopt(int sockfd, int level ,int optname, void *optval, socklen_t *optlen) { if(inited && sockfd > ANS_FD_BASE) { return -2; }
functions
int setsockopt(int sockfd, int level, int optname, const void *optval, socklen_t optlen) { if(inited && sockfd > ANS_FD_BASE) { sockfd -= ANS_FD_BASE; return anssock_setsockopt(sockfd, level, optname, optval, optlen); }
functions
int getpeername(int sockfd, struct sockaddr *addr, socklen_t *addrlen) { if(inited && sockfd > ANS_FD_BASE) { sockfd -= ANS_FD_BASE; return anssock_getpeername(sockfd, addr, addrlen); }
functions
int getsockname(int sockfd, struct sockaddr *addr, socklen_t *addrlen) { if(inited && sockfd > ANS_FD_BASE) { sockfd -= ANS_FD_BASE; return anssock_getsockname(sockfd, addr, addrlen); }
functions
int listen(int sockfd, int backlog) { if(inited && sockfd > ANS_FD_BASE) { sockfd -= ANS_FD_BASE; ANS_FD_DEBUG("ans listen fd %d, pid %d \n", sockfd, getpid()); return anssock_listen(sockfd, backlog); }
functions
int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen) { int rc; if(inited && sockfd > ANS_FD_BASE) { sockfd -= ANS_FD_BASE; rc = anssock_accept(sockfd, addr, addrlen); addr->sa_family = AF_INET; ANS_FD_DEBUG("ans accept fd %d \n", rc); if(rc > 0 ) ...
functions
int accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags) { int rc; if(inited && sockfd > ANS_FD_BASE) { sockfd -= ANS_FD_BASE; rc = anssock_accept(sockfd, addr, addrlen); addr->sa_family = AF_INET; ANS_FD_DEBUG("ans accep4t fd %d, errno %d \n", rc, er...
functions
int shutdown (int fd, int how) { ANS_FD_DEBUG("ans shutdown fd %d, how %d, pid %d \n", fd, how, getpid()); if(inited && fd > ANS_FD_BASE) { fd -= ANS_FD_BASE; return anssock_shutdown(fd, how);; }
functions
int close(int fd) { if(inited && fd > ANS_FD_BASE) { fd -= ANS_FD_BASE; ANS_FD_DEBUG("ans close fd %d, pid %d \n", fd, getpid()); return anssock_close(fd); }
functions
int epoll_create (int size) { int rc; ANS_FD_DEBUG("epoll create start, EPOLL_CTL_ADD %d ,EPOLL_CTL_DEL %d, EPOLLOUT 0x%x, EPOLLIN:0x%x \n", EPOLL_CTL_ADD, EPOLL_CTL_DEL, EPOLLOUT, EPOLLIN); if (inited) { rc = anssock_epoll_create(size); if(rc > 0) rc += ANS_FD_BASE; ...
functions
int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event) { int rc; ANS_FD_DEBUG("epoll ctl start, epfd %d ,op %d, fd %d, event:0x%x \n", epfd, op, fd, event->events); if (inited && epfd > ANS_FD_BASE) { if(fd <= ANS_FD_BASE) { printf("skip linux fd %d \n", fd); ...
functions
int epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout) { int rc; if (inited && epfd > ANS_FD_BASE) { epfd -= ANS_FD_BASE; // ANS_FD_DEBUG("ans epoll_wait: fd %d maxevents %d , timeout %d \n", epfd, maxevents, timeout); rc = anssock_epoll_wait(epfd, events,...
functions
int ioctl(int fd, int request, void *p) { if (inited && fd > ANS_FD_BASE) { fd -= ANS_FD_BASE; //return anssock_ioctl(fd, request, p); return 0; }
functions
ssize_t writev(int fd, const struct iovec *iov, int iovcnt) { ssize_t rc; if (inited && fd > ANS_FD_BASE) { fd -= ANS_FD_BASE; ANS_FD_DEBUG("ans writev data fd %d , iovcnt %d \n", fd, iovcnt); rc = anssock_writev(fd, iov, iovcnt); }