1
0
mirror of https://github.com/openbsd/src.git synced 2024-12-22 16:42:56 -08:00

Move CLOCKS_PER_SEC to sys/_time.h so the kernel has access to it.

This will be used in waitid(2) to set si_utime and si_stime.
The definition of struct timespec also moves from time.h to sys/_time.h
for struct itimerspec.  OK kettenis@
This commit is contained in:
millert 2022-10-25 16:30:30 +00:00
parent 84a080a8d9
commit 3d0c28f3eb
2 changed files with 30 additions and 22 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: time.h,v 1.31 2018/10/30 16:28:42 guenther Exp $ */
/* $OpenBSD: time.h,v 1.32 2022/10/25 16:30:30 millert Exp $ */
/* $NetBSD: time.h,v 1.9 1994/10/26 00:56:35 cgd Exp $ */
/*
@ -44,6 +44,7 @@
#include <sys/cdefs.h>
#include <sys/_null.h>
#include <sys/_types.h>
#include <sys/_time.h>
#ifndef _CLOCK_T_DEFINED_
#define _CLOCK_T_DEFINED_
@ -68,21 +69,7 @@ typedef __size_t size_t;
#define CLK_TCK 100
#endif
#define CLOCKS_PER_SEC 100 /* frequency of ticks reported by clock(). */
#if __POSIX_VISIBLE >= 199309 || __ISO_C_VISIBLE >= 2011
#ifndef _TIMESPEC_DECLARED
#define _TIMESPEC_DECLARED
struct timespec {
time_t tv_sec; /* seconds */
long tv_nsec; /* and nanoseconds */
};
#endif
#endif
#if __POSIX_VISIBLE >= 199309
#include <sys/_time.h>
#ifndef _CLOCKID_T_DEFINED_
#define _CLOCKID_T_DEFINED_
typedef __clockid_t clockid_t;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: _time.h,v 1.9 2017/12/18 05:51:53 cheloha Exp $ */
/* $OpenBSD: _time.h,v 1.10 2022/10/25 16:30:30 millert Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -32,12 +32,8 @@
#ifndef _SYS__TIME_H_
#define _SYS__TIME_H_
#define CLOCK_REALTIME 0
#define CLOCK_PROCESS_CPUTIME_ID 2
#define CLOCK_MONOTONIC 3
#define CLOCK_THREAD_CPUTIME_ID 4
#define CLOCK_UPTIME 5
#define CLOCK_BOOTTIME 6
/* Frequency of ticks reported by clock(). */
#define CLOCKS_PER_SEC 100
#if __BSD_VISIBLE
/*
@ -49,6 +45,29 @@
#define __CLOCK_PTID(c) (((c) >> 12) & 0xfffff)
#endif
#if __POSIX_VISIBLE >= 199309 || __ISO_C_VISIBLE >= 2011
#ifndef _TIME_T_DEFINED_
#define _TIME_T_DEFINED_
typedef __time_t time_t;
#endif
#ifndef _TIMESPEC_DECLARED
#define _TIMESPEC_DECLARED
struct timespec {
time_t tv_sec; /* seconds */
long tv_nsec; /* and nanoseconds */
};
#endif
#endif
#if __POSIX_VISIBLE >= 199309
#define CLOCK_REALTIME 0
#define CLOCK_PROCESS_CPUTIME_ID 2
#define CLOCK_MONOTONIC 3
#define CLOCK_THREAD_CPUTIME_ID 4
#define CLOCK_UPTIME 5
#define CLOCK_BOOTTIME 6
/*
* Structure defined by POSIX 1003.1b to be like a itimerval,
* but with timespecs. Used in the timer_*() system calls.
@ -61,4 +80,6 @@ struct itimerspec {
#define TIMER_RELTIME 0x0 /* relative timer */
#define TIMER_ABSTIME 0x1 /* absolute timer */
#endif
#endif /* !_SYS__TIME_H_ */