003 File Manager
Current Path:
/usr/src/lib/libc/sys
usr
/
src
/
lib
/
libc
/
sys
/
📁
..
📄
Makefile.inc
(10.5 KB)
📄
Symbol.map
(14.62 KB)
📄
__error.c
(1.92 KB)
📄
__vdso_gettimeofday.c
(4.46 KB)
📄
_exit.2
(3.63 KB)
📄
_umtx_op.2
(39.07 KB)
📄
abort2.2
(3.05 KB)
📄
accept.2
(6.12 KB)
📄
accept.c
(1.96 KB)
📄
accept4.c
(1.99 KB)
📄
access.2
(6.76 KB)
📄
acct.2
(4.23 KB)
📄
adjtime.2
(3.48 KB)
📄
aio_cancel.2
(3.31 KB)
📄
aio_error.2
(2.76 KB)
📄
aio_fsync.2
(5.05 KB)
📄
aio_mlock.2
(3.97 KB)
📄
aio_read.2
(6.56 KB)
📄
aio_return.2
(2.91 KB)
📄
aio_suspend.2
(3.2 KB)
📄
aio_suspend.c
(2.02 KB)
📄
aio_waitcomplete.2
(3.71 KB)
📄
aio_write.2
(6.52 KB)
📄
bind.2
(4.41 KB)
📄
bindat.2
(2.99 KB)
📄
brk.2
(4.74 KB)
📄
brk.c
(2.76 KB)
📄
cap_enter.2
(4.78 KB)
📄
cap_fcntls_limit.2
(3.38 KB)
📄
cap_ioctls_limit.2
(4.42 KB)
📄
cap_rights_limit.2
(4.27 KB)
📄
chdir.2
(3.88 KB)
📄
chflags.2
(9.61 KB)
📄
chmod.2
(9.27 KB)
📄
chown.2
(6.94 KB)
📄
chroot.2
(4.89 KB)
📄
clock_gettime.2
(5.29 KB)
📄
clock_gettime.c
(1.94 KB)
📄
clock_nanosleep.c
(2.06 KB)
📄
close.2
(4.32 KB)
📄
close.c
(1.86 KB)
📄
closefrom.2
(2.63 KB)
📄
closefrom.c
(1.75 KB)
📄
compat-ino64.h
(3.41 KB)
📄
compat-stub.c
(2.33 KB)
📄
connect.2
(5.59 KB)
📄
connect.c
(1.97 KB)
📄
connectat.2
(3 KB)
📄
copy_file_range.2
(4.89 KB)
📄
cpuset.2
(6.94 KB)
📄
cpuset_getaffinity.2
(4.82 KB)
📄
cpuset_getdomain.2
(5.46 KB)
📄
dup.2
(4.09 KB)
📄
eventfd.2
(5.29 KB)
📄
execve.2
(10.77 KB)
📄
extattr_get_file.2
(8.32 KB)
📄
fcntl.2
(17.85 KB)
📄
fcntl.c
(2.06 KB)
📄
fdatasync.c
(1.8 KB)
📄
ffclock.2
(6.31 KB)
📄
fhlink.2
(5.67 KB)
📄
fhopen.2
(3.78 KB)
📄
fhreadlink.2
(2.63 KB)
📄
flock.2
(4.92 KB)
📄
fork.2
(4.55 KB)
📄
fork.c
(1.83 KB)
📄
fstat.c
(1.83 KB)
📄
fstatat.c
(1.82 KB)
📄
fstatfs.c
(1.86 KB)
📄
fsync.2
(3.69 KB)
📄
fsync.c
(1.84 KB)
📄
getdents.c
(1.76 KB)
📄
getdirentries.2
(5.53 KB)
📄
getdirentries.c
(3.87 KB)
📄
getdtablesize.2
(2.29 KB)
📄
getfh.2
(5.13 KB)
📄
getfsstat.2
(3.71 KB)
📄
getfsstat.c
(2.23 KB)
📄
getgid.2
(2.67 KB)
📄
getgroups.2
(3.14 KB)
📄
getitimer.2
(4.86 KB)
📄
getlogin.2
(5.46 KB)
📄
getloginclass.2
(2.94 KB)
📄
getpeername.2
(2.96 KB)
📄
getpgrp.2
(3.85 KB)
📄
getpid.2
(2.57 KB)
📄
getpriority.2
(3.84 KB)
📄
getrandom.2
(3.39 KB)
📄
getrlimit.2
(7.42 KB)
📄
getrusage.2
(6 KB)
📄
getsid.2
(2.36 KB)
📄
getsockname.2
(2.94 KB)
📄
getsockopt.2
(18.1 KB)
📄
gettimeofday.2
(3.99 KB)
📄
gettimeofday.c
(1.83 KB)
📄
getuid.2
(2.69 KB)
📄
interposing_table.c
(3.35 KB)
📄
intro.2
(27.98 KB)
📄
ioctl.2
(4.27 KB)
📄
issetugid.2
(3.36 KB)
📄
jail.2
(9.56 KB)
📄
kenv.2
(4.2 KB)
📄
kevent.c
(2.12 KB)
📄
kill.2
(4.53 KB)
📄
kldfind.2
(2.34 KB)
📄
kldfirstmod.2
(2.2 KB)
📄
kldload.2
(2.65 KB)
📄
kldnext.2
(2.41 KB)
📄
kldstat.2
(3.48 KB)
📄
kldsym.2
(2.99 KB)
📄
kldunload.2
(2.61 KB)
📄
kqueue.2
(21.15 KB)
📄
ktrace.2
(6.26 KB)
📄
link.2
(7.32 KB)
📄
lio_listio.2
(4.8 KB)
📄
listen.2
(5.43 KB)
📄
lseek.2
(6.34 KB)
📄
lstat.c
(1.88 KB)
📄
madvise.2
(6.32 KB)
📄
mincore.2
(4.49 KB)
📄
minherit.2
(4.62 KB)
📄
mkdir.2
(5.28 KB)
📄
mkfifo.2
(5.21 KB)
📄
mknod.2
(5.17 KB)
📄
mknod.c
(1.71 KB)
📄
mlock.2
(5.6 KB)
📄
mlockall.2
(4.55 KB)
📄
mmap.2
(15.29 KB)
📄
modfind.2
(2.37 KB)
📄
modnext.2
(2.48 KB)
📄
modstat.2
(3.23 KB)
📄
mount.2
(10.66 KB)
📄
mprotect.2
(3.52 KB)
📄
mq_close.2
(3.85 KB)
📄
mq_getattr.2
(4.32 KB)
📄
mq_notify.2
(5.7 KB)
📄
mq_open.2
(9.36 KB)
📄
mq_receive.2
(6.92 KB)
📄
mq_send.2
(7.06 KB)
📄
mq_setattr.2
(4.3 KB)
📄
msgctl.2
(5.66 KB)
📄
msgget.2
(4.06 KB)
📄
msgrcv.2
(5.31 KB)
📄
msgsnd.2
(4.62 KB)
📄
msync.2
(3.5 KB)
📄
msync.c
(1.92 KB)
📄
munmap.2
(2.47 KB)
📄
nanosleep.2
(5.15 KB)
📄
nanosleep.c
(1.95 KB)
📄
nfssvc.2
(6.66 KB)
📄
ntp_adjtime.2
(8.96 KB)
📄
open.2
(15.7 KB)
📄
open.c
(2.07 KB)
📄
openat.c
(2.21 KB)
📄
pathconf.2
(7.65 KB)
📄
pdfork.2
(4.97 KB)
📄
pdfork.c
(1.83 KB)
📄
pipe.2
(4.52 KB)
📄
pipe.c
(1.79 KB)
📄
poll.2
(6.82 KB)
📄
poll.c
(1.91 KB)
📄
posix_fadvise.2
(4.3 KB)
📄
posix_fallocate.2
(4.21 KB)
📄
posix_openpt.2
(4.32 KB)
📄
ppoll.c
(2.04 KB)
📄
procctl.2
(20.29 KB)
📄
profil.2
(3.7 KB)
📄
pselect.2
(3.3 KB)
📄
pselect.c
(2.03 KB)
📄
ptrace.2
(28.87 KB)
📄
ptrace.c
(1.87 KB)
📄
quotactl.2
(6.9 KB)
📄
rctl_add_rule.2
(5.74 KB)
📄
read.2
(7.23 KB)
📄
read.c
(1.92 KB)
📄
readlink.2
(4.33 KB)
📄
readv.c
(1.97 KB)
📄
reboot.2
(5.31 KB)
📄
recv.2
(9.94 KB)
📄
recvfrom.c
(2.08 KB)
📄
recvmsg.c
(1.94 KB)
📄
rename.2
(8.36 KB)
📄
revoke.2
(3.76 KB)
📄
rfork.2
(5.15 KB)
📄
rmdir.2
(3.71 KB)
📄
rtprio.2
(6.11 KB)
📄
sched_get_priority_max.2
(3.59 KB)
📄
sched_setparam.2
(5.34 KB)
📄
sched_setscheduler.2
(4.62 KB)
📄
sched_yield.2
(1.97 KB)
📄
sctp_generic_recvmsg.2
(2.57 KB)
📄
sctp_generic_sendmsg.2
(2.86 KB)
📄
sctp_peeloff.2
(2.49 KB)
📄
select.2
(5.9 KB)
📄
select.c
(1.96 KB)
📄
semctl.2
(5.36 KB)
📄
semget.2
(3.99 KB)
📄
semop.2
(6.98 KB)
📄
send.2
(7.81 KB)
📄
sendfile.2
(10.57 KB)
📄
sendmsg.c
(1.95 KB)
📄
sendto.c
(2.06 KB)
📄
setcontext.c
(2.04 KB)
📄
setfib.2
(3.03 KB)
📄
setgroups.2
(3.19 KB)
📄
setpgid.2
(3.42 KB)
📄
setregid.2
(3.09 KB)
📄
setresuid.2
(2.55 KB)
📄
setreuid.2
(3.04 KB)
📄
setsid.2
(2.81 KB)
📄
setuid.2
(5.49 KB)
📄
shm_open.2
(10.56 KB)
📄
shm_open.c
(4.58 KB)
📄
shmat.2
(3.7 KB)
📄
shmctl.2
(4.33 KB)
📄
shmget.2
(3.82 KB)
📄
shutdown.2
(4.63 KB)
📄
sigaction.2
(19.07 KB)
📄
sigaction.c
(2.01 KB)
📄
sigaltstack.2
(5.04 KB)
📄
sigfastblock.2
(5.45 KB)
📄
sigpending.2
(2.58 KB)
📄
sigprocmask.2
(3.57 KB)
📄
sigprocmask.c
(2 KB)
📄
sigqueue.2
(4.43 KB)
📄
sigreturn.2
(3.01 KB)
📄
sigstack.2
(1.97 KB)
📄
sigsuspend.2
(2.89 KB)
📄
sigsuspend.c
(1.94 KB)
📄
sigtimedwait.c
(2.03 KB)
📄
sigwait.2
(3.65 KB)
📄
sigwait.c
(1.87 KB)
📄
sigwaitinfo.2
(5.22 KB)
📄
sigwaitinfo.c
(1.95 KB)
📄
socket.2
(9.3 KB)
📄
socketpair.2
(3.13 KB)
📄
stat.2
(11.23 KB)
📄
stat.c
(1.86 KB)
📄
statfs.2
(6.99 KB)
📄
statfs.c
(1.79 KB)
📄
swapcontext.c
(2.07 KB)
📄
swapon.2
(4.11 KB)
📄
symlink.2
(5.61 KB)
📄
sync.2
(2.47 KB)
📄
sysarch.2
(2.71 KB)
📄
syscall.2
(2.72 KB)
📄
thr_exit.2
(2.75 KB)
📄
thr_kill.2
(3.59 KB)
📄
thr_new.2
(6.85 KB)
📄
thr_self.2
(2.79 KB)
📄
thr_set_name.2
(2.89 KB)
📄
thr_suspend.2
(3.58 KB)
📄
thr_wake.2
(3.36 KB)
📄
timer_create.2
(4.93 KB)
📄
timer_delete.2
(2.39 KB)
📄
timer_settime.2
(7.16 KB)
📄
trivial-vdso_tc.c
(1.67 KB)
📄
truncate.2
(4.62 KB)
📄
umask.2
(2.71 KB)
📄
undelete.2
(3.56 KB)
📄
unlink.2
(7.26 KB)
📄
utimensat.2
(7.73 KB)
📄
utimes.2
(6.78 KB)
📄
utrace.2
(2.44 KB)
📄
uuidgen.2
(5 KB)
📄
vadvise.c
(1.76 KB)
📄
vfork.2
(3.94 KB)
📄
wait.2
(14.9 KB)
📄
wait4.c
(1.94 KB)
📄
wait6.c
(2.04 KB)
📄
write.2
(7.16 KB)
📄
write.c
(1.94 KB)
📄
writev.c
(1.97 KB)
Editing: __vdso_gettimeofday.c
/*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2012 Konstantin Belousov <kib@FreeBSD.org> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); #include <sys/elf.h> #include <sys/time.h> #include <sys/vdso.h> #include <errno.h> #include <strings.h> #include <time.h> #include <machine/atomic.h> #include "libc_private.h" static int tc_delta(const struct vdso_timehands *th, u_int *delta) { int error; u_int tc; error = __vdso_gettc(th, &tc); if (error == 0) *delta = (tc - th->th_offset_count) & th->th_counter_mask; return (error); } /* * Calculate the absolute or boot-relative time from the * machine-specific fast timecounter and the published timehands * structure read from the shared page. * * The lockless reading scheme is similar to the one used to read the * in-kernel timehands, see sys/kern/kern_tc.c:binuptime(). This code * is based on the kernel implementation. */ static int binuptime(struct bintime *bt, struct vdso_timekeep *tk, int abs) { struct vdso_timehands *th; uint32_t curr, gen; uint64_t scale, x; u_int delta, scale_bits; int error; do { if (!tk->tk_enabled) return (ENOSYS); curr = atomic_load_acq_32(&tk->tk_current); th = &tk->tk_th[curr]; gen = atomic_load_acq_32(&th->th_gen); *bt = th->th_offset; error = tc_delta(th, &delta); if (error == EAGAIN) continue; if (error != 0) return (error); scale = th->th_scale; #ifdef _LP64 scale_bits = ffsl(scale); #else scale_bits = ffsll(scale); #endif if (__predict_false(scale_bits + fls(delta) > 63)) { x = (scale >> 32) * delta; scale &= 0xffffffff; bt->sec += x >> 32; bintime_addx(bt, x << 32); } bintime_addx(bt, scale * delta); if (abs) bintime_add(bt, &th->th_boottime); /* * Ensure that the load of th_offset is completed * before the load of th_gen. */ atomic_thread_fence_acq(); } while (curr != tk->tk_current || gen == 0 || gen != th->th_gen); return (0); } static struct vdso_timekeep *tk; #pragma weak __vdso_gettimeofday int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz) { struct bintime bt; int error; if (tz != NULL) return (ENOSYS); if (tk == NULL) { error = __vdso_gettimekeep(&tk); if (error != 0 || tk == NULL) return (ENOSYS); } if (tk->tk_ver != VDSO_TK_VER_CURR) return (ENOSYS); error = binuptime(&bt, tk, 1); if (error != 0) return (error); bintime2timeval(&bt, tv); return (0); } #pragma weak __vdso_clock_gettime int __vdso_clock_gettime(clockid_t clock_id, struct timespec *ts) { struct bintime bt; int abs, error; if (tk == NULL) { error = _elf_aux_info(AT_TIMEKEEP, &tk, sizeof(tk)); if (error != 0 || tk == NULL) return (ENOSYS); } if (tk->tk_ver != VDSO_TK_VER_CURR) return (ENOSYS); switch (clock_id) { case CLOCK_REALTIME: case CLOCK_REALTIME_PRECISE: case CLOCK_REALTIME_FAST: case CLOCK_SECOND: abs = 1; break; case CLOCK_MONOTONIC: case CLOCK_MONOTONIC_PRECISE: case CLOCK_MONOTONIC_FAST: case CLOCK_UPTIME: case CLOCK_UPTIME_PRECISE: case CLOCK_UPTIME_FAST: abs = 0; break; default: return (ENOSYS); } error = binuptime(&bt, tk, abs); if (error != 0) return (error); bintime2timespec(&bt, ts); if (clock_id == CLOCK_SECOND) ts->tv_nsec = 0; return (0); }
Upload File
Create Folder