1 // Copyright 2017 Google Inc.
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 #include "internal/filesystem.h"
20 #include <sys/types.h>
24 int CpuFeatures_OpenFile(const char* filename) {
25 return _open(filename, _O_RDONLY);
28 void CpuFeatures_CloseFile(int file_descriptor) { _close(file_descriptor); }
30 int CpuFeatures_ReadFile(int file_descriptor, void* buffer,
32 return _read(file_descriptor, buffer, buffer_size);
38 int CpuFeatures_OpenFile(const char* filename) {
41 result = open(filename, O_RDONLY);
42 } while (result == -1L && errno == EINTR);
46 void CpuFeatures_CloseFile(int file_descriptor) { close(file_descriptor); }
48 int CpuFeatures_ReadFile(int file_descriptor, void* buffer,
52 result = read(file_descriptor, buffer, buffer_size);
53 } while (result == -1L && errno == EINTR);