Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1340)

Side by Side Diff: ports/python-static/nacl.patch

Issue 907563002: Simplify cli_main (Closed) Base URL: https://chromium.googlesource.com/external/naclports.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 diff --git a/Include/datetime.h b/Include/datetime.h 1 diff --git a/Include/datetime.h b/Include/datetime.h
2 --- a/Include/datetime.h 2 --- a/Include/datetime.h
3 +++ b/Include/datetime.h 3 +++ b/Include/datetime.h
4 @@ -166,6 +166,8 @@ typedef struct { 4 @@ -166,6 +166,8 @@ typedef struct {
5 5
6 #ifdef Py_BUILD_CORE 6 #ifdef Py_BUILD_CORE
7 7
8 +#define PyDataTime_STATIC 1 8 +#define PyDataTime_STATIC 1
9 + 9 +
10 /* Macros for type checking when building the Python core. */ 10 /* Macros for type checking when building the Python core. */
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 +} 416 +}
417 +#define getpwuid my_getpwuid 417 +#define getpwuid my_getpwuid
418 +#endif 418 +#endif
419 + 419 +
420 PyDoc_STRVAR(pwd_getpwuid__doc__, 420 PyDoc_STRVAR(pwd_getpwuid__doc__,
421 "getpwuid(uid) -> (pw_name,pw_passwd,pw_uid,\n\ 421 "getpwuid(uid) -> (pw_name,pw_passwd,pw_uid,\n\
422 pw_gid,pw_gecos,pw_dir,pw_shell)\n\ 422 pw_gid,pw_gecos,pw_dir,pw_shell)\n\
423 diff --git a/Modules/python.c b/Modules/python.c 423 diff --git a/Modules/python.c b/Modules/python.c
424 --- a/Modules/python.c 424 --- a/Modules/python.c
425 +++ b/Modules/python.c 425 +++ b/Modules/python.c
426 @@ -6,6 +6,36 @@ 426 @@ -6,6 +6,20 @@
427 #include <floatingpoint.h> 427 #include <floatingpoint.h>
428 #endif 428 #endif
429 429
430 +#ifdef __native_client__ 430 +#ifdef __native_client__
431 +#define main nacl_main 431 +#define main nacl_main
432 +#include <stdio.h> 432 +#include <stdio.h>
433 +#include <sys/utsname.h> 433 +#include <sys/utsname.h>
434 + 434 +
435 +// Stubs for functions implemented through PPAPI.
436 +int spawnv(int mode, const char* path, char *const argv[]) {
437 + return 0;
438 +}
439 +
440 +int spawnve(int mode, const char* path,
441 + char *const argv[], char *const envp[]) {
442 + return 0;
443 +}
444 +
Sam Clegg 2015/02/13 18:35:18 So these are not longer needed because libnacl-spa
gdeepti 2015/02/13 21:43:56 Done.
gdeepti 2015/02/13 21:43:56 Good point, removed uname as well.
445 +// Dummy implementation of uname. This is only needed for the sel_ldr 435 +// Dummy implementation of uname. This is only needed for the sel_ldr
446 +// version of python. Otherwise it gets provided by nacl_io. 436 +// version of python. Otherwise it gets provided by nacl_io.
447 +int uname(struct utsname *buf) 437 +int uname(struct utsname *buf)
448 +{ 438 +{
449 + sprintf(buf->sysname, "NaCl"); 439 + sprintf(buf->sysname, "NaCl");
450 + return 0; 440 + return 0;
451 +} 441 +}
452 +#endif 442 +#endif
453 + 443 +
454 +// Dummy implementation of nacl_spawn_vfork_exit, otherwise provided
455 +// by nacl_spawn.
456 +void nacl_spawn_vfork_exit(int status) {
457 + _exit(status);
458 +}
459 +
460 int 444 int
461 main(int argc, char **argv) 445 main(int argc, char **argv)
462 { 446 {
463 @@ -20,5 +44,9 @@ main(int argc, char **argv) 447 @@ -20,5 +34,9 @@ main(int argc, char **argv)
464 m = fpgetmask(); 448 m = fpgetmask();
465 fpsetmask(m & ~FP_X_OFL); 449 fpsetmask(m & ~FP_X_OFL);
466 #endif 450 #endif
467 +#ifdef __native_client__ 451 +#ifdef __native_client__
468 + setvbuf(stdout, NULL, _IOLBF, 0); 452 + setvbuf(stdout, NULL, _IOLBF, 0);
469 + setvbuf(stdin, NULL, _IOLBF, 0); 453 + setvbuf(stdin, NULL, _IOLBF, 0);
470 +#endif 454 +#endif
471 return Py_Main(argc, argv); 455 return Py_Main(argc, argv);
472 } 456 }
473 diff --git a/Modules/timemodule.c b/Modules/timemodule.c 457 diff --git a/Modules/timemodule.c b/Modules/timemodule.c
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 OpenUNIX*|UnixWare*) 716 OpenUNIX*|UnixWare*)
733 @@ -2121,7 +2140,7 @@ then 717 @@ -2121,7 +2140,7 @@ then
734 LINKFORSHARED="-Wl,-E -Wl,+s";; 718 LINKFORSHARED="-Wl,-E -Wl,+s";;
735 # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";; 719 # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
736 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";; 720 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
737 - Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";; 721 - Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
738 + Linux*|GNU*|NaCl*) LINKFORSHARED="-Xlinker -export-dynamic";; 722 + Linux*|GNU*|NaCl*) LINKFORSHARED="-Xlinker -export-dynamic";;
739 # -u libsys_s pulls in all symbols in libsys 723 # -u libsys_s pulls in all symbols in libsys
740 Darwin/*) 724 Darwin/*)
741 # -u _PyMac_Error is needed to pull in the mac toolbox glue, 725 # -u _PyMac_Error is needed to pull in the mac toolbox glue,
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698