[v5,7/9] eal: remove syslog support for windows

Message ID 20200113215534.10084-8-pallavi.kadam@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series Windows patchset with additional EAL functionalities |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Kadam, Pallavi Jan. 13, 2020, 9:55 p.m. UTC
  Added #ifndef WIN64 to exclude syslog definitions and parameters
from Windows builds.

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 lib/librte_eal/common/eal_common_options.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
  

Comments

Thomas Monjalon Jan. 27, 2020, 10:52 p.m. UTC | #1
13/01/2020 22:55, Pallavi Kadam:
> Added #ifndef WIN64 to exclude syslog definitions and parameters
> from Windows builds.
> 
> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> ---
> --- a/lib/librte_eal/common/eal_common_options.c
> +++ b/lib/librte_eal/common/eal_common_options.c
> @@ -204,9 +206,9 @@ eal_reset_internal_config(struct internal_config *internal_cfg)
>  		internal_cfg->hugepage_info[i].lock_descriptor = -1;
>  	}
>  	internal_cfg->base_virtaddr = 0;
> -

Please keep blank lines

> +#ifndef _WIN64

Could it be #ifdef LOG_DAEMON?

>  	internal_cfg->syslog_facility = LOG_DAEMON;
> -
> +#endif
[..]
> @@ -1391,7 +1395,7 @@ eal_parse_common_option(int opt, const char *optarg,
> +#ifndef _WIN64
>  	case OPT_SYSLOG_NUM:
>  		if (eal_parse_syslog(optarg, conf) < 0) {

Instead of adding #ifdef, I think we could introduce eal_parse_unix_option()
in a separate file, and it would call eal_parse_common_option().
So in Windows, you just skip it by calling directly eal_parse_common_option()
which would be truly common.
  
Kadam, Pallavi Jan. 28, 2020, 11:45 p.m. UTC | #2
On 1/27/2020 2:52 PM, Thomas Monjalon wrote:
> 13/01/2020 22:55, Pallavi Kadam:
>> Added #ifndef WIN64 to exclude syslog definitions and parameters
>> from Windows builds.
>>
>> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
>> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
>> ---
>> --- a/lib/librte_eal/common/eal_common_options.c
>> +++ b/lib/librte_eal/common/eal_common_options.c
>> @@ -204,9 +206,9 @@ eal_reset_internal_config(struct internal_config *internal_cfg)
>>   		internal_cfg->hugepage_info[i].lock_descriptor = -1;
>>   	}
>>   	internal_cfg->base_virtaddr = 0;
>> -
> Please keep blank lines

Sure, will add new lines here.

>
>> +#ifndef _WIN64
> Could it be #ifdef LOG_DAEMON?

Will update this in v6.

>
>>   	internal_cfg->syslog_facility = LOG_DAEMON;
>> -
>> +#endif
> [..]
>> @@ -1391,7 +1395,7 @@ eal_parse_common_option(int opt, const char *optarg,
>> +#ifndef _WIN64
>>   	case OPT_SYSLOG_NUM:
>>   		if (eal_parse_syslog(optarg, conf) < 0) {
> Instead of adding #ifdef, I think we could introduce eal_parse_unix_option()
> in a separate file, and it would call eal_parse_common_option().
> So in Windows, you just skip it by calling directly eal_parse_common_option()
> which would be truly common.

We might have to include changes in multiple files once we create a 'unix' directory
to introduce unix based functions and then test it on Linux and FreeBSD.

For this release, will include #ifndef RTE_EXEC_ENV_WINDOWS for syslog functions
and can add unix based functions in the next release.

>
>
>
  

Patch

diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index a7f9c5f9b..3cf32b156 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -6,7 +6,9 @@ 
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
+#ifndef _WIN64
 #include <syslog.h>
+#endif
 #include <ctype.h>
 #include <limits.h>
 #include <errno.h>
@@ -204,9 +206,9 @@  eal_reset_internal_config(struct internal_config *internal_cfg)
 		internal_cfg->hugepage_info[i].lock_descriptor = -1;
 	}
 	internal_cfg->base_virtaddr = 0;
-
+#ifndef _WIN64
 	internal_cfg->syslog_facility = LOG_DAEMON;
-
+#endif
 	/* if set to NONE, interrupt mode is determined automatically */
 	internal_cfg->vfio_intr_mode = RTE_INTR_MODE_NONE;
 
@@ -930,6 +932,7 @@  eal_parse_lcores(const char *lcores)
 	return ret;
 }
 
+#ifndef _WIN64
 static int
 eal_parse_syslog(const char *facility, struct internal_config *conf)
 {
@@ -968,6 +971,7 @@  eal_parse_syslog(const char *facility, struct internal_config *conf)
 	}
 	return -1;
 }
+#endif
 
 static int
 eal_parse_log_priority(const char *level)
@@ -1391,7 +1395,7 @@  eal_parse_common_option(int opt, const char *optarg,
 			return -1;
 		}
 		break;
-
+#ifndef _WIN64
 	case OPT_SYSLOG_NUM:
 		if (eal_parse_syslog(optarg, conf) < 0) {
 			RTE_LOG(ERR, EAL, "invalid parameters for --"
@@ -1399,7 +1403,7 @@  eal_parse_common_option(int opt, const char *optarg,
 			return -1;
 		}
 		break;
-
+#endif
 	case OPT_LOG_LEVEL_NUM: {
 		if (eal_parse_log_level(optarg) < 0) {
 			RTE_LOG(ERR, EAL,