title: Remount filesystem with mount() without knowing the filesystem type or source device
body: <p>I need to remount <code>/</code> read-only with C running on Linux. So far, I've come up with the following code:</p>
  
  <pre><code>mount("/dev/sda1", "/", "ext4", MS_REMOUNT | MS_RDONLY, NULL);
  </code></pre>
  
  <p>But I was wondering if there was a way to do that without specifying the source device (/dev/sda1) or the file system type (ext4), like the command <code>mount -o remount,ro /</code>. Can those sections of the syscall simply be replaced with <code>NULL</code>?</p>