flux-framework / dyad

DYAD: DYnamic and Asynchronous Data Streamliner
GNU Lesser General Public License v3.0
7 stars 5 forks source link

Wrapper: automatically detect if the file access sync need #16

Closed JaeseungYeom closed 1 year ago

JaeseungYeom commented 1 year ago

DYAD currently detects the synchronization need by environment variable. Users need to set appropriate variable to tell DYAD I/O interceptor which file access to synchronize. However, this has a limitation as a process can open multiple files with different modes. A consumer can be a producer at the same time, and vice versa. This PR removes the need for environment variable. For a file about to be closed, it utilizes the system call fcntl() to detect if a file has been open in the write mode. For a file about to be opened, the mode argument can be checked easily. This addresses issue #10

ilumsden commented 1 year ago

@JaeseungYeom I've tweaked your is_wronly function to check for fcntl errors (as @garlick recommended). I've tested this with my DYAD demo for the ECP tutorial, and it works. Can you take a look to make sure it looks good before merge?