title: Read data from proc/sys/kernel/
body: <p>I want create program for get info about operating system. I tried used syscalls, but think that read from systems files will be more faster (directly). So, i write simple program for read data from file from directory &quot;/proc/sys/kernel/&quot; and want read files: osrelease hostname, ostype and other.... So, i did supposed is just but isn't. When i read file &quot;hostname&quot; i got this:</p>
  <pre><code>����
  </code></pre>
  <p>If i read as superuser i got normal data</p>
  <pre><code>oleg
  </code></pre>
  <p>This is code of my program:</p>
  <pre><code>global _start
  
  section .data
  file db &quot;/proc/sys/kernel/hostname&quot;,0
  
  section .bss
  buf resb 1024
  descriptor resb 4
  len equ 1024
  
  
  section .text
  _start:
  
      mov eax, 5
      mov ebx, file
      mov ecx, 2
      int 80h
      mov [descriptor], eax
  
  read:
      mov eax, 3  ;read text
      mov ebx, [descriptor];  
      mov ecx, buf    ;read to variable buf
      mov edx, len    ;size of bug
      int 80h     ;interrupt
  
  print_text:
      mov edx, eax
      mov eax, 4
      mov ebx, 1
      mov ecx, buf
      int 80h
  
  close_file:
      mov eax, 6
      mov ebx, [descriptor]
      int 80h
  
  exit:
      mov eax, 1
      mov ebx, 0
      int 80h
  </code></pre>
  <p>So, i thought change name of file and can get other system information, but it's mistake, because i don't got result. So, i change path to file, compile project and execute program as super user and i don't get result. Nothing...
  I can read all files except this directory (&quot;proc/sys/kernel&quot;).
  I googled information about this problem and don't find similar problem. I think it is security of OS, but i only read info, don't write... I understand that using syscall more simple, but want undestand structure of OS. Why i can't read info from this directory? So, can you attach useful info about this problam, please?</p>