tools/power/acpi/os_specific/service_layers/osunixxf.c

Source file repositories/reference/linux-study-clean/tools/power/acpi/os_specific/service_layers/osunixxf.c

File Facts

System
Linux kernel
Corpus path
tools/power/acpi/os_specific/service_layers/osunixxf.c
Extension
.c
Size
33088 bytes
Lines
1318
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: implementation source
Status
source implementation candidate

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

if (acpi_gbl_debug_file) {

			/* Output file is open, send the output there */

			va_start(args, fmt);
			vfprintf(acpi_gbl_debug_file, 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(acpi_gbl_output_file, fmt, args);
		va_end(args);
	}
}

/******************************************************************************
 *
 * FUNCTION:    acpi_os_vprintf
 *
 * PARAMETERS:  fmt                 - Standard printf format
 *              args                - Argument list
 *
 * RETURN:      None
 *
 * DESCRIPTION: Formatted output with argument list pointer. Note: very
 *              similar to acpi_os_printf, changes should be tracked in both
 *              functions.
 *
 *****************************************************************************/

void acpi_os_vprintf(const char *fmt, va_list args)
{
	u8 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 = acpi_gbl_db_output_flags;
	if (flags & ACPI_DB_REDIRECTABLE_OUTPUT) {

		/* Output is directable to either a file (if open) or the console */

		if (acpi_gbl_debug_file) {

			/* Output file is open, send the output there */

			fputs(buffer, acpi_gbl_debug_file);
		} else {
			/* No redirection, send output to console (once only!) */

			flags |= ACPI_DB_CONSOLE_OUTPUT;
		}
	}

	if (flags & ACPI_DB_CONSOLE_OUTPUT) {
		fputs(buffer, acpi_gbl_output_file);
	}
}

#ifndef ACPI_EXEC_APP
/******************************************************************************
 *
 * FUNCTION:    acpi_os_get_line
 *
 * PARAMETERS:  buffer              - Where to return the command line
 *              buffer_length       - Maximum length of Buffer
 *              bytes_read          - Where the actual byte count is returned
 *
 * RETURN:      Status and actual bytes read
 *
 * DESCRIPTION: Get the next input line from the terminal. NOTE: For the
 *              acpi_exec utility, we use the acgetline module instead to
 *              provide line-editing and history support.
 *

Annotation

Implementation Notes