~ubuntu-branches/debian/sid/iotop/sid

« back to all changes in this revision

Viewing changes to iotop/netlink.py

  • Committer: Package Import Robot
  • Author(s): Paul Wise, Paul Wise, Scott Kitterman
  • Date: 2011-11-01 16:10:09 UTC
  • mfrom: (1.1.8)
  • Revision ID: package-import@ubuntu.com-20111101161009-h8v36iuwrhzmclhb
Tags: 0.4.4-1
[ Paul Wise ]
* New upstream release
  - Produces a helpful error instead of crashing when Linux
    denies permission (Closes: #644616, LP: #879767)
* Bump Standards-Version, no changes needed

[ Scott Kitterman ]
* Switch to dh_python2 (LP: #856478)

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
GPLv2+; See copying for details.
7
7
'''
8
8
 
9
 
import struct, socket
 
9
import os
 
10
import socket
 
11
import struct
10
12
 
11
13
try:
12
14
    # try to use python 2.5's netlink support
36
38
    except ImportError:
37
39
        # or fall back to the ctypes module
38
40
        import ctypes
39
 
        import os
40
41
 
41
42
        libc = ctypes.CDLL(None)
42
43
 
220
221
        msg = Message(msg_type, flags, seq, contents[16:])
221
222
        msg.pid = pid
222
223
        if msg.type == NLMSG_ERROR:
223
 
            import os
224
224
            errno = -struct.unpack("i", msg.payload[:4])[0]
225
225
            if errno != 0:
226
226
                err = OSError("Netlink error: %s (%d)" % (