-.\" $OpenBSD: sigaltstack.2,v 1.27 2024/03/29 06:48:04 deraadt Exp $
+.\" $OpenBSD: sigaltstack.2,v 1.28 2024/06/22 17:19:05 deraadt Exp $
.\" $NetBSD: sigaltstack.2,v 1.3 1995/02/27 10:41:52 cgd Exp $
.\"
.\" Copyright (c) 1983, 1991, 1992, 1993
.\"
.\" @(#)sigaltstack.2 8.1 (Berkeley) 6/4/93
.\"
-.Dd $Mdocdate: March 29 2024 $
+.Dd $Mdocdate: June 22 2024 $
.Dt SIGALTSTACK 2
.Os
.Sh NAME
the usual case when allocating an alternate stack area.
The following code fragment is typically used to allocate an alternate stack.
.Bd -literal -offset indent
-if ((sigstk.ss_sp = malloc(SIGSTKSZ)) == NULL)
+if ((sigstk.ss_sp = mmap(NULL, SIGSTKSZ, PROT_READ|PROT_WRITE,
+ MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED)
/* error return */
sigstk.ss_size = SIGSTKSZ;
sigstk.ss_flags = 0;