@@ -141,7 +141,7 @@ void *realloc(void *ptr, size_t size)
141
141
return r ;
142
142
}
143
143
144
- ssize_t read (int fd , void * buf , size_t count )
144
+ ssize_t _native_read (int fd , void * buf , size_t count )
145
145
{
146
146
ssize_t r ;
147
147
@@ -152,27 +152,26 @@ ssize_t read(int fd, void *buf, size_t count)
152
152
return r ;
153
153
}
154
154
155
- ssize_t write (int fd , const void * buf , size_t count )
155
+ ssize_t _native_write (int fd , const void * buf , size_t count )
156
156
{
157
157
ssize_t r ;
158
158
159
159
_native_syscall_enter ();
160
- //real_write(fd, "real_write: ", 12);
161
160
r = real_write (fd , buf , count );
162
161
_native_syscall_leave ();
163
162
164
163
return r ;
165
164
}
166
165
167
166
int putchar (int c ) {
168
- write (STDOUT_FILENO , & c , 1 );
167
+ _native_write (STDOUT_FILENO , & c , 1 );
169
168
return 0 ;
170
169
}
171
170
172
171
int puts (const char * s )
173
172
{
174
173
int r ;
175
- r = write (STDOUT_FILENO , (char * )s , strlen (s ));
174
+ r = _native_write (STDOUT_FILENO , (char * )s , strlen (s ));
176
175
putchar ('\n' );
177
176
return r ;
178
177
}
@@ -213,7 +212,7 @@ int printf(const char *format, ...)
213
212
if ((m = make_message (format , argp )) == NULL ) {
214
213
err (EXIT_FAILURE , "malloc" );
215
214
}
216
- r = write (STDOUT_FILENO , m , strlen (m ));
215
+ r = _native_write (STDOUT_FILENO , m , strlen (m ));
217
216
va_end (argp );
218
217
free (m );
219
218
@@ -229,7 +228,7 @@ int vprintf(const char *format, va_list argp)
229
228
if ((m = make_message (format , argp )) == NULL ) {
230
229
err (EXIT_FAILURE , "malloc" );
231
230
}
232
- r = write (STDOUT_FILENO , m , strlen (m ));
231
+ r = _native_write (STDOUT_FILENO , m , strlen (m ));
233
232
free (m );
234
233
235
234
return r ;
@@ -243,15 +242,15 @@ void vwarn(const char *fmt, va_list args)
243
242
e = strerror (errno );
244
243
245
244
if ((m = make_message (fmt , args )) == NULL ) {
246
- write (STDERR_FILENO , "malloc\n" , 7 );
245
+ _native_write (STDERR_FILENO , "malloc\n" , 7 );
247
246
exit (EXIT_FAILURE );
248
247
}
249
- write (STDERR_FILENO , _progname , strlen (_progname ));
250
- write (STDERR_FILENO , ": " , 2 );
251
- write (STDERR_FILENO , m , strlen (m ));
252
- write (STDERR_FILENO , ": " , 2 );
253
- write (STDERR_FILENO , e , strlen (e ));
254
- write (STDERR_FILENO , "\n" , 1 );
248
+ _native_write (STDERR_FILENO , _progname , strlen (_progname ));
249
+ _native_write (STDERR_FILENO , ": " , 2 );
250
+ _native_write (STDERR_FILENO , m , strlen (m ));
251
+ _native_write (STDERR_FILENO , ": " , 2 );
252
+ _native_write (STDERR_FILENO , e , strlen (e ));
253
+ _native_write (STDERR_FILENO , "\n" , 1 );
255
254
free (m );
256
255
}
257
256
@@ -260,13 +259,13 @@ void vwarnx(const char *fmt, va_list args)
260
259
char * m ;
261
260
262
261
if ((m = make_message (fmt , args )) == NULL ) {
263
- write (STDERR_FILENO , "malloc\n" , 7 );
262
+ _native_write (STDERR_FILENO , "malloc\n" , 7 );
264
263
exit (EXIT_FAILURE );
265
264
}
266
- write (STDERR_FILENO , _progname , strlen (_progname ));
267
- write (STDERR_FILENO , ": " , 2 );
268
- write (STDERR_FILENO , m , strlen (m ));
269
- write (STDERR_FILENO , "\n" , 1 );
265
+ _native_write (STDERR_FILENO , _progname , strlen (_progname ));
266
+ _native_write (STDERR_FILENO , ": " , 2 );
267
+ _native_write (STDERR_FILENO , m , strlen (m ));
268
+ _native_write (STDERR_FILENO , "\n" , 1 );
270
269
free (m );
271
270
}
272
271
0 commit comments