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
3c0b79ca
Kaydet (Commit)
3c0b79ca
authored
Haz 11, 1996
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
A fcntl implementation for systems (like Solaris) without flock() call.
By Sjoerd.
üst
8c1529dc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
fcntlmodule.c
Modules/fcntlmodule.c
+27
-0
No files found.
Modules/fcntlmodule.c
Dosyayı görüntüle @
3c0b79ca
...
...
@@ -27,6 +27,8 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "allobjects.h"
#include "modsupport.h"
#include <fcntl.h>
/* fcntl(fd, opt, [arg]) */
...
...
@@ -144,7 +146,32 @@ fcntl_flock(self, args)
return
NULL
;
BGN_SAVE
#ifdef HAVE_FLOCK
ret
=
flock
(
fd
,
code
);
#else
#ifndef LOCK_SH
#define LOCK_SH 1
/* shared lock */
#define LOCK_EX 2
/* exclusive lock */
#define LOCK_NB 4
/* don't block when locking */
#define LOCK_UN 8
/* unlock */
#endif
{
struct
flock
l
;
if
(
code
==
LOCK_UN
)
l
.
l_type
=
F_UNLCK
;
else
if
(
code
&
LOCK_SH
)
l
.
l_type
=
F_RDLCK
;
else
if
(
code
&
LOCK_EX
)
l
.
l_type
=
F_WRLCK
;
else
{
err_setstr
(
ValueError
,
"unrecognized flock argument"
);
return
NULL
;
}
l
.
l_whence
=
l
.
l_start
=
l
.
l_len
=
0
;
ret
=
fcntl
(
fd
,
(
code
&
LOCK_NB
)
?
F_SETLK
:
F_SETLKW
,
&
l
);
}
#endif
/* HAVE_FLOCK */
END_SAVE
if
(
ret
<
0
)
{
err_errno
(
IOError
);
...
...
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