Updated with Tizen:Base source codes
[external/procps.git] / packaging / procps-3.2.7-ps-stime.patch
1 --- procps-3.2.7/ps/output.c.jitter     2007-04-26 13:15:47.000000000 +0200
2 +++ procps-3.2.7/ps/output.c    2007-04-26 13:31:24.000000000 +0200
3 @@ -77,7 +77,6 @@
4  static int wide_signals;  /* true if we have room */
5  
6  static unsigned long seconds_since_1970;
7 -static unsigned long time_of_boot;
8  static unsigned long page_shift;
9  
10  
11 @@ -1952,7 +1951,6 @@
12    // available space:  page_size*outbuf_pages-SPACE_AMOUNT
13  
14    seconds_since_1970 = time(NULL);
15 -  time_of_boot = seconds_since_1970 - seconds_since_boot;
16  
17    meminfo();
18  
19 --- procps-3.2.7/ps/common.h.jitter     2005-01-27 04:43:22.000000000 +0100
20 +++ procps-3.2.7/ps/common.h    2007-04-26 12:44:01.000000000 +0200
21 @@ -302,6 +302,7 @@
22  extern int             screen_cols;
23  extern int             screen_rows;
24  extern unsigned long   seconds_since_boot;
25 +extern unsigned long   time_of_boot;
26  extern selection_node *selection_list;
27  extern unsigned        simple_select;
28  extern sort_node      *sort_list;
29 --- procps-3.2.7/ps/global.c.jitter     2005-10-30 01:43:34.000000000 +0200
30 +++ procps-3.2.7/ps/global.c    2007-04-26 13:26:38.000000000 +0200
31 @@ -70,6 +70,7 @@
32  int             screen_cols = -1;
33  int             screen_rows = -1;
34  unsigned long   seconds_since_boot = -1;
35 +unsigned long   time_of_boot = -1;
36  selection_node *selection_list = (selection_node *)0xdeadbeef;
37  unsigned        simple_select = 0xffffffff;
38  sort_node      *sort_list = (sort_node *)0xdeadbeef; /* ready-to-use sort list */
39 @@ -361,7 +362,23 @@
40    look_up_our_self(&p);
41    set_screen_size();
42    set_personality();
43 -  
44 +  int fd;
45 +  char *buf[BUFFSIZE];
46 +  const char *b;
47 +
48 +  /* get boot time from /proc/stat */
49 +  fd = open("/proc/stat", O_RDONLY, 0);
50 +  if (fd != -1) {
51 +    buf[BUFFSIZE-1] = 0;
52 +    read(fd, buf, BUFFSIZE-1);
53 +    b = strstr(buf, "btime ");
54 +    if (b) {
55 +      sscanf(b, "btime %lu", &time_of_boot);
56 +      seconds_since_boot = time(0) - time_of_boot;
57 +    }  
58 +    close(fd);
59 +  }
60 +    
61    all_processes         = 0;
62    bsd_c_option          = 0;
63    bsd_e_option          = 0;
64 @@ -380,7 +397,6 @@
65    negate_selection      = 0;
66    page_size             = getpagesize();
67    running_only          = 0;
68 -  seconds_since_boot    = uptime(0,0);
69    selection_list        = NULL;
70    simple_select         = 0;
71    sort_list             = NULL;