Projects
Browse Source     Search     Timeline     Wiki

Changeset 23479

Show
Ignore:
Timestamp:
01/09/08 14:18:09 (11 months ago)
Author:
zarzycki@…
Message:

We should use a better internal ABI when we can.

Location:
trunk/launchd/src
Files:
9 modified

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__ 
     1AM_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__ 
    22 
    33CLEANFILES = protocol_vproc.h protocol_vprocServer.c protocol_vprocUser.c protocol_vprocServer.h                \ 
     
    4747SystemStarter_SOURCES = StartupItems.c IPC.c SystemStarter.c 
    4848 
    49 launchd_CFLAGS = -mdynamic-no-pic $(AM_CFLAGS) # -Wconversion # -Wstrict-aliasing=2 -fstrict-aliasing 
     49launchd_CFLAGS = -mdynamic-no-pic $(AM_CFLAGS) -freorder-blocks # -fomit-frame-pointer # -Wconversion # -Wstrict-aliasing=2 -fstrict-aliasing 
    5050launchd_LDFLAGS = -lbsm 
    5151launchd_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  
    239239top_builddir = @top_builddir@ 
    240240top_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__ 
     241AM_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__ 
    242242CLEANFILES = protocol_vproc.h protocol_vprocServer.c protocol_vprocUser.c protocol_vprocServer.h                \ 
    243243             launchd_internal.h launchd_internalServer.h launchd_internalServer.c launchd_internalUser.c        \ 
     
    255255@LIBS_ONLY_FALSE@SystemStarter_LDFLAGS = -framework CoreFoundation -framework IOKit 
    256256@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-aliasing 
     257@LIBS_ONLY_FALSE@launchd_CFLAGS = -mdynamic-no-pic $(AM_CFLAGS) -freorder-blocks # -fomit-frame-pointer # -Wconversion # -Wstrict-aliasing=2 -fstrict-aliasing 
    258258@LIBS_ONLY_FALSE@launchd_LDFLAGS = -lbsm 
    259259@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  
    228228 
    229229 
    230 int 
     230INTERNAL_ABI int 
    231231_fd(int fd) 
    232232{ 
     
    243243} 
    244244 
    245 void 
     245INTERNAL_ABI void 
    246246launchd_shutdown(void) 
    247247{ 
     
    272272} 
    273273 
    274 void 
     274INTERNAL_ABI void 
    275275launchd_single_user(void) 
    276276{ 
     
    286286} 
    287287 
    288 void 
     288INTERNAL_ABI void 
    289289launchd_SessionCreate(void) 
    290290{ 
     
    393393} 
    394394 
    395 void 
     395INTERNAL_ABI bool 
    396396_log_launchd_bug(const char *rcs_rev, const char *path, unsigned int line, const char *test) 
    397397{ 
     
    418418 
    419419        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  
    3636extern bool network_up; 
    3737 
    38 bool init_check_pid(pid_t); 
     38INTERNAL_ABI bool init_check_pid(pid_t); 
    3939 
    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); 
     40INTERNAL_ABI launch_data_t launchd_setstdio(int d, launch_data_t o); 
     41INTERNAL_ABI void launchd_SessionCreate(void); 
     42INTERNAL_ABI void launchd_shutdown(void); 
     43INTERNAL_ABI void launchd_single_user(void); 
    4444boolean_t launchd_mach_ipc_demux(mach_msg_header_t *Request, mach_msg_header_t *Reply); 
    4545 
    46 void mach_start_shutdown(void); 
     46INTERNAL_ABI void mach_start_shutdown(void); 
    4747 
    48 int _fd(int fd); 
     48INTERNAL_ABI int _fd(int fd); 
    4949 
    5050#endif 
  • trunk/launchd/src/launchd_core_logic.c

    r23478 r23479  
    276276 
    277277#define jobmgr_assumes(jm, e)   \ 
    278         (likely(e) ? true : jobmgr_log_bug(jm, __LINE__), false) 
     278        (likely(e) ? true : jobmgr_log_bug(jm, __LINE__)) 
    279279 
    280280static jobmgr_t jobmgr_new(jobmgr_t jm, mach_port_t requestorport, mach_port_t transfer_port, bool sflag, const char *name); 
     
    297297static void jobmgr_log(jobmgr_t jm, int pri, const char *msg, ...) __attribute__((format(printf, 3, 4))); 
    298298/* static void jobmgr_log_error(jobmgr_t jm, int pri, const char *msg, ...) __attribute__((format(printf, 3, 4))); */ 
    299 static void jobmgr_log_bug(jobmgr_t jm, unsigned int line); 
     299static bool jobmgr_log_bug(jobmgr_t jm, unsigned int line); 
    300300 
    301301#define DO_RUSAGE_SUMMATION 0 
     
    376376 
    377377#define job_assumes(j, e)       \ 
    378         (likely(e) ? true : job_log_bug(j, __LINE__), false) 
     378        (likely(e) ? true : job_log_bug(j, __LINE__)) 
    379379 
    380380static void job_import_keys(launch_data_t obj, const char *key, void *context); 
     
    418418static void job_logv(job_t j, int pri, int err, const char *msg, va_list ap) __attribute__((format(printf, 4, 0))); 
    419419static void job_log_error(job_t j, int pri, const char *msg, ...) __attribute__((format(printf, 3, 4))); 
    420 static void job_log_bug(job_t j, unsigned int line); 
     420static bool job_log_bug(job_t j, unsigned int line); 
    421421static void job_log_stdouterr2(job_t j, const char *msg, ...); 
    422422static void job_set_exeception_port(job_t j, mach_port_t port); 
     
    531531} 
    532532 
    533 void 
     533INTERNAL_ABI void 
    534534job_stop(job_t j) 
    535535{ 
     
    549549} 
    550550 
    551 launch_data_t 
     551INTERNAL_ABI launch_data_t 
    552552job_export(job_t j) 
    553553{ 
     
    691691} 
    692692 
    693 jobmgr_t 
     693INTERNAL_ABI jobmgr_t 
    694694jobmgr_shutdown(jobmgr_t jm) 
    695695{ 
     
    774774} 
    775775 
    776 void 
     776INTERNAL_ABI void 
    777777job_remove(job_t j) 
    778778{ 
     
    12741274} 
    12751275 
    1276 job_t  
     1276INTERNAL_ABI job_t  
    12771277job_import(launch_data_t pload) 
    12781278{ 
     
    12861286} 
    12871287 
    1288 launch_data_t 
     1288INTERNAL_ABI launch_data_t 
    12891289job_import_bulk(launch_data_t pload) 
    12901290{ 
     
    18961896} 
    18971897 
    1898 job_t  
     1898INTERNAL_ABI job_t  
    18991899job_find(const char *label) 
    19001900{ 
     
    19651965} 
    19661966 
    1967 job_t  
     1967INTERNAL_ABI job_t  
    19681968job_mig_intran(mach_port_t p) 
    19691969{ 
     
    19911991} 
    19921992 
    1993 job_t 
     1993INTERNAL_ABI job_t 
    19941994job_find_by_service_port(mach_port_t p) 
    19951995{ 
     
    20052005} 
    20062006 
    2007 void 
     2007INTERNAL_ABI void 
    20082008job_mig_destructor(job_t j) 
    20092009{ 
     
    20432043} 
    20442044 
    2045 launch_data_t 
     2045INTERNAL_ABI launch_data_t 
    20462046job_export_all(void) 
    20472047{ 
     
    22562256} 
    22572257 
    2258 job_t 
     2258INTERNAL_ABI job_t 
    22592259job_dispatch(job_t j, bool kickstart) 
    22602260{ 
     
    32403240} 
    32413241 
    3242 void 
     3242bool 
    32433243jobmgr_log_bug(jobmgr_t jm, unsigned int line) 
    32443244{ 
     
    32643264                runtime_syslog(LOG_NOTICE, "Bug: %s:%u (%s):%u", file, line, buf, saved_errno); 
    32653265        } 
    3266 } 
    3267  
    3268 void 
     3266 
     3267        return false; 
     3268} 
     3269 
     3270bool 
    32693271job_log_bug(job_t j, unsigned int line) 
    32703272{ 
     
    32903292                runtime_syslog(LOG_NOTICE, "Bug: %s:%u (%s):%u", file, line, buf, saved_errno); 
    32913293        } 
     3294 
     3295        return false; 
    32923296} 
    32933297 
     
    33393343} 
    33403344 
    3341 void 
     3345INTERNAL_ABI void 
    33423346job_log(job_t j, int pri, const char *msg, ...) 
    33433347{ 
     
    45884592} 
    45894593 
    4590 jobmgr_t 
     4594INTERNAL_ABI jobmgr_t 
    45914595jobmgr_delete_anything_with_port(jobmgr_t jm, mach_port_t port) 
    45924596{ 
     
    47884792} 
    47894793 
    4790 void 
     4794INTERNAL_ABI void 
    47914795job_checkin(job_t j) 
    47924796{ 
     
    47944798} 
    47954799 
    4796 bool 
     4800INTERNAL_ABI bool 
    47974801job_ack_port_destruction(mach_port_t p) 
    47984802{ 
     
    48234827} 
    48244828 
    4825 void 
     4829INTERNAL_ABI void 
    48264830job_ack_no_senders(job_t j) 
    48274831{ 
     
    48464850} 
    48474851 
    4848 bool 
     4852INTERNAL_ABI bool 
    48494853job_is_anonymous(job_t j) 
    48504854{ 
     
    50655069} 
    50665070 
    5067 void 
     5071INTERNAL_ABI void 
    50685072jobmgr_dispatch_all_semaphores(jobmgr_t jm) 
    50695073{ 
     
    66676671} 
    66686672 
    6669 void 
     6673INTERNAL_ABI void 
    66706674jobmgr_init(bool sflag) 
    66716675{ 
  • trunk/launchd/src/launchd_core_logic.h

    r23409 r23479  
    2121 */ 
    2222 
     23#include <launchd_runtime.h> 
    2324#include "libbootstrap_public.h" 
    2425#include "liblaunch_public.h" 
     
    3031extern mach_port_t inherited_bootstrap_port; 
    3132 
    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); 
     33INTERNAL_ABI void jobmgr_init(bool); 
     34INTERNAL_ABI jobmgr_t jobmgr_shutdown(jobmgr_t jm); 
     35INTERNAL_ABI void jobmgr_dispatch_all_semaphores(jobmgr_t jm); 
     36INTERNAL_ABI jobmgr_t jobmgr_delete_anything_with_port(jobmgr_t jm, mach_port_t port); 
    3637 
    37 launch_data_t job_export_all(void); 
     38INTERNAL_ABI launch_data_t job_export_all(void); 
    3839 
    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))); 
     40INTERNAL_ABI job_t job_dispatch(job_t j, bool kickstart); /* returns j on success, NULL on job removal */ 
     41INTERNAL_ABI job_t job_find(const char *label); 
     42INTERNAL_ABI job_t job_find_by_service_port(mach_port_t p); 
     43INTERNAL_ABI bool job_ack_port_destruction(mach_port_t p); 
     44INTERNAL_ABI bool job_is_anonymous(job_t j); 
     45INTERNAL_ABI launch_data_t job_export(job_t j); 
     46INTERNAL_ABI void job_stop(job_t j); 
     47INTERNAL_ABI void job_checkin(job_t j); 
     48INTERNAL_ABI void job_remove(job_t j); 
     49INTERNAL_ABI job_t job_import(launch_data_t pload); 
     50INTERNAL_ABI launch_data_t job_import_bulk(launch_data_t pload); 
     51INTERNAL_ABI job_t job_mig_intran(mach_port_t mp); 
     52INTERNAL_ABI void job_mig_destructor(job_t j); 
     53INTERNAL_ABI void job_ack_no_senders(job_t j); 
     54INTERNAL_ABI void job_log(job_t j, int pri, const char *msg, ...) __attribute__((format(printf, 3, 4))); 
    5455 
    5556#endif 
  • trunk/launchd/src/launchd_runtime.c

    r23477 r23479  
    123123 
    124124 
    125 mach_port_t 
     125INTERNAL_ABI mach_port_t 
    126126runtime_get_kernel_port(void) 
    127127{ 
     
    133133 
    134134 
    135 void 
     135INTERNAL_ABI void 
    136136launchd_runtime_init(void) 
    137137{ 
     
    168168} 
    169169 
    170 void 
     170INTERNAL_ABI void 
    171171launchd_runtime_init2(void) 
    172172{ 
     
    198198} 
    199199 
    200 const char * 
     200INTERNAL_ABI const char * 
    201201proc_flags_to_C_names(unsigned int flags) 
    202202{ 
     
    262262} 
    263263 
    264 const char * 
     264INTERNAL_ABI const char * 
    265265reboot_flags_to_C_names(unsigned int flags) 
    266266{ 
     
    301301} 
    302302 
    303 const char * 
     303INTERNAL_ABI const char * 
    304304signal_to_C_name(unsigned int sig) 
    305305{ 
     
    622622 
    623623 
    624 void 
     624INTERNAL_ABI void 
    625625launchd_runtime(void) 
    626626{ 
     
    654654} 
    655655 
    656 kern_return_t 
     656INTERNAL_ABI kern_return_t 
    657657launchd_set_bport(mach_port_t name) 
    658658{ 
     
    660660} 
    661661 
    662 kern_return_t 
     662INTERNAL_ABI kern_return_t 
    663663launchd_get_bport(mach_port_t *name) 
    664664{ 
     
    666666} 
    667667 
    668 kern_return_t 
     668INTERNAL_ABI kern_return_t 
    669669launchd_mport_notify_req(mach_port_t name, mach_msg_id_t which) 
    670670{ 
     
    690690} 
    691691 
    692 pid_t 
     692INTERNAL_ABI pid_t 
    693693runtime_fork(mach_port_t bsport) 
    694694{ 
     
    728728 
    729729 
    730 void 
     730INTERNAL_ABI void 
    731731runtime_set_timeout(timeout_callback to_cb, unsigned int sec) 
    732732{ 
     
    740740} 
    741741 
    742 kern_return_t 
     742INTERNAL_ABI kern_return_t 
    743743runtime_add_mport(mach_port_t name, mig_callback demux, mach_msg_size_t msg_size) 
    744744{ 
     
    774774} 
    775775 
    776 kern_return_t 
     776INTERNAL_ABI kern_return_t 
    777777runtime_remove_mport(mach_port_t name) 
    778778{ 
     
    782782} 
    783783 
    784 kern_return_t 
     784INTERNAL_ABI kern_return_t 
    785785launchd_mport_make_send(mach_port_t name) 
    786786{ 
     
    788788} 
    789789 
    790 kern_return_t 
     790INTERNAL_ABI kern_return_t 
    791791launchd_mport_close_recv(mach_port_t name) 
    792792{ 
     
    794794} 
    795795 
    796 kern_return_t 
     796INTERNAL_ABI kern_return_t 
    797797launchd_mport_create_recv(mach_port_t *name) 
    798798{ 
     
    800800} 
    801801 
    802 kern_return_t 
     802INTERNAL_ABI kern_return_t 
    803803launchd_mport_deallocate(mach_port_t name) 
    804804{ 
     
    806806} 
    807807 
    808 int 
     808INTERNAL_ABI int 
    809809kevent_bulk_mod(struct kevent *kev, size_t kev_cnt) 
    810810{ 
     
    818818} 
    819819 
    820 int 
     820INTERNAL_ABI int 
    821821kevent_mod(uintptr_t ident, short filter, u_short flags, u_int fflags, intptr_t data, void *udata) 
    822822{ 
     
    967967} 
    968968 
    969 bool 
     969INTERNAL_ABI bool 
    970970runtime_get_caller_creds(struct ldcred *ldc) 
    971971{ 
     
    10991099} 
    11001100 
    1101 int 
     1101INTERNAL_ABI int 
    11021102runtime_close(int fd) 
    11031103{ 
     
    11091109                case EVFILT_WRITE: 
    11101110                case EVFILT_READ: 
    1111                         if ((int)bulk_kev[i].ident == fd) { 
     1111                        if (unlikely((int)bulk_kev[i].ident == fd)) { 
    11121112                                runtime_syslog(LOG_DEBUG, "Skipping kevent index: %d", i); 
    11131113                                bulk_kev[i].filter = 0; 
     
    11211121} 
    11221122 
    1123 void 
     1123INTERNAL_ABI void 
    11241124runtime_closelog(void) 
    11251125{ 
     
    11321132} 
    11331133 
    1134 int 
     1134INTERNAL_ABI int 
    11351135runtime_fsync(int fd) 
    11361136{ 
     
    11461146} 
    11471147 
    1148 int 
     1148INTERNAL_ABI int 
    11491149runtime_setlogmask(int maskpri) 
    11501150{ 
     
    11541154} 
    11551155 
    1156 void 
     1156INTERNAL_ABI void 
    11571157runtime_syslog(int pri, const char *message, ...) 
    11581158{ 
     
    11711171} 
    11721172 
    1173 void 
     1173INTERNAL_ABI void 
    11741174runtime_vsyslog(struct runtime_syslog_attr *attr, const char *message, va_list args) 
    11751175{ 
     
    13151315#endif 
    13161316 
    1317 void 
     1317INTERNAL_ABI void 
    13181318runtime_log_push(void) 
    13191319{ 
     
    13691369} 
    13701370 
    1371 kern_return_t 
     1371INTERNAL_ABI kern_return_t 
    13721372runtime_log_forward(uid_t forward_uid, gid_t forward_gid, vm_offset_t inval, mach_msg_type_number_t invalCnt) 
    13731373{ 
     
    14051405} 
    14061406 
    1407 kern_return_t 
     1407INTERNAL_ABI kern_return_t 
    14081408runtime_log_drain(mach_port_t srp, vm_offset_t *outval, mach_msg_type_number_t *outvalCnt) 
    14091409{ 
     
    14291429 * process can and should exit. 
    14301430 */ 
    1431