Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
c5fce4de
Kaydet (Commit)
c5fce4de
authored
Agu 02, 2011
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
check individually for some for sched_ functions
üst
28da7b8b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
4 deletions
+43
-4
test_posix.py
Lib/test/test_posix.py
+2
-2
posixmodule.c
Modules/posixmodule.c
+30
-0
configure
configure
+1
-1
configure.in
configure.in
+1
-1
pyconfig.h.in
pyconfig.h.in
+9
-0
No files found.
Lib/test/test_posix.py
Dosyayı görüntüle @
c5fce4de
...
@@ -851,7 +851,7 @@ class PosixTester(unittest.TestCase):
...
@@ -851,7 +851,7 @@ class PosixTester(unittest.TestCase):
self
.
assertRaises
(
OSError
,
posix
.
sched_get_priority_min
,
-
23
)
self
.
assertRaises
(
OSError
,
posix
.
sched_get_priority_min
,
-
23
)
self
.
assertRaises
(
OSError
,
posix
.
sched_get_priority_max
,
-
23
)
self
.
assertRaises
(
OSError
,
posix
.
sched_get_priority_max
,
-
23
)
@
requires_sched_h
@
unittest.skipUnless
(
hasattr
(
posix
,
'sched_setscheduler'
),
"can't change scheduler"
)
def
test_get_and_set_scheduler_and_param
(
self
):
def
test_get_and_set_scheduler_and_param
(
self
):
possible_schedulers
=
[
sched
for
name
,
sched
in
posix
.
__dict__
.
items
()
possible_schedulers
=
[
sched
for
name
,
sched
in
posix
.
__dict__
.
items
()
if
name
.
startswith
(
"SCHED_"
)]
if
name
.
startswith
(
"SCHED_"
)]
...
@@ -882,7 +882,7 @@ class PosixTester(unittest.TestCase):
...
@@ -882,7 +882,7 @@ class PosixTester(unittest.TestCase):
param
=
posix
.
sched_param
(
sched_priority
=-
large
)
param
=
posix
.
sched_param
(
sched_priority
=-
large
)
self
.
assertRaises
(
OverflowError
,
posix
.
sched_setparam
,
0
,
param
)
self
.
assertRaises
(
OverflowError
,
posix
.
sched_setparam
,
0
,
param
)
@
requires_sched_h
@
unittest.skipUnless
(
hasattr
(
posix
,
"sched_rr_get_interval"
),
"no function"
)
def
test_sched_rr_get_interval
(
self
):
def
test_sched_rr_get_interval
(
self
):
interval
=
posix
.
sched_rr_get_interval
(
0
)
interval
=
posix
.
sched_rr_get_interval
(
0
)
self
.
assertIsInstance
(
interval
,
float
)
self
.
assertIsInstance
(
interval
,
float
)
...
...
Modules/posixmodule.c
Dosyayı görüntüle @
c5fce4de
...
@@ -4585,6 +4585,8 @@ posix_sched_get_priority_min(PyObject *self, PyObject *args)
...
@@ -4585,6 +4585,8 @@ posix_sched_get_priority_min(PyObject *self, PyObject *args)
return
PyLong_FromLong
(
min
);
return
PyLong_FromLong
(
min
);
}
}
#ifdef HAVE_SCHED_SETSCHEDULER
PyDoc_STRVAR
(
posix_sched_getscheduler__doc__
,
PyDoc_STRVAR
(
posix_sched_getscheduler__doc__
,
"sched_getscheduler(pid)
\n\n
\
"sched_getscheduler(pid)
\n\n
\
Get the scheduling policy for the process with a PID of *pid*.
\n
\
Get the scheduling policy for the process with a PID of *pid*.
\n
\
...
@@ -4604,6 +4606,10 @@ posix_sched_getscheduler(PyObject *self, PyObject *args)
...
@@ -4604,6 +4606,10 @@ posix_sched_getscheduler(PyObject *self, PyObject *args)
return
PyLong_FromLong
(
policy
);
return
PyLong_FromLong
(
policy
);
}
}
#endif
#if defined(HAVE_SCHED_SETSCHEDULER) || defined(HAVE_SCHED_SETPARAM)
static
PyObject
*
static
PyObject
*
sched_param_new
(
PyTypeObject
*
type
,
PyObject
*
args
,
PyObject
*
kwargs
)
sched_param_new
(
PyTypeObject
*
type
,
PyObject
*
args
,
PyObject
*
kwargs
)
{
{
...
@@ -4656,6 +4662,10 @@ convert_sched_param(PyObject *param, struct sched_param *res)
...
@@ -4656,6 +4662,10 @@ convert_sched_param(PyObject *param, struct sched_param *res)
return
1
;
return
1
;
}
}
#endif
#ifdef HAVE_SCHED_SETSCHEDULER
PyDoc_STRVAR
(
posix_sched_setscheduler__doc__
,
PyDoc_STRVAR
(
posix_sched_setscheduler__doc__
,
"sched_setscheduler(pid, policy, param)
\n\n
\
"sched_setscheduler(pid, policy, param)
\n\n
\
Set the scheduling policy, *policy*, for *pid*.
\n
\
Set the scheduling policy, *policy*, for *pid*.
\n
\
...
@@ -4677,6 +4687,10 @@ posix_sched_setscheduler(PyObject *self, PyObject *args)
...
@@ -4677,6 +4687,10 @@ posix_sched_setscheduler(PyObject *self, PyObject *args)
Py_RETURN_NONE
;
Py_RETURN_NONE
;
}
}
#endif
#ifdef HAVE_SCHED_SETPARAM
PyDoc_STRVAR
(
posix_sched_getparam__doc__
,
PyDoc_STRVAR
(
posix_sched_getparam__doc__
,
"sched_getparam(pid) -> sched_param
\n\n
\
"sched_getparam(pid) -> sched_param
\n\n
\
Returns scheduling parameters for the process with *pid* as an instance of the
\n
\
Returns scheduling parameters for the process with *pid* as an instance of the
\n
\
...
@@ -4724,6 +4738,10 @@ posix_sched_setparam(PyObject *self, PyObject *args)
...
@@ -4724,6 +4738,10 @@ posix_sched_setparam(PyObject *self, PyObject *args)
Py_RETURN_NONE
;
Py_RETURN_NONE
;
}
}
#endif
#ifdef HAVE_SCHED_RR_GET_INTERVAL
PyDoc_STRVAR
(
posix_sched_rr_get_interval__doc__
,
PyDoc_STRVAR
(
posix_sched_rr_get_interval__doc__
,
"sched_rr_get_interval(pid) -> float
\n\n
\
"sched_rr_get_interval(pid) -> float
\n\n
\
Return the round-robin quantum for the process with PID *pid* in seconds."
);
Return the round-robin quantum for the process with PID *pid* in seconds."
);
...
@@ -4741,6 +4759,8 @@ posix_sched_rr_get_interval(PyObject *self, PyObject *args)
...
@@ -4741,6 +4759,8 @@ posix_sched_rr_get_interval(PyObject *self, PyObject *args)
return
PyFloat_FromDouble
((
double
)
interval
.
tv_sec
+
1e-9
*
interval
.
tv_nsec
);
return
PyFloat_FromDouble
((
double
)
interval
.
tv_sec
+
1e-9
*
interval
.
tv_nsec
);
}
}
#endif
PyDoc_STRVAR
(
posix_sched_yield__doc__
,
PyDoc_STRVAR
(
posix_sched_yield__doc__
,
"sched_yield()
\n\n
\
"sched_yield()
\n\n
\
Voluntarily relinquish the CPU."
);
Voluntarily relinquish the CPU."
);
...
@@ -10054,11 +10074,21 @@ static PyMethodDef posix_methods[] = {
...
@@ -10054,11 +10074,21 @@ static PyMethodDef posix_methods[] = {
#ifdef HAVE_SCHED_H
#ifdef HAVE_SCHED_H
{
"sched_get_priority_max"
,
posix_sched_get_priority_max
,
METH_VARARGS
,
posix_sched_get_priority_max__doc__
},
{
"sched_get_priority_max"
,
posix_sched_get_priority_max
,
METH_VARARGS
,
posix_sched_get_priority_max__doc__
},
{
"sched_get_priority_min"
,
posix_sched_get_priority_min
,
METH_VARARGS
,
posix_sched_get_priority_min__doc__
},
{
"sched_get_priority_min"
,
posix_sched_get_priority_min
,
METH_VARARGS
,
posix_sched_get_priority_min__doc__
},
#ifdef HAVE_SCHED_SETPARAM
{
"sched_getparam"
,
posix_sched_getparam
,
METH_VARARGS
,
posix_sched_getparam__doc__
},
{
"sched_getparam"
,
posix_sched_getparam
,
METH_VARARGS
,
posix_sched_getparam__doc__
},
#endif
#ifdef HAVE_SCHED_SETSCHEDULER
{
"sched_getscheduler"
,
posix_sched_getscheduler
,
METH_VARARGS
,
posix_sched_getscheduler__doc__
},
{
"sched_getscheduler"
,
posix_sched_getscheduler
,
METH_VARARGS
,
posix_sched_getscheduler__doc__
},
#endif
#ifdef HAVE_SCHED_RR_GET_INTERVAL
{
"sched_rr_get_interval"
,
posix_sched_rr_get_interval
,
METH_VARARGS
,
posix_sched_rr_get_interval__doc__
},
{
"sched_rr_get_interval"
,
posix_sched_rr_get_interval
,
METH_VARARGS
,
posix_sched_rr_get_interval__doc__
},
#endif
#ifdef HAVE_SCHED_SETPARAM
{
"sched_setparam"
,
posix_sched_setparam
,
METH_VARARGS
,
posix_sched_setparam__doc__
},
{
"sched_setparam"
,
posix_sched_setparam
,
METH_VARARGS
,
posix_sched_setparam__doc__
},
#endif
#ifdef HAVE_SCHED_SETSCHEDULER
{
"sched_setscheduler"
,
posix_sched_setscheduler
,
METH_VARARGS
,
posix_sched_setscheduler__doc__
},
{
"sched_setscheduler"
,
posix_sched_setscheduler
,
METH_VARARGS
,
posix_sched_setscheduler__doc__
},
#endif
{
"sched_yield"
,
posix_sched_yield
,
METH_NOARGS
,
posix_sched_yield__doc__
},
{
"sched_yield"
,
posix_sched_yield
,
METH_NOARGS
,
posix_sched_yield__doc__
},
#ifdef HAVE_SCHED_SETAFFINITY
#ifdef HAVE_SCHED_SETAFFINITY
{
"sched_setaffinity"
,
posix_sched_setaffinity
,
METH_VARARGS
,
posix_sched_setaffinity__doc__
},
{
"sched_setaffinity"
,
posix_sched_setaffinity
,
METH_VARARGS
,
posix_sched_setaffinity__doc__
},
...
...
configure
Dosyayı görüntüle @
c5fce4de
...
@@ -9339,7 +9339,7 @@ for ac_func in alarm accept4 setitimer getitimer bind_textdomain_codeset chown \
...
@@ -9339,7 +9339,7 @@ for ac_func in alarm accept4 setitimer getitimer bind_textdomain_codeset chown \
select
sem_open sem_timedwait sem_getvalue sem_unlink sendfile setegid seteuid
\
select
sem_open sem_timedwait sem_getvalue sem_unlink sendfile setegid seteuid
\
setgid sethostname
\
setgid sethostname
\
setlocale setregid setreuid setresuid setresgid setsid setpgid setpgrp setpriority setuid setvbuf
\
setlocale setregid setreuid setresuid setresgid setsid setpgid setpgrp setpriority setuid setvbuf
\
sched_setaffinity
\
sched_setaffinity
sched_setscheduler sched_setparam sched_rr_get_interval
\
sigaction sigaltstack siginterrupt sigpending sigrelse
\
sigaction sigaltstack siginterrupt sigpending sigrelse
\
sigtimedwait sigwait sigwaitinfo snprintf strftime strlcpy symlinkat
sync
\
sigtimedwait sigwait sigwaitinfo snprintf strftime strlcpy symlinkat
sync
\
sysconf tcgetpgrp tcsetpgrp tempnam timegm
times
tmpfile tmpnam tmpnam_r
\
sysconf tcgetpgrp tcsetpgrp tempnam timegm
times
tmpfile tmpnam tmpnam_r
\
...
...
configure.in
Dosyayı görüntüle @
c5fce4de
...
@@ -2537,7 +2537,7 @@ AC_CHECK_FUNCS(alarm accept4 setitimer getitimer bind_textdomain_codeset chown \
...
@@ -2537,7 +2537,7 @@ AC_CHECK_FUNCS(alarm accept4 setitimer getitimer bind_textdomain_codeset chown \
select sem_open sem_timedwait sem_getvalue sem_unlink sendfile setegid seteuid \
select sem_open sem_timedwait sem_getvalue sem_unlink sendfile setegid seteuid \
setgid sethostname \
setgid sethostname \
setlocale setregid setreuid setresuid setresgid setsid setpgid setpgrp setpriority setuid setvbuf \
setlocale setregid setreuid setresuid setresgid setsid setpgid setpgrp setpriority setuid setvbuf \
sched_setaffinity \
sched_setaffinity
sched_setscheduler sched_setparam sched_rr_get_interval
\
sigaction sigaltstack siginterrupt sigpending sigrelse \
sigaction sigaltstack siginterrupt sigpending sigrelse \
sigtimedwait sigwait sigwaitinfo snprintf strftime strlcpy symlinkat sync \
sigtimedwait sigwait sigwaitinfo snprintf strftime strlcpy symlinkat sync \
sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
...
...
pyconfig.h.in
Dosyayı görüntüle @
c5fce4de
...
@@ -653,9 +653,18 @@
...
@@ -653,9 +653,18 @@
/* Define to 1 if you have the <sched.h> header file. */
/* Define to 1 if you have the <sched.h> header file. */
#undef HAVE_SCHED_H
#undef HAVE_SCHED_H
/* Define to 1 if you have the `sched_rr_get_interval' function. */
#undef HAVE_SCHED_RR_GET_INTERVAL
/* Define to 1 if you have the `sched_setaffinity' function. */
/* Define to 1 if you have the `sched_setaffinity' function. */
#undef HAVE_SCHED_SETAFFINITY
#undef HAVE_SCHED_SETAFFINITY
/* Define to 1 if you have the `sched_setparam' function. */
#undef HAVE_SCHED_SETPARAM
/* Define to 1 if you have the `sched_setscheduler' function. */
#undef HAVE_SCHED_SETSCHEDULER
/* Define to 1 if you have the `select' function. */
/* Define to 1 if you have the `select' function. */
#undef HAVE_SELECT
#undef HAVE_SELECT
...
...
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