1 // SPDX-License-Identifier: BSD-2-Clause
2 /*
3  * Copyright (c) 2020, Huawei Technologies Co., Ltd
4  */
5 
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <unistd.h>
9 
fwrite(const void * ptr,size_t size,size_t nmemb,FILE * stream)10 size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
11 {
12 	int fd = 0;
13 
14 	if (stream == stdout)
15 		fd = 1;
16 	else if (stream == stderr)
17 		fd = 2;
18 	else
19 		abort();
20 
21 	return write(fd, ptr, size * nmemb);
22 }
23