Go to the documentation of this file.
   27 #include <sys/socket.h> 
   51   printf(
"Socket cb got events %d\n", events);
 
   80   waited_pid = waitpid(child_pid, &child_stat, 0);
 
   81   printf(
"Waited pid is %d with status %d\n", waited_pid, child_stat);
 
   82   if (waited_pid == -1) {
 
   83     perror(
"Failed to wait");
 
   85   ASSERT(child_pid == waited_pid);
 
   86   ASSERT(WIFEXITED(child_stat)); 
 
   87   ASSERT(!WIFSIGNALED(child_stat));
 
   88   ASSERT(0 == WEXITSTATUS(child_stat));
 
  105   if (child_pid != 0) {
 
  129   ASSERT(0 == socketpair(AF_UNIX, SOCK_STREAM, 0, socket_fds));
 
  137   if (child_pid != 0) {
 
  139     ASSERT(3 == send(socket_fds[1], 
"hi\n", 3, 0));
 
  146     printf(
"Going to run the loop in the child\n");
 
  166   ASSERT(0 == pipe(sync_pipe));
 
  171   ASSERT(0 == socketpair(AF_UNIX, SOCK_STREAM, 0, socket_fds));
 
  186   if (child_pid != 0) {
 
  193     ASSERT(3 == send(socket_fds[1], 
"hi\n", 3, 0));
 
  201     printf(
"Child is %d\n", getpid());
 
  206     printf(
"Going to run the loop in the child\n");
 
  239   ASSERT(0 == pipe(sync_pipe));
 
  250   if (child_pid != 0) {
 
  253     ASSERT(0 == kill(child_pid, SIGUSR1));
 
  255     printf(
"Running loop in parent\n");
 
  259     printf(
"Waiting for child in parent\n");
 
  267     printf(
"Running loop in child\n");
 
  290   ASSERT(0 == pipe(sync_pipe));
 
  291   ASSERT(0 == pipe(sync_pipe2));
 
  302   if (child_pid != 0) {
 
  304     printf(
"Wating on child in parent\n");
 
  306     printf(
"Parent killing child\n");
 
  307     ASSERT(0 == kill(child_pid, SIGUSR1));
 
  309     printf(
"Running loop in parent\n");
 
  318     printf(
"Waiting for child in parent\n");
 
  323     printf(
"Checking loop in child\n");
 
  325     printf(
"Alerting parent in child\n");
 
  328     printf(
"Waiting on parent in child\n");
 
  332     r = 
read(sync_pipe2[0], sync_buf, 1);
 
  335     printf(
"Exiting child \n");
 
  405 #if defined(__APPLE__) || defined(__linux__) 
  420   remove(
"watch_file");
 
  429                         file_or_dir == 1 ? 
"." : 
"watch_file",
 
  448   remove(
"watch_file");
 
  455 #define FS_TEST_FILE 0 
  456 #define FS_TEST_DIR 1 
  468   if (child_pid != 0) {
 
  475 #if defined(__APPLE__) 
  478     printf(
"Running child\n");
 
  480     printf(
"Child first watch\n");
 
  483     printf(
"Child second watch default loop\n");
 
  500     printf(
"Exiting child \n");
 
  510 #if defined(NO_FS_EVENTS) 
  518 #if defined(NO_FS_EVENTS) 
  521 #if defined(__APPLE__) || defined (__linux__) 
  534 #if defined(NO_FS_EVENTS) 
  537 #if defined(__sun) || defined(_AIX) || defined(__MVS__) 
  557   remove(
"watch_file");
 
  573   if (child_pid != 0) {
 
  578     printf(
"Running child\n");
 
  586     printf(
"Running loop in child \n");
 
  593     remove(
"watch_file");
 
  627   printf(
"Queue in %d\n", getpid());
 
  630   printf(
"Running in %d\n", getpid());
 
  655   if (child_pid != 0) {
 
  661     printf(
"Running child in %d\n", getpid());
 
  663     printf(
"Child first watch\n");
 
  666     printf(
"Child second watch default loop\n");
 
  670     printf(
"Exiting child \n");
 
  
static void create_file(const char *name)
UV_EXTERN int uv_fs_open(uv_loop_t *loop, uv_fs_t *req, const char *path, int flags, int mode, uv_fs_cb cb)
const grpc_generator::File * file
static char socket_cb_read_buf[1024]
UV_EXTERN int uv_poll_init(uv_loop_t *loop, uv_poll_t *handle, int fd)
UV_EXTERN int uv_signal_init(uv_loop_t *loop, uv_signal_t *handle)
_Use_decl_annotations_ int __cdecl printf(const char *_Format,...)
void fork_signal_to_child_cb(uv_signal_t *handle, int signum)
static int socket_cb_read_size
UV_EXTERN int uv_run(uv_loop_t *, uv_run_mode mode)
UV_EXTERN int uv_queue_work(uv_loop_t *loop, uv_work_t *req, uv_work_cb work_cb, uv_after_work_cb after_work_cb)
static int fs_event_cb_called
UV_EXTERN int uv_poll_start(uv_poll_t *handle, int events, uv_poll_cb cb)
UV_EXTERN void uv_unref(uv_handle_t *)
UV_EXTERN void uv_close(uv_handle_t *handle, uv_close_cb close_cb)
static void timer_cb_touch(uv_timer_t *timer)
static int fork_signal_cb_called
UV_EXTERN int uv_loop_close(uv_loop_t *loop)
UV_EXTERN void uv_update_time(uv_loop_t *)
UV_EXTERN uv_loop_t * uv_default_loop(void)
UV_EXTERN int uv_loop_fork(uv_loop_t *loop)
static void work_cb(uv_work_t *req)
static void timer_cb(uv_timer_t *timer)
static uv_fs_event_t fs_event
static void assert_wait_child(pid_t child_pid)
static int timer_cb_touch_called
UV_EXTERN int uv_loop_init(uv_loop_t *loop)
static int timer_cb_called
UV_EXTERN int uv_loop_alive(const uv_loop_t *loop)
static void socket_cb(uv_poll_t *poll, int status, int events)
UV_EXTERN int uv_fs_close(uv_loop_t *loop, uv_fs_t *req, uv_file file, uv_fs_cb cb)
static void assert_watch_file_current_dir(uv_loop_t *const loop, int file_or_dir)
#define MAKE_VALGRIND_HAPPY()
static int socket_cb_called
int read(izstream &zs, T *x, Items items)
static int socket_cb_read_fd
UV_EXTERN int uv_fs_write(uv_loop_t *loop, uv_fs_t *req, uv_file file, const uv_buf_t bufs[], unsigned int nbufs, int64_t offset, uv_fs_cb cb)
static void assert_run_work(uv_loop_t *const loop)
UV_EXTERN int uv_poll_stop(uv_poll_t *handle)
UV_EXTERN uv_buf_t uv_buf_init(char *base, unsigned int len)
static void touch_file(const char *name)
UV_EXTERN int uv_fs_event_start(uv_fs_event_t *handle, uv_fs_event_cb cb, const char *path, unsigned int flags)
UV_EXTERN void uv_fs_req_cleanup(uv_fs_t *req)
#define RETURN_SKIP(explanation)
UV_EXTERN int uv_timer_start(uv_timer_t *handle, uv_timer_cb cb, uint64_t timeout, uint64_t repeat)
static void after_work_cb(uv_work_t *req, int status)
static void run_timer_loop_once(void)
static int _do_fork_fs_events_child(int file_or_dir)
UV_EXTERN int uv_timer_init(uv_loop_t *, uv_timer_t *handle)
UV_EXTERN int uv_fs_event_init(uv_loop_t *loop, uv_fs_event_t *handle)
static uv_fs_poll_t poll_handle
static uv_timer_t timer_handle
static uv_work_t work_req
static int after_work_cb_count
UV_EXTERN int uv_signal_start(uv_signal_t *handle, uv_signal_cb signal_cb, int signum)
static void fs_event_cb_file_current_dir(uv_fs_event_t *handle, const char *filename, int events, int status)
grpc
Author(s): 
autogenerated on Fri May 16 2025 03:00:26