Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(439)

Side by Side Diff: nspr/pr/src/misc/pripc.c

Issue 2078763002: Delete bundled copy of NSS and replace with README. (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/nss@master
Patch Set: Delete bundled copy of NSS and replace with README. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « nspr/pr/src/misc/prinrval.c ('k') | nspr/pr/src/misc/pripcsem.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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/. */
5
6 /*
7 * File: pripc.c
8 *
9 * Description: functions for IPC support
10 */
11
12 #include "primpl.h"
13
14 #include <string.h>
15
16 /*
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 and OSF1 must be a valid pathname
21 * in the file system.
22 *
23 * The ftok() function for System V IPC requires a valid pathname
24 * in the file system.
25 *
26 * A Win32 IPC name cannot contain '\'.
27 */
28
29 static void _pr_ConvertSemName(char *result)
30 {
31 #ifdef _PR_HAVE_POSIX_SEMAPHORES
32 #if defined(SOLARIS)
33 char *p;
34
35 /* Convert '/' to '_' except for the leading '/' */
36 for (p = result+1; *p; p++) {
37 if (*p == '/') {
38 *p = '_';
39 }
40 }
41 return;
42 #else
43 return;
44 #endif
45 #elif defined(_PR_HAVE_SYSV_SEMAPHORES)
46 return;
47 #elif defined(WIN32)
48 return;
49 #endif
50 }
51
52 static void _pr_ConvertShmName(char *result)
53 {
54 #if defined(PR_HAVE_POSIX_NAMED_SHARED_MEMORY)
55 #if defined(SOLARIS)
56 char *p;
57
58 /* Convert '/' to '_' except for the leading '/' */
59 for (p = result+1; *p; p++) {
60 if (*p == '/') {
61 *p = '_';
62 }
63 }
64 return;
65 #else
66 return;
67 #endif
68 #elif defined(PR_HAVE_SYSV_NAMED_SHARED_MEMORY)
69 return;
70 #elif defined(WIN32)
71 return;
72 #else
73 return;
74 #endif
75 }
76
77 PRStatus _PR_MakeNativeIPCName(
78 const char *name,
79 char *result,
80 PRIntn size,
81 _PRIPCType type)
82 {
83 if (strlen(name) >= (PRSize)size) {
84 PR_SetError(PR_BUFFER_OVERFLOW_ERROR, 0);
85 return PR_FAILURE;
86 }
87 strcpy(result, name);
88 switch (type) {
89 case _PRIPCSem:
90 _pr_ConvertSemName(result);
91 break;
92 case _PRIPCShm:
93 _pr_ConvertShmName(result);
94 break;
95 default:
96 PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
97 return PR_FAILURE;
98 }
99 return PR_SUCCESS;
100 }
OLDNEW
« no previous file with comments | « nspr/pr/src/misc/prinrval.c ('k') | nspr/pr/src/misc/pripcsem.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698