summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cpukit/posix/src/pthreadatfork.c13
-rw-r--r--testsuites/psxtests/psxenosys/init.c10
-rw-r--r--testsuites/psxtests/psxenosys/psxenosys.scn2
3 files changed, 14 insertions, 11 deletions
diff --git a/cpukit/posix/src/pthreadatfork.c b/cpukit/posix/src/pthreadatfork.c
index 1ee03a0111..27e6c725ea 100644
--- a/cpukit/posix/src/pthreadatfork.c
+++ b/cpukit/posix/src/pthreadatfork.c
@@ -8,7 +8,7 @@
*/
/*
- * COPYRIGHT (c) 1989-2007.
+ * COPYRIGHT (c) 1989-2007, 2022.
* On-Line Applications Research Corporation (OAR).
*
* Redistribution and use in source and binary forms, with or without
@@ -47,12 +47,8 @@
*
* 3.1.3 Register Fork Handlers, P1003.1c/Draft 10, P1003.1c/Draft 10, p. 27
*
- * RTEMS does not support processes, so we fall under this and do not
- * provide this routine:
- *
- * "Either the implementation shall support the pthread_atfork() function
- * as described above or the pthread_atfork() funciton shall not be
- * provided."
+ * RTEMS does not support processes and we follow the FACE Technical Standard
+ * recommendation to return 0 when multiple processes are not supported.
*/
int pthread_atfork(
void (*prepare)(void),
@@ -63,5 +59,6 @@ int pthread_atfork(
(void) prepare;
(void) parent;
(void) child;
- rtems_set_errno_and_return_minus_one( ENOSYS );
+
+ return 0;
}
diff --git a/testsuites/psxtests/psxenosys/init.c b/testsuites/psxtests/psxenosys/init.c
index 40f83aa0f0..d9a4d835f7 100644
--- a/testsuites/psxtests/psxenosys/init.c
+++ b/testsuites/psxtests/psxenosys/init.c
@@ -104,9 +104,15 @@ void *POSIX_Init(
sc = fork();
check_enosys( sc );
- puts( "pthread_atfork -- ENOSYS" );
+ /*
+ * The behavior of pthread_atfork() in single process environments was
+ * undefined by POSIX but the fACE Technical Standard required returning
+ * 0. Before ticket #4713, this did return ENOSYS. Just leaving this test
+ * case here for convenience.
+ */
+ puts( "pthread_atfork -- 0" );
sc = pthread_atfork( NULL, NULL, NULL );
- check_enosys( sc );
+ rtems_test_assert( !sc );
puts( "pthread_getcpuclockid -- ENOSYS" );
sc = pthread_getcpuclockid( 0, NULL );
diff --git a/testsuites/psxtests/psxenosys/psxenosys.scn b/testsuites/psxtests/psxenosys/psxenosys.scn
index 1ed64f92e9..9e88acd05a 100644
--- a/testsuites/psxtests/psxenosys/psxenosys.scn
+++ b/testsuites/psxtests/psxenosys/psxenosys.scn
@@ -9,7 +9,7 @@ execv -- ENOSYS
execve -- ENOSYS
execvp -- ENOSYS
fork -- ENOSYS
-pthread_atfork -- ENOSYS
+pthread_atfork -- 0
pthread_getcpuclockid -- ENOSYS
sched_setparam -- ENOSYS
sched_getparam -- ENOSYS