xref: /illumos-gate/usr/src/cmd/acpi/common/osl.c (revision 35786f68)
17b1019a6SJerry Jelinek /*
27b1019a6SJerry Jelinek  * This file and its contents are supplied under the terms of the
37b1019a6SJerry Jelinek  * Common Development and Distribution License ("CDDL"), version 1.0.
47b1019a6SJerry Jelinek  * You may only use this file in accordance with the terms of version
57b1019a6SJerry Jelinek  * 1.0 of the CDDL.
67b1019a6SJerry Jelinek  *
77b1019a6SJerry Jelinek  * A full copy of the text of the CDDL should have accompanied this
87b1019a6SJerry Jelinek  * source.  A copy of the CDDL is also available via the Internet at
97b1019a6SJerry Jelinek  * http://www.illumos.org/license/CDDL.
107b1019a6SJerry Jelinek  */
117b1019a6SJerry Jelinek 
127b1019a6SJerry Jelinek /*
13*bc36eafdSMike Gerdts  * Copyright (c) 2018, Joyent, Inc.
147b1019a6SJerry Jelinek  */
157b1019a6SJerry Jelinek 
16*bc36eafdSMike Gerdts #include <fcntl.h>
177b1019a6SJerry Jelinek #include <stdarg.h>
18*bc36eafdSMike Gerdts #include <stdio.h>
19*bc36eafdSMike Gerdts #include <sys/stat.h>
20*bc36eafdSMike Gerdts #include <sys/types.h>
21*bc36eafdSMike Gerdts #include <unistd.h>
22*bc36eafdSMike Gerdts 
237b1019a6SJerry Jelinek #include "acpi.h"
247b1019a6SJerry Jelinek #include "accommon.h"
257b1019a6SJerry Jelinek 
26*bc36eafdSMike Gerdts UINT32
CmGetFileSize(ACPI_FILE File)27*bc36eafdSMike Gerdts CmGetFileSize(ACPI_FILE File)
287b1019a6SJerry Jelinek {
29*bc36eafdSMike Gerdts 	int fd;
30*bc36eafdSMike Gerdts 	struct stat sb;
317b1019a6SJerry Jelinek 
32*bc36eafdSMike Gerdts 	fd = fileno(File);
33*bc36eafdSMike Gerdts 	if (fstat(fd, &sb) != 0)
34*bc36eafdSMike Gerdts 		return (ACPI_UINT32_MAX);
35*bc36eafdSMike Gerdts 	return ((UINT32)sb.st_size);
367b1019a6SJerry Jelinek }
37