1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
9 * Description: functions for IPC support
17 * A POSIX IPC name must begin with a '/'.
18 * A POSIX IPC name on Solaris cannot contain any '/' except
19 * the required leading '/'.
20 * A POSIX IPC name on HP-UX must be a valid pathname
23 * The ftok() function for System V IPC requires a valid pathname
26 * A Win32 IPC name cannot contain '\'.
29 static void _pr_ConvertSemName(char *result
)
31 #ifdef _PR_HAVE_POSIX_SEMAPHORES
35 /* Convert '/' to '_' except for the leading '/' */
36 for (p
= result
+1; *p
; p
++) {
45 #elif defined(_PR_HAVE_SYSV_SEMAPHORES)
52 static void _pr_ConvertShmName(char *result
)
54 #if defined(PR_HAVE_POSIX_NAMED_SHARED_MEMORY)
58 /* Convert '/' to '_' except for the leading '/' */
59 for (p
= result
+1; *p
; p
++) {
68 #elif defined(PR_HAVE_SYSV_NAMED_SHARED_MEMORY)
77 PRStatus
_PR_MakeNativeIPCName(
83 if (strlen(name
) >= (PRSize
)size
) {
84 PR_SetError(PR_BUFFER_OVERFLOW_ERROR
, 0);
90 _pr_ConvertSemName(result
);
93 _pr_ConvertShmName(result
);
96 PR_SetError(PR_INVALID_ARGUMENT_ERROR
, 0);