libc: resolve minix clang warnings
Change-Id: If6c42f7346cc1b00b387ae8d3b4f0df3ffb0244f
This commit is contained in:
		
							parent
							
								
									685aa79304
								
							
						
					
					
						commit
						5dd8da10c5
					
				@ -15,6 +15,9 @@ void _cpuid(u32_t *eax, u32_t *ebx, u32_t *ecx, u32_t *edx);
 | 
			
		||||
int load_mtab(char *_prog_name);
 | 
			
		||||
int get_mtab_entry(char dev[PATH_MAX], char mount_point[PATH_MAX],
 | 
			
		||||
			char type[MNTNAMELEN], char flags[MNTFLAGLEN]);
 | 
			
		||||
int servxcheck(unsigned long peer, const char *service,
 | 
			
		||||
	void (*logf)(int pass, const char *name));
 | 
			
		||||
char *servxfile(const char *file);
 | 
			
		||||
 | 
			
		||||
/* read_tsc() and friends */
 | 
			
		||||
void read_tsc(u32_t *hi, u32_t *lo);
 | 
			
		||||
 | 
			
		||||
@ -149,7 +149,7 @@ static void skipwhite(void)
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void parse_err(void)
 | 
			
		||||
static void __dead parse_err(void)
 | 
			
		||||
/* Tell user that you can't parse past the current character. */
 | 
			
		||||
{
 | 
			
		||||
    char sc[2];
 | 
			
		||||
 | 
			
		||||
@ -42,7 +42,7 @@
 | 
			
		||||
 | 
			
		||||
#define BUF_SIZE   512		  /* size of the /etc/mtab buffer */
 | 
			
		||||
 | 
			
		||||
char *etc_mtab = "/etc/mtab";	  /* name of the /etc/mtab file */
 | 
			
		||||
const char *etc_mtab = "/etc/mtab";	  /* name of the /etc/mtab file */
 | 
			
		||||
static char mtab_in[BUF_SIZE+1];  /* holds /etc/mtab when it is read in */
 | 
			
		||||
static char *iptr = mtab_in;	  /* pointer to next line to feed out. */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -24,6 +24,8 @@
 | 
			
		||||
#include <net/gen/inet.h>
 | 
			
		||||
#include <net/gen/socket.h>
 | 
			
		||||
#include <netdb.h>
 | 
			
		||||
#include <arpa/inet.h>
 | 
			
		||||
#include <minix/minlib.h>
 | 
			
		||||
 | 
			
		||||
/* Default service access file. */
 | 
			
		||||
static const char *path_servacces = _PATH_SERVACCES;
 | 
			
		||||
@ -76,12 +78,12 @@ static int netspec(char *word, ipaddr_t *addr, ipaddr_t *mask)
 | 
			
		||||
    if ((slash= strchr(word, '/')) == NULL) slash= S32;
 | 
			
		||||
 | 
			
		||||
    *slash= 0;
 | 
			
		||||
    r= inet_aton(word, addr);
 | 
			
		||||
    r= inet_aton(word, (struct in_addr *)addr);
 | 
			
		||||
    *slash++= '/';
 | 
			
		||||
    if (!r) return 0;
 | 
			
		||||
 | 
			
		||||
    r= 0;
 | 
			
		||||
    while ((*slash - '0') < 10u) {
 | 
			
		||||
    while ((unsigned int)(*slash - '0') < 10u) {
 | 
			
		||||
	r= 10*r + (*slash++ - '0');
 | 
			
		||||
	if (r > 32) return 0;
 | 
			
		||||
    }
 | 
			
		||||
@ -148,7 +150,7 @@ static int get_name(ipaddr_t addr, char *name)
 | 
			
		||||
	    }
 | 
			
		||||
	}
 | 
			
		||||
    }
 | 
			
		||||
    strcpy(name, inet_ntoa(addr));
 | 
			
		||||
    strcpy(name, inet_ntoa(*(struct in_addr *)&addr));
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -5,6 +5,7 @@
 | 
			
		||||
#include <sys/types.h>
 | 
			
		||||
#include <fcntl.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
@ -38,6 +39,7 @@ int sethostname(const char *buf, size_t len)
 | 
			
		||||
 | 
			
		||||
	r = write(fd, buf, len);
 | 
			
		||||
	tmperr = errno;
 | 
			
		||||
	fsync(fd);
 | 
			
		||||
	close(fd);
 | 
			
		||||
 | 
			
		||||
	if (r == -1) {
 | 
			
		||||
@ -46,7 +48,7 @@ int sethostname(const char *buf, size_t len)
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (r < len) {
 | 
			
		||||
	if ((size_t)r < len) {
 | 
			
		||||
		unlink(name);
 | 
			
		||||
		errno = ENOSPC;
 | 
			
		||||
		return -1;
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,7 @@
 | 
			
		||||
#include <lib.h>
 | 
			
		||||
#include <sys/types.h>
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
#include <minix/minlib.h>
 | 
			
		||||
 | 
			
		||||
void std_err(const char *s)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
@ -29,7 +29,7 @@ int fcntl(int fd, int cmd, ...)
 | 
			
		||||
     case F_SETLK:
 | 
			
		||||
     case F_SETLKW:
 | 
			
		||||
     case F_FREESP:
 | 
			
		||||
	m.m_lc_vfs_fcntl.arg_ptr = va_arg(argp, struct flock *);
 | 
			
		||||
	m.m_lc_vfs_fcntl.arg_ptr = (vir_bytes)va_arg(argp, struct flock *);
 | 
			
		||||
	break;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -7,7 +7,7 @@ int gcov_flush_svr(char *buff, int buff_sz, int server_nr)
 | 
			
		||||
	message m;
 | 
			
		||||
 | 
			
		||||
	memset(&m, 0, sizeof(m));
 | 
			
		||||
	m.m_lc_vfs_gcov.buff_p = buff;
 | 
			
		||||
	m.m_lc_vfs_gcov.buff_p = (vir_bytes)buff;
 | 
			
		||||
	m.m_lc_vfs_gcov.buff_sz = buff_sz;
 | 
			
		||||
	m.m_lc_vfs_gcov.pid = server_nr;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -71,7 +71,7 @@ int     ioctl(int fd, unsigned long request, ...)
 | 
			
		||||
		break;
 | 
			
		||||
	default:
 | 
			
		||||
		/* Keep original as-is */
 | 
			
		||||
		addr = data;
 | 
			
		||||
		addr = (vir_bytes)data;
 | 
			
		||||
		break;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -12,7 +12,7 @@ int ptrace(int req, pid_t pid, void *addr, int data)
 | 
			
		||||
  memset(&m, 0, sizeof(m));
 | 
			
		||||
  m.m_lc_pm_ptrace.pid = pid;
 | 
			
		||||
  m.m_lc_pm_ptrace.req = req;
 | 
			
		||||
  m.m_lc_pm_ptrace.addr = addr;
 | 
			
		||||
  m.m_lc_pm_ptrace.addr = (vir_bytes)addr;
 | 
			
		||||
  m.m_lc_pm_ptrace.data = data;
 | 
			
		||||
  if (_syscall(PM_PROC_NR, PM_PTRACE, &m) < 0) return(-1);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -19,7 +19,6 @@
 | 
			
		||||
#include <net/gen/udp_io.h>
 | 
			
		||||
 | 
			
		||||
#include <net/gen/ip_hdr.h>
 | 
			
		||||
#include <net/gen/icmp_hdr.h>
 | 
			
		||||
 | 
			
		||||
#define DEBUG 0
 | 
			
		||||
 | 
			
		||||
@ -88,15 +87,14 @@ ssize_t recvfrom(int sock, void *__restrict buffer, size_t length,
 | 
			
		||||
 | 
			
		||||
	{
 | 
			
		||||
		ip_hdr_t *ip_hdr;
 | 
			
		||||
       		int ihl, rd;
 | 
			
		||||
		icmp_hdr_t *icmp_hdr;
 | 
			
		||||
		int rd;
 | 
			
		||||
		struct sockaddr_in sin;
 | 
			
		||||
 | 
			
		||||
		rd = read(sock, buffer, length);
 | 
			
		||||
 | 
			
		||||
		if(rd < 0) return rd;
 | 
			
		||||
 | 
			
		||||
		assert(rd >= sizeof(*ip_hdr));
 | 
			
		||||
		assert((size_t)rd >= sizeof(*ip_hdr));
 | 
			
		||||
 | 
			
		||||
		ip_hdr= buffer;
 | 
			
		||||
 | 
			
		||||
@ -108,8 +106,8 @@ ssize_t recvfrom(int sock, void *__restrict buffer, size_t length,
 | 
			
		||||
			sin.sin_addr.s_addr= ip_hdr->ih_src;
 | 
			
		||||
			sin.sin_len= sizeof(sin);
 | 
			
		||||
			len= *address_len;
 | 
			
		||||
			if (len > sizeof(sin))
 | 
			
		||||
				len= sizeof(sin);
 | 
			
		||||
			if ((size_t)len > sizeof(sin))
 | 
			
		||||
				len= (int)sizeof(sin);
 | 
			
		||||
			memcpy(address, &sin, len);
 | 
			
		||||
			*address_len= sizeof(sin);
 | 
			
		||||
		}
 | 
			
		||||
@ -237,7 +235,7 @@ static ssize_t _udp_recvfrom(int sock, void *__restrict buffer, size_t length,
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	assert(r >= sizeof(*io_hdrp));
 | 
			
		||||
	assert((size_t)r >= sizeof(*io_hdrp));
 | 
			
		||||
	length= r-sizeof(*io_hdrp);
 | 
			
		||||
 | 
			
		||||
	io_hdrp= buf;
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,7 @@
 | 
			
		||||
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <sys/ioctl.h>
 | 
			
		||||
#include <sys/ioc_net.h>
 | 
			
		||||
#include <sys/socket.h>
 | 
			
		||||
 | 
			
		||||
@ -13,7 +13,6 @@
 | 
			
		||||
 | 
			
		||||
#include <net/gen/in.h>
 | 
			
		||||
#include <net/gen/ip_hdr.h>
 | 
			
		||||
#include <net/gen/icmp_hdr.h>
 | 
			
		||||
#include <net/gen/tcp.h>
 | 
			
		||||
#include <net/gen/tcp_io.h>
 | 
			
		||||
#include <net/gen/udp.h>
 | 
			
		||||
@ -78,8 +77,6 @@ ssize_t sendto(int sock, const void *message, size_t length, int flags,
 | 
			
		||||
 | 
			
		||||
	{
 | 
			
		||||
		ip_hdr_t *ip_hdr;
 | 
			
		||||
		int ihl;
 | 
			
		||||
		icmp_hdr_t *icmp_hdr;
 | 
			
		||||
		struct sockaddr_in *sinp;
 | 
			
		||||
 | 
			
		||||
		sinp = (struct sockaddr_in *) __UNCONST(dest_addr);
 | 
			
		||||
@ -199,7 +196,7 @@ static ssize_t _udp_sendto(int sock, const void *message, size_t length,
 | 
			
		||||
		errno= t_errno;
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
	assert(r == buflen);
 | 
			
		||||
	assert((size_t)r == buflen);
 | 
			
		||||
	free(buf);
 | 
			
		||||
	return length;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -11,7 +11,7 @@
 | 
			
		||||
 */
 | 
			
		||||
int setpgid(pid_t pid, pid_t pgid)
 | 
			
		||||
{
 | 
			
		||||
	pid_t _pid, _pgid, sid, cpid;
 | 
			
		||||
	pid_t _pid, _pgid, cpid;
 | 
			
		||||
 | 
			
		||||
	_pid = pid;
 | 
			
		||||
	_pgid = pgid;
 | 
			
		||||
 | 
			
		||||
@ -9,7 +9,6 @@
 | 
			
		||||
/* Simple stub for now. */
 | 
			
		||||
int setrlimit(int resource, const struct rlimit *rlp)
 | 
			
		||||
{
 | 
			
		||||
	rlim_t limit;
 | 
			
		||||
 | 
			
		||||
	switch (resource)
 | 
			
		||||
	{
 | 
			
		||||
@ -35,4 +34,3 @@ int setrlimit(int resource, const struct rlimit *rlp)
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -17,6 +17,7 @@
 | 
			
		||||
#include <minix/type.h>
 | 
			
		||||
#include <minix/minlib.h>
 | 
			
		||||
#include <minix/partition.h>
 | 
			
		||||
#include <sys/ioctl.h>
 | 
			
		||||
#include <sys/ioc_disk.h>
 | 
			
		||||
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
 | 
			
		||||
@ -9,9 +9,11 @@ __weak_alias(socket, __socket30)
 | 
			
		||||
#include <fcntl.h>
 | 
			
		||||
#include <signal.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
#include <sys/socket.h>
 | 
			
		||||
 | 
			
		||||
#include <sys/ioctl.h>
 | 
			
		||||
#include <sys/ioc_net.h>
 | 
			
		||||
#include <net/hton.h>
 | 
			
		||||
#include <net/gen/in.h>
 | 
			
		||||
@ -148,8 +150,7 @@ static int _udp_socket(int type, int protocol)
 | 
			
		||||
 | 
			
		||||
static int _raw_socket(int type, int protocol)
 | 
			
		||||
{
 | 
			
		||||
	int r, fd, t_errno, flags = O_RDWR;
 | 
			
		||||
	struct sockaddr_in sin;
 | 
			
		||||
	int fd, flags = O_RDWR;
 | 
			
		||||
	nwio_ipopt_t ipopt;
 | 
			
		||||
	int result;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -6,6 +6,7 @@
 | 
			
		||||
#include <fcntl.h>
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
#include <net/netlib.h>
 | 
			
		||||
#include <sys/ioctl.h>
 | 
			
		||||
#include <sys/ioc_net.h>
 | 
			
		||||
#include <sys/socket.h>
 | 
			
		||||
#include <sys/stat.h>
 | 
			
		||||
 | 
			
		||||
@ -23,8 +23,8 @@ int sprofile(int action,
 | 
			
		||||
  m.m_lc_pm_sprof.mem_size	= size;
 | 
			
		||||
  m.m_lc_pm_sprof.freq		= freq;
 | 
			
		||||
  m.m_lc_pm_sprof.intr_type	= type;
 | 
			
		||||
  m.m_lc_pm_sprof.ctl_ptr	= ctl_ptr;
 | 
			
		||||
  m.m_lc_pm_sprof.mem_ptr	= mem_ptr;
 | 
			
		||||
  m.m_lc_pm_sprof.ctl_ptr	= (vir_bytes)ctl_ptr;
 | 
			
		||||
  m.m_lc_pm_sprof.mem_ptr	= (vir_bytes)mem_ptr;
 | 
			
		||||
 | 
			
		||||
  return _syscall(PM_PROC_NR, PM_SPROF, &m);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -39,7 +39,9 @@ static ssize_t vectorio_buffer(int fildes, const struct iovec *iov,
 | 
			
		||||
			while (copied < r)
 | 
			
		||||
			{
 | 
			
		||||
				assert(iovidx < iovcnt);
 | 
			
		||||
				len = MIN(r - copied, iov[iovidx].iov_len);
 | 
			
		||||
				len = iov[iovidx].iov_len;
 | 
			
		||||
				if (len > r - copied)
 | 
			
		||||
					len = r - copied;
 | 
			
		||||
				memcpy(iov[iovidx++].iov_base, buffer + copied, len);
 | 
			
		||||
				copied += len;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user