Cosmetics:

- Move to ANSI definitions syntax, removing warnings about type promotions.
- Remove __P().
- Staticise everything.
- Remove warnings about unused args for signal handlers.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
This commit is contained in:
kib 2015-03-18 22:05:15 +00:00
parent dbd87e5d3d
commit 862f41014f

View File

@ -49,27 +49,22 @@
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
int main __P((int, char *[])); static void print_shmid_ds(struct shmid_ds *, mode_t);
void print_shmid_ds __P((struct shmid_ds *, mode_t)); static void sigsys_handler(int);
void sigsys_handler __P((int)); static void sigchld_handler(int);
void sigchld_handler __P((int)); static void cleanup(void);
void cleanup __P((void)); static void receiver(void);
void receiver __P((void)); static void usage(void);
void usage __P((void));
const char *m_str = "The quick brown fox jumped over the lazy dog."; static const char *m_str = "The quick brown fox jumped over the lazy dog.";
int sender_shmid = -1; static int sender_shmid = -1;
pid_t child_pid; static pid_t child_pid;
static key_t shmkey;
key_t shmkey; static size_t pgsize;
size_t pgsize;
int int
main(argc, argv) main(int argc, char *argv[])
int argc;
char *argv[];
{ {
struct sigaction sa; struct sigaction sa;
struct shmid_ds s_ds; struct shmid_ds s_ds;
@ -172,17 +167,15 @@ main(argc, argv)
errx(1, "sender: received unexpected signal"); errx(1, "sender: received unexpected signal");
} }
void static void
sigsys_handler(signo) sigsys_handler(int signo __unused)
int signo;
{ {
errx(1, "System V Shared Memory support is not present in the kernel"); errx(1, "System V Shared Memory support is not present in the kernel");
} }
void static void
sigchld_handler(signo) sigchld_handler(int signo __unused)
int signo;
{ {
struct shmid_ds s_ds; struct shmid_ds s_ds;
int cstatus; int cstatus;
@ -214,8 +207,8 @@ sigchld_handler(signo)
exit(0); exit(0);
} }
void static void
cleanup() cleanup(void)
{ {
/* /*
@ -227,10 +220,8 @@ cleanup()
} }
} }
void static void
print_shmid_ds(sp, mode) print_shmid_ds(struct shmid_ds *sp, mode_t mode)
struct shmid_ds *sp;
mode_t mode;
{ {
uid_t uid = geteuid(); uid_t uid = geteuid();
gid_t gid = getegid(); gid_t gid = getegid();
@ -262,16 +253,16 @@ print_shmid_ds(sp, mode)
errx(1, "mode mismatch"); errx(1, "mode mismatch");
} }
void static void
usage() usage(void)
{ {
fprintf(stderr, "usage: %s keypath\n", getprogname()); fprintf(stderr, "usage: %s keypath\n", getprogname());
exit(1); exit(1);
} }
void static void
receiver() receiver(void)
{ {
int shmid; int shmid;
void *shm_buf; void *shm_buf;