

# for bgsingleton is reasonable, for fslock is irreasonable
___x_cmd_fslock_ls(){
    [ -d "$___X_CMD_FSLOCK_ROOT" ] || return 0
    x fsiter "$___X_CMD_FSLOCK_ROOT" |  while read -r fp; do
            case "$fp" in
                *.X)    printf "%s\n" "$fp" ;;
            esac
        done
}

___x_cmd_fslock_name_(){
    x_="$1"

    if [ "$___X_CMD_SHELL" != dash ]; then
        x_="${x_//\//_}"
    else
        local part=
        while [ -n "$x_" ]; do
            part="${x_%%/*}"
            [ "$part" != "$x_" ] || break
            x_="${part}_${x_#*/}"
        done
    fi
}

___x_cmd_fslock_pid_(){
    ___x_cmd_fslock_name_ "$1"
    [ -n "$x_" ] || M="Provide fslock name" N=fslock log:ret:64
    [ -f "${___X_CMD_FSLOCK_ROOT}/${x_}.fslock.x-cmd.X" ] || return 1
    read -r x_ <"${___X_CMD_FSLOCK_ROOT}/${x_}.fslock.x-cmd.X"
}

___x_cmd_fslock_pid(){
    local x_=; ___x_cmd_fslock_pid_ "$@" || return
    printf "%s\n" "$x_"
}


# Try to get the content of fslock file
# Is there a lock ?

# Get the lock pid
# Get the lock fingerprint
# Get the lock name type
# Get the user info

___x_cmd_fslock_info(){
    :
}

