Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.package.keep
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ivan Tyagov
slapos.package.keep
Commits
6ccaa7f9
Commit
6ccaa7f9
authored
May 17, 2013
by
Jondy Zhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add skeleton files of net usage report
parent
aa7a0e43
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
133 additions
and
0 deletions
+133
-0
windows/netreport/README
windows/netreport/README
+1
-0
windows/netreport/setup.py
windows/netreport/setup.py
+66
-0
windows/netreport/src/netuse.c
windows/netreport/src/netuse.c
+66
-0
No files found.
windows/netreport/README
0 → 100644
View file @
6ccaa7f9
Net Resource Usage Report For Windows
windows/netreport/setup.py
0 → 100644
View file @
6ccaa7f9
#!/usr/bin/env python
#
import
sys
import
os
try
:
from
setuptools
import
setup
,
Extension
except
ImportError
:
from
distutils.core
import
setup
,
Extension
def
get_description
():
README
=
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'README'
))
f
=
open
(
README
,
'r'
)
try
:
return
f
.
read
()
finally
:
f
.
close
()
VERSION
=
"0.1.1"
if
sys
.
platform
.
startswith
(
"cygwin"
):
def
get_winver
():
return
'0x0503'
maj
,
min
=
sys
.
getwindowsversion
()[
0
:
2
]
return
'0x0%s'
%
((
maj
*
100
)
+
min
)
extensions
=
[
Extension
(
'netuse'
,
sources
=
[
'src/netuse.c'
],
define_macros
=
[(
'_WIN32_WINNT'
,
'0x0503'
),
(
'USE_SYS_TYPES_FD_SET'
,
1
)],
libraries
=
[
"psapi"
,
"kernel32"
,
"advapi32"
,
"shell32"
,
"netapi32"
,
"iphlpapi"
,
"wtsapi32"
],
#extra_compile_args=["/Z7"],
#extra_link_args=["/DEBUG"]
)]
else
:
sys
.
exit
(
'platform %s is not supported'
%
sys
.
platform
)
def
main
():
setup_args
=
dict
(
name
=
'netreport'
,
version
=
VERSION
,
download_url
=
'http://'
,
description
=
'A tool used to report the usage of net resource in the Windows'
,
long_description
=
get_description
(),
keywords
=
[
'netdrive'
,],
scripts
=
[
'src/netreport.py'
],
author
=
'Nexedi'
,
author_email
=
'jondy.zhao@nexedi.com'
,
maintainer
=
'Jondy Zhao'
,
maintainer_email
=
'jondy.zhao@nexedi.com'
,
url
=
'http://'
,
platforms
=
'Platform Independent'
,
license
=
'License :: OSI Approved :: BSD License'
,
)
if
extensions
is
not
None
:
setup_args
[
"ext_modules"
]
=
extensions
setup
(
**
setup_args
)
if
__name__
==
'__main__'
:
main
()
windows/netreport/src/netuse.c
0 → 100644
View file @
6ccaa7f9
/*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include <Python.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/cygwin.h>
/* Avoid select function conflict in the winsock2.h */
#define __INSIDE_CYGWIN__
#include <windows.h>
#define MALLOC(x) HeapAlloc(GetProcessHeap(), 0, (x))
#define FREE(x) HeapFree(GetProcessHeap(), 0, (x))
static
PyObject
*
netuse_init
(
PyObject
*
self
,
PyObject
*
args
)
{
return
NULL
;
}
static
PyMethodDef
NetUseMethods
[]
=
{
{
"init"
,
netuse_init
,
METH_VARARGS
,
(
"init()
\n\n
"
"Initialize an inotify instance and return a PyCObject, When this
\n
"
"PyCObject is reclaimed, GC will free the memory.
\n
"
)
},
{
NULL
,
NULL
,
0
,
NULL
}
};
PyMODINIT_FUNC
netuse
(
void
)
{
PyObject
*
module
;
module
=
Py_InitModule3
(
"netuse"
,
NetUseMethods
,
"Show information about net resource in the Windows."
);
if
(
module
==
NULL
)
return
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment