summaryrefslogtreecommitdiff
path: root/include/unistd.h
diff options
context:
space:
mode:
authorjvoisin2023-09-22 18:27:54 +0200
committerjvoisin2023-09-22 18:30:35 +0200
commit75b95fa25df74fcd0498bf59e3524f20f594755d (patch)
tree729ba69a2358566f126a8b20f9f30d7a5f7f249c /include/unistd.h
parent8c2352b985b1bf69efb965ba15f5e300eb7e8e12 (diff)
Add more __diagnose_as_builtin annotations
Diffstat (limited to 'include/unistd.h')
-rw-r--r--include/unistd.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/include/unistd.h b/include/unistd.h
index 57f0d0c..38c7c9b 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -42,6 +42,9 @@ extern "C" {
42#undef write 42#undef write
43 43
44__access(write_only, 2, 3) 44__access(write_only, 2, 3)
45#if __has_builtin(__builtin_confstr)
46__diagnose_as_builtin(__builtin_confstr, 1, 2, 3)
47#endif
45_FORTIFY_FN(confstr) size_t confstr(int __n, char * _FORTIFY_POS0 __s, size_t __l) 48_FORTIFY_FN(confstr) size_t confstr(int __n, char * _FORTIFY_POS0 __s, size_t __l)
46{ 49{
47 size_t __b = __bos(__s, 0); 50 size_t __b = __bos(__s, 0);
@@ -53,6 +56,9 @@ _FORTIFY_FN(confstr) size_t confstr(int __n, char * _FORTIFY_POS0 __s, size_t __
53} 56}
54 57
55__access(write_only, 1, 2) 58__access(write_only, 1, 2)
59#if __has_builtin(__builtin_getcwd)
60__diagnose_as_builtin(__builtin_getcwd, 1, 2)
61#endif
56_FORTIFY_FN(getcwd) char *getcwd(char * _FORTIFY_POS0 __s, size_t __l) 62_FORTIFY_FN(getcwd) char *getcwd(char * _FORTIFY_POS0 __s, size_t __l)
57{ 63{
58 size_t __b = __bos(__s, 0); 64 size_t __b = __bos(__s, 0);
@@ -65,6 +71,9 @@ _FORTIFY_FN(getcwd) char *getcwd(char * _FORTIFY_POS0 __s, size_t __l)
65#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) 71#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
66#undef getdomainname 72#undef getdomainname
67__access(write_only, 1, 2) 73__access(write_only, 1, 2)
74#if __has_builtin(__builtin_getdomainname)
75__diagnose_as_builtin(__builtin_getdomainname, 1, 2)
76#endif
68_FORTIFY_FN(getdomainname) int getdomainname(char * _FORTIFY_POS0 __s, size_t __l) 77_FORTIFY_FN(getdomainname) int getdomainname(char * _FORTIFY_POS0 __s, size_t __l)
69{ 78{
70 size_t __b = __bos(__s, 0); 79 size_t __b = __bos(__s, 0);
@@ -75,6 +84,9 @@ _FORTIFY_FN(getdomainname) int getdomainname(char * _FORTIFY_POS0 __s, size_t __
75} 84}
76#endif 85#endif
77 86
87#if __has_builtin(__builtin_getgroups)
88__diagnose_as_builtin(__builtin_getgroups, 1, 2)
89#endif
78_FORTIFY_FN(getgroups) int getgroups(int __l, gid_t * _FORTIFY_POS0 __s) 90_FORTIFY_FN(getgroups) int getgroups(int __l, gid_t * _FORTIFY_POS0 __s)
79{ 91{
80 size_t __b = __bos(__s, 0); 92 size_t __b = __bos(__s, 0);
@@ -85,6 +97,9 @@ _FORTIFY_FN(getgroups) int getgroups(int __l, gid_t * _FORTIFY_POS0 __s)
85} 97}
86 98
87__access(write_only, 1, 2) 99__access(write_only, 1, 2)
100#if __has_builtin(__builtin_gethostname)
101__diagnose_as_builtin(__builtin_gethostname, 1, 2)
102#endif
88_FORTIFY_FN(gethostname) int gethostname(char * _FORTIFY_POS0 __s, size_t __l) 103_FORTIFY_FN(gethostname) int gethostname(char * _FORTIFY_POS0 __s, size_t __l)
89{ 104{
90 size_t __b = __bos(__s, 0); 105 size_t __b = __bos(__s, 0);
@@ -95,6 +110,9 @@ _FORTIFY_FN(gethostname) int gethostname(char * _FORTIFY_POS0 __s, size_t __l)
95} 110}
96 111
97__access(write_only, 1, 2) 112__access(write_only, 1, 2)
113#if __has_builtin(__builtin_getlogin_r)
114__diagnose_as_builtin(__builtin_getlogin_r, 1, 2)
115#endif
98_FORTIFY_FN(getlogin_r) int getlogin_r(char * _FORTIFY_POS0 __s, size_t __l) 116_FORTIFY_FN(getlogin_r) int getlogin_r(char * _FORTIFY_POS0 __s, size_t __l)
99{ 117{
100 size_t __b = __bos(__s, 0); 118 size_t __b = __bos(__s, 0);
@@ -104,6 +122,9 @@ _FORTIFY_FN(getlogin_r) int getlogin_r(char * _FORTIFY_POS0 __s, size_t __l)
104 return __orig_getlogin_r(__s, __l); 122 return __orig_getlogin_r(__s, __l);
105} 123}
106 124
125#if __has_builtin(__builtin_pread)
126__diagnose_as_builtin(__builtin_pread, 1, 2, 3, 4)
127#endif
107_FORTIFY_FN(pread) ssize_t pread(int __f, void * _FORTIFY_POS0 __s, 128_FORTIFY_FN(pread) ssize_t pread(int __f, void * _FORTIFY_POS0 __s,
108 size_t __n, off_t __o) 129 size_t __n, off_t __o)
109{ 130{
@@ -115,6 +136,9 @@ _FORTIFY_FN(pread) ssize_t pread(int __f, void * _FORTIFY_POS0 __s,
115} 136}
116 137
117__access(write_only, 2, 3) 138__access(write_only, 2, 3)
139#if __has_builtin(__builtin_read)
140__diagnose_as_builtin(__builtin_read, 1, 2, 3)
141#endif
118_FORTIFY_FN(read) ssize_t read(int __f, void * _FORTIFY_POS0 __s, size_t __n) 142_FORTIFY_FN(read) ssize_t read(int __f, void * _FORTIFY_POS0 __s, size_t __n)
119{ 143{
120 size_t __b = __bos(__s, 0); 144 size_t __b = __bos(__s, 0);
@@ -125,6 +149,9 @@ _FORTIFY_FN(read) ssize_t read(int __f, void * _FORTIFY_POS0 __s, size_t __n)
125} 149}
126 150
127__access(write_only, 2, 3) 151__access(write_only, 2, 3)
152#if __has_builtin(__builtin_readlink)
153__diagnose_as_builtin(__builtin_readlink, 1, 2, 3)
154#endif
128_FORTIFY_FN(readlink) ssize_t readlink(const char *__p, 155_FORTIFY_FN(readlink) ssize_t readlink(const char *__p,
129 char * _FORTIFY_POS0 __s, size_t __n) 156 char * _FORTIFY_POS0 __s, size_t __n)
130{ 157{
@@ -136,6 +163,9 @@ _FORTIFY_FN(readlink) ssize_t readlink(const char *__p,
136} 163}
137 164
138__access(write_only, 3, 4) 165__access(write_only, 3, 4)
166#if __has_builtin(__builtin_readlinkat)
167__diagnose_as_builtin(__builtin_readlinkat, 1, 2, 3, 4)
168#endif
139_FORTIFY_FN(readlinkat) ssize_t readlinkat(int __f, const char *__p, 169_FORTIFY_FN(readlinkat) ssize_t readlinkat(int __f, const char *__p,
140 char * _FORTIFY_POS0 __s, size_t __n) 170 char * _FORTIFY_POS0 __s, size_t __n)
141{ 171{
@@ -147,6 +177,9 @@ _FORTIFY_FN(readlinkat) ssize_t readlinkat(int __f, const char *__p,
147} 177}
148 178
149__access(write_only, 2, 3) 179__access(write_only, 2, 3)
180#if __has_builtin(__builtin_ttyname_r)
181__diagnose_as_builtin(__builtin_ttyname_r, 1, 2, 3)
182#endif
150_FORTIFY_FN(ttyname_r) int ttyname_r(int __f, char * _FORTIFY_POS0 __s, 183_FORTIFY_FN(ttyname_r) int ttyname_r(int __f, char * _FORTIFY_POS0 __s,
151 size_t __n) 184 size_t __n)
152{ 185{
@@ -158,6 +191,9 @@ _FORTIFY_FN(ttyname_r) int ttyname_r(int __f, char * _FORTIFY_POS0 __s,
158} 191}
159 192
160__access(read_only, 2, 3) 193__access(read_only, 2, 3)
194#if __has_builtin(__builtin_write)
195__diagnose_as_builtin(__builtin_write, 1, 2, 3)
196#endif
161_FORTIFY_FN(write) ssize_t write(int __f, const void * _FORTIFY_POS0 __s, 197_FORTIFY_FN(write) ssize_t write(int __f, const void * _FORTIFY_POS0 __s,
162 size_t __n) 198 size_t __n)
163{ 199{
@@ -168,6 +204,9 @@ _FORTIFY_FN(write) ssize_t write(int __f, const void * _FORTIFY_POS0 __s,
168 return __orig_write(__f, __s, __n); 204 return __orig_write(__f, __s, __n);
169} 205}
170 206
207#if __has_builtin(__builtin_pwrite)
208__diagnose_as_builtin(__builtin_pwrite, 1, 2, 3, 4)
209#endif
171_FORTIFY_FN(pwrite) ssize_t pwrite(int __f, const void * _FORTIFY_POS0 __s, 210_FORTIFY_FN(pwrite) ssize_t pwrite(int __f, const void * _FORTIFY_POS0 __s,
172 size_t __n, off_t __o) 211 size_t __n, off_t __o)
173{ 212{