mirror of
https://github.com/trapexit/mergerfs.git
synced 2025-04-25 06:24:05 +08:00
Merge pull request #177 from trapexit/xattr-pid
add mergerfs pid to xattrs
This commit is contained in:
commit
0165fb24d4
@ -33,6 +33,7 @@
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "config.hpp"
|
||||
#include "fs_path.hpp"
|
||||
@ -152,6 +153,19 @@ _getxattr_controlfile_version(string &attrvalue)
|
||||
attrvalue = MERGERFS_VERSION;
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
_getxattr_pid(string &attrvalue)
|
||||
{
|
||||
int pid;
|
||||
char buf[32];
|
||||
|
||||
pid = getpid();
|
||||
snprintf(buf,sizeof(buf),"%d",pid);
|
||||
|
||||
attrvalue = buf;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
_getxattr_controlfile(const Config &config,
|
||||
@ -180,6 +194,8 @@ _getxattr_controlfile(const Config &config,
|
||||
_getxattr_controlfile_policies(config,attrvalue);
|
||||
else if(attr[2] == "version")
|
||||
_getxattr_controlfile_version(attrvalue);
|
||||
else if(attr[2] == "pid")
|
||||
_getxattr_pid(attrvalue);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
|
@ -55,7 +55,8 @@ _listxattr_controlfile(char *list,
|
||||
("user.mergerfs.minfreespace")
|
||||
("user.mergerfs.moveonenospc")
|
||||
("user.mergerfs.policies")
|
||||
("user.mergerfs.version");
|
||||
("user.mergerfs.version")
|
||||
("user.mergerfs.pid");
|
||||
|
||||
xattrs.reserve(1024);
|
||||
for(size_t i = 0; i < strs.size(); i++)
|
||||
|
Loading…
x
Reference in New Issue
Block a user