Existe algum utilitário que suporte o MNT_EXPIRE do umount2 (2)?

2

man umount2 diz:

   MNT_EXPIRE (since Linux 2.6.8)
          Mark the mount point as expired.  If a mount point is not
          currently in use, then an initial call to umount2() with this
          flag fails with the error EAGAIN, but marks the mount point as
          expired.  The mount point remains expired as long as it isn't
          accessed by any process.  A second umount2() call specifying
          MNT_EXPIRE unmounts an expired mount point.  This flag cannot
          be specified with either MNT_FORCE or MNT_DETACH.

umount parece não ser compatível .

Existe algum utilitário que permita usar esse sinalizador?

    
por Tom Hale 12.08.2017 / 08:38

1 resposta

2

Você pode acessar facilmente as funções C do Python.

#!/usr/bin/env python
import os, sys
from ctypes import *
libc = CDLL('libc.so.6', use_errno=True)
MNT_EXPIRE = 4
libc.umount2(c_char_p(sys.argv[1]), c_int(MNT_EXPIRE))
if get_errno() != 0:
    print os.strerror(get_errno())
    exit(1)
    
por 13.08.2017 / 02:48

Tags