diff options
| author | Jung-uk Kim <jkim@FreeBSD.org> | 2013-01-17 21:32:03 +0000 |
|---|---|---|
| committer | Jung-uk Kim <jkim@FreeBSD.org> | 2013-01-17 21:32:03 +0000 |
| commit | ee39d6d85cfcfa8e856c410c0ad4cd96e8fded55 (patch) | |
| tree | 4bd397d55198bfd01fc6744430f25faf08f18b0c /source/os_specific | |
| parent | b28e481ae9b051dab150e9b5a89730cdc1103a9c (diff) | |
Notes
Diffstat (limited to 'source/os_specific')
| -rw-r--r-- | source/os_specific/service_layers/osunixdir.c | 35 | ||||
| -rw-r--r-- | source/os_specific/service_layers/osunixxf.c | 63 | ||||
| -rw-r--r-- | source/os_specific/service_layers/oswindir.c | 2 | ||||
| -rw-r--r-- | source/os_specific/service_layers/oswintbl.c | 2 | ||||
| -rw-r--r-- | source/os_specific/service_layers/oswinxf.c | 32 |
5 files changed, 85 insertions, 49 deletions
diff --git a/source/os_specific/service_layers/osunixdir.c b/source/os_specific/service_layers/osunixdir.c index 7916c03159640..58351a64ab10c 100644 --- a/source/os_specific/service_layers/osunixdir.c +++ b/source/os_specific/service_layers/osunixdir.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2012, Intel Corp. + * Copyright (C) 2000 - 2013, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -215,36 +215,3 @@ AcpiOsCloseDirectory ( closedir (ExternalInfo->DirPtr); free (DirHandle); } - - -/* Other functions acpisrc uses but that aren't standard on Unix */ - -/******************************************************************************* - * - * FUNCTION: strlwr - * - * PARAMETERS: str - String to be lowercased. - * - * RETURN: str. - * - * DESCRIPTION: Lowercase a string in-place. - * - ******************************************************************************/ - -char * -strlwr ( - char *str) -{ - int length; - int i; - - - length = strlen (str); - - for (i = 0; i < length; i++) - { - str[i] = tolower ((int) str[i]); - } - - return (str); -} diff --git a/source/os_specific/service_layers/osunixxf.c b/source/os_specific/service_layers/osunixxf.c index 9ae2465366ce1..2afc54e9df13d 100644 --- a/source/os_specific/service_layers/osunixxf.c +++ b/source/os_specific/service_layers/osunixxf.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2012, Intel Corp. + * Copyright (C) 2000 - 2013, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -84,6 +84,10 @@ AeTableOverride ( typedef void* (*PTHREAD_CALLBACK) (void *); +/* Buffer used by AcpiOsVprintf */ + +#define ACPI_VPRINTF_BUFFER_SIZE 512 + /* Apple-specific */ #ifdef __APPLE__ @@ -268,7 +272,8 @@ AcpiOsRedirectOutput ( * * RETURN: None * - * DESCRIPTION: Formatted output + * DESCRIPTION: Formatted output. Note: very similar to AcpiOsVprintf + * (performance), changes should be tracked in both functions. * *****************************************************************************/ @@ -278,11 +283,36 @@ AcpiOsPrintf ( ...) { va_list Args; + UINT8 Flags; + + + Flags = AcpiGbl_DbOutputFlags; + if (Flags & ACPI_DB_REDIRECTABLE_OUTPUT) + { + /* Output is directable to either a file (if open) or the console */ + if (AcpiGbl_DebugFile) + { + /* Output file is open, send the output there */ - va_start (Args, Fmt); - AcpiOsVprintf (Fmt, Args); - va_end (Args); + va_start (Args, Fmt); + vfprintf (AcpiGbl_DebugFile, Fmt, Args); + va_end (Args); + } + else + { + /* No redirection, send output to console (once only!) */ + + Flags |= ACPI_DB_CONSOLE_OUTPUT; + } + } + + if (Flags & ACPI_DB_CONSOLE_OUTPUT) + { + va_start (Args, Fmt); + vfprintf (AcpiGbl_OutputFile, Fmt, Args); + va_end (Args); + } } @@ -295,7 +325,9 @@ AcpiOsPrintf ( * * RETURN: None * - * DESCRIPTION: Formatted output with argument list pointer + * DESCRIPTION: Formatted output with argument list pointer. Note: very + * similar to AcpiOsPrintf, changes should be tracked in both + * functions. * *****************************************************************************/ @@ -305,8 +337,21 @@ AcpiOsVprintf ( va_list Args) { UINT8 Flags; + char Buffer[ACPI_VPRINTF_BUFFER_SIZE]; + /* + * We build the output string in a local buffer because we may be + * outputting the buffer twice. Using vfprintf is problematic because + * some implementations modify the args pointer/structure during + * execution. Thus, we use the local buffer for portability. + * + * Note: Since this module is intended for use by the various ACPICA + * utilities/applications, we can safely declare the buffer on the stack. + * Also, This function is used for relatively small error messages only. + */ + vsnprintf (Buffer, ACPI_VPRINTF_BUFFER_SIZE, Fmt, Args); + Flags = AcpiGbl_DbOutputFlags; if (Flags & ACPI_DB_REDIRECTABLE_OUTPUT) { @@ -316,7 +361,7 @@ AcpiOsVprintf ( { /* Output file is open, send the output there */ - vfprintf (AcpiGbl_DebugFile, Fmt, Args); + fputs (Buffer, AcpiGbl_DebugFile); } else { @@ -328,7 +373,7 @@ AcpiOsVprintf ( if (Flags & ACPI_DB_CONSOLE_OUTPUT) { - vfprintf (AcpiGbl_OutputFile, Fmt, Args); + fputs (Buffer, AcpiGbl_OutputFile); } } @@ -929,7 +974,7 @@ AcpiOsSleep ( * Sleep for remaining microseconds. * Arg to usleep() is in usecs and must be less than 1,000,000 (1 second). */ - usleep ((milliseconds % ACPI_MSEC_PER_SEC) * ACPI_USEC_PER_MSEC); + usleep ((milliseconds % ACPI_MSEC_PER_SEC) * ACPI_USEC_PER_MSEC); } diff --git a/source/os_specific/service_layers/oswindir.c b/source/os_specific/service_layers/oswindir.c index ab2d810a944f6..d7ead1c4474a2 100644 --- a/source/os_specific/service_layers/oswindir.c +++ b/source/os_specific/service_layers/oswindir.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2012, Intel Corp. + * Copyright (C) 2000 - 2013, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/source/os_specific/service_layers/oswintbl.c b/source/os_specific/service_layers/oswintbl.c index 2158b05377d16..6dcd5546b88a6 100644 --- a/source/os_specific/service_layers/oswintbl.c +++ b/source/os_specific/service_layers/oswintbl.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2012, Intel Corp. + * Copyright (C) 2000 - 2013, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/source/os_specific/service_layers/oswinxf.c b/source/os_specific/service_layers/oswinxf.c index 11e2d7bf377a5..b389fbe5122fe 100644 --- a/source/os_specific/service_layers/oswinxf.c +++ b/source/os_specific/service_layers/oswinxf.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2012, Intel Corp. + * Copyright (C) 2000 - 2013, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -440,13 +440,37 @@ AcpiOsPrintf ( ...) { va_list Args; + UINT8 Flags; - va_start (Args, Fmt); + Flags = AcpiGbl_DbOutputFlags; + if (Flags & ACPI_DB_REDIRECTABLE_OUTPUT) + { + /* Output is directable to either a file (if open) or the console */ - AcpiOsVprintf (Fmt, Args); + if (AcpiGbl_DebugFile) + { + /* Output file is open, send the output there */ + + va_start (Args, Fmt); + vfprintf (AcpiGbl_DebugFile, Fmt, Args); + va_end (Args); + } + else + { + /* No redirection, send output to console (once only!) */ + + Flags |= ACPI_DB_CONSOLE_OUTPUT; + } + } + + if (Flags & ACPI_DB_CONSOLE_OUTPUT) + { + va_start (Args, Fmt); + vfprintf (AcpiGbl_OutputFile, Fmt, Args); + va_end (Args); + } - va_end (Args); return; } |
