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
a94414a2
Kaydet (Commit)
a94414a2
authored
May 10, 2001
tarafından
Fred Drake
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Remove all remaining uses of the FCNTL module from the standard library.
üst
7c116d7a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
30 deletions
+29
-30
asyncore.py
Lib/asyncore.py
+3
-4
lockfile.py
Lib/lib-old/lockfile.py
+5
-5
posixfile.py
Lib/posixfile.py
+21
-21
No files found.
Lib/asyncore.py
Dosyayı görüntüle @
a94414a2
...
...
@@ -510,7 +510,6 @@ def close_all (map=None):
import
os
if
os
.
name
==
'posix'
:
import
fcntl
import
FCNTL
class
file_wrapper
:
# here we override just enough to make a file
...
...
@@ -538,9 +537,9 @@ if os.name == 'posix':
dispatcher
.
__init__
(
self
)
self
.
connected
=
1
# set it to non-blocking mode
flags
=
fcntl
.
fcntl
(
fd
,
FCNTL
.
F_GETFL
,
0
)
flags
=
flags
|
FCNTL
.
O_NONBLOCK
fcntl
.
fcntl
(
fd
,
FCNTL
.
F_SETFL
,
flags
)
flags
=
fcntl
.
fcntl
(
fd
,
fcntl
.
F_GETFL
,
0
)
flags
=
flags
|
os
.
O_NONBLOCK
fcntl
.
fcntl
(
fd
,
fcntl
.
F_SETFL
,
flags
)
self
.
set_file
(
fd
)
def
set_file
(
self
,
fd
):
...
...
Lib/lib-old/lockfile.py
Dosyayı görüntüle @
a94414a2
import
struct
,
fcntl
,
FCNTL
import
struct
,
fcntl
def
writelock
(
f
):
_lock
(
f
,
FCNTL
.
F_WRLCK
)
_lock
(
f
,
fcntl
.
F_WRLCK
)
def
readlock
(
f
):
_lock
(
f
,
FCNTL
.
F_RDLCK
)
_lock
(
f
,
fcntl
.
F_RDLCK
)
def
unlock
(
f
):
_lock
(
f
,
FCNTL
.
F_UNLCK
)
_lock
(
f
,
fcntl
.
F_UNLCK
)
def
_lock
(
f
,
op
):
dummy
=
fcntl
.
fcntl
(
f
.
fileno
(),
FCNTL
.
F_SETLKW
,
dummy
=
fcntl
.
fcntl
(
f
.
fileno
(),
fcntl
.
F_SETLKW
,
struct
.
pack
(
'2h8l'
,
op
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
))
Lib/posixfile.py
Dosyayı görüntüle @
a94414a2
...
...
@@ -107,7 +107,7 @@ class _posixfile_:
return
posix
.
fdopen
(
fd
,
self
.
_file_
.
mode
)
def
flags
(
self
,
*
which
):
import
fcntl
,
FCNTL
import
fcntl
if
which
:
if
len
(
which
)
>
1
:
...
...
@@ -116,44 +116,44 @@ class _posixfile_:
else
:
which
=
'?'
l_flags
=
0
if
'n'
in
which
:
l_flags
=
l_flags
|
FCNTL
.
O_NDELAY
if
'a'
in
which
:
l_flags
=
l_flags
|
FCNTL
.
O_APPEND
if
's'
in
which
:
l_flags
=
l_flags
|
FCNTL
.
O_SYNC
if
'n'
in
which
:
l_flags
=
l_flags
|
os
.
O_NDELAY
if
'a'
in
which
:
l_flags
=
l_flags
|
os
.
O_APPEND
if
's'
in
which
:
l_flags
=
l_flags
|
os
.
O_SYNC
file
=
self
.
_file_
if
'='
not
in
which
:
cur_fl
=
fcntl
.
fcntl
(
file
.
fileno
(),
FCNTL
.
F_GETFL
,
0
)
cur_fl
=
fcntl
.
fcntl
(
file
.
fileno
(),
fcntl
.
F_GETFL
,
0
)
if
'!'
in
which
:
l_flags
=
cur_fl
&
~
l_flags
else
:
l_flags
=
cur_fl
|
l_flags
l_flags
=
fcntl
.
fcntl
(
file
.
fileno
(),
FCNTL
.
F_SETFL
,
l_flags
)
l_flags
=
fcntl
.
fcntl
(
file
.
fileno
(),
fcntl
.
F_SETFL
,
l_flags
)
if
'c'
in
which
:
arg
=
(
'!'
not
in
which
)
# 0 is don't, 1 is do close on exec
l_flags
=
fcntl
.
fcntl
(
file
.
fileno
(),
FCNTL
.
F_SETFD
,
arg
)
l_flags
=
fcntl
.
fcntl
(
file
.
fileno
(),
fcntl
.
F_SETFD
,
arg
)
if
'?'
in
which
:
which
=
''
# Return current flags
l_flags
=
fcntl
.
fcntl
(
file
.
fileno
(),
FCNTL
.
F_GETFL
,
0
)
if
FCNTL
.
O_APPEND
&
l_flags
:
which
=
which
+
'a'
if
fcntl
.
fcntl
(
file
.
fileno
(),
FCNTL
.
F_GETFD
,
0
)
&
1
:
l_flags
=
fcntl
.
fcntl
(
file
.
fileno
(),
fcntl
.
F_GETFL
,
0
)
if
os
.
O_APPEND
&
l_flags
:
which
=
which
+
'a'
if
fcntl
.
fcntl
(
file
.
fileno
(),
fcntl
.
F_GETFD
,
0
)
&
1
:
which
=
which
+
'c'
if
FCNTL
.
O_NDELAY
&
l_flags
:
which
=
which
+
'n'
if
FCNTL
.
O_SYNC
&
l_flags
:
which
=
which
+
's'
if
os
.
O_NDELAY
&
l_flags
:
which
=
which
+
'n'
if
os
.
O_SYNC
&
l_flags
:
which
=
which
+
's'
return
which
def
lock
(
self
,
how
,
*
args
):
import
struct
,
fcntl
,
FCNTL
import
struct
,
fcntl
if
'w'
in
how
:
l_type
=
FCNTL
.
F_WRLCK
elif
'r'
in
how
:
l_type
=
FCNTL
.
F_RDLCK
elif
'u'
in
how
:
l_type
=
FCNTL
.
F_UNLCK
if
'w'
in
how
:
l_type
=
fcntl
.
F_WRLCK
elif
'r'
in
how
:
l_type
=
fcntl
.
F_RDLCK
elif
'u'
in
how
:
l_type
=
fcntl
.
F_UNLCK
else
:
raise
TypeError
,
'no type of lock specified'
if
'|'
in
how
:
cmd
=
FCNTL
.
F_SETLKW
elif
'?'
in
how
:
cmd
=
FCNTL
.
F_GETLK
else
:
cmd
=
FCNTL
.
F_SETLK
if
'|'
in
how
:
cmd
=
fcntl
.
F_SETLKW
elif
'?'
in
how
:
cmd
=
fcntl
.
F_GETLK
else
:
cmd
=
fcntl
.
F_SETLK
l_whence
=
0
l_start
=
0
...
...
@@ -203,8 +203,8 @@ class _posixfile_:
l_type
,
l_whence
,
l_start
,
l_len
,
l_sysid
,
l_pid
=
\
struct
.
unpack
(
'hhllhh'
,
flock
)
if
l_type
!=
FCNTL
.
F_UNLCK
:
if
l_type
==
FCNTL
.
F_RDLCK
:
if
l_type
!=
fcntl
.
F_UNLCK
:
if
l_type
==
fcntl
.
F_RDLCK
:
return
'r'
,
l_len
,
l_start
,
l_whence
,
l_pid
else
:
return
'w'
,
l_len
,
l_start
,
l_whence
,
l_pid
...
...
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