xref: /illumos-gate/usr/src/cmd/acpi/common/osl.c (revision c653bb4713ca694c2d16b04b65d5b76c0bb46bd4)
1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy of the CDDL is also available via the Internet at
9  * http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright (c) 2018, Joyent, Inc.
14  */
15 
16 #include <fcntl.h>
17 #include <stdarg.h>
18 #include <stdio.h>
19 #include <sys/stat.h>
20 #include <sys/types.h>
21 #include <unistd.h>
22 
23 #include "acpi.h"
24 #include "accommon.h"
25 
26 UINT32
27 CmGetFileSize(ACPI_FILE File)
28 {
29 	int fd;
30 	struct stat sb;
31 
32 	fd = fileno(File);
33 	if (fstat(fd, &sb) != 0)
34 		return (ACPI_UINT32_MAX);
35 	return ((UINT32)sb.st_size);
36 }
37