Page MenuHomeFreeBSD

D49423.id152509.diff
No OneTemporary

D49423.id152509.diff

diff --git a/include/dlfcn.h b/include/dlfcn.h
--- a/include/dlfcn.h
+++ b/include/dlfcn.h
@@ -80,6 +80,9 @@
const char *dli_sname; /* Name of nearest symbol. */
void *dli_saddr; /* Address of nearest symbol. */
} Dl_info;
+#if __POSIX_VISIBLE >= 202405
+typedef struct dl_info Dl_info_t;
+#endif
/*-
* The actual type declared by this typedef is immaterial, provided that
@@ -119,9 +122,12 @@
void *dlopen(const char *, int);
void *dlsym(void * __restrict, const char * __restrict);
+#if __POSIX_VISIBLE >= 202405
+int dladdr(const void * __restrict, Dl_info * __restrict);
+#endif
+
#if __BSD_VISIBLE
void *fdlopen(int, int);
-int dladdr(const void * __restrict, Dl_info * __restrict);
dlfunc_t dlfunc(void * __restrict, const char * __restrict);
int dlinfo(void * __restrict, int, void * __restrict);
void dllockinit(void *_context,
diff --git a/include/stdlib.h b/include/stdlib.h
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -157,7 +157,7 @@
/*
* If we're in a mode greater than C99, expose C11 functions.
*/
-#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
+#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L || __POSIX_VISIBLE >= 202405
void * aligned_alloc(size_t, size_t) __malloc_like __alloc_align(1)
__alloc_size(2);
int at_quick_exit(void (*)(void)) __noexcept;
@@ -236,6 +236,13 @@
int ptsname_r(int, char *, size_t);
#endif
+#if __POSIX_VISIBLE >= 202405
+void qsort_r(void *, size_t, size_t,
+ int (*)(const void *, const void *, void *), void *);
+void *reallocarray(void *, size_t, size_t) __result_use_check
+ __alloc_size2(2, 3);
+#endif
+
#if __BSD_VISIBLE
extern const char *malloc_conf;
extern void (*malloc_message)(void *, const char *);
@@ -305,12 +312,8 @@
int mkostemp(char *, int);
int mkostemps(char *, int, int);
int mkostempsat(int, char *, int, int);
-void qsort_r(void *, size_t, size_t,
- int (*)(const void *, const void *, void *), void *);
int radixsort(const unsigned char **, int, const unsigned char *,
unsigned);
-void *reallocarray(void *, size_t, size_t) __result_use_check
- __alloc_size2(2, 3);
void *reallocf(void *, size_t) __result_use_check __alloc_size(2);
int rpmatch(const char *);
char *secure_getenv(const char *);
diff --git a/include/string.h b/include/string.h
--- a/include/string.h
+++ b/include/string.h
@@ -63,8 +63,8 @@
#endif
int memcmp(const void *, const void *, size_t) __pure;
void *(memcpy)(void * __restrict, const void * __restrict, size_t);
-#if __BSD_VISIBLE
-void *memmem(const void *, size_t, const void *, size_t) __pure;
+#if __POSIX_VISIBLE >= 202405
+void *(memmem)(const void *, size_t, const void *, size_t) __pure;
#endif
void *(memmove)(void *, const void *, size_t);
#if __BSD_VISIBLE
@@ -98,7 +98,7 @@
#if __POSIX_VISIBLE >= 200112
int strerror_r(int, char *, size_t);
#endif
-#if __BSD_VISIBLE
+#if __POSIX_VISIBLE >= 202405
size_t (strlcat)(char * __restrict, const char * __restrict, size_t);
size_t (strlcpy)(char * __restrict, const char * __restrict, size_t);
#endif
diff --git a/include/time.h b/include/time.h
--- a/include/time.h
+++ b/include/time.h
@@ -180,15 +180,17 @@
#include <xlocale/_time.h>
#endif
-#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 2011 || \
+#if __ISO_C_VISIBLE >= 2011 || __POSIX_VISIBLE >= 202405 || \
(defined(__cplusplus) && __cplusplus >= 201703)
#include <sys/_timespec.h>
/* ISO/IEC 9899:2011 7.27.2.5 The timespec_get function */
#define TIME_UTC 1 /* time elapsed since epoch */
-int timespec_get(struct timespec *ts, int base);
-#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 2023
+#if __ISO_C_VISIBLE >= 2023 || __POSIX_VISIBLE >= 202405
/* ISO/IEC 9899:2024 7.29.1 Components of time */
#define TIME_MONOTONIC 2 /* monotonic time */
+#endif
+int timespec_get(struct timespec *ts, int base);
+#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 2023
/* ISO/IEC 9899:2024 7.29.2.7 The timespec_getres function */
int timespec_getres(struct timespec *, int);
#endif
diff --git a/include/unistd.h b/include/unistd.h
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -483,6 +483,16 @@
pid_t vfork(void) __returns_twice;
#endif
+/* 1003.1-2024 */
+#if __POSIX_VISIBLE >= 202405
+pid_t _Fork(void);
+int getentropy(void *, size_t);
+int getresgid(gid_t *, gid_t *, gid_t *);
+int getresuid(uid_t *, uid_t *, uid_t *);
+int setresgid(gid_t, gid_t, gid_t);
+int setresuid(uid_t, uid_t, uid_t);
+#endif
+
#if __BSD_VISIBLE
struct timeval; /* select(2) */
@@ -510,14 +520,11 @@
int fchroot(int);
char *fflagstostr(u_long);
int getdomainname(char *, int);
-int getentropy(void *, size_t);
int getgrouplist(const char *, gid_t, gid_t *, int *);
int getloginclass(char *, size_t);
mode_t getmode(const void *, mode_t);
int getosreldate(void);
int getpeereid(int, uid_t *, gid_t *);
-int getresgid(gid_t *, gid_t *, gid_t *);
-int getresuid(uid_t *, uid_t *, uid_t *);
char *getusershell(void);
int initgroups(const char *, gid_t);
int iruserok(unsigned long, int, const char *, const char *);
@@ -575,8 +582,6 @@
int setpgrp(pid_t, pid_t); /* obsoleted by setpgid() */
void setproctitle(const char *_fmt, ...) __printf0like(1, 2);
void setproctitle_fast(const char *_fmt, ...) __printf0like(1, 2);
-int setresgid(gid_t, gid_t, gid_t);
-int setresuid(uid_t, uid_t, uid_t);
int setrgid(gid_t);
int setruid(uid_t);
void setusershell(void);
@@ -589,7 +594,6 @@
int unwhiteout(const char *);
void *valloc(size_t); /* obsoleted by malloc() */
int funlinkat(int, const char *, int, int);
-pid_t _Fork(void);
#ifndef _OPTRESET_DECLARED
#define _OPTRESET_DECLARED
diff --git a/include/wchar.h b/include/wchar.h
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -235,12 +235,15 @@
size_t, mbstate_t * __restrict);
#endif
-#if __BSD_VISIBLE
-wchar_t *fgetwln(FILE * __restrict, size_t * __restrict);
+#if __POSIX_VISIBLE >= 202405
size_t wcslcat(wchar_t *, const wchar_t *, size_t);
size_t wcslcpy(wchar_t *, const wchar_t *, size_t);
#endif
+#if __BSD_VISIBLE
+wchar_t *fgetwln(FILE * __restrict, size_t * __restrict);
+#endif
+
#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
#include <xlocale/_wchar.h>
#endif
diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h
--- a/sys/sys/cdefs.h
+++ b/sys/sys/cdefs.h
@@ -468,6 +468,173 @@
#define __RENAME(x) no renaming in kernel/standalone environment
#endif
+/*
+ * Verify that zero or one of the environment selection macros are defined.
+ * See cdefs(9)
+ */
+#if __BSD_VISIBLE
+/*
+ * The error is preferred... if we can get away with it, move it to be with
+ * the rest of the __*_VISIBLE checks after the _*_SOURCE checks
+ */
+#error "__BSD_VISIBLE defined by user - exp-run"
+#warning "__BSD_VISIBLE defined by user, forcing _BSD_SOURCE see cdefs(9)"
+#ifndef _BSD_SOURCE
+#define _BSD_SOURCE
+#endif
+#endif
+
+/*
+ * The priority is _BSD_SOURCE, _XOPEN_SOURCE, _POSIX_C_SOURCE, _CXX_SOURCE
+ * _CXX_SOURCE can upgrade the C version for _XOPEN_SOURCE and _POSIX_C_SOURCE
+ * but cannot downgrade it.
+ */
+
+#if defined(_BSD_SOURCE)
+#define __PROGRAMMING_ENVIRONMENT_SELECTED 9999
+#endif
+
+#ifdef _XOPEN_SOURCE
+# ifdef __PROGRAMMING_ENVIRONMENT_SELECTED
+# warning "_XOPEN_SOURCE undefined due to conflict - see cdefs(9)"
+# undef _XOPEN_SOURCE
+# else
+# if _XOPEN_SOURCE - 0 >= 800
+# define __PROGRAMMING_ENVIRONMENT_SELECTED 2017
+# elif _XOPEN_SOURCE - 0 >= 700
+# define __PROGRAMMING_ENVIRONMENT_SELECTED 1999
+# elif _XOPEN_SOURCE - 0 >= 600
+# define __PROGRAMMING_ENVIRONMENT_SELECTED 1999
+# elif _XOPEN_SOURCE - 0 >= 500
+# define __PROGRAMMING_ENVIRONMENT_SELECTED 1990
+# else
+# define __PROGRAMMING_ENVIRONMENT_SELECTED 1
+# endif
+# endif
+#endif
+
+#ifdef _POSIX_C_SOURCE
+# ifdef __PROGRAMMING_ENVIRONMENT_SELECTED
+# warning "_POSIX_C_SOURCE undefined due to conflict - see cdefs(9)"
+# undef _POSIX_C_SOURCE
+# else
+# if _POSIX_C_SOURCE >= 202405
+# define __PROGRAMMING_ENVIRONMENT_SELECTED 2017
+# elif _POSIX_C_SOURCE >= 200809
+# define __PROGRAMMING_ENVIRONMENT_SELECTED 1999
+# elif _POSIX_C_SOURCE >= 200112
+# define __PROGRAMMING_ENVIRONMENT_SELECTED 1999
+# elif _POSIX_C_SOURCE >= 199506
+# define __PROGRAMMING_ENVIRONMENT_SELECTED 1990
+# elif _POSIX_C_SOURCE >= 199309
+# define __PROGRAMMING_ENVIRONMENT_SELECTED 1990
+# elif _POSIX_C_SOURCE >= 199209
+# define __PROGRAMMING_ENVIRONMENT_SELECTED 1990
+# elif _POSIX_C_SOURCE >= 199009
+# define __PROGRAMMING_ENVIRONMENT_SELECTED 1990
+# else
+# define __PROGRAMMING_ENVIRONMENT_SELECTED 1
+# endif
+# endif
+#endif
+
+#ifdef _POSIX_SOURCE
+#ifdef __PROGRAMMING_ENVIRONMENT_SELECTED
+#warning "_POSIX_SOURCE undefined due to conflict - see cdefs(9)"
+#undef _POSIX_SOURCE
+#else
+#define __PROGRAMMING_ENVIRONMENT_SELECTED 1
+#endif
+#endif
+
+#ifdef _C23_SOURCE
+#if __PROGRAMMING_ENVIRONMENT_SELECTED > 2023
+#warning "_C23_SOURCE undefined due to conflict - see cdefs(9)"
+#undef _C23_SOURCE
+#else
+#undef __PROGRAMMING_ENVIRONMENT_SELECTED
+#define __PROGRAMMING_ENVIRONMENT_SELECTED 2023
+#endif
+#endif
+
+#ifdef _C11_SOURCE
+#if __PROGRAMMING_ENVIRONMENT_SELECTED > 2011
+#warning "_C11_SOURCE undefined due to conflict - see cdefs(9)"
+#undef _C11_SOURCE
+#else
+#undef __PROGRAMMING_ENVIRONMENT_SELECTED
+#define __PROGRAMMING_ENVIRONMENT_SELECTED 2011
+#endif
+#endif
+
+#ifdef _ISOC11_SOURCE
+#if __PROGRAMMING_ENVIRONMENT_SELECTED > 2011
+#warning "_ISOC11_SOURCE undefined due to conflict - see cdefs(9)"
+#undef _ISOC11_SOURCE
+#else
+#undef __PROGRAMMING_ENVIRONMENT_SELECTED
+#define __PROGRAMMING_ENVIRONMENT_SELECTED 2011
+#endif
+#endif
+
+#ifdef _C99_SOURCE
+#if __PROGRAMMING_ENVIRONMENT_SELECTED > 1999
+#warning "_C99_SOURCE undefined due to conflict - see cdefs(9)"
+#undef _C99_SOURCE
+#else
+#undef __PROGRAMMING_ENVIRONMENT_SELECTED
+#define __PROGRAMMING_ENVIRONMENT_SELECTED 1999
+#endif
+#endif
+
+#ifdef _ISOC99_SOURCE
+#if __PROGRAMMING_ENVIRONMENT_SELECTED > 1999
+#warning "_ISOC99_SOURCE undefined due to conflict - see cdefs(9)"
+#undef _ISOC99_SOURCE
+#else
+#undef __PROGRAMMING_ENVIRONMENT_SELECTED
+#define __PROGRAMMING_ENVIRONMENT_SELECTED 1999
+#endif
+#endif
+
+#ifdef _ANSI_SOURCE
+#ifdef __PROGRAMMING_ENVIRONMENT_SELECTED
+#warning "_ANSI_SOURCE undefined due to conflict - see cdefs(9)"
+#undef _ANSI_SOURCE
+#else
+#define __PROGRAMMING_ENVIRONMENT_SELECTED 1990
+#endif
+#endif
+
+#ifndef __PROGRAMMING_ENVIRONMENT_SELECTED
+#define _BSD_SOURCE
+#endif
+
+#if __BSD_VISIBLE
+// NOTE: We already got a warning about this when we defined _BSD_SOURCE
+#undef __BSD_VISIBLE
+#endif
+
+#if defined(__POSIX_VISIBLE)
+#warning "Implementation reserved __POSIX_VISIBLE defined by user see cdefs(9)"
+#endif
+
+#if defined(__XSI_VISIBLE)
+#warning "Implementation reserved __XSI_VISIBLE defined by user see cdefs(9)"
+#endif
+
+#if defined(__ISO_C_VISIBLE)
+#warning "Implementation reserved __ISO_C_VISIBLE defined by user see cdefs(9)"
+#endif
+
+#if defined(__ISO_C_VISIBLE)
+#warning "Implementation reserved __EXT1_VISIBLE defined by user see cdefs(9)"
+#endif
+
+/*
+ * TODO shurd@: This is the end of the exp-run chunk
+ */
+
/*-
* The following definitions are an extension of the behavior originally
* implemented in <sys/_posix.h>, but with a different level of granularity.

File Metadata

Mime Type
text/plain
Expires
Mon, Oct 27, 5:30 PM (6 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24306409
Default Alt Text
D49423.id152509.diff (11 KB)

Event Timeline