Resolve more warnings

Change-Id: Ibc1b7f7cd45ad7295285e59c6ce55888266fece8
This commit is contained in:
David van Moolenbroek 2015-09-21 17:14:39 +00:00
parent 9488aa4c04
commit 7c48de6cc4
73 changed files with 264 additions and 296 deletions

View file

@ -526,7 +526,7 @@ connectlog_r(struct syslog_data *data)
} }
if (!data->log_connected) { if (!data->log_connected) {
#if defined(__minix) #if defined(__minix)
if(ioctl(data->log_file, NWIOSUDSTADDR, (void *) &sun) < 0) if(ioctl(data->log_file, NWIOSUDSTADDR, __UNCONST(&sun)) < 0)
#else #else
if (connect(data->log_file, if (connect(data->log_file,

View file

@ -82,7 +82,7 @@ int fs_putnode(ino_t ino_nr, unsigned int count)
lpuffs_debug("%"PRIu64": %d %s %u %u\n", lpuffs_debug("%"PRIu64": %d %s %u %u\n",
ino, ino,
pn_cur->pn_count, pn_cur->pn_count,
pn_cur->pn_po.po_path, (char *)pn_cur->pn_po.po_path,
pn_cur->pn_po.po_len, pn_cur->pn_po.po_len,
pn_cur->pn_po.po_hash); pn_cur->pn_po.po_hash);
} }

View file

@ -161,7 +161,7 @@ ssize_t fs_rdlink(ino_t ino_nr, struct fsdriver_data *data, size_t bytes)
r = fsdriver_copyout(data, 0, path, bytes); r = fsdriver_copyout(data, 0, path, bytes);
return (r == OK) ? bytes : r; return (r == OK) ? (ssize_t)bytes : r;
} }

View file

@ -258,7 +258,8 @@ int fs_slink(ino_t dir_nr, char *name, uid_t uid, gid_t gid,
/* Copy the link name's last component */ /* Copy the link name's last component */
pcn.pcn_namelen = strlen(name); pcn.pcn_namelen = strlen(name);
if (pcn.pcn_namelen <= NAME_MAX); if (pcn.pcn_namelen > NAME_MAX)
return(ENAMETOOLONG);
strcpy(pcn.pcn_name, name); strcpy(pcn.pcn_name, name);
if (bytes >= PATH_MAX) if (bytes >= PATH_MAX)

View file

@ -1,6 +1,3 @@
# LSC For nwo
NOGCCERROR:= yes
PROG= backup PROG= backup
MAN= MAN=

View file

@ -33,9 +33,6 @@
# malloc() and its relatives (most do). # malloc() and its relatives (most do).
# #
#DEFS = -DUNIX -DMALLOCH #DEFS = -DUNIX -DMALLOCH
#LSC For now...
NOGCCERROR:= yes
DEFS= -DUNIX -DUSG -DSTDLIB DEFS= -DUNIX -DUSG -DSTDLIB
CPPFLAGS+= ${DEFS} CPPFLAGS+= ${DEFS}

View file

@ -1,5 +1,3 @@
# LSC For now
NOGCCERROR:= yes
PROG= cleantmp PROG= cleantmp
MAN= MAN=

View file

@ -1,5 +1,3 @@
# LSC For Now...
NOGCCERROR:= yes
PROG= compress PROG= compress
MAN= MAN=

View file

@ -1,7 +1,4 @@
# Makefile for cron. # Makefile for cron.
# LSC For Now...
NOGCCERROR:=yes
PROG= cron PROG= cron
SRCS= cron.c tab.c misc.c SRCS= cron.c tab.c misc.c
MAN= MAN=

View file

@ -2,9 +2,6 @@
.include <bsd.own.mk> .include <bsd.own.mk>
# LSC For now...
NOGCCERROR:= yes
PROG= crontab PROG= crontab
SRCS= crontab.c tab.c misc.c SRCS= crontab.c tab.c misc.c
CPPFLAGS+= -I${.CURDIR} -I${NETBSDSRCDIR}/minix/commands/cron CPPFLAGS+= -I${.CURDIR} -I${NETBSDSRCDIR}/minix/commands/cron

View file

@ -13,6 +13,7 @@
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <limits.h> #include <limits.h>
#include <stdint.h> #include <stdint.h>
#include <inttypes.h>
#include <assert.h> #include <assert.h>
#ifdef __minix #ifdef __minix
@ -191,7 +192,8 @@ void show_part(struct part_entry *p)
printf("%3d ", (n-1) / 2); printf("%3d ", (n-1) / 2);
show_chs(p->lowsec); show_chs(p->lowsec);
show_chs(p->lowsec + p->size - 1); show_chs(p->lowsec + p->size - 1);
printf(" %8u %8u %7u\n", p->lowsec, p->size, p->size / 2); printf(" %8"PRIu32" %8"PRIu32" %7"PRIu32"\n",
p->lowsec, p->size, p->size / 2);
} }
void usage(void) void usage(void)

View file

@ -16,6 +16,7 @@
#include <assert.h> #include <assert.h>
#include <ctype.h> #include <ctype.h>
#include <partition.h> #include <partition.h>
#include <inttypes.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -309,7 +310,7 @@ maketree(struct node *thisdir, char *name, int level)
} }
if(!(dirnodes = malloc(sizeof(*dirnodes)*reserved_dirnodes))) { if(!(dirnodes = malloc(sizeof(*dirnodes)*reserved_dirnodes))) {
fprintf(stderr, "couldn't allocate dirnodes (%d bytes)\n", fprintf(stderr, "couldn't allocate dirnodes (%zu bytes)\n",
sizeof(*dirnodes)*reserved_dirnodes); sizeof(*dirnodes)*reserved_dirnodes);
exit(1); exit(1);
} }
@ -508,7 +509,7 @@ makepathtables(struct node *root, int littleendian, int *bytes, int fd)
if(*bytes % ISO_SECTOR) { if(*bytes % ISO_SECTOR) {
ssize_t x; ssize_t x;
x = ISO_SECTOR-(*bytes % ISO_SECTOR); x = ISO_SECTOR-(*bytes % ISO_SECTOR);
write(fd, block, x); Write(fd, block, x);
*bytes += x; *bytes += x;
} }
@ -595,7 +596,7 @@ write_direntry(struct node * n, char *origname, int fd)
if(total != entry.recordsize || (total % 2) != 0) { if(total != entry.recordsize || (total % 2) != 0) {
printf("%2d, %2d! ", total, entry.recordsize); printf("%2d, %2d! ", total, entry.recordsize);
printf("%3d = %3d - %2d + %2d\n", printf("%3d = %3zu - %2zu + %2d\n",
entry.recordsize, sizeof(entry), sizeof(entry.name), namelen); entry.recordsize, sizeof(entry), sizeof(entry.name), namelen);
} }
@ -833,7 +834,8 @@ writebootimage(char *bootimage, int bootfd, int fd, int *currentsector,
exit(1); exit(1);
} }
fprintf(stderr, " * appended sector info: 0x%llx len 0x%x\n", fprintf(stderr,
" * appended sector info: 0x%"PRIx64" len 0x%x\n",
bap[0].sector, bap[0].length); bap[0].sector, bap[0].length);
addr = buf; addr = buf;
@ -891,7 +893,8 @@ writebootrecord(int fd, int *currentsector, int bootcatalogsector)
w += Writefield(fd, bootrecord.zero2); w += Writefield(fd, bootrecord.zero2);
if(w != ISO_SECTOR) { if(w != ISO_SECTOR) {
fprintf(stderr, "WARNING: something went wrong - boot record (%d) isn't a sector size (%d)\n", fprintf(stderr, "WARNING: something went wrong - "
"boot record (%zd) isn't a sector size (%d)\n",
w, ISO_SECTOR); w, ISO_SECTOR);
} }
@ -926,8 +929,8 @@ main(int argc, char *argv[])
if(sizeof(struct pvd) != ISO_SECTOR) { if(sizeof(struct pvd) != ISO_SECTOR) {
fprintf(stderr, "Something confusing happened at\n" fprintf(stderr, "Something confusing happened at\n"
"compile-time; pvd should be a sector size. %d != %d\n", "compile-time; pvd should be a sector size. "
sizeof(struct pvd), ISO_SECTOR); "%zd != %d\n", sizeof(struct pvd), ISO_SECTOR);
return 1; return 1;
} }

View file

@ -7,6 +7,4 @@ LDADD+= -li2cdriver -lchardriver -lsys -ltimers
CPPFLAGS+= -I${NETBSDSRCDIR} CPPFLAGS+= -I${NETBSDSRCDIR}
NOCLANGERROR=yes
.include <minix.service.mk> .include <minix.service.mk>

View file

@ -113,7 +113,7 @@ struct calibration
#define CAL_COEF_FIRST AC1_MSB_REG #define CAL_COEF_FIRST AC1_MSB_REG
#define CAL_COEF_LAST MD_LSB_REG #define CAL_COEF_LAST MD_LSB_REG
#define CAL_COEF_IS_VALID(x) (x != 0x0000 && x != 0xffff) #define CAL_COEF_IS_VALID(x) (x != 0x0000 && (uint16_t)x != 0xffff)
#define SENSOR_VAL_MSB_REG 0xf6 #define SENSOR_VAL_MSB_REG 0xf6
#define SENSOR_VAL_LSB_REG 0xf7 #define SENSOR_VAL_LSB_REG 0xf7

View file

@ -17,7 +17,7 @@ int get_mtab_entry(char dev[PATH_MAX], char mount_point[PATH_MAX],
char type[MNTNAMELEN], char flags[MNTFLAGLEN]); char type[MNTNAMELEN], char flags[MNTFLAGLEN]);
int servxcheck(unsigned long peer, const char *service, int servxcheck(unsigned long peer, const char *service,
void (*logf)(int pass, const char *name)); void (*logf)(int pass, const char *name));
char *servxfile(const char *file); const char *servxfile(const char *file);
/* read_tsc() and friends */ /* read_tsc() and friends */
void read_tsc(u32_t *hi, u32_t *lo); void read_tsc(u32_t *hi, u32_t *lo);

View file

@ -1,7 +1,5 @@
# Makefile for the common audio framework # Makefile for the common audio framework
NOGCCERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM CPPFLAGS+= -D_MINIX_SYSTEM
LIB= audiodriver LIB= audiodriver

View file

@ -47,8 +47,10 @@ static int init_buffers(sub_dev_t *sub_dev_ptr);
static int get_started(sub_dev_t *sub_dev_ptr); static int get_started(sub_dev_t *sub_dev_ptr);
static int io_ctl_length(int io_request); static int io_ctl_length(int io_request);
static special_file_t* get_special_file(int minor_dev_nr); static special_file_t* get_special_file(int minor_dev_nr);
#if defined(__i386__)
static void tell_dev(vir_bytes buf, size_t size, int pci_bus, static void tell_dev(vir_bytes buf, size_t size, int pci_bus,
int pci_dev, int pci_func); int pci_dev, int pci_func);
#endif
static char io_ctl_buf[IOCPARM_MASK]; static char io_ctl_buf[IOCPARM_MASK];
static int irq_hook_id = 0; /* id of irq hook at the kernel */ static int irq_hook_id = 0; /* id of irq hook at the kernel */
@ -822,6 +824,7 @@ static special_file_t* get_special_file(int minor_dev_nr) {
return NULL; return NULL;
} }
#if defined(__i386__)
static void tell_dev(vir_bytes buf, size_t size, int pci_bus, static void tell_dev(vir_bytes buf, size_t size, int pci_bus,
int pci_dev, int pci_func) int pci_dev, int pci_func)
{ {
@ -858,3 +861,4 @@ static void tell_dev(vir_bytes buf, size_t size, int pci_bus,
return; return;
} }
} }
#endif

View file

@ -1,8 +1,6 @@
# Makefile for libbdev # Makefile for libbdev
.include <bsd.own.mk> .include <bsd.own.mk>
NOGCCERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM CPPFLAGS+= -D_MINIX_SYSTEM
LIB= bdev LIB= bdev

View file

@ -58,7 +58,7 @@ static int bdev_retry(int *driver_tries, int *transfer_tries, int *result)
return FALSE; return FALSE;
} }
static int bdev_opcl(int req, dev_t dev, int access) static int bdev_opcl(int req, dev_t dev, int bits)
{ {
/* Open or close the given minor device. /* Open or close the given minor device.
*/ */
@ -69,7 +69,7 @@ static int bdev_opcl(int req, dev_t dev, int access)
memset(&m, 0, sizeof(m)); memset(&m, 0, sizeof(m));
m.m_type = req; m.m_type = req;
m.m_lbdev_lblockdriver_msg.minor = minor(dev); m.m_lbdev_lblockdriver_msg.minor = minor(dev);
m.m_lbdev_lblockdriver_msg.access = access; m.m_lbdev_lblockdriver_msg.access = bits;
r = bdev_sendrec(dev, &m); r = bdev_sendrec(dev, &m);
} while (bdev_retry(&driver_tries, NULL, &r)); } while (bdev_retry(&driver_tries, NULL, &r));
@ -77,17 +77,17 @@ static int bdev_opcl(int req, dev_t dev, int access)
return r; return r;
} }
int bdev_open(dev_t dev, int access) int bdev_open(dev_t dev, int bits)
{ {
/* Open the given minor device. /* Open the given minor device.
* File system usage note: typically called from mount, after bdev_driver. * File system usage note: typically called from mount, after bdev_driver.
*/ */
int r; int r;
r = bdev_opcl(BDEV_OPEN, dev, access); r = bdev_opcl(BDEV_OPEN, dev, bits);
if (r == OK) if (r == OK)
bdev_minor_add(dev, access); bdev_minor_add(dev, bits);
return r; return r;
} }
@ -116,16 +116,16 @@ static int bdev_rdwt_setup(int req, dev_t dev, u64_t pos, char *buf,
*/ */
endpoint_t endpt; endpoint_t endpt;
cp_grant_id_t grant; cp_grant_id_t grant;
int access; int perm;
assert((ssize_t) count >= 0); assert((ssize_t) count >= 0);
if ((endpt = bdev_driver_get(dev)) == NONE) if ((endpt = bdev_driver_get(dev)) == NONE)
return EDEADSRCDST; return EDEADSRCDST;
access = (req == BDEV_READ) ? CPF_WRITE : CPF_READ; perm = (req == BDEV_READ) ? CPF_WRITE : CPF_READ;
grant = cpf_grant_direct(endpt, (vir_bytes) buf, count, access); grant = cpf_grant_direct(endpt, (vir_bytes) buf, count, perm);
if (!GRANT_VALID(grant)) { if (!GRANT_VALID(grant)) {
printf("bdev: unable to allocate grant!\n"); printf("bdev: unable to allocate grant!\n");
@ -179,19 +179,19 @@ static int bdev_vrdwt_setup(int req, dev_t dev, u64_t pos, iovec_t *vec,
ssize_t size; ssize_t size;
endpoint_t endpt; endpoint_t endpt;
cp_grant_id_t grant; cp_grant_id_t grant;
int i, access; int i, perm;
assert(count <= NR_IOREQS); assert(count <= NR_IOREQS);
if ((endpt = bdev_driver_get(dev)) == NONE) if ((endpt = bdev_driver_get(dev)) == NONE)
return EDEADSRCDST; return EDEADSRCDST;
access = (req == BDEV_GATHER) ? CPF_WRITE : CPF_READ; perm = (req == BDEV_GATHER) ? CPF_WRITE : CPF_READ;
size = 0; size = 0;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
grant = cpf_grant_direct(endpt, vec[i].iov_addr, vec[i].iov_size, grant = cpf_grant_direct(endpt, vec[i].iov_addr, vec[i].iov_size,
access); perm);
if (!GRANT_VALID(grant)) { if (!GRANT_VALID(grant)) {
printf("bdev: unable to allocate grant!\n"); printf("bdev: unable to allocate grant!\n");
@ -311,7 +311,7 @@ static int bdev_ioctl_setup(dev_t dev, unsigned long request, void *buf,
endpoint_t endpt; endpoint_t endpt;
size_t size; size_t size;
cp_grant_id_t grant; cp_grant_id_t grant;
int access; int perm;
if ((endpt = bdev_driver_get(dev)) == NONE) if ((endpt = bdev_driver_get(dev)) == NONE)
return EDEADSRCDST; return EDEADSRCDST;
@ -321,12 +321,12 @@ static int bdev_ioctl_setup(dev_t dev, unsigned long request, void *buf,
else else
size = _MINIX_IOCTL_SIZE(request); size = _MINIX_IOCTL_SIZE(request);
access = 0; perm = 0;
if (_MINIX_IOCTL_IOR(request)) access |= CPF_WRITE; if (_MINIX_IOCTL_IOR(request)) perm |= CPF_WRITE;
if (_MINIX_IOCTL_IOW(request)) access |= CPF_READ; if (_MINIX_IOCTL_IOW(request)) perm |= CPF_READ;
/* The size may be 0, in which case 'buf' need not be a valid pointer. */ /* The size may be 0, in which case 'buf' need not be a valid pointer. */
grant = cpf_grant_direct(endpt, (vir_bytes) buf, size, access); grant = cpf_grant_direct(endpt, (vir_bytes) buf, size, perm);
if (!GRANT_VALID(grant)) { if (!GRANT_VALID(grant)) {
printf("bdev: unable to allocate grant!\n"); printf("bdev: unable to allocate grant!\n");

View file

@ -75,32 +75,32 @@ int bdev_minor_reopen(dev_t dev)
return OK; return OK;
} }
void bdev_minor_add(dev_t dev, int access) void bdev_minor_add(dev_t dev, int bits)
{ {
/* Increase the reference count of the given minor device. /* Increase the reference count of the given minor device.
*/ */
int i, free = -1; int i, ifree = -1;
for (i = 0; i < NR_OPEN_DEVS; i++) { for (i = 0; i < NR_OPEN_DEVS; i++) {
if (open_dev[i].dev == dev) { if (open_dev[i].dev == dev) {
open_dev[i].count++; open_dev[i].count++;
open_dev[i].access |= access; open_dev[i].access |= bits;
return; return;
} }
if (free < 0 && open_dev[i].dev == NO_DEV) if (ifree < 0 && open_dev[i].dev == NO_DEV)
free = i; ifree = i;
} }
if (free < 0) { if (ifree < 0) {
printf("bdev: too many open devices, increase NR_OPEN_DEVS\n"); printf("bdev: too many open devices, increase NR_OPEN_DEVS\n");
return; return;
} }
open_dev[free].dev = dev; open_dev[ifree].dev = dev;
open_dev[free].count = 1; open_dev[ifree].count = 1;
open_dev[free].access = access; open_dev[ifree].access = bits;
} }
void bdev_minor_del(dev_t dev) void bdev_minor_del(dev_t dev)

View file

@ -1,8 +1,6 @@
# Makefile for libblockdriver # Makefile for libblockdriver
.include <bsd.own.mk> .include <bsd.own.mk>
NOGCCERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM CPPFLAGS+= -D_MINIX_SYSTEM
LIB= blockdriver LIB= blockdriver

View file

@ -488,7 +488,7 @@ void blockdriver_mt_wakeup(thread_id_t id)
worker_id = TID_WORKER(id); worker_id = TID_WORKER(id);
assert(device_id >= 0 && device_id < MAX_DEVICES); assert(device_id >= 0 && device_id < MAX_DEVICES);
assert(worker_id >= 0 && worker_id < MAX_WORKERS); assert(worker_id < MAX_WORKERS);
wp = &device[device_id].worker[worker_id]; wp = &device[device_id].worker[worker_id];

View file

@ -275,12 +275,12 @@ int servxcheck(unsigned long peer, const char *service,
return state == PASS; return state == PASS;
} }
char *servxfile(const char *file) const char *servxfile(const char *file)
/* Specify a file to use for the access checks other than the default. Return /* Specify a file to use for the access checks other than the default. Return
* the old path. * the old path.
*/ */
{ {
const char *oldpath= path_servacces; const char *oldpath= path_servacces;
path_servacces= file; path_servacces= file;
return (char *) oldpath; /* (avoid const poisoning) */ return oldpath;
} }

View file

@ -77,9 +77,11 @@ ssize_t sendto(int sock, const void *message, size_t length, int flags,
{ {
ip_hdr_t *ip_hdr; ip_hdr_t *ip_hdr;
struct sockaddr_in *sinp; const struct sockaddr_in *sinp;
ssize_t retval;
int saved_errno;
sinp = (struct sockaddr_in *) __UNCONST(dest_addr); sinp = (const struct sockaddr_in *)dest_addr;
if (sinp->sin_family != AF_INET) if (sinp->sin_family != AF_INET)
{ {
errno= EAFNOSUPPORT; errno= EAFNOSUPPORT;
@ -87,10 +89,21 @@ ssize_t sendto(int sock, const void *message, size_t length, int flags,
} }
/* raw */ /* raw */
ip_hdr= (ip_hdr_t *)message; /* XXX this is horrible: we have to copy the entire buffer
* because we have to change one header field. Obviously we
* can't modify the user buffer directly..
*/
if ((ip_hdr = malloc(length)) == NULL)
return -1; /* errno is ENOMEM */
memcpy(ip_hdr, message, length);
ip_hdr->ih_dst= sinp->sin_addr.s_addr; ip_hdr->ih_dst= sinp->sin_addr.s_addr;
return write(sock, message, length); retval = write(sock, ip_hdr, length);
saved_errno = errno;
free(ip_hdr);
errno = saved_errno;
return retval;
} }
#if DEBUG #if DEBUG

View file

@ -1,8 +1,6 @@
# Makefile for libchardriver # Makefile for libchardriver
.include <bsd.own.mk> .include <bsd.own.mk>
NOGCCERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM CPPFLAGS+= -D_MINIX_SYSTEM
LIB= chardriver LIB= chardriver

View file

@ -281,7 +281,7 @@ static int do_open(struct chardriver *cdp, message *m_ptr)
/* Open a minor device. */ /* Open a minor device. */
endpoint_t user_endpt; endpoint_t user_endpt;
devminor_t minor; devminor_t minor;
int r, access; int r, bits;
/* Default action if no open hook is in place. */ /* Default action if no open hook is in place. */
if (cdp->cdr_open == NULL) if (cdp->cdr_open == NULL)
@ -289,10 +289,10 @@ static int do_open(struct chardriver *cdp, message *m_ptr)
/* Call the open hook. */ /* Call the open hook. */
minor = m_ptr->m_vfs_lchardriver_openclose.minor; minor = m_ptr->m_vfs_lchardriver_openclose.minor;
access = m_ptr->m_vfs_lchardriver_openclose.access; bits = m_ptr->m_vfs_lchardriver_openclose.access;
user_endpt = m_ptr->m_vfs_lchardriver_openclose.user; user_endpt = m_ptr->m_vfs_lchardriver_openclose.user;
r = cdp->cdr_open(minor, access, user_endpt); r = cdp->cdr_open(minor, bits, user_endpt);
/* If the device has been cloned, mark the new minor as open too. */ /* If the device has been cloned, mark the new minor as open too. */
if (r >= 0 && (r & CDEV_CLONED)) { if (r >= 0 && (r & CDEV_CLONED)) {

View file

@ -1,8 +1,6 @@
# #
# Makefile for libclkconf # Makefile for libclkconf
NOGCCERROR=yes
CPPFLAGS+= -D_SYSTEM -D_MINIX_SYSTEM CPPFLAGS+= -D_SYSTEM -D_MINIX_SYSTEM
LIB= clkconf LIB= clkconf

View file

@ -20,7 +20,7 @@
#include <assert.h> #include <assert.h>
/* used for logging */ /* used for logging */
static struct log log = { static struct log clk_log = {
.name = "omap_clkconf", .name = "omap_clkconf",
.log_level = LEVEL_INFO, .log_level = LEVEL_INFO,
.log_func = default_log .log_func = default_log
@ -44,7 +44,7 @@ clkconf_init()
if (base != 0) { if (base != 0) {
/* when used in a library we can't guaranty we only call this /* when used in a library we can't guaranty we only call this
* method once */ * method once */
log_trace(&log, "Called %d times\n", use_count); log_trace(&clk_log, "Called %d times\n", use_count);
return OK; return OK;
} }
@ -58,14 +58,15 @@ clkconf_init()
mr.mr_limit = cm_base + 0x1000; mr.mr_limit = cm_base + 0x1000;
if (sys_privctl(SELF, SYS_PRIV_ADD_MEM, &mr) != 0) { if (sys_privctl(SELF, SYS_PRIV_ADD_MEM, &mr) != 0) {
log_warn(&log, "Unable to request permission to map memory\n"); log_warn(&clk_log,
"Unable to request permission to map memory\n");
return EPERM; return EPERM;
} }
base = (uint32_t) vm_map_phys(SELF, (void *) cm_base, 0x1000); base = (uint32_t) vm_map_phys(SELF, (void *) cm_base, 0x1000);
if (base == (uint32_t) MAP_FAILED) { if (base == (uint32_t) MAP_FAILED) {
log_warn(&log, "Unable to map GPIO memory\n"); log_warn(&clk_log, "Unable to map GPIO memory\n");
return EPERM; return EPERM;
} }
return OK; return OK;

View file

@ -1,5 +1,3 @@
NOGCCERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM CPPFLAGS+= -D_MINIX_SYSTEM
LIB = devman LIB = devman

View file

@ -106,6 +106,9 @@ int devman_add_device(struct devman_dev *dev)
size_t grant_size; size_t grant_size;
void *buf = serialize_dev(dev, &grant_size); void *buf = serialize_dev(dev, &grant_size);
if (buf == NULL)
panic("out of memory");
cp_grant_id_t gid = cp_grant_id_t gid =
cpf_grant_direct(devman_ep,(vir_bytes) buf, cpf_grant_direct(devman_ep,(vir_bytes) buf,
grant_size, CPF_READ); grant_size, CPF_READ);

View file

@ -1,8 +1,5 @@
# Makefile for libexec # Makefile for libexec
# LSC For now
NOGCCERROR:= yes
LIB= exec LIB= exec
INCS= libexec.h INCS= libexec.h
SRCS= exec_elf.c exec_general.c SRCS= exec_elf.c exec_general.c

View file

@ -1,7 +1,5 @@
# Makefile for libi2cdriver # Makefile for libi2cdriver
NOGCCERROR=yes
CPPFLAGS+=-D_MINIX_SYSTEM CPPFLAGS+=-D_MINIX_SYSTEM
LIB= i2cdriver LIB= i2cdriver

View file

@ -1,8 +1,6 @@
# Makefile for libminixfs # Makefile for libminixfs
.include <bsd.own.mk> .include <bsd.own.mk>
NOGCCERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM CPPFLAGS+= -D_MINIX_SYSTEM
LIB= minixfs LIB= minixfs

View file

@ -122,13 +122,13 @@ lmfs_bio(dev_t dev, struct fsdriver_data * data, size_t bytes, off_t pos,
size_t block_size, off, block_off, last_size, size, chunk; size_t block_size, off, block_off, last_size, size, chunk;
unsigned int blocks_left; unsigned int blocks_left;
struct buf *bp; struct buf *bp;
int r, write, how; int r, do_write, how;
if (dev == NO_DEV) if (dev == NO_DEV)
return EINVAL; return EINVAL;
block_size = lmfs_fs_block_size(); block_size = lmfs_fs_block_size();
write = (call == FSC_WRITE); do_write = (call == FSC_WRITE);
assert(block_size > 0); assert(block_size > 0);
@ -183,7 +183,7 @@ lmfs_bio(dev_t dev, struct fsdriver_data * data, size_t bytes, off_t pos,
* For read requests, help the block driver form larger I/O * For read requests, help the block driver form larger I/O
* requests. * requests.
*/ */
if (!write) if (!do_write)
block_prefetch(dev, block, blocks_left, block_size, block_prefetch(dev, block, blocks_left, block_size,
last_size); last_size);
@ -191,7 +191,7 @@ lmfs_bio(dev_t dev, struct fsdriver_data * data, size_t bytes, off_t pos,
* Do not read the block from disk if we will end up * Do not read the block from disk if we will end up
* overwriting all of its contents. * overwriting all of its contents.
*/ */
how = (write && chunk == size) ? NO_READ : NORMAL; how = (do_write && chunk == size) ? NO_READ : NORMAL;
if (size < block_size) if (size < block_size)
r = lmfs_get_partial_block(&bp, dev, block, how, size); r = lmfs_get_partial_block(&bp, dev, block, how, size);
@ -207,7 +207,7 @@ lmfs_bio(dev_t dev, struct fsdriver_data * data, size_t bytes, off_t pos,
/* Perform the actual copy. */ /* Perform the actual copy. */
if (r == OK && data != NULL) { if (r == OK && data != NULL) {
if (write) { if (do_write) {
r = fsdriver_copyin(data, off, r = fsdriver_copyin(data, off,
(char *)bp->data + block_off, chunk); (char *)bp->data + block_off, chunk);

View file

@ -239,8 +239,7 @@ static void munmap_t(void *a, int len)
static void raisecount(struct buf *bp) static void raisecount(struct buf *bp)
{ {
assert(bufs_in_use >= 0); ASSERT(bp->lmfs_count < CHAR_MAX);
ASSERT(bp->lmfs_count >= 0);
bp->lmfs_count++; bp->lmfs_count++;
if(bp->lmfs_count == 1) bufs_in_use++; if(bp->lmfs_count == 1) bufs_in_use++;
assert(bufs_in_use > 0); assert(bufs_in_use > 0);
@ -252,7 +251,6 @@ static void lowercount(struct buf *bp)
ASSERT(bp->lmfs_count > 0); ASSERT(bp->lmfs_count > 0);
bp->lmfs_count--; bp->lmfs_count--;
if(bp->lmfs_count == 0) bufs_in_use--; if(bp->lmfs_count == 0) bufs_in_use--;
assert(bufs_in_use >= 0);
} }
static void freeblock(struct buf *bp) static void freeblock(struct buf *bp)

View file

@ -1,7 +1,5 @@
# Makefile for libnetdriver # Makefile for libnetdriver
NOGCCERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM CPPFLAGS+= -D_MINIX_SYSTEM
LIB= netdriver LIB= netdriver

View file

@ -323,14 +323,14 @@ netdriver_send(void)
*/ */
static void static void
do_readwrite(const struct netdriver * __restrict ndp, endpoint_t endpt, do_readwrite(const struct netdriver * __restrict ndp, endpoint_t endpt,
cp_grant_id_t grant, unsigned int count, int write) cp_grant_id_t grant, unsigned int count, int do_write)
{ {
struct netdriver_data *data; struct netdriver_data *data;
unsigned int i; unsigned int i;
int r; int r;
/* Copy in the I/O vector. */ /* Copy in the I/O vector. */
data = (write) ? &pending_send : &pending_recv; data = (do_write) ? &pending_send : &pending_recv;
if (data->size != 0) if (data->size != 0)
panic("netdriver: multiple concurrent requests"); panic("netdriver: multiple concurrent requests");
@ -349,7 +349,7 @@ do_readwrite(const struct netdriver * __restrict ndp, endpoint_t endpt,
data->size += data->iovec[i].iov_size; data->size += data->iovec[i].iov_size;
if (data->size < ETH_MIN_PACK_SIZE || if (data->size < ETH_MIN_PACK_SIZE ||
(!write && data->size < ETH_MAX_PACK_SIZE_TAGGED)) (!do_write && data->size < ETH_MAX_PACK_SIZE_TAGGED))
panic("netdriver: invalid I/O vector size: %zu\n", data->size); panic("netdriver: invalid I/O vector size: %zu\n", data->size);
/* Save the endpoint to which we should reply. */ /* Save the endpoint to which we should reply. */
@ -360,7 +360,7 @@ do_readwrite(const struct netdriver * __restrict ndp, endpoint_t endpt,
/* Resume sending or receiving. */ /* Resume sending or receiving. */
defer_replies(); defer_replies();
if (write) if (do_write)
netdriver_send(); netdriver_send();
else else
netdriver_recv(); netdriver_recv();
@ -400,17 +400,17 @@ do_getstat(const struct netdriver * __restrict ndp,
const message * __restrict m_ptr) const message * __restrict m_ptr)
{ {
message m_reply; message m_reply;
eth_stat_t stat; eth_stat_t st;
int r; int r;
memset(&stat, 0, sizeof(stat)); memset(&st, 0, sizeof(st));
if (ndp->ndr_stat != NULL) if (ndp->ndr_stat != NULL)
ndp->ndr_stat(&stat); ndp->ndr_stat(&st);
if ((r = sys_safecopyto(m_ptr->m_source, if ((r = sys_safecopyto(m_ptr->m_source,
m_ptr->m_net_netdrv_dl_getstat_s.grant, 0, (vir_bytes)&stat, m_ptr->m_net_netdrv_dl_getstat_s.grant, 0, (vir_bytes)&st,
sizeof(stat))) != OK) sizeof(st))) != OK)
panic("netdriver: unable to copy out statistics: %d", r); panic("netdriver: unable to copy out statistics: %d", r);
memset(&m_reply, 0, sizeof(m_reply)); memset(&m_reply, 0, sizeof(m_reply));
@ -485,13 +485,13 @@ netdriver_process(const struct netdriver * __restrict ndp,
case DL_READV_S: case DL_READV_S:
do_readwrite(ndp, m_ptr->m_source, do_readwrite(ndp, m_ptr->m_source,
m_ptr->m_net_netdrv_dl_readv_s.grant, m_ptr->m_net_netdrv_dl_readv_s.grant,
m_ptr->m_net_netdrv_dl_readv_s.count, FALSE /*write*/); m_ptr->m_net_netdrv_dl_readv_s.count, FALSE /*do_write*/);
break; break;
case DL_WRITEV_S: case DL_WRITEV_S:
do_readwrite(ndp, m_ptr->m_source, do_readwrite(ndp, m_ptr->m_source,
m_ptr->m_net_netdrv_dl_writev_s.grant, m_ptr->m_net_netdrv_dl_writev_s.grant,
m_ptr->m_net_netdrv_dl_writev_s.count, TRUE /*write*/); m_ptr->m_net_netdrv_dl_writev_s.count, TRUE /*do_write*/);
break; break;
default: default:

View file

@ -68,7 +68,7 @@ void
netdriver_portinw(struct netdriver_data * data, size_t off, long port, netdriver_portinw(struct netdriver_data * data, size_t off, long port,
size_t size) size_t size)
{ {
uint8_t buf[2]; uint16_t buf;
uint32_t value; uint32_t value;
size_t chunk; size_t chunk;
unsigned int i; unsigned int i;
@ -85,8 +85,8 @@ netdriver_portinw(struct netdriver_data * data, size_t off, long port,
if (odd_byte) { if (odd_byte) {
if ((r = sys_safecopyto(data->endpt, if ((r = sys_safecopyto(data->endpt,
data->iovec[i].iov_grant, off, (vir_bytes)&buf[1], data->iovec[i].iov_grant, off,
1)) != OK) (vir_bytes)&((char *)&buf)[1], 1)) != OK)
panic("netdriver: unable to copy data: %d", r); panic("netdriver: unable to copy data: %d", r);
off++; off++;
@ -109,11 +109,11 @@ netdriver_portinw(struct netdriver_data * data, size_t off, long port,
if (odd_byte) { if (odd_byte) {
if ((r = sys_inw(port, &value)) != OK) if ((r = sys_inw(port, &value)) != OK)
panic("netdriver: port input failed: %d", r); panic("netdriver: port input failed: %d", r);
*(uint16_t *)buf = (uint16_t)value; buf = (uint16_t)value;
if ((r = sys_safecopyto(data->endpt, if ((r = sys_safecopyto(data->endpt,
data->iovec[i].iov_grant, off, (vir_bytes)&buf[0], data->iovec[i].iov_grant, off,
1)) != OK) (vir_bytes)&((char *)&buf)[0], 1)) != OK)
panic("netdriver: unable to copy data: %d", r); panic("netdriver: unable to copy data: %d", r);
size--; size--;
@ -131,7 +131,7 @@ void
netdriver_portoutw(struct netdriver_data * data, size_t off, long port, netdriver_portoutw(struct netdriver_data * data, size_t off, long port,
size_t size) size_t size)
{ {
uint8_t buf[2]; uint16_t buf;
size_t chunk; size_t chunk;
unsigned int i; unsigned int i;
int r, odd_byte; int r, odd_byte;
@ -147,11 +147,11 @@ netdriver_portoutw(struct netdriver_data * data, size_t off, long port,
if (odd_byte) { if (odd_byte) {
if ((r = sys_safecopyfrom(data->endpt, if ((r = sys_safecopyfrom(data->endpt,
data->iovec[i].iov_grant, off, (vir_bytes)&buf[1], data->iovec[i].iov_grant, off,
1)) != OK) (vir_bytes)&((char *)&buf)[1], 1)) != OK)
panic("netdriver: unable to copy data: %d", r); panic("netdriver: unable to copy data: %d", r);
if ((r = sys_outw(port, *(uint16_t *)buf)) != OK) if ((r = sys_outw(port, buf)) != OK)
panic("netdriver: port output failed: %d", r); panic("netdriver: port output failed: %d", r);
off++; off++;
@ -173,8 +173,8 @@ netdriver_portoutw(struct netdriver_data * data, size_t off, long port,
if (odd_byte) { if (odd_byte) {
if ((r = sys_safecopyfrom(data->endpt, if ((r = sys_safecopyfrom(data->endpt,
data->iovec[i].iov_grant, off, (vir_bytes)&buf[0], data->iovec[i].iov_grant, off,
1)) != OK) (vir_bytes)&((char *)&buf)[0], 1)) != OK)
panic("netdriver: unable to copy data: %d", r); panic("netdriver: unable to copy data: %d", r);
size--; size--;
@ -185,9 +185,9 @@ netdriver_portoutw(struct netdriver_data * data, size_t off, long port,
} }
if (odd_byte) { if (odd_byte) {
buf[1] = 0; ((char *)&buf)[1] = 0;
if ((r = sys_outw(port, *(uint16_t *)buf)) != OK) if ((r = sys_outw(port, buf)) != OK)
panic("netdriver: port output failed: %d", r); panic("netdriver: port output failed: %d", r);
} }
} }

View file

@ -1,5 +1,3 @@
NOGCCERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM CPPFLAGS+= -D_MINIX_SYSTEM
LIB = netsock LIB = netsock

View file

@ -1,8 +1,6 @@
# Makefile for libsffs # Makefile for libsffs
.include <bsd.own.mk> .include <bsd.own.mk>
NOGCCERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM CPPFLAGS+= -D_MINIX_SYSTEM
LIB= sffs LIB= sffs

View file

@ -30,7 +30,7 @@ struct inode *init_inode(void)
/* Initialize inode table. Return the root inode. /* Initialize inode table. Return the root inode.
*/ */
struct inode *ino; struct inode *ino;
unsigned int index; unsigned int i;
TAILQ_INIT(&free_list); TAILQ_INIT(&free_list);
@ -38,11 +38,11 @@ struct inode *init_inode(void)
sffs_name, NUM_INODES, sizeof(struct inode), sizeof(inodes))); sffs_name, NUM_INODES, sizeof(struct inode), sizeof(inodes)));
/* Mark all inodes except the root inode as free. */ /* Mark all inodes except the root inode as free. */
for (index = 1; index < NUM_INODES; index++) { for (i = 1; i < NUM_INODES; i++) {
ino = &inodes[index]; ino = &inodes[i];
ino->i_parent = NULL; ino->i_parent = NULL;
LIST_INIT(&ino->i_child); LIST_INIT(&ino->i_child);
ino->i_num = index + 1; ino->i_num = i + 1;
ino->i_gen = (unsigned short)-1; /* aesthetics */ ino->i_gen = (unsigned short)-1; /* aesthetics */
ino->i_ref = 0; ino->i_ref = 0;
ino->i_flags = 0; ino->i_flags = 0;
@ -70,19 +70,19 @@ struct inode *find_inode(ino_t ino_nr)
/* Get an inode based on its inode number. Do not increase its reference count. /* Get an inode based on its inode number. Do not increase its reference count.
*/ */
struct inode *ino; struct inode *ino;
int index; int i;
/* Inode 0 (= index -1) is not a valid inode number. */ /* Inode 0 (= index -1) is not a valid inode number. */
index = INODE_INDEX(ino_nr); i = INODE_INDEX(ino_nr);
if (index < 0) { if (i < 0) {
printf("%s: VFS passed invalid inode number!\n", sffs_name); printf("%s: VFS passed invalid inode number!\n", sffs_name);
return NULL; return NULL;
} }
assert(index < NUM_INODES); assert(i < NUM_INODES);
ino = &inodes[index]; ino = &inodes[i];
/* Make sure the generation number matches. */ /* Make sure the generation number matches. */
if (INODE_GEN(ino_nr) != ino->i_gen) { if (INODE_GEN(ino_nr) != ino->i_gen) {
@ -261,10 +261,10 @@ int have_used_inode(void)
/* Check whether any inodes are still in use, that is, any of the inodes have /* Check whether any inodes are still in use, that is, any of the inodes have
* a reference count larger than zero. * a reference count larger than zero.
*/ */
unsigned int index; unsigned int i;
for (index = 0; index < NUM_INODES; index++) for (i = 0; i < NUM_INODES; i++)
if (inodes[index].i_ref > 0) if (inodes[i].i_ref > 0)
return TRUE; return TRUE;
return FALSE; return FALSE;

View file

@ -14,13 +14,13 @@
/*===========================================================================* /*===========================================================================*
* do_statvfs * * do_statvfs *
*===========================================================================*/ *===========================================================================*/
int do_statvfs(struct statvfs *statvfs) int do_statvfs(struct statvfs *st)
{ {
/* Retrieve file system statistics. /* Retrieve file system statistics.
*/ */
struct inode *ino; struct inode *ino;
char path[PATH_MAX]; char path[PATH_MAX];
u64_t free, total; u64_t bfree, btotal;
int r; int r;
/* Unfortunately, we cannot be any more specific than this, because we are /* Unfortunately, we cannot be any more specific than this, because we are
@ -34,20 +34,20 @@ int do_statvfs(struct statvfs *statvfs)
if ((r = verify_inode(ino, path, NULL)) != OK) if ((r = verify_inode(ino, path, NULL)) != OK)
return r; return r;
if ((r = sffs_table->t_queryvol(path, &free, &total)) != OK) if ((r = sffs_table->t_queryvol(path, &bfree, &btotal)) != OK)
return r; return r;
/* Returning zero for unknown values seems to be the convention. However, we /* Returning zero for unknown values seems to be the convention. However, we
* do have to use a nonzero block size, even though it is entirely arbitrary. * do have to use a nonzero block size, even though it is entirely arbitrary.
*/ */
statvfs->f_flag = ST_NOTRUNC; st->f_flag = ST_NOTRUNC;
statvfs->f_bsize = BLOCK_SIZE; st->f_bsize = BLOCK_SIZE;
statvfs->f_frsize = BLOCK_SIZE; st->f_frsize = BLOCK_SIZE;
statvfs->f_iosize = BLOCK_SIZE; st->f_iosize = BLOCK_SIZE;
statvfs->f_blocks = (fsblkcnt_t)(total / BLOCK_SIZE); st->f_blocks = (fsblkcnt_t)(btotal / BLOCK_SIZE);
statvfs->f_bfree = (fsblkcnt_t)(free / BLOCK_SIZE); st->f_bfree = (fsblkcnt_t)(bfree / BLOCK_SIZE);
statvfs->f_bavail = statvfs->f_bfree; st->f_bavail = st->f_bfree;
statvfs->f_namemax = NAME_MAX; st->f_namemax = NAME_MAX;
return OK; return OK;
} }

View file

@ -37,7 +37,7 @@ mode_t get_mode(struct inode *ino, int mode)
/*===========================================================================* /*===========================================================================*
* do_stat * * do_stat *
*===========================================================================*/ *===========================================================================*/
int do_stat(ino_t ino_nr, struct stat *stat) int do_stat(ino_t ino_nr, struct stat *st)
{ {
/* Retrieve inode status. /* Retrieve inode status.
*/ */
@ -56,31 +56,31 @@ int do_stat(ino_t ino_nr, struct stat *stat)
if ((r = verify_inode(ino, path, &attr)) != OK) if ((r = verify_inode(ino, path, &attr)) != OK)
return r; return r;
stat->st_mode = get_mode(ino, attr.a_mode); st->st_mode = get_mode(ino, attr.a_mode);
stat->st_uid = sffs_params->p_uid; st->st_uid = sffs_params->p_uid;
stat->st_gid = sffs_params->p_gid; st->st_gid = sffs_params->p_gid;
stat->st_rdev = NO_DEV; st->st_rdev = NO_DEV;
stat->st_size = attr.a_size; st->st_size = attr.a_size;
stat->st_atimespec = attr.a_atime; st->st_atimespec = attr.a_atime;
stat->st_mtimespec = attr.a_mtime; st->st_mtimespec = attr.a_mtime;
stat->st_ctimespec = attr.a_ctime; st->st_ctimespec = attr.a_ctime;
stat->st_birthtimespec = attr.a_crtime; st->st_birthtimespec = attr.a_crtime;
stat->st_blocks = stat->st_size / S_BLKSIZE; st->st_blocks = st->st_size / S_BLKSIZE;
if (stat->st_size % S_BLKSIZE != 0) if (st->st_size % S_BLKSIZE != 0)
stat->st_blocks += 1; st->st_blocks += 1;
stat->st_blksize = BLOCK_SIZE; st->st_blksize = BLOCK_SIZE;
/* We could make this more accurate by iterating over directory inodes' /* We could make this more accurate by iterating over directory inodes'
* children, counting how many of those are directories as well. * children, counting how many of those are directories as well.
* It's just not worth it. * It's just not worth it.
*/ */
stat->st_nlink = 0; st->st_nlink = 0;
if (ino->i_parent != NULL) stat->st_nlink++; if (ino->i_parent != NULL) st->st_nlink++;
if (IS_DIR(ino)) { if (IS_DIR(ino)) {
stat->st_nlink++; st->st_nlink++;
if (HAS_CHILDREN(ino)) stat->st_nlink++; if (HAS_CHILDREN(ino)) st->st_nlink++;
} }
return OK; return OK;

View file

@ -1,8 +1,6 @@
# Makefile for libsys # Makefile for libsys
.include <bsd.own.mk> .include <bsd.own.mk>
NOGCCERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM -D_SYSTEM CPPFLAGS+= -D_MINIX_SYSTEM -D_SYSTEM
LIB= sys LIB= sys

View file

@ -4,7 +4,7 @@
int env_argc = 0; int env_argc = 0;
char **env_argv = NULL; char **env_argv = NULL;
static char *find_key(const char *params, const char *key); static const char *find_key(const char *params, const char *key);
/*===========================================================================* /*===========================================================================*
* env_setargs * * env_setargs *
@ -22,7 +22,7 @@ int env_get_param(const char *key, char *value, int max_len)
{ {
message m; message m;
static char mon_params[MULTIBOOT_PARAM_BUF_SIZE]; /* copy parameters here */ static char mon_params[MULTIBOOT_PARAM_BUF_SIZE]; /* copy parameters here */
char *key_value; const char *key_value;
int i, s; int i, s;
size_t keylen; size_t keylen;
@ -75,12 +75,11 @@ int env_get_param(const char *key, char *value, int max_len)
/*==========================================================================* /*==========================================================================*
* find_key * * find_key *
*==========================================================================*/ *==========================================================================*/
static char *find_key(const char *params, const char *name) static const char *find_key(const char *params, const char *name)
{ {
const char *namep; const char *namep, *envp;
char *envp;
for (envp = (char *) params; *envp != 0;) { for (envp = params; *envp != 0;) {
for (namep = name; *namep != 0 && *namep == *envp; namep++, envp++) for (namep = name; *namep != 0 && *namep == *envp; namep++, envp++)
; ;
if (*namep == '\0' && *envp == '=') if (*namep == '\0' && *envp == '=')

View file

@ -15,9 +15,9 @@ extern int env_argc;
/*===========================================================================* /*===========================================================================*
* sef_llvm_magic_enabled * * sef_llvm_magic_enabled *
*===========================================================================*/ *===========================================================================*/
int sef_llvm_magic_enabled() int sef_llvm_magic_enabled(void)
{ {
extern void __attribute__((weak)) magic_init(); extern void __attribute__((weak)) magic_init(void);
if (!magic_init) if (!magic_init)
return 0; return 0;
return 1; return 1;
@ -37,7 +37,7 @@ int sef_llvm_real_brk(char *newbrk)
/*===========================================================================* /*===========================================================================*
* sef_llvm_state_cleanup * * sef_llvm_state_cleanup *
*===========================================================================*/ *===========================================================================*/
int sef_llvm_state_cleanup() int sef_llvm_state_cleanup(void)
{ {
return OK; return OK;
} }
@ -67,7 +67,7 @@ int sef_llvm_eval_bool(char *expr, char *result)
/*===========================================================================* /*===========================================================================*
* sef_llvm_state_table_addr * * sef_llvm_state_table_addr *
*===========================================================================*/ *===========================================================================*/
void *sef_llvm_state_table_addr() void *sef_llvm_state_table_addr(void)
{ {
extern void* __attribute__((weak)) _magic_vars_addr(void); extern void* __attribute__((weak)) _magic_vars_addr(void);
if (!_magic_vars_addr) if (!_magic_vars_addr)
@ -78,7 +78,7 @@ void *sef_llvm_state_table_addr()
/*===========================================================================* /*===========================================================================*
* sef_llvm_state_table_size * * sef_llvm_state_table_size *
*===========================================================================*/ *===========================================================================*/
size_t sef_llvm_state_table_size() size_t sef_llvm_state_table_size(void)
{ {
extern size_t __attribute__((weak)) _magic_vars_size(void); extern size_t __attribute__((weak)) _magic_vars_size(void);
if (!_magic_vars_size) if (!_magic_vars_size)
@ -135,10 +135,10 @@ int sef_llvm_state_transfer(sef_init_info_t *info)
int sef_llvm_add_special_mem_region(void *addr, size_t len, const char* name) int sef_llvm_add_special_mem_region(void *addr, size_t len, const char* name)
{ {
extern int __attribute__((weak)) st_add_special_mmapped_region(void *addr, extern int __attribute__((weak)) st_add_special_mmapped_region(void *addr,
size_t len, char* name); size_t len, const char* name);
if (!st_add_special_mmapped_region) if (!st_add_special_mmapped_region)
return 0; return 0;
return st_add_special_mmapped_region(addr, len, (char*) name); return st_add_special_mmapped_region(addr, len, name);
} }
/*===========================================================================* /*===========================================================================*
@ -207,7 +207,7 @@ int sef_llvm_ac_munmap(void *buf, size_t len)
/*===========================================================================* /*===========================================================================*
* sef_llvm_ltckpt_enabled * * sef_llvm_ltckpt_enabled *
*===========================================================================*/ *===========================================================================*/
int sef_llvm_ltckpt_enabled() int sef_llvm_ltckpt_enabled(void)
{ {
extern int __attribute__((weak)) ltckpt_mechanism_enabled(void); extern int __attribute__((weak)) ltckpt_mechanism_enabled(void);
if (!sef_llvm_get_ltckpt_offset() || !ltckpt_mechanism_enabled()) if (!sef_llvm_get_ltckpt_offset() || !ltckpt_mechanism_enabled())
@ -218,9 +218,9 @@ int sef_llvm_ltckpt_enabled()
/*===========================================================================* /*===========================================================================*
* sef_llvm_ltckpt_get_offset * * sef_llvm_ltckpt_get_offset *
*===========================================================================*/ *===========================================================================*/
int sef_llvm_get_ltckpt_offset() int sef_llvm_get_ltckpt_offset(void)
{ {
extern int __attribute__((weak)) ltckpt_get_offset(); extern int __attribute__((weak)) ltckpt_get_offset(void);
if (!ltckpt_get_offset) if (!ltckpt_get_offset)
return 0; return 0;
return ltckpt_get_offset(); return ltckpt_get_offset();
@ -239,4 +239,3 @@ int sef_llvm_ltckpt_restart(int type, sef_init_info_t *info)
assert(ltckpt_restart); assert(ltckpt_restart);
return ltckpt_restart(info); return ltckpt_restart(info);
} }

View file

@ -28,12 +28,12 @@ static void process_sigmgr_signals(void)
{ {
/* A signal manager has pending signals in the kernel. Process them. */ /* A signal manager has pending signals in the kernel. Process them. */
endpoint_t target; endpoint_t target;
sigset_t sigset; sigset_t set;
int signo, r; int signo, r;
while (TRUE) { while (TRUE) {
/* Get an arbitrary pending signal. */ /* Get an arbitrary pending signal. */
if((r=sys_getksig(&target, &sigset)) != OK) if((r=sys_getksig(&target, &set)) != OK)
panic("SEF: sys_getksig failed: %d", r); panic("SEF: sys_getksig failed: %d", r);
if (target == NONE) { if (target == NONE) {
@ -43,7 +43,7 @@ static void process_sigmgr_signals(void)
/* Process every signal in the signal set. */ /* Process every signal in the signal set. */
r = OK; r = OK;
for (signo = SIGS_FIRST; signo <= SIGS_LAST; signo++) { for (signo = SIGS_FIRST; signo <= SIGS_LAST; signo++) {
int s = sigismember(&sigset, signo); int s = sigismember(&set, signo);
assert(s >= 0); assert(s >= 0);
if(s) { if(s) {
/* Let the callback code process the signal. */ /* Let the callback code process the signal. */
@ -67,13 +67,13 @@ static void process_sigmgr_signals(void)
/*===========================================================================* /*===========================================================================*
* process_sigmgr_self_signals * * process_sigmgr_self_signals *
*===========================================================================*/ *===========================================================================*/
static void process_sigmgr_self_signals(sigset_t sigset) static void process_sigmgr_self_signals(sigset_t set)
{ {
/* A signal manager has pending signals for itself. Process them. */ /* A signal manager has pending signals for itself. Process them. */
int signo; int signo;
for (signo = SIGS_FIRST; signo <= SIGS_LAST; signo++) { for (signo = SIGS_FIRST; signo <= SIGS_LAST; signo++) {
int s = sigismember(&sigset, signo); int s = sigismember(&set, signo);
assert(s >= 0); assert(s >= 0);
if(s) { if(s) {
/* Let the callback code process the signal. */ /* Let the callback code process the signal. */
@ -89,13 +89,13 @@ int do_sef_signal_request(message *m_ptr)
{ {
/* Handle a SEF Signal request. */ /* Handle a SEF Signal request. */
int signo; int signo;
sigset_t sigset; sigset_t set;
if(m_ptr->m_source == SYSTEM) { if(m_ptr->m_source == SYSTEM) {
/* Handle kernel signals. */ /* Handle kernel signals. */
sigset = m_ptr->m_notify.sigset; set = m_ptr->m_notify.sigset;
for (signo = SIGK_FIRST; signo <= SIGK_LAST; signo++) { for (signo = SIGK_FIRST; signo <= SIGK_LAST; signo++) {
int s = sigismember(&sigset, signo); int s = sigismember(&set, signo);
assert(s >= 0); assert(s >= 0);
if (s) { if (s) {
/* Let the callback code handle the kernel signal. */ /* Let the callback code handle the kernel signal. */
@ -107,7 +107,7 @@ int do_sef_signal_request(message *m_ptr)
} }
/* Handle SIGKSIGSM for a signal manager. */ /* Handle SIGKSIGSM for a signal manager. */
else if(signo == SIGKSIGSM) { else if(signo == SIGKSIGSM) {
process_sigmgr_self_signals(sigset); process_sigmgr_self_signals(set);
} }
} }
} }

View file

@ -1,7 +1,5 @@
# Makefile for libdriver # Makefile for libdriver
NOGCCERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM CPPFLAGS+= -D_MINIX_SYSTEM
LIB = usb LIB = usb

View file

@ -1,7 +1,5 @@
# Makefile for libvassert library # Makefile for libvassert library
NOGCCERROR=yes
MKPIC?= no MKPIC?= no
LIB= vassert LIB= vassert
SRCS= backdoor.S vassert.c SRCS= backdoor.S vassert.c

View file

@ -1,8 +1,6 @@
# Makefile for libvirtio # Makefile for libvirtio
.include <bsd.own.mk> .include <bsd.own.mk>
NOGCCERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM CPPFLAGS+= -D_MINIX_SYSTEM
LIB= virtio LIB= virtio

View file

@ -1,7 +1,5 @@
# Makefile for libvtreefs # Makefile for libvtreefs
NOGCCERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM CPPFLAGS+= -D_MINIX_SYSTEM
LIB= vtreefs LIB= vtreefs

View file

@ -90,7 +90,7 @@ fs_read(ino_t ino_nr, struct fsdriver_data * data, size_t bytes,
* return a partial result. Otherwise return the error. * return a partial result. Otherwise return the error.
*/ */
if (r < 0) if (r < 0)
return (off > 0) ? off : r; return (off > 0) ? (ssize_t)off : r;
off += len; off += len;
pos += len; pos += len;
@ -151,7 +151,7 @@ fs_write(ino_t ino_nr, struct fsdriver_data * data, size_t bytes, off_t pos,
* return a partial result. Otherwise return the error. * return a partial result. Otherwise return the error.
*/ */
if (r < 0) if (r < 0)
return (off > 0) ? off : r; return (off > 0) ? (ssize_t)off : r;
off += r; off += r;
pos += r; pos += r;

View file

@ -28,7 +28,7 @@ static LIST_HEAD(index_head, inode) *parent_index_head;
* Initialize the inode-related state. * Initialize the inode-related state.
*/ */
int int
init_inodes(unsigned int inodes, struct inode_stat * stat, init_inodes(unsigned int inodes, struct inode_stat * istat,
index_t nr_indexed_entries) index_t nr_indexed_entries)
{ {
struct inode *node; struct inode *node;
@ -91,7 +91,7 @@ init_inodes(unsigned int inodes, struct inode_stat * stat,
TAILQ_INIT(&node->i_children); TAILQ_INIT(&node->i_children);
node->i_flags = 0; node->i_flags = 0;
node->i_index = NO_INDEX; node->i_index = NO_INDEX;
set_inode_stat(node, stat); set_inode_stat(node, istat);
node->i_indexed = nr_indexed_entries; node->i_indexed = nr_indexed_entries;
node->i_cbdata = NULL; node->i_cbdata = NULL;
@ -130,10 +130,10 @@ parent_name_hash(const struct inode * parent, const char *name)
* Return the hash value of a <parent,index> tuple. * Return the hash value of a <parent,index> tuple.
*/ */
static int static int
parent_index_hash(const struct inode * parent, index_t index) parent_index_hash(const struct inode * parent, index_t idx)
{ {
return (parent->i_num ^ index) % nr_inodes; return (parent->i_num ^ idx) % nr_inodes;
} }
/* /*
@ -182,8 +182,8 @@ purge_inode(struct inode * parent)
* Add an inode. * Add an inode.
*/ */
struct inode * struct inode *
add_inode(struct inode * parent, const char * name, index_t index, add_inode(struct inode * parent, const char * name, index_t idx,
const struct inode_stat * stat, index_t nr_indexed_entries, const struct inode_stat * istat, index_t nr_indexed_entries,
cbdata_t cbdata) cbdata_t cbdata)
{ {
struct inode *newnode; struct inode *newnode;
@ -194,8 +194,8 @@ add_inode(struct inode * parent, const char * name, index_t index,
assert(S_ISDIR(parent->i_stat.mode)); assert(S_ISDIR(parent->i_stat.mode));
assert(!(parent->i_flags & I_DELETED)); assert(!(parent->i_flags & I_DELETED));
assert(strlen(name) <= NAME_MAX); assert(strlen(name) <= NAME_MAX);
assert(index >= 0 || index == NO_INDEX); assert(idx >= 0 || idx == NO_INDEX);
assert(stat != NULL); assert(istat != NULL);
assert(nr_indexed_entries >= 0); assert(nr_indexed_entries >= 0);
assert(get_inode_by_name(parent, name) == NULL); assert(get_inode_by_name(parent, name) == NULL);
@ -223,8 +223,8 @@ add_inode(struct inode * parent, const char * name, index_t index,
newnode->i_parent = parent; newnode->i_parent = parent;
newnode->i_name = newname; newnode->i_name = newname;
newnode->i_flags = 0; newnode->i_flags = 0;
newnode->i_index = index; newnode->i_index = idx;
newnode->i_stat = *stat; newnode->i_stat = *istat;
newnode->i_indexed = nr_indexed_entries; newnode->i_indexed = nr_indexed_entries;
newnode->i_cbdata = cbdata; newnode->i_cbdata = cbdata;
strcpy(newnode->i_name, name); strcpy(newnode->i_name, name);
@ -240,8 +240,8 @@ add_inode(struct inode * parent, const char * name, index_t index,
LIST_INSERT_HEAD(&parent_name_head[slot], newnode, i_hname); LIST_INSERT_HEAD(&parent_name_head[slot], newnode, i_hname);
/* Add the inode to the <parent,index> hash table. */ /* Add the inode to the <parent,index> hash table. */
if (index != NO_INDEX) { if (idx != NO_INDEX) {
slot = parent_index_hash(parent, index); slot = parent_index_hash(parent, idx);
LIST_INSERT_HEAD(&parent_index_head[slot], newnode, i_hindex); LIST_INSERT_HEAD(&parent_index_head[slot], newnode, i_hindex);
} }
@ -378,24 +378,24 @@ get_inode_number(const struct inode * node)
* Retrieve an inode's status. * Retrieve an inode's status.
*/ */
void void
get_inode_stat(const struct inode * node, struct inode_stat * stat) get_inode_stat(const struct inode * node, struct inode_stat * istat)
{ {
CHECK_INODE(node); CHECK_INODE(node);
*stat = node->i_stat; *istat = node->i_stat;
} }
/* /*
* Set an inode's status. * Set an inode's status.
*/ */
void void
set_inode_stat(struct inode * node, struct inode_stat * stat) set_inode_stat(struct inode * node, struct inode_stat * istat)
{ {
CHECK_INODE(node); CHECK_INODE(node);
node->i_stat = *stat; node->i_stat = *istat;
} }
/* /*
@ -425,22 +425,22 @@ get_inode_by_name(const struct inode * parent, const char * name)
* Look up an inode using a <parent,index> tuple. * Look up an inode using a <parent,index> tuple.
*/ */
struct inode * struct inode *
get_inode_by_index(const struct inode * parent, index_t index) get_inode_by_index(const struct inode * parent, index_t idx)
{ {
struct inode *node; struct inode *node;
int slot; int slot;
CHECK_INODE(parent); CHECK_INODE(parent);
assert(S_ISDIR(parent->i_stat.mode)); assert(S_ISDIR(parent->i_stat.mode));
assert(index >= 0); assert(idx >= 0);
if (index >= parent->i_indexed) if (idx >= parent->i_indexed)
return NULL; return NULL;
/* Get the hash value, and search for the inode. */ /* Get the hash value, and search for the inode. */
slot = parent_index_hash(parent, index); slot = parent_index_hash(parent, idx);
LIST_FOREACH(node, &parent_index_head[slot], i_hindex) { LIST_FOREACH(node, &parent_index_head[slot], i_hindex) {
if (parent == node->i_parent && index == node->i_index) if (parent == node->i_parent && idx == node->i_index)
return node; /* found */ return node; /* found */
} }

View file

@ -48,7 +48,7 @@ fs_slink(ino_t dir_nr, char * name, uid_t uid, gid_t gid,
{ {
char path[PATH_MAX]; char path[PATH_MAX];
struct inode *node; struct inode *node;
struct inode_stat stat; struct inode_stat istat;
int r; int r;
if ((node = find_inode(dir_nr)) == NULL) if ((node = find_inode(dir_nr)) == NULL)
@ -67,14 +67,14 @@ fs_slink(ino_t dir_nr, char * name, uid_t uid, gid_t gid,
return r; return r;
path[bytes] = 0; path[bytes] = 0;
memset(&stat, 0, sizeof(stat)); memset(&istat, 0, sizeof(istat));
stat.mode = S_IFLNK | RWX_MODES; istat.mode = S_IFLNK | RWX_MODES;
stat.uid = uid; istat.uid = uid;
stat.gid = gid; istat.gid = gid;
stat.size = strlen(path); istat.size = strlen(path);
stat.dev = 0; istat.dev = 0;
return vtreefs_hooks->slink_hook(node, name, &stat, path, return vtreefs_hooks->slink_hook(node, name, &istat, path,
get_inode_cbdata(node)); get_inode_cbdata(node));
} }
@ -86,7 +86,7 @@ fs_mknod(ino_t dir_nr, char * name, mode_t mode, uid_t uid, gid_t gid,
dev_t rdev) dev_t rdev)
{ {
struct inode *node; struct inode *node;
struct inode_stat stat; struct inode_stat istat;
if ((node = find_inode(dir_nr)) == NULL) if ((node = find_inode(dir_nr)) == NULL)
return EINVAL; return EINVAL;
@ -97,14 +97,14 @@ fs_mknod(ino_t dir_nr, char * name, mode_t mode, uid_t uid, gid_t gid,
if (vtreefs_hooks->mknod_hook == NULL) if (vtreefs_hooks->mknod_hook == NULL)
return ENOSYS; return ENOSYS;
memset(&stat, 0, sizeof(stat)); memset(&istat, 0, sizeof(istat));
stat.mode = mode; istat.mode = mode;
stat.uid = uid; istat.uid = uid;
stat.gid = gid; istat.gid = gid;
stat.size = 0; istat.size = 0;
stat.dev = rdev; istat.dev = rdev;
return vtreefs_hooks->mknod_hook(node, name, &stat, return vtreefs_hooks->mknod_hook(node, name, &istat,
get_inode_cbdata(node)); get_inode_cbdata(node));
} }

View file

@ -49,7 +49,7 @@ int
fs_chmod(ino_t ino_nr, mode_t * mode) fs_chmod(ino_t ino_nr, mode_t * mode)
{ {
struct inode *node; struct inode *node;
struct inode_stat stat; struct inode_stat istat;
int r; int r;
if ((node = find_inode(ino_nr)) == NULL) if ((node = find_inode(ino_nr)) == NULL)
@ -58,18 +58,18 @@ fs_chmod(ino_t ino_nr, mode_t * mode)
if (vtreefs_hooks->chstat_hook == NULL) if (vtreefs_hooks->chstat_hook == NULL)
return ENOSYS; return ENOSYS;
get_inode_stat(node, &stat); get_inode_stat(node, &istat);
stat.mode = (stat.mode & ~ALL_MODES) | (*mode & ALL_MODES); istat.mode = (istat.mode & ~ALL_MODES) | (*mode & ALL_MODES);
r = vtreefs_hooks->chstat_hook(node, &stat, get_inode_cbdata(node)); r = vtreefs_hooks->chstat_hook(node, &istat, get_inode_cbdata(node));
if (r != OK) if (r != OK)
return r; return r;
get_inode_stat(node, &stat); get_inode_stat(node, &istat);
*mode = stat.mode; *mode = istat.mode;
return OK; return OK;
} }
@ -81,7 +81,7 @@ int
fs_chown(ino_t ino_nr, uid_t uid, gid_t gid, mode_t * mode) fs_chown(ino_t ino_nr, uid_t uid, gid_t gid, mode_t * mode)
{ {
struct inode *node; struct inode *node;
struct inode_stat stat; struct inode_stat istat;
int r; int r;
if ((node = find_inode(ino_nr)) == NULL) if ((node = find_inode(ino_nr)) == NULL)
@ -90,20 +90,20 @@ fs_chown(ino_t ino_nr, uid_t uid, gid_t gid, mode_t * mode)
if (vtreefs_hooks->chstat_hook == NULL) if (vtreefs_hooks->chstat_hook == NULL)
return ENOSYS; return ENOSYS;
get_inode_stat(node, &stat); get_inode_stat(node, &istat);
stat.uid = uid; istat.uid = uid;
stat.gid = gid; istat.gid = gid;
stat.mode &= ~(S_ISUID | S_ISGID); istat.mode &= ~(S_ISUID | S_ISGID);
r = vtreefs_hooks->chstat_hook(node, &stat, get_inode_cbdata(node)); r = vtreefs_hooks->chstat_hook(node, &istat, get_inode_cbdata(node));
if (r != OK) if (r != OK)
return r; return r;
get_inode_stat(node, &stat); get_inode_stat(node, &istat);
*mode = stat.mode; *mode = istat.mode;
return OK; return OK;
} }

View file

@ -36,10 +36,10 @@ init_server(int __unused type, sef_init_info_t * __unused info)
* We received a signal. * We received a signal.
*/ */
static void static void
got_signal(int signal) got_signal(int sig)
{ {
if (signal != SIGTERM) if (sig != SIGTERM)
return; return;
fsdriver_terminate(); fsdriver_terminate();
@ -86,7 +86,7 @@ fs_other(const message * m_ptr, int ipc_status)
*/ */
void void
run_vtreefs(struct fs_hooks * hooks, unsigned int nr_inodes, run_vtreefs(struct fs_hooks * hooks, unsigned int nr_inodes,
size_t inode_extra, struct inode_stat * stat, size_t inode_extra, struct inode_stat * istat,
index_t nr_indexed_entries, size_t bufsize) index_t nr_indexed_entries, size_t bufsize)
{ {
@ -97,7 +97,7 @@ run_vtreefs(struct fs_hooks * hooks, unsigned int nr_inodes,
vtreefs_hooks = hooks; vtreefs_hooks = hooks;
inodes = nr_inodes; inodes = nr_inodes;
extra_size = inode_extra; extra_size = inode_extra;
root_stat = stat; root_stat = istat;
root_entries = nr_indexed_entries; root_entries = nr_indexed_entries;
buf_size = bufsize; buf_size = bufsize;

View file

@ -27,7 +27,7 @@ PUBLIC int magic_create_dsentry(struct _magic_dsentry *dsentry,
char *name, char *parent_name); char *name, char *parent_name);
PUBLIC struct _magic_obdsentry* magic_create_obdsentry(void *data_ptr, PUBLIC struct _magic_obdsentry* magic_create_obdsentry(void *data_ptr,
struct _magic_type *type, size_t size, int flags, struct _magic_type *type, size_t size, int flags,
char *name, char *parent_name); const char *name, char *parent_name);
PUBLIC int magic_update_dsentry_state(struct _magic_dsentry *dsentry, PUBLIC int magic_update_dsentry_state(struct _magic_dsentry *dsentry,
unsigned long mstate); unsigned long mstate);
PUBLIC void magic_free_dead_dsentries(); PUBLIC void magic_free_dead_dsentries();

View file

@ -4,7 +4,8 @@
/* Public functions for special types and regions. */ /* Public functions for special types and regions. */
PUBLIC void st_register_typename_key(char *key); PUBLIC void st_register_typename_key(char *key);
PUBLIC void st_register_typename_keys(char **keys); PUBLIC void st_register_typename_keys(char **keys);
PUBLIC int st_add_special_mmapped_region(void *address, size_t size, char* name); PUBLIC int st_add_special_mmapped_region(void *address, size_t size,
const char* name);
PUBLIC int st_del_special_mmapped_region_by_addr(void *address); PUBLIC int st_del_special_mmapped_region_by_addr(void *address);
#endif /* ST_SPECIAL_H */ #endif /* ST_SPECIAL_H */

View file

@ -540,7 +540,7 @@ PUBLIC int magic_create_dsentry(struct _magic_dsentry *dsentry,
*===========================================================================*/ *===========================================================================*/
PUBLIC struct _magic_obdsentry* magic_create_obdsentry(void *data_ptr, PUBLIC struct _magic_obdsentry* magic_create_obdsentry(void *data_ptr,
struct _magic_type *type, size_t size, int flags, struct _magic_type *type, size_t size, int flags,
char *name, char *parent_name) const char *name, char *parent_name)
{ {
struct _magic_obdsentry *obdsentry = NULL; struct _magic_obdsentry *obdsentry = NULL;
int i, ret; int i, ret;

View file

@ -437,7 +437,7 @@ PUBLIC void st_stack_refs_save_restore(char* stack_buff, int is_save)
/* Metadata management. */ /* Metadata management. */
PUBLIC int st_add_special_mmapped_region(void *address, size_t size, PUBLIC int st_add_special_mmapped_region(void *address, size_t size,
char* name) const char* name)
{ {
struct _magic_obdsentry* obdsentry; struct _magic_obdsentry* obdsentry;
char addr_name[24]; char addr_name[24];

View file

@ -12,10 +12,6 @@ SRCS= buf.c clock.c inet.c inet_config.c \
.PATH: ${.CURDIR}/generic .PATH: ${.CURDIR}/generic
WARNS=
NOCLANGERROR=yes
DPADD+= ${LIBCHARDRIVER} ${LIBSYS} DPADD+= ${LIBCHARDRIVER} ${LIBSYS}
LDADD+= -lchardriver -lsys LDADD+= -lchardriver -lsys

View file

@ -759,7 +759,7 @@ static void test_xfer_server(const struct socket_test_info *info, pid_t pid)
return; return;
} }
if (rc < strlen(buf)) { if (rc < strlen((char *)buf)) {
test_fail("[server] write didn't write all the bytes"); test_fail("[server] write didn't write all the bytes");
} }
@ -787,7 +787,7 @@ static void test_xfer_server(const struct socket_test_info *info, pid_t pid)
return; return;
} }
if (rc < strlen(buf)) { if (rc < strlen((char *)buf)) {
test_fail("[server] write didn't write all the bytes"); test_fail("[server] write didn't write all the bytes");
} }
@ -815,7 +815,7 @@ static void test_xfer_server(const struct socket_test_info *info, pid_t pid)
return; return;
} }
if (rc < strlen(buf)) { if (rc < strlen((char *)buf)) {
test_fail("[server] write didn't write all the bytes"); test_fail("[server] write didn't write all the bytes");
} }

View file

@ -597,8 +597,8 @@ gid_t * r_gid;
perror(PASSWD_FILE); perror(PASSWD_FILE);
} }
while (fp != NULL && fgets(line, sizeof(line), fp) != NULL) { while (fp != NULL && fgets(line, sizeof(line), fp) != NULL) {
p = strchr(line, ':'); p = (unsigned char *)strchr(line, ':');
if (p != NULL) p = strchr(p + 1, ':'); if (p != NULL) p = (unsigned char *)strchr((char *)p + 1, ':');
if (p != NULL) { if (p != NULL) {
p++; p++;
uid = 0; uid = 0;

View file

@ -337,8 +337,8 @@ gid_t *r_gid;
perror(PASSWD_FILE); perror(PASSWD_FILE);
} }
while (fp != NULL && fgets(line, sizeof(line), fp) != NULL) { while (fp != NULL && fgets(line, sizeof(line), fp) != NULL) {
p = strchr(line, ':'); p = (unsigned char *)strchr(line, ':');
if (p != NULL) p = strchr(p + 1, ':'); if (p != NULL) p = (unsigned char *)strchr((char *)p + 1, ':');
if (p != NULL) { if (p != NULL) {
p++; p++;
uid = 0; uid = 0;

View file

@ -172,7 +172,7 @@ void timed_test_func(const char *s, void (* func)(void))
} }
pid_t traced_fork(c) pid_t traced_fork(c)
void(*c) (void); void (*c)(void);
{ {
pid_t pid; pid_t pid;
int r, status; int r, status;
@ -333,6 +333,9 @@ void(*c) (void);
detach_running(ppid); detach_running(ppid);
break; break;
default:
abort();
} }
return pid; return pid;

View file

@ -1224,7 +1224,7 @@ static void test_fd_passing(void) {
} }
} }
static void test_select() static void test_select(void)
{ {
int nfds = -1; int nfds = -1;
int socks[2]; int socks[2];
@ -1344,7 +1344,7 @@ static void test_select_close(void)
close(socks[0]); close(socks[0]);
} }
static void test_fchmod() static void test_fchmod(void)
{ {
int socks[2]; int socks[2];
struct stat st1, st2; struct stat st1, st2;

View file

@ -25,13 +25,13 @@ int subtest = 1;
int main(void); int main(void);
void quit(void); void quit(void);
static void test_clock_getres(); static void test_clock_getres(void);
static void test_clock_gettime(); static void test_clock_gettime(void);
static void test_clock_settime(); static void test_clock_settime(void);
static void test_adjtime(); static void test_adjtime(void);
static void show_timespec(char *msg, struct timespec *ts); static void show_timespec(char *msg, struct timespec *ts);
static void test_clock_getres() static void test_clock_getres(void)
{ {
struct timespec res; struct timespec res;
@ -47,7 +47,7 @@ static void test_clock_getres()
if (clock_getres(-1, &res) == 0) e(14); if (clock_getres(-1, &res) == 0) e(14);
} }
static void test_clock_gettime() static void test_clock_gettime(void)
{ {
struct timespec ts, ts2; struct timespec ts, ts2;
@ -148,7 +148,7 @@ static void show_timespec(char *msg, struct timespec *ts)
#endif /* DEBUG == 1 */ #endif /* DEBUG == 1 */
} }
int main() int main(void)
{ {
start(69); start(69);
struct timespec starttime, endtime; struct timespec starttime, endtime;

View file

@ -62,7 +62,7 @@ doseeks(int seekbase)
} }
int int
main() main(void)
{ {
start(70); start(70);
pid_t f; pid_t f;

View file

@ -187,7 +187,7 @@ static void do_readlink2(void *buf, int fd, int writable)
((char *) buf)[rl] = '\0'; ((char *) buf)[rl] = '\0';
if(strcmp(buf, TARGETNAME)) { if(strcmp(buf, TARGETNAME)) {
fprintf(stderr, "readlink: expected %s, got %s\n", fprintf(stderr, "readlink: expected %s, got %s\n",
TARGETNAME, buf); TARGETNAME, (char *)buf);
e(3); e(3);
} }
return; return;

View file

@ -733,6 +733,8 @@ static void send_packet_ip(
fragsize = payloadsize; fragsize = payloadsize;
fragstep = 0; fragstep = 0;
break; break;
default:
abort();
} }
while (fragcount > 0) { while (fragcount > 0) {

View file

@ -10,6 +10,5 @@ MAN?=
CPPFLAGS+= -I${.CURDIR} CPPFLAGS+= -I${.CURDIR}
NOGCCERROR?= yes NOGCCERROR?= yes
NOCLANGERROR?= yes
.include <bsd.prog.mk> .include <bsd.prog.mk>

View file

@ -430,7 +430,7 @@ main(int argc, char *argv[])
(int)next_inode-1, next_zone); (int)next_inode-1, next_zone);
} }
if(insertmode) printf("%llu\n", written_fs_size); if(insertmode) printf("%"PRIu64"\n", written_fs_size);
return(0); return(0);

View file

@ -1,7 +1,4 @@
PROG= mkproto PROG= mkproto
MAN= MAN=
NOGCCERROR?= yes
NOCLANGERROR?= yes
.include <bsd.prog.mk> .include <bsd.prog.mk>