summaryrefslogtreecommitdiffstats
path: root/usr.bin/gcore
diff options
context:
space:
mode:
authordwmalone <dwmalone@FreeBSD.org>2002-09-04 23:29:10 +0000
committerdwmalone <dwmalone@FreeBSD.org>2002-09-04 23:29:10 +0000
commitb4339b74aded4c38ebcfe3a2a9b37b900abb8874 (patch)
treefb230419005f211ecea1e667385bde9886dbf0d8 /usr.bin/gcore
parent228b93ce829543fee06561687a63c17a7e821dfd (diff)
downloadFreeBSD-src-b4339b74aded4c38ebcfe3a2a9b37b900abb8874.zip
FreeBSD-src-b4339b74aded4c38ebcfe3a2a9b37b900abb8874.tar.gz
ANSIify function definitions.
Add some constness to avoid some warnings. Remove use register keyword. Deal with missing/unneeded extern/prototypes. Some minor type changes/casts to avoid warnings. Reviewed by: md5
Diffstat (limited to 'usr.bin/gcore')
-rw-r--r--usr.bin/gcore/aoutcore.c4
-rw-r--r--usr.bin/gcore/elfcore.c19
-rw-r--r--usr.bin/gcore/gcore.c4
-rw-r--r--usr.bin/gcore/md-nop.c6
4 files changed, 19 insertions, 14 deletions
diff --git a/usr.bin/gcore/aoutcore.c b/usr.bin/gcore/aoutcore.c
index e9c2e63..7c8ede6 100644
--- a/usr.bin/gcore/aoutcore.c
+++ b/usr.bin/gcore/aoutcore.c
@@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$");
#include <sys/user.h>
#include <sys/sysctl.h>
+#include <arpa/inet.h>
#include <machine/elf.h>
#include <machine/vmparam.h>
@@ -99,7 +100,8 @@ main(argc, argv)
{
struct kinfo_proc *ki = NULL;
struct exec exec;
- int ch, cnt, efd, fd, sflag, uid;
+ int ch, cnt, efd, fd, sflag;
+ uid_t uid;
char *binfile, *corefile;
char errbuf[_POSIX2_LINE_MAX], fname[MAXPATHLEN];
int is_aout;
diff --git a/usr.bin/gcore/elfcore.c b/usr.bin/gcore/elfcore.c
index ef98a69..e473d7c 100644
--- a/usr.bin/gcore/elfcore.c
+++ b/usr.bin/gcore/elfcore.c
@@ -125,28 +125,29 @@ elf_coredump(int fd, pid_t pid)
php = (Elf_Phdr *)((char *)hdr + sizeof(Elf_Ehdr)) + 1;
for (i = 0; i < seginfo.count; i++) {
- int nleft = php->p_filesz;
+ uintmax_t nleft = php->p_filesz;
lseek(memfd, (off_t)php->p_vaddr, SEEK_SET);
while (nleft > 0) {
char buf[8*1024];
- int nwant;
- int ngot;
+ size_t nwant;
+ ssize_t ngot;
- nwant = nleft;
- if (nwant > sizeof buf)
+ if (nleft > sizeof(buf))
nwant = sizeof buf;
+ else
+ nwant = nleft;
ngot = read(memfd, buf, nwant);
if (ngot == -1)
err(1, "read from %s", memname);
- if (ngot < nwant)
+ if ((size_t)ngot < nwant)
errx(1, "short read from %s:"
" wanted %d, got %d", memname,
nwant, ngot);
ngot = write(fd, buf, nwant);
if (ngot == -1)
err(1, "write of segment %d failed", i);
- if (ngot != nwant)
+ if ((size_t)ngot != nwant)
errx(1, "short write");
nleft -= nwant;
}
@@ -395,7 +396,7 @@ readhdrinfo(pid_t pid, prstatus_t *status, prfpregset_t *fpregset,
err(1, "cannot open %s", name);
if ((n = read(fd, &status->pr_reg, sizeof status->pr_reg)) == -1)
err(1, "read error from %s", name);
- if (n < sizeof status->pr_reg)
+ if ((size_t)n < sizeof(status->pr_reg))
errx(1, "short read from %s: wanted %u, got %d", name,
sizeof status->pr_reg, n);
close(fd);
@@ -406,7 +407,7 @@ readhdrinfo(pid_t pid, prstatus_t *status, prfpregset_t *fpregset,
err(1, "cannot open %s", name);
if ((n = read(fd, fpregset, sizeof *fpregset)) == -1)
err(1, "read error from %s", name);
- if (n < sizeof *fpregset)
+ if ((size_t)n < sizeof(*fpregset))
errx(1, "short read from %s: wanted %u, got %d", name,
sizeof *fpregset, n);
close(fd);
diff --git a/usr.bin/gcore/gcore.c b/usr.bin/gcore/gcore.c
index e9c2e63..7c8ede6 100644
--- a/usr.bin/gcore/gcore.c
+++ b/usr.bin/gcore/gcore.c
@@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$");
#include <sys/user.h>
#include <sys/sysctl.h>
+#include <arpa/inet.h>
#include <machine/elf.h>
#include <machine/vmparam.h>
@@ -99,7 +100,8 @@ main(argc, argv)
{
struct kinfo_proc *ki = NULL;
struct exec exec;
- int ch, cnt, efd, fd, sflag, uid;
+ int ch, cnt, efd, fd, sflag;
+ uid_t uid;
char *binfile, *corefile;
char errbuf[_POSIX2_LINE_MAX], fname[MAXPATHLEN];
int is_aout;
diff --git a/usr.bin/gcore/md-nop.c b/usr.bin/gcore/md-nop.c
index ee6a041..af7072c 100644
--- a/usr.bin/gcore/md-nop.c
+++ b/usr.bin/gcore/md-nop.c
@@ -48,9 +48,9 @@ __FBSDID("$FreeBSD$");
void
md_core(kd, fd, ki)
- kvm_t *kd;
- int fd;
- struct kinfo_proc *ki;
+ kvm_t *kd __unused;
+ int fd __unused;
+ struct kinfo_proc *ki __unused;
{
/* Don't need to fix anything for this architecture. */
return;
OpenPOWER on IntegriCloud