mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-06 16:40:47 +00:00
libsys: fix sleep(3)/usleep(3) cancel behavior
Move functions back to libc/gen sources; they are only versioned from libc and not libsys. Access libsys interposing slots using __libsys_interposing_slot() instead of direct __libsys_interposing array dereference, which cannot work from libc. Reported by: glebius Reviewed by: brooks Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D44042
This commit is contained in:
parent
baa7d0741b
commit
7d233b2220
|
@ -137,6 +137,7 @@ SRCS+= \
|
|||
siglist.c \
|
||||
signal.c \
|
||||
sigsetops.c \
|
||||
sleep.c \
|
||||
srand48.c \
|
||||
statvfs.c \
|
||||
stringlist.c \
|
||||
|
@ -160,6 +161,7 @@ SRCS+= \
|
|||
ulimit.c \
|
||||
uname.c \
|
||||
unvis-compat.c \
|
||||
usleep.c \
|
||||
utime.c \
|
||||
utxdb.c \
|
||||
valloc.c \
|
||||
|
|
|
@ -56,7 +56,7 @@ __sleep(unsigned int seconds)
|
|||
time_to_sleep.tv_sec = seconds;
|
||||
time_to_sleep.tv_nsec = 0;
|
||||
if (((int (*)(const struct timespec *, struct timespec *))
|
||||
__libsys_interposing[INTERPOS_nanosleep])(
|
||||
(*__libsys_interposing_slot(INTERPOS_nanosleep)))(
|
||||
&time_to_sleep, &time_remaining) != -1)
|
||||
return (0);
|
||||
if (errno != EINTR)
|
|
@ -46,7 +46,8 @@ __usleep(useconds_t useconds)
|
|||
time_to_sleep.tv_nsec = (useconds % 1000000) * 1000;
|
||||
time_to_sleep.tv_sec = useconds / 1000000;
|
||||
return (((int (*)(const struct timespec *, struct timespec *))
|
||||
__libsys_interposing[INTERPOS_nanosleep])(&time_to_sleep, NULL));
|
||||
(*__libsys_interposing_slot(INTERPOS_nanosleep)))(&time_to_sleep,
|
||||
NULL));
|
||||
}
|
||||
|
||||
__weak_reference(__usleep, usleep);
|
|
@ -40,7 +40,7 @@ SRCS+= \
|
|||
SRCS+= getdents.c lstat.c mknod.c stat.c
|
||||
|
||||
SRCS+= creat.c
|
||||
SRCS+= lockf.c sleep.c usleep.c wait.c wait3.c waitpid.c waitid.c
|
||||
SRCS+= lockf.c wait.c wait3.c waitpid.c waitid.c
|
||||
SRCS+= recv.c recvmmsg.c send.c sendmmsg.c
|
||||
|
||||
NOASM+= sched_getcpu.o
|
||||
|
|
Loading…
Reference in a new issue