Changeset 23479
- Timestamp:
- 01/09/08 14:18:09 (11 months ago)
- Location:
- trunk/launchd/src
- Files:
-
- 9 modified
-
Makefile.am (modified) (2 diffs)
-
Makefile.in (modified) (2 diffs)
-
launchd.c (modified) (6 diffs)
-
launchd.h (modified) (1 diff)
-
launchd_core_logic.c (modified) (27 diffs)
-
launchd_core_logic.h (modified) (2 diffs)
-
launchd_runtime.c (modified) (38 diffs)
-
launchd_runtime.h (modified) (4 diffs)
-
launchd_unix_ipc.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/launchd/src/Makefile.am
r23463 r23479 1 AM_CFLAGS = -F/System/Library/PrivateFrameworks -Wall -Wextra -Waggregate-return -Wfloat-equal -Wshadow -Wpacked -Wpadded -Wstrict-overflow=4 -Wmissing-prototypes -Wmissing-declarations -Werror -D__MigTypeCheck=1 -fvisibility=hidden - freorder-blocks -Dmig_external=__private_extern__1 AM_CFLAGS = -F/System/Library/PrivateFrameworks -Wall -Wextra -Waggregate-return -Wfloat-equal -Wshadow -Wpacked -Wpadded -Wstrict-overflow=4 -Wmissing-prototypes -Wmissing-declarations -Werror -D__MigTypeCheck=1 -fvisibility=hidden -Dmig_external=__private_extern__ 2 2 3 3 CLEANFILES = protocol_vproc.h protocol_vprocServer.c protocol_vprocUser.c protocol_vprocServer.h \ … … 47 47 SystemStarter_SOURCES = StartupItems.c IPC.c SystemStarter.c 48 48 49 launchd_CFLAGS = -mdynamic-no-pic $(AM_CFLAGS) # -Wconversion # -Wstrict-aliasing=2 -fstrict-aliasing49 launchd_CFLAGS = -mdynamic-no-pic $(AM_CFLAGS) -freorder-blocks # -fomit-frame-pointer # -Wconversion # -Wstrict-aliasing=2 -fstrict-aliasing 50 50 launchd_LDFLAGS = -lbsm 51 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 job_forwardUser.c mach_excServer.c -
trunk/launchd/src/Makefile.in
r23463 r23479 239 239 top_builddir = @top_builddir@ 240 240 top_srcdir = @top_srcdir@ 241 AM_CFLAGS = -F/System/Library/PrivateFrameworks -Wall -Wextra -Waggregate-return -Wfloat-equal -Wshadow -Wpacked -Wpadded -Wstrict-overflow=4 -Wmissing-prototypes -Wmissing-declarations -Werror -D__MigTypeCheck=1 -fvisibility=hidden - freorder-blocks -Dmig_external=__private_extern__241 AM_CFLAGS = -F/System/Library/PrivateFrameworks -Wall -Wextra -Waggregate-return -Wfloat-equal -Wshadow -Wpacked -Wpadded -Wstrict-overflow=4 -Wmissing-prototypes -Wmissing-declarations -Werror -D__MigTypeCheck=1 -fvisibility=hidden -Dmig_external=__private_extern__ 242 242 CLEANFILES = protocol_vproc.h protocol_vprocServer.c protocol_vprocUser.c protocol_vprocServer.h \ 243 243 launchd_internal.h launchd_internalServer.h launchd_internalServer.c launchd_internalUser.c \ … … 255 255 @LIBS_ONLY_FALSE@SystemStarter_LDFLAGS = -framework CoreFoundation -framework IOKit 256 256 @LIBS_ONLY_FALSE@SystemStarter_SOURCES = StartupItems.c IPC.c SystemStarter.c 257 @LIBS_ONLY_FALSE@launchd_CFLAGS = -mdynamic-no-pic $(AM_CFLAGS) # -Wconversion # -Wstrict-aliasing=2 -fstrict-aliasing257 @LIBS_ONLY_FALSE@launchd_CFLAGS = -mdynamic-no-pic $(AM_CFLAGS) -freorder-blocks # -fomit-frame-pointer # -Wconversion # -Wstrict-aliasing=2 -fstrict-aliasing 258 258 @LIBS_ONLY_FALSE@launchd_LDFLAGS = -lbsm 259 259 @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 mach_excServer.c -
trunk/launchd/src/launchd.c
r23471 r23479 228 228 229 229 230 int230 INTERNAL_ABI int 231 231 _fd(int fd) 232 232 { … … 243 243 } 244 244 245 void245 INTERNAL_ABI void 246 246 launchd_shutdown(void) 247 247 { … … 272 272 } 273 273 274 void274 INTERNAL_ABI void 275 275 launchd_single_user(void) 276 276 { … … 286 286 } 287 287 288 void288 INTERNAL_ABI void 289 289 launchd_SessionCreate(void) 290 290 { … … 393 393 } 394 394 395 void 395 INTERNAL_ABI bool 396 396 _log_launchd_bug(const char *rcs_rev, const char *path, unsigned int line, const char *test) 397 397 { … … 418 418 419 419 runtime_syslog(LOG_NOTICE, "Bug: %s:%u (%s):%u: %s", file, line, buf, saved_errno, test); 420 } 420 421 return false; 422 } -
trunk/launchd/src/launchd.h
r23470 r23479 36 36 extern bool network_up; 37 37 38 bool init_check_pid(pid_t);38 INTERNAL_ABI bool init_check_pid(pid_t); 39 39 40 launch_data_t launchd_setstdio(int d, launch_data_t o);41 void launchd_SessionCreate(void);42 void launchd_shutdown(void);43 void launchd_single_user(void);40 INTERNAL_ABI launch_data_t launchd_setstdio(int d, launch_data_t o); 41 INTERNAL_ABI void launchd_SessionCreate(void); 42 INTERNAL_ABI void launchd_shutdown(void); 43 INTERNAL_ABI void launchd_single_user(void); 44 44 boolean_t launchd_mach_ipc_demux(mach_msg_header_t *Request, mach_msg_header_t *Reply); 45 45 46 void mach_start_shutdown(void);46 INTERNAL_ABI void mach_start_shutdown(void); 47 47 48 int _fd(int fd);48 INTERNAL_ABI int _fd(int fd); 49 49 50 50 #endif -
trunk/launchd/src/launchd_core_logic.c
r23478 r23479 276 276 277 277 #define jobmgr_assumes(jm, e) \ 278 (likely(e) ? true : jobmgr_log_bug(jm, __LINE__) , false)278 (likely(e) ? true : jobmgr_log_bug(jm, __LINE__)) 279 279 280 280 static jobmgr_t jobmgr_new(jobmgr_t jm, mach_port_t requestorport, mach_port_t transfer_port, bool sflag, const char *name); … … 297 297 static void jobmgr_log(jobmgr_t jm, int pri, const char *msg, ...) __attribute__((format(printf, 3, 4))); 298 298 /* static void jobmgr_log_error(jobmgr_t jm, int pri, const char *msg, ...) __attribute__((format(printf, 3, 4))); */ 299 static voidjobmgr_log_bug(jobmgr_t jm, unsigned int line);299 static bool jobmgr_log_bug(jobmgr_t jm, unsigned int line); 300 300 301 301 #define DO_RUSAGE_SUMMATION 0 … … 376 376 377 377 #define job_assumes(j, e) \ 378 (likely(e) ? true : job_log_bug(j, __LINE__) , false)378 (likely(e) ? true : job_log_bug(j, __LINE__)) 379 379 380 380 static void job_import_keys(launch_data_t obj, const char *key, void *context); … … 418 418 static void job_logv(job_t j, int pri, int err, const char *msg, va_list ap) __attribute__((format(printf, 4, 0))); 419 419 static void job_log_error(job_t j, int pri, const char *msg, ...) __attribute__((format(printf, 3, 4))); 420 static voidjob_log_bug(job_t j, unsigned int line);420 static bool job_log_bug(job_t j, unsigned int line); 421 421 static void job_log_stdouterr2(job_t j, const char *msg, ...); 422 422 static void job_set_exeception_port(job_t j, mach_port_t port); … … 531 531 } 532 532 533 void533 INTERNAL_ABI void 534 534 job_stop(job_t j) 535 535 { … … 549 549 } 550 550 551 launch_data_t551 INTERNAL_ABI launch_data_t 552 552 job_export(job_t j) 553 553 { … … 691 691 } 692 692 693 jobmgr_t693 INTERNAL_ABI jobmgr_t 694 694 jobmgr_shutdown(jobmgr_t jm) 695 695 { … … 774 774 } 775 775 776 void776 INTERNAL_ABI void 777 777 job_remove(job_t j) 778 778 { … … 1274 1274 } 1275 1275 1276 job_t1276 INTERNAL_ABI job_t 1277 1277 job_import(launch_data_t pload) 1278 1278 { … … 1286 1286 } 1287 1287 1288 launch_data_t1288 INTERNAL_ABI launch_data_t 1289 1289 job_import_bulk(launch_data_t pload) 1290 1290 { … … 1896 1896 } 1897 1897 1898 job_t1898 INTERNAL_ABI job_t 1899 1899 job_find(const char *label) 1900 1900 { … … 1965 1965 } 1966 1966 1967 job_t1967 INTERNAL_ABI job_t 1968 1968 job_mig_intran(mach_port_t p) 1969 1969 { … … 1991 1991 } 1992 1992 1993 job_t1993 INTERNAL_ABI job_t 1994 1994 job_find_by_service_port(mach_port_t p) 1995 1995 { … … 2005 2005 } 2006 2006 2007 void2007 INTERNAL_ABI void 2008 2008 job_mig_destructor(job_t j) 2009 2009 { … … 2043 2043 } 2044 2044 2045 launch_data_t2045 INTERNAL_ABI launch_data_t 2046 2046 job_export_all(void) 2047 2047 { … … 2256 2256 } 2257 2257 2258 job_t2258 INTERNAL_ABI job_t 2259 2259 job_dispatch(job_t j, bool kickstart) 2260 2260 { … … 3240 3240 } 3241 3241 3242 void 3242 bool 3243 3243 jobmgr_log_bug(jobmgr_t jm, unsigned int line) 3244 3244 { … … 3264 3264 runtime_syslog(LOG_NOTICE, "Bug: %s:%u (%s):%u", file, line, buf, saved_errno); 3265 3265 } 3266 } 3267 3268 void 3266 3267 return false; 3268 } 3269 3270 bool 3269 3271 job_log_bug(job_t j, unsigned int line) 3270 3272 { … … 3290 3292 runtime_syslog(LOG_NOTICE, "Bug: %s:%u (%s):%u", file, line, buf, saved_errno); 3291 3293 } 3294 3295 return false; 3292 3296 } 3293 3297 … … 3339 3343 } 3340 3344 3341 void3345 INTERNAL_ABI void 3342 3346 job_log(job_t j, int pri, const char *msg, ...) 3343 3347 { … … 4588 4592 } 4589 4593 4590 jobmgr_t4594 INTERNAL_ABI jobmgr_t 4591 4595 jobmgr_delete_anything_with_port(jobmgr_t jm, mach_port_t port) 4592 4596 { … … 4788 4792 } 4789 4793 4790 void4794 INTERNAL_ABI void 4791 4795 job_checkin(job_t j) 4792 4796 { … … 4794 4798 } 4795 4799 4796 bool4800 INTERNAL_ABI bool 4797 4801 job_ack_port_destruction(mach_port_t p) 4798 4802 { … … 4823 4827 } 4824 4828 4825 void4829 INTERNAL_ABI void 4826 4830 job_ack_no_senders(job_t j) 4827 4831 { … … 4846 4850 } 4847 4851 4848 bool4852 INTERNAL_ABI bool 4849 4853 job_is_anonymous(job_t j) 4850 4854 { … … 5065 5069 } 5066 5070 5067 void5071 INTERNAL_ABI void 5068 5072 jobmgr_dispatch_all_semaphores(jobmgr_t jm) 5069 5073 { … … 6667 6671 } 6668 6672 6669 void6673 INTERNAL_ABI void 6670 6674 jobmgr_init(bool sflag) 6671 6675 { -
trunk/launchd/src/launchd_core_logic.h
r23409 r23479 21 21 */ 22 22 23 #include <launchd_runtime.h> 23 24 #include "libbootstrap_public.h" 24 25 #include "liblaunch_public.h" … … 30 31 extern mach_port_t inherited_bootstrap_port; 31 32 32 void jobmgr_init(bool);33 jobmgr_t jobmgr_shutdown(jobmgr_t jm);34 void jobmgr_dispatch_all_semaphores(jobmgr_t jm);35 jobmgr_t jobmgr_delete_anything_with_port(jobmgr_t jm, mach_port_t port);33 INTERNAL_ABI void jobmgr_init(bool); 34 INTERNAL_ABI jobmgr_t jobmgr_shutdown(jobmgr_t jm); 35 INTERNAL_ABI void jobmgr_dispatch_all_semaphores(jobmgr_t jm); 36 INTERNAL_ABI jobmgr_t jobmgr_delete_anything_with_port(jobmgr_t jm, mach_port_t port); 36 37 37 launch_data_t job_export_all(void);38 INTERNAL_ABI launch_data_t job_export_all(void); 38 39 39 job_t job_dispatch(job_t j, bool kickstart); /* returns j on success, NULL on job removal */40 job_t job_find(const char *label);41 job_t job_find_by_service_port(mach_port_t p);42 bool job_ack_port_destruction(mach_port_t p);43 bool job_is_anonymous(job_t j);44 launch_data_t job_export(job_t j);45 void job_stop(job_t j);46 void job_checkin(job_t j);47 void job_remove(job_t j);48 job_t job_import(launch_data_t pload);49 launch_data_t job_import_bulk(launch_data_t pload);50 job_t job_mig_intran(mach_port_t mp);51 void job_mig_destructor(job_t j);52 void job_ack_no_senders(job_t j);53 void job_log(job_t j, int pri, const char *msg, ...) __attribute__((format(printf, 3, 4)));40 INTERNAL_ABI job_t job_dispatch(job_t j, bool kickstart); /* returns j on success, NULL on job removal */ 41 INTERNAL_ABI job_t job_find(const char *label); 42 INTERNAL_ABI job_t job_find_by_service_port(mach_port_t p); 43 INTERNAL_ABI bool job_ack_port_destruction(mach_port_t p); 44 INTERNAL_ABI bool job_is_anonymous(job_t j); 45 INTERNAL_ABI launch_data_t job_export(job_t j); 46 INTERNAL_ABI void job_stop(job_t j); 47 INTERNAL_ABI void job_checkin(job_t j); 48 INTERNAL_ABI void job_remove(job_t j); 49 INTERNAL_ABI job_t job_import(launch_data_t pload); 50 INTERNAL_ABI launch_data_t job_import_bulk(launch_data_t pload); 51 INTERNAL_ABI job_t job_mig_intran(mach_port_t mp); 52 INTERNAL_ABI void job_mig_destructor(job_t j); 53 INTERNAL_ABI void job_ack_no_senders(job_t j); 54 INTERNAL_ABI void job_log(job_t j, int pri, const char *msg, ...) __attribute__((format(printf, 3, 4))); 54 55 55 56 #endif -
trunk/launchd/src/launchd_runtime.c
r23477 r23479 123 123 124 124 125 mach_port_t125 INTERNAL_ABI mach_port_t 126 126 runtime_get_kernel_port(void) 127 127 { … … 133 133 134 134 135 void135 INTERNAL_ABI void 136 136 launchd_runtime_init(void) 137 137 { … … 168 168 } 169 169 170 void170 INTERNAL_ABI void 171 171 launchd_runtime_init2(void) 172 172 { … … 198 198 } 199 199 200 const char *200 INTERNAL_ABI const char * 201 201 proc_flags_to_C_names(unsigned int flags) 202 202 { … … 262 262 } 263 263 264 const char *264 INTERNAL_ABI const char * 265 265 reboot_flags_to_C_names(unsigned int flags) 266 266 { … … 301 301 } 302 302 303 const char *303 INTERNAL_ABI const char * 304 304 signal_to_C_name(unsigned int sig) 305 305 { … … 622 622 623 623 624 void624 INTERNAL_ABI void 625 625 launchd_runtime(void) 626 626 { … … 654 654 } 655 655 656 kern_return_t656 INTERNAL_ABI kern_return_t 657 657 launchd_set_bport(mach_port_t name) 658 658 { … … 660 660 } 661 661 662 kern_return_t662 INTERNAL_ABI kern_return_t 663 663 launchd_get_bport(mach_port_t *name) 664 664 { … … 666 666 } 667 667 668 kern_return_t668 INTERNAL_ABI kern_return_t 669 669 launchd_mport_notify_req(mach_port_t name, mach_msg_id_t which) 670 670 { … … 690 690 } 691 691 692 pid_t692 INTERNAL_ABI pid_t 693 693 runtime_fork(mach_port_t bsport) 694 694 { … … 728 728 729 729 730 void730 INTERNAL_ABI void 731 731 runtime_set_timeout(timeout_callback to_cb, unsigned int sec) 732 732 { … … 740 740 } 741 741 742 kern_return_t742 INTERNAL_ABI kern_return_t 743 743 runtime_add_mport(mach_port_t name, mig_callback demux, mach_msg_size_t msg_size) 744 744 { … … 774 774 } 775 775 776 kern_return_t776 INTERNAL_ABI kern_return_t 777 777 runtime_remove_mport(mach_port_t name) 778 778 { … … 782 782 } 783 783 784 kern_return_t784 INTERNAL_ABI kern_return_t 785 785 launchd_mport_make_send(mach_port_t name) 786 786 { … … 788 788 } 789 789 790 kern_return_t790 INTERNAL_ABI kern_return_t 791 791 launchd_mport_close_recv(mach_port_t name) 792 792 { … … 794 794 } 795 795 796 kern_return_t796 INTERNAL_ABI kern_return_t 797 797 launchd_mport_create_recv(mach_port_t *name) 798 798 { … … 800 800 } 801 801 802 kern_return_t802 INTERNAL_ABI kern_return_t 803 803 launchd_mport_deallocate(mach_port_t name) 804 804 { … … 806 806 } 807 807 808 int808 INTERNAL_ABI int 809 809 kevent_bulk_mod(struct kevent *kev, size_t kev_cnt) 810 810 { … … 818 818 } 819 819 820 int820 INTERNAL_ABI int 821 821 kevent_mod(uintptr_t ident, short filter, u_short flags, u_int fflags, intptr_t data, void *udata) 822 822 { … … 967 967 } 968 968 969 bool969 INTERNAL_ABI bool 970 970 runtime_get_caller_creds(struct ldcred *ldc) 971 971 { … … 1099 1099 } 1100 1100 1101 int1101 INTERNAL_ABI int 1102 1102 runtime_close(int fd) 1103 1103 { … … 1109 1109 case EVFILT_WRITE: 1110 1110 case EVFILT_READ: 1111 if ( (int)bulk_kev[i].ident == fd) {1111 if (unlikely((int)bulk_kev[i].ident == fd)) { 1112 1112 runtime_syslog(LOG_DEBUG, "Skipping kevent index: %d", i); 1113 1113 bulk_kev[i].filter = 0; … … 1121 1121 } 1122 1122 1123 void1123 INTERNAL_ABI void 1124 1124 runtime_closelog(void) 1125 1125 { … … 1132 1132 } 1133 1133 1134 int1134 INTERNAL_ABI int 1135 1135 runtime_fsync(int fd) 1136 1136 { … … 1146 1146 } 1147 1147 1148 int1148 INTERNAL_ABI int 1149 1149 runtime_setlogmask(int maskpri) 1150 1150 { … … 1154 1154 } 1155 1155 1156 void1156 INTERNAL_ABI void 1157 1157 runtime_syslog(int pri, const char *message, ...) 1158 1158 { … … 1171 1171 } 1172 1172 1173 void1173 INTERNAL_ABI void 1174 1174 runtime_vsyslog(struct runtime_syslog_attr *attr, const char *message, va_list args) 1175 1175 { … … 1315 1315 #endif 1316 1316 1317 void1317 INTERNAL_ABI void 1318 1318 runtime_log_push(void) 1319 1319 { … … 1369 1369 } 1370 1370 1371 kern_return_t1371 INTERNAL_ABI kern_return_t 1372 1372 runtime_log_forward(uid_t forward_uid, gid_t forward_gid, vm_offset_t inval, mach_msg_type_number_t invalCnt) 1373 1373 { … … 1405 1405 } 1406 1406 1407 kern_return_t1407 INTERNAL_ABI kern_return_t 1408 1408 runtime_log_drain(mach_port_t srp, vm_offset_t *outval, mach_msg_type_number_t *outvalCnt) 1409 1409 { … … 1429 1429 * process can and should exit. 1430 1430 */ 1431

