Rev 3869 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3869 | Rev 4348 | ||
---|---|---|---|
Line 100... | Line 100... | ||
100 | /* |
100 | /* |
101 | * If name contains slashes, treat it as a pathname and |
101 | * If name contains slashes, treat it as a pathname and |
102 | * construct soname by chopping off the path. Otherwise |
102 | * construct soname by chopping off the path. Otherwise |
103 | * treat it as soname. |
103 | * treat it as soname. |
104 | */ |
104 | */ |
105 | p = strrchr(name, '/'); |
105 | p = str_rchr(name, '/'); |
106 | soname = p ? (p + 1) : name; |
106 | soname = p ? (p + 1) : name; |
107 | 107 | ||
108 | /* Traverse list of all modules. Not extremely fast, but simple */ |
108 | /* Traverse list of all modules. Not extremely fast, but simple */ |
109 | for (cur = head->next; cur != head; cur = cur->next) { |
109 | for (cur = head->next; cur != head; cur = cur->next) { |
110 | m = list_get_instance(cur, module_t, modules_link); |
110 | m = list_get_instance(cur, module_t, modules_link); |
111 | if (strcmp(m->dyn.soname, soname) == 0) { |
111 | if (str_cmp(m->dyn.soname, soname) == 0) { |
112 | return m; /* Found */ |
112 | return m; /* Found */ |
113 | } |
113 | } |
114 | } |
114 | } |
115 | 115 | ||
116 | return NULL; /* Not found */ |
116 | return NULL; /* Not found */ |
Line 133... | Line 133... | ||
133 | if (!m) { |
133 | if (!m) { |
134 | printf("malloc failed\n"); |
134 | printf("malloc failed\n"); |
135 | exit(1); |
135 | exit(1); |
136 | } |
136 | } |
137 | 137 | ||
138 | if (strlen(name) > NAME_BUF_SIZE - 2) { |
138 | if (str_size(name) > NAME_BUF_SIZE - 2) { |
139 | printf("soname too long. increase NAME_BUF_SIZE\n"); |
139 | printf("soname too long. increase NAME_BUF_SIZE\n"); |
140 | exit(1); |
140 | exit(1); |
141 | } |
141 | } |
142 | 142 | ||
143 | /* Prepend soname with '/lib/' */ |
143 | /* Prepend soname with '/lib/' */ |
144 | name_buf[0] = '/'; |
- | |
145 | strcpy(name_buf, "/lib/"); |
144 | str_cpy(name_buf, NAME_BUF_SIZE, "/lib/"); |
146 | strcpy(name_buf + 5, name); |
145 | str_cpy(name_buf + 5, NAME_BUF_SIZE - 5, name); |
147 | 146 | ||
148 | /* FIXME: need to real allocation of address space */ |
147 | /* FIXME: need to real allocation of address space */ |
149 | m->bias = runtime_env->next_bias; |
148 | m->bias = runtime_env->next_bias; |
150 | runtime_env->next_bias += 0x100000; |
149 | runtime_env->next_bias += 0x100000; |
151 | 150 |