Sunday, July 17, 2022

Find flags with which a file was opened

 lsof +fg /chia/scratch/disk01/subspace/plot3/plot-index-to-offset/000017.sst
COMMAND      PID         USER   FD   TYPE FILE-FLAG DEVICE SIZE/OFF        NODE NAME
subspace- 134267 srv_subspace  273r   REG     LG,CX  254,6 67377874 45101533594 /chia/scratch/disk01/subspace/plot3/plot-index-to-offset/000017.sst

 

# man lsof |grep "Flag in C code" -A 21
                          Abbrev.   Flag in C code (see open(2))

                          W         O_WRONLY
                          RW        O_RDWR
                          CR        O_CREAT
                          EXCL      O_EXCL
                          NTTY      O_NOCTTY
                          TR        O_TRUNC
                          AP        O_APPEND
                          ND        O_NDELAY
                          SYN       O_SYNC
                          ASYN      O_ASYNC
                          DIR       O_DIRECT
                          DTY       O_DIRECTORY
                          NFLK      O_NOFOLLOW
                          NATM      O_NOATIME
                          DSYN      O_DSYNC
                          RSYN      O_RSYNC
                          LG        O_LARGEFILE
                          CX        O_CLOEXEC
                          TMPF      O_TMPFILE