Patchwork [6/7] Add hack for ioctl() on VxWorks.

login
register
mail settings
Submitter rbmj
Date June 6, 2012, 4:38 p.m.
Message ID <4FCF878E.10007@verizon.net>
Download mbox | patch
Permalink /patch/163398/
State New
Headers show

Comments

rbmj - June 6, 2012, 4:38 p.m.
ioctl() is supposed to be variadic, but VxWorks only has a three
argument version with the third argument of type int.  This messes
up when the third argument is not implicitly convertible to int.
This adds a macro which wraps around ioctl() and explicitly casts
the third argument to an int.

Changes:

     * fixincludes/inclhack.def: Added vxworks_ioctl_macro fix
---
  fixincludes/inclhack.def |   16 ++++++++++++++++
  1 files changed, 16 insertions(+), 0 deletions(-)

Patch

From 3a52d77fdbf4c422a1e641402794ce8eda47f410 Mon Sep 17 00:00:00 2001
From: rbmj <rbmj@verizon.net>
Date: Mon, 4 Jun 2012 14:16:26 -0400
Subject: [PATCH 6/7] Add hack for ioctl() on VxWorks.

ioctl() is supposed to be variadic, but VxWorks only has a three
argument version with the third argument of type int.  This messes
up when the third argument is not implicitly convertible to int.
This adds a macro which wraps around ioctl() and explicitly casts
the third argument to an int.

Changes:

	* fixincludes/inclhack.def: Added vxworks_ioctl_macro fix
---
 fixincludes/inclhack.def |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index a258f10..7863dbe 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -4440,6 +4440,22 @@  fix = {
     "#endif /* __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__ */\n";
 };
 
+/*
+ *  Wrap VxWorks ioctl to keep everything pretty
+ */
+fix = {
+	hackname	= vxworks_ioctl_macro;
+	files	   	= ioLib.h;
+	mach		= "*-*-vxworks*";
+
+	c_fix		= format;
+	c_fix_arg	= "%0\n"
+		"#define ioctl(fd, func, arg) ((ioctl)((fd), (func), ((int)(arg))))\n";
+	c_fix_arg	= "extern[\t ]+int[\t ]+ioctl[\t ]*\([\t ,[:alnum:]]\);";
+	
+	test_text	= "extern int ioctl ( int asdf1234, int jkl , int qwerty ) ;";
+};
+
 
 /*
  *  Fix VxWorks <time.h> to not require including <vxTypes.h>.
-- 
1.7.5.4