HTCondor Project List Archives



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Condor-devel] using /dev/null as a userlog



In Quill++, we hook into the userlog code (specifically, condor_event.C) to
get a lot of information about the runtime of a job - there's a complete
'runs' table.

However, if there is no
log = /some/path 

in the submit file, none of our code gets called because higher levels
of Condor short-circuit from the event code if there's no event.

We'd like to always go through the event code, but putting an implicit
log = /dev/null 

if the user says nothing, like we do with out, err, and input.

This mostly works, except for this bit of code in user_log.C/writeEvent:

    // Now that we have flushed the stdio stream, sync to disk
    // *before* we release our write lock!
    if ( fsync( fileno( fp ) ) != 0 ) {
        dprintf( D_ALWAYS, "fsync() failed in UserLog::writeEvent - "
                "errno %d (%s)\n", errno, strerror(errno) );
        // Note:  should we set success to false here?
    }

it turns out you can't fsync() on /dev/null, you get
2/7 14:35:41 (9.9) (21956): fsync() failed in UserLog::writeEvent - errno 22 (In
valid argument)

I'd like to change that dprintf to only print if errno != EINVAL - Is there
any other case that you'd get an EINVAL from fsync except that the underlying
device doesn't support it? We'd probably blow up earlier in the function if
we were trying to use an invalid fd (there's an fflush() right before the 
fsync())

Thanks,

-Erik