/[LeafOK_CVS]/lbbs/src/test_file_loader.c
ViewVC logotype

Diff of /lbbs/src/test_file_loader.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.2 by sysadm, Sat May 17 05:54:42 2025 UTC Revision 1.3 by sysadm, Sun May 18 06:56:46 2025 UTC
# Line 35  int main(int argc, char *argv[]) Line 35  int main(int argc, char *argv[])
35  {  {
36          int ret;          int ret;
37          int i;          int i;
38          const void *p_file_shm;          const void *p_shm;
39            size_t data_len;
40            long line_total;
41            const void *p_data;
42            const long *p_line_offsets;
43    
44          if (log_begin("../log/bbsd.log", "../log/error.log") < 0)          if (log_begin("../log/bbsd.log", "../log/error.log") < 0)
45          {          {
# Line 71  int main(int argc, char *argv[]) Line 75  int main(int argc, char *argv[])
75    
76          for (i = 0; i < files_cnt; i++)          for (i = 0; i < files_cnt; i++)
77          {          {
78                  if ((p_file_shm = get_file_shm(files[i])) == NULL)                  if ((p_shm = get_file_shm(files[i], &data_len, &line_total, &p_data, &p_line_offsets)) == NULL)
79                  {                  {
80                          printf("Get file shm %s error\n", files[i]);                          printf("Get file shm %s error\n", files[i]);
81                  }                  }
82                  else                  else
83                  {                  {
84                          printf("File: %s size: %ld lines: %ld\n", files[i], *((size_t *)p_file_shm), *((size_t *)(p_file_shm + sizeof(size_t))));                          printf("File: %s size: %ld lines: %ld\n", files[i], data_len, line_total);
   
                         if (shmdt(p_file_shm) == -1)  
                         {  
                                 log_error("shmdt() error (%d)\n", errno);  
                         }  
85                  }                  }
86          }          }
87    
# Line 121  int main(int argc, char *argv[]) Line 120  int main(int argc, char *argv[])
120          {          {
121                  if (i % 2 != 0)                  if (i % 2 != 0)
122                  {                  {
123                          if ((p_file_shm = get_file_shm(files[i])) == NULL)                          if ((p_shm = get_file_shm(files[i], &data_len, &line_total, &p_data, &p_line_offsets)) == NULL)
124                          {                          {
125                                  printf("Get file shm %s error\n", files[i]);                                  printf("Get file shm %s error\n", files[i]);
126                          }                          }
127                          else                          else
128                          {                          {
129                                  printf("File: %s size: %ld lines: %ld\n", files[i], *((size_t *)p_file_shm), *((size_t *)(p_file_shm + sizeof(size_t))));                                  printf("File: %s size: %ld lines: %ld\n", files[i], data_len, line_total);
   
                                 if (shmdt(p_file_shm) == -1)  
                                 {  
                                         log_error("shmdt() error (%d)\n", errno);  
                                 }  
130                          }                          }
131                  }                  }
132          }          }


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1