Commit 0421fc83 authored by Peter Foley's avatar Peter Foley Committed by Jiri Kosina

Documentation: make functions static to avoid prototype warnings

Signed-off-by: default avatarPeter Foley <pefoley2@pefoley.com>
Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent adb19fb6
...@@ -77,7 +77,7 @@ struct hdr { ...@@ -77,7 +77,7 @@ struct hdr {
#define ROUND_UP(x) ((x + ALIGN - 1) & ~(ALIGN - 1)) #define ROUND_UP(x) ((x + ALIGN - 1) & ~(ALIGN - 1))
ssize_t do_read(int fd, void *buf, size_t count) static ssize_t do_read(int fd, void *buf, size_t count)
{ {
size_t offset = 0; size_t offset = 0;
ssize_t l; ssize_t l;
...@@ -98,7 +98,7 @@ ssize_t do_read(int fd, void *buf, size_t count) ...@@ -98,7 +98,7 @@ ssize_t do_read(int fd, void *buf, size_t count)
return offset; return offset;
} }
ssize_t do_write(int fd, const void *buf, size_t count) static ssize_t do_write(int fd, const void *buf, size_t count)
{ {
size_t offset = 0; size_t offset = 0;
ssize_t l; ssize_t l;
...@@ -117,7 +117,7 @@ ssize_t do_write(int fd, const void *buf, size_t count) ...@@ -117,7 +117,7 @@ ssize_t do_write(int fd, const void *buf, size_t count)
return offset; return offset;
} }
ssize_t write_zero(int fd, size_t len) static ssize_t write_zero(int fd, size_t len)
{ {
size_t i = len; size_t i = len;
......
...@@ -27,19 +27,20 @@ ...@@ -27,19 +27,20 @@
# define PR_TSC_SIGSEGV 2 /* throw a SIGSEGV instead of reading the TSC */ # define PR_TSC_SIGSEGV 2 /* throw a SIGSEGV instead of reading the TSC */
#endif #endif
uint64_t rdtsc() { static uint64_t rdtsc(void)
{
uint32_t lo, hi; uint32_t lo, hi;
/* We cannot use "=A", since this would use %rax on x86_64 */ /* We cannot use "=A", since this would use %rax on x86_64 */
__asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
return (uint64_t)hi << 32 | lo; return (uint64_t)hi << 32 | lo;
} }
void sigsegv_expect(int sig) static void sigsegv_expect(int sig)
{ {
/* */ /* */
} }
void segvtask(void) static void segvtask(void)
{ {
if (prctl(PR_SET_TSC, PR_TSC_SIGSEGV) < 0) if (prctl(PR_SET_TSC, PR_TSC_SIGSEGV) < 0)
{ {
...@@ -54,13 +55,13 @@ void segvtask(void) ...@@ -54,13 +55,13 @@ void segvtask(void)
} }
void sigsegv_fail(int sig) static void sigsegv_fail(int sig)
{ {
fprintf(stderr, "FATAL ERROR, rdtsc() failed while enabled\n"); fprintf(stderr, "FATAL ERROR, rdtsc() failed while enabled\n");
exit(0); exit(0);
} }
void rdtsctask(void) static void rdtsctask(void)
{ {
if (prctl(PR_SET_TSC, PR_TSC_ENABLE) < 0) if (prctl(PR_SET_TSC, PR_TSC_ENABLE) < 0)
{ {
......
...@@ -29,7 +29,8 @@ ...@@ -29,7 +29,8 @@
/* snippet from wikipedia :-) */ /* snippet from wikipedia :-) */
uint64_t rdtsc() { static uint64_t rdtsc(void)
{
uint32_t lo, hi; uint32_t lo, hi;
/* We cannot use "=A", since this would use %rax on x86_64 */ /* We cannot use "=A", since this would use %rax on x86_64 */
__asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
...@@ -38,7 +39,7 @@ return (uint64_t)hi << 32 | lo; ...@@ -38,7 +39,7 @@ return (uint64_t)hi << 32 | lo;
int should_segv = 0; int should_segv = 0;
void sigsegv_cb(int sig) static void sigsegv_cb(int sig)
{ {
if (!should_segv) if (!should_segv)
{ {
...@@ -55,7 +56,7 @@ void sigsegv_cb(int sig) ...@@ -55,7 +56,7 @@ void sigsegv_cb(int sig)
rdtsc(); rdtsc();
} }
void task(void) static void task(void)
{ {
signal(SIGSEGV, sigsegv_cb); signal(SIGSEGV, sigsegv_cb);
alarm(10); alarm(10);
......
...@@ -29,14 +29,15 @@ const char *tsc_names[] = ...@@ -29,14 +29,15 @@ const char *tsc_names[] =
[PR_TSC_SIGSEGV] = "PR_TSC_SIGSEGV", [PR_TSC_SIGSEGV] = "PR_TSC_SIGSEGV",
}; };
uint64_t rdtsc() { static uint64_t rdtsc(void)
{
uint32_t lo, hi; uint32_t lo, hi;
/* We cannot use "=A", since this would use %rax on x86_64 */ /* We cannot use "=A", since this would use %rax on x86_64 */
__asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
return (uint64_t)hi << 32 | lo; return (uint64_t)hi << 32 | lo;
} }
void sigsegv_cb(int sig) static void sigsegv_cb(int sig)
{ {
int tsc_val = 0; int tsc_val = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment