virFileIsNamedPipe checks whether passed path is a FIFO file or not.
Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkaladevi@linux.microsoft.com>
Co-authored-by: Vineeth Pillai <viremana@linux.microsoft.com>
---
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
On 10/1/2024 7:20 AM, Purna Pavan Chandra Aekkaladevi wrote:
> virFileIsNamedPipe checks whether passed path is a FIFO file or not.
>
> Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkaladevi@linux.microsoft.com>
> Co-authored-by: Vineeth Pillai <viremana@linux.microsoft.com>
> ---
> 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)
With v2, you are not using this method anywhere.
> +{
> + 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);
--
Regards,
Praveen K Paladugu
On Tue, Oct 08, 2024 at 01:39:34PM -0500, Praveen K Paladugu wrote:
>
>
> On 10/1/2024 7:20 AM, Purna Pavan Chandra Aekkaladevi wrote:
> >virFileIsNamedPipe checks whether passed path is a FIFO file or not.
> >
> >Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkaladevi@linux.microsoft.com>
> >Co-authored-by: Vineeth Pillai <viremana@linux.microsoft.com>
> >---
> > 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)
> With v2, you are not using this method anywhere.
Sure, will remove it. Also, will take care of comments from other
patches as well in V3.
> >+{
> >+ 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);
>
> --
> Regards,
> Praveen K Paladugu
Regards,
Pavan
© 2016 - 2026 Red Hat, Inc.