Projects
Browse Source     Search     Timeline     Wiki

Changeset 23443

Show
Ignore:
Timestamp:
10/23/07 08:40:55 (14 months ago)
Author:
zarzycki@…
Message:

Short circuit MIG replies when forwarding queries.

Location:
trunk/launchd/src
Files:
1 added
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/launchd/src/Makefile.am

    r23408 r23443  
    4949launchd_CFLAGS = -mdynamic-no-pic $(AM_CFLAGS) -Wno-unused-parameter 
    5050launchd_LDFLAGS = -lbsm 
    51 launchd_SOURCES = launchd.c launchd_core_logic.c launchd_unix_ipc.c protocol_vprocServer.c notifyServer.c launchd_internalUser.c launchd_internalServer.c job_replyUser.c launchd_runtime.c launchd_runtime_kill.c 
     51launchd_SOURCES = launchd.c launchd_core_logic.c launchd_unix_ipc.c protocol_vprocServer.c notifyServer.c launchd_internalUser.c launchd_internalServer.c job_replyUser.c launchd_runtime.c launchd_runtime_kill.c job_forwardUser.c 
    5252 
    5353launchd_runtime.c:: notifyServer.h launchd_internal.h 
    54 launchd_core_logic.c:: protocol_vproc.h job_reply.h protocol_vprocServer.h 
     54launchd_core_logic.c:: protocol_vproc.h job_reply.h protocol_vprocServer.h job_forward.h 
    5555 
    5656launchproxy_LDFLAGS = -weak_framework Security 
     57 
     58job_forwardUser.c job_forward.h: $(srcdir)/protocol_job_forward.defs 
     59        mig $(MIGFLAGS) -sheader /dev/null -server /dev/null $(srcdir)/protocol_job_forward.defs 
    5760 
    5861notifyServer.c notifyServer.h: /usr/include/mach/notify.defs 
  • trunk/launchd/src/Makefile.in

    r23408 r23443  
    9797        launchd_unix_ipc.c protocol_vprocServer.c notifyServer.c \ 
    9898        launchd_internalUser.c launchd_internalServer.c \ 
    99         job_replyUser.c launchd_runtime.c launchd_runtime_kill.c 
     99        job_replyUser.c launchd_runtime.c launchd_runtime_kill.c \ 
     100        job_forwardUser.c 
    100101@LIBS_ONLY_FALSE@am_launchd_OBJECTS = launchd-launchd.$(OBJEXT) \ 
    101102@LIBS_ONLY_FALSE@       launchd-launchd_core_logic.$(OBJEXT) \ 
     
    107108@LIBS_ONLY_FALSE@       launchd-job_replyUser.$(OBJEXT) \ 
    108109@LIBS_ONLY_FALSE@       launchd-launchd_runtime.$(OBJEXT) \ 
    109 @LIBS_ONLY_FALSE@       launchd-launchd_runtime_kill.$(OBJEXT) 
     110@LIBS_ONLY_FALSE@       launchd-launchd_runtime_kill.$(OBJEXT) \ 
     111@LIBS_ONLY_FALSE@       launchd-job_forwardUser.$(OBJEXT) 
    110112launchd_OBJECTS = $(am_launchd_OBJECTS) 
    111113launchd_LDADD = $(LDADD) 
     
    254256@LIBS_ONLY_FALSE@launchd_CFLAGS = -mdynamic-no-pic $(AM_CFLAGS) -Wno-unused-parameter 
    255257@LIBS_ONLY_FALSE@launchd_LDFLAGS = -lbsm 
    256 @LIBS_ONLY_FALSE@launchd_SOURCES = launchd.c launchd_core_logic.c launchd_unix_ipc.c protocol_vprocServer.c notifyServer.c launchd_internalUser.c launchd_internalServer.c job_replyUser.c launchd_runtime.c launchd_runtime_kill.c 
     258@LIBS_ONLY_FALSE@launchd_SOURCES = launchd.c launchd_core_logic.c launchd_unix_ipc.c protocol_vprocServer.c notifyServer.c launchd_internalUser.c launchd_internalServer.c job_replyUser.c launchd_runtime.c launchd_runtime_kill.c job_forwardUser.c 
    257259@LIBS_ONLY_FALSE@launchproxy_LDFLAGS = -weak_framework Security 
    258260@LIBS_ONLY_FALSE@man1_MANS = wait4path.1 launchctl.1 
     
    416418@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SystemStarter-SystemStarter.Po@am__quote@ 
    417419@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/launchctl-launchctl.Po@am__quote@ 
     420@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/launchd-job_forwardUser.Po@am__quote@ 
    418421@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/launchd-job_replyUser.Po@am__quote@ 
    419422@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/launchd-launchd.Po@am__quote@ 
     
    788791@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 
    789792@am__fastdepCC_FALSE@   $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(launchd_CFLAGS) $(CFLAGS) -c -o launchd-launchd_runtime_kill.obj `if test -f 'launchd_runtime_kill.c'; then $(CYGPATH_W) 'launchd_runtime_kill.c'; else $(CYGPATH_W) '$(srcdir)/launchd_runtime_kill.c'; fi` 
     793 
     794launchd-job_forwardUser.o: job_forwardUser.c 
     795@am__fastdepCC_TRUE@    $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(launchd_CFLAGS) $(CFLAGS) -MT launchd-job_forwardUser.o -MD -MP -MF $(DEPDIR)/launchd-job_forwardUser.Tpo -c -o launchd-job_forwardUser.o `test -f 'job_forwardUser.c' || echo '$(srcdir)/'`job_forwardUser.c 
     796@am__fastdepCC_TRUE@    mv -f $(DEPDIR)/launchd-job_forwardUser.Tpo $(DEPDIR)/launchd-job_forwardUser.Po 
     797@AMDEP_TRUE@@am__fastdepCC_FALSE@       source='job_forwardUser.c' object='launchd-job_forwardUser.o' libtool=no @AMDEPBACKSLASH@ 
     798@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 
     799@am__fastdepCC_FALSE@   $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(launchd_CFLAGS) $(CFLAGS) -c -o launchd-job_forwardUser.o `test -f 'job_forwardUser.c' || echo '$(srcdir)/'`job_forwardUser.c 
     800 
     801launchd-job_forwardUser.obj: job_forwardUser.c 
     802@am__fastdepCC_TRUE@    $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(launchd_CFLAGS) $(CFLAGS) -MT launchd-job_forwardUser.obj -MD -MP -MF $(DEPDIR)/launchd-job_forwardUser.Tpo -c -o launchd-job_forwardUser.obj `if test -f 'job_forwardUser.c'; then $(CYGPATH_W) 'job_forwardUser.c'; else $(CYGPATH_W) '$(srcdir)/job_forwardUser.c'; fi` 
     803@am__fastdepCC_TRUE@    mv -f $(DEPDIR)/launchd-job_forwardUser.Tpo $(DEPDIR)/launchd-job_forwardUser.Po 
     804@AMDEP_TRUE@@am__fastdepCC_FALSE@       source='job_forwardUser.c' object='launchd-job_forwardUser.obj' libtool=no @AMDEPBACKSLASH@ 
     805@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 
     806@am__fastdepCC_FALSE@   $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(launchd_CFLAGS) $(CFLAGS) -c -o launchd-job_forwardUser.obj `if test -f 'job_forwardUser.c'; then $(CYGPATH_W) 'job_forwardUser.c'; else $(CYGPATH_W) '$(srcdir)/job_forwardUser.c'; fi` 
    790807install-man1: $(man1_MANS) $(man_MANS) 
    791808        @$(NORMAL_INSTALL) 
     
    11501167 
    11511168@LIBS_ONLY_FALSE@launchd_runtime.c:: notifyServer.h launchd_internal.h 
    1152 @LIBS_ONLY_FALSE@launchd_core_logic.c:: protocol_vproc.h job_reply.h protocol_vprocServer.h 
     1169@LIBS_ONLY_FALSE@launchd_core_logic.c:: protocol_vproc.h job_reply.h protocol_vprocServer.h job_forward.h 
     1170 
     1171@LIBS_ONLY_FALSE@job_forwardUser.c job_forward.h: $(srcdir)/protocol_job_forward.defs 
     1172@LIBS_ONLY_FALSE@       mig $(MIGFLAGS) -sheader /dev/null -server /dev/null $(srcdir)/protocol_job_forward.defs 
    11531173 
    11541174@LIBS_ONLY_FALSE@notifyServer.c notifyServer.h: /usr/include/mach/notify.defs 
  • trunk/launchd/src/launchd_core_logic.c

    r23439 r23443  
    9292#include "protocol_vprocServer.h" 
    9393#include "job_reply.h" 
     94#include "job_forward.h" 
    9495 
    9596#define LAUNCHD_MIN_JOB_RUN_TIME 10 
     
    57425743 
    57435744kern_return_t 
    5744 job_mig_look_up2(job_t j, name_t servicename, mach_port_t *serviceportp, mach_msg_type_name_t *ptype, pid_t target_pid, uint64_t flags) 
     5745job_mig_look_up2(job_t j, mach_port_t srp, name_t servicename, mach_port_t *serviceportp, pid_t target_pid, uint64_t flags) 
    57455746{ 
    57465747        struct machservice *ms; 
     
    57895790#endif 
    57905791                *serviceportp = machservice_port(ms); 
    5791                 *ptype = MACH_MSG_TYPE_COPY_SEND; 
    57925792                kr = BOOTSTRAP_SUCCESS; 
    57935793        } else if (!(flags & BOOTSTRAP_PER_PID_SERVICE) && (inherited_bootstrap_port != MACH_PORT_NULL)) { 
    57945794                job_log(j, LOG_DEBUG, "Mach service lookup forwarded: %s", servicename); 
    5795                 *ptype = MACH_MSG_TYPE_MOVE_SEND; 
    5796                 kr = bootstrap_look_up(inherited_bootstrap_port, servicename, serviceportp); 
     5795                job_assumes(j, vproc_mig_look_up2_forward(inherited_bootstrap_port, srp, servicename, 0, 0) == 0); 
     5796                /* The previous routine moved the reply port, we're forced to return MIG_NO_REPLY now */ 
     5797                return MIG_NO_REPLY; 
    57975798        } else if (getpid() == 1 && j->anonymous && ldc.euid >= 500 && strcasecmp(job_get_bs(j)->name, VPROCMGR_SESSION_LOGINWINDOW) == 0) { 
    57985799                /* 
     
    58125813 
    58135814kern_return_t 
    5814 job_mig_parent(job_t j, mach_port_t *parentport, mach_msg_type_name_t *pptype) 
     5815job_mig_parent(job_t j, mach_port_t srp, mach_port_t *parentport) 
    58155816{ 
    58165817        if (!launchd_assumes(j != NULL)) { 
     
    58205821        job_log(j, LOG_DEBUG, "Requested parent bootstrap port"); 
    58215822        jobmgr_t jm = j->mgr; 
    5822  
    5823         *pptype = MACH_MSG_TYPE_MAKE_SEND; 
    58245823 
    58255824        if (jobmgr_parent(jm)) { 
     
    58285827                *parentport = jm->jm_port; 
    58295828        } else { 
    5830                 *pptype = MACH_MSG_TYPE_COPY_SEND; 
    5831                 *parentport = inherited_bootstrap_port; 
     5829                job_assumes(j, vproc_mig_parent_forward(inherited_bootstrap_port, srp) == 0); 
     5830                /* The previous routine moved the reply port, we're forced to return MIG_NO_REPLY now */ 
     5831                return MIG_NO_REPLY; 
    58325832        } 
    58335833        return BOOTSTRAP_SUCCESS; 
  • trunk/launchd/src/protocol_job.defs

    r23343 r23443  
    6464routine look_up2( 
    6565                __bs_port       : job_t; 
     66        sreplyport      __rport : mach_port_make_send_once_t; 
    6667                __service_name  : name_t; 
    67         out     __service_port  : mach_port_send_t; 
     68        out     __service_port  : mach_port_t; 
    6869                __target_pid    : pid_t; 
    6970                __flags         : uint64_t); 
     
    7778routine parent( 
    7879                __bs_port       : job_t; 
    79         out     __parent_port   : mach_port_send_t); 
     80        sreplyport      __rport : mach_port_make_send_once_t; 
     81        out     __parent_port   : mach_port_make_send_t); 
    8082 
    8183routine post_fork_ping(