Files
infidel-ITTI/.kqueue_file_watch.c.swp

17 lines
12 KiB
Plaintext
Raw Normal View History

2022-09-22 23:41:38 +07:00
b0VIM 8.2<00><>,c<><63> ginfidelbsd-server.local~infidel/kqueue-project/kqueue_file_watch.cutf-8 3210#"! U
<00>
<00>
<00>
<00>
<00>
<00>
Z
Q
P
O
<



<00> <00> <00> <00> <00> ~ o X ? 0    <00><00><00><00><00><00>}nW>/<00><00><00><00><00><00>t><00><00><00>T<00><00><00>|vts}} } // printf("--> RET 2 VAL = %d\n", ret2); // printf("--> RET 1 VAL = %d\n", ret1); } printf("--> RET 2 VAL = %d\n", ret2); printf("--> RET 1 VAL = %d\n", ret1); printf("Change detected on file...\n"); } else if ( ret1 > 0 || ret2 > 0 ){ printf("Waiting.......\n"); if (ret1 == -1 || ret2 == -1) { ret2 = kevent(kq, NULL, 0, &tevent, 1, NULL); ret1 = kevent(kq, NULL, 0, &tevent, 1, NULL); for (;;) { } printf("event failure to attched"); if ( ret1 == -1 || ret2 == -1 ){ ret2 = kevent(kq, &event2, 1, NULL, 0, NULL); ); NULL 0, NOTE_WRITE, EV_CLEAR, | EV_ADD EVFILT_VNODE, fd2, &event2, EV_SET( ret1 = kevent(kq, &event1, 1, NULL, 0, NULL); ); NULL 0, NOTE_WRITE, EV_CLEAR, | EV_ADD EVFILT_VNODE, fd1, &event1, EV_SET( /* initialzing kevent struct */ } return 0; printf("Error kq...\n"); if (kq == -1){ // } // printf("==> %s\n", argv[i]); // printf("YOUR FILES \n"); // for (int i=1; i <= 2; i++){ // fd = open(argv[1], O_RDONLY); } fd2 = open(argv[2], O_RDONLY); if (i == 2) fd1 = open(argv[1], O_RDONLY); if (i == 1) printf("==> %s\n", argv[i]); for (int i=1; i <= 2; i++){ printf("%d number of args\n", argc); kq = kqueue(); int fd1, fd2; // File Pointers int kq, fd, ret1, ret2; // General Pointers // printf("%s\n", task_list_t); static task_list_t **tasks=NULL; struct epoll_event *events =NULL; struct kevent tevent2; struct kevent tevent; struct kevent event2; struct kevent event1;int main(int argc, char **argv){ } task_list_t; int sem_fd=-1; int nb_events=0; /** kqueque equivalent **/ int epoll_fd=-1; int nb_fd_epoll=0; struct epoll_event *events =NULL; /** Replace these shits **/ uint64_t next_timer=UINT_MAX; // std::map<long,timer_elm_t> timer_map; // std::vector<MessageDef *> message_queue; pthread_mutex_t queue_cond_lock; pthread_t thread; siginfo_t admin; typedef struct task_list_s {////#include <sys/event.h>// #include <sys/epoll.h>#include <sys/param.h>// #include <map>// #include <vector>#include <limits.h>#include <stdlib.h>#include <fcntl.h>#include <cstdio>#include <sys/event.h>