From 45720098d5fa91d0eb2b95c480a3d3a2991d6770 Mon Sep 17 00:00:00 2001 From: daniel Date: Thu, 26 Mar 2026 21:46:24 +0000 Subject: [PATCH] shm_open(3): align the type of the mode_t parameter with POSIX POSIX says that sys/mman.h should also define mode_t which is currently missing. With mode_t defined there, the type of the last parameter of the shm_open function can be changed from __mode_t to mode_t, matching the standard. Both issues flagged by Sortix os-test. ok deraadt@, millert@ --- sys/sys/mman.h | 9 +++++++-- sys/sys/types.h | 8 ++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/sys/sys/mman.h b/sys/sys/mman.h index c36687f5d5e..f76d7e382cd 100644 --- a/sys/sys/mman.h +++ b/sys/sys/mman.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mman.h,v 1.35 2022/10/07 14:59:39 deraadt Exp $ */ +/* $OpenBSD: mman.h,v 1.36 2026/03/26 21:46:24 daniel Exp $ */ /* $NetBSD: mman.h,v 1.11 1995/03/26 20:24:23 jtc Exp $ */ /*- @@ -142,6 +142,11 @@ typedef __size_t size_t; typedef __off_t off_t; #endif +#ifndef _MODE_T_DEFINED_ +#define _MODE_T_DEFINED_ +typedef __mode_t mode_t; +#endif + __BEGIN_DECLS void * mmap(void *, size_t, int, int, int, off_t); int mprotect(void *, size_t, int); @@ -158,7 +163,7 @@ int mimmutable(void *, size_t); void * mquery(void *, size_t, int, int, int, off_t); #endif int posix_madvise(void *, size_t, int); -int shm_open(const char *, int, __mode_t); +int shm_open(const char *, int, mode_t); int shm_unlink(const char *); int shm_mkstemp(char *); __END_DECLS diff --git a/sys/sys/types.h b/sys/sys/types.h index 2207da9994f..d81d9eab3a4 100644 --- a/sys/sys/types.h +++ b/sys/sys/types.h @@ -1,4 +1,4 @@ -/* $OpenBSD: types.h,v 1.49 2022/08/06 13:31:13 semarie Exp $ */ +/* $OpenBSD: types.h,v 1.50 2026/03/26 21:46:24 daniel Exp $ */ /* $NetBSD: types.h,v 1.29 1996/11/15 22:48:25 jtc Exp $ */ /*- @@ -140,7 +140,6 @@ typedef __gid_t gid_t; /* group id */ typedef __id_t id_t; /* may contain pid, uid or gid */ typedef __ino_t ino_t; /* inode number */ typedef __key_t key_t; /* IPC key (for Sys V IPC) */ -typedef __mode_t mode_t; /* permissions */ typedef __nlink_t nlink_t; /* link count */ typedef __rlim_t rlim_t; /* resource limit */ typedef __segsz_t segsz_t; /* segment size */ @@ -193,6 +192,11 @@ typedef __timer_t timer_t; typedef __off_t off_t; #endif +#ifndef _MODE_T_DEFINED_ +#define _MODE_T_DEFINED_ +typedef __mode_t mode_t; /* permissions */ +#endif + /* * These belong in unistd.h, but are placed here too to ensure that * long arguments will be promoted to off_t if the program fails to