74
78
static void selfpipe_setup (void);
81
* test_job_process_handler_pid:
83
* PID passed to test_job_process_handler().
85
pid_t test_job_process_handler_pid = -1;
88
* test_job_process_handler_event:
90
* event passed to test_job_process_handler().
92
NihChildEvents test_job_process_handler_event = 0x0;
95
* test_job_process_handler_status:
97
* status passed to test_job_process_handler().
99
int test_job_process_handler_status = -1;
77
102
* wait_for_upstart:
79
104
* @session_init_pid: pid of Session Init (which uses a private bus
1037
* Exit main loop with an error value indicating that the expected main
1038
* loop events/actions were not performed within the expected time.
1041
timer_cb (void *data, NihTimer *timer)
1045
/* Return non-zero to denote failure */
1046
nih_main_loop_exit (1);
1050
* test_job_process_handler:
1053
* @pid: process that changed,
1054
* @event: event that occurred on the child,
1055
* @status: exit status, signal raised or ptrace event.
1057
* Handler that just sets some globals and requests the main loop to
1058
* exit to allow the test that installs it to check the values passed to
1059
* this function as appropriate.
1062
test_job_process_handler (void *data,
1064
NihChildEvents event,
1067
nih_assert (pid > 0);
1069
/* Check that TEST_RESET_MAIN_LOOP() has been called */
1070
nih_assert (test_job_process_handler_pid == -1);
1072
test_job_process_handler_pid = pid;
1073
test_job_process_handler_event = event;
1074
test_job_process_handler_status = status;
1078
printf ("XXX:%s:%d:pid=%d, event=%x, status=%x\n",
1080
pid, event, status);
1084
nih_main_loop_exit (0);
1089
* @fd: file descriptor.
1091
* Return 1 if @fd is valid, else 0.
1102
flags = fcntl (fd, F_GETFL);
1107
/* redundant really */
1118
* @fd: open file descriptor.
1120
* Read from the specified fd, close the fd and return the data.
1122
* Returns: Newly-allocated NihIoBuffer representing data read from @fd.
1126
read_from_fd (void *parent, int fd)
1128
NihIoBuffer *buffer = NULL;
1133
buffer = nih_io_buffer_new (parent);
1134
nih_assert (buffer);
1138
nih_assert (! nih_io_buffer_resize (buffer, 1024));
1141
buffer->buf + buffer->len,
1142
buffer->size - buffer->len);