diff options
Diffstat (limited to 'libc')
170 files changed, 817 insertions, 788 deletions
diff --git a/libc/inet/addr.c b/libc/inet/addr.c index 35b590073..a03b7575b 100644 --- a/libc/inet/addr.c +++ b/libc/inet/addr.c @@ -146,7 +146,7 @@ char *inet_ntoa(struct in_addr in) * Formulate an Internet address from network + host. Used in * building addresses stored in the ifnet structure. */ -struct in_addr inet_makeaddr(in_addr_t net, in_addr_t host) +struct in_addr attribute_hidden __inet_makeaddr(in_addr_t net, in_addr_t host) { in_addr_t addr; @@ -161,6 +161,7 @@ struct in_addr inet_makeaddr(in_addr_t net, in_addr_t host) addr = htonl(addr); return (*(struct in_addr *)&addr); } +strong_alias(__inet_makeaddr,inet_makeaddr) #endif diff --git a/libc/inet/getaddrinfo.c b/libc/inet/getaddrinfo.c index 228e04f97..d2d0e151e 100644 --- a/libc/inet/getaddrinfo.c +++ b/libc/inet/getaddrinfo.c @@ -44,7 +44,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* This software is Copyright 1996 by Craig Metz, All Rights Reserved. */ +/* strdupa is using these */ +#if 0 #define memcpy __memcpy +#define strlen __strlen +#endif #define _GNU_SOURCE #define __FORCE_GLIBC @@ -151,7 +155,7 @@ static int addrconfig (sa_family_t af) ret = (errno == EMFILE) ? 1 : 0; else { - close(s); + __close(s); ret = 1; } __set_errno (saved_errno); @@ -175,10 +179,10 @@ gaih_local (const char *name, const struct gaih_service *service, if (name != NULL) { - if (strcmp(name, "localhost") && - strcmp(name, "local") && - strcmp(name, "unix") && - strcmp(name, utsname.nodename)) + if (__strcmp(name, "localhost") && + __strcmp(name, "local") && + __strcmp(name, "unix") && + __strcmp(name, utsname.nodename)) return GAIH_OKIFUNSPEC | -EAI_NONAME; } @@ -205,7 +209,7 @@ gaih_local (const char *name, const struct gaih_service *service, *pai = malloc (sizeof (struct addrinfo) + sizeof (struct sockaddr_un) + ((req->ai_flags & AI_CANONNAME) - ? (strlen(utsname.nodename) + 1): 0)); + ? (__strlen(utsname.nodename) + 1): 0)); if (*pai == NULL) return -EAI_MEMORY; @@ -223,22 +227,22 @@ gaih_local (const char *name, const struct gaih_service *service, #endif /* SALEN */ ((struct sockaddr_un *)(*pai)->ai_addr)->sun_family = AF_LOCAL; - memset(((struct sockaddr_un *)(*pai)->ai_addr)->sun_path, 0, UNIX_PATH_MAX); + __memset(((struct sockaddr_un *)(*pai)->ai_addr)->sun_path, 0, UNIX_PATH_MAX); if (service) { struct sockaddr_un *sunp = (struct sockaddr_un *) (*pai)->ai_addr; - if (strchr (service->name, '/') != NULL) + if (__strchr (service->name, '/') != NULL) { - if (strlen (service->name) >= sizeof (sunp->sun_path)) + if (__strlen (service->name) >= sizeof (sunp->sun_path)) return GAIH_OKIFUNSPEC | -EAI_SERVICE; - strcpy (sunp->sun_path, service->name); + __strcpy (sunp->sun_path, service->name); } else { - if (strlen (P_tmpdir "/") + 1 + strlen (service->name) >= + if (__strlen (P_tmpdir "/") + 1 + __strlen (service->name) >= sizeof (sunp->sun_path)) return GAIH_OKIFUNSPEC | -EAI_SERVICE; @@ -260,7 +264,7 @@ gaih_local (const char *name, const struct gaih_service *service, } if (req->ai_flags & AI_CANONNAME) - (*pai)->ai_canonname = strcpy ((char *) *pai + sizeof (struct addrinfo) + (*pai)->ai_canonname = __strcpy ((char *) *pai + sizeof (struct addrinfo) + sizeof (struct sockaddr_un), utsname.nodename); else @@ -340,7 +344,7 @@ gaih_inet_serv (const char *servicename, const struct gaih_typeproto *tp, } \ (*pat)->next = NULL; \ (*pat)->family = _family; \ - memcpy ((*pat)->addr, h->h_addr_list[i], \ + __memcpy ((*pat)->addr, h->h_addr_list[i], \ sizeof(_type)); \ pat = &((*pat)->next); \ } \ @@ -491,7 +495,7 @@ gaih_inet (const char *name, const struct gaih_service *service, char *namebuf = strdupa (name); char *scope_delim; - scope_delim = strchr (namebuf, SCOPE_DELIMITER); + scope_delim = __strchr (namebuf, SCOPE_DELIMITER); if (scope_delim != NULL) *scope_delim = '\0'; @@ -574,12 +578,12 @@ gaih_inet (const char *name, const struct gaih_service *service, { struct gaih_addrtuple *atr; atr = at = alloca (sizeof (struct gaih_addrtuple)); - memset (at, '\0', sizeof (struct gaih_addrtuple)); + __memset (at, '\0', sizeof (struct gaih_addrtuple)); if (req->ai_family == 0) { at->next = alloca (sizeof (struct gaih_addrtuple)); - memset (at->next, '\0', sizeof (struct gaih_addrtuple)); + __memset (at->next, '\0', sizeof (struct gaih_addrtuple)); } #if __UCLIBC_HAS_IPV6__ @@ -588,7 +592,7 @@ gaih_inet (const char *name, const struct gaih_service *service, extern const struct in6_addr __in6addr_loopback; at->family = AF_INET6; if ((req->ai_flags & AI_PASSIVE) == 0) - memcpy (at->addr, &__in6addr_loopback, sizeof (struct in6_addr)); + __memcpy (at->addr, &__in6addr_loopback, sizeof (struct in6_addr)); atr = at->next; } #endif @@ -660,7 +664,7 @@ gaih_inet (const char *name, const struct gaih_service *service, if (c == NULL) return GAIH_OKIFUNSPEC | -EAI_NONAME; - namelen = strlen (c) + 1; + namelen = __strlen (c) + 1; } else namelen = 0; @@ -704,7 +708,7 @@ gaih_inet (const char *name, const struct gaih_service *service, sin6p->sin6_flowinfo = 0; if (at2->family == AF_INET6) { - memcpy (&sin6p->sin6_addr, + __memcpy (&sin6p->sin6_addr, at2->addr, sizeof (struct in6_addr)); } else @@ -712,7 +716,7 @@ gaih_inet (const char *name, const struct gaih_service *service, sin6p->sin6_addr.s6_addr32[0] = 0; sin6p->sin6_addr.s6_addr32[1] = 0; sin6p->sin6_addr.s6_addr32[2] = htonl(0x0000ffff); - memcpy(&sin6p->sin6_addr.s6_addr32[3], + __memcpy(&sin6p->sin6_addr.s6_addr32[3], at2->addr, sizeof (sin6p->sin6_addr.s6_addr32[3])); } sin6p->sin6_port = st2->port; @@ -724,17 +728,17 @@ gaih_inet (const char *name, const struct gaih_service *service, struct sockaddr_in *sinp = (struct sockaddr_in *) (*pai)->ai_addr; - memcpy (&sinp->sin_addr, + __memcpy (&sinp->sin_addr, at2->addr, sizeof (struct in_addr)); sinp->sin_port = st2->port; - memset (sinp->sin_zero, '\0', sizeof (sinp->sin_zero)); + __memset (sinp->sin_zero, '\0', sizeof (sinp->sin_zero)); } if (c) { (*pai)->ai_canonname = ((void *) (*pai) + sizeof (struct addrinfo) + socklen); - strcpy ((*pai)->ai_canonname, c); + __strcpy ((*pai)->ai_canonname, c); } else (*pai)->ai_canonname = NULL; diff --git a/libc/inet/getnetbynm.c b/libc/inet/getnetbynm.c index 456c337c1..5479c654b 100644 --- a/libc/inet/getnetbynm.c +++ b/libc/inet/getnetbynm.c @@ -30,10 +30,10 @@ getnetbyname(const char *name) setnetent(_net_stayopen); while ((p = getnetent())) { - if (strcmp(p->n_name, name) == 0) + if (__strcmp(p->n_name, name) == 0) break; for (cp = p->n_aliases; *cp != 0; cp++) - if (strcmp(*cp, name) == 0) + if (__strcmp(*cp, name) == 0) goto found; } found: diff --git a/libc/inet/getproto.c b/libc/inet/getproto.c index 85b9fc26f..e7221f3a2 100644 --- a/libc/inet/getproto.c +++ b/libc/inet/getproto.c @@ -213,10 +213,10 @@ int getprotobyname_r(const char *name, LOCK; setprotoent(proto_stayopen); while (!(ret=getprotoent_r(result_buf, buf, buflen, result))) { - if (strcmp(result_buf->p_name, name) == 0) + if (__strcmp(result_buf->p_name, name) == 0) break; for (cp = result_buf->p_aliases; *cp != 0; cp++) - if (strcmp(*cp, name) == 0) + if (__strcmp(*cp, name) == 0) goto found; } found: diff --git a/libc/inet/getservice.c b/libc/inet/getservice.c index a8279e4db..d5402ba3e 100644 --- a/libc/inet/getservice.c +++ b/libc/inet/getservice.c @@ -239,14 +239,14 @@ int getservbyname_r(const char *name, const char *proto, LOCK; setservent(serv_stayopen); while (!(ret=getservent_r(result_buf, buf, buflen, result))) { - if (strcmp(name, result_buf->s_name) == 0) + if (__strcmp(name, result_buf->s_name) == 0) goto gotname; for (cp = result_buf->s_aliases; *cp; cp++) - if (strcmp(name, *cp) == 0) + if (__strcmp(name, *cp) == 0) goto gotname; continue; gotname: - if (proto == 0 || strcmp(result_buf->s_proto, proto) == 0) + if (proto == 0 || __strcmp(result_buf->s_proto, proto) == 0) break; } if (!serv_stayopen) @@ -266,7 +266,7 @@ int getservbyport_r(int port, const char *proto, while (!(ret=getservent_r(result_buf, buf, buflen, result))) { if (result_buf->s_port != port) continue; - if (proto == 0 || strcmp(result_buf->s_proto, proto) == 0) + if (proto == 0 || __strcmp(result_buf->s_proto, proto) == 0) break; } if (!serv_stayopen) diff --git a/libc/inet/hostid.c b/libc/inet/hostid.c index e90cf256c..be3bacb96 100644 --- a/libc/inet/hostid.c +++ b/libc/inet/hostid.c @@ -18,10 +18,10 @@ int sethostid(long int new_id) int ret; if (geteuid() || getuid()) return __set_errno(EPERM); - if ((fd=open(HOSTID,O_CREAT|O_WRONLY,0644))<0) return -1; - ret = write(fd,(void *)&new_id,sizeof(new_id)) == sizeof(new_id) + if ((fd=__open(HOSTID,O_CREAT|O_WRONLY,0644))<0) return -1; + ret = __write(fd,(void *)&new_id,sizeof(new_id)) == sizeof(new_id) ? 0 : -1; - close (fd); + __close (fd); return ret; } @@ -34,12 +34,12 @@ long int gethostid(void) * It is not an error if we cannot read this file. It is not even an * error if we cannot read all the bytes, we just carry on trying... */ - if ((fd=open(HOSTID,O_RDONLY))>=0 && read(fd,(void *)&id,sizeof(id))) + if ((fd=__open(HOSTID,O_RDONLY))>=0 && __read(fd,(void *)&id,sizeof(id))) { - close (fd); + __close (fd); return id; } - if (fd >= 0) close (fd); + if (fd >= 0) __close (fd); /* Try some methods of returning a unique 32 bit id. Clearly IP * numbers, if on the internet, will have a unique address. If they @@ -65,7 +65,7 @@ long int gethostid(void) */ return 0; else { - memcpy((char *) &in, (char *) hp->h_addr, hp->h_length); + __memcpy((char *) &in, (char *) hp->h_addr, hp->h_length); /* Just so it doesn't look exactly like the IP addr */ return(in.s_addr<<16|in.s_addr>>16); diff --git a/libc/inet/if_nametoindex.c b/libc/inet/if_nametoindex.c index 45b319f97..0e556dba8 100644 --- a/libc/inet/if_nametoindex.c +++ b/libc/inet/if_nametoindex.c @@ -51,15 +51,15 @@ unsigned int if_nametoindex(const char* ifname) fd = __opensock(); if (fd < 0) return 0; - strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name)); + __strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name)); if (ioctl(fd,SIOCGIFINDEX,&ifr) < 0) { int saved_errno = errno; - close(fd); + __close(fd); if (saved_errno == EINVAL) __set_errno(ENOSYS); return 0; } - close(fd); + __close(fd); return ifr.ifr_ifindex; #endif /* SIOCGIFINDEX */ @@ -103,7 +103,7 @@ struct if_nameindex * if_nameindex (void) do { ifc.ifc_buf = realloc(ifc.ifc_buf, ifc.ifc_len = rq_len); if (ifc.ifc_buf == NULL || ioctl(fd, SIOCGIFCONF, &ifc) < 0) { - close(fd); + __close(fd); return NULL; } rq_len *= 2; @@ -113,21 +113,21 @@ struct if_nameindex * if_nameindex (void) idx = malloc ((nifs + 1) * sizeof(struct if_nameindex)); if (idx == NULL) { - close(fd); + __close(fd); __set_errno(ENOBUFS); return NULL; } for (i = 0; i < nifs; ++i) { struct ifreq *ifr = &ifc.ifc_req[i]; - idx[i].if_name = strdup (ifr->ifr_name); + idx[i].if_name = __strdup (ifr->ifr_name); if (idx[i].if_name == NULL || ioctl(fd,SIOCGIFINDEX,ifr) < 0) { int saved_errno = errno; unsigned int j; for (j = 0; j < i; ++j) free (idx[j].if_name); free(idx); - close(fd); + __close(fd); if (saved_errno == EINVAL) saved_errno = ENOSYS; else if (saved_errno == ENOMEM) @@ -141,7 +141,7 @@ struct if_nameindex * if_nameindex (void) idx[i].if_index = 0; idx[i].if_name = NULL; - close(fd); + __close(fd); return idx; #endif } @@ -161,13 +161,13 @@ char * if_indextoname (unsigned int ifindex, char *ifname) ifr.ifr_ifindex = ifindex; if (ioctl (fd, SIOCGIFNAME, &ifr) < 0) { saved_errno = errno; - close (fd); + __close (fd); __set_errno (saved_errno); return NULL; } - close (fd); + __close (fd); - return strncpy (ifname, ifr.ifr_name, IFNAMSIZ); + return __strncpy (ifname, ifr.ifr_name, IFNAMSIZ); #else struct if_nameindex *idx; struct if_nameindex *p; @@ -177,7 +177,7 @@ char * if_indextoname (unsigned int ifindex, char *ifname) if (idx != NULL) { for (p = idx; p->if_index || p->if_name; ++p) { if (p->if_index == ifindex) { - result = strncpy (ifname, p->if_name, IFNAMSIZ); + result = __strncpy (ifname, p->if_name, IFNAMSIZ); break; } } diff --git a/libc/inet/ntop.c b/libc/inet/ntop.c index 3a9f5f477..65ff1842b 100644 --- a/libc/inet/ntop.c +++ b/libc/inet/ntop.c @@ -15,8 +15,6 @@ * SOFTWARE. */ -#define memmove __memmove - #define __FORCE_GLIBC #include <features.h> #include <sys/param.h> @@ -78,12 +76,12 @@ inet_ntop4(const u_char *src, char *dst, size_t size) } tmp[i - 1] = '\0'; - if (strlen (tmp) > size) { + if (__strlen (tmp) > size) { __set_errno (ENOSPC); return (NULL); } - return strcpy(dst, tmp); + return __strcpy(dst, tmp); } @@ -116,7 +114,7 @@ inet_ntop6(const u_char *src, char *dst, size_t size) * Copy the input (bytewise) array into a wordwise array. * Find the longest run of 0x00's in src[] for :: shorthanding. */ - memset(words, '\0', sizeof words); + __memset(words, '\0', sizeof words); for (i = 0; i < 16; i += 2) words[i / 2] = (src[i] << 8) | src[i + 1]; best.base = -1; @@ -162,7 +160,7 @@ inet_ntop6(const u_char *src, char *dst, size_t size) (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) { if (!inet_ntop4(src+12, tp, sizeof tmp - (tp - tmp))) return (NULL); - tp += strlen(tp); + tp += __strlen(tp); break; } tp += sprintf(tp, "%x", words[i]); @@ -179,7 +177,7 @@ inet_ntop6(const u_char *src, char *dst, size_t size) __set_errno (ENOSPC); return (NULL); } - return strcpy(dst, tmp); + return __strcpy(dst, tmp); } #endif /* __UCLIBC_HAS_IPV6__ */ @@ -226,7 +224,7 @@ inet_pton4(const char *src, u_char *dst) } if (octets < 4) return (0); - memcpy(dst, tmp, 4); + __memcpy(dst, tmp, 4); return (1); } @@ -263,7 +261,7 @@ inet_pton6(const char *src, u_char *dst) u_int val; - tp = memset(tmp, '\0', 16); + tp = __memset(tmp, '\0', 16); endp = tp + 16; colonp = NULL; /* Leading :: requires some special handling. */ @@ -276,7 +274,7 @@ inet_pton6(const char *src, u_char *dst) while ((ch = tolower (*src++)) != '\0') { const char *pch; - pch = strchr(xdigits, ch); + pch = __strchr(xdigits, ch); if (pch != NULL) { val <<= 4; val |= (pch - xdigits); @@ -335,7 +333,7 @@ inet_pton6(const char *src, u_char *dst) } if (tp != endp) return (0); - memcpy(dst, tmp, 16); + __memcpy(dst, tmp, 16); return (1); } diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c index 0fee6a597..3313bfc85 100644 --- a/libc/inet/resolv.c +++ b/libc/inet/resolv.c @@ -133,7 +133,6 @@ * */ -#define memmove __memmove #define strnlen __strnlen #define strncat __strncat #define strstr __strstr @@ -342,14 +341,14 @@ int attribute_hidden __encode_dotted(const char *dotted, unsigned char *dest, in int used = 0; while (dotted && *dotted) { - char *c = strchr(dotted, '.'); - int l = c ? c - dotted : strlen(dotted); + char *c = __strchr(dotted, '.'); + int l = c ? c - dotted : __strlen(dotted); if (l >= (maxlen - used - 1)) return -1; dest[used++] = l; - memcpy(dest + used, dotted, l); + __memcpy(dest + used, dotted, l); used += l; if (c) @@ -397,7 +396,7 @@ int attribute_hidden __decode_dotted(const unsigned char *data, int offset, if ((used + l + 1) >= maxlen) return -1; - memcpy(dest + used, data + offset, l); + __memcpy(dest + used, data + offset, l); offset += l; used += l; if (measure) @@ -482,7 +481,7 @@ int __decode_question(unsigned char *message, int offset, offset += i; - q->dotted = strdup(temp); + q->dotted = __strdup(temp); q->qtype = (message[offset + 0] << 8) | message[offset + 1]; q->qclass = (message[offset + 2] << 8) | message[offset + 3]; @@ -528,7 +527,7 @@ int attribute_hidden __encode_answer(struct resolv_answer *a, unsigned char *des *dest++ = (a->ttl & 0x000000ff) >> 0; *dest++ = (a->rdlength & 0xff00) >> 8; *dest++ = (a->rdlength & 0x00ff) >> 0; - memcpy(dest, a->rdata, a->rdlength); + __memcpy(dest, a->rdata, a->rdlength); return i + RRFIXEDSZ + a->rdlength; } @@ -547,7 +546,7 @@ int attribute_hidden __decode_answer(unsigned char *message, int offset, message += offset + i; - a->dotted = strdup(temp); + a->dotted = __strdup(temp); a->atype = (message[0] << 8) | message[1]; message += 2; a->aclass = (message[0] << 8) | message[1]; @@ -638,7 +637,7 @@ int __form_query(int id, const char *name, int type, unsigned char *packet, struct resolv_question q; int i, j; - memset(&h, 0, sizeof(h)); + __memset(&h, 0, sizeof(h)); h.id = id; h.qdcount = 1; @@ -714,11 +713,11 @@ int attribute_hidden __dns_lookup(const char *name, int type, int nscount, char while (retries < MAX_RETRIES) { if (fd != -1) - close(fd); + __close(fd); - memset(packet, 0, PACKETSZ); + __memset(packet, 0, PACKETSZ); - memset(&h, 0, sizeof(h)); + __memset(&h, 0, sizeof(h)); ++local_id; local_id &= 0xffff; @@ -734,7 +733,7 @@ int attribute_hidden __dns_lookup(const char *name, int type, int nscount, char if (i < 0) goto fail; - strncpy(lookup,name,MAXDNAME); + __strncpy(lookup,name,MAXDNAME); if (variant >= 0) { BIGLOCK; if (variant < __searchdomains) { @@ -865,7 +864,7 @@ int attribute_hidden __dns_lookup(const char *name, int type, int nscount, char ma.buf = a->buf; ma.buflen = a->buflen; ma.add_count = a->add_count; - memcpy(a, &ma, sizeof(ma)); + __memcpy(a, &ma, sizeof(ma)); if (a->atype != T_SIG && (0 == a->buf || (type != T_A && type != T_AAAA))) { break; @@ -897,7 +896,7 @@ int attribute_hidden __dns_lookup(const char *name, int type, int nscount, char ma.rdlength, a->rdlength); goto again; } - memcpy(a->buf + (a->add_count * ma.rdlength), ma.rdata, ma.rdlength); + __memcpy(a->buf + (a->add_count * ma.rdlength), ma.rdata, ma.rdlength); ++a->add_count; } } @@ -905,7 +904,7 @@ int attribute_hidden __dns_lookup(const char *name, int type, int nscount, char DPRINTF("Answer name = |%s|\n", a->dotted); DPRINTF("Answer type = |%d|\n", a->atype); - close(fd); + __close(fd); if (outpacket) *outpacket = packet; @@ -957,7 +956,7 @@ int attribute_hidden __dns_lookup(const char *name, int type, int nscount, char fail: if (fd != -1) - close(fd); + __close(fd); if (lookup) free(lookup); if (packet) @@ -1022,21 +1021,21 @@ int attribute_hidden __open_nameservers() *p++ = '\0'; } - if (strcmp(argv[0], "nameserver") == 0) { + if (__strcmp(argv[0], "nameserver") == 0) { for (i = 1; i < argc && __nameservers < MAX_SERVERS; i++) { - __nameserver[__nameservers++] = strdup(argv[i]); + __nameserver[__nameservers++] = __strdup(argv[i]); DPRINTF("adding nameserver %s\n", argv[i]); } } /* domain and search are mutually exclusive, the last one wins */ - if (strcmp(argv[0],"domain")==0 || strcmp(argv[0],"search")==0) { + if (__strcmp(argv[0],"domain")==0 || __strcmp(argv[0],"search")==0) { while (__searchdomains > 0) { free(__searchdomain[--__searchdomains]); __searchdomain[__searchdomains] = NULL; } for (i=1; i < argc && __searchdomains < MAX_SEARCH; i++) { - __searchdomain[__searchdomains++] = strdup(argv[i]); + __searchdomain[__searchdomains++] = __strdup(argv[i]); DPRINTF("adding search %s\n", argv[i]); } } @@ -1187,7 +1186,7 @@ int res_query(const char *dname, int class, int type, return(-1); } - memset((char *) &a, '\0', sizeof(a)); + __memset((char *) &a, '\0', sizeof(a)); BIGLOCK; __nameserversXX=__nameservers; @@ -1204,7 +1203,7 @@ int res_query(const char *dname, int class, int type, if (a.atype == type) { /* CNAME*/ int len = MIN(anslen, i); - memcpy(answer, packet, len); + __memcpy(answer, packet, len); if (packet) free(packet); return(len); @@ -1380,19 +1379,19 @@ int res_querydomain(name, domain, class, type, answer, anslen) * Check for trailing '.'; * copy without '.' if present. */ - n = strlen(name); + n = __strlen(name); if (n + 1 > sizeof(nbuf)) { h_errno = NO_RECOVERY; return (-1); } if (n > 0 && name[--n] == '.') { - strncpy(nbuf, name, n); + __strncpy(nbuf, name, n); nbuf[n] = '\0'; } else longname = name; } else { - n = strlen(name); - d = strlen(domain); + n = __strlen(name); + d = __strlen(domain); if (n + 1 + d + 1 > sizeof(nbuf)) { h_errno = NO_RECOVERY; return (-1); @@ -1509,7 +1508,7 @@ int attribute_hidden __read_etc_hosts_r(FILE * fp, const char * name, int type, *h_errnop=HOST_NOT_FOUND; while (fgets(buf, buflen, fp)) { - if ((cp = strchr(buf, '#'))) + if ((cp = __strchr(buf, '#'))) *cp = '\0'; DPRINTF("Looking at: %s\n", buf); aliases = 0; @@ -1534,7 +1533,7 @@ int attribute_hidden __read_etc_hosts_r(FILE * fp, const char * name, int type, /* Return whatever the next entry happens to be. */ break; } else if (action==GET_HOSTS_BYADDR) { - if (strcmp(name, alias[0]) != 0) + if (__strcmp(name, alias[0]) != 0) continue; } else { /* GET_HOSTS_BYNAME */ @@ -1765,12 +1764,12 @@ int getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host, && (getdomainname (domain, sizeof(domain)) == 0) && (c = strstr (h->h_name, domain)) && (c != h->h_name) && (*(--c) == '.')) { - strncpy (host, h->h_name, + __strncpy (host, h->h_name, min(hostlen, (size_t) (c - h->h_name))); host[min(hostlen - 1, (size_t) (c - h->h_name))] = '\0'; ok = 1; } else { - strncpy (host, h->h_name, hostlen); + __strncpy (host, h->h_name, hostlen); ok = 1; } } @@ -1811,7 +1810,7 @@ int getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host, if (if_indextoname (scopeid, scopeptr) == NULL) ++ni_numericscope; else - scopelen = strlen (scopebuf); + scopelen = __strlen (scopebuf); } else { ++ni_numericscope; } @@ -1825,7 +1824,7 @@ int getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host, if (real_hostlen + scopelen + 1 > hostlen) return EAI_SYSTEM; - memcpy (host + real_hostlen, scopebuf, scopelen + 1); + __memcpy (host + real_hostlen, scopebuf, scopelen + 1); } #endif } else @@ -1848,7 +1847,7 @@ int getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host, struct utsname utsname; if (!uname (&utsname)) { - strncpy (host, utsname.nodename, hostlen); + __strncpy (host, utsname.nodename, hostlen); break; }; }; @@ -1858,7 +1857,7 @@ int getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host, return EAI_NONAME; } - strncpy (host, "localhost", hostlen); + __strncpy (host, "localhost", hostlen); break; default: @@ -1876,7 +1875,7 @@ int getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host, s = getservbyport (((const struct sockaddr_in *) sa)->sin_port, ((flags & NI_DGRAM) ? "udp" : "tcp")); if (s) { - strncpy (serv, s->s_name, servlen); + __strncpy (serv, s->s_name, servlen); break; } } @@ -1885,7 +1884,7 @@ int getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host, break; case AF_LOCAL: - strncpy (serv, ((const struct sockaddr_un *) sa)->sun_path, servlen); + __strncpy (serv, ((const struct sockaddr_un *) sa)->sun_path, servlen); break; } } @@ -1970,7 +1969,7 @@ int gethostbyname_r(const char * name, if (buflen<256) return ERANGE; - strncpy(buf, name, buflen); + __strncpy(buf, name, buflen); alias[0] = buf; alias[1] = NULL; @@ -2014,7 +2013,7 @@ int gethostbyname_r(const char * name, } else if(a.add_count > 0) { - memmove(buf - sizeof(struct in_addr*)*2, buf, a.add_count * a.rdlength); + __memmove(buf - sizeof(struct in_addr*)*2, buf, a.add_count * a.rdlength); addr_list = (struct in_addr**)(buf + a.add_count * a.rdlength); addr_list[0] = in; for (i = a.add_count-1; i>=0; --i) @@ -2024,11 +2023,11 @@ int gethostbyname_r(const char * name, buf = (char*)&addr_list[a.add_count + 2]; } - strncpy(buf, a.dotted, buflen); + __strncpy(buf, a.dotted, buflen); free(a.dotted); if (a.atype == T_A) { /* ADDRESS */ - memcpy(in, a.rdata, sizeof(*in)); + __memcpy(in, a.rdata, sizeof(*in)); result_buf->h_name = buf; result_buf->h_addrtype = AF_INET; result_buf->h_length = sizeof(*in); @@ -2127,7 +2126,7 @@ int gethostbyname2_r(const char *name, int family, if (buflen<256) return ERANGE; - strncpy(buf, name, buflen); + __strncpy(buf, name, buflen); /* First check if this is already an address */ if (inet_pton(AF_INET6, name, in)) { @@ -2140,7 +2139,7 @@ int gethostbyname2_r(const char *name, int family, return NETDB_SUCCESS; } - memset((char *) &a, '\0', sizeof(a)); + __memset((char *) &a, '\0', sizeof(a)); for (;;) { BIGLOCK; @@ -2155,7 +2154,7 @@ int gethostbyname2_r(const char *name, int family, return TRY_AGAIN; } - strncpy(buf, a.dotted, buflen); + __strncpy(buf, a.dotted, buflen); free(a.dotted); if (a.atype == T_CNAME) { /* CNAME */ @@ -2173,7 +2172,7 @@ int gethostbyname2_r(const char *name, int family, } continue; } else if (a.atype == T_AAAA) { /* ADDRESS */ - memcpy(in, a.rdata, sizeof(*in)); + __memcpy(in, a.rdata, sizeof(*in)); result_buf->h_name = buf; result_buf->h_addrtype = AF_INET6; result_buf->h_length = sizeof(*in); @@ -2221,7 +2220,7 @@ int gethostbyaddr_r (const void *addr, socklen_t len, int type, if (!addr) return EINVAL; - memset((char *) &a, '\0', sizeof(a)); + __memset((char *) &a, '\0', sizeof(a)); switch (type) { case AF_INET: @@ -2295,7 +2294,7 @@ int gethostbyaddr_r (const void *addr, socklen_t len, int type, if(type == AF_INET) { unsigned char *tmp_addr = (unsigned char *)addr; - memcpy(&in->s_addr, addr, len); + __memcpy(&in->s_addr, addr, len); addr_list[0] = in; @@ -2303,7 +2302,7 @@ int gethostbyaddr_r (const void *addr, socklen_t len, int type, tmp_addr[3], tmp_addr[2], tmp_addr[1], tmp_addr[0]); #ifdef __UCLIBC_HAS_IPV6__ } else { - memcpy(in6->s6_addr, addr, len); + __memcpy(in6->s6_addr, addr, len); addr_list6[0] = in6; qp = buf; @@ -2312,7 +2311,7 @@ int gethostbyaddr_r (const void *addr, socklen_t len, int type, qp += sprintf(qp, "%x.%x.", in6->s6_addr[i] & 0xf, (in6->s6_addr[i] >> 4) & 0xf); } - strcpy(qp, "ip6.int"); + __strcpy(qp, "ip6.int"); #endif /* __UCLIBC_HAS_IPV6__ */ } @@ -2331,7 +2330,7 @@ int gethostbyaddr_r (const void *addr, socklen_t len, int type, return TRY_AGAIN; } - strncpy(buf, a.dotted, buflen); + __strncpy(buf, a.dotted, buflen); free(a.dotted); if (a.atype == T_CNAME) { /* CNAME */ @@ -2570,7 +2569,7 @@ int attribute_hidden __libc_ns_name_unpack(const u_char *msg, const u_char *eom, } checked += n + 1; *dstp++ = n; - memcpy(dstp, srcp, n); + __memcpy(dstp, srcp, n); dstp += n; srcp += n; break; diff --git a/libc/inet/rpc/auth_unix.c b/libc/inet/rpc/auth_unix.c index 787e08b13..c02cc309b 100644 --- a/libc/inet/rpc/auth_unix.c +++ b/libc/inet/rpc/auth_unix.c @@ -152,7 +152,7 @@ no_memory: au->au_origcred.oa_base = mem_alloc ((u_int) len); if (au->au_origcred.oa_base == NULL) goto no_memory; - memcpy(au->au_origcred.oa_base, mymem, (u_int) len); + __memcpy(au->au_origcred.oa_base, mymem, (u_int) len); /* * set auth handle to reflect new cred. diff --git a/libc/inet/rpc/bindresvport.c b/libc/inet/rpc/bindresvport.c index 1234f0682..98ce691ee 100644 --- a/libc/inet/rpc/bindresvport.c +++ b/libc/inet/rpc/bindresvport.c @@ -58,7 +58,7 @@ bindresvport (int sd, struct sockaddr_in *sin) if (sin == (struct sockaddr_in *) 0) { sin = &myaddr; - memset (sin, 0, sizeof (*sin)); + __memset (sin, 0, sizeof (*sin)); sin->sin_family = AF_INET; } else if (sin->sin_family != AF_INET) diff --git a/libc/inet/rpc/clnt_generic.c b/libc/inet/rpc/clnt_generic.c index c8fe545c3..3e2998477 100644 --- a/libc/inet/rpc/clnt_generic.c +++ b/libc/inet/rpc/clnt_generic.c @@ -63,11 +63,11 @@ clnt_create (const char *hostname, u_long prog, u_long vers, CLIENT *client; int herr; - if (strcmp (proto, "unix") == 0) + if (__strcmp (proto, "unix") == 0) { - memset ((char *)&sun, 0, sizeof (sun)); + __memset ((char *)&sun, 0, sizeof (sun)); sun.sun_family = AF_UNIX; - strcpy (sun.sun_path, hostname); + __strcpy (sun.sun_path, hostname); sock = RPC_ANYSOCK; client = clntunix_create (&sun, prog, vers, &sock, 0, 0); if (client == NULL) @@ -112,8 +112,8 @@ clnt_create (const char *hostname, u_long prog, u_long vers, } sin.sin_family = h->h_addrtype; sin.sin_port = 0; - memset (sin.sin_zero, 0, sizeof (sin.sin_zero)); - memcpy ((char *) &sin.sin_addr, h->h_addr, h->h_length); + __memset (sin.sin_zero, 0, sizeof (sin.sin_zero)); + __memcpy ((char *) &sin.sin_addr, h->h_addr, h->h_length); prtbuflen = 1024; prttmpbuf = alloca (prtbuflen); diff --git a/libc/inet/rpc/clnt_perror.c b/libc/inet/rpc/clnt_perror.c index 1c9ca88ae..595ddde9a 100644 --- a/libc/inet/rpc/clnt_perror.c +++ b/libc/inet/rpc/clnt_perror.c @@ -91,8 +91,8 @@ clnt_sperror (CLIENT * rpch, const char *msg) len = sprintf (str, "%s: ", msg); str += len; - (void) strcpy(str, clnt_sperrno(e.re_status)); - str += strlen(str); + (void) __strcpy(str, clnt_sperrno(e.re_status)); + str += __strlen(str); switch (e.re_status) { @@ -126,13 +126,13 @@ clnt_sperror (CLIENT * rpch, const char *msg) case RPC_AUTHERROR: err = auth_errmsg (e.re_why); - (void) strcpy(str, _("; why = ")); - str += strlen(str); + (void) __strcpy(str, _("; why = ")); + str += __strlen(str); if (err != NULL) { - (void) strcpy(str, err); - str += strlen(str); + (void) __strcpy(str, err); + str += __strlen(str); } else { @@ -316,27 +316,27 @@ clnt_spcreateerror (const char *msg) ce = &get_rpc_createerr (); len = sprintf (str, "%s: ", msg); cp = str + len; - (void) strcpy(cp, clnt_sperrno (ce->cf_stat)); - cp += strlen(cp); + (void) __strcpy(cp, clnt_sperrno (ce->cf_stat)); + cp += __strlen(cp); switch (ce->cf_stat) { case RPC_PMAPFAILURE: - (void) strcpy(cp, " - "); - cp += strlen(cp); + (void) __strcpy(cp, " - "); + cp += __strlen(cp); - (void) strcpy(cp, clnt_sperrno (ce->cf_error.re_status)); - cp += strlen(cp); + (void) __strcpy(cp, clnt_sperrno (ce->cf_error.re_status)); + cp += __strlen(cp); break; case RPC_SYSTEMERROR: - (void) strcpy(cp, " - "); - cp += strlen(cp); + (void) __strcpy(cp, " - "); + cp += __strlen(cp); strerror_r (ce->cf_error.re_errno, chrbuf, sizeof chrbuf); - (void) strcpy(cp, chrbuf); - cp += strlen(cp); + (void) __strcpy(cp, chrbuf); + cp += __strlen(cp); break; default: break; diff --git a/libc/inet/rpc/clnt_simple.c b/libc/inet/rpc/clnt_simple.c index b9d315aef..dede4a028 100644 --- a/libc/inet/rpc/clnt_simple.c +++ b/libc/inet/rpc/clnt_simple.c @@ -87,7 +87,7 @@ callrpc (const char *host, u_long prognum, u_long versnum, u_long procnum, crp->socket = RPC_ANYSOCK; } if (crp->valid && crp->oldprognum == prognum && crp->oldversnum == versnum - && strcmp (crp->oldhost, host) == 0) + && __strcmp (crp->oldhost, host) == 0) { /* reuse old client */ } @@ -100,7 +100,7 @@ callrpc (const char *host, u_long prognum, u_long versnum, u_long procnum, crp->valid = 0; if (crp->socket != RPC_ANYSOCK) { - (void) close (crp->socket); + (void) __close (crp->socket); crp->socket = RPC_ANYSOCK; } if (crp->client) @@ -125,7 +125,7 @@ callrpc (const char *host, u_long prognum, u_long versnum, u_long procnum, timeout.tv_usec = 0; timeout.tv_sec = 5; - memcpy ((char *) &server_addr.sin_addr, hp->h_addr, hp->h_length); + __memcpy ((char *) &server_addr.sin_addr, hp->h_addr, hp->h_length); server_addr.sin_family = AF_INET; server_addr.sin_port = 0; if ((crp->client = clntudp_create (&server_addr, (u_long) prognum, @@ -134,7 +134,7 @@ callrpc (const char *host, u_long prognum, u_long versnum, u_long procnum, crp->valid = 1; crp->oldprognum = prognum; crp->oldversnum = versnum; - (void) strncpy (crp->oldhost, host, 255); + (void) __strncpy (crp->oldhost, host, 255); crp->oldhost[255] = '\0'; } tottimeout.tv_sec = 25; diff --git a/libc/inet/rpc/clnt_tcp.c b/libc/inet/rpc/clnt_tcp.c index 62c95bbf0..ad2797a9e 100644 --- a/libc/inet/rpc/clnt_tcp.c +++ b/libc/inet/rpc/clnt_tcp.c @@ -175,7 +175,7 @@ clnttcp_create (struct sockaddr_in *raddr, u_long prog, u_long vers, ce->cf_stat = RPC_SYSTEMERROR; ce->cf_error.re_errno = errno; if (*sockp >= 0) - (void) close (*sockp); + (void) __close (*sockp); goto fooy; } ct->ct_closeit = TRUE; @@ -211,7 +211,7 @@ clnttcp_create (struct sockaddr_in *raddr, u_long prog, u_long vers, { if (ct->ct_closeit) { - (void) close (*sockp); + (void) __close (*sockp); } goto fooy; } @@ -464,7 +464,7 @@ clnttcp_destroy (CLIENT *h) if (ct->ct_closeit) { - (void) close (ct->ct_sock); + (void) __close (ct->ct_sock); } XDR_DESTROY (&(ct->ct_xdrs)); mem_free ((caddr_t) ct, sizeof (struct ct_data)); @@ -506,7 +506,7 @@ readtcp (char *ctptr, char *buf, int len) } break; } - switch (len = read (ct->ct_sock, buf, len)) + switch (len = __read (ct->ct_sock, buf, len)) { case 0: @@ -532,7 +532,7 @@ writetcp (char *ctptr, char *buf, int len) for (cnt = len; cnt > 0; cnt -= i, buf += i) { - if ((i = write (ct->ct_sock, buf, cnt)) == -1) + if ((i = __write (ct->ct_sock, buf, cnt)) == -1) { ct->ct_error.re_errno = errno; ct->ct_error.re_status = RPC_CANTSEND; diff --git a/libc/inet/rpc/clnt_udp.c b/libc/inet/rpc/clnt_udp.c index bd25e4b33..5a7e35e80 100644 --- a/libc/inet/rpc/clnt_udp.c +++ b/libc/inet/rpc/clnt_udp.c @@ -405,13 +405,13 @@ send_again: msg.msg_controllen = 256; ret = recvmsg (cu->cu_sock, &msg, MSG_ERRQUEUE); if (ret >= 0 - && memcmp (cbuf + 256, cu->cu_outbuf, ret) == 0 + && __memcmp (cbuf + 256, cu->cu_outbuf, ret) == 0 && (msg.msg_flags & MSG_ERRQUEUE) && ((msg.msg_namelen == 0 && ret >= 12) || (msg.msg_namelen == sizeof (err_addr) && err_addr.sin_family == AF_INET - && memcmp (&err_addr.sin_addr, &cu->cu_raddr.sin_addr, + && __memcmp (&err_addr.sin_addr, &cu->cu_raddr.sin_addr, sizeof (err_addr.sin_addr)) == 0 && err_addr.sin_port == cu->cu_raddr.sin_port))) for (cmsg = CMSG_FIRSTHDR (&msg); cmsg; @@ -606,7 +606,7 @@ clntudp_destroy (CLIENT *cl) if (cu->cu_closeit) { - (void) close (cu->cu_sock); + (void) __close (cu->cu_sock); } XDR_DESTROY (&(cu->cu_outxdrs)); mem_free ((caddr_t) cu, (sizeof (*cu) + cu->cu_sendsz + cu->cu_recvsz)); diff --git a/libc/inet/rpc/clnt_unix.c b/libc/inet/rpc/clnt_unix.c index a6ac295ad..93ea42afd 100644 --- a/libc/inet/rpc/clnt_unix.c +++ b/libc/inet/rpc/clnt_unix.c @@ -149,7 +149,7 @@ clntunix_create (struct sockaddr_un *raddr, u_long prog, u_long vers, if (*sockp < 0) { *sockp = socket (AF_UNIX, SOCK_STREAM, 0); - len = strlen (raddr->sun_path) + sizeof (raddr->sun_family) + 1; + len = __strlen (raddr->sun_path) + sizeof (raddr->sun_family) + 1; if (*sockp < 0 || connect (*sockp, (struct sockaddr *) raddr, len) < 0) { @@ -157,7 +157,7 @@ clntunix_create (struct sockaddr_un *raddr, u_long prog, u_long vers, ce->cf_stat = RPC_SYSTEMERROR; ce->cf_error.re_errno = errno; if (*sockp != -1) - close (*sockp); + __close (*sockp); goto fooy; } ct->ct_closeit = TRUE; @@ -191,7 +191,7 @@ clntunix_create (struct sockaddr_un *raddr, u_long prog, u_long vers, if (!xdr_callhdr (&(ct->ct_xdrs), &call_msg)) { if (ct->ct_closeit) - close (*sockp); + __close (*sockp); goto fooy; } ct->ct_mpos = XDR_GETPOS (&(ct->ct_xdrs)); @@ -437,7 +437,7 @@ clntunix_destroy (CLIENT *h) if (ct->ct_closeit) { - (void) close (ct->ct_sock); + (void) __close (ct->ct_sock); } XDR_DESTROY (&(ct->ct_xdrs)); mem_free ((caddr_t) ct, sizeof (struct ct_data)); @@ -510,7 +510,7 @@ __msgwrite (int sock, void *data, size_t cnt) cred.uid = geteuid (); cred.gid = getegid (); - memcpy (CMSG_DATA(cmsg), &cred, sizeof (struct ucred)); + __memcpy (CMSG_DATA(cmsg), &cred, sizeof (struct ucred)); cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_type = SCM_CREDENTIALS; cmsg->cmsg_len = sizeof(*cmsg) + sizeof(struct ucred); diff --git a/libc/inet/rpc/get_myaddress.c b/libc/inet/rpc/get_myaddress.c index 7674a7a46..ef2c2f52e 100644 --- a/libc/inet/rpc/get_myaddress.c +++ b/libc/inet/rpc/get_myaddress.c @@ -94,7 +94,7 @@ get_myaddress (struct sockaddr_in *addr) { *addr = *((struct sockaddr_in *) &ifr->ifr_addr); addr->sin_port = htons (PMAPPORT); - close (s); + __close (s); return; } ifr++; @@ -104,5 +104,5 @@ get_myaddress (struct sockaddr_in *addr) loopback = 1; goto again; } - close (s); + __close (s); } diff --git a/libc/inet/rpc/getrpcent.c b/libc/inet/rpc/getrpcent.c index 56fbbbe45..c261dfb3b 100644 --- a/libc/inet/rpc/getrpcent.c +++ b/libc/inet/rpc/getrpcent.c @@ -96,10 +96,10 @@ struct rpcent *getrpcbyname(const char *name) setrpcent(0); while ((rpc = getrpcent())) { - if (strcmp(rpc->r_name, name) == 0) + if (__strcmp(rpc->r_name, name) == 0) return rpc; for (rp = rpc->r_aliases; *rp != NULL; rp++) { - if (strcmp(*rp, name) == 0) + if (__strcmp(*rp, name) == 0) return rpc; } } @@ -166,8 +166,8 @@ static char *firstwhite(char *s) { char *s1, *s2; - s1 = strchr(s, ' '); - s2 = strchr(s, '\t'); + s1 = __strchr(s, ' '); + s2 = __strchr(s, '\t'); if (s1) { if (s2) return (s1 < s2) ? s1 : s2; @@ -184,12 +184,12 @@ static struct rpcent *interpret(register struct rpcdata *d) register char *cp, **q; p = d->line; - d->line[strlen(p)-1] = '\n'; + d->line[__strlen(p)-1] = '\n'; if (*p == '#') return __get_next_rpcent(d); - cp = strchr(p, '#'); + cp = __strchr(p, '#'); if (cp == NULL) { - cp = strchr(p, '\n'); + cp = __strchr(p, '\n'); if (cp == NULL) return __get_next_rpcent(d); } @@ -200,9 +200,9 @@ static struct rpcent *interpret(register struct rpcdata *d) else return __get_next_rpcent(d); #else - cp = strchr(p, ' '); + cp = __strchr(p, ' '); if (cp == NULL) { - cp = strchr(p, '\t'); + cp = __strchr(p, '\t'); if (cp == NULL) return __get_next_rpcent(d); } @@ -218,11 +218,11 @@ static struct rpcent *interpret(register struct rpcdata *d) if ((cp = firstwhite(cp))) *cp++ = '\0'; #else - cp = strchr(p, ' '); + cp = __strchr(p, ' '); if (cp != NULL) *cp++ = '\0'; else { - cp = strchr(p, '\t'); + cp = __strchr(p, '\t'); if (cp != NULL) *cp++ = '\0'; } @@ -238,11 +238,11 @@ static struct rpcent *interpret(register struct rpcdata *d) if ((cp = firstwhite(cp))) *cp++ = '\0'; #else - cp = strchr(p, ' '); + cp = __strchr(p, ' '); if (cp != NULL) *cp++ = '\0'; else { - cp = strchr(p, '\t'); + cp = __strchr(p, '\t'); if (cp != NULL) *cp++ = '\0'; } @@ -275,8 +275,8 @@ static int __copy_rpcent(struct rpcent *r, struct rpcent *result_buf, char *buff return ENOENT; /* copy the struct from the shared mem */ - memset(result_buf, 0x00, sizeof(*result_buf)); - memset(buffer, 0x00, buflen); + __memset(result_buf, 0x00, sizeof(*result_buf)); + __memset(buffer, 0x00, buflen); result_buf->r_number = r->r_number; @@ -293,21 +293,21 @@ static int __copy_rpcent(struct rpcent *r, struct rpcent *result_buf, char *buff buflen -= s; while (i-- > 0) { - s = strlen(r->r_aliases[i]) + 1; + s = __strlen(r->r_aliases[i]) + 1; if (buflen < s) goto err_out; result_buf->r_aliases[i] = buffer; buffer += s; buflen -= s; - memcpy(result_buf->r_aliases[i], r->r_aliases[i], s); + __memcpy(result_buf->r_aliases[i], r->r_aliases[i], s); } /* copy the name */ - i = strlen(r->r_name); + i = __strlen(r->r_name); if (buflen <= i) goto err_out; result_buf->r_name = buffer; - memcpy(result_buf->r_name, r->r_name, i); + __memcpy(result_buf->r_name, r->r_name, i); /* that was a hoot eh ? */ *result = result_buf; diff --git a/libc/inet/rpc/getrpcport.c b/libc/inet/rpc/getrpcport.c index 851a1c487..5470fbff6 100644 --- a/libc/inet/rpc/getrpcport.c +++ b/libc/inet/rpc/getrpcport.c @@ -70,7 +70,7 @@ getrpcport (const char *host, u_long prognum, u_long versnum, u_int proto) buffer = alloca (buflen); } - memcpy ((char *) &addr.sin_addr, hp->h_addr, hp->h_length); + __memcpy ((char *) &addr.sin_addr, hp->h_addr, hp->h_length); addr.sin_family = AF_INET; addr.sin_port = 0; return pmap_getport (&addr, prognum, versnum, proto); diff --git a/libc/inet/rpc/pmap_clnt.c b/libc/inet/rpc/pmap_clnt.c index 2382c153b..5bbc81564 100644 --- a/libc/inet/rpc/pmap_clnt.c +++ b/libc/inet/rpc/pmap_clnt.c @@ -90,7 +90,7 @@ __get_myaddress (struct sockaddr_in *addr) { *addr = *((struct sockaddr_in *) &ifr->ifr_addr); addr->sin_port = htons (PMAPPORT); - close (s); + __close (s); return TRUE; } ifr++; @@ -100,7 +100,7 @@ __get_myaddress (struct sockaddr_in *addr) loopback = 0; goto again; } - close (s); + __close (s); return FALSE; } @@ -139,7 +139,7 @@ pmap_set (u_long program, u_long version, int protocol, u_short port) return FALSE; } CLNT_DESTROY (client); - /* (void)close(socket); CLNT_DESTROY closes it */ + /* (void)__close(socket); CLNT_DESTROY closes it */ return rslt; } @@ -168,6 +168,6 @@ pmap_unset (u_long program, u_long version) CLNT_CALL (client, PMAPPROC_UNSET, (xdrproc_t)xdr_pmap, (caddr_t)&parms, (xdrproc_t)xdr_bool, (caddr_t)&rslt, tottimeout); CLNT_DESTROY (client); - /* (void)close(socket); CLNT_DESTROY already closed it */ + /* (void)__close(socket); CLNT_DESTROY already closed it */ return rslt; } diff --git a/libc/inet/rpc/pmap_getmaps.c b/libc/inet/rpc/pmap_getmaps.c index c435dea4e..4ec2d40e9 100644 --- a/libc/inet/rpc/pmap_getmaps.c +++ b/libc/inet/rpc/pmap_getmaps.c @@ -74,7 +74,7 @@ pmap_getmaps (struct sockaddr_in *address) } CLNT_DESTROY (client); } - /* (void)close(socket); CLNT_DESTROY already closed it */ + /* (void)__close(socket); CLNT_DESTROY already closed it */ address->sin_port = 0; return head; } diff --git a/libc/inet/rpc/pmap_getport.c b/libc/inet/rpc/pmap_getport.c index 6d68ef01f..45ed4eae8 100644 --- a/libc/inet/rpc/pmap_getport.c +++ b/libc/inet/rpc/pmap_getport.c @@ -88,7 +88,7 @@ pmap_getport (address, program, version, protocol) } CLNT_DESTROY (client); } - /* (void)close(socket); CLNT_DESTROY already closed it */ + /* (void)__close(socket); CLNT_DESTROY already closed it */ address->sin_port = 0; return port; } diff --git a/libc/inet/rpc/pmap_rmt.c b/libc/inet/rpc/pmap_rmt.c index 04f558fe2..db875e987 100644 --- a/libc/inet/rpc/pmap_rmt.c +++ b/libc/inet/rpc/pmap_rmt.c @@ -40,6 +40,7 @@ static char sccsid[] = "@(#)pmap_rmt.c 1.21 87/08/27 Copyr 1984 Sun Micro"; */ #define authunix_create_default __authunix_create_default +#define inet_makeaddr __inet_makeaddr #define __FORCE_GLIBC #include <features.h> @@ -281,7 +282,7 @@ clnt_broadcast (prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult) fd.fd = sock; fd.events = POLLIN; nets = getbroadcastnets (addrs, sock, inbuf); - memset ((char *) &baddr, 0, sizeof (baddr)); + __memset ((char *) &baddr, 0, sizeof (baddr)); baddr.sin_family = AF_INET; baddr.sin_port = htons (PMAPPORT); baddr.sin_addr.s_addr = htonl (INADDR_ANY); @@ -409,7 +410,7 @@ clnt_broadcast (prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult) } } done_broad: - (void) close (sock); + (void) __close (sock); AUTH_DESTROY (unix_auth); return stat; } diff --git a/libc/inet/rpc/rcmd.c b/libc/inet/rpc/rcmd.c index cb4866b7a..a51d09fcd 100644 --- a/libc/inet/rpc/rcmd.c +++ b/libc/inet/rpc/rcmd.c @@ -155,7 +155,7 @@ int rcmd(ahost, rport, locuser, remuser, cmd, fd2p) sin.sin_port = rport; if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) >= 0) /* __connect */ break; - (void)close(s); /* __close */ + (void)__close(s); if (errno == EADDRINUSE) { lport--; continue; @@ -185,7 +185,7 @@ int rcmd(ahost, rport, locuser, remuser, cmd, fd2p) } lport--; if (fd2p == 0) { - write(s, "", 1); /* __write */ + __write(s, "", 1); lport = 0; } else { char num[8]; @@ -196,10 +196,10 @@ int rcmd(ahost, rport, locuser, remuser, cmd, fd2p) goto bad; listen(s2, 1); (void)snprintf(num, sizeof(num), "%d", lport); /* __snprintf */ - if (write(s, num, strlen(num)+1) != strlen(num)+1) { + if (__write(s, num, __strlen(num)+1) != __strlen(num)+1) { (void)fprintf(stderr, "rcmd: write (setting up stderr): %m\n"); - (void)close(s2); /* __close */ + (void)__close(s2); goto bad; } pfd[0].fd = s; @@ -210,11 +210,11 @@ int rcmd(ahost, rport, locuser, remuser, cmd, fd2p) (void)fprintf(stderr, "rcmd: poll (setting up stderr): %m\n"); else (void)fprintf(stderr, "poll: protocol failure in circuit setup\n"); - (void)close(s2); + (void)__close(s2); goto bad; } s3 = accept(s2, (struct sockaddr *)&from, &len); - (void)close(s2); + (void)__close(s2); if (s3 < 0) { (void)fprintf(stderr, "rcmd: accept: %m\n"); @@ -231,17 +231,17 @@ int rcmd(ahost, rport, locuser, remuser, cmd, fd2p) goto bad2; } } - (void)write(s, locuser, strlen(locuser)+1); - (void)write(s, remuser, strlen(remuser)+1); - (void)write(s, cmd, strlen(cmd)+1); - if (read(s, &c, 1) != 1) { + (void)__write(s, locuser, __strlen(locuser)+1); + (void)__write(s, remuser, __strlen(remuser)+1); + (void)__write(s, cmd, __strlen(cmd)+1); + if (__read(s, &c, 1) != 1) { (void)fprintf(stderr, "rcmd: %s: %m\n", *ahost); goto bad2; } if (c != 0) { - while (read(s, &c, 1) == 1) { - (void)write(STDERR_FILENO, &c, 1); + while (__read(s, &c, 1) == 1) { + (void)__write(STDERR_FILENO, &c, 1); if (c == '\n') break; } @@ -251,9 +251,9 @@ int rcmd(ahost, rport, locuser, remuser, cmd, fd2p) return s; bad2: if (lport) - (void)close(*fd2p); + (void)__close(*fd2p); bad: - (void)close(s); + (void)__close(s); sigsetmask(oldmask); return -1; } @@ -273,12 +273,12 @@ int rresvport(int *alport) if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) >= 0) return s; if (errno != EADDRINUSE) { - (void)close(s); + (void)__close(s); return -1; } (*alport)--; if (*alport == IPPORT_RESERVED/2) { - (void)close(s); + (void)__close(s); __set_errno (EAGAIN); /* close */ return -1; } @@ -455,10 +455,10 @@ iruserok2 (raddr, superuser, ruser, luser, rhost) return -1; #endif - dirlen = strlen (pwd->pw_dir); + dirlen = __strlen (pwd->pw_dir); pbuf = malloc (dirlen + sizeof "/.rhosts"); - strcpy (pbuf, pwd->pw_dir); - strcat (pbuf, "/.rhosts"); + __strcpy (pbuf, pwd->pw_dir); + __strcat (pbuf, "/.rhosts"); /* Change effective uid while reading .rhosts. If root and reading an NFS mounted file system, can't read files that @@ -523,18 +523,18 @@ __icheckhost (u_int32_t raddr, char *lhost, const char *rhost) #ifdef HAVE_NETGROUP /* Check nis netgroup. */ - if (strncmp ("+@", lhost, 2) == 0) + if (__strncmp ("+@", lhost, 2) == 0) return innetgr (&lhost[2], rhost, NULL, NULL); - if (strncmp ("-@", lhost, 2) == 0) + if (__strncmp ("-@", lhost, 2) == 0) return -innetgr (&lhost[2], rhost, NULL, NULL); #endif /* HAVE_NETGROUP */ /* -host */ - if (strncmp ("-", lhost,1) == 0) { + if (__strncmp ("-", lhost,1) == 0) { negate = -1; lhost++; - } else if (strcmp ("+",lhost) == 0) { + } else if (__strcmp ("+",lhost) == 0) { return 1; /* asking for trouble, but ok.. */ } @@ -564,7 +564,7 @@ __icheckhost (u_int32_t raddr, char *lhost, const char *rhost) /* Spin through ip addresses. */ for (pp = hp->h_addr_list; *pp; ++pp) - if (!memcmp (&raddr, *pp, sizeof (u_int32_t))) + if (!__memcmp (&raddr, *pp, sizeof (u_int32_t))) return negate; /* No match. */ @@ -583,23 +583,23 @@ __icheckuser (const char *luser, const char *ruser) #ifdef HAVE_NETGROUP /* [-+]@netgroup */ - if (strncmp ("+@", luser, 2) == 0) + if (__strncmp ("+@", luser, 2) == 0) return innetgr (&luser[2], NULL, ruser, NULL); - if (strncmp ("-@", luser,2) == 0) + if (__strncmp ("-@", luser,2) == 0) return -innetgr (&luser[2], NULL, ruser, NULL); #endif /* HAVE_NETGROUP */ /* -user */ - if (strncmp ("-", luser, 1) == 0) - return -(strcmp (&luser[1], ruser) == 0); + if (__strncmp ("-", luser, 1) == 0) + return -(__strcmp (&luser[1], ruser) == 0); /* + */ - if (strcmp ("+", luser) == 0) + if (__strcmp ("+", luser) == 0) return 1; /* simple string match */ - return strcmp (ruser, luser) == 0; + return __strcmp (ruser, luser) == 0; } /* @@ -641,7 +641,7 @@ __ivaliduser2(hostf, raddr, luser, ruser, rhost) } /* Skip lines that are too long. */ - if (strchr (p, '\n') == NULL) { + if (__strchr (p, '\n') == NULL) { int ch = getc_unlocked (hostf); while (ch != '\n' && ch != EOF) diff --git a/libc/inet/rpc/rexec.c b/libc/inet/rpc/rexec.c index 2c280d922..00e68ff6b 100644 --- a/libc/inet/rpc/rexec.c +++ b/libc/inet/rpc/rexec.c @@ -70,7 +70,7 @@ rexec_af(ahost, rport, name, pass, cmd, fd2p, af) snprintf(servbuff, sizeof(servbuff), "%d", ntohs(rport)); servbuff[sizeof(servbuff) - 1] = '\0'; - memset(&hints, 0, sizeof(hints)); + __memset(&hints, 0, sizeof(hints)); hints.ai_family = af; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_CANONNAME; @@ -81,7 +81,7 @@ rexec_af(ahost, rport, name, pass, cmd, fd2p, af) } if (res0->ai_canonname){ - strncpy(ahostbuf, res0->ai_canonname, sizeof(ahostbuf)); + __strncpy(ahostbuf, res0->ai_canonname, sizeof(ahostbuf)); ahostbuf[sizeof(ahostbuf)-1] = '\0'; *ahost = ahostbuf; } @@ -97,7 +97,7 @@ retry: } if (connect(s, res0->ai_addr, res0->ai_addrlen) < 0) { if (errno == ECONNREFUSED && timo <= 16) { - (void) close(s); + (void) __close(s); sleep(timo); timo *= 2; goto retry; @@ -106,7 +106,7 @@ retry: return (-1); } if (fd2p == 0) { - (void) write(s, "", 1); + (void) __write(s, "", 1); port = 0; } else { char num[32]; @@ -114,18 +114,18 @@ retry: s2 = socket(res0->ai_family, res0->ai_socktype, 0); if (s2 < 0) { - (void) close(s); + (void) __close(s); return (-1); } listen(s2, 1); sa2len = sizeof (sa2); if (getsockname(s2, (struct sockaddr *)&sa2, &sa2len) < 0) { perror("getsockname"); - (void) close(s2); + (void) __close(s2); goto bad; } else if (sa2len != SA_LEN((struct sockaddr *)&sa2)) { __set_errno(EINVAL); - (void) close(s2); + (void) __close(s2); goto bad; } port = 0; @@ -134,10 +134,10 @@ retry: NI_NUMERICSERV)) port = atoi(servbuff); (void) sprintf(num, "%u", port); - (void) write(s, num, strlen(num)+1); + (void) __write(s, num, __strlen(num)+1); { socklen_t len = sizeof (from); s3 = accept(s2, (struct sockaddr *)&from, &len); - close(s2); + __close(s2); if (s3 < 0) { perror("accept"); port = 0; @@ -146,10 +146,10 @@ retry: } *fd2p = s3; } - (void) write(s, name, strlen(name) + 1); + (void) __write(s, name, __strlen(name) + 1); /* should public key encypt the password here */ - (void) write(s, pass, strlen(pass) + 1); - (void) write(s, cmd, strlen(cmd) + 1); + (void) __write(s, pass, __strlen(pass) + 1); + (void) __write(s, cmd, __strlen(cmd) + 1); /* We don't need the memory allocated for the name and the password in ruserpass anymore. */ @@ -158,13 +158,13 @@ retry: if (pass != orig_pass) free ((char *) pass); - if (read(s, &c, 1) != 1) { + if (__read(s, &c, 1) != 1) { perror(*ahost); goto bad; } if (c != 0) { - while (read(s, &c, 1) == 1) { - (void) write(2, &c, 1); + while (__read(s, &c, 1) == 1) { + (void) __write(2, &c, 1); if (c == '\n') break; } @@ -174,8 +174,8 @@ retry: return (s); bad: if (port) - (void) close(*fd2p); - (void) close(s); + (void) __close(*fd2p); + (void) __close(s); freeaddrinfo(res0); return (-1); } diff --git a/libc/inet/rpc/rpc_callmsg.c b/libc/inet/rpc/rpc_callmsg.c index 634b1bea5..8934eed91 100644 --- a/libc/inet/rpc/rpc_callmsg.c +++ b/libc/inet/rpc/rpc_callmsg.c @@ -85,7 +85,7 @@ xdr_callmsg (XDR *xdrs, struct rpc_msg *cmsg) IXDR_PUT_INT32 (buf, oa->oa_length); if (oa->oa_length) { - memcpy ((caddr_t) buf, oa->oa_base, oa->oa_length); + __memcpy ((caddr_t) buf, oa->oa_base, oa->oa_length); buf = (int32_t *) ((char *) buf + RNDUP (oa->oa_length)); } oa = &cmsg->rm_call.cb_verf; @@ -93,7 +93,7 @@ xdr_callmsg (XDR *xdrs, struct rpc_msg *cmsg) IXDR_PUT_INT32 (buf, oa->oa_length); if (oa->oa_length) { - memcpy ((caddr_t) buf, oa->oa_base, oa->oa_length); + __memcpy ((caddr_t) buf, oa->oa_base, oa->oa_length); /* no real need.... buf = (long *) ((char *) buf + RNDUP(oa->oa_length)); */ @@ -141,7 +141,7 @@ xdr_callmsg (XDR *xdrs, struct rpc_msg *cmsg) } else { - memcpy (oa->oa_base, (caddr_t) buf, oa->oa_length); + __memcpy (oa->oa_base, (caddr_t) buf, oa->oa_length); /* no real need.... buf = (long *) ((char *) buf + RNDUP(oa->oa_length)); @@ -181,7 +181,7 @@ xdr_callmsg (XDR *xdrs, struct rpc_msg *cmsg) } else { - memcpy (oa->oa_base, (caddr_t) buf, oa->oa_length); + __memcpy (oa->oa_base, (caddr_t) buf, oa->oa_length); /* no real need... buf = (long *) ((char *) buf + RNDUP(oa->oa_length)); diff --git a/libc/inet/rpc/rtime.c b/libc/inet/rpc/rtime.c index bf30cd282..554ad69eb 100644 --- a/libc/inet/rpc/rtime.c +++ b/libc/inet/rpc/rtime.c @@ -68,7 +68,7 @@ do_close (int s) int save; save = errno; - close (s); + __close (s); __set_errno (save); } @@ -132,7 +132,7 @@ rtime (struct sockaddr_in *addrp, struct rpc_timeval *timep, do_close (s); return -1; } - res = read (s, (char *) &thetime, sizeof (thetime)); + res = __read (s, (char *) &thetime, sizeof (thetime)); do_close (s); if (res < 0) return (-1); diff --git a/libc/inet/rpc/ruserpass.c b/libc/inet/rpc/ruserpass.c index 9963ac3e9..116a34276 100644 --- a/libc/inet/rpc/ruserpass.c +++ b/libc/inet/rpc/ruserpass.c @@ -112,9 +112,9 @@ int ruserpass(const char *host, const char **aname, const char **apass) return -1; } - buf = alloca (strlen(hdir) + 8); - strcpy(buf, hdir); - strcat(buf, "/.netrc"); + buf = alloca (__strlen(hdir) + 8); + __strcpy(buf, hdir); + __strcat(buf, "/.netrc"); cfile = fopen(buf, "r"); if (cfile == NULL) { if (errno != ENOENT) @@ -127,9 +127,9 @@ int ruserpass(const char *host, const char **aname, const char **apass) #endif if (gethostname(myname, sizeof(myname)) < 0) myname[0] = '\0'; - mydomain = strchr(myname, '.'); + mydomain = __strchr(myname, '.'); if (mydomain==NULL) { - mydomain=myname + strlen(myname); + mydomain=myname + __strlen(myname); } next: while ((t = token())) switch(t) { @@ -151,12 +151,12 @@ next: goto match; /* if (__strcasecmp(hostname, tokval) == 0) goto match; - if ((tmp = strchr(hostname, '.')) != NULL && + if ((tmp = __strchr(hostname, '.')) != NULL && __strcasecmp(tmp, mydomain) == 0 && __strncasecmp(hostname, tokval, tmp-hostname) == 0 && tokval[tmp - hostname] == '\0') goto match; */ - if ((tmp = strchr(host, '.')) != NULL && + if ((tmp = __strchr(host, '.')) != NULL && strcasecmp(tmp, mydomain) == 0 && strncasecmp(host, tokval, tmp - host) == 0 && tokval[tmp - host] == '\0') @@ -170,21 +170,21 @@ next: if (token()) { if (*aname == 0) { char *newp; - newp = malloc((unsigned) strlen(tokval) + 1); + newp = malloc((unsigned) __strlen(tokval) + 1); if (newp == NULL) { printf(_("out of memory")); goto bad; } - *aname = strcpy(newp, tokval); + *aname = __strcpy(newp, tokval); } else { - if (strcmp(*aname, tokval)) + if (__strcmp(*aname, tokval)) goto next; } } break; case PASSWD: - if (strcmp(*aname, "anonymous") && + if (__strcmp(*aname, "anonymous") && fstat(fileno(cfile), &stb) >= 0 && (stb.st_mode & 077) != 0) { printf(_("Error: .netrc file is readable by others.")); @@ -193,13 +193,13 @@ next: } if (token() && *apass == 0) { char *newp; - newp = malloc((unsigned) strlen(tokval) + 1); + newp = malloc((unsigned) __strlen(tokval) + 1); if (newp == NULL) { printf(_("out of memory")); goto bad; } - *apass = strcpy(newp, tokval); + *apass = __strcpy(newp, tokval); } break; case ACCOUNT: @@ -211,8 +211,8 @@ next: goto bad; } if (token() && *aacct == 0) { - *aacct = malloc((unsigned) strlen(tokval) + 1); - (void) strcpy(*aacct, tokval); + *aacct = malloc((unsigned) __strlen(tokval) + 1); + (void) __strcpy(*aacct, tokval); } #endif break; @@ -327,7 +327,7 @@ token() if (tokval[0] == 0) return (0); for (i = 0; i < (int) (sizeof (toktab) / sizeof (toktab[0])); ++i) - if (!strcmp(&tokstr[toktab[i].tokstr_off], tokval)) + if (!__strcmp(&tokstr[toktab[i].tokstr_off], tokval)) return toktab[i].tval; return (ID); } diff --git a/libc/inet/rpc/svc_auth_unix.c b/libc/inet/rpc/svc_auth_unix.c index 84c563cdf..256a42154 100644 --- a/libc/inet/rpc/svc_auth_unix.c +++ b/libc/inet/rpc/svc_auth_unix.c @@ -84,7 +84,7 @@ _svcauth_unix (struct svc_req *rqst, struct rpc_msg *msg) stat = AUTH_BADCRED; goto done; } - memcpy (aup->aup_machname, (caddr_t) buf, (u_int) str_len); + __memcpy (aup->aup_machname, (caddr_t) buf, (u_int) str_len); aup->aup_machname[str_len] = 0; str_len = RNDUP (str_len); buf = (int32_t *) ((char *) buf + str_len); diff --git a/libc/inet/rpc/svc_simple.c b/libc/inet/rpc/svc_simple.c index afc01bafa..da3c71211 100644 --- a/libc/inet/rpc/svc_simple.c +++ b/libc/inet/rpc/svc_simple.c @@ -96,7 +96,7 @@ registerrpc (u_long prognum, u_long versnum, u_long procnum, transp = svcudp_create (RPC_ANYSOCK); if (transp == NULL) { - buf = strdup (_("couldn't create an rpc server\n")); + buf = __strdup (_("couldn't create an rpc server\n")); goto err_out; } } @@ -111,7 +111,7 @@ registerrpc (u_long prognum, u_long versnum, u_long procnum, pl = (struct proglst_ *) malloc (sizeof (struct proglst_)); if (pl == NULL) { - buf = strdup (_("registerrpc: out of memory\n")); + buf = __strdup (_("registerrpc: out of memory\n")); goto err_out; } pl->p_progname = progname; @@ -150,7 +150,7 @@ universal (struct svc_req *rqstp, SVCXPRT *transp_l) { if (svc_sendreply (transp_l, (xdrproc_t)xdr_void, (char *) NULL) == FALSE) { - write (STDERR_FILENO, "xxx\n", 4); + __write (STDERR_FILENO, "xxx\n", 4); exit (1); } return; @@ -161,7 +161,7 @@ universal (struct svc_req *rqstp, SVCXPRT *transp_l) if (pl->p_prognum == prog && pl->p_procnum == proc) { /* decode arguments into a CLEAN buffer */ - memset (xdrbuf, 0, sizeof (xdrbuf)); /* required ! */ + __memset (xdrbuf, 0, sizeof (xdrbuf)); /* required ! */ if (!svc_getargs (transp_l, pl->p_inproc, xdrbuf)) { svcerr_decode (transp_l); diff --git a/libc/inet/rpc/svc_tcp.c b/libc/inet/rpc/svc_tcp.c index 05e1d2dbe..20deb8719 100644 --- a/libc/inet/rpc/svc_tcp.c +++ b/libc/inet/rpc/svc_tcp.c @@ -164,7 +164,7 @@ svctcp_create (int sock, u_int sendsize, u_int recvsize) } madesock = TRUE; } - memset ((char *) &addr, 0, sizeof (addr)); + __memset ((char *) &addr, 0, sizeof (addr)); addr.sin_family = AF_INET; if (bindresvport (sock, &addr)) { @@ -176,7 +176,7 @@ svctcp_create (int sock, u_int sendsize, u_int recvsize) { perror (_("svc_tcp.c - cannot getsockname or listen")); if (madesock) - (void) close (sock); + (void) __close (sock); return (SVCXPRT *) NULL; } r = (struct tcp_rendezvous *) mem_alloc (sizeof (*r)); @@ -272,7 +272,7 @@ again: * make a new transporter (re-uses xprt) */ xprt = makefd_xprt (sock, r->sendsize, r->recvsize); - memcpy (&xprt->xp_raddr, &addr, sizeof (addr)); + __memcpy (&xprt->xp_raddr, &addr, sizeof (addr)); xprt->xp_addrlen = len; return FALSE; /* there is never an rpc msg to be processed */ } @@ -289,7 +289,7 @@ svctcp_destroy (SVCXPRT *xprt) struct tcp_conn *cd = (struct tcp_conn *) xprt->xp_p1; xprt_unregister (xprt); - (void) close (xprt->xp_sock); + (void) __close (xprt->xp_sock); if (xprt->xp_port != 0) { /* a rendezvouser socket */ @@ -339,7 +339,7 @@ readtcp (char *xprtptr, char *buf, int len) } while ((pollfd.revents & POLLIN) == 0); - if ((len = read (sock, buf, len)) > 0) + if ((len = __read (sock, buf, len)) > 0) return len; fatal_err: @@ -359,7 +359,7 @@ writetcp (char *xprtptr, char * buf, int len) for (cnt = len; cnt > 0; cnt -= i, buf += i) { - if ((i = write (xprt->xp_sock, buf, cnt)) < 0) + if ((i = __write (xprt->xp_sock, buf, cnt)) < 0) { ((struct tcp_conn *) (xprt->xp_p1))->strm_stat = XPRT_DIED; return -1; diff --git a/libc/inet/rpc/svc_udp.c b/libc/inet/rpc/svc_udp.c index 88fde6c0f..a37552a4b 100644 --- a/libc/inet/rpc/svc_udp.c +++ b/libc/inet/rpc/svc_udp.c @@ -136,7 +136,7 @@ svcudp_bufcreate (sock, sendsz, recvsz) } madesock = TRUE; } - memset ((char *) &addr, 0, sizeof (addr)); + __memset ((char *) &addr, 0, sizeof (addr)); addr.sin_family = AF_INET; if (bindresvport (sock, &addr)) { @@ -147,7 +147,7 @@ svcudp_bufcreate (sock, sendsz, recvsz) { perror (_("svcudp_create - cannot getsockname")); if (madesock) - (void) close (sock); + (void) __close (sock); return (SVCXPRT *) NULL; } xprt = (SVCXPRT *) mem_alloc (sizeof (SVCXPRT)); @@ -200,7 +200,7 @@ svcudp_bufcreate (sock, sendsz, recvsz) #endif /* Clear the padding. */ pad = 0; - memset (&xprt->xp_pad [0], pad, sizeof (xprt->xp_pad)); + __memset (&xprt->xp_pad [0], pad, sizeof (xprt->xp_pad)); xprt_register (xprt); return xprt; @@ -375,7 +375,7 @@ svcudp_destroy (xprt) struct svcudp_data *su = su_data (xprt); xprt_unregister (xprt); - (void) close (xprt->xp_sock); + (void) __close (xprt->xp_sock); XDR_DESTROY (&(su->su_xdrs)); mem_free (rpc_buffer (xprt), su->su_iosz); mem_free ((caddr_t) su, sizeof (struct svcudp_data)); @@ -408,7 +408,7 @@ svcudp_destroy (xprt) (type *) mem_alloc((unsigned) (sizeof(type) * (size))) #define BZERO(addr, type, size) \ - memset((char *) addr, 0, sizeof(type) * (int) (size)) + __memset((char *) addr, 0, sizeof(type) * (int) (size)) /* * An entry in the cache @@ -586,7 +586,7 @@ cache_get (xprt, msg, replyp, replylenp) struct svcudp_data *su = su_data (xprt); struct udp_cache *uc = (struct udp_cache *) su->su_cache; -#define EQADDR(a1, a2) (memcmp((char*)&a1, (char*)&a2, sizeof(a1)) == 0) +#define EQADDR(a1, a2) (__memcmp((char*)&a1, (char*)&a2, sizeof(a1)) == 0) loc = CACHE_LOC (xprt, su->su_xid); for (ent = uc->uc_entries[loc]; ent != NULL; ent = ent->cache_next) @@ -609,6 +609,6 @@ cache_get (xprt, msg, replyp, replylenp) uc->uc_proc = msg->rm_call.cb_proc; uc->uc_vers = msg->rm_call.cb_vers; uc->uc_prog = msg->rm_call.cb_prog; - memcpy (&uc->uc_addr, &xprt->xp_raddr, sizeof (uc->uc_addr)); + __memcpy (&uc->uc_addr, &xprt->xp_raddr, sizeof (uc->uc_addr)); return 0; } diff --git a/libc/inet/rpc/svc_unix.c b/libc/inet/rpc/svc_unix.c index e3b3e8c11..d1568e4a7 100644 --- a/libc/inet/rpc/svc_unix.c +++ b/libc/inet/rpc/svc_unix.c @@ -158,10 +158,10 @@ svcunix_create (int sock, u_int sendsize, u_int recvsize, char *path) } madesock = TRUE; } - memset (&addr, '\0', sizeof (addr)); + __memset (&addr, '\0', sizeof (addr)); addr.sun_family = AF_UNIX; - len = strlen (path) + 1; - memcpy (addr.sun_path, path, len); + len = __strlen (path) + 1; + __memcpy (addr.sun_path, path, len); len += sizeof (addr.sun_family); bind (sock, (struct sockaddr *) &addr, len); @@ -171,7 +171,7 @@ svcunix_create (int sock, u_int sendsize, u_int recvsize, char *path) { perror (_("svc_unix.c - cannot getsockname or listen")); if (madesock) - close (sock); + __close (sock); return (SVCXPRT *) NULL; } @@ -268,10 +268,10 @@ again: /* * make a new transporter (re-uses xprt) */ - memset (&in_addr, '\0', sizeof (in_addr)); + __memset (&in_addr, '\0', sizeof (in_addr)); in_addr.sin_family = AF_UNIX; xprt = makefd_xprt (sock, r->sendsize, r->recvsize); - memcpy (&xprt->xp_raddr, &in_addr, sizeof (in_addr)); + __memcpy (&xprt->xp_raddr, &in_addr, sizeof (in_addr)); xprt->xp_addrlen = len; return FALSE; /* there is never an rpc msg to be processed */ } @@ -288,7 +288,7 @@ svcunix_destroy (SVCXPRT *xprt) struct unix_conn *cd = (struct unix_conn *) xprt->xp_p1; xprt_unregister (xprt); - close (xprt->xp_sock); + __close (xprt->xp_sock); if (xprt->xp_port != 0) { /* a rendezvouser socket */ @@ -380,7 +380,7 @@ __msgwrite (int sock, void *data, size_t cnt) cred.uid = geteuid (); cred.gid = getegid (); - memcpy (CMSG_DATA(cmsg), &cred, sizeof (struct ucred)); + __memcpy (CMSG_DATA(cmsg), &cred, sizeof (struct ucred)); cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_type = SCM_CREDENTIALS; cmsg->cmsg_len = sizeof(*cmsg) + sizeof(struct ucred); diff --git a/libc/inet/rpc/xdr.c b/libc/inet/rpc/xdr.c index a1d449e19..7d69022dc 100644 --- a/libc/inet/rpc/xdr.c +++ b/libc/inet/rpc/xdr.c @@ -678,7 +678,7 @@ xdr_string (xdrs, cpp, maxsize) case XDR_ENCODE: if (sp == NULL) return FALSE; - size = strlen (sp); + size = __strlen (sp); break; case XDR_DECODE: break; diff --git a/libc/inet/rpc/xdr_array.c b/libc/inet/rpc/xdr_array.c index 450f5b2ea..584174e22 100644 --- a/libc/inet/rpc/xdr_array.c +++ b/libc/inet/rpc/xdr_array.c @@ -117,7 +117,7 @@ xdr_array (xdrs, addrp, sizep, maxsize, elsize, elproc) (void) fputs (_("xdr_array: out of memory\n"), stderr); return FALSE; } - memset (target, 0, nodesize); + __memset (target, 0, nodesize); break; case XDR_FREE: diff --git a/libc/inet/rpc/xdr_mem.c b/libc/inet/rpc/xdr_mem.c index e80de7b1a..568d0e54a 100644 --- a/libc/inet/rpc/xdr_mem.c +++ b/libc/inet/rpc/xdr_mem.c @@ -137,7 +137,7 @@ xdrmem_getbytes (XDR *xdrs, caddr_t addr, u_int len) { if ((xdrs->x_handy -= len) < 0) return FALSE; - memcpy (addr, xdrs->x_private, len); + __memcpy (addr, xdrs->x_private, len); xdrs->x_private += len; return TRUE; } @@ -151,7 +151,7 @@ xdrmem_putbytes (XDR *xdrs, const char *addr, u_int len) { if ((xdrs->x_handy -= len) < 0) return FALSE; - memcpy (xdrs->x_private, addr, len); + __memcpy (xdrs->x_private, addr, len); xdrs->x_private += len; return TRUE; } diff --git a/libc/inet/rpc/xdr_rec.c b/libc/inet/rpc/xdr_rec.c index abe81bb58..749955401 100644 --- a/libc/inet/rpc/xdr_rec.c +++ b/libc/inet/rpc/xdr_rec.c @@ -297,7 +297,7 @@ xdrrec_putbytes (XDR *xdrs, const char *addr, u_int len) { current = rstrm->out_boundry - rstrm->out_finger; current = (len < current) ? len : current; - memcpy (rstrm->out_finger, addr, current); + __memcpy (rstrm->out_finger, addr, current); rstrm->out_finger += current; addr += current; len -= current; @@ -599,7 +599,7 @@ get_input_bytes (RECSTREAM *rstrm, caddr_t addr, int len) continue; } current = (len < current) ? len : current; - memcpy (addr, rstrm->in_finger, current); + __memcpy (addr, rstrm->in_finger, current); rstrm->in_finger += current; addr += current; len -= current; diff --git a/libc/inet/rpc/xdr_reference.c b/libc/inet/rpc/xdr_reference.c index 1569e51b7..177c25059 100644 --- a/libc/inet/rpc/xdr_reference.c +++ b/libc/inet/rpc/xdr_reference.c @@ -95,7 +95,7 @@ xdr_reference (xdrs, pp, size, proc) (void) fputs (_("xdr_reference: out of memory\n"), stderr); return FALSE; } - memset (loc, 0, (int) size); + __memset (loc, 0, (int) size); break; default: break; diff --git a/libc/misc/dirent/alphasort.c b/libc/misc/dirent/alphasort.c index dcf970070..feae021e6 100644 --- a/libc/misc/dirent/alphasort.c +++ b/libc/misc/dirent/alphasort.c @@ -4,7 +4,7 @@ int alphasort(const void * a, const void * b) { - return strcmp ((*(const struct dirent **) a)->d_name, + return __strcmp ((*(const struct dirent **) a)->d_name, (*(const struct dirent **) b)->d_name); } diff --git a/libc/misc/dirent/alphasort64.c b/libc/misc/dirent/alphasort64.c index bcae8108f..5801f4940 100644 --- a/libc/misc/dirent/alphasort64.c +++ b/libc/misc/dirent/alphasort64.c @@ -19,7 +19,7 @@ int alphasort64(const void * a, const void * b) { - return strcmp ((*(const struct dirent64 **) a)->d_name, + return __strcmp ((*(const struct dirent64 **) a)->d_name, (*(const struct dirent64 **) b)->d_name); } #endif /* __UCLIBC_HAS_LFS__ */ diff --git a/libc/misc/dirent/closedir.c b/libc/misc/dirent/closedir.c index 068e2d3e2..57600ab69 100644 --- a/libc/misc/dirent/closedir.c +++ b/libc/misc/dirent/closedir.c @@ -29,5 +29,5 @@ int closedir(DIR * dir) #endif free(dir->dd_buf); free(dir); - return close(fd); + return __close(fd); } diff --git a/libc/misc/dirent/opendir.c b/libc/misc/dirent/opendir.c index 017684b40..9f5f75e3f 100644 --- a/libc/misc/dirent/opendir.c +++ b/libc/misc/dirent/opendir.c @@ -24,7 +24,7 @@ DIR *opendir(const char *name) __set_errno(ENOTDIR); return NULL; } - if ((fd = open(name, O_RDONLY)) < 0) + if ((fd = __open(name, O_RDONLY)) < 0) return NULL; /* According to POSIX, directory streams should be closed when * exec. From "Anna Pluzhnikov" <besp@midway.uchicago.edu>. @@ -32,7 +32,7 @@ DIR *opendir(const char *name) if (fcntl(fd, F_SETFD, FD_CLOEXEC) < 0) return NULL; if (!(ptr = malloc(sizeof(*ptr)))) { - close(fd); + __close(fd); __set_errno(ENOMEM); return NULL; } @@ -45,7 +45,7 @@ DIR *opendir(const char *name) ptr->dd_max = 512; if (!(buf = calloc(1, ptr->dd_max))) { - close(fd); + __close(fd); free(ptr); __set_errno(ENOMEM); return NULL; diff --git a/libc/misc/dirent/readdir64_r.c b/libc/misc/dirent/readdir64_r.c index da3564edb..1daae5116 100644 --- a/libc/misc/dirent/readdir64_r.c +++ b/libc/misc/dirent/readdir64_r.c @@ -62,7 +62,7 @@ int readdir64_r(DIR *dir, struct dirent64 *entry, struct dirent64 **result) if (de == NULL) { *result = NULL; } else { - *result = memcpy (entry, de, de->d_reclen); + *result = __memcpy (entry, de, de->d_reclen); } ret = 0; diff --git a/libc/misc/dirent/readdir_r.c b/libc/misc/dirent/readdir_r.c index 245dcbdde..1c8eeadce 100644 --- a/libc/misc/dirent/readdir_r.c +++ b/libc/misc/dirent/readdir_r.c @@ -48,7 +48,7 @@ int readdir_r(DIR *dir, struct dirent *entry, struct dirent **result) if (de == NULL) { *result = NULL; } else { - *result = memcpy (entry, de, de->d_reclen); + *result = __memcpy (entry, de, de->d_reclen); } ret = 0; diff --git a/libc/misc/dirent/scandir.c b/libc/misc/dirent/scandir.c index cb3d505db..8b08e4884 100644 --- a/libc/misc/dirent/scandir.c +++ b/libc/misc/dirent/scandir.c @@ -72,7 +72,7 @@ int scandir(const char *dir, struct dirent ***namelist, if (vnew == NULL) break; - names[pos++] = (struct dirent *) memcpy (vnew, current, dsize); + names[pos++] = (struct dirent *) __memcpy (vnew, current, dsize); } if (unlikely(errno != 0)) diff --git a/libc/misc/dirent/scandir64.c b/libc/misc/dirent/scandir64.c index b4cc57a36..2916285eb 100644 --- a/libc/misc/dirent/scandir64.c +++ b/libc/misc/dirent/scandir64.c @@ -87,7 +87,7 @@ int scandir64(const char *dir, struct dirent64 ***namelist, if (vnew == NULL) break; - names[pos++] = (struct dirent64 *) memcpy (vnew, current, dsize); + names[pos++] = (struct dirent64 *) __memcpy (vnew, current, dsize); } if (unlikely(errno != 0)) diff --git a/libc/misc/error/error.c b/libc/misc/error/error.c index 576d11154..0a19e3923 100644 --- a/libc/misc/error/error.c +++ b/libc/misc/error/error.c @@ -70,7 +70,7 @@ void __error_at_line (int status, int errnum, const char *file_name, static unsigned int old_line_number; if (old_line_number == line_number && - (file_name == old_file_name || !strcmp (old_file_name, file_name))) + (file_name == old_file_name || !__strcmp (old_file_name, file_name))) /* Simply return and print nothing. */ return; diff --git a/libc/misc/file/lockf.c b/libc/misc/file/lockf.c index f95b24fac..0962031da 100644 --- a/libc/misc/file/lockf.c +++ b/libc/misc/file/lockf.c @@ -28,7 +28,7 @@ int lockf (int fd, int cmd, off_t len) { struct flock fl; - memset ((char *) &fl, '\0', sizeof (fl)); + __memset ((char *) &fl, '\0', sizeof (fl)); /* lockf is always relative to the current file position. */ fl.l_whence = SEEK_CUR; diff --git a/libc/misc/file/lockf64.c b/libc/misc/file/lockf64.c index 5638d6938..eb70e8ddd 100644 --- a/libc/misc/file/lockf64.c +++ b/libc/misc/file/lockf64.c @@ -62,7 +62,7 @@ int lockf64 (int fd, int cmd, off64_t len64) return -1; } - memset((char *) &fl, '\0', sizeof (fl)); + __memset((char *) &fl, '\0', sizeof (fl)); /* lockf is always relative to the current file position. */ fl.l_whence = SEEK_CUR; diff --git a/libc/misc/ftw/ftw.c b/libc/misc/ftw/ftw.c index 48b385c19..c36ae45b6 100644 --- a/libc/misc/ftw/ftw.c +++ b/libc/misc/ftw/ftw.c @@ -18,7 +18,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define mempcpy __libc_mempcpy +/* used by D_EXACT_NAMLEN */ +#define strlen __strlen + +#define mempcpy __mempcpy #define tsearch __tsearch #define _GNU_SOURCE @@ -424,7 +427,7 @@ ftw_dir (struct ftw_data *data, struct STAT *st) /* Next, update the `struct FTW' information. */ ++data->ftw.level; - startp = strchr (data->dirbuf, '\0'); + startp = __strchr (data->dirbuf, '\0'); /* There always must be a directory name. */ assert (startp != data->dirbuf); if (startp[-1] != '/') @@ -460,7 +463,7 @@ ftw_dir (struct ftw_data *data, struct STAT *st) while (result == 0 && *runp != '\0') { - char *endp = strchr (runp, '\0'); + char *endp = __strchr (runp, '\0'); result = process_entry (data, &dir, runp, endp - runp); @@ -501,7 +504,7 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors, int flag __set_errno (ENOENT); return -1; } - if ((strlen(dir)+1) > NAME_MAX) { + if ((__strlen(dir)+1) > NAME_MAX) { __set_errno(ENAMETOOLONG); return -1; } @@ -510,10 +513,10 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors, int flag data.actdir = 0; data.dirstreams = (struct dir_data **) alloca (data.maxdir * sizeof (struct dir_data *)); - memset (data.dirstreams, '\0', data.maxdir * sizeof (struct dir_data *)); + __memset (data.dirstreams, '\0', data.maxdir * sizeof (struct dir_data *)); /* PATH_MAX is always defined when we get here. */ - data.dirbufsize = MAX (2 * strlen (dir), PATH_MAX); + data.dirbufsize = MAX (2 * __strlen (dir), PATH_MAX); data.dirbuf = (char *) malloc (data.dirbufsize); if (data.dirbuf == NULL) return -1; diff --git a/libc/misc/glob/glob.c b/libc/misc/glob/glob.c index 246402113..22f1874ab 100644 --- a/libc/misc/glob/glob.c +++ b/libc/misc/glob/glob.c @@ -127,7 +127,7 @@ glob (pattern, flags, errfunc, pglob) { dirlen = filename - pattern; dirname = (char *) alloca (dirlen + 1); - memcpy (dirname, pattern, dirlen); + __memcpy (dirname, pattern, dirlen); dirname[dirlen] = '\0'; ++filename; } @@ -219,11 +219,11 @@ glob (pattern, flags, errfunc, pglob) /* No matches. */ if (flags & GLOB_NOCHECK) { - size_t len = strlen (pattern) + 1; + size_t len = __strlen (pattern) + 1; char *patcopy = (char *) malloc (len); if (patcopy == NULL) return GLOB_NOSPACE; - memcpy (patcopy, pattern, len); + __memcpy (patcopy, pattern, len); pglob->gl_pathv = (char **) realloc (pglob->gl_pathv, @@ -281,7 +281,7 @@ glob (pattern, flags, errfunc, pglob) for (i = oldcount; i < pglob->gl_pathc; ++i) if (lstat (pglob->gl_pathv[i], &st) == 0 && S_ISDIR (st.st_mode)) - strcat (pglob->gl_pathv[i], "/"); + __strcat (pglob->gl_pathv[i], "/"); } if (!(flags & GLOB_NOSORT)) @@ -343,7 +343,7 @@ prefix_array (dirname, array, n, add_slash) int add_slash; { register size_t i; - size_t dirlen = strlen (dirname); + size_t dirlen = __strlen (dirname); if (dirlen == 1 && dirname[0] == '/') /* DIRNAME is just "/", so normal prepending would get us "//foo". @@ -352,7 +352,7 @@ prefix_array (dirname, array, n, add_slash) for (i = 0; i < n; ++i) { - size_t eltlen = strlen (array[i]) + 1; + size_t eltlen = __strlen (array[i]) + 1; char *new = (char *) malloc (dirlen + 1 + eltlen + (add_slash ? 1 : 0)); if (new == NULL) { @@ -361,9 +361,9 @@ prefix_array (dirname, array, n, add_slash) return 1; } - memcpy (new, dirname, dirlen); + __memcpy (new, dirname, dirlen); new[dirlen] = '/'; - memcpy (&new[dirlen + 1], array[i], eltlen); + __memcpy (&new[dirlen + 1], array[i], eltlen); free ((__ptr_t) array[i]); array[i] = new; } @@ -436,7 +436,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) #endif } - if ((!meta && strcmp (pattern, name) == 0) + if ((!meta && __strcmp (pattern, name) == 0) || fnmatch (pattern, name, (!(flags & GLOB_PERIOD) ? FNM_PERIOD : 0) | ((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0)) == 0) @@ -444,12 +444,12 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) struct globlink *new = (struct globlink *) alloca (sizeof (struct globlink)); if (len == 0) - len = strlen (name); + len = __strlen (name); new->name = (char *) malloc (len + ((flags & GLOB_MARK) ? 1 : 0) + 1); if (new->name == NULL) goto memory_error; - memcpy ((__ptr_t) new->name, name, len); + __memcpy ((__ptr_t) new->name, name, len); new->name[len] = '\0'; new->next = names; names = new; @@ -461,14 +461,14 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) if (nfound == 0 && (flags & GLOB_NOCHECK)) { - size_t len = strlen (pattern); + size_t len = __strlen (pattern); nfound = 1; names = (struct globlink *) alloca (sizeof (struct globlink)); names->next = NULL; names->name = (char *) malloc (len + (flags & GLOB_MARK ? 1 : 0) + 1); if (names->name == NULL) goto memory_error; - memcpy (names->name, pattern, len); + __memcpy (names->name, pattern, len); names->name[len] = '\0'; } diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c index 48b3b6e7d..a46465398 100644 --- a/libc/misc/internals/__uClibc_main.c +++ b/libc/misc/internals/__uClibc_main.c @@ -80,9 +80,9 @@ const char *__progname = 0; #endif extern int __libc_fcntl(int fd, int cmd, ...); -extern int __libc_open(const char *file, int flags, ...); #ifdef __ARCH_HAS_MMU__ + static void __check_one_fd(int fd, int mode) { /* Check if the specified fd is already open */ @@ -90,7 +90,7 @@ static void __check_one_fd(int fd, int mode) { /* The descriptor is probably not open, so try to use /dev/null */ struct stat st; - int nullfd = __libc_open(_PATH_DEVNULL, mode); + int nullfd = __open(_PATH_DEVNULL, mode); /* /dev/null is major=1 minor=3. Make absolutely certain * that is in fact the device that we have opened and not * some other wierd file... */ @@ -229,7 +229,7 @@ __uClibc_main(int (*main)(int, char **, char **), int argc, while (*aux_dat) { ElfW(auxv_t) *auxv_entry = (ElfW(auxv_t) *) aux_dat; if (auxv_entry->a_type <= AT_EGID) { - memcpy(&(auxvt[auxv_entry->a_type]), auxv_entry, sizeof(ElfW(auxv_t))); + __memcpy(&(auxvt[auxv_entry->a_type]), auxv_entry, sizeof(ElfW(auxv_t))); } aux_dat += 2; } diff --git a/libc/misc/internals/tempname.c b/libc/misc/internals/tempname.c index 589d627ae..360c76879 100644 --- a/libc/misc/internals/tempname.c +++ b/libc/misc/internals/tempname.c @@ -31,6 +31,8 @@ * Use brain damaged getpid() if real random fails. */ +#define open64 __open64 + #include <stddef.h> #include <stdint.h> #include <stdio.h> @@ -72,7 +74,7 @@ int attribute_hidden __path_search (char *tmpl, size_t tmpl_len, const char *dir } else { - plen = strlen (pfx); + plen = __strlen (pfx); if (plen > 5) plen = 5; } @@ -94,7 +96,7 @@ int attribute_hidden __path_search (char *tmpl, size_t tmpl_len, const char *dir { if (direxists (P_tmpdir)) dir = P_tmpdir; - else if (strcmp (P_tmpdir, "/tmp") != 0 && direxists ("/tmp")) + else if (__strcmp (P_tmpdir, "/tmp") != 0 && direxists ("/tmp")) dir = "/tmp"; else { @@ -103,7 +105,7 @@ int attribute_hidden __path_search (char *tmpl, size_t tmpl_len, const char *dir } } - dlen = strlen (dir); + dlen = __strlen (dir); while (dlen > 1 && dir[dlen - 1] == '/') dlen--; /* remove trailing slashes */ @@ -126,13 +128,13 @@ static unsigned int fillrand(unsigned char *buf, unsigned int len) { int fd; unsigned int result = -1; - fd = open("/dev/urandom", O_RDONLY); + fd = __open("/dev/urandom", O_RDONLY); if (fd < 0) { - fd = open("/dev/random", O_RDONLY | O_NONBLOCK); + fd = __open("/dev/random", O_RDONLY | O_NONBLOCK); } if (fd >= 0) { - result = read(fd, buf, len); - close(fd); + result = __read(fd, buf, len); + __close(fd); } return result; } @@ -182,8 +184,8 @@ int attribute_hidden __gen_tempname (char *tmpl, int kind) int len, i, count, fd, save_errno = errno; unsigned char randomness[6]; - len = strlen (tmpl); - if (len < 6 || strcmp (&tmpl[len - 6], "XXXXXX")) + len = __strlen (tmpl); + if (len < 6 || __strcmp (&tmpl[len - 6], "XXXXXX")) { __set_errno (EINVAL); return -1; @@ -223,7 +225,7 @@ int attribute_hidden __gen_tempname (char *tmpl, int kind) continue; } case __GT_FILE: - fd = open (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); + fd = __open (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); break; #if defined __UCLIBC_HAS_LFS__ case __GT_BIGFILE: diff --git a/libc/misc/intl/intl.c b/libc/misc/intl/intl.c index f3255828c..e882f441c 100644 --- a/libc/misc/intl/intl.c +++ b/libc/misc/intl/intl.c @@ -60,7 +60,7 @@ char *__uClibc_textdomain(const char *domainname) { static const char default_str[] = "messages"; - if (domainname && *domainname && strcmp(domainname, default_str)) { + if (domainname && *domainname && __strcmp(domainname, default_str)) { __set_errno(EINVAL); return NULL; } @@ -82,7 +82,7 @@ char *__uClibc_bindtextdomain(const char *domainname, const char *dirname) #if 1 && ((dirname[0] != '/') || dirname[1]) #else - && strcmp(dirname, dir) + && __strcmp(dirname, dir) #endif ) ) { diff --git a/libc/misc/locale/locale.c b/libc/misc/locale/locale.c index f46dabc2d..77d3f1e5d 100644 --- a/libc/misc/locale/locale.c +++ b/libc/misc/locale/locale.c @@ -155,7 +155,7 @@ char *setlocale(int category, register const char *locale) && ( (!locale) /* Request for locale category string. */ || (!*locale) /* Implementation-defined default is C. */ || ((*locale == 'C') && !locale[1]) - || (!strcmp(locale, "POSIX"))) ) + || (!__strcmp(locale, "POSIX"))) ) ? (char *) C_string /* Always in C/POSIX locale. */ : NULL; } @@ -226,7 +226,7 @@ static void update_hr_locale(const unsigned char *spec) *n = 0; } else { char at = 0; - memcpy(n, LOCALE_NAMES + 5*((*loc)-1), 5); + __memcpy(n, LOCALE_NAMES + 5*((*loc)-1), 5); if (n[2] != '_') { at = n[2]; n[2] = '_'; @@ -455,7 +455,7 @@ static int init_cur_collate(int der_num, __collate_t *cur_collate) + cdd->base_idx * sizeof(coldata_base_t) )/2 ); - memcpy(cur_collate, cdb, offsetof(coldata_base_t,index2weight_offset)); + __memcpy(cur_collate, cdb, offsetof(coldata_base_t,index2weight_offset)); cur_collate->undefined_idx = cdd->undefined_idx; cur_collate->ti_mask = (1 << cur_collate->ti_shift)-1; @@ -507,9 +507,9 @@ static int init_cur_collate(int der_num, __collate_t *cur_collate) cur_collate->index2ruleidx = cur_collate->index2weight + cur_collate->max_col_index + 1; - memcpy(cur_collate->index2weight, cur_collate->index2weight_tbl, + __memcpy(cur_collate->index2weight, cur_collate->index2weight_tbl, cur_collate->num_col_base * sizeof(uint16_t)); - memcpy(cur_collate->index2ruleidx, cur_collate->index2ruleidx_tbl, + __memcpy(cur_collate->index2ruleidx, cur_collate->index2ruleidx_tbl, cur_collate->num_col_base * sizeof(uint16_t)); /* now do the overrides */ @@ -594,7 +594,7 @@ int _locale_set_l(const unsigned char *p, __locale_t base) return 0; /* calloc failed. */ } free(base->collate.index2weight); - memcpy(&base->collate, &newcol, sizeof(__collate_t)); + __memcpy(&base->collate, &newcol, sizeof(__collate_t)); } do { @@ -664,15 +664,15 @@ int _locale_set_l(const unsigned char *p, __locale_t base) * All of this will be replaced in the next generation * of locale support anyway... */ - memcpy(base->__ctype_b_data, + __memcpy(base->__ctype_b_data, __C_ctype_b - __UCLIBC_CTYPE_B_TBL_OFFSET, (256 + __UCLIBC_CTYPE_B_TBL_OFFSET) * sizeof(__ctype_mask_t)); - memcpy(base->__ctype_tolower_data, + __memcpy(base->__ctype_tolower_data, __C_ctype_tolower - __UCLIBC_CTYPE_TO_TBL_OFFSET, (256 + __UCLIBC_CTYPE_TO_TBL_OFFSET) * sizeof(__ctype_touplow_t)); - memcpy(base->__ctype_toupper_data, + __memcpy(base->__ctype_toupper_data, __C_ctype_toupper - __UCLIBC_CTYPE_TO_TBL_OFFSET, (256 + __UCLIBC_CTYPE_TO_TBL_OFFSET) * sizeof(__ctype_touplow_t)); @@ -782,7 +782,7 @@ int _locale_set_l(const unsigned char *p, __locale_t base) d = base->outdigit_length; x = &base->outdigit0_mb; for (c = 0 ; c < 10 ; c++) { - ((unsigned char *)d)[c] = strlen(x[c]); + ((unsigned char *)d)[c] = __strlen(x[c]); assert(d[c] > 0); } } else if (i == LC_NUMERIC) { @@ -847,10 +847,10 @@ static const uint16_t __code2flag[16] = { void _locale_init_l(__locale_t base) { - memset(base->cur_locale, 0, LOCALE_SELECTOR_SIZE); + __memset(base->cur_locale, 0, LOCALE_SELECTOR_SIZE); base->cur_locale[0] = '#'; - memcpy(base->category_item_count, + __memcpy(base->category_item_count, __locale_mmap->lc_common_item_offsets_LEN, LC_ALL); @@ -1072,14 +1072,14 @@ static int find_locale(int category_mask, const char *p, char buf[18]; /* TODO: 7+{max codeset name length} */ const char *q; - if ((q = strchr(p,'@')) != NULL) { + if ((q = __strchr(p,'@')) != NULL) { if ((((size_t)((q-p)-5)) > (sizeof(buf) - 5)) || (p[2] != '_')) { return 0; } /* locale name at least 5 chars long and 3rd char is '_' */ s = LOCALE_AT_MODIFIERS; do { - if (!strcmp(s+2, q+1)) { + if (!__strcmp(s+2, q+1)) { break; } s += 2 + *s; /* TODO - fix this throughout */ @@ -1088,7 +1088,7 @@ static int find_locale(int category_mask, const char *p, return 0; } assert(q - p < sizeof(buf)); - memcpy(buf, p, q-p); + __memcpy(buf, p, q-p); buf[q-p] = 0; buf[2] = s[1]; p = buf; @@ -1096,19 +1096,19 @@ static int find_locale(int category_mask, const char *p, #endif lang_cult = codeset = 0; /* Assume C and default codeset. */ - if (((*p == 'C') && !p[1]) || !strcmp(p, posix)) { + if (((*p == 'C') && !p[1]) || !__strcmp(p, posix)) { goto FIND_LOCALE; } - if ((strlen(p) > 5) && (p[5] == '.')) { /* Codeset in locale name? */ + if ((__strlen(p) > 5) && (p[5] == '.')) { /* Codeset in locale name? */ /* TODO: maybe CODESET_LIST + *s ??? */ /* 7bit is 1, UTF-8 is 2, 8-bit is >= 3 */ codeset = 2; - if (strcmp(utf8,p+6) != 0) {/* TODO - fix! */ + if (__strcmp(utf8,p+6) != 0) {/* TODO - fix! */ s = CODESET_LIST; do { ++codeset; /* Increment codeset first. */ - if (!strcmp(CODESET_LIST+*s, p+6)) { + if (!__strcmp(CODESET_LIST+*s, p+6)) { goto FIND_LANG_CULT; } } while (*++s); @@ -1121,7 +1121,7 @@ static int find_locale(int category_mask, const char *p, do { /* TODO -- do a binary search? */ /* TODO -- fix gen_mmap!*/ ++lang_cult; /* Increment first since C/POSIX is 0. */ - if (!strncmp(s,p,5)) { /* Found a matching locale name; */ + if (!__strncmp(s,p,5)) { /* Found a matching locale name; */ goto FIND_LOCALE; } s += 5; @@ -1163,14 +1163,14 @@ static unsigned char *composite_locale(int category_mask, const char *locale, int c; int component_mask; - if (!strchr(locale,'=')) { + if (!__strchr(locale,'=')) { if (!find_locale(category_mask, locale, new_locale)) { return NULL; } return new_locale; } - if (strlen(locale) >= sizeof(buf)) { + if (__strlen(locale) >= sizeof(buf)) { return NULL; } stpcpy(buf, locale); @@ -1179,7 +1179,7 @@ static unsigned char *composite_locale(int category_mask, const char *locale, t = strtok_r(buf, "=", &e); /* This can't fail because of strchr test above. */ do { c = 0; - while (strcmp(CATEGORY_NAMES + (int) CATEGORY_NAMES[c], t)) { + while (__strcmp(CATEGORY_NAMES + (int) CATEGORY_NAMES[c], t)) { if (++c == LC_ALL) { /* Unknown category name! */ return NULL; } @@ -1221,7 +1221,7 @@ __locale_t __newlocale(int category_mask, const char *locale, __locale_t base) #ifdef __UCLIBC_MJN3_ONLY__ #warning TODO: Rename cur_locale to locale_selector. #endif - strcpy((char *) new_selector, + __strcpy((char *) new_selector, (base ? (char *) base->cur_locale : C_LOCALE_SELECTOR)); if (!*locale) { /* locale == "", so check environment. */ @@ -1310,9 +1310,9 @@ __locale_t __duplocale(__locale_t dataset) if ((i2w = calloc(n, sizeof(uint16_t))) != NULL ) { - memcpy(r, dataset, sizeof(__uclibc_locale_t)); + __memcpy(r, dataset, sizeof(__uclibc_locale_t)); r->collate.index2weight = i2w; - memcpy(i2w, dataset->collate.index2weight, n * sizeof(uint16_t)); + __memcpy(i2w, dataset->collate.index2weight, n * sizeof(uint16_t)); } else { free(r); r = NULL; diff --git a/libc/misc/regex/regex.c b/libc/misc/regex/regex.c index 5e09af6d9..d367211c5 100644 --- a/libc/misc/regex/regex.c +++ b/libc/misc/regex/regex.c @@ -44,6 +44,15 @@ extern wctype_t __wctype (__const char *__property) attribute_hidden; extern int __iswctype (wint_t __wc, wctype_t __desc) /*attribute_hidden*/; #endif + +#define memcmp __memcmp +#define memcpy __memcpy +#define memmove __memmove +#define memset __memset +#define strchr __strchr +#define strcmp __strcmp +#define strlen __strlen +#define strncpy __strncpy #endif /* Make sure noone compiles this code with a C++ compiler. */ diff --git a/libc/misc/regex/regex_old.c b/libc/misc/regex/regex_old.c index 3e9d2eb30..cdf2f940a 100644 --- a/libc/misc/regex/regex_old.c +++ b/libc/misc/regex/regex_old.c @@ -21,7 +21,6 @@ 02111-1307 USA. */ #define HAVE_MEMPCPY -#define __mempcpy __libc_mempcpy #define memset __memset #define memcmp __memcmp #define strcmp __strcmp @@ -40,8 +39,8 @@ #define STDC_HEADERS #define RE_TRANSLATE_TYPE char * -extern void *__libc_mempcpy (void *__restrict __dest, - __const void *__restrict __src, size_t __n) /*attribute_hidden*/; +extern void *__mempcpy (void *__restrict __dest, + __const void *__restrict __src, size_t __n) attribute_hidden; /* AIX requires this to be the first thing in the file. */ #if defined _AIX && !defined REGEX_MALLOC diff --git a/libc/misc/search/hsearch_r.c b/libc/misc/search/hsearch_r.c index 10efb1a88..0f96180b1 100644 --- a/libc/misc/search/hsearch_r.c +++ b/libc/misc/search/hsearch_r.c @@ -140,7 +140,7 @@ int hsearch_r (ENTRY item, ACTION action, ENTRY **retval, { unsigned int hval; unsigned int count; - unsigned int len = strlen (item.key); + unsigned int len = __strlen (item.key); unsigned int idx; /* Compute an value for the given string. Perhaps use a better method. */ @@ -166,7 +166,7 @@ int hsearch_r (ENTRY item, ACTION action, ENTRY **retval, unsigned hval2; if (htab->table[idx].used == hval - && strcmp (item.key, htab->table[idx].entry.key) == 0) + && __strcmp (item.key, htab->table[idx].entry.key) == 0) { *retval = &htab->table[idx].entry; return 1; @@ -190,7 +190,7 @@ int hsearch_r (ENTRY item, ACTION action, ENTRY **retval, /* If entry is found use it. */ if (htab->table[idx].used == hval - && strcmp (item.key, htab->table[idx].entry.key) == 0) + && __strcmp (item.key, htab->table[idx].entry.key) == 0) { *retval = &htab->table[idx].entry; return 1; diff --git a/libc/misc/search/lsearch.c b/libc/misc/search/lsearch.c index 2a9996d47..4bc45ca36 100644 --- a/libc/misc/search/lsearch.c +++ b/libc/misc/search/lsearch.c @@ -37,7 +37,7 @@ void *lsearch(const void *key, void *base, size_t *nmemb, register char *p; if ((p = lfind(key, base, nmemb, size, compar)) == NULL) { - p = memcpy((base + (size * (*nmemb))), key, size); + p = __memcpy((base + (size * (*nmemb))), key, size); ++(*nmemb); } return (p); diff --git a/libc/misc/statfs/fstatfs64.c b/libc/misc/statfs/fstatfs64.c index 1040e1fe1..b793002fb 100644 --- a/libc/misc/statfs/fstatfs64.c +++ b/libc/misc/statfs/fstatfs64.c @@ -57,7 +57,7 @@ int fstatfs64 (int fd, struct statfs64 *buf) buf->f_ffree = buf32.f_ffree; buf->f_fsid = buf32.f_fsid; buf->f_namelen = buf32.f_namelen; - memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare)); + __memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare)); return 0; } diff --git a/libc/misc/statfs/internal_statvfs.c b/libc/misc/statfs/internal_statvfs.c index aa7af44f5..8f7e386c4 100644 --- a/libc/misc/statfs/internal_statvfs.c +++ b/libc/misc/statfs/internal_statvfs.c @@ -39,7 +39,7 @@ buf->__f_unused = 0; #endif buf->f_namemax = fsbuf.f_namelen; - memset (buf->__f_spare, '\0', 6 * sizeof (int)); + __memset (buf->__f_spare, '\0', 6 * sizeof (int)); /* What remains to do is to fill the fields f_favail and f_flag. */ @@ -79,21 +79,21 @@ char *opt; while ((opt = strsep (&cp, ",")) != NULL) - if (strcmp (opt, "ro") == 0) + if (__strcmp (opt, "ro") == 0) buf->f_flag |= ST_RDONLY; - else if (strcmp (opt, "nosuid") == 0) + else if (__strcmp (opt, "nosuid") == 0) buf->f_flag |= ST_NOSUID; - else if (strcmp (opt, "noexec") == 0) + else if (__strcmp (opt, "noexec") == 0) buf->f_flag |= ST_NOEXEC; - else if (strcmp (opt, "nodev") == 0) + else if (__strcmp (opt, "nodev") == 0) buf->f_flag |= ST_NODEV; - else if (strcmp (opt, "sync") == 0) + else if (__strcmp (opt, "sync") == 0) buf->f_flag |= ST_SYNCHRONOUS; - else if (strcmp (opt, "mand") == 0) + else if (__strcmp (opt, "mand") == 0) buf->f_flag |= ST_MANDLOCK; - else if (strcmp (opt, "noatime") == 0) + else if (__strcmp (opt, "noatime") == 0) buf->f_flag |= ST_NOATIME; - else if (strcmp (opt, "nodiratime") == 0) + else if (__strcmp (opt, "nodiratime") == 0) buf->f_flag |= ST_NODIRATIME; /* We can stop looking for more entries. */ diff --git a/libc/misc/statfs/statfs64.c b/libc/misc/statfs/statfs64.c index 0b954c675..7144cce71 100644 --- a/libc/misc/statfs/statfs64.c +++ b/libc/misc/statfs/statfs64.c @@ -55,7 +55,7 @@ int statfs64 (const char *file, struct statfs64 *buf) buf->f_ffree = buf32.f_ffree; buf->f_fsid = buf32.f_fsid; buf->f_namelen = buf32.f_namelen; - memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare)); + __memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare)); return 0; } diff --git a/libc/misc/syslog/syslog.c b/libc/misc/syslog/syslog.c index dc30db913..69ff0b38b 100644 --- a/libc/misc/syslog/syslog.c +++ b/libc/misc/syslog/syslog.c @@ -31,8 +31,6 @@ * SUCH DAMAGE. */ -#define memmove __memmove - #define __FORCE_GLIBC #define _GNU_SOURCE #include <features.h> @@ -114,7 +112,7 @@ closelog_intern(int to_default) { LOCK; if (LogFile != -1) { - (void) close(LogFile); + (void) __close(LogFile); } LogFile = -1; connected = 0; @@ -160,7 +158,7 @@ vsyslog( int pri, const char *fmt, va_list ap ) struct sigaction action, oldaction; int sigpipe; - memset (&action, 0, sizeof (action)); + __memset (&action, 0, sizeof (action)); action.sa_handler = sigpipe_handler; sigemptyset (&action.sa_mask); sigpipe = sigaction (SIGPIPE, &action, &oldaction); @@ -186,7 +184,7 @@ vsyslog( int pri, const char *fmt, va_list ap ) (void)time(&now); stdp = p = tbuf + sprintf(tbuf, "<%d>%.15s ", pri, ctime(&now) + 4); if (LogTag) { - if (strlen(LogTag) < sizeof(tbuf) - 64) + if (__strlen(LogTag) < sizeof(tbuf) - 64) p += sprintf(p, "%s", LogTag); else p += sprintf(p, "<BUFFER OVERRUN ATTEMPT>"); @@ -209,9 +207,9 @@ vsyslog( int pri, const char *fmt, va_list ap ) p += vsnprintf(p, end - p, fmt, ap); if (p >= end || p < head_end) { /* Returned -1 in case of error... */ static const char truncate_msg[12] = "[truncated] "; - memmove(head_end + sizeof(truncate_msg), head_end, + __memmove(head_end + sizeof(truncate_msg), head_end, end - head_end - sizeof(truncate_msg)); - memcpy(head_end, truncate_msg, sizeof(truncate_msg)); + __memcpy(head_end, truncate_msg, sizeof(truncate_msg)); if (p < head_end) { while (p < end && *p) { p++; @@ -227,14 +225,14 @@ vsyslog( int pri, const char *fmt, va_list ap ) /* Output to stderr if requested. */ if (LogStat & LOG_PERROR) { *last_chr = '\n'; - (void)write(STDERR_FILENO, stdp, last_chr - stdp + 1); + (void)__write(STDERR_FILENO, stdp, last_chr - stdp + 1); } /* Output the message to the local logger using NUL as a message delimiter. */ p = tbuf; *last_chr = 0; do { - rc = write(LogFile, p, last_chr + 1 - p); + rc = __write(LogFile, p, last_chr + 1 - p); if (rc < 0) { if ((errno==EAGAIN) || (errno==EINTR)) rc=0; @@ -255,12 +253,12 @@ vsyslog( int pri, const char *fmt, va_list ap ) */ /* should mode be `O_WRONLY | O_NOCTTY' ? -- Uli */ if (LogStat & LOG_CONS && - (fd = open(_PATH_CONSOLE, O_WRONLY, 0)) >= 0) { - p = strchr(tbuf, '>') + 1; + (fd = __open(_PATH_CONSOLE, O_WRONLY, 0)) >= 0) { + p = __strchr(tbuf, '>') + 1; last_chr[0] = '\r'; last_chr[1] = '\n'; - (void)write(fd, p, last_chr - p + 2); - (void)close(fd); + (void)__write(fd, p, last_chr - p + 2); + (void)__close(fd); } getout: @@ -287,7 +285,7 @@ openlog( const char *ident, int logstat, int logfac ) LogFacility = logfac; if (LogFile == -1) { SyslogAddr.sa_family = AF_UNIX; - (void)strncpy(SyslogAddr.sa_data, _PATH_LOG, + (void)__strncpy(SyslogAddr.sa_data, _PATH_LOG, sizeof(SyslogAddr.sa_data)); retry: if (LogStat & LOG_NDELAY) { @@ -301,19 +299,19 @@ retry: if (LogFile != -1 && !connected) { if (connect(LogFile, &SyslogAddr, sizeof(SyslogAddr) - - sizeof(SyslogAddr.sa_data) + strlen(SyslogAddr.sa_data)) != -1) + sizeof(SyslogAddr.sa_data) + __strlen(SyslogAddr.sa_data)) != -1) { connected = 1; } else if (logType == SOCK_DGRAM) { logType = SOCK_STREAM; if (LogFile != -1) { - close(LogFile); + __close(LogFile); LogFile = -1; } goto retry; } else { if (LogFile != -1) { - close(LogFile); + __close(LogFile); LogFile = -1; } } diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c index e1e86db91..4d3c43492 100644 --- a/libc/misc/time/time.c +++ b/libc/misc/time/time.c @@ -131,7 +131,6 @@ #define _uintmaxtostr __libc__uintmaxtostr #define strnlen __strnlen -#define memcpy __memcpy #define _GNU_SOURCE #include <stdio.h> @@ -316,23 +315,23 @@ char attribute_hidden *__asctime_r(register const struct tm *__restrict ptm, assert(buffer); #ifdef SAFE_ASCTIME_R - memcpy(buffer, at_data + 3*(7 + 12), sizeof(at_data) - 3*(7 + 12)); + __memcpy(buffer, at_data + 3*(7 + 12), sizeof(at_data) - 3*(7 + 12)); if (((unsigned int)(ptm->tm_wday)) <= 6) { - memcpy(buffer, at_data + 3 * ptm->tm_wday, 3); + __memcpy(buffer, at_data + 3 * ptm->tm_wday, 3); } if (((unsigned int)(ptm->tm_mon)) <= 11) { - memcpy(buffer + 4, at_data + 3*7 + 3 * ptm->tm_mon, 3); + __memcpy(buffer + 4, at_data + 3*7 + 3 * ptm->tm_mon, 3); } #else assert(((unsigned int)(ptm->tm_wday)) <= 6); assert(((unsigned int)(ptm->tm_mon)) <= 11); - memcpy(buffer, at_data + 3*(7 + 12) - 3, sizeof(at_data) + 3 - 3*(7 + 12)); + __memcpy(buffer, at_data + 3*(7 + 12) - 3, sizeof(at_data) + 3 - 3*(7 + 12)); - memcpy(buffer, at_data + 3 * ptm->tm_wday, 3); - memcpy(buffer + 4, at_data + 3*7 + 3 * ptm->tm_mon, 3); + __memcpy(buffer, at_data + 3 * ptm->tm_wday, 3); + __memcpy(buffer + 4, at_data + 3*7 + 3 * ptm->tm_mon, 3); #endif #ifdef SAFE_ASCTIME_R @@ -587,7 +586,7 @@ static const char *lookup_tzname(const char *key) ll_tzname_item_t *p; for (p=ll_tzname ; p ; p=p->next) { - if (!strcmp(p->tzname, key)) { + if (!__strcmp(p->tzname, key)) { return p->tzname; } } @@ -598,7 +597,7 @@ static const char *lookup_tzname(const char *key) /* Insert as 3rd item in the list. */ p->next = ll_tzname[1].next; ll_tzname[1].next = p; - strcpy(p->tzname, key); + __strcpy(p->tzname, key); return p->tzname; } } @@ -742,8 +741,8 @@ time_t timegm(struct tm *timeptr) { rule_struct gmt_tzinfo[2]; - memset(gmt_tzinfo, 0, sizeof(gmt_tzinfo)); - strcpy(gmt_tzinfo[0].tzname, "GMT"); /* Match glibc behavior here. */ + __memset(gmt_tzinfo, 0, sizeof(gmt_tzinfo)); + __strcpy(gmt_tzinfo[0].tzname, "GMT"); /* Match glibc behavior here. */ return _time_mktime_tzi(timeptr, 1, gmt_tzinfo); } @@ -1503,7 +1502,7 @@ char *__XL(strptime)(const char *__restrict buf, const char *__restrict format, do { --j; o = __XL(nl_langinfo)(i+j __LOCALE_ARG); - if (!__XL(strncasecmp)(buf,o,strlen(o) __LOCALE_ARG) && *o) { + if (!__XL(strncasecmp)(buf,o,__strlen(o) __LOCALE_ARG) && *o) { do { /* Found a match. */ ++buf; } while (*++o); @@ -1758,11 +1757,11 @@ static char *read_TZ_file(char *buf) size_t todo; char *p = NULL; - if ((fd = open(__UCLIBC_TZ_FILE_PATH__, O_RDONLY)) >= 0) { + if ((fd = __open(__UCLIBC_TZ_FILE_PATH__, O_RDONLY)) >= 0) { todo = TZ_BUFLEN; p = buf; do { - if ((r = read(fd, p, todo)) < 0) { + if ((r = __read(fd, p, todo)) < 0) { goto ERROR; } if (r == 0) { @@ -1782,7 +1781,7 @@ static char *read_TZ_file(char *buf) ERROR: p = NULL; } - close(fd); + __close(fd); } return p; } @@ -1834,8 +1833,8 @@ void tzset(void) #ifdef __UCLIBC_HAS_TZ_CACHING__ *oldval = 0; /* Set oldval to an empty string. */ #endif /* __UCLIBC_HAS_TZ_CACHING__ */ - memset(_time_tzinfo, 0, 2*sizeof(rule_struct)); - strcpy(_time_tzinfo[0].tzname, UTC); + __memset(_time_tzinfo, 0, 2*sizeof(rule_struct)); + __strcpy(_time_tzinfo[0].tzname, UTC); goto DONE; } @@ -1844,13 +1843,13 @@ void tzset(void) } #ifdef __UCLIBC_HAS_TZ_CACHING__ - if (strcmp(e, oldval) == 0) { /* Same string as last time... */ + if (__strcmp(e, oldval) == 0) { /* Same string as last time... */ goto FAST_DONE; /* So nothing to do. */ } /* Make a copy of the TZ env string. It won't be nul-terminated if * it is too long, but it that case it will be illegal and will be reset * to the empty string anyway. */ - strncpy(oldval, e, TZ_BUFLEN); + __strncpy(oldval, e, TZ_BUFLEN); #endif /* __UCLIBC_HAS_TZ_CACHING__ */ count = 0; @@ -1964,7 +1963,7 @@ void tzset(void) } } - memcpy(_time_tzinfo, new_rules, sizeof(new_rules)); + __memcpy(_time_tzinfo, new_rules, sizeof(new_rules)); DONE: tzname[0] = _time_tzinfo[0].tzname; tzname[1] = _time_tzinfo[1].tzname; @@ -2211,7 +2210,7 @@ time_t attribute_hidden _time_mktime_tzi(struct tm *timeptr, int store_on_succes register const unsigned char *s; int d, default_dst; - memcpy(p, timeptr, sizeof(struct tm)); + __memcpy(p, timeptr, sizeof(struct tm)); if (!tzi[1].tzname[0]) { /* No dst in this timezone, */ p[8] = 0; /* so set tm_isdst to 0. */ @@ -2301,7 +2300,7 @@ time_t attribute_hidden _time_mktime_tzi(struct tm *timeptr, int store_on_succes if (store_on_success) { - memcpy(timeptr, p, sizeof(struct tm)); + __memcpy(timeptr, p, sizeof(struct tm)); } diff --git a/libc/misc/ttyent/getttyent.c b/libc/misc/ttyent/getttyent.c index 7c734dc0b..c15228a24 100644 --- a/libc/misc/ttyent/getttyent.c +++ b/libc/misc/ttyent/getttyent.c @@ -52,7 +52,7 @@ struct ttyent * getttynam(const char *tty) setttyent(); while ((t = getttyent())) - if (!strcmp(tty, t->ty_name)) + if (!__strcmp(tty, t->ty_name)) break; endttyent(); return (t); @@ -98,7 +98,7 @@ static char * skip(register char *p) static char * value(register char *p) { - return ((p = strchr(p, '=')) ? ++p : NULL); + return ((p = __strchr(p, '=')) ? ++p : NULL); } struct ttyent * getttyent(void) @@ -124,7 +124,7 @@ struct ttyent * getttyent(void) return (NULL); } /* skip lines that are too big */ - if (!strchr(p, '\n')) { + if (!__strchr(p, '\n')) { while ((c = getc_unlocked(tf)) != '\n' && c != EOF) ; continue; @@ -150,8 +150,8 @@ struct ttyent * getttyent(void) tty.ty_status = 0; tty.ty_window = NULL; -#define scmp(e) !strncmp(p, e, sizeof(e) - 1) && isspace(p[sizeof(e) - 1]) -#define vcmp(e) !strncmp(p, e, sizeof(e) - 1) && p[sizeof(e) - 1] == '=' +#define scmp(e) !__strncmp(p, e, sizeof(e) - 1) && isspace(p[sizeof(e) - 1]) +#define vcmp(e) !__strncmp(p, e, sizeof(e) - 1) && p[sizeof(e) - 1] == '=' for (; *p; p = skip(p)) { if (scmp(_TTYS_OFF)) tty.ty_status &= ~TTY_ON; @@ -173,7 +173,7 @@ struct ttyent * getttyent(void) tty.ty_comment = p; if (*p == 0) tty.ty_comment = 0; - if ((p = strchr(p, '\n'))) + if ((p = __strchr(p, '\n'))) *p = '\0'; return (&tty); } diff --git a/libc/misc/utmp/utent.c b/libc/misc/utmp/utent.c index aa74cb544..c3d9ab620 100644 --- a/libc/misc/utmp/utent.c +++ b/libc/misc/utmp/utent.c @@ -53,7 +53,7 @@ static struct utmp *__getutent(int utmp_fd) } LOCK; - if (read(utmp_fd, (char *) &static_utmp, sizeof(struct utmp)) != sizeof(struct utmp)) + if (__read(utmp_fd, (char *) &static_utmp, sizeof(struct utmp)) != sizeof(struct utmp)) { return NULL; } @@ -68,8 +68,8 @@ void setutent(void) LOCK; if (static_fd == -1) { - if ((static_fd = open(static_ut_name, O_RDWR)) < 0) { - if ((static_fd = open(static_ut_name, O_RDONLY)) < 0) { + if ((static_fd = __open(static_ut_name, O_RDWR)) < 0) { + if ((static_fd = __open(static_ut_name, O_RDONLY)) < 0) { goto bummer; } } @@ -82,7 +82,7 @@ void setutent(void) bummer: UNLOCK; static_fd = -1; - close(static_fd); + __close(static_fd); return; } } @@ -95,7 +95,7 @@ void endutent(void) { LOCK; if (static_fd != -1) { - close(static_fd); + __close(static_fd); } static_fd = -1; UNLOCK; @@ -125,7 +125,7 @@ struct utmp attribute_hidden *__getutid (const struct utmp *utmp_entry) utmp_entry->ut_type == DEAD_PROCESS || utmp_entry->ut_type == LOGIN_PROCESS || utmp_entry->ut_type == USER_PROCESS) && - !strncmp(lutmp->ut_id, utmp_entry->ut_id, sizeof(lutmp->ut_id))) + !__strncmp(lutmp->ut_id, utmp_entry->ut_id, sizeof(lutmp->ut_id))) { return lutmp; } @@ -142,7 +142,7 @@ struct utmp *getutline(const struct utmp *utmp_entry) while ((lutmp = __getutent(static_fd)) != NULL) { if ((lutmp->ut_type == USER_PROCESS || lutmp->ut_type == LOGIN_PROCESS) && - !strcmp(lutmp->ut_line, utmp_entry->ut_line)) + !__strcmp(lutmp->ut_line, utmp_entry->ut_line)) { return lutmp; } @@ -162,11 +162,11 @@ struct utmp *pututline (const struct utmp *utmp_entry) if (__getutid(utmp_entry) != NULL) { lseek(static_fd, (off_t) - sizeof(struct utmp), SEEK_CUR); - if (write(static_fd, utmp_entry, sizeof(struct utmp)) != sizeof(struct utmp)) + if (__write(static_fd, utmp_entry, sizeof(struct utmp)) != sizeof(struct utmp)) return NULL; } else { lseek(static_fd, (off_t) 0, SEEK_END); - if (write(static_fd, utmp_entry, sizeof(struct utmp)) != sizeof(struct utmp)) + if (__write(static_fd, utmp_entry, sizeof(struct utmp)) != sizeof(struct utmp)) return NULL; } @@ -180,7 +180,7 @@ int utmpname (const char *new_ut_name) if (new_ut_name != NULL) { if (static_ut_name != default_file_name) free((char *)static_ut_name); - static_ut_name = strdup(new_ut_name); + static_ut_name = __strdup(new_ut_name); if (static_ut_name == NULL) { /* We should probably whine about out-of-memory * errors here... Instead just reset to the default */ @@ -189,7 +189,7 @@ int utmpname (const char *new_ut_name) } if (static_fd != -1) - close(static_fd); + __close(static_fd); UNLOCK; return 0; } diff --git a/libc/misc/utmp/wtent.c b/libc/misc/utmp/wtent.c index ef5663feb..bb5244878 100644 --- a/libc/misc/utmp/wtent.c +++ b/libc/misc/utmp/wtent.c @@ -31,13 +31,13 @@ void logwtmp (const char *line, const char *name, const char *host) { struct utmp lutmp; - memset (&(lutmp), 0, sizeof (struct utmp)); + __memset (&(lutmp), 0, sizeof (struct utmp)); lutmp.ut_type = (name && *name)? USER_PROCESS : DEAD_PROCESS; lutmp.ut_pid = getpid(); - strncpy(lutmp.ut_line, line, sizeof(lutmp.ut_line)-1); - strncpy(lutmp.ut_name, name, sizeof(lutmp.ut_name)-1); - strncpy(lutmp.ut_host, host, sizeof(lutmp.ut_host)-1); + __strncpy(lutmp.ut_line, line, sizeof(lutmp.ut_line)-1); + __strncpy(lutmp.ut_name, name, sizeof(lutmp.ut_name)-1); + __strncpy(lutmp.ut_host, host, sizeof(lutmp.ut_host)-1); gettimeofday(&(lutmp.ut_tv), NULL); updwtmp(_PATH_WTMP, &(lutmp)); @@ -48,12 +48,12 @@ extern void updwtmp(const char *wtmp_file, const struct utmp *lutmp) { int fd; - fd = open(wtmp_file, O_APPEND | O_WRONLY, 0); + fd = __open(wtmp_file, O_APPEND | O_WRONLY, 0); if (fd >= 0) { if (lockf(fd, F_LOCK, 0)==0) { - write(fd, (const char *) lutmp, sizeof(struct utmp)); + __write(fd, (const char *) lutmp, sizeof(struct utmp)); lockf(fd, F_ULOCK, 0); - close(fd); + __close(fd); } } } diff --git a/libc/misc/wchar/wchar.c b/libc/misc/wchar/wchar.c index 055900827..1691e00e0 100644 --- a/libc/misc/wchar/wchar.c +++ b/libc/misc/wchar/wchar.c @@ -98,8 +98,6 @@ * Manuel */ -#define memmove __memmove - #define _GNU_SOURCE #define _ISOC99_SOURCE #include <errno.h> @@ -1620,7 +1618,7 @@ int main(int argc, char **argv) break; } do { - if ((s = strchr(opt_chars,*p)) == NULL) { + if ((s = __strchr(opt_chars,*p)) == NULL) { USAGE: s = basename(progname); fprintf(stderr, @@ -1697,7 +1695,7 @@ int main(int argc, char **argv) } } if (ni) { /* still bytes in buffer! */ - memmove(ibuf, pi, ni); + __memmove(ibuf, pi, ni); } } diff --git a/libc/misc/wctype/wctype.c b/libc/misc/wctype/wctype.c index ba902ba74..aa2b97d60 100644 --- a/libc/misc/wctype/wctype.c +++ b/libc/misc/wctype/wctype.c @@ -490,7 +490,7 @@ wctype_t attribute_hidden __wctype(const char *property) p = typestring; i = 1; do { - if (!strcmp(property, ++p)) { + if (!__strcmp(property, ++p)) { return i; } ++i; @@ -886,7 +886,7 @@ wctrans_t wctrans(const char *property) p = transstring; i = 1; do { - if (!strcmp(property, ++p)) { + if (!__strcmp(property, ++p)) { return i; } ++i; diff --git a/libc/misc/wordexp/wordexp.c b/libc/misc/wordexp/wordexp.c index da20ad0a4..5e9133c83 100644 --- a/libc/misc/wordexp/wordexp.c +++ b/libc/misc/wordexp/wordexp.c @@ -19,7 +19,7 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define mempcpy __libc_mempcpy +#define mempcpy __mempcpy #define strndup __strndup #define strspn __strspn #define unsetenv __unsetenv @@ -135,7 +135,7 @@ static char *w_addstr(char *buffer, size_t * actlen, size_t * maxlen, { size_t len; assert(str != NULL); /* w_addstr only called from this file */ - len = strlen(str); + len = __strlen(str); return w_addmem(buffer, actlen, maxlen, str, len); } @@ -150,7 +150,7 @@ static int w_addword(wordexp_t * pwordexp, char *word) * the caller sees them. */ if (word == NULL) { - word = strdup(""); + word = __strdup(""); if (word == NULL) goto no_space; } @@ -252,7 +252,7 @@ parse_tilde(char **word, size_t * word_length, size_t * max_length, if (*word_length != 0) { if (!((*word)[*word_length - 1] == '=' && wordc == 0)) { if (!((*word)[*word_length - 1] == ':' - && strchr(*word, '=') && wordc == 0)) { + && __strchr(*word, '=') && wordc == 0)) { *word = w_addchar(*word, word_length, max_length, '~'); return *word ? 0 : WRDE_NOSPACE; } @@ -377,7 +377,7 @@ do_parse_glob(const char *glob_word, char **word, size_t * word_length, } for (match = 0; match < globbuf.gl_pathc; ++match) { - char *matching_word = strdup(globbuf.gl_pathv[match]); + char *matching_word = __strdup(globbuf.gl_pathv[match]); if (matching_word == NULL || w_addword(pwordexp, matching_word)) { globfree(&globbuf); @@ -404,8 +404,8 @@ parse_glob(char **word, size_t * word_length, size_t * max_length, glob_list.we_wordv = NULL; glob_list.we_offs = 0; for (; words[*offset] != '\0'; ++*offset) { - if ((ifs && strchr(ifs, words[*offset])) || - (!ifs && strchr(" \t\n", words[*offset]))) + if ((ifs && __strchr(ifs, words[*offset])) || + (!ifs && __strchr(" \t\n", words[*offset]))) /* Reached IFS */ break; @@ -762,24 +762,24 @@ exec_comm_child(char *comm, int *fildes, int showerr, int noexec) /* Redirect output. */ dup2(fildes[1], 1); - close(fildes[1]); + __close(fildes[1]); /* Redirect stderr to /dev/null if we have to. */ if (showerr == 0) { int fd; - close(2); - fd = open(_PATH_DEVNULL, O_WRONLY); + __close(2); + fd = __open(_PATH_DEVNULL, O_WRONLY); if (fd >= 0 && fd != 2) { dup2(fd, 2); - close(fd); + __close(fd); } } /* Make sure the subshell doesn't field-split on our behalf. */ unsetenv("IFS"); - close(fildes[0]); + __close(fildes[0]); execve(_PATH_BSHELL, (char *const *) args, __environ); /* Bad. What now? */ @@ -812,8 +812,8 @@ exec_comm(char *comm, char **word, size_t * word_length, if ((pid = fork()) < 0) { /* Bad */ - close(fildes[0]); - close(fildes[1]); + __close(fildes[0]); + __close(fildes[1]); return WRDE_NOSPACE; } @@ -822,17 +822,17 @@ exec_comm(char *comm, char **word, size_t * word_length, /* Parent */ - close(fildes[1]); + __close(fildes[1]); buffer = alloca(bufsize); if (!pwordexp) /* Quoted - no field splitting */ { while (1) { - if ((buflen = read(fildes[0], buffer, bufsize)) < 1) { + if ((buflen = __read(fildes[0], buffer, bufsize)) < 1) { if (waitpid(pid, &status, WNOHANG) == 0) continue; - if ((buflen = read(fildes[0], buffer, bufsize)) < 1) + if ((buflen = __read(fildes[0], buffer, bufsize)) < 1) break; } @@ -855,17 +855,17 @@ exec_comm(char *comm, char **word, size_t * word_length, */ while (1) { - if ((buflen = read(fildes[0], buffer, bufsize)) < 1) { + if ((buflen = __read(fildes[0], buffer, bufsize)) < 1) { if (waitpid(pid, &status, WNOHANG) == 0) continue; - if ((buflen = read(fildes[0], buffer, bufsize)) < 1) + if ((buflen = __read(fildes[0], buffer, bufsize)) < 1) break; } for (i = 0; i < buflen; ++i) { - if (strchr(ifs, buffer[i]) != NULL) { + if (__strchr(ifs, buffer[i]) != NULL) { /* Current character is IFS */ - if (strchr(ifs_white, buffer[i]) == NULL) { + if (__strchr(ifs_white, buffer[i]) == NULL) { /* Current character is IFS but not whitespace */ if (copying == 2) { /* current character @@ -959,7 +959,7 @@ exec_comm(char *comm, char **word, size_t * word_length, } } - close(fildes[0]); + __close(fildes[0]); /* Check for syntax error (re-execute but with "-n" flag) */ if (buflen < 1 && status != 0) { @@ -982,7 +982,7 @@ exec_comm(char *comm, char **word, size_t * word_length, no_space: kill(pid, SIGKILL); waitpid(pid, NULL, 0); - close(fildes[0]); + __close(fildes[0]); return WRDE_NOSPACE; } @@ -1181,7 +1181,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, goto envsubst; } while (isdigit(words[++*offset])); - } else if (strchr("*@$", words[*offset]) != NULL) { + } else if (__strchr("*@$", words[*offset]) != NULL) { /* Special parameter. */ special = 1; env = w_addchar(env, &env_length, &env_maxlen, words[*offset]); @@ -1217,7 +1217,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, break; case ':': - if (strchr("-=?+", words[1 + *offset]) == NULL) + if (__strchr("-=?+", words[1 + *offset]) == NULL) goto syntax; colon_seen = 1; @@ -1349,7 +1349,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, /* Build up value parameter by parameter (copy them) */ for (p = 1; __libc_argv[p]; ++p) - plist_len += strlen(__libc_argv[p]) + 1; /* for space */ + plist_len += __strlen(__libc_argv[p]) + 1; /* for space */ value = malloc(plist_len); if (value == NULL) goto no_space; @@ -1379,7 +1379,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, goto no_space; for (p = 2; __libc_argv[p + 1]; p++) { - char *newword = strdup(__libc_argv[p]); + char *newword = __strdup(__libc_argv[p]); if (newword == NULL || w_addword(pwordexp, newword)) goto no_space; @@ -1559,7 +1559,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, if (value == NULL || pattern == NULL || *pattern == '\0') break; - end = value + strlen(value); + end = value + __strlen(value); switch (action) { case ACT_RP_SHORT_LEFT: @@ -1569,7 +1569,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, if (fnmatch(pattern, value, 0) != FNM_NOMATCH) { *p = c; if (free_value) { - char *newval = strdup(p); + char *newval = __strdup(p); if (newval == NULL) { free(value); @@ -1593,7 +1593,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, if (fnmatch(pattern, value, 0) != FNM_NOMATCH) { *p = c; if (free_value) { - char *newval = strdup(p); + char *newval = __strdup(p); if (newval == NULL) { free(value); @@ -1697,7 +1697,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, /* Substitute NULL */ goto success; - value = pattern ? strdup(pattern) : pattern; + value = pattern ? __strdup(pattern) : pattern; free_value = 1; if (pattern && !value) @@ -1710,7 +1710,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, if (free_value && value) free(value); - value = pattern ? strdup(pattern) : pattern; + value = pattern ? __strdup(pattern) : pattern; free_value = 1; if (pattern && !value) @@ -1739,7 +1739,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, if (free_value && value) free(value); - value = pattern ? strdup(pattern) : pattern; + value = pattern ? __strdup(pattern) : pattern; free_value = 1; if (pattern && !value) @@ -1763,7 +1763,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, param_length[20] = '\0'; *word = w_addstr(*word, word_length, max_length, - _itoa(value ? strlen(value) : 0, + _itoa(value ? __strlen(value) : 0, ¶m_length[20])); if (free_value) { assert(value != NULL); @@ -1785,7 +1785,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, return *word ? 0 : WRDE_NOSPACE; } else { /* Need to field-split */ - char *value_copy = strdup(value); /* Don't modify value */ + char *value_copy = __strdup(value); /* Don't modify value */ char *field_begin = value_copy; int seen_nonws_ifs = 0; @@ -1825,7 +1825,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, /* Skip at most one non-whitespace IFS character after the field */ seen_nonws_ifs = 0; - if (*next_field && strchr(ifs, *next_field)) { + if (*next_field && __strchr(ifs, *next_field)) { seen_nonws_ifs = 1; next_field++; } @@ -2071,7 +2071,7 @@ int wordexp(const char *words, wordexp_t * we, int flags) if (!ifs) /* IFS unset - use <space><tab><newline>. */ - ifs = strcpy(ifs_white, " \t\n"); + ifs = __strcpy(ifs_white, " \t\n"); else { char *ifsch = ifs; char *whch = ifs_white; @@ -2190,11 +2190,11 @@ int wordexp(const char *words, wordexp_t * we, int flags) default: /* Is it a word separator? */ - if (strchr(" \t", words[words_offset]) == NULL) { + if (__strchr(" \t", words[words_offset]) == NULL) { char ch = words[words_offset]; /* Not a word separator -- but is it a valid word char? */ - if (strchr("\n|&;<>(){}", ch)) { + if (__strchr("\n|&;<>(){}", ch)) { /* Fail */ error = WRDE_BADCHAR; goto do_error; diff --git a/libc/pwd_grp/lckpwdf.c b/libc/pwd_grp/lckpwdf.c index 6b9c2519b..bac807e6f 100644 --- a/libc/pwd_grp/lckpwdf.c +++ b/libc/pwd_grp/lckpwdf.c @@ -64,7 +64,7 @@ int lckpwdf (void) LOCK; - lock_fd = open (_PATH_PASSWD, O_WRONLY); + lock_fd = __open (_PATH_PASSWD, O_WRONLY); if (lock_fd == -1) { /* Cannot create lock file. */ UNLOCK; @@ -75,7 +75,7 @@ int lckpwdf (void) flags = fcntl (lock_fd, F_GETFD, 0); if (flags == -1) { /* Cannot get file flags. */ - close(lock_fd); + __close(lock_fd); lock_fd = -1; UNLOCK; return -1; @@ -83,7 +83,7 @@ int lckpwdf (void) flags |= FD_CLOEXEC; /* Close on exit. */ if (fcntl (lock_fd, F_SETFD, flags) < 0) { /* Cannot set new flags. */ - close(lock_fd); + __close(lock_fd); lock_fd = -1; UNLOCK; return -1; @@ -97,7 +97,7 @@ int lckpwdf (void) It is important that we don't change the signal state. We must restore the old signal behaviour. */ - memset (&new_act, '\0', sizeof (struct sigaction)); + __memset (&new_act, '\0', sizeof (struct sigaction)); new_act.sa_handler = noop_handler; sigfillset (&new_act.sa_mask); new_act.sa_flags = 0ul; @@ -105,7 +105,7 @@ int lckpwdf (void) /* Install new action handler for alarm and save old. */ if (sigaction (SIGALRM, &new_act, &saved_act) < 0) { /* Cannot install signal handler. */ - close(lock_fd); + __close(lock_fd); lock_fd = -1; UNLOCK; return -1; @@ -114,9 +114,9 @@ int lckpwdf (void) /* Now make sure the alarm signal is not blocked. */ sigemptyset (&new_set); sigaddset (&new_set, SIGALRM); - if (sigprocmask (SIG_UNBLOCK, &new_set, &saved_set) < 0) { + if (__sigprocmask (SIG_UNBLOCK, &new_set, &saved_set) < 0) { sigaction (SIGALRM, &saved_act, NULL); - close(lock_fd); + __close(lock_fd); lock_fd = -1; UNLOCK; return -1; @@ -127,7 +127,7 @@ int lckpwdf (void) alarm (TIMEOUT); /* Try to get the lock. */ - memset (&fl, '\0', sizeof (struct flock)); + __memset (&fl, '\0', sizeof (struct flock)); fl.l_type = F_WRLCK; fl.l_whence = SEEK_SET; result = fcntl (lock_fd, F_SETLKW, &fl); @@ -137,14 +137,14 @@ int lckpwdf (void) /* Restore old set of handled signals. We don't need to know about the current one.*/ - sigprocmask (SIG_SETMASK, &saved_set, NULL); + __sigprocmask (SIG_SETMASK, &saved_set, NULL); /* Restore old action handler for alarm. We don't need to know about the current one. */ sigaction (SIGALRM, &saved_act, NULL); if (result < 0) { - close(lock_fd); + __close(lock_fd); lock_fd = -1; UNLOCK; return -1; @@ -165,7 +165,7 @@ int ulckpwdf (void) } else { LOCK; - result = close (lock_fd); + result = __close (lock_fd); /* Mark descriptor as unused. */ lock_fd = -1; UNLOCK; diff --git a/libc/pwd_grp/pwd_grp.c b/libc/pwd_grp/pwd_grp.c index 2682b83a1..3baa0ad33 100644 --- a/libc/pwd_grp/pwd_grp.c +++ b/libc/pwd_grp/pwd_grp.c @@ -190,10 +190,10 @@ int sgetspent_r(const char *string, struct spwd *result_buf, } if (string != buffer) { - if (strlen(string) >= buflen) { + if (__strlen(string) >= buflen) { goto DO_ERANGE; } - strcpy(buffer, string); + __strcpy(buffer, string); } if (!(rv = __parsespent(result_buf, buffer))) { @@ -215,7 +215,7 @@ int sgetspent_r(const char *string, struct spwd *result_buf, #define GETXXKEY_R_FUNC getpwnam_r #define GETXXKEY_R_PARSER __parsepwent #define GETXXKEY_R_ENTTYPE struct passwd -#define GETXXKEY_R_TEST(ENT) (!strcmp((ENT)->pw_name, key)) +#define GETXXKEY_R_TEST(ENT) (!__strcmp((ENT)->pw_name, key)) #define DO_GETXXKEY_R_KEYTYPE const char *__restrict #define DO_GETXXKEY_R_PATHNAME _PATH_PASSWD #include "pwd_grp_internal.c" @@ -225,7 +225,7 @@ int sgetspent_r(const char *string, struct spwd *result_buf, #define GETXXKEY_R_FUNC getgrnam_r #define GETXXKEY_R_PARSER __parsegrent #define GETXXKEY_R_ENTTYPE struct group -#define GETXXKEY_R_TEST(ENT) (!strcmp((ENT)->gr_name, key)) +#define GETXXKEY_R_TEST(ENT) (!__strcmp((ENT)->gr_name, key)) #define DO_GETXXKEY_R_KEYTYPE const char *__restrict #define DO_GETXXKEY_R_PATHNAME _PATH_GROUP #include "pwd_grp_internal.c" @@ -235,7 +235,7 @@ int sgetspent_r(const char *string, struct spwd *result_buf, #define GETXXKEY_R_FUNC getspnam_r #define GETXXKEY_R_PARSER __parsespent #define GETXXKEY_R_ENTTYPE struct spwd -#define GETXXKEY_R_TEST(ENT) (!strcmp((ENT)->sp_namp, key)) +#define GETXXKEY_R_TEST(ENT) (!__strcmp((ENT)->sp_namp, key)) #define DO_GETXXKEY_R_KEYTYPE const char *__restrict #define DO_GETXXKEY_R_PATHNAME _PATH_SHADOW #include "pwd_grp_internal.c" @@ -658,7 +658,7 @@ int initgroups(const char *user, gid_t gid) assert(group.gr_mem); /* Must have at least a NULL terminator. */ if (group.gr_gid != gid) { for (m=group.gr_mem ; *m ; m++) { - if (!strcmp(*m, user)) { + if (!__strcmp(*m, user)) { if (!(num_groups & 7)) { gid_t *tmp = (gid_t *) realloc(group_list, @@ -851,7 +851,7 @@ int attribute_hidden __parsepwent(void *data, char *line) /* NOTE: glibc difference - glibc allows omission of * ':' seperators after the gid field if all remaining * entries are empty. We require all separators. */ - if (!(line = strchr(line, ':'))) { + if (!(line = __strchr(line, ':'))) { break; } } else { @@ -903,7 +903,7 @@ int attribute_hidden __parsegrent(void *data, char *line) if (i < 2) { *((char **) p) = line; - if (!(line = strchr(line, ':'))) { + if (!(line = __strchr(line, ':'))) { break; } *line++ = 0; @@ -1003,7 +1003,7 @@ int attribute_hidden __parsespent(void *data, char * line) p = ((char *) ((struct spwd *) data)) + sp_off[i]; if (i < 2) { *((char **) p) = line; - if (!(line = strchr(line, ':'))) { + if (!(line = __strchr(line, ':'))) { break; } } else { @@ -1080,7 +1080,7 @@ int attribute_hidden __pgsreader(int (*__parserfunc)(void *d, char *line), void break; } - line_len = strlen(line_buff) - 1; /* strlen() must be > 0. */ + line_len = __strlen(line_buff) - 1; /* strlen() must be > 0. */ if (line_buff[line_len] == '\n') { line_buff[line_len] = 0; } else if (line_len + 2 == buflen) { /* line too long */ diff --git a/libc/signal/sigaction.c b/libc/signal/sigaction.c index 0ead76ef6..5a56ed1e6 100644 --- a/libc/signal/sigaction.c +++ b/libc/signal/sigaction.c @@ -45,7 +45,7 @@ __libc_sigaction (sig, act, oact) if (act) { kact.k_sa_handler = act->sa_handler; - memcpy (&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask)); + __memcpy (&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask)); kact.sa_flags = act->sa_flags; # ifdef HAVE_SA_RESTORER kact.sa_restorer = act->sa_restorer; @@ -60,7 +60,7 @@ __libc_sigaction (sig, act, oact) if (oact && result >= 0) { oact->sa_handler = koact.k_sa_handler; - memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (oact->sa_mask)); + __memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (oact->sa_mask)); oact->sa_flags = koact.sa_flags; # ifdef HAVE_SA_RESTORER oact->sa_restorer = koact.sa_restorer; diff --git a/libc/signal/sigblock.c b/libc/signal/sigblock.c index 62ef060ac..70af609aa 100644 --- a/libc/signal/sigblock.c +++ b/libc/signal/sigblock.c @@ -29,7 +29,7 @@ int __sigblock (int mask) if (sigset_set_old_mask (&set, mask) < 0) return -1; - if (sigprocmask (SIG_BLOCK, &set, &oset) < 0) + if (__sigprocmask (SIG_BLOCK, &set, &oset) < 0) return -1; return sigset_get_old_mask (&oset); diff --git a/libc/signal/sigempty.c b/libc/signal/sigempty.c index 75b5be420..777edbdd5 100644 --- a/libc/signal/sigempty.c +++ b/libc/signal/sigempty.c @@ -31,7 +31,7 @@ sigemptyset (set) return -1; } - memset (set, 0, sizeof (sigset_t)); + __memset (set, 0, sizeof (sigset_t)); return 0; } diff --git a/libc/signal/sigfillset.c b/libc/signal/sigfillset.c index 03361787e..f06334216 100644 --- a/libc/signal/sigfillset.c +++ b/libc/signal/sigfillset.c @@ -31,7 +31,7 @@ sigfillset (set) return -1; } - memset (set, 0xff, sizeof (sigset_t)); + __memset (set, 0xff, sizeof (sigset_t)); /* If the implementation uses a cancellation signal don't set the bit. */ #ifdef SIGCANCEL diff --git a/libc/signal/sighold.c b/libc/signal/sighold.c index 670a4872e..29b452f63 100644 --- a/libc/signal/sighold.c +++ b/libc/signal/sighold.c @@ -30,7 +30,7 @@ sighold (sig) sigset_t set; /* Retrieve current signal set. */ - if (sigprocmask (SIG_SETMASK, NULL, &set) < 0) + if (__sigprocmask (SIG_SETMASK, NULL, &set) < 0) return -1; /* Add the specified signal. */ @@ -38,5 +38,5 @@ sighold (sig) return -1; /* Set the new mask. */ - return sigprocmask (SIG_SETMASK, &set, NULL); + return __sigprocmask (SIG_SETMASK, &set, NULL); } diff --git a/libc/signal/sigjmp.c b/libc/signal/sigjmp.c index 59fe6db7a..37f19595a 100644 --- a/libc/signal/sigjmp.c +++ b/libc/signal/sigjmp.c @@ -27,7 +27,7 @@ int __sigjmp_save (sigjmp_buf env, int savemask) { env[0].__mask_was_saved = (savemask && - sigprocmask (SIG_BLOCK, (sigset_t *) NULL, &env[0].__saved_mask) == 0); + __sigprocmask (SIG_BLOCK, (sigset_t *) NULL, &env[0].__saved_mask) == 0); return 0; } diff --git a/libc/signal/sigpause.c b/libc/signal/sigpause.c index e25803a9b..35d58c680 100644 --- a/libc/signal/sigpause.c +++ b/libc/signal/sigpause.c @@ -32,7 +32,7 @@ int __sigpause (int sig_or_mask, int is_sig) if (is_sig != 0) { /* The modern X/Open implementation is requested. */ - if (sigprocmask (0, NULL, &set) < 0 + if (__sigprocmask (0, NULL, &set) < 0 /* Yes, we call `sigdelset' and not `__sigdelset'. */ || sigdelset (&set, sig_or_mask) < 0) return -1; diff --git a/libc/signal/sigrelse.c b/libc/signal/sigrelse.c index 091f97de5..5519480e1 100644 --- a/libc/signal/sigrelse.c +++ b/libc/signal/sigrelse.c @@ -30,7 +30,7 @@ sigrelse (sig) sigset_t set; /* Retrieve current signal set. */ - if (sigprocmask (SIG_SETMASK, NULL, &set) < 0) + if (__sigprocmask (SIG_SETMASK, NULL, &set) < 0) return -1; /* Remove the specified signal. */ @@ -38,5 +38,5 @@ sigrelse (sig) return -1; /* Set the new mask. */ - return sigprocmask (SIG_SETMASK, &set, NULL); + return __sigprocmask (SIG_SETMASK, &set, NULL); } diff --git a/libc/signal/sigset.c b/libc/signal/sigset.c index 0ce411c8c..350e3cb2d 100644 --- a/libc/signal/sigset.c +++ b/libc/signal/sigset.c @@ -46,7 +46,7 @@ sigset (sig, disp) return SIG_ERR; /* Add the signal set to the current signal mask. */ - if (sigprocmask (SIG_BLOCK, &set, NULL) < 0) + if (__sigprocmask (SIG_BLOCK, &set, NULL) < 0) return SIG_ERR; return SIG_HOLD; @@ -76,7 +76,7 @@ sigset (sig, disp) return SIG_ERR; /* Remove the signal set from the current signal mask. */ - if (sigprocmask (SIG_UNBLOCK, &set, NULL) < 0) + if (__sigprocmask (SIG_UNBLOCK, &set, NULL) < 0) return SIG_ERR; return oact.sa_handler; diff --git a/libc/signal/sigsetmask.c b/libc/signal/sigsetmask.c index 4b27b54a9..1c16d6411 100644 --- a/libc/signal/sigsetmask.c +++ b/libc/signal/sigsetmask.c @@ -30,7 +30,7 @@ __sigsetmask (int mask) if (sigset_set_old_mask (&set, mask) < 0) return -1; - if (sigprocmask (SIG_SETMASK, &set, &oset) < 0) + if (__sigprocmask (SIG_SETMASK, &set, &oset) < 0) return -1; diff --git a/libc/stdio/_cs_funcs.c b/libc/stdio/_cs_funcs.c index 9df93f227..3bec64c19 100644 --- a/libc/stdio/_cs_funcs.c +++ b/libc/stdio/_cs_funcs.c @@ -13,14 +13,14 @@ ssize_t attribute_hidden _cs_read(void *cookie, char *buf, size_t bufsize) { - return read(*((int *) cookie), buf, bufsize); + return __read(*((int *) cookie), buf, bufsize); } /**********************************************************************/ ssize_t attribute_hidden _cs_write(void *cookie, const char *buf, size_t bufsize) { - return write(*((int *) cookie), (char *) buf, bufsize); + return __write(*((int *) cookie), (char *) buf, bufsize); } /**********************************************************************/ @@ -42,7 +42,7 @@ int attribute_hidden _cs_seek(void *cookie, register __offmax_t *pos, int whence int attribute_hidden _cs_close(void *cookie) { - return close(*((int *) cookie)); + return __close(*((int *) cookie)); } /**********************************************************************/ diff --git a/libc/stdio/_fopen.c b/libc/stdio/_fopen.c index 8ab314612..e33c50f0a 100644 --- a/libc/stdio/_fopen.c +++ b/libc/stdio/_fopen.c @@ -128,7 +128,7 @@ FILE attribute_hidden *_stdio_fopen(intptr_t fname_or_mode, & O_LARGEFILE) ); } else { __STDIO_WHEN_LFS( if (filedes < -1) open_mode |= O_LARGEFILE ); - if ((stream->__filedes = open(((const char *) fname_or_mode), + if ((stream->__filedes = __open(((const char *) fname_or_mode), open_mode, 0666)) < 0) { goto FREE_STREAM; } diff --git a/libc/stdio/_fpmaxtostr.c b/libc/stdio/_fpmaxtostr.c index 9ffa5493e..2024caca1 100644 --- a/libc/stdio/_fpmaxtostr.c +++ b/libc/stdio/_fpmaxtostr.c @@ -417,7 +417,7 @@ ssize_t attribute_hidden _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info if (mode == 'f') { round += exp; if (round < -1) { - memset(buf, '0', DECIMAL_DIG); /* OK, since 'f' -> decimal case. */ + __memset(buf, '0', DECIMAL_DIG); /* OK, since 'f' -> decimal case. */ exp = -1; round = -1; } diff --git a/libc/stdio/_fwrite.c b/libc/stdio/_fwrite.c index 6657b0849..600b15e6d 100644 --- a/libc/stdio/_fwrite.c +++ b/libc/stdio/_fwrite.c @@ -35,7 +35,7 @@ size_t attribute_hidden __stdio_fwrite(const unsigned char * __restrict buffer, if (pending > bytes) { pending = bytes; } - memcpy(stream->__bufpos, buffer, pending); + __memcpy(stream->__bufpos, buffer, pending); stream->__bufpos += pending; __STDIO_STREAM_VALIDATE(stream); return bytes; @@ -43,7 +43,7 @@ size_t attribute_hidden __stdio_fwrite(const unsigned char * __restrict buffer, /* RETRY: */ if (bytes <= __STDIO_STREAM_BUFFER_WAVAIL(stream)) { - memcpy(stream->__bufpos, buffer, bytes); + __memcpy(stream->__bufpos, buffer, bytes); stream->__bufpos += bytes; if (__STDIO_STREAM_IS_LBF(stream) && memrchr(buffer, '\n', bytes) /* Search backwards. */ diff --git a/libc/stdio/_stdio.c b/libc/stdio/_stdio.c index c71de343d..b5f11419c 100644 --- a/libc/stdio/_stdio.c +++ b/libc/stdio/_stdio.c @@ -167,7 +167,7 @@ void attribute_hidden __stdio_init_mutex(pthread_mutex_t *m) static const pthread_mutex_t __stdio_mutex_initializer = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; - memcpy(m, &__stdio_mutex_initializer, sizeof(__stdio_mutex_initializer)); + __memcpy(m, &__stdio_mutex_initializer, sizeof(__stdio_mutex_initializer)); } #endif diff --git a/libc/stdio/_uintmaxtostr.c b/libc/stdio/_uintmaxtostr.c index da7ebc766..847d23560 100644 --- a/libc/stdio/_uintmaxtostr.c +++ b/libc/stdio/_uintmaxtostr.c @@ -61,7 +61,7 @@ char attribute_hidden *__libc__uintmaxtostr(register char * __restrict bufend, u #ifndef __LOCALE_C_ONLY if (!grouping) { /* Finished a group. */ bufend -= __UCLIBC_CURLOCALE_DATA.thousands_sep_len; - memcpy(bufend, __UCLIBC_CURLOCALE_DATA.thousands_sep, + __memcpy(bufend, __UCLIBC_CURLOCALE_DATA.thousands_sep, __UCLIBC_CURLOCALE_DATA.thousands_sep_len); if (g[1] != 0) { /* g[1] == 0 means repeat last grouping. */ /* Note: g[1] == -1 means no further grouping. But since @@ -79,7 +79,7 @@ char attribute_hidden *__libc__uintmaxtostr(register char * __restrict bufend, u #ifndef __LOCALE_C_ONLY if (unlikely(outdigit)) { bufend -= __UCLIBC_CURLOCALE_DATA.outdigit_length[digit]; - memcpy(bufend, + __memcpy(bufend, (&__UCLIBC_CURLOCALE_DATA.outdigit0_mb)[digit], __UCLIBC_CURLOCALE_DATA.outdigit_length[digit]); } else @@ -104,7 +104,7 @@ char attribute_hidden *__libc__uintmaxtostr(register char * __restrict bufend, u #ifndef __LOCALE_C_ONLY if (!grouping) { /* Finished a group. */ bufend -= __UCLIBC_CURLOCALE_DATA.thousands_sep_len; - memcpy(bufend, __UCLIBC_CURLOCALE_DATA.thousands_sep, + __memcpy(bufend, __UCLIBC_CURLOCALE_DATA.thousands_sep, __UCLIBC_CURLOCALE_DATA.thousands_sep_len); if (g[1] != 0) { /* g[1] == 0 means repeat last grouping. */ /* Note: g[1] == -1 means no further grouping. But since @@ -131,7 +131,7 @@ char attribute_hidden *__libc__uintmaxtostr(register char * __restrict bufend, u #ifndef __LOCALE_C_ONLY if (unlikely(outdigit)) { bufend -= __UCLIBC_CURLOCALE_DATA.outdigit_length[digit]; - memcpy(bufend, + __memcpy(bufend, (&__UCLIBC_CURLOCALE_DATA.outdigit0_mb)[digit], __UCLIBC_CURLOCALE_DATA.outdigit_length[digit]); } else diff --git a/libc/stdio/ctermid.c b/libc/stdio/ctermid.c index 118608780..11e43f336 100644 --- a/libc/stdio/ctermid.c +++ b/libc/stdio/ctermid.c @@ -21,6 +21,6 @@ char *ctermid(register char *s) return s; #else /* glibc always returns /dev/tty for linux. */ - return strcpy((s ? s : sbuf), "/dev/tty"); + return __strcpy((s ? s : sbuf), "/dev/tty"); #endif } diff --git a/libc/stdio/fmemopen.c b/libc/stdio/fmemopen.c index ff03cb426..7febe1a6e 100644 --- a/libc/stdio/fmemopen.c +++ b/libc/stdio/fmemopen.c @@ -35,7 +35,7 @@ static ssize_t fmo_read(register void *cookie, char *buf, size_t bufsize) bufsize = count; } - memcpy(buf, COOKIE->buf + COOKIE->pos, bufsize); + __memcpy(buf, COOKIE->buf + COOKIE->pos, bufsize); COOKIE->pos += bufsize; return bufsize; @@ -62,7 +62,7 @@ static ssize_t fmo_write(register void *cookie, const char *buf, size_t bufsize) } } - memcpy(COOKIE->buf + COOKIE->pos, buf, bufsize); + __memcpy(COOKIE->buf + COOKIE->pos, buf, bufsize); COOKIE->pos += bufsize; if (COOKIE->pos > COOKIE->eof) { diff --git a/libc/stdio/fputs.c b/libc/stdio/fputs.c index 4a4d8e480..211fc1018 100644 --- a/libc/stdio/fputs.c +++ b/libc/stdio/fputs.c @@ -17,7 +17,7 @@ int attribute_hidden __fputs_unlocked(register const char * __restrict s, FILE * __restrict stream) { - size_t n = strlen(s); + size_t n = __strlen(s); return ((__fwrite_unlocked(s, 1, n, stream) == n) ? n : EOF); } diff --git a/libc/stdio/fread.c b/libc/stdio/fread.c index 10ae37418..42a29b067 100644 --- a/libc/stdio/fread.c +++ b/libc/stdio/fread.c @@ -44,7 +44,7 @@ size_t attribute_hidden __fread_unlocked(void * __restrict ptr, size_t size, siz if (avail > todo) { avail = todo; } - memcpy(buffer, stream->__bufpos, avail); + __memcpy(buffer, stream->__bufpos, avail); buffer += avail; stream->__bufpos += avail; if (!(todo -= avail)) { diff --git a/libc/stdio/old_vfprintf.c b/libc/stdio/old_vfprintf.c index 97049d379..abf535a16 100644 --- a/libc/stdio/old_vfprintf.c +++ b/libc/stdio/old_vfprintf.c @@ -191,7 +191,7 @@ static void _outnstr(FILE *stream, const unsigned char *s, size_t n) if (r > n) { r = n; } - memcpy(f->bufpos, s, r); + __memcpy(f->bufpos, s, r); f->bufpos += r; } } @@ -237,7 +237,7 @@ static void _charpad(FILE * __restrict stream, int padchar, size_t numpad) static void _fp_out_narrow(FILE *fp, intptr_t type, intptr_t len, intptr_t buf) { if (type & 0x80) { /* Some type of padding needed. */ - int buflen = strlen((const char *) buf); + int buflen = __strlen((const char *) buf); if ((len -= buflen) > 0) { _charpad(fp, (type & 0x7f), len); } diff --git a/libc/stdio/open_memstream.c b/libc/stdio/open_memstream.c index 0e3df43d1..358486010 100644 --- a/libc/stdio/open_memstream.c +++ b/libc/stdio/open_memstream.c @@ -51,7 +51,7 @@ static ssize_t oms_write(register void *cookie, const char *buf, size_t bufsize) } } - memcpy(COOKIE->buf + COOKIE->pos, buf, bufsize); + __memcpy(COOKIE->buf + COOKIE->pos, buf, bufsize); COOKIE->pos += bufsize; if (COOKIE->pos > COOKIE->eof) { @@ -90,7 +90,7 @@ static int oms_seek(register void *cookie, __offmax_t *pos, int whence) if (buf) { *COOKIE->bufloc = COOKIE->buf = buf; COOKIE->len = leastlen; - memset(buf + COOKIE->eof, leastlen - COOKIE->eof, 0); /* 0-fill */ + __memset(buf + COOKIE->eof, leastlen - COOKIE->eof, 0); /* 0-fill */ } else { /* TODO: check glibc errno setting... */ return -1; @@ -100,7 +100,7 @@ static int oms_seek(register void *cookie, __offmax_t *pos, int whence) *pos = COOKIE->pos = --leastlen; if (leastlen > COOKIE->eof) { - memset(COOKIE->buf + COOKIE->eof, leastlen - COOKIE->eof, 0); + __memset(COOKIE->buf + COOKIE->eof, leastlen - COOKIE->eof, 0); *COOKIE->sizeloc = COOKIE->eof; } diff --git a/libc/stdio/popen.c b/libc/stdio/popen.c index c7887ad41..6de09253c 100644 --- a/libc/stdio/popen.c +++ b/libc/stdio/popen.c @@ -84,23 +84,23 @@ FILE *popen(const char *command, const char *modes) parent_fd = pipe_fd[1-child_writing]; if (!(fp = fdopen(parent_fd, modes))) { - close(parent_fd); - close(child_fd); + __close(parent_fd); + __close(child_fd); goto FREE_PI; } VFORK_LOCK; if ((pid = vfork()) == 0) { /* Child of vfork... */ - close(parent_fd); + __close(parent_fd); if (child_fd != child_writing) { dup2(child_fd, child_writing); - close(child_fd); + __close(child_fd); } /* SUSv3 requires that any previously popen()'d streams in the * parent shall be closed in the child. */ for (po = popen_list ; po ; po = po->next) { - close(po->f->__filedes); + __close(po->f->__filedes); } execl("/bin/sh", "sh", "-c", command, (char *)0); @@ -113,7 +113,7 @@ FILE *popen(const char *command, const char *modes) /* We need to close the child filedes whether vfork failed or * it succeeded and we're in the parent. */ - close(child_fd); + __close(child_fd); if (pid > 0) { /* Parent of vfork... */ pi->pid = pid; diff --git a/libc/stdio/scanf.c b/libc/stdio/scanf.c index ed424f163..af1018636 100644 --- a/libc/stdio/scanf.c +++ b/libc/stdio/scanf.c @@ -246,7 +246,7 @@ int vsscanf(__const char *sp, __const char *fmt, va_list ap) f.__bufstart = f.__bufpos = (unsigned char *) ((void *) sp); f.__bufread = - f.__bufend = f.__bufstart + strlen(sp); + f.__bufend = f.__bufstart + __strlen(sp); __STDIO_STREAM_ENABLE_GETC(&f); __STDIO_STREAM_DISABLE_PUTC(&f); @@ -260,7 +260,7 @@ int vsscanf(__const char *sp, __const char *fmt, va_list ap) __FILE_vsscanf f; f.bufpos = (unsigned char *) ((void *) sp); - f.bufread = f.bufpos + strlen(sp); + f.bufread = f.bufpos + __strlen(sp); /* __STDIO_STREAM_RESET_GCS(&f.f); */ #ifdef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__ @@ -298,7 +298,7 @@ int vsscanf(__const char *sp, __const char *fmt, va_list ap) FILE *f; int rv = EOF; - if ((f = fmemopen((char *)sp, strlen(sp), "r")) != NULL) { + if ((f = fmemopen((char *)sp, __strlen(sp), "r")) != NULL) { rv = vfscanf(f, fmt, ap); fclose(f); } @@ -1188,7 +1188,7 @@ int VFSCANF (FILE *__restrict fp, const Wchar *__restrict format, va_list arg) #if defined(NL_ARGMAX) && (NL_ARGMAX > 0) psfs.num_pos_args = -1; /* Must start at -1. */ /* Initialize positional arg ptrs to NULL. */ - memset(psfs.pos_args, 0, sizeof(psfs.pos_args)); + __memset(psfs.pos_args, 0, sizeof(psfs.pos_args)); #endif /* defined(NL_ARGMAX) && (NL_ARGMAX > 0) */ __STDIO_AUTO_THREADLOCK(fp); @@ -1420,7 +1420,7 @@ int VFSCANF (FILE *__restrict fp, const Wchar *__restrict format, va_list arg) ++fmt; invert = 1; } - memset(scanset, invert, sizeof(scanset)); + __memset(scanset, invert, sizeof(scanset)); invert = 1-invert; if (*fmt == ']') { @@ -1969,14 +1969,14 @@ int attribute_hidden __psfs_do_numeric(psfs_t *psfs, struct scan_cookie *sc) if ((psfs->conv_num > CONV_i) /* float conversion */ && (!pass || (i == nblk1)) /* possible last */ - && !memcmp(sc->thousands_sep, sc->fake_decpt, k) + && !__memcmp(sc->thousands_sep, sc->fake_decpt, k) /* and prefix matched, so could be decpt */ ) { __scan_getc(sc); p = sc->fake_decpt + k; do { if (!*++p) { - strcpy(b, sc->decpt); + __strcpy(b, sc->decpt); b += sc->decpt_len; goto GOT_DECPT; } @@ -2070,7 +2070,7 @@ int attribute_hidden __psfs_do_numeric(psfs_t *psfs, struct scan_cookie *sc) p = sc->fake_decpt; do { if (!*p) { - strcpy(b, sc->decpt); + __strcpy(b, sc->decpt); b += sc->decpt_len; break; } diff --git a/libc/stdio/tempnam.c b/libc/stdio/tempnam.c index a11f82b5d..d626dc0f8 100644 --- a/libc/stdio/tempnam.c +++ b/libc/stdio/tempnam.c @@ -38,6 +38,6 @@ tempnam (const char *dir, const char *pfx) if (__gen_tempname (buf, __GT_NOCREATE)) return NULL; - return strdup (buf); + return __strdup (buf); } diff --git a/libc/stdio/tmpfile.c b/libc/stdio/tmpfile.c index 5484d5d6c..488ddd763 100644 --- a/libc/stdio/tmpfile.c +++ b/libc/stdio/tmpfile.c @@ -42,7 +42,7 @@ FILE * tmpfile (void) (void) remove (buf); if ((f = fdopen (fd, "w+b")) == NULL) - close (fd); + __close (fd); return f; } diff --git a/libc/stdio/tmpnam.c b/libc/stdio/tmpnam.c index 802c54498..df2399e66 100644 --- a/libc/stdio/tmpnam.c +++ b/libc/stdio/tmpnam.c @@ -41,7 +41,7 @@ char * tmpnam (char *s) return NULL; if (s == NULL) - return (char *) memcpy (tmpnam_buffer, tmpbuf, L_tmpnam); + return (char *) __memcpy (tmpnam_buffer, tmpbuf, L_tmpnam); return s; } diff --git a/libc/stdio/vfprintf.c b/libc/stdio/vfprintf.c index 0852c9915..4675dacc2 100644 --- a/libc/stdio/vfprintf.c +++ b/libc/stdio/vfprintf.c @@ -508,7 +508,7 @@ int attribute_hidden _ppfs_init(register ppfs_t *ppfs, const char *fmt0) int r; /* First, zero out everything... argnumber[], argtype[], argptr[] */ - memset(ppfs, 0, sizeof(ppfs_t)); /* TODO: nonportable???? */ + __memset(ppfs, 0, sizeof(ppfs_t)); /* TODO: nonportable???? */ #ifdef NL_ARGMAX --ppfs->maxposarg; /* set to -1 */ #endif /* NL_ARGMAX */ @@ -1114,7 +1114,7 @@ int attribute_hidden _ppfs_parsespec(ppfs_t *ppfs) } else { #endif /* NL_ARGMAX */ ppfs->argnumber[2] = 1; - memcpy(ppfs->argtype, argtype + 2, ppfs->num_data_args * sizeof(int)); + __memcpy(ppfs->argtype, argtype + 2, ppfs->num_data_args * sizeof(int)); #ifdef NL_ARGMAX } @@ -1197,7 +1197,7 @@ static size_t _charpad(FILE * __restrict stream, int padchar, size_t numpad); #define VFPRINTF vfprintf #define FMT_TYPE char #define OUTNSTR _outnstr -#define STRLEN strlen +#define STRLEN __strlen #define _PPFS_init _ppfs_init #define OUTPUT(F,S) __fputs_unlocked(S,F) /* #define _outnstr(stream, string, len) __stdio_fwrite(string, len, stream) */ @@ -1211,7 +1211,7 @@ static size_t _fp_out_narrow(FILE *fp, intptr_t type, intptr_t len, intptr_t buf size_t r = 0; if (type & 0x80) { /* Some type of padding needed. */ - int buflen = strlen((const char *) buf); + int buflen = __strlen((const char *) buf); if ((len -= buflen) > 0) { if ((r = _charpad(fp, (type & 0x7f), len)) != len) { return r; @@ -1281,7 +1281,7 @@ static size_t _fp_out_wide(FILE *fp, intptr_t type, intptr_t len, intptr_t buf) int i; if (type & 0x80) { /* Some type of padding needed */ - int buflen = strlen(s); + int buflen = __strlen(s); if ((len -= buflen) > 0) { if ((r = _charpad(fp, (type & 0x7f), len)) != len) { return r; @@ -1325,7 +1325,7 @@ static int _ppwfs_init(register ppfs_t *ppfs, const wchar_t *fmt0) int r; /* First, zero out everything... argnumber[], argtype[], argptr[] */ - memset(ppfs, 0, sizeof(ppfs_t)); /* TODO: nonportable???? */ + __memset(ppfs, 0, sizeof(ppfs_t)); /* TODO: nonportable???? */ #ifdef NL_ARGMAX --ppfs->maxposarg; /* set to -1 */ #endif /* NL_ARGMAX */ diff --git a/libc/stdlib/abort.c b/libc/stdlib/abort.c index 6457836e8..07e4a208c 100644 --- a/libc/stdlib/abort.c +++ b/libc/stdlib/abort.c @@ -92,7 +92,7 @@ void abort(void) /* Unmask SIGABRT to be sure we can get it */ if (__sigemptyset(&sigset) == 0 && __sigaddset(&sigset, SIGABRT) == 0) { - sigprocmask(SIG_UNBLOCK, &sigset, (sigset_t *) NULL); + __sigprocmask(SIG_UNBLOCK, &sigset, (sigset_t *) NULL); } while (1) { @@ -121,7 +121,7 @@ abort_it: struct sigaction act; been_there_done_that++; - memset(&act, '\0', sizeof(struct sigaction)); + __memset(&act, '\0', sizeof(struct sigaction)); act.sa_handler = SIG_DFL; __sigfillset(&act.sa_mask); act.sa_flags = 0; diff --git a/libc/stdlib/bsd_getpt.c b/libc/stdlib/bsd_getpt.c index 0249abbde..f219afd29 100644 --- a/libc/stdlib/bsd_getpt.c +++ b/libc/stdlib/bsd_getpt.c @@ -48,8 +48,8 @@ __getpt (void) const char *p, *q; char *s; - memcpy (buf, _PATH_PTY, sizeof (_PATH_PTY)); - s = buf + strlen (buf); + __memcpy (buf, _PATH_PTY, sizeof (_PATH_PTY)); + s = buf + __strlen (buf); /* s[0] and s[1] will be filled in the loop. */ s[2] = '\0'; @@ -64,7 +64,7 @@ __getpt (void) s[1] = *q; - fd = open (buf, O_RDWR); + fd = __open (buf, O_RDWR); if (fd != -1) return fd; diff --git a/libc/stdlib/getenv.c b/libc/stdlib/getenv.c index 2daf03955..9dfc0d132 100644 --- a/libc/stdlib/getenv.c +++ b/libc/stdlib/getenv.c @@ -29,9 +29,9 @@ char *getenv(const char *var) if (!(ep=__environ)) return NULL; - len = strlen(var); + len = __strlen(var); while(*ep) { - if (memcmp(var, *ep, len) == 0 && (*ep)[len] == '=') { + if (__memcmp(var, *ep, len) == 0 && (*ep)[len] == '=') { return *ep + len + 1; } ep++; diff --git a/libc/stdlib/getpt.c b/libc/stdlib/getpt.c index 71d7d6c5f..c219adb24 100644 --- a/libc/stdlib/getpt.c +++ b/libc/stdlib/getpt.c @@ -55,7 +55,7 @@ getpt (void) if (!have_no_dev_ptmx) #endif { - fd = open (_PATH_DEVPTMX, O_RDWR); + fd = __open (_PATH_DEVPTMX, O_RDWR); if (fd != -1) { #if defined __ASSUME_DEVPTS__ @@ -79,7 +79,7 @@ getpt (void) /* If /dev/pts is not mounted then the UNIX98 pseudo terminals are not usable. */ - close (fd); + __close (fd); #if !defined __UNIX98PTY_ONLY__ have_no_dev_ptmx = 1; #endif diff --git a/libc/stdlib/malloc-simple/alloc.c b/libc/stdlib/malloc-simple/alloc.c index ed14c37c4..7f0a91f0b 100644 --- a/libc/stdlib/malloc-simple/alloc.c +++ b/libc/stdlib/malloc-simple/alloc.c @@ -64,7 +64,7 @@ void * calloc(size_t nmemb, size_t lsize) * doesn't need to actually zero anything.... */ if (result != NULL) { - memset(result, 0, size); + __memset(result, 0, size); } #endif return result; @@ -85,7 +85,7 @@ void *realloc(void *ptr, size_t size) newptr = malloc(size); if (newptr) { - memcpy(newptr, ptr, *((size_t *) (ptr - sizeof(size_t)))); + __memcpy(newptr, ptr, *((size_t *) (ptr - sizeof(size_t)))); free(ptr); } return newptr; diff --git a/libc/stdlib/malloc-standard/calloc.c b/libc/stdlib/malloc-standard/calloc.c index a67dad738..b8c43d9dc 100644 --- a/libc/stdlib/malloc-standard/calloc.c +++ b/libc/stdlib/malloc-standard/calloc.c @@ -54,7 +54,7 @@ void* calloc(size_t n_elements, size_t elem_size) assert(nclears >= 3); if (nclears > 9) - memset(d, 0, clearsize); + __memset(d, 0, clearsize); else { *(d+0) = 0; @@ -83,7 +83,7 @@ void* calloc(size_t n_elements, size_t elem_size) d = (size_t*)mem; /* Note the additional (sizeof(size_t)) */ clearsize = chunksize(p) - 2*(sizeof(size_t)); - memset(d, 0, clearsize); + __memset(d, 0, clearsize); } #endif } diff --git a/libc/stdlib/malloc-standard/realloc.c b/libc/stdlib/malloc-standard/realloc.c index 195013095..3d77442af 100644 --- a/libc/stdlib/malloc-standard/realloc.c +++ b/libc/stdlib/malloc-standard/realloc.c @@ -126,7 +126,7 @@ void* realloc(void* oldmem, size_t bytes) assert(ncopies >= 3); if (ncopies > 9) - memcpy(d, s, copysize); + __memcpy(d, s, copysize); else { *(d+0) = *(s+0); @@ -226,7 +226,7 @@ void* realloc(void* oldmem, size_t bytes) /* Must alloc, copy, free. */ newmem = malloc(nb - MALLOC_ALIGN_MASK); if (newmem != 0) { - memcpy(newmem, oldmem, oldsize - 2*(sizeof(size_t))); + __memcpy(newmem, oldmem, oldsize - 2*(sizeof(size_t))); free(oldmem); } } diff --git a/libc/stdlib/malloc/calloc.c b/libc/stdlib/malloc/calloc.c index 15281a97f..94031ce29 100644 --- a/libc/stdlib/malloc/calloc.c +++ b/libc/stdlib/malloc/calloc.c @@ -34,7 +34,7 @@ void * calloc(size_t nmemb, size_t lsize) return NULL; } if ((result=malloc(size)) != NULL) { - memset(result, 0, size); + __memset(result, 0, size); } return result; } diff --git a/libc/stdlib/malloc/realloc.c b/libc/stdlib/malloc/realloc.c index 85392ae6a..8dcc35360 100644 --- a/libc/stdlib/malloc/realloc.c +++ b/libc/stdlib/malloc/realloc.c @@ -66,7 +66,7 @@ realloc (void *mem, size_t new_size) void *new_mem = malloc (new_size - MALLOC_HEADER_SIZE); if (new_mem) { - memcpy (new_mem, mem, size - MALLOC_HEADER_SIZE); + __memcpy (new_mem, mem, size - MALLOC_HEADER_SIZE); free (mem); } mem = new_mem; diff --git a/libc/stdlib/ptsname.c b/libc/stdlib/ptsname.c index 4ed70427e..539cbcae2 100644 --- a/libc/stdlib/ptsname.c +++ b/libc/stdlib/ptsname.c @@ -103,8 +103,8 @@ int ptsname_r (int fd, char *buf, size_t buflen) return ERANGE; } - strcpy (buf, devpts); - strcat (buf, p); + __strcpy (buf, devpts); + __strcat (buf, p); /* Note: Don't bother with stat on the slave name and checking the driver's major device number - the ioctl above succeeded so we know the fd was a Unix'98 master and the /dev/pts/ prefix @@ -130,7 +130,7 @@ int ptsname_r (int fd, char *buf, size_t buflen) { char *p; - if (buflen < strlen (_PATH_TTY) + 3) + if (buflen < __strlen (_PATH_TTY) + 3) { errno = ERANGE; return ERANGE; @@ -152,14 +152,14 @@ int ptsname_r (int fd, char *buf, size_t buflen) if (major (st.st_rdev) == 4) ptyno -= 128; - if (ptyno / 16 >= strlen (_ptyname1)) + if (ptyno / 16 >= __strlen (_ptyname1)) { errno = ENOTTY; return ENOTTY; } - strcpy (buf, _PATH_TTY); - p = buf + strlen (buf); + __strcpy (buf, _PATH_TTY); + p = buf + __strlen (buf); p[0] = _ptyname1[ptyno / 16]; p[1] = _ptyname2[ptyno % 16]; p[2] = '\0'; diff --git a/libc/stdlib/realpath.c b/libc/stdlib/realpath.c index c3628b745..7266ba4c6 100644 --- a/libc/stdlib/realpath.c +++ b/libc/stdlib/realpath.c @@ -59,11 +59,11 @@ char resolved_path[]; int n; /* Make a copy of the source path since we may need to modify it. */ - if (strlen(path) >= PATH_MAX - 2) { + if (__strlen(path) >= PATH_MAX - 2) { __set_errno(ENAMETOOLONG); return NULL; } - strcpy(copy_path, path); + __strcpy(copy_path, path); path = copy_path; max_path = copy_path + PATH_MAX - 2; /* If it's a relative pathname use getwd for starters. */ @@ -75,7 +75,7 @@ char resolved_path[]; #else getwd(new_path); #endif - new_path += strlen(new_path); + new_path += __strlen(new_path); if (new_path[-1] != '/') *new_path++ = '/'; } else { @@ -129,7 +129,7 @@ char resolved_path[]; if (errno != EINVAL) { /* Make sure it's null terminated. */ *new_path = '\0'; - strcpy(resolved_path, got_path); + __strcpy(resolved_path, got_path); return NULL; } } else { @@ -142,13 +142,13 @@ char resolved_path[]; /* Otherwise back up over this component. */ while (*(--new_path) != '/'); /* Safe sex check. */ - if (strlen(path) + n >= PATH_MAX - 2) { + if (__strlen(path) + n >= PATH_MAX - 2) { __set_errno(ENAMETOOLONG); return NULL; } /* Insert symlink contents into path. */ - strcat(link_path, path); - strcpy(copy_path, link_path); + __strcat(link_path, path); + __strcpy(copy_path, link_path); path = copy_path; } #endif /* S_IFLNK */ @@ -159,6 +159,6 @@ char resolved_path[]; new_path--; /* Make sure it's null terminated. */ *new_path = '\0'; - strcpy(resolved_path, got_path); + __strcpy(resolved_path, got_path); return resolved_path; } diff --git a/libc/stdlib/seed48_r.c b/libc/stdlib/seed48_r.c index 0bfe11f43..d1c74f24c 100644 --- a/libc/stdlib/seed48_r.c +++ b/libc/stdlib/seed48_r.c @@ -17,8 +17,6 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define memcpy __memcpy - #include <stdlib.h> #include <string.h> #include <limits.h> @@ -26,7 +24,7 @@ int attribute_hidden __seed48_r (unsigned short int seed16v[3], struct drand48_data *buffer) { /* Save old value at a private place to be used as return value. */ - memcpy (buffer->__old_x, buffer->__x, sizeof (buffer->__x)); + __memcpy (buffer->__old_x, buffer->__x, sizeof (buffer->__x)); /* Install new state. */ buffer->__x[2] = seed16v[2]; diff --git a/libc/stdlib/setenv.c b/libc/stdlib/setenv.c index 5df8b0d98..8704717a7 100644 --- a/libc/stdlib/setenv.c +++ b/libc/stdlib/setenv.c @@ -56,8 +56,8 @@ int attribute_hidden __add_to_environ (const char *name, const char *value, { register char **ep; register size_t size; - const size_t namelen = strlen (name); - const size_t vallen = value != NULL ? strlen (value) + 1 : 0; + const size_t namelen = __strlen (name); + const size_t vallen = value != NULL ? __strlen (value) + 1 : 0; LOCK; @@ -68,7 +68,7 @@ int attribute_hidden __add_to_environ (const char *name, const char *value, size = 0; if (ep != NULL) { for (; *ep != NULL; ++ep) { - if (!strncmp (*ep, name, namelen) && (*ep)[namelen] == '=') + if (!__strncmp (*ep, name, namelen) && (*ep)[namelen] == '=') break; else ++size; @@ -100,13 +100,13 @@ int attribute_hidden __add_to_environ (const char *name, const char *value, return -1; } - memcpy (new_environ[size], name, namelen); + __memcpy (new_environ[size], name, namelen); new_environ[size][namelen] = '='; - memcpy (&new_environ[size][namelen + 1], value, vallen); + __memcpy (&new_environ[size][namelen + 1], value, vallen); } if (__environ != last_environ) { - memcpy ((char *) new_environ, (char *) __environ, + __memcpy ((char *) new_environ, (char *) __environ, size * sizeof (char *)); } @@ -124,9 +124,9 @@ int attribute_hidden __add_to_environ (const char *name, const char *value, UNLOCK; return -1; } - memcpy (np, name, namelen); + __memcpy (np, name, namelen); np[namelen] = '='; - memcpy (&np[namelen + 1], value, vallen); + __memcpy (&np[namelen + 1], value, vallen); } *ep = np; } @@ -145,16 +145,16 @@ int attribute_hidden __unsetenv (const char *name) size_t len; char **ep; - if (name == NULL || *name == '\0' || strchr (name, '=') != NULL) { + if (name == NULL || *name == '\0' || __strchr (name, '=') != NULL) { __set_errno (EINVAL); return -1; } - len = strlen (name); + len = __strlen (name); LOCK; ep = __environ; while (*ep != NULL) { - if (!strncmp (*ep, name, len) && (*ep)[len] == '=') { + if (!__strncmp (*ep, name, len) && (*ep)[len] == '=') { /* Found it. Remove this pointer by moving later ones back. */ char **dp = ep; do { @@ -191,7 +191,7 @@ int clearenv (void) int putenv (char *string) { int result; - const char *const name_end = strchr (string, '='); + const char *const name_end = __strchr (string, '='); if (name_end != NULL) { char *name = strndup(string, name_end - string); diff --git a/libc/stdlib/strtod.c b/libc/stdlib/strtod.c index 10844414e..47f809f3e 100644 --- a/libc/stdlib/strtod.c +++ b/libc/stdlib/strtod.c @@ -314,7 +314,7 @@ __fpmax_t __XL_NPP(__strtofpmax)(const Wchar *str, Wchar **endptr, int exponent_ goto LOOP; } #else - if (!pos0 && !memcmp(pos, decpt, decpt_len)) { /* First decimal point? */ + if (!pos0 && !__memcmp(pos, decpt, decpt_len)) { /* First decimal point? */ pos0 = (pos += decpt_len); goto LOOP; } diff --git a/libc/stdlib/unix_grantpt.c b/libc/stdlib/unix_grantpt.c index 181fab37f..5d21ec9f8 100644 --- a/libc/stdlib/unix_grantpt.c +++ b/libc/stdlib/unix_grantpt.c @@ -19,6 +19,7 @@ #define memchr __memchr #define getgid __getgid +#define setrlimit __setrlimit #include <assert.h> #include <errno.h> diff --git a/libc/string/generic/memmem.c b/libc/string/generic/memmem.c index 5f2c1e244..05d7de639 100644 --- a/libc/string/generic/memmem.c +++ b/libc/string/generic/memmem.c @@ -41,7 +41,7 @@ void attribute_hidden *__memmem (const void *haystack, size_t haystack_len, for (begin = (const char *) haystack; begin <= last_possible; ++begin) if (begin[0] == ((const char *) needle)[0] && - !memcmp ((const void *) &begin[1], + !__memcmp ((const void *) &begin[1], (const void *) ((const char *) needle + 1), needle_len - 1)) return (void *) begin; diff --git a/libc/string/generic/memmove.c b/libc/string/generic/memmove.c index a2c38a9b5..0e649a1a9 100644 --- a/libc/string/generic/memmove.c +++ b/libc/string/generic/memmove.c @@ -19,8 +19,6 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define memcpy __memcpy - #include <string.h> #include "memcopy.h" @@ -221,7 +219,7 @@ void attribute_hidden *__memmove (void *dest, const void *src, size_t len) { #if 1 #warning REMINDER: generic-opt memmove assumes memcpy does forward copying! - memcpy(dest, src, len); + __memcpy(dest, src, len); #else /* Copy from the beginning to the end. */ diff --git a/libc/string/generic/mempcpy.c b/libc/string/generic/mempcpy.c index 4eb6db099..f2c860107 100644 --- a/libc/string/generic/mempcpy.c +++ b/libc/string/generic/mempcpy.c @@ -9,11 +9,10 @@ #undef mempcpy -void attribute_hidden *__libc_mempcpy (void *dstpp, const void *srcpp, size_t len) +void attribute_hidden *__mempcpy (void *dstpp, const void *srcpp, size_t len) { - memcpy(dstpp, srcpp, len); + __memcpy(dstpp, srcpp, len); return (void *)(((char *)dstpp) + len); } -strong_alias(__libc_mempcpy, __mempcpy) -strong_alias(__mempcpy, mempcpy) +strong_alias(__mempcpy,mempcpy) diff --git a/libc/string/generic/strcspn.c b/libc/string/generic/strcspn.c index c41132cf6..a10912e25 100644 --- a/libc/string/generic/strcspn.c +++ b/libc/string/generic/strcspn.c @@ -27,7 +27,7 @@ size_t attribute_hidden __strcspn (const char *s, const char *reject) size_t count = 0; while (*s != '\0') - if (strchr (reject, *s++) == NULL) + if (__strchr (reject, *s++) == NULL) ++count; else return count; diff --git a/libc/string/generic/strrchr.c b/libc/string/generic/strrchr.c index bde4d4da0..325be7d48 100644 --- a/libc/string/generic/strrchr.c +++ b/libc/string/generic/strrchr.c @@ -30,10 +30,10 @@ char attribute_hidden *__strrchr (const char *s, int c) /* Since strchr is fast, we use it rather than the obvious loop. */ if (c == '\0') - return strchr (s, '\0'); + return __strchr (s, '\0'); found = NULL; - while ((p = strchr (s, c)) != NULL) + while ((p = __strchr (s, c)) != NULL) { found = p; s = p + 1; diff --git a/libc/string/generic/strsep.c b/libc/string/generic/strsep.c index b46610849..9515fa193 100644 --- a/libc/string/generic/strsep.c +++ b/libc/string/generic/strsep.c @@ -46,7 +46,7 @@ char attribute_hidden *__strsep (char **stringp, const char *delim) else if (*begin == '\0') end = NULL; else - end = strchr (begin + 1, ch); + end = __strchr (begin + 1, ch); } } else diff --git a/libc/string/mempcpy.c b/libc/string/mempcpy.c index 18a1c513c..9f7fab351 100644 --- a/libc/string/mempcpy.c +++ b/libc/string/mempcpy.c @@ -5,11 +5,10 @@ */ #define L_mempcpy -#define Wmempcpy __libc_mempcpy +#define Wmempcpy __mempcpy #include "wstring.c" -strong_alias(__libc_mempcpy, __mempcpy) strong_alias(__mempcpy,mempcpy) #undef L_mempcpy diff --git a/libc/string/strdup.c b/libc/string/strdup.c index 19c2d6ad1..2bf2462fb 100644 --- a/libc/string/strdup.c +++ b/libc/string/strdup.c @@ -9,8 +9,8 @@ #undef Wstrlen #undef Wstrcpy -#define Wstrlen strlen -#define Wstrcpy strcpy +#define Wstrlen __strlen +#define Wstrcpy __strcpy #include "wstring.c" diff --git a/libc/string/wstring.c b/libc/string/wstring.c index 028ffdd42..826c4b8ce 100644 --- a/libc/string/wstring.c +++ b/libc/string/wstring.c @@ -63,11 +63,6 @@ typedef unsigned char __string_uchar_t; #endif -extern void *__memcpy (void *__restrict __dest, - __const void *__restrict __src, size_t __n) attribute_hidden; -extern void *__memmove (void *__dest, __const void *__src, size_t __n) attribute_hidden; -extern void *__memset (void *__s, int __c, size_t __n) attribute_hidden; -extern int __memcmp (__const void *__s1, __const void *__s2, size_t __n) attribute_hidden; extern size_t __strnlen (__const char *__string, size_t __maxlen) attribute_hidden; extern char *__strpbrk (__const char *__s, __const char *__accept) attribute_hidden; extern size_t __strspn (__const char *__s, __const char *__accept) attribute_hidden; @@ -1678,7 +1673,7 @@ int __xpg_strerror_r(int errnum, char *strerrbuf, size_t buflen) if (!strerrbuf) { /* SUSv3 */ buflen = 0; } - i = strlen(s) + 1; + i = __strlen(s) + 1; if (i > buflen) { i = buflen; retval = ERANGE; @@ -2008,7 +2003,7 @@ void attribute_hidden __bcopy(const void *s2, void *s1, size_t n) #endif } -strong_alias(__bcopy, bcopy) +//strong_alias(__bcopy, bcopy) #endif /**********************************************************************/ @@ -3063,7 +3058,7 @@ int __XL(wcscoll) (const Wchar *s0, const Wchar *s1 __LOCALE_PARAM ) #ifdef WANT_WIDE return wcscmp(s0, s1); #else /* WANT_WIDE */ - return strcmp(s0, s1); + return __strcmp(s0, s1); #endif /* WANT_WIDE */ } diff --git a/libc/sysdeps/linux/arm/ioperm.c b/libc/sysdeps/linux/arm/ioperm.c index 357d987f8..f887d54f1 100644 --- a/libc/sysdeps/linux/arm/ioperm.c +++ b/libc/sysdeps/linux/arm/ioperm.c @@ -157,7 +157,7 @@ init_iosys (void) /* translate systype name into i/o system: */ for (i = 0; i < sizeof (platform) / sizeof (platform[0]); ++i) { - if (strcmp (platform[i].name, systype) == 0) { + if (__strcmp (platform[i].name, systype) == 0) { io.shift = platform[i].shift; io.io_base = platform[i].io_base; io.initdone = 1; @@ -185,14 +185,14 @@ int ioperm (unsigned long int from, unsigned long int num, int turn_on) if (! io.base) { int fd; - fd = open ("/dev/mem", O_RDWR); + fd = __open ("/dev/mem", O_RDWR); if (fd < 0) return -1; io.base = (unsigned long int) mmap (0, MAX_PORT << io.shift, PROT_READ | PROT_WRITE, MAP_SHARED, fd, io.io_base); - close (fd); + __close (fd); if ((long) io.base == -1) return -1; } diff --git a/libc/sysdeps/linux/arm/sigaction.c b/libc/sysdeps/linux/arm/sigaction.c index 5fbb7fbf1..822fd0d97 100644 --- a/libc/sysdeps/linux/arm/sigaction.c +++ b/libc/sysdeps/linux/arm/sigaction.c @@ -58,7 +58,7 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa if (act) { kact.k_sa_handler = act->sa_handler; - memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t)); + __memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t)); kact.sa_flags = act->sa_flags; # ifdef HAVE_SA_RESTORER /* If the user specified SA_ONSTACK this means she is trying to @@ -83,7 +83,7 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa oact ? __ptrvalue (&koact) : NULL, _NSIG / 8); if (oact && result >= 0) { oact->sa_handler = koact.k_sa_handler; - memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t)); + __memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t)); oact->sa_flags = koact.sa_flags; # ifdef HAVE_SA_RESTORER oact->sa_restorer = koact.sa_restorer; diff --git a/libc/sysdeps/linux/common/close.c b/libc/sysdeps/linux/common/close.c index 1e03b091e..2e9c2073d 100644 --- a/libc/sysdeps/linux/common/close.c +++ b/libc/sysdeps/linux/common/close.c @@ -10,6 +10,7 @@ #include "syscalls.h" #include <unistd.h> -#define __NR___libc_close __NR_close -_syscall1(int, __libc_close, int, fd); -weak_alias(__libc_close, close); +#define __NR___close __NR_close +attribute_hidden _syscall1(int, __close, int, fd); +strong_alias(__close,close) +weak_alias(__close,__libc_close) diff --git a/libc/sysdeps/linux/common/creat64.c b/libc/sysdeps/linux/common/creat64.c index deeda3892..759f5bed8 100644 --- a/libc/sysdeps/linux/common/creat64.c +++ b/libc/sysdeps/linux/common/creat64.c @@ -16,6 +16,8 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#define open64 __open64 + #include <features.h> #include <fcntl.h> #include <sys/types.h> diff --git a/libc/sysdeps/linux/common/create_module.c b/libc/sysdeps/linux/common/create_module.c index ee7b4daef..a54f13be5 100644 --- a/libc/sysdeps/linux/common/create_module.c +++ b/libc/sysdeps/linux/common/create_module.c @@ -34,7 +34,7 @@ # ifdef __STR_NR_create_module # define __STR_NR___create_module __STR_NR_create_module # endif -attribute_hidden _syscall2(long, __create_module, const char *, name, size_t, size); +static inline _syscall2(long, __create_module, const char *, name, size_t, size); /* By checking the value of errno, we know if we have been fooled * by the syscall2 macro making a very high address look like a * negative, so we we fix it up here. */ @@ -53,7 +53,7 @@ unsigned long create_module(const char *name, size_t size) # define __NR___create_module __NR_create_module /* Alpha doesn't have the same problem, exactly, but a bug in older kernels fails to clear the error flag. Clear it here explicitly. */ -attribute_hidden _syscall4(unsigned long, __create_module, const char *, name, +static inline _syscall4(unsigned long, __create_module, const char *, name, size_t, size, size_t, dummy, size_t, err); unsigned long create_module(const char *name, size_t size) { diff --git a/libc/sysdeps/linux/common/dl-osinfo.h b/libc/sysdeps/linux/common/dl-osinfo.h index 4976b2b46..7998b08a4 100644 --- a/libc/sysdeps/linux/common/dl-osinfo.h +++ b/libc/sysdeps/linux/common/dl-osinfo.h @@ -10,35 +10,35 @@ #include <features.h> #ifdef __UCLIBC_HAS_SSP__ -#include <stdint.h> -#include <sys/time.h> +# if defined IS_IN_libc || defined IS_IN_rtld -#ifdef IS_IN_libc -#include <ssp-internal.h> -#if 0 -#ifndef __SSP_QUICK_CANARY__ -#define OPEN __libc_open -#define READ __libc_read -#define CLOSE __libc_close -#endif -#define GETTIMEOFDAY gettimeofday -#endif -#else -#ifdef __SSP__ -#error "file must not be compiled with stack protection enabled on it. Use -fno-stack-protector" -#endif -#ifndef __SSP_QUICK_CANARY__ -#define OPEN _dl_open -#define READ _dl_read -#define CLOSE _dl_close -#endif -#define GETTIMEOFDAY _dl_gettimeofday -#endif +# if defined __SSP__ || defined __SSP_ALL__ +# error "file must not be compiled with stack protection enabled on it. Use -fno-stack-protector" +# endif + +# include <stdint.h> +# include <sys/time.h> + +# ifdef IS_IN_libc +# ifndef __SSP_QUICK_CANARY__ +# define OPEN __open +# define READ __read +# define CLOSE __close +# endif +# define GETTIMEOFDAY gettimeofday +# else +# ifndef __SSP_QUICK_CANARY__ +# define OPEN _dl_open +# define READ _dl_read +# define CLOSE _dl_close +# endif +# define GETTIMEOFDAY _dl_gettimeofday +# endif static __always_inline uintptr_t _dl_setup_stack_chk_guard(void) { uintptr_t ret; -#ifndef __SSP_QUICK_CANARY__ +# ifndef __SSP_QUICK_CANARY__ { int fd = OPEN("/dev/urandom", O_RDONLY, 0); if (fd >= 0) { @@ -48,7 +48,7 @@ static __always_inline uintptr_t _dl_setup_stack_chk_guard(void) return ret; } } -#endif /* !__SSP_QUICK_CANARY__ */ +# endif /* !__SSP_QUICK_CANARY__ */ /* Start with the "terminator canary". */ ret = 0xFF0A0D00UL; @@ -62,6 +62,7 @@ static __always_inline uintptr_t _dl_setup_stack_chk_guard(void) } return ret; } +# endif /* libc || rtld */ #endif /* __UCLIBC_HAS_SSP__ */ #endif /* _DL_OSINFO_H */ diff --git a/libc/sysdeps/linux/common/getcwd.c b/libc/sysdeps/linux/common/getcwd.c index c6a2fc005..d007993eb 100644 --- a/libc/sysdeps/linux/common/getcwd.c +++ b/libc/sysdeps/linux/common/getcwd.c @@ -47,13 +47,13 @@ static char *search_dir(dev_t this_dev, ino_t this_ino, char *path_buf, int path slow_search = 1; #endif - slen = strlen(path_buf); + slen = __strlen(path_buf); ptr = path_buf + slen - 1; if (*ptr != '/') { if (slen + 2 > path_size) { goto oops; } - strcpy(++ptr, "/"); + __strcpy(++ptr, "/"); slen++; } slen++; @@ -67,10 +67,10 @@ static char *search_dir(dev_t this_dev, ino_t this_ino, char *path_buf, int path #ifdef FAST_DIR_SEARCH_POSSIBLE if (slow_search || this_ino == d->d_ino) { #endif - if (slen + strlen(d->d_name) > path_size) { + if (slen + __strlen(d->d_name) > path_size) { goto oops; } - strcpy(ptr + 1, d->d_name); + __strcpy(ptr + 1, d->d_name); if (stat(path_buf, &st) < 0) continue; if (st.st_ino == this_ino && st.st_dev == this_dev) { @@ -108,13 +108,13 @@ static char *recurser(char *path_buf, int path_size, dev_t root_dev, ino_t root_ if (path_size < 2) { goto oops; } - strcpy(path_buf, "/"); + __strcpy(path_buf, "/"); return path_buf; } - if (strlen(path_buf) + 4 > path_size) { + if (__strlen(path_buf) + 4 > path_size) { goto oops; } - strcat(path_buf, "/.."); + __strcat(path_buf, "/.."); if (recurser(path_buf, path_size, root_dev, root_ino) == 0) return 0; @@ -141,11 +141,11 @@ int __syscall_getcwd(char * buf, unsigned long size) return -1; } /* start with actual dir */ - if (buf) strncpy(buf, ".", size); + if (buf) __strncpy(buf, ".", size); cwd = recurser(buf, size, st.st_dev, st.st_ino); if (cwd) { - len = strlen(buf); + len = __strlen(buf); __set_errno(olderrno); } return len; diff --git a/libc/sysdeps/linux/common/getdents.c b/libc/sysdeps/linux/common/getdents.c index 876420664..6913798a8 100644 --- a/libc/sysdeps/linux/common/getdents.c +++ b/libc/sysdeps/linux/common/getdents.c @@ -90,7 +90,7 @@ ssize_t attribute_hidden __getdents (int fd, char *buf, size_t nbytes) dp->d_off = kdp->d_off; dp->d_reclen = new_reclen; dp->d_type = DT_UNKNOWN; - memcpy (dp->d_name, kdp->d_name, + __memcpy (dp->d_name, kdp->d_name, kdp->d_reclen - offsetof (struct kernel_dirent, d_name)); dp = (struct dirent *) ((char *) dp + new_reclen); kdp = (struct kernel_dirent *) (((char *) kdp) + kdp->d_reclen); diff --git a/libc/sysdeps/linux/common/getdents64.c b/libc/sysdeps/linux/common/getdents64.c index e45d9d364..37ecc1339 100644 --- a/libc/sysdeps/linux/common/getdents64.c +++ b/libc/sysdeps/linux/common/getdents64.c @@ -95,7 +95,7 @@ ssize_t attribute_hidden __getdents64 (int fd, char *buf, size_t nbytes) dp->d_off = kdp->d_off; dp->d_reclen = new_reclen; dp->d_type = DT_UNKNOWN; - memcpy (dp->d_name, kdp->d_name, + __memcpy (dp->d_name, kdp->d_name, kdp->d_reclen - offsetof (struct kernel_dirent64, d_name)); dp = (struct dirent64 *) ((char *) dp + new_reclen); kdp = (struct kernel_dirent64 *) (((char *) kdp) + kdp->d_reclen); diff --git a/libc/sysdeps/linux/common/getdirname.c b/libc/sysdeps/linux/common/getdirname.c index 4cc528fc7..d0865fba5 100644 --- a/libc/sysdeps/linux/common/getdirname.c +++ b/libc/sysdeps/linux/common/getdirname.c @@ -49,7 +49,7 @@ get_current_dir_name (void) && pwdstat.st_dev == dotstat.st_dev && pwdstat.st_ino == dotstat.st_ino) /* The PWD value is correct. Use it. */ - return strdup (pwd); + return __strdup (pwd); return getcwd ((char *) NULL, 0); } diff --git a/libc/sysdeps/linux/common/getdnnm.c b/libc/sysdeps/linux/common/getdnnm.c index aa5a7d756..3c48b4ca0 100644 --- a/libc/sysdeps/linux/common/getdnnm.c +++ b/libc/sysdeps/linux/common/getdnnm.c @@ -18,10 +18,10 @@ getdomainname(char *name, size_t len) if (uname(&uts) == -1) return -1; - if (strlen(uts.domainname)+1 > len) { + if (__strlen(uts.domainname)+1 > len) { __set_errno(EINVAL); return -1; } - strcpy(name, uts.domainname); + __strcpy(name, uts.domainname); return 0; } diff --git a/libc/sysdeps/linux/common/getdtablesize.c b/libc/sysdeps/linux/common/getdtablesize.c index 016e6f62e..8cbcebdce 100644 --- a/libc/sysdeps/linux/common/getdtablesize.c +++ b/libc/sysdeps/linux/common/getdtablesize.c @@ -16,6 +16,8 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define getrlimit __getrlimit + #include <stdlib.h> #include <unistd.h> #include <sys/resource.h> diff --git a/libc/sysdeps/linux/common/gethstnm.c b/libc/sysdeps/linux/common/gethstnm.c index 0f7a04681..8a23e9516 100644 --- a/libc/sysdeps/linux/common/gethstnm.c +++ b/libc/sysdeps/linux/common/gethstnm.c @@ -15,10 +15,10 @@ gethostname(char *name, size_t len) if (uname(&uts) == -1) return -1; - if (strlen(uts.nodename)+1 > len) { + if (__strlen(uts.nodename)+1 > len) { __set_errno(EINVAL); return -1; } - strcpy(name, uts.nodename); + __strcpy(name, uts.nodename); return 0; } diff --git a/libc/sysdeps/linux/common/getrlimit.c b/libc/sysdeps/linux/common/getrlimit.c index c84330b03..fef907a03 100644 --- a/libc/sysdeps/linux/common/getrlimit.c +++ b/libc/sysdeps/linux/common/getrlimit.c @@ -13,9 +13,10 @@ #ifdef __NR_ugetrlimit #define __NR___ugetrlimit __NR_ugetrlimit -attribute_hidden _syscall2(int, __ugetrlimit, enum __rlimit_resource, resource, +static inline +_syscall2(int, __ugetrlimit, enum __rlimit_resource, resource, struct rlimit *, rlim); -int getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits) +int attribute_hidden __getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits) { return (__ugetrlimit(resource, rlimits)); } @@ -23,15 +24,15 @@ int getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits) #else /* __NR_ugetrlimit */ /* Only include the old getrlimit if the new one (ugetrlimit) is not around */ -#define __NR___getrlimit __NR_getrlimit +#define __NR___syscall_getrlimit __NR_getrlimit static inline -_syscall2(int, __getrlimit, int, resource, struct rlimit *, rlim); +_syscall2(int, __syscall_getrlimit, int, resource, struct rlimit *, rlim); -int getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits) +int attribute_hidden __getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits) { int result; - result = __getrlimit(resource, rlimits); + result = __syscall_getrlimit(resource, rlimits); if (result == -1) return result; @@ -45,3 +46,5 @@ int getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits) return result; } #endif + +strong_alias(__getrlimit,getrlimit) diff --git a/libc/sysdeps/linux/common/getrlimit64.c b/libc/sysdeps/linux/common/getrlimit64.c index 1af7870af..76c3196ad 100644 --- a/libc/sysdeps/linux/common/getrlimit64.c +++ b/libc/sysdeps/linux/common/getrlimit64.c @@ -16,6 +16,8 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#define getrlimit __getrlimit + #include <features.h> #if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64 diff --git a/libc/sysdeps/linux/common/gettimeofday.c b/libc/sysdeps/linux/common/gettimeofday.c index 0165acfc1..88f7f9999 100644 --- a/libc/sysdeps/linux/common/gettimeofday.c +++ b/libc/sysdeps/linux/common/gettimeofday.c @@ -9,4 +9,8 @@ #include "syscalls.h" #include <sys/time.h> -_syscall2(int, gettimeofday, struct timeval *, tv, struct timezone *, tz); +#undef gettimeofday +#define __NR___gettimeofday __NR_gettimeofday +attribute_hidden _syscall2(int, __gettimeofday, struct timeval *, tv, struct timezone *, tz); +strong_alias(__gettimeofday,gettimeofday) +weak_alias(__gettimeofday,__libc_gettimeofday) diff --git a/libc/sysdeps/linux/common/longjmp.c b/libc/sysdeps/linux/common/longjmp.c index 1a4201922..5b4eff5f5 100644 --- a/libc/sysdeps/linux/common/longjmp.c +++ b/libc/sysdeps/linux/common/longjmp.c @@ -36,7 +36,7 @@ void __libc_longjmp (sigjmp_buf env, int val) if (env[0].__mask_was_saved) /* Restore the saved signal mask. */ - (void) sigprocmask (SIG_SETMASK, &env[0].__saved_mask, + (void) __sigprocmask (SIG_SETMASK, &env[0].__saved_mask, (sigset_t *) NULL); /* Call the machine-dependent function to restore machine state. */ diff --git a/libc/sysdeps/linux/common/open.c b/libc/sysdeps/linux/common/open.c index 332d6a402..90e990a4f 100644 --- a/libc/sysdeps/linux/common/open.c +++ b/libc/sysdeps/linux/common/open.c @@ -18,7 +18,7 @@ static inline _syscall3(int, __syscall_open, const char *, file, int, flags, __kernel_mode_t, mode); -int __libc_open(const char *file, int flags, ...) +int attribute_hidden __open(const char *file, int flags, ...) { /* gcc may warn about mode being uninitialized. * Just ignore that, since gcc is wrong. */ @@ -33,9 +33,10 @@ int __libc_open(const char *file, int flags, ...) } return __syscall_open(file, flags, mode); } -weak_alias(__libc_open, open); +strong_alias(__open,open) +weak_alias(__open,__libc_open) int creat(const char *file, mode_t mode) { - return __libc_open(file, O_WRONLY | O_CREAT | O_TRUNC, mode); + return __open(file, O_WRONLY | O_CREAT | O_TRUNC, mode); } diff --git a/libc/sysdeps/linux/common/open64.c b/libc/sysdeps/linux/common/open64.c index d9a27a7bc..c1cd47141 100644 --- a/libc/sysdeps/linux/common/open64.c +++ b/libc/sysdeps/linux/common/open64.c @@ -26,11 +26,9 @@ #endif #ifdef __UCLIBC_HAS_LFS__ -extern int __libc_open (__const char *file, int oflag, ...); - /* Open FILE with access OFLAG. If OFLAG includes O_CREAT, a third argument is the file protection. */ -int __libc_open64 (const char *file, int oflag, ...) +int attribute_hidden __open64 (const char *file, int oflag, ...) { int mode = 0; @@ -42,7 +40,8 @@ int __libc_open64 (const char *file, int oflag, ...) va_end (arg); } - return __libc_open(file, oflag | O_LARGEFILE, mode); + return __open(file, oflag | O_LARGEFILE, mode); } -weak_alias (__libc_open64, open64); +strong_alias(__open64,open64) +weak_alias(__open64,__libc_open64) #endif /* __UCLIBC_HAS_LFS__ */ diff --git a/libc/sysdeps/linux/common/poll.c b/libc/sysdeps/linux/common/poll.c index 06c857c43..87d0dbb27 100644 --- a/libc/sysdeps/linux/common/poll.c +++ b/libc/sysdeps/linux/common/poll.c @@ -62,9 +62,9 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout) /* We can't call FD_ZERO, since FD_ZERO only works with sets of exactly __FD_SETSIZE size. */ - memset (rset, 0, bytes); - memset (wset, 0, bytes); - memset (xset, 0, bytes); + __memset (rset, 0, bytes); + __memset (wset, 0, bytes); + __memset (xset, 0, bytes); for (f = fds; f < &fds[nfds]; ++f) { @@ -86,13 +86,13 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout) nwset = alloca (nbytes); nxset = alloca (nbytes); - memset ((char *) nrset + bytes, 0, nbytes - bytes); - memset ((char *) nwset + bytes, 0, nbytes - bytes); - memset ((char *) nxset + bytes, 0, nbytes - bytes); + __memset ((char *) nrset + bytes, 0, nbytes - bytes); + __memset ((char *) nwset + bytes, 0, nbytes - bytes); + __memset ((char *) nxset + bytes, 0, nbytes - bytes); - rset = memcpy (nrset, rset, bytes); - wset = memcpy (nwset, wset, bytes); - xset = memcpy (nxset, xset, bytes); + rset = __memcpy (nrset, rset, bytes); + wset = __memcpy (nwset, wset, bytes); + xset = __memcpy (nxset, xset, bytes); bytes = nbytes; } @@ -126,9 +126,9 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout) struct timeval sngl_tv; /* Clear the original set. */ - memset (rset, 0, bytes); - memset (wset, 0, bytes); - memset (xset, 0, bytes); + __memset (rset, 0, bytes); + __memset (wset, 0, bytes); + __memset (xset, 0, bytes); /* This means we don't wait for input. */ sngl_tv.tv_sec = 0; @@ -145,9 +145,9 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout) { int n; - memset (sngl_rset, 0, bytes); - memset (sngl_wset, 0, bytes); - memset (sngl_xset, 0, bytes); + __memset (sngl_rset, 0, bytes); + __memset (sngl_wset, 0, bytes); + __memset (sngl_xset, 0, bytes); if (f->events & POLLIN) FD_SET (f->fd, sngl_rset); diff --git a/libc/sysdeps/linux/common/read.c b/libc/sysdeps/linux/common/read.c index 9b9ea5bc9..6490bccbc 100644 --- a/libc/sysdeps/linux/common/read.c +++ b/libc/sysdeps/linux/common/read.c @@ -10,6 +10,7 @@ #include "syscalls.h" #include <unistd.h> -#define __NR___libc_read __NR_read -_syscall3(ssize_t, __libc_read, int, fd, __ptr_t, buf, size_t, count); -weak_alias(__libc_read, read); +#define __NR___read __NR_read +attribute_hidden _syscall3(ssize_t, __read, int, fd, __ptr_t, buf, size_t, count); +strong_alias(__read,read) +weak_alias(__read,__libc_read) diff --git a/libc/sysdeps/linux/common/setrlimit.c b/libc/sysdeps/linux/common/setrlimit.c index c7ebe6c98..9c5466a09 100644 --- a/libc/sysdeps/linux/common/setrlimit.c +++ b/libc/sysdeps/linux/common/setrlimit.c @@ -12,12 +12,13 @@ #ifndef __NR_ugetrlimit /* Only wrap setrlimit if the new ugetrlimit is not present */ -#define __NR___setrlimit __NR_setrlimit +#define __NR___syscall_setrlimit __NR_setrlimit #include <unistd.h> #include <sys/resource.h> #define RMIN(x, y) ((x) < (y) ? (x) : (y)) -_syscall2(int, __setrlimit, int, resource, const struct rlimit *, rlim); -int setrlimit(__rlimit_resource_t resource, const struct rlimit *rlimits) +static inline +_syscall2(int, __syscall_setrlimit, int, resource, const struct rlimit *, rlim); +int attribute_hidden __setrlimit(__rlimit_resource_t resource, const struct rlimit *rlimits) { struct rlimit rlimits_small; @@ -27,7 +28,7 @@ int setrlimit(__rlimit_resource_t resource, const struct rlimit *rlimits) RLIM_INFINITY >> 1); rlimits_small.rlim_max = RMIN((unsigned long int) rlimits->rlim_max, RLIM_INFINITY >> 1); - return (__setrlimit(resource, &rlimits_small)); + return (__syscall_setrlimit(resource, &rlimits_small)); } #undef RMIN @@ -36,6 +37,9 @@ int setrlimit(__rlimit_resource_t resource, const struct rlimit *rlimits) #include <unistd.h> struct rlimit; -_syscall2(int, setrlimit, unsigned int, resource, +#define __NR___setrlimit __NR_setrlimit +attribute_hidden _syscall2(int, __setrlimit, unsigned int, resource, const struct rlimit *, rlim); #endif + +strong_alias(__setrlimit,setrlimit) diff --git a/libc/sysdeps/linux/common/setrlimit64.c b/libc/sysdeps/linux/common/setrlimit64.c index 8d190f573..d59057c90 100644 --- a/libc/sysdeps/linux/common/setrlimit64.c +++ b/libc/sysdeps/linux/common/setrlimit64.c @@ -16,6 +16,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#define setrlimit __setrlimit #include <features.h> diff --git a/libc/sysdeps/linux/common/sigprocmask.c b/libc/sysdeps/linux/common/sigprocmask.c index c15ba2485..7a18648e8 100644 --- a/libc/sysdeps/linux/common/sigprocmask.c +++ b/libc/sysdeps/linux/common/sigprocmask.c @@ -19,7 +19,7 @@ static inline _syscall4(int, __rt_sigprocmask, int, how, const sigset_t *, set, sigset_t *, oldset, size_t, size); -int sigprocmask(int how, const sigset_t * set, sigset_t * oldset) +int attribute_hidden __sigprocmask(int how, const sigset_t * set, sigset_t * oldset) { if (set && #if (SIG_BLOCK == 0) && (SIG_UNBLOCK == 1) && (SIG_SETMASK == 2) @@ -44,7 +44,7 @@ static inline _syscall3(int, __syscall_sigprocmask, int, how, const sigset_t *, set, sigset_t *, oldset); -int sigprocmask(int how, const sigset_t * set, sigset_t * oldset) +int attribute_hidden __sigprocmask(int how, const sigset_t * set, sigset_t * oldset) { if (set && #if (SIG_BLOCK == 0) && (SIG_UNBLOCK == 1) && (SIG_SETMASK == 2) @@ -61,3 +61,5 @@ int sigprocmask(int how, const sigset_t * set, sigset_t * oldset) return (__syscall_sigprocmask(how, set, oldset)); } #endif + +strong_alias(__sigprocmask,sigprocmask) diff --git a/libc/sysdeps/linux/common/ssp.c b/libc/sysdeps/linux/common/ssp.c index 43708fe61..4c52d070f 100644 --- a/libc/sysdeps/linux/common/ssp.c +++ b/libc/sysdeps/linux/common/ssp.c @@ -30,10 +30,10 @@ static __always_inline void block_signals(void) sigfillset(&mask); sigdelset(&mask, SSP_SIGTYPE); /* Block all signal handlers */ - SIGPROCMASK(SIG_BLOCK, &mask, NULL); /* except SSP_SIGTYPE */ + __sigprocmask(SIG_BLOCK, &mask, NULL); /* except SSP_SIGTYPE */ /* Make the default handler associated with the signal handler */ - memset(&sa, 0, sizeof(struct sigaction)); + __memset(&sa, 0, sizeof(struct sigaction)); sigfillset(&sa.sa_mask); /* Block all signals */ sa.sa_flags = 0; sa.sa_handler = SIG_DFL; @@ -42,10 +42,10 @@ static __always_inline void block_signals(void) static __always_inline void ssp_write(int fd, const char *msg1, const char *msg2, const char *msg3) { - WRITE(fd, msg1, strlen(msg1)); - WRITE(fd, msg2, strlen(msg2)); - WRITE(fd, msg3, strlen(msg3)); - WRITE(fd, "()\n", 3); + __write(fd, msg1, __strlen(msg1)); + __write(fd, msg2, __strlen(msg2)); + __write(fd, msg3, __strlen(msg3)); + __write(fd, "()\n", 3); openlog("ssp", LOG_CONS | LOG_PID, LOG_USER); syslog(LOG_INFO, "%s%s%s()", msg1, msg2, msg3); closelog(); diff --git a/libc/sysdeps/linux/common/ulimit.c b/libc/sysdeps/linux/common/ulimit.c index 5bbed45a7..b8e09fc8f 100644 --- a/libc/sysdeps/linux/common/ulimit.c +++ b/libc/sysdeps/linux/common/ulimit.c @@ -19,6 +19,8 @@ */ #define sysconf __sysconf +#define getrlimit __getrlimit +#define setrlimit __setrlimit #define _GNU_SOURCE #define _LARGEFILE64_SOURCE diff --git a/libc/sysdeps/linux/common/write.c b/libc/sysdeps/linux/common/write.c index b7e34f81c..d3b5fab93 100644 --- a/libc/sysdeps/linux/common/write.c +++ b/libc/sysdeps/linux/common/write.c @@ -10,9 +10,12 @@ #include "syscalls.h" #include <unistd.h> -#define __NR___libc_write __NR_write -_syscall3(ssize_t, __libc_write, int, fd, const __ptr_t, buf, size_t, count); -weak_alias(__libc_write, write); +#define __NR___write __NR_write +attribute_hidden _syscall3(ssize_t, __write, int, fd, const __ptr_t, buf, size_t, count); +strong_alias(__write,write) +weak_alias(__write,__libc_write) +#if 0 /* Stupid libgcc.a from gcc 2.95.x uses __write in pure.o * which is a blatent GNU libc-ism... */ weak_alias(__libc_write, __write); +#endif diff --git a/libc/sysdeps/linux/e1/longjmp.c b/libc/sysdeps/linux/e1/longjmp.c index 5770d4997..89d6b76d9 100644 --- a/libc/sysdeps/linux/e1/longjmp.c +++ b/libc/sysdeps/linux/e1/longjmp.c @@ -43,7 +43,7 @@ void longjmp(jmp_buf state, int value ) void siglongjmp(sigjmp_buf state, int value ) { if( state->__mask_was_saved ) - sigprocmask(SIG_SETMASK, &state->__saved_mask, NULL); + __sigprocmask(SIG_SETMASK, &state->__saved_mask, NULL); if(!value) state->__jmpbuf->ReturnValue = 1; diff --git a/libc/sysdeps/linux/e1/setjmp.c b/libc/sysdeps/linux/e1/setjmp.c index 2942cb193..502e89b22 100644 --- a/libc/sysdeps/linux/e1/setjmp.c +++ b/libc/sysdeps/linux/e1/setjmp.c @@ -32,7 +32,7 @@ int sigsetjmp( sigjmp_buf state , int savesigs) if(savesigs) { state->__mask_was_saved = 1; /* how arg in <sigprocmask> is not significant */ - sigprocmask(SIG_SETMASK, NULL, &state->__saved_mask); + __sigprocmask(SIG_SETMASK, NULL, &state->__saved_mask); } else state->__mask_was_saved = 0; diff --git a/libc/sysdeps/linux/i386/sigaction.c b/libc/sysdeps/linux/i386/sigaction.c index 640e51f21..0875796cf 100644 --- a/libc/sysdeps/linux/i386/sigaction.c +++ b/libc/sysdeps/linux/i386/sigaction.c @@ -48,7 +48,7 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa if (act) { kact.k_sa_handler = act->sa_handler; - memcpy (&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask)); + __memcpy (&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask)); kact.sa_flags = act->sa_flags; kact.sa_flags = act->sa_flags | SA_RESTORER; @@ -63,7 +63,7 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa if (oact && result >= 0) { oact->sa_handler = koact.k_sa_handler; - memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (oact->sa_mask)); + __memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (oact->sa_mask)); oact->sa_flags = koact.sa_flags; oact->sa_restorer = koact.sa_restorer; } diff --git a/libc/sysdeps/linux/mips/sigaction.c b/libc/sysdeps/linux/mips/sigaction.c index de35edf40..245886dbd 100644 --- a/libc/sysdeps/linux/mips/sigaction.c +++ b/libc/sysdeps/linux/mips/sigaction.c @@ -46,7 +46,7 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa if (act) { kact.k_sa_handler = act->sa_handler; - memcpy (&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask)); + __memcpy (&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask)); kact.sa_flags = act->sa_flags; kact.sa_flags = act->sa_flags | SA_RESTORER; @@ -62,7 +62,7 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa if (oact && result >= 0) { oact->sa_handler = koact.k_sa_handler; - memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (oact->sa_mask)); + __memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (oact->sa_mask)); oact->sa_flags = koact.sa_flags; #ifdef HAVE_SA_RESTORER oact->sa_restorer = koact.sa_restorer; diff --git a/libc/sysdeps/linux/sh/longjmp.c b/libc/sysdeps/linux/sh/longjmp.c index c36344cd1..ee3afcd74 100644 --- a/libc/sysdeps/linux/sh/longjmp.c +++ b/libc/sysdeps/linux/sh/longjmp.c @@ -33,7 +33,7 @@ void __libc_siglongjmp (sigjmp_buf env, int val) { if (env[0].__mask_was_saved) /* Restore the saved signal mask. */ - (void) sigprocmask (SIG_SETMASK, &env[0].__saved_mask, + (void) __sigprocmask (SIG_SETMASK, &env[0].__saved_mask, (sigset_t *) NULL); /* Call the machine-dependent function to restore machine state. */ diff --git a/libc/sysdeps/linux/x86_64/sigaction.c b/libc/sysdeps/linux/x86_64/sigaction.c index f701d5047..ac10bc5aa 100644 --- a/libc/sysdeps/linux/x86_64/sigaction.c +++ b/libc/sysdeps/linux/x86_64/sigaction.c @@ -52,7 +52,7 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) if (act) { kact.k_sa_handler = act->sa_handler; - memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t)); + __memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t)); kact.sa_flags = act->sa_flags | SA_RESTORER; kact.sa_restorer = &restore_rt; @@ -65,7 +65,7 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) oact ? __ptrvalue (&koact) : NULL, _NSIG / 8); if (oact && result >= 0) { oact->sa_handler = koact.k_sa_handler; - memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t)); + __memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t)); oact->sa_flags = koact.sa_flags; oact->sa_restorer = koact.sa_restorer; } diff --git a/libc/termios/tcgetattr.c b/libc/termios/tcgetattr.c index e671309b6..1f1f0562b 100644 --- a/libc/termios/tcgetattr.c +++ b/libc/termios/tcgetattr.c @@ -16,7 +16,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define mempcpy __libc_mempcpy +#define mempcpy __mempcpy #include <features.h> #define __USE_GNU @@ -55,18 +55,18 @@ int tcgetattr (int fd, struct termios *termios_p) if (sizeof (cc_t) == 1 || _POSIX_VDISABLE == 0 || (unsigned char) _POSIX_VDISABLE == (unsigned char) -1) { - memset (mempcpy (&termios_p->c_cc[0], &k_termios.c_cc[0], + __memset (mempcpy (&termios_p->c_cc[0], &k_termios.c_cc[0], __KERNEL_NCCS * sizeof (cc_t)), _POSIX_VDISABLE, (NCCS - __KERNEL_NCCS) * sizeof (cc_t)); #if 0 - memset ( (memcpy (&termios_p->c_cc[0], &k_termios.c_cc[0], + __memset ( (__memcpy (&termios_p->c_cc[0], &k_termios.c_cc[0], __KERNEL_NCCS * sizeof (cc_t)) + (__KERNEL_NCCS * sizeof (cc_t))) , _POSIX_VDISABLE, (NCCS - __KERNEL_NCCS) * sizeof (cc_t)); #endif } else { size_t cnt; - memcpy (&termios_p->c_cc[0], &k_termios.c_cc[0], + __memcpy (&termios_p->c_cc[0], &k_termios.c_cc[0], __KERNEL_NCCS * sizeof (cc_t)); for (cnt = __KERNEL_NCCS; cnt < NCCS; ++cnt) diff --git a/libc/termios/tcsetattr.c b/libc/termios/tcsetattr.c index 83bf61d99..76d73796e 100644 --- a/libc/termios/tcsetattr.c +++ b/libc/termios/tcsetattr.c @@ -80,7 +80,7 @@ int tcsetattr (int fd, int optional_actions, const struct termios *termios_p) #ifdef _HAVE_C_OSPEED k_termios.c_ospeed = termios_p->c_ospeed; #endif - memcpy (&k_termios.c_cc[0], &termios_p->c_cc[0], + __memcpy (&k_termios.c_cc[0], &termios_p->c_cc[0], __KERNEL_NCCS * sizeof (cc_t)); retval = ioctl (fd, cmd, &k_termios); diff --git a/libc/termios/ttyname.c b/libc/termios/ttyname.c index 7b937fb0b..15093f8a5 100644 --- a/libc/termios/ttyname.c +++ b/libc/termios/ttyname.c @@ -68,7 +68,7 @@ int ttyname_r(int fd, char *ubuf, size_t ubuflen) assert(len + 2 <= TTYNAME_BUFLEN); /* dirname + 1 char + nul */ - strcpy(buf, p); + __strcpy(buf, p); s = buf + len; len = (TTYNAME_BUFLEN-2) - len; /* Available non-nul space. */ @@ -79,11 +79,11 @@ int ttyname_r(int fd, char *ubuf, size_t ubuflen) while ((d = readdir(fp)) != NULL) { /* This should never trigger for standard names, but we * check it to be safe. */ - if (strlen(d->d_name) > len) { /* Too big? */ + if (__strlen(d->d_name) > len) { /* Too big? */ continue; } - strcpy(s, d->d_name); + __strcpy(s, d->d_name); if ((lstat(buf, &dst) == 0) #if 0 @@ -100,8 +100,8 @@ int ttyname_r(int fd, char *ubuf, size_t ubuflen) /* We treat NULL buf as ERANGE rather than EINVAL. */ rv = ERANGE; - if (ubuf && (strlen(buf) <= ubuflen)) { - strcpy(ubuf, buf); + if (ubuf && (__strlen(buf) <= ubuflen)) { + __strcpy(ubuf, buf); rv = 0; } goto DONE; diff --git a/libc/unistd/confstr.c b/libc/unistd/confstr.c index 017cf1e8e..bfaecb198 100644 --- a/libc/unistd/confstr.c +++ b/libc/unistd/confstr.c @@ -48,10 +48,10 @@ size_t confstr ( int name, char *buf, size_t len) if (len > 0 && buf != NULL) { if (string_len <= len) - memcpy (buf, string, string_len); + __memcpy (buf, string, string_len); else { - memcpy (buf, string, len - 1); + __memcpy (buf, string, len - 1); buf[len - 1] = '\0'; } } diff --git a/libc/unistd/daemon.c b/libc/unistd/daemon.c index c584d8fc5..3c54ad234 100644 --- a/libc/unistd/daemon.c +++ b/libc/unistd/daemon.c @@ -55,12 +55,12 @@ int daemon( int nochdir, int noclose ) if (!nochdir) chdir("/"); - if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { + if (!noclose && (fd = __open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { dup2(fd, STDIN_FILENO); dup2(fd, STDOUT_FILENO); dup2(fd, STDERR_FILENO); if (fd > 2) - close(fd); + __close(fd); } return(0); } diff --git a/libc/unistd/exec.c b/libc/unistd/exec.c index 21f335da9..7bf58289b 100644 --- a/libc/unistd/exec.c +++ b/libc/unistd/exec.c @@ -232,7 +232,7 @@ int execvp(const char *path, char *const argv[]) return -1; } - if (strchr(path, '/')) { + if (__strchr(path, '/')) { execve(path, argv, __environ); CHECK_ENOEXEC: if (errno == ENOEXEC) { @@ -245,7 +245,7 @@ int execvp(const char *path, char *const argv[]) nargv = (char **) EXEC_ALLOC((n+2) * sizeof(char *), size2); nargv[0] = argv[0]; nargv[1] = (char *)path; - memcpy(nargv+2, argv+1, n*sizeof(char *)); + __memcpy(nargv+2, argv+1, n*sizeof(char *)); execve("/bin/sh", nargv, __environ); EXEC_FREE(nargv, size2); } @@ -258,7 +258,7 @@ int execvp(const char *path, char *const argv[]) p = (char *) default_path; } - plen = strlen(path); + plen = __strlen(path); if (plen > (FILENAME_MAX - 1)) { ALL_TOO_LONG: __set_errno(ENAMETOOLONG); @@ -269,7 +269,7 @@ int execvp(const char *path, char *const argv[]) if ((buf = EXEC_ALLOC(FILENAME_MAX, size)) != NULL) { int seen_small = 0; s0 = buf + len; - memcpy(s0, path, plen+1); + __memcpy(s0, path, plen+1); do { s = s0; @@ -283,7 +283,7 @@ int execvp(const char *path, char *const argv[]) goto NEXT; } s -= plen; - memcpy(s, p, plen); + __memcpy(s, p, plen); s[plen-1] = '/'; } diff --git a/libc/unistd/getlogin.c b/libc/unistd/getlogin.c index d6a11b01e..e1685692c 100644 --- a/libc/unistd/getlogin.c +++ b/libc/unistd/getlogin.c @@ -41,7 +41,7 @@ int getlogin_r(char *name, size_t len) if (! foo) return -1; - strncpy(name, foo, len); + __strncpy(name, foo, len); name[len-1] = '\0'; return 0; } @@ -50,7 +50,7 @@ char *cuserid(char *s) { char *name = getlogin(); if (s) { - return(strcpy(s, name ? name : "")); + return(__strcpy(s, name ? name : "")); } return name; } diff --git a/libc/unistd/getopt-susv3.c b/libc/unistd/getopt-susv3.c index c53e2b089..d9ee18c43 100644 --- a/libc/unistd/getopt-susv3.c +++ b/libc/unistd/getopt-susv3.c @@ -87,7 +87,7 @@ int getopt(int argc, char * const argv[], const char *optstring) #endif retval = (unsigned char) *o; /* Avoid problems for char val of -1. */ - if ((*o == ':') || !(s = strchr(optstring, *o))) { /* Illegal option? */ + if ((*o == ':') || !(s = __strchr(optstring, *o))) { /* Illegal option? */ s = illegal; retval = '?'; goto BAD; diff --git a/libc/unistd/getopt.c b/libc/unistd/getopt.c index ed5237dc5..216e0575a 100644 --- a/libc/unistd/getopt.c +++ b/libc/unistd/getopt.c @@ -149,7 +149,7 @@ static enum } ordering; # include <string.h> -# define my_index strchr +# define my_index __strchr /* Handle permutation of arguments. */ @@ -371,7 +371,7 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * then exchange with previous non-options as if it were an option, then skip everything else like a non-option. */ - if (optind != argc && !strcmp (argv[optind], "--")) + if (optind != argc && !__strcmp (argv[optind], "--")) { optind++; @@ -447,10 +447,10 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, nextchar, nameend - nextchar)) + if (!__strncmp (p->name, nextchar, nameend - nextchar)) { if ((unsigned int) (nameend - nextchar) - == (unsigned int) strlen (p->name)) + == (unsigned int) __strlen (p->name)) { /* Exact match found. */ pfound = p; @@ -479,7 +479,7 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * fprintf (stderr, _("%s: option `%s' is ambiguous\n"), argv[0], argv[optind]); } - nextchar += strlen (nextchar); + nextchar += __strlen (nextchar); optind++; optopt = 0; return '?'; @@ -517,7 +517,7 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * } - nextchar += strlen (nextchar); + nextchar += __strlen (nextchar); optopt = pfound->val; return '?'; @@ -535,12 +535,12 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * _("%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); } - nextchar += strlen (nextchar); + nextchar += __strlen (nextchar); optopt = pfound->val; return optstring[0] == ':' ? ':' : '?'; } } - nextchar += strlen (nextchar); + nextchar += __strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) @@ -651,9 +651,9 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, nextchar, nameend - nextchar)) + if (!__strncmp (p->name, nextchar, nameend - nextchar)) { - if ((unsigned int) (nameend - nextchar) == strlen (p->name)) + if ((unsigned int) (nameend - nextchar) == __strlen (p->name)) { /* Exact match found. */ pfound = p; @@ -678,7 +678,7 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), argv[0], argv[optind]); } - nextchar += strlen (nextchar); + nextchar += __strlen (nextchar); optind++; return '?'; } @@ -700,7 +700,7 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * argv[0], pfound->name); } - nextchar += strlen (nextchar); + nextchar += __strlen (nextchar); return '?'; } } @@ -716,11 +716,11 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * _("%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); } - nextchar += strlen (nextchar); + nextchar += __strlen (nextchar); return optstring[0] == ':' ? ':' : '?'; } } - nextchar += strlen (nextchar); + nextchar += __strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) diff --git a/libc/unistd/getpass.c b/libc/unistd/getpass.c index ac2159036..5dc6f5cf1 100644 --- a/libc/unistd/getpass.c +++ b/libc/unistd/getpass.c @@ -80,7 +80,7 @@ getpass (prompt) fgets (buf, PWD_BUFFER_SIZE-1, in); if (buf != NULL) { - nread = strlen(buf); + nread = __strlen(buf); if (nread < 0) buf[0] = '\0'; else if (buf[nread - 1] == '\n') diff --git a/libc/unistd/getsubopt.c b/libc/unistd/getsubopt.c index 2759a6d25..bebfbc4ed 100644 --- a/libc/unistd/getsubopt.c +++ b/libc/unistd/getsubopt.c @@ -50,7 +50,7 @@ int getsubopt(char **optionp, char *const *tokens, char **valuep) /* Try to match the characters between *OPTIONP and VSTART against one of the TOKENS. */ for (cnt = 0; tokens[cnt] != NULL; ++cnt) - if (memcmp (*optionp, tokens[cnt], vstart - *optionp) == 0 + if (__memcmp (*optionp, tokens[cnt], vstart - *optionp) == 0 && tokens[cnt][vstart - *optionp] == '\0') { /* We found the current option in TOKENS. */ diff --git a/libc/unistd/sleep.c b/libc/unistd/sleep.c index 20689da0e..01a9b641b 100644 --- a/libc/unistd/sleep.c +++ b/libc/unistd/sleep.c @@ -56,7 +56,7 @@ unsigned int sleep (unsigned int seconds) in libc. We block SIGCHLD first. */ if (__sigemptyset (&set) < 0 || __sigaddset (&set, SIGCHLD) < 0 - || sigprocmask (SIG_BLOCK, &set, &oset)) + || __sigprocmask (SIG_BLOCK, &set, &oset)) return -1; /* If SIGCHLD is already blocked, we don't have to do anything. */ @@ -73,7 +73,7 @@ unsigned int sleep (unsigned int seconds) { saved_errno = errno; /* Restore the original signal mask. */ - (void) sigprocmask (SIG_SETMASK, &oset, (sigset_t *) NULL); + (void) __sigprocmask (SIG_SETMASK, &oset, (sigset_t *) NULL); __set_errno (saved_errno); return -1; } @@ -85,13 +85,13 @@ unsigned int sleep (unsigned int seconds) saved_errno = errno; /* Restore the original signal mask. */ - (void) sigprocmask (SIG_SETMASK, &oset, (sigset_t *) NULL); + (void) __sigprocmask (SIG_SETMASK, &oset, (sigset_t *) NULL); __set_errno (saved_errno); } else { /* We should unblock SIGCHLD. Restore the original signal mask. */ - (void) sigprocmask (SIG_SETMASK, &oset, (sigset_t *) NULL); + (void) __sigprocmask (SIG_SETMASK, &oset, (sigset_t *) NULL); result = nanosleep (&ts, &ts); } } |