跳至主要内容

博文

源码编译LLVM

  cmake -S llvm -B build -G "Unix Makefiles" -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind;compiler-rt;libc;openmp" -DCMAKE_BUILD_TYPE=Release   cd build/   make -j8
最新博文

libevent2的一些api

 server: auto listener = evconnlistener_new_bind(base, listener_cb, (void *) base, LEV_OPT_REUSEABLE | LEV_OPT_CLOSE_ON_FREE,                                             -1, (struct sockaddr *) &sin, sizeof(sin));  在 listener_cb中 bufferevent_socket_new bufferevent_setcb bufferevent_enable   在read_cb中 evbuffer_get_length evbuffer_copyout evbuffer_copyout_from evbuffer_drain     client: bufferevent_socket_new bufferevent_setcb bufferevent_enable bufferevent_socket_connect timer: event_new(base, -1, EV_PERSIST, timer_cb, NULL) event_add

利用yellowdns解决dns污染问题

 很多网站的dns直接被污染成了127.0.0.1,这样一般就无法访问了,很多翻墙软件也认为是局域网,所以访问不了 这时候,使用yellowdns,将dns转发到远程。然后listen本地的53端口。再将dns服务器都改成本地 vi /etc/resolv.conf windows和路由器,也可以都更改

编译期移除__FILE__的冗余前缀

  On the CMakeLists.txt file, define a macro that has the length of the path to your project on CMake: # The additional / is important to remove the last character from the path. # Note that it does not matter if the OS uses / or \, because we are only # saving the path size. string (LENGTH "${CMAKE_SOURCE_DIR}/" SOURCE_PATH_SIZE) add_definitions( "-DSOURCE_PATH_SIZE=${SOURCE_PATH_SIZE}" ) On your source code, define a __FILENAME__ macro that just adds the source path size to the __FILE__ macro: # define __FILENAME__ (__FILE__ + SOURCE_PATH_SIZE)