mirror of
				https://sourceware.org/git/glibc.git
				synced 2025-11-03 20:53:13 +03:00 
			
		
		
		
	This patch consolidates all the non cancellable write calls to use the __write_nocancel identifier. For non cancellable targets it will be just a macro to call the default respective symbol while on Linux will be a internal one. Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu. * sysdeps/generic/not-cancel.h (write_not_cancel): Remove macro. (__write_nocancel): New macro. * sysdeps/unix/sysv/linux/not-cancel.h (__write_nocancel): Rewrite as a function prototype. (write_not_cancel): Remove macro. * sysdeps/unix/sysv/linux/write.c (__write_nocancel): New function. * gmon/gmon.c (ERR): Replace write_not_cancel with __write_nocancel. (write_gmon): Likewise. * libio/fileops.c (_IO_new_file_write): Likewise. * login/utmp_file.c (pututline_file): Likewise. (updwtmp_file): Likewise. * stdio-common/psiginfo.c (psiginfo): Likewise. * sysdeps/posix/spawni.c (__spawni_child): Likewise. * sysdeps/unix/sysv/linux/gethostid.c (sethostid): Likewise. * sysdeps/unix/sysv/linux/libc_fatal.c (backtrace_and_maps): Likewise. * sysdeps/unix/sysv/linux/pthread_setname.c (pthread_setname_np): Likewise.
		
			
				
	
	
		
			46 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
/* Linux write syscall implementation.
 | 
						|
   Copyright (C) 2017 Free Software Foundation, Inc.
 | 
						|
   This file is part of the GNU C Library.
 | 
						|
 | 
						|
   The GNU C Library is free software; you can redistribute it and/or
 | 
						|
   modify it under the terms of the GNU Lesser General Public
 | 
						|
   License as published by the Free Software Foundation; either
 | 
						|
   version 2.1 of the License, or (at your option) any later version.
 | 
						|
 | 
						|
   The GNU C Library is distributed in the hope that it will be useful,
 | 
						|
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
						|
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
						|
   Lesser General Public License for more details.
 | 
						|
 | 
						|
   You should have received a copy of the GNU Lesser General Public
 | 
						|
   License along with the GNU C Library; if not, see
 | 
						|
   <http://www.gnu.org/licenses/>.  */
 | 
						|
 | 
						|
#include <unistd.h>
 | 
						|
#include <sysdep-cancel.h>
 | 
						|
#include <not-cancel.h>
 | 
						|
 | 
						|
/* Write NBYTES of BUF to FD.  Return the number written, or -1.  */
 | 
						|
ssize_t
 | 
						|
__libc_write (int fd, const void *buf, size_t nbytes)
 | 
						|
{
 | 
						|
  return SYSCALL_CANCEL (write, fd, buf, nbytes);
 | 
						|
}
 | 
						|
libc_hidden_def (__libc_write)
 | 
						|
 | 
						|
weak_alias (__libc_write, __write)
 | 
						|
libc_hidden_weak (__write)
 | 
						|
weak_alias (__libc_write, write)
 | 
						|
libc_hidden_weak (write)
 | 
						|
 | 
						|
#if !IS_IN (rtld)
 | 
						|
ssize_t
 | 
						|
__write_nocancel (int fd, const void *buf, size_t nbytes)
 | 
						|
{
 | 
						|
  return INLINE_SYSCALL_CALL (write, fd, buf, nbytes);
 | 
						|
}
 | 
						|
#else
 | 
						|
strong_alias (__libc_write, __write_nocancel)
 | 
						|
#endif
 | 
						|
libc_hidden_def (__write_nocancel)
 |