virFileIsNamedPipe checks whether passed path is a FIFO file or not. Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkaladevi@xxxxxxxxxxxxxxxxxxx> Co-authored-by: Vineeth Pillai <viremana@xxxxxxxxxxxxxxxxxxx> --- src/libvirt_private.syms | 1 + src/util/virfile.c | 8 ++++++++ src/util/virfile.h | 1 + 3 files changed, 10 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 02dacea857..6bf6cfd20b 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2357,6 +2357,7 @@ virFileIsDir; virFileIsExecutable; virFileIsLink; virFileIsMountPoint; +virFileIsNamedPipe; virFileIsRegular; virFileIsSharedFS; virFileIsSharedFSType; diff --git a/src/util/virfile.c b/src/util/virfile.c index d820172405..19b074ed8a 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -2023,6 +2023,14 @@ virFileIsDir(const char *path) } +bool +virFileIsNamedPipe(const char *path) +{ + struct stat s; + return (stat(path, &s) == 0) && S_ISFIFO(s.st_mode); +} + + bool virFileIsRegular(const char *path) { diff --git a/src/util/virfile.h b/src/util/virfile.h index 7df3fcb840..4f7ff72483 100644 --- a/src/util/virfile.h +++ b/src/util/virfile.h @@ -215,6 +215,7 @@ void virFileActivateDirOverrideForLib(void); off_t virFileLength(const char *path, int fd) ATTRIBUTE_NONNULL(1); bool virFileIsDir (const char *file) ATTRIBUTE_NONNULL(1); +bool virFileIsNamedPipe (const char *file) ATTRIBUTE_NONNULL(1); bool virFileExists(const char *file) ATTRIBUTE_NONNULL(1) G_NO_INLINE; bool virFileIsExecutable(const char *file) ATTRIBUTE_NONNULL(1); bool virFileIsRegular(const char *file) ATTRIBUTE_NONNULL(1); -- 2.34.1