Skip to content

Instantly share code, notes, and snippets.

@ahojukka5
Created February 24, 2021 10:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahojukka5/299df70e0025491a0c4ddfd347a4bfe5 to your computer and use it in GitHub Desktop.
Save ahojukka5/299df70e0025491a0c4ddfd347a4bfe5 to your computer and use it in GitHub Desktop.
Prosesseja, prosesseja
16:59 $ ps aux |grep main_static
jukka     686308  0.0  0.0   1072     8 pts/9    S+   17:00   0:00 ./main_static
jukka     686314  0.0  0.0   1072     8 pts/12   S+   17:01   0:00 ./main_static
jukka     686324  0.0  0.0  11572   740 pts/11   S+   17:01   0:00 grep --color=auto main_static
17:01 $ sudo pmap -x 686308
686308:   ./main_static
Address           Kbytes     RSS   Dirty Mode  Mapping
0000000000400000       4       4       0 r---- main_static
0000000000401000     592     592       0 r-x-- main_static
0000000000495000     156     156       0 r---- main_static
00000000004bd000      12      12       4 r---- main_static
00000000004c0000      12      12      12 rw--- main_static
00000000004c3000       4       4       4 rw---   [ anon ]
0000000000cd7000     140      12      12 rw---   [ anon ]
00007fff145fa000     136      20      20 rw---   [ stack ]
00007fff14692000      12       0       0 r----   [ anon ]
00007fff14695000       4       4       0 r-x--   [ anon ]
ffffffffff600000       4       0       0 --x--   [ anon ]
---------------- ------- ------- ------- 
total kB            1076     816      52
17:01 $ sudo pmap -x 686314
686314:   ./main_static
Address           Kbytes     RSS   Dirty Mode  Mapping
0000000000400000       4       4       0 r---- main_static
0000000000401000     592     592       0 r-x-- main_static
0000000000495000     156     156       0 r---- main_static
00000000004bd000      12      12       4 r---- main_static
00000000004c0000      12      12      12 rw--- main_static
00000000004c3000       4       4       4 rw---   [ anon ]
0000000000e38000     140      12      12 rw---   [ anon ]
00007ffcd1fdd000     136      16      16 rw---   [ stack ]
00007ffcd216f000      12       0       0 r----   [ anon ]
00007ffcd2172000       4       4       0 r-x--   [ anon ]
ffffffffff600000       4       0       0 --x--   [ anon ]
---------------- ------- ------- ------- 
total kB            1076     812      48
// gcc -static -o main main.c
#include <stdio.h>
#include <string.h>
void main() {
char name[20];
while (1) {
printf("Anna nimi: ");
fgets(name, 20, stdin);
if (strlen(name) == 1) {
return;
}
printf("Hei, %s", name);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment