aboutsummaryrefslogtreecommitdiff
path: root/sysklogd/logread.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2004-03-15 08:29:22 +0000
committerEric Andersen <andersen@codepoet.org>2004-03-15 08:29:22 +0000
commitc7bda1ce659294d6e22c06e087f6f265983c7578 (patch)
tree4c6d2217f4d8306c59cf1096f8664e1cfd167213 /sysklogd/logread.c
parent8854004b41065b3d081af7f3df13a100b0c8bfbe (diff)
downloadbusybox-w32-c7bda1ce659294d6e22c06e087f6f265983c7578.tar.gz
busybox-w32-c7bda1ce659294d6e22c06e087f6f265983c7578.tar.bz2
busybox-w32-c7bda1ce659294d6e22c06e087f6f265983c7578.zip
Remove trailing whitespace. Update copyright to include 2004.
Diffstat (limited to 'sysklogd/logread.c')
-rw-r--r--sysklogd/logread.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/sysklogd/logread.c b/sysklogd/logread.c
index 207e78b57..70d1db631 100644
--- a/sysklogd/logread.c
+++ b/sysklogd/logread.c
@@ -62,13 +62,13 @@ static void interrupted(int sig);
62 */ 62 */
63static inline void sem_up(int semid) 63static inline void sem_up(int semid)
64{ 64{
65 if ( semop(semid, SMrup, 1) == -1 ) 65 if ( semop(semid, SMrup, 1) == -1 )
66 error_exit("semop[SMrup]"); 66 error_exit("semop[SMrup]");
67} 67}
68 68
69/* 69/*
70 * sem_down - down()'s a semaphore 70 * sem_down - down()'s a semaphore
71 */ 71 */
72static inline void sem_down(int semid) 72static inline void sem_down(int semid)
73{ 73{
74 if ( semop(semid, SMrdn, 2) == -1 ) 74 if ( semop(semid, SMrdn, 2) == -1 )
@@ -79,7 +79,7 @@ extern int logread_main(int argc, char **argv)
79{ 79{
80 int i; 80 int i;
81 int follow=0; 81 int follow=0;
82 82
83 if (argc == 2 && strcmp(argv[1],"-f")==0) { 83 if (argc == 2 && strcmp(argv[1],"-f")==0) {
84 follow = 1; 84 follow = 1;
85 } else { 85 } else {
@@ -87,16 +87,16 @@ extern int logread_main(int argc, char **argv)
87 if (argc > 1) 87 if (argc > 1)
88 bb_show_usage(); 88 bb_show_usage();
89 } 89 }
90 90
91 // handle intrrupt signal 91 // handle intrrupt signal
92 if (setjmp(jmp_env)) goto output_end; 92 if (setjmp(jmp_env)) goto output_end;
93 93
94 // attempt to redefine ^C signal 94 // attempt to redefine ^C signal
95 signal(SIGINT, interrupted); 95 signal(SIGINT, interrupted);
96 96
97 if ( (log_shmid = shmget(KEY_ID, 0, 0)) == -1) 97 if ( (log_shmid = shmget(KEY_ID, 0, 0)) == -1)
98 error_exit("Can't find circular buffer"); 98 error_exit("Can't find circular buffer");
99 99
100 // Attach shared memory to our char* 100 // Attach shared memory to our char*
101 if ( (buf = shmat(log_shmid, NULL, SHM_RDONLY)) == NULL) 101 if ( (buf = shmat(log_shmid, NULL, SHM_RDONLY)) == NULL)
102 error_exit("Can't get access to circular buffer from syslogd"); 102 error_exit("Can't get access to circular buffer from syslogd");
@@ -113,7 +113,7 @@ extern int logread_main(int argc, char **argv)
113 int log_len,j; 113 int log_len,j;
114#endif 114#endif
115 115
116 sem_down(log_semid); 116 sem_down(log_semid);
117 117
118 //printf("head: %i tail: %i size: %i\n",buf->head,buf->tail,buf->size); 118 //printf("head: %i tail: %i size: %i\n",buf->head,buf->tail,buf->size);
119 if (buf->head == buf->tail || i==buf->tail) { 119 if (buf->head == buf->tail || i==buf->tail) {
@@ -125,8 +125,8 @@ extern int logread_main(int argc, char **argv)
125 printf("<empty syslog>\n"); 125 printf("<empty syslog>\n");
126 } 126 }
127 } 127 }
128 128
129 // Read Memory 129 // Read Memory
130#ifdef CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING 130#ifdef CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING
131 log_len = buf->tail - i; 131 log_len = buf->tail - i;
132 if (log_len < 0) 132 if (log_len < 0)
@@ -165,10 +165,10 @@ extern int logread_main(int argc, char **argv)
165 } while (follow); 165 } while (follow);
166 166
167output_end: 167output_end:
168 if (log_shmid != -1) 168 if (log_shmid != -1)
169 shmdt(buf); 169 shmdt(buf);
170 170
171 return EXIT_SUCCESS; 171 return EXIT_SUCCESS;
172} 172}
173 173
174static void interrupted(int sig){ 174static void interrupted(int sig){
@@ -179,7 +179,7 @@ static void interrupted(int sig){
179static void error_exit(const char *str){ 179static void error_exit(const char *str){
180 perror(str); 180 perror(str);
181 //release all acquired resources 181 //release all acquired resources
182 if (log_shmid != -1) 182 if (log_shmid != -1)
183 shmdt(buf); 183 shmdt(buf);
184 184
185 exit(1); 185 exit(1);