Module Name: src
Committed By: joerg
Date: Tue Sep 6 18:30:39 UTC 2011
Modified Files:
src/usr.bin/shlock: shlock.c
Log Message:
Use pid_t directly. Apply static and __dead.
To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/shlock/shlock.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/shlock/shlock.c
diff -u src/usr.bin/shlock/shlock.c:1.11 src/usr.bin/shlock/shlock.c:1.12
--- src/usr.bin/shlock/shlock.c:1.11 Wed Aug 31 16:24:58 2011
+++ src/usr.bin/shlock/shlock.c Tue Sep 6 18:30:38 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: shlock.c,v 1.11 2011/08/31 16:24:58 plunky Exp $ */
+/* $NetBSD: shlock.c,v 1.12 2011/09/06 18:30:38 joerg Exp $ */
/*-
* Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: shlock.c,v 1.11 2011/08/31 16:24:58 plunky Exp $");
+__RCSID("$NetBSD: shlock.c,v 1.12 2011/09/06 18:30:38 joerg Exp $");
#endif
#include <sys/types.h>
@@ -88,11 +88,11 @@
#define TRUE 1
#define FALSE 0
-int Debug = FALSE;
-char *Pname;
-const char USAGE[] = "%s: USAGE: %s [-du] [-p PID] -f file\n";
-const char E_unlk[] = "%s: unlink(%s): %s\n";
-const char E_open[] = "%s: open(%s): %s\n";
+static int Debug = FALSE;
+static char *Pname;
+static const char USAGE[] = "%s: USAGE: %s [-du] [-p PID] -f file\n";
+static const char E_unlk[] = "%s: unlink(%s): %s\n";
+static const char E_open[] = "%s: open(%s): %s\n";
#define dprintf if (Debug) printf
@@ -103,12 +103,11 @@
*/
/* the following is in case you need to make the prototypes go away. */
-char *xtmpfile(char *, pid_t, int);
-int p_exists(pid_t);
-int cklock(char *, int);
-int mklock(char *, pid_t, int);
-void bad_usage(void);
-int main(int, char **);
+static char *xtmpfile(char *, pid_t, int);
+static int p_exists(pid_t);
+static int cklock(char *, int);
+static int mklock(char *, pid_t, int);
+__dead static void bad_usage(void);
/*
** Create a temporary file, all ready to lock with.
@@ -116,8 +115,8 @@
** gave us a full path, instead of using the current directory
** which might not be in the same filesystem.
*/
-char *
-xtmpfile(char *file, __pid_t pid, int uucpstyle)
+static char *
+xtmpfile(char *file, pid_t pid, int uucpstyle)
{
int fd;
int len;
@@ -182,8 +181,8 @@
** Does the PID exist?
** Send null signal to find out.
*/
-int
-p_exists(__pid_t pid)
+static int
+p_exists(pid_t pid)
{
dprintf("%s: process %ld is ", Pname, (u_long)pid);
if (pid <= 0) {
@@ -222,7 +221,7 @@
** o No clean up to do if the system or application crashes.
**
*/
-int
+static int
cklock(char *file, int uucpstyle)
{
int fd = open(file, O_RDONLY);
@@ -250,8 +249,8 @@
return(p_exists(uucpstyle ? pid : atoi(buf)));
}
-int
-mklock(char *file, __pid_t pid, int uucpstyle)
+static int
+mklock(char *file, pid_t pid, int uucpstyle)
{
char *tmp;
int retcode = FALSE;
@@ -298,7 +297,7 @@
return(retcode);
}
-void
+static void
bad_usage(void)
{
fprintf(stderr, USAGE, Pname, Pname);