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);
}
}
-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];
#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. */
#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;
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;
}
}
}
}
- strcpy(name, inet_ntoa(addr));
+ strcpy(name, inet_ntoa(*(struct in_addr *)&addr));
return 0;
}
#include <sys/types.h>
#include <fcntl.h>
#include <stdlib.h>
+#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
r = write(fd, buf, len);
tmperr = errno;
+ fsync(fd);
close(fd);
if (r == -1) {
return -1;
}
- if (r < len) {
+ if ((size_t)r < len) {
unlink(name);
errno = ENOSPC;
return -1;
#include <lib.h>
#include <sys/types.h>
#include <unistd.h>
+#include <minix/minlib.h>
void std_err(const char *s)
{
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;
}
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;
break;
default:
/* Keep original as-is */
- addr = data;
+ addr = (vir_bytes)data;
break;
}
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);
#include <net/gen/udp_io.h>
#include <net/gen/ip_hdr.h>
-#include <net/gen/icmp_hdr.h>
#define DEBUG 0
{
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;
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);
}
return -1;
}
- assert(r >= sizeof(*io_hdrp));
+ assert((size_t)r >= sizeof(*io_hdrp));
length= r-sizeof(*io_hdrp);
io_hdrp= buf;
#include <errno.h>
#include <stdlib.h>
+#include <string.h>
#include <sys/ioctl.h>
#include <sys/ioc_net.h>
#include <sys/socket.h>
#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>
{
ip_hdr_t *ip_hdr;
- int ihl;
- icmp_hdr_t *icmp_hdr;
struct sockaddr_in *sinp;
sinp = (struct sockaddr_in *) __UNCONST(dest_addr);
errno= t_errno;
return -1;
}
- assert(r == buflen);
+ assert((size_t)r == buflen);
free(buf);
return length;
}
*/
int setpgid(pid_t pid, pid_t pgid)
{
- pid_t _pid, _pgid, sid, cpid;
+ pid_t _pid, _pgid, cpid;
_pid = pid;
_pgid = pgid;
/* Simple stub for now. */
int setrlimit(int resource, const struct rlimit *rlp)
{
- rlim_t limit;
-
+
switch (resource)
{
case RLIMIT_CPU:
return 0;
}
-
#include <minix/type.h>
#include <minix/minlib.h>
#include <minix/partition.h>
+#include <sys/ioctl.h>
#include <sys/ioc_disk.h>
#include <unistd.h>
#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>
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;
#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>
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);
}
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;
}