_exit() doesn't flush open file buffers. exit() does.
You may wish to flush after every line.
Instead of writing all output twice you could use a function like this:
Code:
void print(const char *fmt, ...) {
    va_list va;
    va_start(va, fmt);
 
    vprintf(fmt, va);
    putchar('\n');
 
    fputc('_', fptr);
    vfprintf(fptr, fmt, va);
    fputc('_', fptr);
    fputc('\n', fptr);
    fflush(fptr);
 
    va_end(va);
}
 
// Example of using it (note the removal of \n)
void childProcess() {
    int value = 0;
    sem_getvalue(semaphore, &value);
 
    print("Detailed search file count is %d.", value);
    print("Detailed search is grabbing the file.");
    sem_wait(semaphore);
    sem_getvalue(semaphore, &value);
    print("Detailed search file count is %d.", value);
 
    //START CRITICAL REGION
    print("Starting to do a detailed search...");
    for (int i = 0; i < 60; ++i) {
        print(".");
        sleep(1);
    }
    //END CRITICAL REGION
    sem_post(semaphore);
 
    //Exit child process
    print("Exit detailed search");
    exit(0);
}