Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
06a83e90
Commit
06a83e90
authored
Apr 14, 2002
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch #543447: Add posix.mknod.
parent
314fc79c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
60 additions
and
7 deletions
+60
-7
Doc/lib/libos.tex
Doc/lib/libos.tex
+11
-0
Misc/NEWS
Misc/NEWS
+2
-0
Modules/posixmodule.c
Modules/posixmodule.c
+40
-4
configure
configure
+3
-2
configure.in
configure.in
+1
-1
pyconfig.h.in
pyconfig.h.in
+3
-0
No files found.
Doc/lib/libos.tex
View file @
06a83e90
...
...
@@ -644,6 +644,17 @@ the client opens it for writing. Note that \function{mkfifo()}
doesn't open the FIFO --- it just creates the rendezvous point.
\end{funcdesc}
\begin{funcdesc}
{
mknod
}{
path
\optional
{
, mode=0600, major, minor
}}
Create a filesystem node (file, device special file or named pipe)
named filename. mode specifies both the permissions to use and the
type of node to be created, being combined (bitwise OR) with one of
S
_
IFREG, S
_
IFCHR, S
_
IFBLK, and S
_
IFIFO (those constants are available
in
\module
{
stat
}
). For S
_
IFCHR and S
_
IFBLK, major and minor define the
newly created device special file, otherwise they are ignored.
\versionadded
{
2.3
}
\end{funcdesc}
\begin{funcdesc}
{
mkdir
}{
path
\optional
{
, mode
}}
Create a directory named
\var
{
path
}
with numeric mode
\var
{
mode
}
.
The default
\var
{
mode
}
is
\code
{
0777
}
(octal). On some systems,
...
...
Misc/NEWS
View file @
06a83e90
...
...
@@ -56,6 +56,8 @@ Core and builtins
Extension modules
- posix.mknod was added.
- The locale module now exposes the C library's gettext interface.
- A security hole ("double free") was found in zlib-1.1.3, a popular
...
...
Modules/posixmodule.c
View file @
06a83e90
...
...
@@ -4582,19 +4582,52 @@ posix_pipe(PyObject *self, PyObject *args)
#ifdef HAVE_MKFIFO
static
char
posix_mkfifo__doc__
[]
=
"mkfifo(file, [, mode=0666]) -> None
\n
\
"mkfifo(file
name
, [, mode=0666]) -> None
\n
\
Create a FIFO (a POSIX named pipe)."
;
static
PyObject
*
posix_mkfifo
(
PyObject
*
self
,
PyObject
*
args
)
{
char
*
file
;
char
*
file
name
;
int
mode
=
0666
;
int
res
;
if
(
!
PyArg_ParseTuple
(
args
,
"s|i:mkfifo"
,
&
file
,
&
mode
))
if
(
!
PyArg_ParseTuple
(
args
,
"s|i:mkfifo"
,
&
file
name
,
&
mode
))
return
NULL
;
Py_BEGIN_ALLOW_THREADS
res
=
mkfifo
(
file
,
mode
);
res
=
mkfifo
(
filename
,
mode
);
Py_END_ALLOW_THREADS
if
(
res
<
0
)
return
posix_error
();
Py_INCREF
(
Py_None
);
return
Py_None
;
}
#endif
#ifdef HAVE_MKNOD
static
char
posix_mknod__doc__
[]
=
"mknod(filename, [, mode=0600, major, minor]) -> None
\n
\
Create a filesystem node (file, device special file or named pipe)
\n
\
named filename. mode specifies both the permissions to use and the
\n
\
type of node to be created, being combined (bitwise OR) with one of
\n
\
S_IFREG, S_IFCHR, S_IFBLK, and S_IFIFO. For S_IFCHR and S_IFBLK,
\n
\
major and minor define the newly created device special file, otherwise
\n
\
they are ignored."
;
static
PyObject
*
posix_mknod
(
PyObject
*
self
,
PyObject
*
args
)
{
char
*
filename
;
int
mode
=
0600
;
int
major
=
0
;
int
minor
=
0
;
int
res
;
if
(
!
PyArg_ParseTuple
(
args
,
"s|iii:mknod"
,
&
filename
,
&
mode
,
&
major
,
&
minor
))
return
NULL
;
Py_BEGIN_ALLOW_THREADS
res
=
mknod
(
filename
,
mode
,
makedev
(
major
,
minor
));
Py_END_ALLOW_THREADS
if
(
res
<
0
)
return
posix_error
();
...
...
@@ -6336,6 +6369,9 @@ static PyMethodDef posix_methods[] = {
#ifdef HAVE_MKFIFO
{
"mkfifo"
,
posix_mkfifo
,
METH_VARARGS
,
posix_mkfifo__doc__
},
#endif
#ifdef HAVE_MKNOD
{
"mknod"
,
posix_mknod
,
METH_VARARGS
,
posix_mknod__doc__
},
#endif
#ifdef HAVE_FTRUNCATE
{
"ftruncate"
,
posix_ftruncate
,
METH_VARARGS
,
posix_ftruncate__doc__
},
#endif
...
...
configure
View file @
06a83e90
#! /bin/sh
# From configure.in Revision: 1.30
6
.
# From configure.in Revision: 1.30
7
.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.53.
#
...
...
@@ -11243,12 +11243,13 @@ echo "${ECHO_T}MACHDEP_OBJS" >&6
for
ac_func
in
alarm
chown chroot
clock confstr ctermid ctermid_r execv
\
flock fork fsync fdatasync fpathconf ftime ftruncate
\
gai_strerror getgroups getlogin getpeername getpid getpwent getwd
\
hstrerror inet_pton
kill
killpg
link
lstat
mkfifo
mktime mremap
\
hstrerror inet_pton
kill
killpg
link
lstat
mkfifo mk
nod
mk
time mremap
\
nice
pathconf pause plock poll pthread_init
\
putenv
readlink
\
select
setegid seteuid setgid setgroups
\
...
...
configure.in
View file @
06a83e90
...
...
@@ -1568,7 +1568,7 @@ AC_MSG_RESULT(MACHDEP_OBJS)
AC_CHECK_FUNCS(alarm chown chroot clock confstr ctermid ctermid_r execv \
flock fork fsync fdatasync fpathconf ftime ftruncate \
gai_strerror getgroups getlogin getpeername getpid getpwent getwd \
hstrerror inet_pton kill killpg link lstat mkfifo mktime mremap \
hstrerror inet_pton kill killpg link lstat mkfifo mk
nod mk
time mremap \
nice pathconf pause plock poll pthread_init \
putenv readlink \
select setegid seteuid setgid setgroups \
...
...
pyconfig.h.in
View file @
06a83e90
...
...
@@ -260,6 +260,9 @@
/* Define to 1 if you have the `mkfifo' function. */
#undef HAVE_MKFIFO
/* Define to 1 if you have the `mknod' function. */
#undef HAVE_MKNOD
/* Define to 1 if you have the `mktime' function. */
#undef HAVE_MKTIME
...
...
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