diff --git a/lib/libcompat/Makefile b/lib/libcompat/Makefile index 7c99556e7513..e30e120c3d41 100644 --- a/lib/libcompat/Makefile +++ b/lib/libcompat/Makefile @@ -1,29 +1,24 @@ # @(#)Makefile 8.1 (Berkeley) 6/4/93 PACKAGE=lib${LIB} LIB= compat CFLAGS+=-I${SRCTOP}/lib/libc/locale NO_PIC= WARNS?= 0 -.PATH: ${.CURDIR}/4.1 ${.CURDIR}/4.3 ${.CURDIR}/4.4 - -# compat 4.1 sources -SRCS+= ftime.c - -MAN+= 4.1/ftime.3 +.PATH: ${.CURDIR}/4.3 ${.CURDIR}/4.4 # compat 4.3 sources SRCS+= re_comp.c rexec.c MAN+= 4.3/re_comp.3 4.3/rexec.3 MLINKS+=re_comp.3 re_exec.3 # compat 4.4 sources SRCS+= cuserid.c MAN+= 4.4/cuserid.3 .include diff --git a/lib/libutil/Makefile b/lib/libutil/Makefile index 889a81747c82..5bce5c158958 100644 --- a/lib/libutil/Makefile +++ b/lib/libutil/Makefile @@ -1,95 +1,95 @@ # @(#)Makefile 8.1 (Berkeley) 6/4/93 SHLIBDIR?= /lib .include PACKAGE= runtime .PATH: ${SRCTOP}/lib/libc/gen # for pw_scan.c LIB= util SHLIB_MAJOR= 9 SRCS= _secure_path.c auth.c cpuset.c expand_number.c flopen.c fparseln.c \ - getlocalbase.c gr_util.c \ + ftime.c getlocalbase.c gr_util.c \ hexdump.c humanize_number.c kinfo_getfile.c \ kinfo_getallproc.c kinfo_getproc.c kinfo_getvmmap.c \ kinfo_getvmobject.c kld.c \ login_auth.c login_cap.c \ login_class.c login_crypt.c login_ok.c login_times.c login_tty.c \ pidfile.c property.c pty.c pw_scan.c pw_util.c quotafile.c \ realhostname.c stub.c trimdomain.c uucplock.c INCS= libutil.h login_cap.h CFLAGS+= -DNO__SCCSID .if ${MK_INET6_SUPPORT} != "no" CFLAGS+= -DINET6 .endif CFLAGS+= -I${.CURDIR} -I${SRCTOP}/lib/libc/gen/ -MAN+= cpuset.3 expand_number.3 flopen.3 fparseln.3 getlocalbase.3 hexdump.3 \ - humanize_number.3 kinfo_getallproc.3 kinfo_getfile.3 \ +MAN+= cpuset.3 expand_number.3 flopen.3 fparseln.3 ftime.3 getlocalbase.3 \ + hexdump.3 humanize_number.3 kinfo_getallproc.3 kinfo_getfile.3 \ kinfo_getproc.3 kinfo_getvmmap.3 kinfo_getvmobject.3 kld.3 \ login_auth.3 login_cap.3 \ login_class.3 login_ok.3 login_times.3 login_tty.3 pidfile.3 \ property.3 pty.3 quotafile.3 realhostname.3 realhostname_sa.3 \ _secure_path.3 trimdomain.3 uucplock.3 pw_util.3 MAN+= login.conf.5 MLINKS+=flopen.3 flopenat.3 MLINKS+=kld.3 kld_isloaded.3 kld.3 kld_load.3 MLINKS+=login_auth.3 auth_cat.3 login_auth.3 auth_checknologin.3 MLINKS+=login_cap.3 login_close.3 login_cap.3 login_getcapbool.3 \ login_cap.3 login_getcaplist.3 login_cap.3 login_getcapnum.3 \ login_cap.3 login_getcapsize.3 login_cap.3 login_getcapstr.3 \ login_cap.3 login_getcaptime.3 login_cap.3 login_getclass.3 \ login_cap.3 login_getclassbyname.3 login_cap.3 login_getpath.3 \ login_cap.3 login_getpwclass.3 login_cap.3 login_getstyle.3 \ login_cap.3 login_getuserclass.3 login_cap.3 login_setcryptfmt.3 MLINKS+=login_class.3 setclasscontext.3 login_class.3 setclassenvironment.3 \ login_class.3 setclassresources.3 login_class.3 setusercontext.3 MLINKS+=login_ok.3 auth_hostok.3 login_ok.3 auth_timeok.3 \ login_ok.3 auth_ttyok.3 MLINKS+=login_times.3 in_lt.3 login_times.3 in_ltm.3 \ login_times.3 in_ltms.3 \ login_times.3 in_lts.3 \ login_times.3 parse_lt.3 MLINKS+=pidfile.3 pidfile_close.3 \ pidfile.3 pidfile_fileno.3 \ pidfile.3 pidfile_open.3 \ pidfile.3 pidfile_remove.3 \ pidfile.3 pidfile_write.3 MLINKS+=property.3 property_find.3 property.3 properties_free.3 MLINKS+=property.3 properties_read.3 MLINKS+=pty.3 forkpty.3 pty.3 openpty.3 MLINKS+=quotafile.3 quota_close.3 \ quotafile.3 quota_fsname.3 \ quotafile.3 quota_open.3 \ quotafile.3 quota_qfname.3 \ quotafile.3 quota_read.3 \ quotafile.3 quota_statfs.3 \ quotafile.3 quota_write_limits.3 \ quotafile.3 quota_write_usage.3 MLINKS+=uucplock.3 uu_lock.3 uucplock.3 uu_lock_txfr.3 \ uucplock.3 uu_lockerr.3 uucplock.3 uu_unlock.3 MLINKS+=pw_util.3 pw_copy.3 \ pw_util.3 pw_dup.3 \ pw_util.3 pw_edit.3 \ pw_util.3 pw_equal.3 \ pw_util.3 pw_fini.3 \ pw_util.3 pw_init.3 \ pw_util.3 pw_make.3 \ pw_util.3 pw_make_v7.3 \ pw_util.3 pw_mkdb.3 \ pw_util.3 pw_lock.3 \ pw_util.3 pw_scan.3 \ pw_util.3 pw_tempname.3 \ pw_util.3 pw_tmp.3 MLINKS+=cpuset.3 cpuset_parselist.3 HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/lib/libcompat/4.1/ftime.3 b/lib/libutil/ftime.3 similarity index 98% rename from lib/libcompat/4.1/ftime.3 rename to lib/libutil/ftime.3 index 48eb465aed31..dbed25317115 100644 --- a/lib/libcompat/4.1/ftime.3 +++ b/lib/libutil/ftime.3 @@ -1,80 +1,80 @@ .\" Copyright (c) 1980, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" 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. .\" 3. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. .\" .\" @(#)ftime.3 8.1 (Berkeley) 6/4/93 .\" -.Dd August 4, 2018 +.Dd May 28, 2024 .Dt FTIME 3 .Os .Sh NAME .Nm ftime .Nd get date and time .Sh LIBRARY -.Lb libcompat +.Lb libuitl .Sh SYNOPSIS .In sys/types.h .In sys/timeb.h .Ft int .Fn ftime "struct timeb *tp" .Sh DESCRIPTION .Bf -symbolic This interface is obsoleted by .Xr gettimeofday 2 . .Ef .Pp The .Fn ftime routine fills in a structure pointed to by its argument, as defined by .In sys/timeb.h : .Bd -literal -offset indent /* * Structure returned by ftime system call */ struct timeb { time_t time; unsigned short millitm; short timezone; short dstflag; }; .Ed .Pp The structure contains the time since the epoch in seconds, up to 1000 milliseconds of more-precise interval, The kernel no longer maintains the timezone and dstflag info, so 0 is always returned for these fields. .Sh SEE ALSO .Xr gettimeofday 2 , .Xr settimeofday 2 , .Xr ctime 3 , .Xr time 3 .Sh HISTORY The .Nm function appeared in .At v7 . diff --git a/lib/libcompat/4.1/ftime.c b/lib/libutil/ftime.c similarity index 99% rename from lib/libcompat/4.1/ftime.c rename to lib/libutil/ftime.c index 5ea57bca40fd..b31fca907883 100644 --- a/lib/libcompat/4.1/ftime.c +++ b/lib/libutil/ftime.c @@ -1,52 +1,54 @@ /*- * SPDX-License-Identifier: BSD-4-Clause * * Copyright (c) 1994 Christopher G. Demetriou * All rights reserved. * * 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. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Christopher G. Demetriou. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 #include #include + +#define _IN_LIBUITL #include int ftime(struct timeb *tbp) { struct timezone tz; struct timeval t; if (gettimeofday(&t, &tz) < 0) return (-1); tbp->millitm = t.tv_usec / 1000; tbp->time = t.tv_sec; tbp->timezone = tz.tz_minuteswest; tbp->dstflag = tz.tz_dsttime; return (0); } diff --git a/sys/sys/timeb.h b/sys/sys/timeb.h index 952a5e83b8a7..853541e27ae6 100644 --- a/sys/sys/timeb.h +++ b/sys/sys/timeb.h @@ -1,69 +1,69 @@ /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * 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. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. * * @(#)timeb.h 8.2 (Berkeley) 1/21/94 */ #ifndef _SYS_TIMEB_H_ #define _SYS_TIMEB_H_ -#ifdef __GNUC__ +#if defined(__GNUC__) && !defined(_IN_LIBUITL) #warning "this file includes which is deprecated" #endif #include #ifndef _TIME_T_DECLARED typedef __time_t time_t; #define _TIME_T_DECLARED #endif /* The ftime(2) system call structure -- deprecated. */ struct timeb { time_t time; /* seconds since the Epoch */ unsigned short millitm; /* + milliseconds since the Epoch */ short timezone; /* minutes west of CUT */ short dstflag; /* DST == non-zero */ }; #ifndef _KERNEL #include __BEGIN_DECLS int ftime(struct timeb *); __END_DECLS #endif /* _KERNEL */ #endif /* !_SYS_TIMEB_H_ */