blob: eee144dc4abe9f9fa78948b0c51a1404dc77581f [file] [log] [blame]
Andrew Geissler1548c072019-02-22 16:03:50 -06001From 241f423a015279cb29b7ad1a34386ef1c32007fc Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 9 Dec 2018 16:47:16 -0800
4Subject: [PATCH] Define ulocked_{fgets|fread|fwrite} aliases
5
6latest clang converts the normal calls to the unlocked variant
7equivalents
8
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10Cc: Andrea Adami <andrea.adami@gmail.com>
11---
12 usr/klibc/fgets.c | 2 ++
13 usr/klibc/fread2.c | 2 ++
14 usr/klibc/fwrite2.c | 2 ++
15 3 files changed, 6 insertions(+)
16
17diff --git a/usr/klibc/fgets.c b/usr/klibc/fgets.c
18index dbf742c6..2e9fcb65 100644
19--- a/usr/klibc/fgets.c
20+++ b/usr/klibc/fgets.c
21@@ -25,3 +25,5 @@ char *fgets(char *s, int n, FILE *f)
22
23 return s;
24 }
25+char *fgets_unlocked(char *s, int n, FILE *f)
26+ __alias("fgets");
27diff --git a/usr/klibc/fread2.c b/usr/klibc/fread2.c
28index 7dca56b1..5c234766 100644
29--- a/usr/klibc/fread2.c
30+++ b/usr/klibc/fread2.c
31@@ -11,3 +11,5 @@ size_t fread(void *ptr, size_t size, size_t nmemb, FILE * f)
32 {
33 return _fread(ptr, size * nmemb, f) / size;
34 }
35+size_t fread_unlocked(void *ptr, size_t size, size_t nmemb, FILE *f)
36+ __alias("fread");
37diff --git a/usr/klibc/fwrite2.c b/usr/klibc/fwrite2.c
38index cebc017c..3e0bb57d 100644
39--- a/usr/klibc/fwrite2.c
40+++ b/usr/klibc/fwrite2.c
41@@ -11,3 +11,5 @@ size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE * f)
42 {
43 return _fwrite(ptr, size * nmemb, f) / size;
44 }
45+size_t fwrite_unlocked(void *ptr, size_t size, size_t nmemb, FILE *f)
46+ __alias("fwrite");
47--
482.19.2
49