Skip to content

Commit

Permalink
xdg-document-portal: implement non-blocking flock operations
Browse files Browse the repository at this point in the history
This is needed for Steam client

Signed-off-by: Kyohei KADOTA <[email protected]>
Co-authored-by: Hubert Figuière <[email protected]>
  • Loading branch information
lufia and hfiguiere committed Apr 29, 2024
1 parent 0cad9ea commit c10af35
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion document-portal/document-portal-fuse.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#ifdef HAVE_SYS_EXTATTR_H
#include <sys/extattr.h>
#endif
#include <sys/file.h>
#include <sys/time.h>
#include <sys/resource.h>

Expand Down Expand Up @@ -3192,10 +3193,22 @@ xdp_fuse_flock (fuse_req_t req,
int lock_op)
{
const char *op = "FLOCK";
XdpFile *file = (XdpFile *)fi->fh;
int res;

g_debug ("FLOCK %lx", ino);

xdp_reply_err (op, req, ENOSYS);
if ((lock_op & (LOCK_SH | LOCK_EX)) && (lock_op & LOCK_NB) == 0)
{
xdp_reply_err (op, req, ENOSYS);
return;
}

res = flock (file->fd, lock_op);
if (res == 0)
xdp_reply_ok (op, req);
else
xdp_reply_err (op, req, errno);
}

static void
Expand Down

0 comments on commit c10af35

Please sign in to comment.