Skip to contentSkip to conversation

linux-user: Fix compilation when F_SETPIPE_SZ isn't defined

PATCH In review Peter Maydell 2 participants 3 messages Jun 30, 2016 – Jul 1, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-user: Fix compilation when F_SETPIPE_SZ isn't defined

Older kernels don't have F_SETPIPE_SZ and F_GETPIPE_SZ (in particular RHEL6's system headers don't define these). Add ifdefs so that we can gracefully fall back to not supporting those guest ioctls rather than failing to build.

---
Reported by an anonymous IRC user...

 linux-user/syscall.c | 2 ++
 1 file changed, 2 insertions(+)
linux-user/syscall.c +2 -0
index 6ad8239..165fd06 100644
@@ -5598,10 +5598,12 @@ static int target_to_host_fcntl_cmd(int cmd)
 	case TARGET_F_SETOWN_EX:
 	    return F_SETOWN_EX;
 #endif
+#ifdef F_SETPIPE_SZ
         case TARGET_F_SETPIPE_SZ:
             return F_SETPIPE_SZ;
         case TARGET_F_GETPIPE_SZ:
             return F_GETPIPE_SZ;
+#endif
 	default:
             return -TARGET_EINVAL;
     }
Signature · 1 line
1.9.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Peter Maydell

Older kernels don't have F_SETPIPE_SZ and F_GETPIPE_SZ (in particular RHEL6's system headers don't define these). Add ifdefs so that we can gracefully fall back to not supporting those guest ioctls rather than failing to build.

Quoted 24 lines

---
Reported by an anonymous IRC user...

 linux-user/syscall.c | 2 ++
 1 file changed, 2 insertions(+)
linux-user/syscall.c +2 -0
index 6ad8239..165fd06 100644
@@ -5598,10 +5598,12 @@ static int target_to_host_fcntl_cmd(int cmd)
 	case TARGET_F_SETOWN_EX:
 	    return F_SETOWN_EX;
 #endif
+#ifdef F_SETPIPE_SZ
         case TARGET_F_SETPIPE_SZ:
             return F_SETPIPE_SZ;
         case TARGET_F_GETPIPE_SZ:
             return F_GETPIPE_SZ;
+#endif
 	default:
             return -TARGET_EINVAL;
     }
#2 lore raw
Quoted 11 lines · Laurent Vivier
Quoted 6 lines · Peter Maydell

Older kernels don't have F_SETPIPE_SZ and F_GETPIPE_SZ (in particular RHEL6's system headers don't define these). Add ifdefs so that we can gracefully fall back to not supporting those guest ioctls rather than failing to build.

Thanks; applied to master as a build fix.

-- PMM