mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-11-20 06:56:27 -05:00
add mergerfs pid to xattrs
This commit is contained in:
parent
2d71229fe9
commit
9e24796429
2 changed files with 18 additions and 1 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue