Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(7)

Side by Side Diff: Modules/posixmodule.c

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Modules/_pickle.c ('k') | Modules/selectmodule.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* POSIX module implementation */ 2 /* POSIX module implementation */
3 3
4 /* This file is also used for Windows NT/MS-Win and OS/2. In that case the 4 /* This file is also used for Windows NT/MS-Win and OS/2. In that case the
5 module actually calls itself 'nt' or 'os2', not 'posix', and a few 5 module actually calls itself 'nt' or 'os2', not 'posix', and a few
6 functions are either unimplemented or implemented differently. The source 6 functions are either unimplemented or implemented differently. The source
7 assumes that for Windows NT, the macro 'MS_WINDOWS' is defined independent 7 assumes that for Windows NT, the macro 'MS_WINDOWS' is defined independent
8 of the compiler used. Different compilers define their own feature 8 of the compiler used. Different compilers define their own feature
9 test macro, e.g. '__BORLANDC__' or '_MSC_VER'. For OS/2, the compiler 9 test macro, e.g. '__BORLANDC__' or '_MSC_VER'. For OS/2, the compiler
10 independent macro PYOS_OS2 should be defined. On OS/2 the default 10 independent macro PYOS_OS2 should be defined. On OS/2 the default
(...skipping 7432 matching lines...) Expand 10 before | Expand all | Expand 10 after
7443 return NULL; 7443 return NULL;
7444 Py_BEGIN_ALLOW_THREADS 7444 Py_BEGIN_ALLOW_THREADS
7445 res = statvfs(path, &st); 7445 res = statvfs(path, &st);
7446 Py_END_ALLOW_THREADS 7446 Py_END_ALLOW_THREADS
7447 if (res != 0) 7447 if (res != 0)
7448 return posix_error_with_filename(path); 7448 return posix_error_with_filename(path);
7449 7449
7450 return _pystatvfs_fromstructstatvfs(st); 7450 return _pystatvfs_fromstructstatvfs(st);
7451 } 7451 }
7452 #endif /* HAVE_STATVFS */ 7452 #endif /* HAVE_STATVFS */
7453
7454 #ifdef MS_WINDOWS
7455 PyDoc_STRVAR(win32__getdiskusage__doc__,
7456 "_getdiskusage(path) -> (total, free)\n\n\
7457 Return disk usage statistics about the given path as (total, free) tuple.");
7458
7459 static PyObject *
7460 win32__getdiskusage(PyObject *self, PyObject *args)
7461 {
7462 BOOL retval;
7463 ULARGE_INTEGER _, total, free;
7464 LPCTSTR path;
7465
7466 if (! PyArg_ParseTuple(args, "s", &path))
7467 return NULL;
7468
7469 Py_BEGIN_ALLOW_THREADS
7470 retval = GetDiskFreeSpaceEx(path, &_, &total, &free);
7471 Py_END_ALLOW_THREADS
7472 if (retval == 0)
7473 return PyErr_SetFromWindowsErr(0);
7474
7475 return Py_BuildValue("(LL)", total.QuadPart, free.QuadPart);
7476 }
7477 #endif
7478
7479 7453
7480 /* This is used for fpathconf(), pathconf(), confstr() and sysconf(). 7454 /* This is used for fpathconf(), pathconf(), confstr() and sysconf().
7481 * It maps strings representing configuration variable names to 7455 * It maps strings representing configuration variable names to
7482 * integer values, allowing those functions to be called with the 7456 * integer values, allowing those functions to be called with the
7483 * magic names instead of polluting the module's namespace with tons of 7457 * magic names instead of polluting the module's namespace with tons of
7484 * rarely-used constants. There are three separate tables that use 7458 * rarely-used constants. There are three separate tables that use
7485 * these definitions. 7459 * these definitions.
7486 * 7460 *
7487 * This code is always included, even if none of the interfaces that 7461 * This code is always included, even if none of the interfaces that
7488 * need it are included. The #if hackery needed to avoid it would be 7462 * need it are included. The #if hackery needed to avoid it would be
(...skipping 2246 matching lines...) Expand 10 before | Expand all | Expand 10 after
9735 #endif 9709 #endif
9736 #ifdef HAVE_PATHCONF 9710 #ifdef HAVE_PATHCONF
9737 {"pathconf", posix_pathconf, METH_VARARGS, posix_pathconf__doc__}, 9711 {"pathconf", posix_pathconf, METH_VARARGS, posix_pathconf__doc__},
9738 #endif 9712 #endif
9739 {"abort", posix_abort, METH_NOARGS, posix_abort__doc__}, 9713 {"abort", posix_abort, METH_NOARGS, posix_abort__doc__},
9740 #ifdef MS_WINDOWS 9714 #ifdef MS_WINDOWS
9741 {"_getfullpathname", posix__getfullpathname, METH_VARARGS, NULL}, 9715 {"_getfullpathname", posix__getfullpathname, METH_VARARGS, NULL},
9742 {"_getfinalpathname", posix__getfinalpathname, METH_VARARGS, NULL}, 9716 {"_getfinalpathname", posix__getfinalpathname, METH_VARARGS, NULL},
9743 {"_getfileinformation", posix__getfileinformation, METH_VARARGS, NULL}, 9717 {"_getfileinformation", posix__getfileinformation, METH_VARARGS, NULL},
9744 {"_isdir", posix__isdir, METH_VARARGS, posix__isdir__doc__} , 9718 {"_isdir", posix__isdir, METH_VARARGS, posix__isdir__doc__} ,
9745 {"_getdiskusage", win32__getdiskusage, METH_VARARGS, win32__getdis kusage__doc__},
9746 #endif 9719 #endif
9747 #ifdef HAVE_GETLOADAVG 9720 #ifdef HAVE_GETLOADAVG
9748 {"getloadavg", posix_getloadavg, METH_NOARGS, posix_getloadavg__doc__}, 9721 {"getloadavg", posix_getloadavg, METH_NOARGS, posix_getloadavg__doc__},
9749 #endif 9722 #endif
9750 #ifdef MS_WINDOWS 9723 #ifdef MS_WINDOWS
9751 {"urandom", win32_urandom, METH_VARARGS, win32_urandom__doc__}, 9724 {"urandom", win32_urandom, METH_VARARGS, win32_urandom__doc__},
9752 #endif 9725 #endif
9753 #ifdef __VMS 9726 #ifdef __VMS
9754 {"urandom", vms_urandom, METH_VARARGS, vms_urandom__doc__}, 9727 {"urandom", vms_urandom, METH_VARARGS, vms_urandom__doc__},
9755 #endif 9728 #endif
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
10384 10357
10385 10358
10386 #endif /* __APPLE__ */ 10359 #endif /* __APPLE__ */
10387 return m; 10360 return m;
10388 10361
10389 } 10362 }
10390 10363
10391 #ifdef __cplusplus 10364 #ifdef __cplusplus
10392 } 10365 }
10393 #endif 10366 #endif
OLDNEW
« no previous file with comments | « Modules/_pickle.c ('k') | Modules/selectmodule.c » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+