Print this page
make: remove SCCS ident stuff
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/make/lib/makestate/src/ld_file.c
+++ new/usr/src/cmd/make/lib/makestate/src/ld_file.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
↓ open down ↓ |
14 lines elided |
↑ open up ↑ |
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 1998 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 24 */
25 -/*
26 - * @(#)ld_file.c 1.7 06/12/12
27 - */
28 -#pragma ident "@(#)ld_file.c 1.7 06/12/12"
29 25
30 26 #pragma init(ld_support_init)
31 27
32 28 #include <stdio.h>
33 29 #include <unistd.h>
34 30 #include <stdlib.h>
35 31 #include <string.h>
36 32 #include <libelf.h>
37 33 #include <sys/param.h>
38 34 #include <link.h>
39 35
40 36 #define SUNPRO_DEPENDENCIES "SUNPRO_DEPENDENCIES"
41 37
42 38 /*
43 39 * Linked list of strings - used to keep lists of names
44 40 * of directories or files.
45 41 */
46 42
47 43 struct Stritem {
48 44 char * str;
49 45 void * next;
50 46 };
51 47
52 48 typedef struct Stritem Stritem;
53 49
54 50 static char * depend_file = NULL;
55 51 static Stritem * list = NULL;
56 52
57 53
58 54 void mk_state_init()
59 55 {
60 56 depend_file = getenv(SUNPRO_DEPENDENCIES);
61 57 } /* mk_state_init() */
62 58
63 59
64 60
65 61 static void
66 62 prepend_str(Stritem **list, const char * str)
67 63 {
68 64 Stritem * new;
69 65 char * newstr;
70 66
71 67 if (!(new = calloc(1, sizeof (Stritem)))) {
72 68 perror("libmakestate.so");
73 69 return;
74 70 } /* if */
75 71
76 72 if (!(newstr = malloc(strlen(str) + 1))) {
77 73 perror("libmakestate.so");
78 74 return;
79 75 } /* if */
80 76
81 77 new->str = strcpy(newstr, str);
82 78 new->next = *list;
83 79 *list = new;
84 80
85 81 } /* prepend_str() */
86 82
87 83
88 84 void
89 85 mk_state_collect_dep(const char * file)
90 86 {
91 87 /*
92 88 * SUNPRO_DEPENDENCIES wasn't set, we don't collect .make.state
93 89 * information.
94 90 */
95 91 if (!depend_file)
96 92 return;
97 93
98 94 prepend_str(&list, file);
99 95
100 96 } /* mk_state_collect_dep() */
101 97
102 98
103 99 void
104 100 mk_state_update_exit()
105 101 {
106 102 Stritem * cur;
107 103 char lockfile[MAXPATHLEN], * err, * space, * target;
108 104 FILE * ofp;
109 105 extern char * file_lock(char *, char *, int);
110 106
111 107 if (!depend_file)
112 108 return;
113 109
114 110 if ((space = strchr(depend_file, ' ')) == NULL)
115 111 return;
116 112 *space = '\0';
117 113 target = &space[1];
118 114
119 115 (void) sprintf(lockfile, "%s.lock", depend_file);
120 116 if ((err = file_lock(depend_file, lockfile, 0))) {
121 117 (void) fprintf(stderr, "%s\n", err);
122 118 return;
123 119 } /* if */
124 120
125 121 if (!(ofp = fopen(depend_file, "a")))
126 122 return;
127 123
128 124 if (list)
129 125 (void) fprintf(ofp, "%s: ", target);
130 126
131 127 for (cur = list; cur; cur = cur->next)
132 128 (void) fprintf(ofp, " %s", cur->str);
133 129
134 130 (void) fputc('\n', ofp);
135 131
136 132 (void) fclose(ofp);
137 133 (void) unlink(lockfile);
138 134 *space = ' ';
139 135
140 136 } /* mk_state_update_exit() */
141 137
142 138 static void
143 139 /* LINTED static unused */
144 140 ld_support_init()
145 141 {
146 142 mk_state_init();
147 143
148 144 } /* ld_support_init() */
149 145
150 146 /* ARGSUSED */
151 147 void
152 148 ld_file(const char * file, const Elf_Kind ekind, int flags, Elf *elf)
153 149 {
154 150 if(! ((flags & LD_SUP_DERIVED) && !(flags & LD_SUP_EXTRACTED)))
155 151 return;
↓ open down ↓ |
117 lines elided |
↑ open up ↑ |
156 152
157 153 mk_state_collect_dep(file);
158 154
159 155 } /* ld_file */
160 156
161 157 void
162 158 ld_atexit(int exit_code)
163 159 {
164 160 if (exit_code)
165 161 return;
166 -
162 +
167 163 mk_state_update_exit();
168 164
169 165 } /* ld_atexit() */
170 166
171 167 /*
172 168 * Supporting 64-bit objects
173 169 */
174 170 void
175 171 ld_file64(const char * file, const Elf_Kind ekind, int flags, Elf *elf)
176 172 {
177 173 if(! ((flags & LD_SUP_DERIVED) && !(flags & LD_SUP_EXTRACTED)))
178 174 return;
↓ open down ↓ |
2 lines elided |
↑ open up ↑ |
179 175
180 176 mk_state_collect_dep(file);
181 177
182 178 } /* ld_file64 */
183 179
184 180 void
185 181 ld_atexit64(int exit_code)
186 182 {
187 183 if (exit_code)
188 184 return;
189 -
185 +
190 186 mk_state_update_exit();
191 187
192 188 } /* ld_atexit64() */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX