Skip to content

Commit fff07bd

Browse files
committed
os: Implement dup().
1 parent e840da9 commit fff07bd

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

os/os/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def errno_(val=None):
3939
read_ = libc.func("i", "read", "ipi")
4040
write_ = libc.func("i", "write", "iPi")
4141
close_ = libc.func("i", "close", "i")
42+
dup_ = libc.func("i", "dup", "i")
4243
access_ = libc.func("i", "access", "si")
4344
fork_ = libc.func("i", "fork", "")
4445
pipe_ = libc.func("i", "pipe", "p")
@@ -184,6 +185,11 @@ def close(fd):
184185
check_error(r)
185186
return r
186187

188+
def dup(fd):
189+
r = dup_(fd)
190+
check_error(r)
191+
return r
192+
187193
def access(path, mode):
188194
return access_(path, mode) == 0
189195

0 commit comments

Comments
 (0)