master
1/***************************************************************************
2 * _ _ ____ _
3 * Project ___| | | | _ \| |
4 * / __| | | | |_) | |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
7 *
8 * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9 *
10 * This software is licensed as described in the file COPYING, which
11 * you should have received as part of this distribution. The terms
12 * are also available at https://curl.se/docs/copyright.html.
13 *
14 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 * copies of the Software, and permit persons to whom the Software is
16 * furnished to do so, under the terms of the COPYING file.
17 *
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
20 *
21 * SPDX-License-Identifier: curl
22 *
23 ***************************************************************************/
24/* File: curl_crtl_init.c
25 *
26 * This file makes sure that the DECC Unix settings are correct for
27 * the mode the program is run in.
28 *
29 * The CRTL has not been initialized at the time that these routines
30 * are called, so many routines can not be called.
31 *
32 * This is a module that provides a LIB$INITIALIZE routine that
33 * will turn on some CRTL features that are not enabled by default.
34 *
35 * The CRTL features can also be turned on via logical names, but that
36 * impacts all programs and some are not ready, willing, or able to handle
37 * those settings.
38 *
39 * On VMS versions that are too old to use the feature setting API, this
40 * module falls back to using logical names.
41 *
42 * Copyright (C) John Malmberg
43 *
44 * Permission to use, copy, modify, and/or distribute this software for any
45 * purpose with or without fee is hereby granted, provided that the above
46 * copyright notice and this permission notice appear in all copies.
47 *
48 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
49 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
50 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
51 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
52 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
53 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
54 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
55 *
56 */
58/* Unix headers */
59#include <stdio.h>
60#include <string.h>
62/* VMS specific headers */
63#include <descrip.h>
64#include <lnmdef.h>
65#include <stsdef.h>
67#pragma member_alignment save
68#pragma nomember_alignment longword
69#pragma message save
70#pragma message disable misalgndmem
71struct itmlst_3 {
72 unsigned short int buflen;
73 unsigned short int itmcode;
74 void *bufadr;
75 unsigned short int *retlen;
76};
77#pragma message restore
78#pragma member_alignment restore
80#ifdef __VAX
81#define ENABLE "ENABLE"
82#define DISABLE "DISABLE"
83#else
85#define ENABLE TRUE
86#define DISABLE 0
87int decc$feature_get_index(const char *name);
88int decc$feature_set_value(int index, int mode, int value);
89#endif
91int SYS$TRNLNM(const unsigned long *attr,
92 const struct dsc$descriptor_s *table_dsc,
93 struct dsc$descriptor_s *name_dsc,
94 const unsigned char *acmode,
95 const struct itmlst_3 *item_list);
96int SYS$CRELNM(const unsigned long *attr,
97 const struct dsc$descriptor_s *table_dsc,
98 const struct dsc$descriptor_s *name_dsc,
99 const unsigned char *acmode,
100 const struct itmlst_3 *item_list);
102/* Take all the fun out of looking up a logical name */
103static int sys_trnlnm(const char *logname, char *value, int value_len)
104{
105 const $DESCRIPTOR(table_dsc, "LNM$FILE_DEV");
106 const unsigned long attr = LNM$M_CASE_BLIND;
107 struct dsc$descriptor_s name_dsc;
108 int status;
109 unsigned short result;
110 struct itmlst_3 itlst[2];
112 itlst[0].buflen = value_len;
113 itlst[0].itmcode = LNM$_STRING;
114 itlst[0].bufadr = value;
115 itlst[0].retlen = &result;
117 itlst[1].buflen = 0;
118 itlst[1].itmcode = 0;
120 name_dsc.dsc$w_length = strlen(logname);
121 name_dsc.dsc$a_pointer = (char *)logname;
122 name_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
123 name_dsc.dsc$b_class = DSC$K_CLASS_S;
125 status = SYS$TRNLNM(&attr, &table_dsc, &name_dsc, 0, itlst);
127 if($VMS_STATUS_SUCCESS(status)) {
129 /* null-terminate and return the string */
130 /*--------------------------------------*/
131 value[result] = '\0';
132 }
134 return status;
135}
137/* How to create a logical name */
138static int sys_crelnm(const char *logname, const char *value)
139{
140 int ret_val;
141 const char *proc_table = "LNM$PROCESS_TABLE";
142 struct dsc$descriptor_s proc_table_dsc;
143 struct dsc$descriptor_s logname_dsc;
144 struct itmlst_3 item_list[2];
146 proc_table_dsc.dsc$a_pointer = (char *)proc_table;
147 proc_table_dsc.dsc$w_length = strlen(proc_table);
148 proc_table_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
149 proc_table_dsc.dsc$b_class = DSC$K_CLASS_S;
151 logname_dsc.dsc$a_pointer = (char *)logname;
152 logname_dsc.dsc$w_length = strlen(logname);
153 logname_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
154 logname_dsc.dsc$b_class = DSC$K_CLASS_S;
156 item_list[0].buflen = strlen(value);
157 item_list[0].itmcode = LNM$_STRING;
158 item_list[0].bufadr = (char *)value;
159 item_list[0].retlen = NULL;
161 item_list[1].buflen = 0;
162 item_list[1].itmcode = 0;
164 ret_val = SYS$CRELNM(NULL, &proc_table_dsc, &logname_dsc, NULL, item_list);
166 return ret_val;
167}
169/* Start of DECC RTL Feature handling */
171/* Sets default value for a feature */
172#ifdef __VAX
173static void set_feature_default(const char *name, const char *value)
174{
175 sys_crelnm(name, value);
176}
177#else
178static void set_feature_default(const char *name, int value)
179{
180 int index;
182 index = decc$feature_get_index(name);
184 if(index > 0)
185 decc$feature_set_value(index, 0, value);
186}
187#endif
189static void set_features(void)
190{
191 int status;
192 char unix_shell_name[255];
193 int use_unix_settings = 1;
195 status = sys_trnlnm("GNV$UNIX_SHELL",
196 unix_shell_name, sizeof(unix_shell_name) - 1);
197 if(!$VMS_STATUS_SUCCESS(status)) {
198 use_unix_settings = 0;
199 }
201 /* ACCESS should check ACLs or it is lying. */
202 set_feature_default("DECC$ACL_ACCESS_CHECK", ENABLE);
204 /* We always want the new parse style */
205 set_feature_default("DECC$ARGV_PARSE_STYLE", ENABLE);
207 /* Unless we are in POSIX compliant mode, we want the old POSIX root
208 * enabled.
209 */
210 set_feature_default("DECC$DISABLE_POSIX_ROOT", DISABLE);
212 /* EFS charset, means UTF-8 support */
213 /* VTF-7 support is controlled by a feature setting called UTF8 */
214 set_feature_default("DECC$EFS_CHARSET", ENABLE);
215 set_feature_default("DECC$EFS_CASE_PRESERVE", ENABLE);
217 /* Support timestamps when available */
218 set_feature_default("DECC$EFS_FILE_TIMESTAMPS", ENABLE);
220 /* Cache environment variables - performance improvements */
221 set_feature_default("DECC$ENABLE_GETENV_CACHE", ENABLE);
223 /* Start out with new file attribute inheritance */
224#ifdef __VAX
225 set_feature_default("DECC$EXEC_FILEATTR_INHERITANCE", "2");
226#else
227 set_feature_default("DECC$EXEC_FILEATTR_INHERITANCE", 2);
228#endif
230 /* Do not display trailing dot after files without type */
231 set_feature_default("DECC$READDIR_DROPDOTNOTYPE", ENABLE);
233 /* For standard output channels buffer output until terminator */
234 /* Gets rid of output logs with single character lines in them. */
235 set_feature_default("DECC$STDIO_CTX_EOL", ENABLE);
237 /* Fix mv aa.bb aa */
238 set_feature_default("DECC$RENAME_NO_INHERIT", ENABLE);
240 if(use_unix_settings) {
242 /* POSIX requires that open files be able to be removed */
243 set_feature_default("DECC$ALLOW_REMOVE_OPEN_FILES", ENABLE);
245 /* Default to outputting Unix filenames in VMS routines */
246 set_feature_default("DECC$FILENAME_UNIX_ONLY", ENABLE);
247 /* FILENAME_UNIX_ONLY Implicitly sets */
248 /* decc$disable_to_vms_logname_translation */
250 set_feature_default("DECC$FILE_PERMISSION_UNIX", ENABLE);
252 set_feature_default("DECC$FILE_SHARING", ENABLE);
254 set_feature_default("DECC$FILE_OWNER_UNIX", ENABLE);
255 set_feature_default("DECC$POSIX_SEEK_STREAM_FILE", ENABLE);
256 }
257 else {
258 set_feature_default("DECC$FILENAME_UNIX_REPORT", ENABLE);
259 }
261 /* When reporting Unix filenames, glob the same way */
262 set_feature_default("DECC$GLOB_UNIX_STYLE", ENABLE);
264 /* The VMS version numbers on Unix filenames is incompatible with most */
265 /* ported packages. */
266 set_feature_default("DECC$FILENAME_UNIX_NO_VERSION", ENABLE);
268 /* The VMS version numbers on Unix filenames is incompatible with most */
269 /* ported packages. */
270 set_feature_default("DECC$UNIX_PATH_BEFORE_LOGNAME", ENABLE);
272 /* Set strtol to proper behavior */
273 set_feature_default("DECC$STRTOL_ERANGE", ENABLE);
275 /* Commented here to prevent future bugs: A program or user should */
276 /* never ever enable DECC$POSIX_STYLE_UID. */
277 /* It will probably break all code that accesses UIDs */
278#if 0
279 do_not_set_default("DECC$POSIX_STYLE_UID", TRUE);
280#endif
281}
283/* Some boilerplate to force this to be a proper LIB$INITIALIZE section */
285#pragma nostandard
286#pragma extern_model save
287#ifdef __VAX
288#pragma extern_model strict_refdef "LIB$INITIALIZE" nowrt, long, nopic
289#else
290#pragma extern_model strict_refdef "LIB$INITIALIZE" nowrt, long
291# if __INITIAL_POINTER_SIZE
292# pragma __pointer_size __save
293# pragma __pointer_size 32
294# else
295# pragma __required_pointer_size __save
296# pragma __required_pointer_size 32
297# endif
298#endif
299/* Set our contribution to the LIB$INITIALIZE array */
300void (* const iniarray[])(void) = { set_features };
301#ifndef __VAX
302# if __INITIAL_POINTER_SIZE
303# pragma __pointer_size __restore
304# else
305# pragma __required_pointer_size __restore
306# endif
307#endif
309/*
310 * Force a reference to LIB$INITIALIZE to ensure it
311 * exists in the image.
312 */
313int LIB$INITIALIZE(void);
314#ifdef __DECC
315#pragma extern_model strict_refdef
316#endif
317int lib_init_ref = (int)LIB$INITIALIZE;
318#ifdef __DECC
319#pragma extern_model restore
320#pragma standard
321#endif
Diagnostics4 git calls · 31 ms
CallStatusSizeTime031 ms
discover200152 B3 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=2 git.response.bytes=152 git.server.agent=gitty/1.0 git.server.object_format=sha1 git.server.caps=agent ls-refs fetch object-format git.server.fetch=shallow filter sideband-all git.protocol.version=2 git.pkt.frames=8 git.pkt.data=6 git.pkt.flush=2 git.pkt.delim=0 git.pkt.bytes=152 git.pkt.payload.max=34
ls-refs200149 B · hit2 ms
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=2 git.response.bytes=149 git.response.cache=HIT git.response.duration_ms=2 git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=149 git.pkt.payload.max=78 git.ls_refs.count=2 git.ls_refs.head=refs/heads/master
fetchblob:none · deepen 10200287 KiB · hit2 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=26 git.response.bytes=293470 git.response.cache=HIT git.response.duration_ms=2 git.fetch.filter=blob:none git.fetch.filter.requested=tree:0 git.fetch.filter.fallback=blob:none git.fetch.filter.learned=false git.fetch.wants=31c911efe5652725e930f4d2e60c9060e5f6646d git.fetch.haves.count=0 git.fetch.deepen=10 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=10 git.pkt.data=8 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=293470 git.pkt.payload.max=65516 git.sideband.band1.bytes=293354 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=87 git.pack.bytes=293354 git.pack.ofs_delta=0 git.pack.ref_delta=1 git.pack.chain.max=1 git.pack.trailer=6a646bcda6740bab42e321b51998b52ea15146c0 git.pack.full=86Open pack map
fetch2003.7 KiB · hit26 ms
git.upload-pack fetch http.response.status_code=200 git.response.bytes=3822 git.response.cache=HIT git.response.duration_ms=26 git.fetch.wants=09c46dd03c38a2ec7546cbc73b02e320f6f40d08 git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=3822 git.pkt.payload.max=3801 git.sideband.band1.bytes=3800 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0
Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.
- Remote
- https://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/curl.git
- Ref
- refs/heads/master
- Commit
- 31c911efe5652725e930f4d2e60c9060e5f6646d
- cf-ray
- a5e33525c82df485
- Request
- 314671f3…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format