Fix many more comiler warnings

Most warnings were harmless, some real bugs. Test set should now compile
cleanly with ack, gcc, and clang.
This commit is contained in:
Thomas Veerman 2011-11-28 10:07:55 +00:00
parent b4fb061802
commit 92b61c816d
53 changed files with 120 additions and 125 deletions

View file

@ -177,7 +177,7 @@ static struct block *block_find(const void *ptr)
/* locate block based on pointer, then check whether it is valid */
block = (struct block *) page_round_down(
(unsigned long) ((struct block *) ptr - 1));
(unsigned long) ((struct block *) __UNCONST(ptr) - 1));
block_check(block);
LOG(("block_find; block=0x%x\n", block));
return block;

View file

@ -546,7 +546,7 @@ device_connect_callback
break;
}
if (_devices[i].dev!= NULL) {
if (i >= MAX_DEVS) {
DEBUG_MSG("Too much devices...");
} else {
_devices[i].dev = dev;

View file

@ -279,6 +279,8 @@ fuse_opt_parse(struct fuse_args *args, void *data,
char *buf;
int i, rv = 0;
memset(&foo, '\0', sizeof(foo));
if (!args || !args->argv || !args->argc || !proc)
return 0;

View file

@ -27,7 +27,7 @@ PRIVATE u32_t get_hz(void)
if ((fp = fopen(_PATH_PROC "hz", "r")) != NULL)
{
r = fscanf(fp, "%lu", &hz);
r = fscanf(fp, "%u", &hz);
fclose(fp);

View file

@ -7,9 +7,7 @@
#include <string.h>
#include <utime.h>
PUBLIC int utime(name, timp)
_CONST char *name;
_CONST struct utimbuf *timp;
PUBLIC int utime(const char *name, const struct utimbuf *timp)
{
message m;
@ -21,6 +19,6 @@ _CONST struct utimbuf *timp;
m.m2_l2 = timp->modtime;
m.m2_i1 = strlen(name) + 1;
}
m.m2_p1 = (char *) name;
m.m2_p1 = (char *) __UNCONST(name);
return(_syscall(VFS_PROC_NR, UTIME, &m));
}

View file

@ -422,8 +422,10 @@ vsyslogp_r(int pri, struct syslog_data *data, const char *msgid,
}
/* Get connected, output the message to the local logger. */
#ifndef __minix
if (data == &sdata)
mutex_lock(&syslog_mutex);
#endif
opened = !data->opened;
if (opened)
openlog_unlocked_r(data->log_tag, data->log_stat, 0, data);
@ -460,8 +462,10 @@ vsyslogp_r(int pri, struct syslog_data *data, const char *msgid,
(void)close(fd);
}
#ifndef __minix
if (data == &sdata)
mutex_unlock(&syslog_mutex);
#endif
if (data != &sdata && opened) {
/* preserve log tag */
@ -541,24 +545,32 @@ openlog_unlocked_r(const char *ident, int logstat, int logfac,
void
openlog_r(const char *ident, int logstat, int logfac, struct syslog_data *data)
{
#ifndef __minix
if (data == &sdata)
mutex_lock(&syslog_mutex);
#endif
openlog_unlocked_r(ident, logstat, logfac, data);
#ifndef __minix
if (data == &sdata)
mutex_unlock(&syslog_mutex);
#endif
}
void
closelog_r(struct syslog_data *data)
{
#ifndef __minix
if (data == &sdata)
mutex_lock(&syslog_mutex);
#endif
(void)close(data->log_file);
data->log_file = -1;
data->connected = 0;
data->log_tag = NULL;
#ifndef __minix
if (data == &sdata)
mutex_unlock(&syslog_mutex);
#endif
}
int

View file

@ -12,7 +12,7 @@ PUBLIC int setmcontext(const mcontext_t *mcp)
{
message m;
m.m1_p1 = (char *) mcp;
m.m1_p1 = (char *) __UNCONST(mcp);
return(_syscall(PM_PROC_NR, SETMCONTEXT, &m));
}

View file

@ -92,7 +92,7 @@ static int _tcp_bind(int sock, const struct sockaddr *address,
nwio_tcpconf_t tcpconf;
struct sockaddr_in *sinp;
sinp= (struct sockaddr_in *)address;
sinp= (struct sockaddr_in *) __UNCONST(address);
if (sinp->sin_family != AF_INET || address_len < sizeof(*sinp))
{
#if DEBUG
@ -132,7 +132,7 @@ static int _udp_bind(int sock, const struct sockaddr *address,
nwio_udpopt_t udpopt;
struct sockaddr_in *sinp;
sinp= (struct sockaddr_in *)address;
sinp= (struct sockaddr_in *) __UNCONST(address);
if (sinp->sin_family != AF_INET || address_len < sizeof(*sinp))
{
#if DEBUG
@ -193,7 +193,7 @@ static int _uds_bind(int sock, const struct sockaddr *address,
did_mknod = 0;
r = mknod(((struct sockaddr_un *) address)->sun_path,
r = mknod(((struct sockaddr_un *) __UNCONST(address))->sun_path,
S_IFSOCK|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH, 0);
if (r == -1 && errno != EEXIST) {
@ -203,14 +203,14 @@ static int _uds_bind(int sock, const struct sockaddr *address,
}
/* perform the bind */
r= ioctl(sock, NWIOSUDSADDR, (void *) address);
r= ioctl(sock, NWIOSUDSADDR, (void *) __UNCONST(address));
if (r == -1 && did_mknod) {
/* bind() failed in pfs, so we roll back the
* file system change
*/
unlink(((struct sockaddr_un *) address)->sun_path);
unlink(((struct sockaddr_un *) __UNCONST(address))->sun_path);
}
return r;

View file

@ -16,6 +16,6 @@ PUBLIC int chown(const char *name, uid_t owner, gid_t grp)
m.m1_i1 = strlen(name) + 1;
m.m1_i2 = owner;
m.m1_i3 = grp;
m.m1_p1 = (char *) name;
m.m1_p1 = (char *) __UNCONST(name);
return(_syscall(VFS_PROC_NR, CHOWN, &m));
}

View file

@ -94,7 +94,7 @@ static int _tcp_connect(int sock, const struct sockaddr *address,
errno= EINVAL;
return -1;
}
sinp= (struct sockaddr_in *)address;
sinp= (struct sockaddr_in *) __UNCONST(address);
if (sinp->sin_family != AF_INET)
{
errno= EINVAL;
@ -148,7 +148,7 @@ static int _udp_connect(int sock, const struct sockaddr *address,
errno= EINVAL;
return -1;
}
sinp= (struct sockaddr_in *)address;
sinp= (struct sockaddr_in *) __UNCONST(address);
if (sinp->sin_family != AF_INET)
{
errno= EINVAL;
@ -174,5 +174,5 @@ static int _uds_connect(int sock, const struct sockaddr *address,
}
/* perform the connect */
return ioctl(sock, NWIOSUDSCONN, (void *) address);
return ioctl(sock, NWIOSUDSCONN, (void *) __UNCONST(address));
}

View file

@ -103,7 +103,7 @@ int execve(const char *path, char * const *argv, char * const *envp)
/* We can finally make the system call. */
m.m1_i1 = strlen(path) + 1;
m.m1_i2 = frame_size;
m.m1_p1 = (char *) path;
m.m1_p1 = (char *) __UNCONST(path);
m.m1_p2 = frame;
/* Clear unused fields */

View file

@ -9,14 +9,13 @@
__weak_alias(link, _link)
#endif
PUBLIC int link(name, name2)
_CONST char *name, *name2;
PUBLIC int link(const char *name, const char *name2)
{
message m;
m.m1_i1 = strlen(name) + 1;
m.m1_i2 = strlen(name2) + 1;
m.m1_p1 = (char *) name;
m.m1_p2 = (char *) name2;
m.m1_p1 = (char *) __UNCONST(name);
m.m1_p2 = (char *) __UNCONST(name2);
return(_syscall(VFS_PROC_NR, LINK, &m));
}

View file

@ -4,9 +4,7 @@
#include <string.h>
void _loadname(name, msgptr)
const char *name;
message *msgptr;
void _loadname(const char *name, message *msgptr)
{
/* This function is used to load a string into a type m3 message. If the
* string fits in the message, it is copied there. If not, a pointer to
@ -17,6 +15,6 @@ message *msgptr;
k = strlen(name) + 1;
msgptr->m3_i1 = k;
msgptr->m3_p1 = (char *) name;
msgptr->m3_p1 = (char *) __UNCONST(name);
if (k <= M3_STRING) strcpy(msgptr->m3_ca1, name);
}

View file

@ -6,7 +6,7 @@
PUBLIC int closefrom(int fd)
{
int f, ok = 0, e;
int f, ok = 0, e = 0;
for(f = fd; f < __MINIX_OPEN_MAX; f++) {
if(close(f) >= 0)
ok = 1;

View file

@ -28,7 +28,7 @@ int minix_rs_lookup(const char *name, endpoint_t *value)
len_key = strlen(name)+1;
m.RS_NAME = (char *) name;
m.RS_NAME = (char *) __UNCONST(name);
m.RS_NAME_LEN = len_key;
if (_syscall(RS_PROC_NR, RS_LOOKUP, &m) != -1) {

View file

@ -15,6 +15,6 @@ PUBLIC int mkdir(const char *name, mode_t mode)
m.m1_i1 = strlen(name) + 1;
m.m1_i2 = mode;
m.m1_p1 = (char *) name;
m.m1_p1 = (char *) __UNCONST(name);
return(_syscall(VFS_PROC_NR, MKDIR, &m));
}

View file

@ -14,7 +14,7 @@ PUBLIC int mknod(const char *name, mode_t mode, dev_t dev)
m.m1_i1 = strlen(name) + 1;
m.m1_i2 = mode;
m.m1_i3 = dev;
m.m1_p1 = (char *) name;
m.m1_p1 = (char *) __UNCONST(name);
m.m1_p2 = (char *) ((int) 0); /* obsolete size field */
return(_syscall(VFS_PROC_NR, MKNOD, &m));
}

View file

@ -27,7 +27,7 @@ PUBLIC int open(const char *name, int flags)
* an int, the mode was passed as an int.
*/
m.m1_i3 = va_arg(argp, int);
m.m1_p1 = (char *) name;
m.m1_p1 = (char *) __UNCONST(name);
} else {
_loadname(name, &m);
m.m3_i2 = flags;

View file

@ -9,16 +9,13 @@
__weak_alias(readlink, _readlink)
#endif
int readlink(name, buffer, bufsiz)
const char *name;
char *buffer;
size_t bufsiz;
int readlink(const char *name, char *buffer, size_t bufsiz)
{
message m;
m.m1_i1 = strlen(name) + 1;
m.m1_i2 = bufsiz;
m.m1_p1 = (char *) name;
m.m1_p1 = (char *) __UNCONST(name);
m.m1_p2 = (char *) buffer;
return(_syscall(VFS_PROC_NR, RDLNK, &m));

View file

@ -5,14 +5,13 @@
#include <string.h>
#include <stdio.h>
int rename(name, name2)
const char *name, *name2;
int rename(const char *name, const char *name2)
{
message m;
m.m1_i1 = strlen(name) + 1;
m.m1_i2 = strlen(name2) + 1;
m.m1_p1 = (char *) name;
m.m1_p2 = (char *) name2;
m.m1_p1 = (char *) __UNCONST(name);
m.m1_p2 = (char *) __UNCONST(name2);
return(_syscall(VFS_PROC_NR, RENAME, &m));
}

View file

@ -137,7 +137,7 @@ static ssize_t _udp_sendto(int sock, const void *message, size_t length,
errno= EINVAL;
return -1;
}
sinp= (struct sockaddr_in *)dest_addr;
sinp= (struct sockaddr_in *) __UNCONST(dest_addr);
if (sinp->sin_family != AF_INET)
{
errno= EAFNOSUPPORT;
@ -226,7 +226,7 @@ static ssize_t _uds_sendto_dgram(int sock, const void *message, size_t length,
}
/* set the target address */
r= ioctl(sock, NWIOSUDSTADDR, (void *) dest_addr);
r= ioctl(sock, NWIOSUDSTADDR, (void *) __UNCONST(dest_addr));
if (r == -1) {
return r;
}

View file

@ -12,7 +12,7 @@ int setgroups(int ngroups, const gid_t *gidset)
{
message m;
m.m1_p1 = (char *) gidset;
m.m1_p1 = (char *) __UNCONST(gidset);
m.m1_i1 = ngroups;
return(_syscall(PM_PROC_NR, SETGROUPS, &m));

View file

@ -19,7 +19,7 @@ int setitimer(int which, const struct itimerval *_RESTRICT value,
if (value == NULL) return(EINVAL);
m.m1_i1 = which;
m.m1_p1 = (char *) value;
m.m1_p1 = (char *) __UNCONST(value);
m.m1_p2 = (char *) ovalue;
return _syscall(PM_PROC_NR, ITIMER, &m);

View file

@ -90,7 +90,7 @@ static int _tcp_setsockopt(int sock, int level, int option_name,
errno= EINVAL;
return -1;
}
i= *(int *)option_value;
i= *(const int *)option_value;
if (!i)
{
/* At the moment there is no way to turn off
@ -108,7 +108,7 @@ static int _tcp_setsockopt(int sock, int level, int option_name,
errno= EINVAL;
return -1;
}
i= *(int *)option_value;
i= *(const int *)option_value;
if (!i)
{
/* At the moment there is no way to turn off
@ -126,7 +126,7 @@ static int _tcp_setsockopt(int sock, int level, int option_name,
errno= EINVAL;
return -1;
}
i= *(int *)option_value;
i= *(const int *)option_value;
if (i > 32*1024)
{
/* The receive buffer is limited to 32K at the moment.
@ -146,7 +146,7 @@ static int _tcp_setsockopt(int sock, int level, int option_name,
errno= EINVAL;
return -1;
}
i= *(int *)option_value;
i= *(const int *)option_value;
if (i > 32*1024)
{
/* The send buffer is limited to 32K at the moment.
@ -166,7 +166,7 @@ static int _tcp_setsockopt(int sock, int level, int option_name,
errno= EINVAL;
return -1;
}
i= *(int *)option_value;
i= *(const int *)option_value;
if (i)
{
/* At the moment there is no way to turn on
@ -212,7 +212,7 @@ static int _uds_setsockopt(int sock, int level, int option_name,
errno= EINVAL;
return -1;
}
size= *(size_t *)option_value;
size= *(const size_t *)option_value;
return ioctl(sock, NWIOSUDSRCVBUF, &size);
}
@ -223,7 +223,7 @@ static int _uds_setsockopt(int sock, int level, int option_name,
errno= EINVAL;
return -1;
}
size= *(size_t *)option_value;
size= *(const size_t *)option_value;
return ioctl(sock, NWIOSUDSSNDBUF, &size);
}
@ -234,7 +234,7 @@ static int _uds_setsockopt(int sock, int level, int option_name,
errno= EINVAL;
return -1;
}
i= *(int *)option_value;
i= *(const int *)option_value;
if (!i)
{
/* At the moment there is no way to turn off
@ -253,7 +253,7 @@ static int _uds_setsockopt(int sock, int level, int option_name,
errno= EINVAL;
return -1;
}
i= *(int *)option_value;
i= *(const int *)option_value;
if (!i)
{
/* credentials can always be received. */

View file

@ -6,17 +6,13 @@
int __sigreturn(void);
int sigaction(sig, act, oact)
int sig;
const struct sigaction *act;
struct sigaction *oact;
int sigaction(int sig, const struct sigaction *act, struct sigaction *oact)
{
message m;
m.m1_i2 = sig;
/* XXX - yet more type puns because message struct is short of types. */
m.m1_p1 = (char *) act;
m.m1_p1 = (char *) __UNCONST(act);
m.m1_p2 = (char *) oact;
m.m1_p3 = (char *) __sigreturn;

View file

@ -40,7 +40,7 @@ int _stat(const char *name, struct stat *buffer)
struct minix_prev_stat old_sb;
m.m1_i1 = strlen(name) + 1;
m.m1_p1 = (char *) name;
m.m1_p1 = (char *) __UNCONST(name);
m.m1_p2 = (char *) buffer;
if((r = _syscall(VFS_PROC_NR, STAT, &m)) >= 0 || errno != ENOSYS)
@ -52,7 +52,7 @@ int _stat(const char *name, struct stat *buffer)
* User has struct stat (buffer), VFS still fills minix_prev_stat.
*/
m.m1_i1 = strlen(name) + 1;
m.m1_p1 = (char *) name;
m.m1_p1 = (char *) __UNCONST(name);
m.m1_p2 = (char *) &old_sb;
if((r = _syscall(VFS_PROC_NR, PREV_STAT, &m)) < 0)
@ -104,7 +104,7 @@ int _lstat(const char *name, struct stat *buffer)
struct minix_prev_stat old_sb;
m.m1_i1 = strlen(name) + 1;
m.m1_p1 = (char *) name;
m.m1_p1 = (char *) __UNCONST(name);
m.m1_p2 = (char *) buffer;
if((r = _syscall(VFS_PROC_NR, LSTAT, &m)) >= 0 || errno != ENOSYS)
@ -116,7 +116,7 @@ int _lstat(const char *name, struct stat *buffer)
* User has struct stat (buffer), VFS still fills minix_prev_stat.
*/
m.m1_i1 = strlen(name) + 1;
m.m1_p1 = (char *) name;
m.m1_p1 = (char *) __UNCONST(name);
m.m1_p2 = (char *) &old_sb;
if((r = _syscall(VFS_PROC_NR, PREV_LSTAT, &m)) < 0)

View file

@ -9,14 +9,12 @@
__weak_alias(statvfs, _statvfs)
#endif
int statvfs(name, buffer)
const char *name;
struct statvfs *buffer;
int statvfs(const char *name, struct statvfs *buffer)
{
message m;
m.STATVFS_LEN = strlen(name) + 1;
m.STATVFS_NAME = (char *) name;
m.STATVFS_NAME = (char *) __UNCONST(name);
m.STATVFS_BUF = (char *) buffer;
return(_syscall(VFS_PROC_NR, STATVFS, &m));
}

View file

@ -9,14 +9,13 @@ __weak_alias(symlink, _symlink)
#include <string.h>
#include <unistd.h>
int symlink(name, name2)
const char *name, *name2;
int symlink(const char *name, const char *name2)
{
message m;
m.m1_i1 = strlen(name) + 1;
m.m1_i2 = strlen(name2) + 1;
m.m1_p1 = (char *) name;
m.m1_p2 = (char *) name2;
m.m1_p1 = (char *) __UNCONST(name);
m.m1_p2 = (char *) __UNCONST(name2);
return(_syscall(VFS_PROC_NR, SYMLINK, &m));
}

View file

@ -13,7 +13,7 @@ __weak_alias(truncate, _truncate)
int truncate(const char *_path, off_t _length)
{
message m;
m.m2_p1 = (char *) _path;
m.m2_p1 = (char *) __UNCONST(_path);
m.m2_i1 = strlen(_path)+1;
m.m2_l1 = _length;

View file

@ -8,16 +8,13 @@
__weak_alias(write, _write)
#endif
ssize_t write(fd, buffer, nbytes)
int fd;
const void *buffer;
size_t nbytes;
ssize_t write(int fd, const void *buffer, size_t nbytes)
{
message m;
m.m1_i1 = fd;
m.m1_i2 = nbytes;
m.m1_p1 = (char *) buffer;
m.m1_p1 = (char *) __UNCONST(buffer);
return(_syscall(VFS_PROC_NR, WRITE, &m));
}

View file

@ -3,7 +3,7 @@
GCC?=gcc
CFLAGS= -O0 -D_MINIX -D_POSIX_SOURCE -g -Wall -Werror
.if ${COMPILER_TYPE} == "gnu"
CFLAGS+= -D_NETBSD_SOURCE
CFLAGS+= -D_NETBSD_SOURCE -fno-builtin
LIBS+= -lm -lcompat_minix
.endif
CFLAGS-GCC= $(CFLAGS) -Wall -D_NETBSD_SOURCE

View file

@ -38,22 +38,22 @@ int main()
if (getpid() == pid)
if (fork() == 0) {
execl("t10a", (char *) 0);
execl("t10a", "t10a", (char *) 0);
exit(0);
}
if (getpid() == pid)
if (fork() == 0) {
execl("t10b", (char *) 0);
execl("t10b", "t10b", (char *) 0);
exit(0);
}
if (getpid() == pid)
if (fork() == 0) {
execl("t10c", (char *) 0);
execl("t10c", "t10c", (char *) 0);
exit(0);
}
if (getpid() == pid)
if (fork() == 0) {
execl("t10d", (char *) 0);
execl("t10d", "t10d", (char *) 0);
exit(0);
}
@ -77,7 +77,7 @@ int n;
if ((pid = fork()) != 0) {
wait(&n); /* wait for some child (any one) */
} else {
k = execl(name[n], (char *) 0);
k = execl(name[n], name[n], (char *) 0);
errct++;
printf("Child execl didn't take. file=%s errno=%d\n", name[n], errno);
rmfiles();

View file

@ -88,7 +88,7 @@ void test11a()
* bits on. If a bug lets it unexpectedly succeed, the child
* will print an error message since the arguments are wrong.
*/
execl("t11a", (char *) 0, envp); /* should fail -- no X bits */
execl("t11a", "t11a", (char *) 0); /* should fail -- no X bits */
/* Control should come here after the failed execl(). */
chmod("t11a", 06555);

View file

@ -63,6 +63,8 @@ int main(int argc, char *argv[])
test20d();
}
quit();
return(-1); /* Unreachable */
}
void test20a()

View file

@ -65,6 +65,8 @@ char *argv[];
if (m & 020000) test21o();
}
quit();
return(-1); /* Unreachable */
}
void test21a()

View file

@ -37,6 +37,8 @@ int main(int argc, char *argv[])
}
quit();
return (-1); /* Unreachable */
}
void test22a()

View file

@ -52,6 +52,8 @@ int main(int argc, char *argv[])
if (m & 0004) test24c();
}
quit();
return(-1); /* Unreachable */
}
void test24a()

View file

@ -63,6 +63,8 @@ int main(int argc, char *argv[])
if (m & 020) test25e();
}
quit();
return(-1); /* Unreachable */
}
void test25a()

View file

@ -41,6 +41,8 @@ int main(int argc, char *argv[])
if (m & 0004) test26c();
}
quit();
return(-1); /* Unreachable */
}
void test26a()

View file

@ -47,6 +47,8 @@ int main(int argc, char *argv[])
if (m & 0004) test27c();
}
quit();
return(-1); /* Unreachable */
}
void test27a()

View file

@ -59,6 +59,8 @@ int main(int argc, char *argv[])
if (m & 0004) test28c();
}
quit();
return(-1); /* Unreachable */
}
void test28a()

View file

@ -58,6 +58,8 @@ int main(int argc, char *argv[])
if (m & 0004) test29c();
}
quit();
return(-1); /* Unreachable */
}
void test29a()

View file

@ -57,6 +57,8 @@ int main(int argc, char *argv[])
if (m & 0004) test30c();
}
quit();
return(-1); /* Unreachable */
}
void test30a()

View file

@ -49,6 +49,8 @@ int main(int argc, char *argv[])
if (m & 0004) test32c();
}
quit();
return(-1); /* Unreachable */
}
#define BUF_SIZE 1024

View file

@ -77,6 +77,8 @@ int main(int argc, char *argv[])
if (m & 0004) test34c();
}
quit();
return(-1); /* Unreachable */
}
void test34a()

View file

@ -102,6 +102,8 @@ char *argv[];
}
quit();
return(-1); /* Unreachable */
}
void test37a()

View file

@ -53,6 +53,8 @@ int main(int argc, char *argv[])
if (m & 0004) test38c();
}
quit();
return(-1); /* Unreachable */
}
void test38a()

View file

@ -10,7 +10,9 @@ _PROTOTYPE( void test39a, (void) );
int main(int argc, char *argv[])
{
start(39);
test39a();
quit();
return(-1); /* Unreachable */
}
void test39a()

View file

@ -60,6 +60,8 @@ int main(int argc, char *argv[])
group_test(); /* Perform some tests that mimic actual use */
quit();
return(-1); /* Unreachable */
}
void limit_test() {

View file

@ -276,4 +276,6 @@ int main(void)
/* this was all */
quit();
return(-1); /* Unreachable */
}

View file

@ -51,4 +51,5 @@ int main(void)
start(54);
do_test();
quit();
return(-1); /* Unreachable */
}

View file

@ -175,6 +175,7 @@ int main(int argc, char* argv[])
start(58);
do_test();
quit();
return(-1); /* Unreachable */
}

View file

@ -18,7 +18,7 @@
#include <setjmp.h>
#define ITERATIONS 4
#define MAX_ERROR 4
#define MAX_ERROR 3
#define ITEMS 32
#define READ 10
#define WRITE 20
@ -28,7 +28,9 @@
char buf[ITEMS] = {0,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,0,1,2,3,4,5,6,7,8,9};
int subtest, errct, xfd;
#include "common.c"
int subtes, xfd;
int whence = SEEK_SET, func_code = F_SETLK;
extern char **environ;
@ -50,9 +52,7 @@ _PROTOTYPE(void test7j, (void));
_PROTOTYPE(void cloexec_test, (void));
_PROTOTYPE(int set, (int how, int first, int last));
_PROTOTYPE(int locked, (int b));
_PROTOTYPE(void e, (int n));
_PROTOTYPE(void sigfunc, (int s));
_PROTOTYPE(void quit, (void));
int main(argc, argv)
int argc;
@ -61,15 +61,10 @@ char *argv[];
int i, m = 0xFFFF;
sync();
if (argc == 2) m = atoi(argv[1]);
if (m == 0) cloexec_test(); /* important; do not remove this! */
printf("Test 7 ");
fflush(stdout);
system("rm -rf DIR_07; mkdir DIR_07");
chdir("DIR_07");
start(7);
for (i = 0; i < ITERATIONS; i++) {
if (m & 00001) timed_test(test7a);
@ -690,39 +685,8 @@ int b;
return(WEXITSTATUS(status));
}
void e(n)
int n;
{
int err_num = errno; /* save errno in case printf clobbers it */
printf("Subtest %d, error %d errno=%d ", subtest, n, errno);
fflush(stdout);
errno = err_num; /* restore errno, just in case */
perror("");
if (errct++ > MAX_ERROR) {
printf("Too many errors; test aborted\n");
chdir("..");
system("rm -rf DIR*");
exit(1);
}
}
void sigfunc(s)
int s; /* for ANSI */
{
}
void quit()
{
chdir("..");
system("rm -rf DIR*");
if (errct == 0) {
printf("ok\n");
exit(0);
} else {
printf("%d errors\n", errct);
exit(1);
}
}