Message ID | 1501765874-6201-8-git-send-email-adhemerval.zanella@linaro.org |
---|---|
State | Accepted |
Commit | 7369800c04f3c0fb9fb15821feb10a7976425aca |
Headers | show |
Series | None | expand |
Since this is a refactor, if no one opposes I will commit it shortly. On 03/08/2017 10:11, Adhemerval Zanella wrote: > This patch consolidates all the non cancellable fcntl calls to use > the __fcntl_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. > > Since its prototype is already defined at internal fcntl.h header, it > is removed from not-cancel.h one. > > Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu. > > * login/utmp_file.c (timeout_handler): Replace fcntl_not_cancel with > __fcntl_nocancel. > * sysdeps/generic/not-cancel.h (fcntl_not_cancel): Remove macro. > * sysdeps/unix/sysv/linux/not-cancel.h (fcntl_not_cancel): Likewise. > --- > ChangeLog | 5 +++++ > login/utmp_file.c | 4 ++-- > sysdeps/generic/not-cancel.h | 2 -- > sysdeps/unix/sysv/linux/not-cancel.h | 4 ---- > 4 files changed, 7 insertions(+), 8 deletions(-) > > diff --git a/ChangeLog b/ChangeLog > index fbf0c6a..e1df1c1 100644 > --- a/ChangeLog > +++ b/ChangeLog > @@ -1,5 +1,10 @@ > 2017-08-02 Adhemerval Zanella <adhemerval.zanella@linaro.org> > > + * login/utmp_file.c (timeout_handler): Replace fcntl_not_cancel with > + __fcntl_nocancel. > + * sysdeps/generic/not-cancel.h (fcntl_not_cancel): Remove macro. > + * sysdeps/unix/sysv/linux/not-cancel.h (fcntl_not_cancel): Likewise. > + > * gmon/gmon.c (write_hist): Replace writev_not_cancel_no_status with > __writev_nocancel_nostatus. > (write_call_graph): Likewise. > diff --git a/login/utmp_file.c b/login/utmp_file.c > index 68e00f2..d410b6c 100644 > --- a/login/utmp_file.c > +++ b/login/utmp_file.c > @@ -81,7 +81,7 @@ static void timeout_handler (int signum) {}; > memset (&fl, '\0', sizeof (struct flock)); \ > fl.l_type = (type); \ > fl.l_whence = SEEK_SET; \ > - if (fcntl_not_cancel ((fd), F_SETLKW, &fl) < 0) > + if (__fcntl_nocancel ((fd), F_SETLKW, &fl) < 0) > > #define LOCKING_FAILED() \ > goto unalarm_return > @@ -89,7 +89,7 @@ static void timeout_handler (int signum) {}; > #define UNLOCK_FILE(fd) \ > /* Unlock the file. */ \ > fl.l_type = F_UNLCK; \ > - fcntl_not_cancel ((fd), F_SETLKW, &fl); \ > + __fcntl_nocancel ((fd), F_SETLKW, &fl); \ > \ > unalarm_return: \ > /* Reset the signal handler and alarm. We must reset the alarm \ > diff --git a/sysdeps/generic/not-cancel.h b/sysdeps/generic/not-cancel.h > index e3ed0e6..cf84550 100644 > --- a/sysdeps/generic/not-cancel.h > +++ b/sysdeps/generic/not-cancel.h > @@ -36,8 +36,6 @@ > __write (fd, buf, n) > #define __writev_nocancel_nostatus(fd, iov, n) \ > (void) __writev (fd, iov, n) > -#define fcntl_not_cancel(fd, cmd, val) \ > - __fcntl (fd, cmd, val) > # define waitpid_not_cancel(pid, stat_loc, options) \ > __waitpid (pid, stat_loc, options) > #define pause_not_cancel() \ > diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h > index 419a3fa..8f567d3 100644 > --- a/sysdeps/unix/sysv/linux/not-cancel.h > +++ b/sysdeps/unix/sysv/linux/not-cancel.h > @@ -72,10 +72,6 @@ __writev_nocancel_nostatus (int fd, const struct iovec *iov, int iovcnt) > INTERNAL_SYSCALL_CALL (writev, err, fd, iov, iovcnt); > } > > -/* Uncancelable fcntl. */ > -#define fcntl_not_cancel(fd, cmd, val) \ > - __fcntl_nocancel (fd, cmd, val) > - > /* Uncancelable waitpid. */ > #define __waitpid_nocancel(pid, stat_loc, options) \ > INLINE_SYSCALL (wait4, 4, pid, stat_loc, options, NULL) >
diff --git a/ChangeLog b/ChangeLog index fbf0c6a..e1df1c1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2017-08-02 Adhemerval Zanella <adhemerval.zanella@linaro.org> + * login/utmp_file.c (timeout_handler): Replace fcntl_not_cancel with + __fcntl_nocancel. + * sysdeps/generic/not-cancel.h (fcntl_not_cancel): Remove macro. + * sysdeps/unix/sysv/linux/not-cancel.h (fcntl_not_cancel): Likewise. + * gmon/gmon.c (write_hist): Replace writev_not_cancel_no_status with __writev_nocancel_nostatus. (write_call_graph): Likewise. diff --git a/login/utmp_file.c b/login/utmp_file.c index 68e00f2..d410b6c 100644 --- a/login/utmp_file.c +++ b/login/utmp_file.c @@ -81,7 +81,7 @@ static void timeout_handler (int signum) {}; memset (&fl, '\0', sizeof (struct flock)); \ fl.l_type = (type); \ fl.l_whence = SEEK_SET; \ - if (fcntl_not_cancel ((fd), F_SETLKW, &fl) < 0) + if (__fcntl_nocancel ((fd), F_SETLKW, &fl) < 0) #define LOCKING_FAILED() \ goto unalarm_return @@ -89,7 +89,7 @@ static void timeout_handler (int signum) {}; #define UNLOCK_FILE(fd) \ /* Unlock the file. */ \ fl.l_type = F_UNLCK; \ - fcntl_not_cancel ((fd), F_SETLKW, &fl); \ + __fcntl_nocancel ((fd), F_SETLKW, &fl); \ \ unalarm_return: \ /* Reset the signal handler and alarm. We must reset the alarm \ diff --git a/sysdeps/generic/not-cancel.h b/sysdeps/generic/not-cancel.h index e3ed0e6..cf84550 100644 --- a/sysdeps/generic/not-cancel.h +++ b/sysdeps/generic/not-cancel.h @@ -36,8 +36,6 @@ __write (fd, buf, n) #define __writev_nocancel_nostatus(fd, iov, n) \ (void) __writev (fd, iov, n) -#define fcntl_not_cancel(fd, cmd, val) \ - __fcntl (fd, cmd, val) # define waitpid_not_cancel(pid, stat_loc, options) \ __waitpid (pid, stat_loc, options) #define pause_not_cancel() \ diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h index 419a3fa..8f567d3 100644 --- a/sysdeps/unix/sysv/linux/not-cancel.h +++ b/sysdeps/unix/sysv/linux/not-cancel.h @@ -72,10 +72,6 @@ __writev_nocancel_nostatus (int fd, const struct iovec *iov, int iovcnt) INTERNAL_SYSCALL_CALL (writev, err, fd, iov, iovcnt); } -/* Uncancelable fcntl. */ -#define fcntl_not_cancel(fd, cmd, val) \ - __fcntl_nocancel (fd, cmd, val) - /* Uncancelable waitpid. */ #define __waitpid_nocancel(pid, stat_loc, options) \ INLINE_SYSCALL (wait4, 4, pid, stat_loc, options, NULL)