committed by
Fredrik Fornwall
5 changed files with 66 additions and 1 deletions
@ -0,0 +1,11 @@ |
|||||
|
--- ../cache/vifm-0.10/src/utils/gmux_nix.c 2018-11-11 15:20:19.000000000 +0000
|
||||
|
+++ ./src/utils/gmux_nix.c 2019-01-16 03:17:11.261518251 +0000
|
||||
|
@@ -27,7 +27,7 @@
|
||||
|
|
||||
|
#include "path.h" |
||||
|
#include "str.h" |
||||
|
-
|
||||
|
+#include "lockf.c"
|
||||
|
/* Data of a single gmux instance. */ |
||||
|
struct gmux_t |
||||
|
{ |
@ -0,0 +1,31 @@ |
|||||
|
#include <unistd.h> |
||||
|
#include <fcntl.h> |
||||
|
#include <errno.h> |
||||
|
|
||||
|
int lockf(int fd, int op, off_t size) |
||||
|
{ |
||||
|
struct flock l = { |
||||
|
.l_type = F_WRLCK, |
||||
|
.l_whence = SEEK_CUR, |
||||
|
.l_len = size, |
||||
|
}; |
||||
|
switch (op) { |
||||
|
case F_TEST: |
||||
|
l.l_type = F_RDLCK; |
||||
|
if (fcntl(fd, F_GETLK, &l) < 0) |
||||
|
return -1; |
||||
|
if (l.l_type == F_UNLCK || l.l_pid == getpid()) |
||||
|
return 0; |
||||
|
errno = EACCES; |
||||
|
return -1; |
||||
|
case F_ULOCK: |
||||
|
l.l_type = F_UNLCK; |
||||
|
case F_TLOCK: |
||||
|
return fcntl(fd, F_SETLK, &l); |
||||
|
case F_LOCK: |
||||
|
return fcntl(fd, F_SETLKW, &l); |
||||
|
} |
||||
|
errno = EINVAL; |
||||
|
return -1; |
||||
|
} |
||||
|
|
@ -0,0 +1,11 @@ |
|||||
|
--- ../cache/vifm-0.10/src/compat/pthread.c 2018-11-11 15:20:19.000000000 +0000
|
||||
|
+++ ./src/compat/pthread.c 2019-01-16 03:08:28.369761090 +0000
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
|
||||
|
#include "pthread.h" |
||||
|
|
||||
|
-#ifdef __APPLE__
|
||||
|
+#ifdef __ANDROID__
|
||||
|
|
||||
|
#include <assert.h> /* assert() */ |
||||
|
#include <errno.h> /* EBUSY */ |
@ -0,0 +1,11 @@ |
|||||
|
--- ../cache/vifm-0.10/src/compat/pthread.h 2018-11-11 15:20:19.000000000 +0000
|
||||
|
+++ ./src/compat/pthread.h 2019-01-16 03:21:20.171148938 +0000
|
||||
|
@@ -21,7 +21,7 @@
|
||||
|
|
||||
|
#include <pthread.h> |
||||
|
|
||||
|
-#ifdef __APPLE__
|
||||
|
+#ifdef __ANDROID__
|
||||
|
|
||||
|
typedef int pthread_spinlock_t; |
||||
|
|
Loading…
Reference in new issue